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
da8a47dd
Commit
da8a47dd
authored
Aug 04, 2016
by
peastman
Browse files
Bug fixes to reading Gromacs files
parent
1f7866ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
wrappers/python/simtk/openmm/app/gromacsgrofile.py
wrappers/python/simtk/openmm/app/gromacsgrofile.py
+3
-2
wrappers/python/simtk/openmm/app/gromacstopfile.py
wrappers/python/simtk/openmm/app/gromacstopfile.py
+4
-4
No files found.
wrappers/python/simtk/openmm/app/gromacsgrofile.py
View file @
da8a47dd
...
@@ -6,7 +6,7 @@ Simbios, the NIH National Center for Physics-Based Simulation of
...
@@ -6,7 +6,7 @@ Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. See https://simtk.org.
Medical Research, grant U54 GM072970. See https://simtk.org.
Portions copyright (c) 2012-201
5
Stanford University and the Authors.
Portions copyright (c) 2012-201
6
Stanford University and the Authors.
Authors: Lee-Ping Wang, Peter Eastman
Authors: Lee-Ping Wang, Peter Eastman
Contributors:
Contributors:
...
@@ -35,6 +35,7 @@ __version__ = "1.0"
...
@@ -35,6 +35,7 @@ __version__ = "1.0"
import
os
import
os
import
sys
import
sys
from
simtk.openmm
import
Vec3
from
simtk.openmm
import
Vec3
from
simtk.openmm.app.internal.unitcell
import
reducePeriodicBoxVectors
from
re
import
sub
,
match
from
re
import
sub
,
match
from
simtk.unit
import
nanometers
,
angstroms
,
Quantity
from
simtk.unit
import
nanometers
,
angstroms
,
Quantity
from
.
import
element
as
elem
from
.
import
element
as
elem
...
@@ -100,7 +101,7 @@ def _construct_box_vectors(line):
...
@@ -100,7 +101,7 @@ def _construct_box_vectors(line):
values
=
[
float
(
i
)
for
i
in
sline
]
values
=
[
float
(
i
)
for
i
in
sline
]
if
len
(
sline
)
==
3
:
if
len
(
sline
)
==
3
:
return
(
Vec3
(
values
[
0
],
0
,
0
),
Vec3
(
0
,
values
[
1
],
0
),
Vec3
(
0
,
0
,
values
[
2
]))
*
nanometers
return
(
Vec3
(
values
[
0
],
0
,
0
),
Vec3
(
0
,
values
[
1
],
0
),
Vec3
(
0
,
0
,
values
[
2
]))
*
nanometers
return
(
Vec3
(
values
[
0
],
values
[
3
],
values
[
4
]),
Vec3
(
values
[
5
],
values
[
1
],
values
[
6
]),
Vec3
(
values
[
7
],
values
[
8
],
values
[
2
]))
*
nanometers
return
reducePeriodicBoxVectors
(
(
Vec3
(
values
[
0
],
values
[
3
],
values
[
4
]),
Vec3
(
values
[
5
],
values
[
1
],
values
[
6
]),
Vec3
(
values
[
7
],
values
[
8
],
values
[
2
]))
*
nanometers
)
class
GromacsGroFile
(
object
):
class
GromacsGroFile
(
object
):
"""GromacsGroFile parses a Gromacs .gro file and constructs a set of atom positions from it.
"""GromacsGroFile parses a Gromacs .gro file and constructs a set of atom positions from it.
...
...
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
da8a47dd
...
@@ -364,7 +364,7 @@ class GromacsTopFile(object):
...
@@ -364,7 +364,7 @@ class GromacsTopFile(object):
# Bonded type and atomic number are both missing.
# Bonded type and atomic number are both missing.
fields
.
insert
(
1
,
None
)
fields
.
insert
(
1
,
None
)
fields
.
insert
(
1
,
None
)
fields
.
insert
(
1
,
None
)
elif
len
(
fields
[
4
])
==
1
and
len
(
fields
[
5
])
>
1
:
elif
len
(
fields
[
4
])
==
1
and
fields
[
4
].
isalpha
()
:
if
fields
[
1
][
0
].
isalpha
():
if
fields
[
1
][
0
].
isalpha
():
# Atomic number is missing.
# Atomic number is missing.
fields
.
insert
(
2
,
None
)
fields
.
insert
(
2
,
None
)
...
@@ -586,9 +586,9 @@ class GromacsTopFile(object):
...
@@ -586,9 +586,9 @@ class GromacsTopFile(object):
# Create the System.
# Create the System.
sys
=
mm
.
System
()
sys
=
mm
.
System
()
box
Size
=
self
.
topology
.
get
UnitCellDimension
s
()
box
Vectors
=
self
.
topology
.
get
PeriodicBoxVector
s
()
if
box
Size
is
not
None
:
if
box
Vectors
is
not
None
:
sys
.
setDefaultPeriodicBoxVectors
(
(
box
Size
[
0
],
0
,
0
),
(
0
,
boxSize
[
1
],
0
),
(
0
,
0
,
boxSize
[
2
])
)
sys
.
setDefaultPeriodicBoxVectors
(
*
box
Vectors
)
elif
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
elif
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
nb
=
mm
.
NonbondedForce
()
nb
=
mm
.
NonbondedForce
()
...
...
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