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

Minimum image code in NAMD/VMD is not robust to strongly tilted PBCs #160

Open
jhenin opened this issue Jun 26, 2018 · 7 comments
Open

Minimum image code in NAMD/VMD is not robust to strongly tilted PBCs #160

jhenin opened this issue Jun 26, 2018 · 7 comments

Comments

@jhenin
Copy link
Member

jhenin commented Jun 26, 2018

The minimum image code found in position_distance() assumes angles close to 90°. In one example, it fails with an angle at 72° and a distance a little smaller that the half box size, but works if the angle is set to 73°.

This could be handled as an error condition, or with more sophisticated PBC code.

@giacomofiorin
Copy link
Member

giacomofiorin commented Jun 26, 2018

To elaborate (also following private chat), the NAMD function uses the Lattice::delta() method from NAMD, i.e. the error arises from NAMD itself. The function colvarproxy::position_distance() referenced here is only used by VMD right now.

@jhenin
Copy link
Member Author

jhenin commented Feb 28, 2019

In-person conversation JH & GF: need to bring this up with NAMD developers.

@jhenin
Copy link
Member Author

jhenin commented Mar 27, 2019

Here is a minimalist example. Pathological behavior happens around the half box size. Here, a distance that is exactly half the box length in y becomes 0.
PBC_bug_example.zip

@jhenin
Copy link
Member Author

jhenin commented Apr 4, 2019

Comment from Jim Phillips:

The Lattice::delta() function is meant for things like bonded terms. If you want the true nearest image you want a variant of Lattice::wrap_nearest_delta().

@giacomofiorin
Copy link
Member

That function adds a loop over the 26 nearest unit cells, so it may work for tilt factors a bit over 1/2 (60°), but probably not much higher. @jhenin How much tilt factor were you worried about here?

Note that the additional loop will add a bit of overhead, so a variant will be more useful than the general function (probably a template, with a flag indicating triclinic PBCs as one of its arguments).

@jhenin
Copy link
Member Author

jhenin commented Apr 4, 2019

I suppose the question is: how much tilt factor should Colvars support? The case that initially brought the issue to my attention was a truncated octahedral box. I think it is reasonable to support any case that is covered by a search over neighboring unit cells.

@giacomofiorin
Copy link
Member

Agreed. There should be an error thrown if the tilt factor exceeds 1 in absolute value.

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

2 participants