Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OFF-EP-0010 #61

Merged
merged 11 commits into from
Apr 3, 2024
Merged

OFF-EP-0010 #61

merged 11 commits into from
Apr 3, 2024

Conversation

lilyminium
Copy link
Contributor

@lilyminium lilyminium commented Feb 7, 2024

Fixes #60
Resolves #59

This PR:
- clarifies and defines idivf
- defines how the dihedral should be calculated
- adds a warning flagging that ProperTorsion SMIRKS are symmetric across the central bond

As John pointed out, a dihedral angle from i-j-k-l should evaluate the same as from l-k-j-i, at least using our definition. I'm 99% sure that this should always be the case, and also briefly checked was true at least for OpenMM -- but thought it may be worth including the warning anyway just in case there's engines where for any reason this is not the case.

@lilyminium lilyminium marked this pull request as ready for review February 8, 2024 05:40

## Motivation and Scope

A ProperTorsion is defined between a connected quartet of atoms i-j-k-l. The dihedral angle can be calculated using input vectors in two directions: ($r_{ij}$, $r_{jk}$, $r_{kl}$) or ($r_{ij}$, $r_{kl}$, $r_{kl}$), where $r_{ij} = x_{j} - x{i}$. It is currently unclear which standard to follow. While both directions yield the same result for symmetric torsions where the phase is 0 or pi, the choice of direction affects the sign for asymmetric torsions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean by "The dihedral angle can be calculated using input vectors in two directions:" where you give triples of vectors (a, b, c). Can you give an explicit mathematical expression for the dihedral angle phi in terms of these vectors (a,b,c)?

Also, the second ($r_{ij}$, $r_{kl}$, $r_{kl}$) contains two repeated vectors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this section to a more qualitative description in words, and left the mathematical definition for the detailed description / specification itself.


A ProperTorsion is defined between a connected quartet of atoms i-j-k-l. The dihedral angle can be calculated using input vectors in two directions: ($r_{ij}$, $r_{jk}$, $r_{kl}$) or ($r_{ij}$, $r_{kl}$, $r_{kl}$), where $r_{ij} = x_{j} - x{i}$. It is currently unclear which standard to follow. While both directions yield the same result for symmetric torsions where the phase is 0 or pi, the choice of direction affects the sign for asymmetric torsions.

In addition, ProperTorsions are matched symmetrically, even if the SMIRKS pattern is written asymmetrically; no order is guaranteed in applying the torsion parameter. While atom order does not affect the angle calculation in many implementations, it is important to highlight this potentially undefined behaviour in case some software does take atom order into account.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, ProperTorsions are matched symmetrically, even if the SMIRKS pattern is written asymmetrically;

Since this is an implementation detail, it may be more useful to say something like "A SMIRKS patterns that can match a particular bonded quartet in either i-j-k-l or l-k-j-i order is ambiguous, and the specification cannot guarantee the match will be performed in any predetermined or deterministic order, potentially leading to undesired results."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks John, that's much clearer -- I've changed the wording accordingly!

Copy link

@davidlmobley davidlmobley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, seems clear, and removes/fixes the issues present in the current spec. I approve.

@mattwthompson
Copy link
Member

I'm removing myself as a reviewer as I'm not a member of the committee. I glanced through the linked notes from the September meeting and don't think there's an explicit call-out for what to do when a member of the committee submitting their own proposal. (Still, I figure that it's reasonable to assume an author approves of their own work and 3/3 counts as 4/4.)

In passing my, feedback on the "auto" section is positive and I'm confused about the directionality section for reasons other than this change (namely that I haven't thought through it).

@mattwthompson mattwthompson removed their request for review February 19, 2024 19:00
Copy link
Member

@j-wags j-wags left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks @lilyminium! I read through this and rendered locally and everything looks good. Great writeup.

docs/enhancement-proposals/off-ep-0010.md Outdated Show resolved Hide resolved
docs/standards/smirnoff.md Outdated Show resolved Hide resolved
docs/standards/smirnoff.md Outdated Show resolved Hide resolved
docs/standards/smirnoff.md Outdated Show resolved Hide resolved
Copy link
Member

@jchodera jchodera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some comments that aim to clarify the conventions we are using and the clarity of the text.

This is one of those cases where a figure illustrating a case we are concerned about and how we define the sign convention would be really valuable.

docs/enhancement-proposals/off-ep-0010.md Outdated Show resolved Hide resolved
> defined by the four atoms of the torsion `i-j-k-l`.
> Where the vector ``r_ij`` is defined as the vector from atom `j` to atom `i`:
> ```
> r_ij = x_i - x_j
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definition is backwards, isn't it? This vector points from j to i

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- I chose to call it r_ij instead of r_ji for easier comparison to OpenMM's implementation, which also names vectors like that, but happy to switch to r_ji instead if that reads better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which OpenMM docs are you referring to? This is not in the OpenMM User Guide.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use standard vector notation r_ij = x_j - x_i

> r_ij = x_i - x_j
> ```
> the angle ``theta`` should be calculated using the input vectors ``r_ij``, ``r_kj``, and ``r_kl``.
> The directionality or sign of the angle is determined by comparing the `r_ij` vector to the `u_jkl` plane. If the angle is acute, the sign is positive; if obtuse, the sign is negative.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement is confusing to me. Can we drop it and let the math speak for itself? Or add a figure?

docs/enhancement-proposals/off-ep-0010.md Outdated Show resolved Hide resolved
docs/enhancement-proposals/off-ep-0010.md Outdated Show resolved Hide resolved
Copy link
Member

@jchodera jchodera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer standard vector notation, but this is great!

> defined by the four atoms of the torsion `i-j-k-l`.
> Where the vector ``r_ij`` is defined as the vector from atom `j` to atom `i`:
> ```
> r_ij = x_i - x_j
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which OpenMM docs are you referring to? This is not in the OpenMM User Guide.

> defined by the four atoms of the torsion `i-j-k-l`.
> Where the vector ``r_ij`` is defined as the vector from atom `j` to atom `i`:
> ```
> r_ij = x_i - x_j
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use standard vector notation r_ij = x_j - x_i

@lilyminium
Copy link
Contributor Author

Changed the notation -- thank you for the reviews, everyone!

@lilyminium lilyminium merged commit 4395111 into main Apr 3, 2024
1 check passed
@lilyminium lilyminium deleted the off-ep-0010 branch April 3, 2024 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Description of default_idivf="auto" not in accordance with community understanding Define or remove idivf
5 participants