"...ssh:/git@developer.sourcefind.cn:2222/tsoc/openmm.git" did not exist on "b8f6d2699631a4b47b03a8884e8cfad27b96ce59"
Commit d9e09633 authored by Jason Swails's avatar Jason Swails
Browse files

Finish the last commit. Make sure the box vector calculation from the lengths

and angles makes numbers exactly 0 that _should_ be zero (but aren't due to
precision and round-off issues).

Now the box vector code in the prmtop file is fully general for every type of
box that Amber supports.
parent d39325d3
...@@ -141,7 +141,8 @@ class AmberPrmtopFile(object): ...@@ -141,7 +141,8 @@ class AmberPrmtopFile(object):
# Set the periodic box size. # Set the periodic box size.
if prmtop.getIfBox(): if prmtop.getIfBox():
top.setUnitCellDimensions(tuple(x.value_in_unit(unit.nanometer) for x in prmtop.getBoxBetaAndDimensions()[1:4])*unit.nanometer) conv = (1.0 * unit.angstrom).value_in_unit(unit.nanometer)
top.setUnitCellDimensions(tuple(x*conv for x in prmtop.getBoxBetaAndDimensions()[1:4])*unit.nanometer)
def createSystem(self, nonbondedMethod=ff.NoCutoff, nonbondedCutoff=1.0*unit.nanometer, def createSystem(self, nonbondedMethod=ff.NoCutoff, nonbondedCutoff=1.0*unit.nanometer,
constraints=None, rigidWater=True, implicitSolvent=None, constraints=None, rigidWater=True, implicitSolvent=None,
......
...@@ -742,10 +742,9 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode ...@@ -742,10 +742,9 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
_box_vectors_from_lengths_angles([boxX, boxY, boxZ], _box_vectors_from_lengths_angles([boxX, boxY, boxZ],
[boxBeta, boxBeta, boxBeta], [boxBeta, boxBeta, boxBeta],
tmp) tmp)
d0 = units.Quantity(0.0, units.angstroms) xVec = units.Quantity(tmp[0], units.angstroms)
xVec = units.Quantity(tmp[0], u.angstroms) yVec = units.Quantity(tmp[1], units.angstroms)
yVec = units.Quantity(tmp[1], u.angstroms) zVec = units.Quantity(tmp[2], units.angstroms)
zVec = units.Quantity(tmp[2], u.angstroms)
system.setDefaultPeriodicBoxVectors(xVec, yVec, zVec) system.setDefaultPeriodicBoxVectors(xVec, yVec, zVec)
# Set cutoff. # Set cutoff.
...@@ -1235,6 +1234,12 @@ def _box_vectors_from_lengths_angles(lengths, angles, boxVectors): ...@@ -1235,6 +1234,12 @@ def _box_vectors_from_lengths_angles(lengths, angles, boxVectors):
boxVectors[0][1] = boxVectors[0][2] = boxVectors[1][2] = 0.0 boxVectors[0][1] = boxVectors[0][2] = boxVectors[1][2] = 0.0
# Now make sure any vector close to zero is zero exactly
for i in range(3):
for j in range(3):
if abs(boxVectors[i][j]) < TINY:
boxVectors[i][j] = 0.0
def readAmberCoordinates(filename, asNumpy=False): def readAmberCoordinates(filename, asNumpy=False):
""" """
Read atomic coordinates (and optionally, box vectors) from Amber formatted coordinate file. Read atomic coordinates (and optionally, box vectors) from Amber formatted coordinate file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment