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
c4e9dcd2
Commit
c4e9dcd2
authored
Apr 16, 2013
by
Peter Eastman
Browse files
Fixed bugs in reading Gromacs files
parent
456b8a05
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
wrappers/python/simtk/openmm/app/gromacsgrofile.py
wrappers/python/simtk/openmm/app/gromacsgrofile.py
+6
-7
wrappers/python/simtk/openmm/app/gromacstopfile.py
wrappers/python/simtk/openmm/app/gromacstopfile.py
+2
-0
No files found.
wrappers/python/simtk/openmm/app/gromacsgrofile.py
View file @
c4e9dcd2
...
@@ -116,28 +116,27 @@ class GromacsGroFile(object):
...
@@ -116,28 +116,27 @@ class GromacsGroFile(object):
ln
=
0
ln
=
0
frame
=
0
frame
=
0
for
line
in
open
(
file
):
for
line
in
open
(
file
):
sline
=
line
.
split
()
if
ln
==
0
:
if
ln
==
0
:
comms
.
append
(
line
.
strip
())
comms
.
append
(
line
.
strip
())
elif
ln
==
1
:
elif
ln
==
1
:
na
=
int
(
line
.
strip
())
na
=
int
(
line
.
strip
())
elif
_is_gro_coord
(
line
):
elif
_is_gro_coord
(
line
):
if
frame
==
0
:
# Create the list of residues, atom names etc. only if it's the first frame.
if
frame
==
0
:
# Create the list of residues, atom names etc. only if it's the first frame.
# Name of the residue, for instance '153SOL1 -> SOL1' ; strips leading numbers
(
thisresnum
,
thisresname
,
thisatomname
,
thisatomnum
)
=
[
line
[
i
*
5
:
i
*
5
+
5
].
strip
()
for
i
in
range
(
4
)]
thisresname
=
sub
(
'^[0-9]*'
,
''
,
sline
[
0
])
resname
.
append
(
thisresname
)
resname
.
append
(
thisresname
)
resid
.
append
(
int
(
sline
[
0
].
replace
(
thisresn
ame
,
''
)
))
resid
.
append
(
int
(
thisresn
um
))
atomname
.
append
(
sline
[
1
]
)
atomname
.
append
(
thisatomname
)
thiselem
=
sline
[
1
]
thiselem
=
thisatomname
if
len
(
thiselem
)
>
1
:
if
len
(
thiselem
)
>
1
:
thiselem
=
thiselem
[
0
]
+
sub
(
'[A-Z0-9]'
,
''
,
thiselem
[
1
:])
thiselem
=
thiselem
[
0
]
+
sub
(
'[A-Z0-9]'
,
''
,
thiselem
[
1
:])
try
:
try
:
elements
.
append
(
elem
.
get_by_symbol
(
thiselem
))
elements
.
append
(
elem
.
get_by_symbol
(
thiselem
))
except
KeyError
:
except
KeyError
:
elements
.
append
(
None
)
elements
.
append
(
None
)
pos
=
[
float
(
i
)
for
i
in
sline
[
-
3
:]
]
pos
=
[
float
(
line
[
20
+
i
*
8
:
28
+
i
*
8
]
)
for
i
in
range
(
3
)
]
xyz
.
append
(
Vec3
(
pos
[
0
],
pos
[
1
],
pos
[
2
]))
xyz
.
append
(
Vec3
(
pos
[
0
],
pos
[
1
],
pos
[
2
]))
elif
_is_gro_box
(
line
)
and
ln
==
na
+
2
:
elif
_is_gro_box
(
line
)
and
ln
==
na
+
2
:
sline
=
line
.
split
()
boxes
.
append
([
float
(
i
)
for
i
in
sline
]
*
nanometers
)
boxes
.
append
([
float
(
i
)
for
i
in
sline
]
*
nanometers
)
xyzs
.
append
(
xyz
*
nanometers
)
xyzs
.
append
(
xyz
*
nanometers
)
xyz
=
[]
xyz
=
[]
...
...
wrappers/python/simtk/openmm/app/gromacstopfile.py
View file @
c4e9dcd2
...
@@ -439,6 +439,8 @@ class GromacsTopFile(object):
...
@@ -439,6 +439,8 @@ class GromacsTopFile(object):
boxSize
=
self
.
topology
.
getUnitCellDimensions
()
boxSize
=
self
.
topology
.
getUnitCellDimensions
()
if
boxSize
is
not
None
:
if
boxSize
is
not
None
:
sys
.
setDefaultPeriodicBoxVectors
((
boxSize
[
0
],
0
,
0
),
(
0
,
boxSize
[
1
],
0
),
(
0
,
0
,
boxSize
[
2
]))
sys
.
setDefaultPeriodicBoxVectors
((
boxSize
[
0
],
0
,
0
),
(
0
,
boxSize
[
1
],
0
),
(
0
,
0
,
boxSize
[
2
]))
elif
nonbondedMethod
in
(
ff
.
CutoffPeriodic
,
ff
.
Ewald
,
ff
.
PME
):
raise
ValueError
(
'Illegal nonbonded method for a non-periodic system'
)
nb
=
mm
.
NonbondedForce
()
nb
=
mm
.
NonbondedForce
()
sys
.
addForce
(
nb
)
sys
.
addForce
(
nb
)
if
implicitSolvent
is
OBC2
:
if
implicitSolvent
is
OBC2
:
...
...
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