Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
0746deda
Commit
0746deda
authored
Feb 11, 2015
by
Jason Swails
Browse files
Add support for triclinic boxes to the Amber and CHARMM file parsers.
parent
10be282a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
wrappers/python/simtk/openmm/app/amberprmtopfile.py
wrappers/python/simtk/openmm/app/amberprmtopfile.py
+3
-1
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
...ers/python/simtk/openmm/app/internal/amber_file_parser.py
+1
-1
wrappers/python/simtk/openmm/app/internal/unitcell.py
wrappers/python/simtk/openmm/app/internal/unitcell.py
+11
-9
No files found.
wrappers/python/simtk/openmm/app/amberprmtopfile.py
View file @
0746deda
...
@@ -39,6 +39,7 @@ import forcefield as ff
...
@@ -39,6 +39,7 @@ import forcefield as ff
import
element
as
elem
import
element
as
elem
import
simtk.unit
as
unit
import
simtk.unit
as
unit
import
simtk.openmm
as
mm
import
simtk.openmm
as
mm
from
simtk.openmm.app.internal.unitcell
import
computePeriodicBoxVectors
# Enumerated values for implicit solvent model
# Enumerated values for implicit solvent model
...
@@ -141,7 +142,8 @@ class AmberPrmtopFile(object):
...
@@ -141,7 +142,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
)
box
=
prmtop
.
getBoxBetaAndDimensions
()
top
.
setPeriodicBoxVectors
(
computePeriodicBoxVectors
(
*
(
box
[
1
:
4
]
+
box
[
0
:
1
]
*
3
)))
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
,
...
...
wrappers/python/simtk/openmm/app/internal/amber_file_parser.py
View file @
0746deda
...
@@ -52,6 +52,7 @@ except:
...
@@ -52,6 +52,7 @@ except:
import
simtk.unit
as
units
import
simtk.unit
as
units
import
simtk.openmm
import
simtk.openmm
from
simtk.openmm.app
import
element
as
elem
from
simtk.openmm.app
import
element
as
elem
from
simtk.openmm.app.internal.unitcell
import
computePeriodicBoxVectors
from
simtk.openmm.vec3
import
Vec3
from
simtk.openmm.vec3
import
Vec3
import
customgbforces
as
customgb
import
customgbforces
as
customgb
...
@@ -691,7 +692,6 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
...
@@ -691,7 +692,6 @@ def readAmberSystem(prmtop_filename=None, prmtop_loader=None, shake=None, gbmode
>>> system = readAmberSystem(prmtop_filename)
>>> system = readAmberSystem(prmtop_filename)
"""
"""
if
prmtop_filename
is
None
and
prmtop_loader
is
None
:
if
prmtop_filename
is
None
and
prmtop_loader
is
None
:
raise
Exception
(
"Must specify a filename or loader"
)
raise
Exception
(
"Must specify a filename or loader"
)
if
prmtop_filename
is
not
None
and
prmtop_loader
is
not
None
:
if
prmtop_filename
is
not
None
and
prmtop_loader
is
not
None
:
...
...
wrappers/python/simtk/openmm/app/internal/unitcell.py
View file @
0746deda
...
@@ -32,7 +32,7 @@ __author__ = "Peter Eastman"
...
@@ -32,7 +32,7 @@ __author__ = "Peter Eastman"
__version__
=
"1.0"
__version__
=
"1.0"
from
simtk.openmm
import
Vec3
from
simtk.openmm
import
Vec3
from
simtk.unit
import
nanometers
,
is_quantity
,
norm
,
dot
from
simtk.unit
import
nanometers
,
is_quantity
,
norm
,
dot
,
radians
import
math
import
math
...
@@ -43,12 +43,12 @@ def computePeriodicBoxVectors(a_length, b_length, c_length, alpha, beta, gamma):
...
@@ -43,12 +43,12 @@ def computePeriodicBoxVectors(a_length, b_length, c_length, alpha, beta, gamma):
instances)
instances)
"""
"""
if
u
.
is_quantity
(
a_length
):
a_length
=
a_length
.
value_in_unit
(
u
.
nanometers
)
if
is_quantity
(
a_length
):
a_length
=
a_length
.
value_in_unit
(
nanometers
)
if
u
.
is_quantity
(
b_length
):
a
_length
=
a
_length
.
value_in_unit
(
u
.
nanometers
)
if
is_quantity
(
b_length
):
b
_length
=
b
_length
.
value_in_unit
(
nanometers
)
if
u
.
is_quantity
(
c_length
):
a
_length
=
a
_length
.
value_in_unit
(
u
.
nanometers
)
if
is_quantity
(
c_length
):
c
_length
=
c
_length
.
value_in_unit
(
nanometers
)
if
u
.
is_quantity
(
alpha
):
alpha
=
alpha
.
value_in_unit
(
u
.
radians
)
if
is_quantity
(
alpha
):
alpha
=
alpha
.
value_in_unit
(
radians
)
if
u
.
is_quantity
(
beta
):
beta
=
beta
.
value_in_unit
(
u
.
radians
)
if
is_quantity
(
beta
):
beta
=
beta
.
value_in_unit
(
radians
)
if
u
.
is_quantity
(
gamma
):
gamma
=
gamma
.
value_in_unit
(
u
.
radians
)
if
is_quantity
(
gamma
):
gamma
=
gamma
.
value_in_unit
(
radians
)
# Compute the vectors.
# Compute the vectors.
...
@@ -84,8 +84,10 @@ def computeLengthsAndAngles(periodicBoxVectors):
...
@@ -84,8 +84,10 @@ def computeLengthsAndAngles(periodicBoxVectors):
Lengths are returned in nanometers and angles in radians.
Lengths are returned in nanometers and angles in radians.
"""
"""
if
is_quantity
(
periodicBoxVectors
):
(
a
,
b
,
c
)
=
vectors
.
value_in_unit
(
nanometers
)
(
a
,
b
,
c
)
=
vectors
.
value_in_unit
(
nanometers
)
else
:
a
,
b
,
c
=
vectors
a_length
=
norm
(
a
)
a_length
=
norm
(
a
)
b_length
=
norm
(
b
)
b_length
=
norm
(
b
)
c_length
=
norm
(
c
)
c_length
=
norm
(
c
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment