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

Topology readers are not aware of virtual sites #1954

Open
jbarnoud opened this issue Jun 23, 2018 · 6 comments
Open

Topology readers are not aware of virtual sites #1954

jbarnoud opened this issue Jun 23, 2018 · 6 comments

Comments

@jbarnoud
Copy link
Contributor

Virtual sites are atoms the coordinates of which are built frame by frame from the coordinates of other atoms. MDAnalysis reads the coordinates of these atoms as for any other ones. Yet, it does not read the connection between the virtual sites and the atoms they are built from. Therefore, the virtual sites appear as not connected to the rest of the molecule which breaks the expected behaviour of ag.fragments and make_whole.

A solution would be to have a VirtualSites topology attribute that connects the relevant atoms. With the relationship described, the appropriate edges can be added to the graph used by ag.fragments and make_whole can translate the virtual sites with the building atoms. The difficulty is that virtual sites can be built from any number of atoms, yet from my tests, TopologyGroups store the indices as an array of ints. I do not know if it is possible to make a TopologyGroup with an array of lists (dtype=object) instead.

Note that virtual sites are especially used by gromacs, and I have the TPR reader in mind, but they seem to exist in other simulation engines.

See #1949 and #588.

@orbeckst
Copy link
Member

The issue that TIP4P is not recognized as a fragment (details in #1949) makes the "make whole" transformation PR #2038 not correctly wrap typical OPLS-AA simulation systems (such as our TPR/XTC test trajectory).

@orbeckst
Copy link
Member

Let me summarize the discussion on #3168 (based @BartBruininks initial implementation of virtual sites as additional bonded interactions in PR #4318 and on @jbarnoud 's #3168 (comment) , @hejamu 's #3168 (comment) , and @mattwthompson '#3168 (comment) )

  • Reading vsites and adding the dummy particles as bonded particles to the topology is straightforward and works, PR adds vsites as bonds between base particles and vsite #4318.
  • However, there's broad consensus that it's important to not confuse dummies/vsites with real atoms and chemical bonds because
    1. it makes the actual chemistry confusing,
    2. implementations of vsites differ between codes so a flexible/customizable solution is needed

How to implement vsites? — essentially what @jbarnoud said at the top of this issue:

vsites should be tracked with a separate TopologyAttr, i.e., add the virtual site to a new VirtualSites topology attribute (to be defined in mda.core.topologyattrs) that would look very similar to the Bonds topology attribute. (This would resolve #588 .)

In order to support the functionality required to solve #3168 (unwrapping), the function that builds the fragments (which is a method of the Bonds topology attribute defined in mda.core.topologyattrs) is changed to account for the virtual sites in addition to the bonds.

@BartBruininks
Copy link
Contributor

BartBruininks commented Oct 15, 2023 via email

@jbarnoud
Copy link
Contributor Author

As you said, virtual sites do not all involve the same number of particles, and therefore cannot be stored all in one array if we store them one site per row. The way I understand it, you came to the same conclusion as I did: store vsites as pairs of particles with the first particle being the site and the second being one of the particles from which it is built.

@orbeckst
Copy link
Member

@BartBruininks is this sufficient information to make progress on PR #4318 ?

@BartBruininks
Copy link
Contributor

BartBruininks commented Feb 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants