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
4f7315b9
"platforms/reference/vscode:/vscode.git/clone" did not exist on "dfba24ea66d4f8ee7e5abac7baca62c9acc031dc"
Commit
4f7315b9
authored
Jun 06, 2014
by
Jason Swails
Browse files
Improve unit handling in charmm crd file classes.
parent
b540b4b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
wrappers/python/simtk/openmm/app/charmmcrdfiles.py
wrappers/python/simtk/openmm/app/charmmcrdfiles.py
+9
-4
No files found.
wrappers/python/simtk/openmm/app/charmmcrdfiles.py
View file @
4f7315b9
...
...
@@ -13,7 +13,7 @@ Copyright (c) 2014 the Authors
Author: Jason Deckman
Contributors: Jason M. Swails
Date:
April 19
, 2014
Date:
June 6
, 2014
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
...
...
@@ -105,7 +105,7 @@ class CharmmCrdFile(object):
self
.
resname
.
append
(
line
[
2
])
self
.
attype
.
append
(
line
[
3
])
pos
=
Vec3
(
float
(
line
[
4
]),
float
(
line
[
5
]),
float
(
line
[
6
]))
self
.
positions
.
append
(
pos
*
u
.
angstroms
)
self
.
positions
.
append
(
pos
)
self
.
segid
.
append
(
line
[
7
])
self
.
resid
.
append
(
int
(
line
[
8
]))
self
.
weighting
.
append
(
float
(
line
[
9
]))
...
...
@@ -120,6 +120,10 @@ class CharmmCrdFile(object):
except
(
ValueError
,
IndexError
),
e
:
raise
CharmmFileError
(
'Error parsing CHARMM coordinate file'
)
# Apply units to the positions now. Do it this way to allow for
# (possible) numpy functionality in the future.
self
.
positions
=
u
.
Quantity
(
self
.
positions
,
u
.
angstroms
)
class
CharmmRstFile
(
object
):
"""
Reads and parses data, velocities and coordinates from a CHARMM restart
...
...
@@ -209,8 +213,9 @@ class CharmmRstFile(object):
self
.
velocities
=
[
v
*
ONE_TIMESCALE
for
v
in
self
.
velocities
]
# Add units to positions and velocities
self
.
positions
*=
u
.
angstroms
self
.
velocities
*=
u
.
angstroms
/
u
.
picoseconds
self
.
positions
=
u
.
Quantity
(
self
.
positions
,
u
.
angstroms
)
self
.
positionsold
=
u
.
Quantity
(
self
.
positionsold
,
u
.
angstroms
)
self
.
velocities
=
u
.
Quantity
(
self
.
velocities
,
u
.
angstroms
/
u
.
picoseconds
)
def
_scan
(
self
,
handle
,
str
,
r
=
0
):
# read lines in file until str is found
scanning
=
True
...
...
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