akohlmey / topotools

VMD plugin for manipulating topology information
Other
28 stars 16 forks source link

Fixed bug in handling of non-orthogonal unit cells in replicatemol() #11

Closed EfremBraun closed 7 years ago

EfremBraun commented 7 years ago

I believe there's a bug in how TopoTools handles non-orthogonal unit cells in the replicatemol() function. If you load the attached pdb file, run "replicatemol 1 1 2", and look at the result, you'll see two atoms that are only 0.828 Angstroms away from each other across the unit cell boundary. If I take the same pdb file and replicate it in Mercury, this does not occur.

bug-illustration.pdb.txt

I believe I've traced the bug to this little typo. If you look at http://lammps.sandia.gov/doc/Section_howto.html#howto-12, it says that c_y=(B\dotC-b_xc_x)/b_y. The dot product of B and C is BCcos(alpha), not BC*cos(beta).

I tested the change in my local distribution, and the atoms no longer overlap.

akohlmey commented 7 years ago

Yup. Thanks a lot.