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

Simplify setBox -- it now takes 3 lengths and 3 angles. You can also set

boxVectors directly (which is how you would do it if you set up a PDB with a
CRYST1 record, for instance).
parent e638eb3d
...@@ -745,27 +745,18 @@ class CharmmPsfFile(object): ...@@ -745,27 +745,18 @@ class CharmmPsfFile(object):
self.positions = positions self.positions = positions
def setBox(self, lengths, angles=None): def setBox(self, a, b, c, alpha=90.0*u.degrees, beta=90.0*u.degrees,
gamma=90.0*u.degrees):
""" """
Sets the periodic box boundary conditions. Sets the periodic box boundary conditions.
Parameters: Parameters:
- lengths (list of 3 distances) : A sequence of 3 distances that - a, b, c (floats) : Lengths of the periodic cell
represent the lengths of the periodic box vectors - alpha, beta, gamma (floats, optional) : Angles between the
- angles (list of 3 angles) : A list of 3 angle measurements between periodic cells.
the periodic box vectors. Default is 90 degrees if lengths
is not None
""" """
if len(lengths) != 3: self.box_vectors = _box_vectors_from_lengths_angles(a, b, c,
raise ValueError('setBox requires 3 box lengths') alpha, beta, gamma)
if angles is not None and len(angles) != 3:
raise ValueError('setBox requires 3 box angles')
if angles is None:
angles = [90.0, 90.0, 90.0] * u.degrees
self.box_vectors = _box_vectors_from_lengths_angles(
lengths[0], lengths[1], lengths[2],
angles[0], angles[1], angles[2],
)
# If we already have a _topology instance, then we have possibly changed # If we already have a _topology instance, then we have possibly changed
# the existence of box information (whether or not this is a periodic # the existence of box information (whether or not this is a periodic
# system), so delete any cached reference to a topology so it's # system), so delete any cached reference to a topology so it's
......
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