Commit 87538363 authored by Jason Swails's avatar Jason Swails
Browse files

Add units back to getBoxBetaAndDimensions...

parent 7f06a313
...@@ -141,8 +141,7 @@ class AmberPrmtopFile(object): ...@@ -141,8 +141,7 @@ class AmberPrmtopFile(object):
# Set the periodic box size. # Set the periodic box size.
if prmtop.getIfBox(): if prmtop.getIfBox():
conv = (1.0 * unit.angstrom).value_in_unit(unit.nanometer) top.setUnitCellDimensions(tuple(x.value_in_unit(unit.nanometer) for x in prmtop.getBoxBetaAndDimensions()[1:4])*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,
......
...@@ -550,7 +550,10 @@ class PrmtopLoader(object): ...@@ -550,7 +550,10 @@ class PrmtopLoader(object):
x=float(self._raw_data["BOX_DIMENSIONS"][1]) x=float(self._raw_data["BOX_DIMENSIONS"][1])
y=float(self._raw_data["BOX_DIMENSIONS"][2]) y=float(self._raw_data["BOX_DIMENSIONS"][2])
z=float(self._raw_data["BOX_DIMENSIONS"][3]) z=float(self._raw_data["BOX_DIMENSIONS"][3])
return (beta, x, y, z) return (units.Quantity(beta, units.degree),
units.Quantity(x, units.angstrom),
units.Quantity(y, units.angstrom),
units.Quantity(z, units.angstrom))
@property @property
def has_scee_scnb(self): def has_scee_scnb(self):
...@@ -738,6 +741,10 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode ...@@ -738,6 +741,10 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
# System is periodic. # System is periodic.
# Set periodic box vectors for periodic system # Set periodic box vectors for periodic system
(boxBeta, boxX, boxY, boxZ) = prmtop.getBoxBetaAndDimensions() (boxBeta, boxX, boxY, boxZ) = prmtop.getBoxBetaAndDimensions()
boxBeta = boxBeta.value_in_unit(units.degrees)
boxX = boxX.value_in_unit(units.angstroms)
boxY = boxY.value_in_unit(units.angstroms)
boxZ = boxZ.value_in_unit(units.angstroms)
tmp = [[0.0, 0.0, 0.0],[0.0, 0.0, 0.0],[0.0, 0.0, 0.0]] tmp = [[0.0, 0.0, 0.0],[0.0, 0.0, 0.0],[0.0, 0.0, 0.0]]
_box_vectors_from_lengths_angles([boxX, boxY, boxZ], _box_vectors_from_lengths_angles([boxX, boxY, boxZ],
[boxBeta, boxBeta, boxBeta], [boxBeta, boxBeta, boxBeta],
...@@ -1264,14 +1271,13 @@ def readAmberCoordinates(filename, asNumpy=False): ...@@ -1264,14 +1271,13 @@ def readAmberCoordinates(filename, asNumpy=False):
>>> directory = os.path.join(os.getenv('YANK_INSTALL_DIR'), 'test', 'systems', 'alanine-dipeptide-gbsa') >>> directory = os.path.join(os.getenv('YANK_INSTALL_DIR'), 'test', 'systems', 'alanine-dipeptide-gbsa')
>>> crd_filename = os.path.join(directory, 'alanine-dipeptide.inpcrd') >>> crd_filename = os.path.join(directory, 'alanine-dipeptide.inpcrd')
>>> coordinates = readAmberCoordinates(crd_filename) >>> coordinates, velocities, box_vectors = readAmberCoordinates(crd_filename)
Read coordinates in solvent. Read coordinates in solvent.
>>> directory = os.path.join(os.getenv('YANK_INSTALL_DIR'), 'test', 'systems', 'alanine-dipeptide-explicit') >>> directory = os.path.join(os.getenv('YANK_INSTALL_DIR'), 'test', 'systems', 'alanine-dipeptide-explicit')
>>> crd_filename = os.path.join(directory, 'alanine-dipeptide.inpcrd') >>> crd_filename = os.path.join(directory, 'alanine-dipeptide.inpcrd')
>>> [coordinates, box_vectors] = readAmberCoordinates(crd_filename) >>> coordinates, velocities, box_vectors = readAmberCoordinates(crd_filename)
""" """
try: try:
......
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