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
a8a78957
Commit
a8a78957
authored
Mar 05, 2014
by
peastman
Browse files
Fixed incorrectly formatted comments that caused problems in the API docs
parent
52c35f70
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
79 deletions
+79
-79
wrappers/python/simtk/openmm/app/desmonddmsfile.py
wrappers/python/simtk/openmm/app/desmonddmsfile.py
+79
-79
No files found.
wrappers/python/simtk/openmm/app/desmonddmsfile.py
View file @
a8a78957
'''
"""
desmonddmsfile.py: Load Desmond dms files
desmonddmsfile.py: Load Desmond dms files
Portions copyright (c) 2013 Stanford University and the Authors
Portions copyright (c) 2013 Stanford University and the Authors
...
@@ -23,7 +23,7 @@ THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
...
@@ -23,7 +23,7 @@ THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
USE OR OTHER DEALINGS IN THE SOFTWARE.
'''
"""
import
os
import
os
import
math
import
math
...
@@ -38,16 +38,16 @@ from simtk.unit import (nanometer, angstrom, dalton, radian,
...
@@ -38,16 +38,16 @@ from simtk.unit import (nanometer, angstrom, dalton, radian,
class
DesmondDMSFile
(
object
):
class
DesmondDMSFile
(
object
):
'''
DesmondDMSFile parses a Desmond DMS (desmond molecular system) and
"""
DesmondDMSFile parses a Desmond DMS (desmond molecular system) and
constructs a topology and (optionally) an OpenMM System from it
constructs a topology and (optionally) an OpenMM System from it
'''
"""
def
__init__
(
self
,
file
):
def
__init__
(
self
,
file
):
'''
Load a DMS file
"""
Load a DMS file
Parameters:
Parameters:
- file (string) the name of the file to load
- file (string) the name of the file to load
'''
"""
# sqlite3 is included in the standard lib, but at python
# sqlite3 is included in the standard lib, but at python
# compile time, you can disable support (I think), so it's
# compile time, you can disable support (I think), so it's
...
@@ -73,8 +73,8 @@ class DesmondDMSFile(object):
...
@@ -73,8 +73,8 @@ class DesmondDMSFile(object):
# build the provenance string
# build the provenance string
provenance
=
[]
provenance
=
[]
q
=
'''
SELECT id, user, timestamp, version, workdir, cmdline, executable
q
=
"""
SELECT id, user, timestamp, version, workdir, cmdline, executable
FROM provenance
'''
FROM provenance
"""
#for id, user, timestamp, version, workdir, cmdline, executable in self._conn.execute(q):
#for id, user, timestamp, version, workdir, cmdline, executable in self._conn.execute(q):
for
row
in
self
.
_conn
.
execute
(
'SELECT * FROM provenance'
):
for
row
in
self
.
_conn
.
execute
(
'SELECT * FROM provenance'
):
rowdict
=
dict
(
zip
(
self
.
_tables
[
'provenance'
],
row
))
rowdict
=
dict
(
zip
(
self
.
_tables
[
'provenance'
],
row
))
...
@@ -89,23 +89,23 @@ class DesmondDMSFile(object):
...
@@ -89,23 +89,23 @@ class DesmondDMSFile(object):
self
.
_angleConstraints
=
[{}
for
x
in
range
(
len
(
self
.
_topologyAtoms
))]
self
.
_angleConstraints
=
[{}
for
x
in
range
(
len
(
self
.
_topologyAtoms
))]
def
getPositions
(
self
):
def
getPositions
(
self
):
'''
Get the positions of each atom in the system
"""
Get the positions of each atom in the system
'''
"""
return
self
.
positions
return
self
.
positions
def
getTopology
(
self
):
def
getTopology
(
self
):
'''
Get the topology of the system
"""
Get the topology of the system
'''
"""
return
self
.
topology
return
self
.
topology
def
getProvenance
(
self
):
def
getProvenance
(
self
):
'''
Get the provenance string of this system
"""
Get the provenance string of this system
'''
"""
return
self
.
provenance
return
self
.
provenance
def
_createTopology
(
self
):
def
_createTopology
(
self
):
'''
Build the topology of the system
"""
Build the topology of the system
'''
"""
top
=
Topology
()
top
=
Topology
()
positions
=
[]
positions
=
[]
...
@@ -119,8 +119,8 @@ class DesmondDMSFile(object):
...
@@ -119,8 +119,8 @@ class DesmondDMSFile(object):
lastChain
=
None
lastChain
=
None
lastResId
=
None
lastResId
=
None
c
=
top
.
addChain
()
c
=
top
.
addChain
()
q
=
'''
SELECT id, name, anum, resname, resid, chain, x, y, z
q
=
"""
SELECT id, name, anum, resname, resid, chain, x, y, z
FROM particle
'''
FROM particle
"""
for
(
atomId
,
atomName
,
atomNumber
,
resName
,
resId
,
chain
,
x
,
y
,
z
)
in
self
.
_conn
.
execute
(
q
):
for
(
atomId
,
atomName
,
atomNumber
,
resName
,
resId
,
chain
,
x
,
y
,
z
)
in
self
.
_conn
.
execute
(
q
):
newChain
=
False
newChain
=
False
if
chain
!=
lastChain
:
if
chain
!=
lastChain
:
...
@@ -156,7 +156,7 @@ class DesmondDMSFile(object):
...
@@ -156,7 +156,7 @@ class DesmondDMSFile(object):
def
createSystem
(
self
,
nonbondedMethod
=
ff
.
NoCutoff
,
nonbondedCutoff
=
1.0
*
nanometer
,
def
createSystem
(
self
,
nonbondedMethod
=
ff
.
NoCutoff
,
nonbondedCutoff
=
1.0
*
nanometer
,
ewaldErrorTolerance
=
0.0005
,
removeCMMotion
=
True
,
hydrogenMass
=
None
):
ewaldErrorTolerance
=
0.0005
,
removeCMMotion
=
True
,
hydrogenMass
=
None
):
'''
Construct an OpenMM System representing the topology described by this dms file
"""
Construct an OpenMM System representing the topology described by this dms file
Parameters:
Parameters:
- nonbondedMethod (object=NoCutoff) The method to use for nonbonded interactions. Allowed values are
- nonbondedMethod (object=NoCutoff) The method to use for nonbonded interactions. Allowed values are
...
@@ -166,7 +166,7 @@ class DesmondDMSFile(object):
...
@@ -166,7 +166,7 @@ class DesmondDMSFile(object):
- removeCMMotion (boolean=True) If true, a CMMotionRemover will be added to the System
- removeCMMotion (boolean=True) If true, a CMMotionRemover will be added to the System
- hydrogenMass (mass=None) The mass to use for hydrogen atoms bound to heavy atoms. Any mass added to a hydrogen is
- hydrogenMass (mass=None) The mass to use for hydrogen atoms bound to heavy atoms. Any mass added to a hydrogen is
subtracted from the heavy atom to keep their total mass the same.
subtracted from the heavy atom to keep their total mass the same.
'''
"""
self
.
_checkForUnsupportedTerms
()
self
.
_checkForUnsupportedTerms
()
sys
=
mm
.
System
()
sys
=
mm
.
System
()
...
@@ -219,14 +219,14 @@ class DesmondDMSFile(object):
...
@@ -219,14 +219,14 @@ class DesmondDMSFile(object):
return
sys
return
sys
def
_addBondsToSystem
(
self
,
sys
):
def
_addBondsToSystem
(
self
,
sys
):
'''
Create the harmonic bonds
"""
Create the harmonic bonds
'''
"""
bonds
=
mm
.
HarmonicBondForce
()
bonds
=
mm
.
HarmonicBondForce
()
sys
.
addForce
(
bonds
)
sys
.
addForce
(
bonds
)
q
=
'''
SELECT p0, p1, r0, fc, constrained
q
=
"""
SELECT p0, p1, r0, fc, constrained
FROM stretch_harm_term INNER JOIN stretch_harm_param
FROM stretch_harm_term INNER JOIN stretch_harm_param
ON stretch_harm_term.param=stretch_harm_param.id
'''
ON stretch_harm_term.param=stretch_harm_param.id
"""
for
p0
,
p1
,
r0
,
fc
,
constrained
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
r0
,
fc
,
constrained
in
self
.
_conn
.
execute
(
q
):
if
constrained
:
if
constrained
:
sys
.
addConstraint
(
p0
,
p1
,
r0
*
angstrom
)
sys
.
addConstraint
(
p0
,
p1
,
r0
*
angstrom
)
...
@@ -242,15 +242,15 @@ class DesmondDMSFile(object):
...
@@ -242,15 +242,15 @@ class DesmondDMSFile(object):
return
bonds
return
bonds
def
_addAnglesToSystem
(
self
,
sys
):
def
_addAnglesToSystem
(
self
,
sys
):
'''
Create the harmonic angles
"""
Create the harmonic angles
'''
"""
angles
=
mm
.
HarmonicAngleForce
()
angles
=
mm
.
HarmonicAngleForce
()
sys
.
addForce
(
angles
)
sys
.
addForce
(
angles
)
degToRad
=
math
.
pi
/
180
degToRad
=
math
.
pi
/
180
q
=
'''
SELECT p0, p1, p2, theta0, fc, constrained
q
=
"""
SELECT p0, p1, p2, theta0, fc, constrained
FROM angle_harm_term INNER JOIN angle_harm_param
FROM angle_harm_term INNER JOIN angle_harm_param
ON angle_harm_term.param=angle_harm_param.id
'''
ON angle_harm_term.param=angle_harm_param.id
"""
for
p0
,
p1
,
p2
,
theta0
,
fc
,
constrained
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
theta0
,
fc
,
constrained
in
self
.
_conn
.
execute
(
q
):
if
constrained
:
if
constrained
:
l1
=
self
.
_atomBonds
[
p1
][
p0
]
l1
=
self
.
_atomBonds
[
p1
][
p0
]
...
@@ -267,15 +267,15 @@ class DesmondDMSFile(object):
...
@@ -267,15 +267,15 @@ class DesmondDMSFile(object):
return
angles
return
angles
def
_addConstraintsToSystem
(
self
,
sys
):
def
_addConstraintsToSystem
(
self
,
sys
):
'''
Add constraints to system. Normally these should already be
"""
Add constraints to system. Normally these should already be
added by the bonds table, but we want to make sure that there's
added by the bonds table, but we want to make sure that there's
no extra information in the constraints table that we're not
no extra information in the constraints table that we're not
including in the system
'''
including in the system
"""
for
term_table
in
[
n
for
n
in
self
.
_tables
.
keys
()
if
n
.
startswith
(
'constraint_a'
)
and
n
.
endswith
(
'term'
)]:
for
term_table
in
[
n
for
n
in
self
.
_tables
.
keys
()
if
n
.
startswith
(
'constraint_a'
)
and
n
.
endswith
(
'term'
)]:
param_table
=
term_table
.
replace
(
'term'
,
'param'
)
param_table
=
term_table
.
replace
(
'term'
,
'param'
)
q
=
'''
SELECT p0, p1, r1
q
=
"""
SELECT p0, p1, r1
FROM %(term)s INNER JOIN %(param)s
FROM %(term)s INNER JOIN %(param)s
ON %(term)s.param=%(param)s.id
'''
%
\
ON %(term)s.param=%(param)s.id
"""
%
\
{
'term'
:
term_table
,
'param'
:
param_table
}
{
'term'
:
term_table
,
'param'
:
param_table
}
for
p0
,
p1
,
r1
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
r1
in
self
.
_conn
.
execute
(
q
):
if
not
p1
in
self
.
_atomBonds
[
p0
]:
if
not
p1
in
self
.
_atomBonds
[
p0
]:
...
@@ -285,9 +285,9 @@ class DesmondDMSFile(object):
...
@@ -285,9 +285,9 @@ class DesmondDMSFile(object):
if
'constraint_hoh_term'
in
self
.
_tables
:
if
'constraint_hoh_term'
in
self
.
_tables
:
degToRad
=
math
.
pi
/
180
degToRad
=
math
.
pi
/
180
q
=
'''
SELECT p0, p1, p2, r1, r2, theta
q
=
"""
SELECT p0, p1, p2, r1, r2, theta
FROM constraint_hoh_term INNER JOIN constraint_hoh_param
FROM constraint_hoh_term INNER JOIN constraint_hoh_param
ON constraint_hoh_term.param=constraint_hoh_param.id
'''
ON constraint_hoh_term.param=constraint_hoh_param.id
"""
for
p0
,
p1
,
p2
,
r1
,
r2
,
theta
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
r1
,
r2
,
theta
in
self
.
_conn
.
execute
(
q
):
# Here, p0 is the heavy atom and p1 and p2 are the H1 and H2
# Here, p0 is the heavy atom and p1 and p2 are the H1 and H2
# wihth O-H1 and O-H2 distances r1 and r2
# wihth O-H1 and O-H2 distances r1 and r2
...
@@ -296,14 +296,14 @@ class DesmondDMSFile(object):
...
@@ -296,14 +296,14 @@ class DesmondDMSFile(object):
sys
.
addConstraint
(
p1
,
p2
,
length
)
sys
.
addConstraint
(
p1
,
p2
,
length
)
def
_addPeriodicTorsionsToSystem
(
self
,
sys
):
def
_addPeriodicTorsionsToSystem
(
self
,
sys
):
'''
Create the torsion terms
"""
Create the torsion terms
'''
"""
periodic
=
mm
.
PeriodicTorsionForce
()
periodic
=
mm
.
PeriodicTorsionForce
()
sys
.
addForce
(
periodic
)
sys
.
addForce
(
periodic
)
q
=
'''
SELECT p0, p1, p2, p3, phi0, fc0, fc1, fc2, fc3, fc4, fc5, fc6
q
=
"""
SELECT p0, p1, p2, p3, phi0, fc0, fc1, fc2, fc3, fc4, fc5, fc6
FROM dihedral_trig_term INNER JOIN dihedral_trig_param
FROM dihedral_trig_term INNER JOIN dihedral_trig_param
ON dihedral_trig_term.param=dihedral_trig_param.id
'''
ON dihedral_trig_term.param=dihedral_trig_param.id
"""
for
p0
,
p1
,
p2
,
p3
,
phi0
,
fc0
,
fc1
,
fc2
,
fc3
,
fc4
,
fc5
,
fc6
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
p3
,
phi0
,
fc0
,
fc1
,
fc2
,
fc3
,
fc4
,
fc5
,
fc6
in
self
.
_conn
.
execute
(
q
):
for
order
,
fc
in
enumerate
([
fc0
,
fc1
,
fc2
,
fc3
,
fc4
,
fc5
,
fc6
]):
for
order
,
fc
in
enumerate
([
fc0
,
fc1
,
fc2
,
fc3
,
fc4
,
fc5
,
fc6
]):
if
fc
==
0
:
if
fc
==
0
:
...
@@ -312,8 +312,8 @@ class DesmondDMSFile(object):
...
@@ -312,8 +312,8 @@ class DesmondDMSFile(object):
def
_addImproperHarmonicTorsionsToSystem
(
self
,
sys
):
def
_addImproperHarmonicTorsionsToSystem
(
self
,
sys
):
'''
Create the improper harmonic torsion terms
"""
Create the improper harmonic torsion terms
'''
"""
if
not
self
.
_hasTable
(
'improper_harm_term'
):
if
not
self
.
_hasTable
(
'improper_harm_term'
):
return
return
...
@@ -322,15 +322,15 @@ class DesmondDMSFile(object):
...
@@ -322,15 +322,15 @@ class DesmondDMSFile(object):
harmonicTorsion
.
addPerTorsionParameter
(
'k'
)
harmonicTorsion
.
addPerTorsionParameter
(
'k'
)
sys
.
addForce
(
harmonicTorsion
)
sys
.
addForce
(
harmonicTorsion
)
q
=
'''
SELECT p0, p1, p2, p3, phi0, fc
q
=
"""
SELECT p0, p1, p2, p3, phi0, fc
FROM improper_harm_term INNER JOIN improper_harm_param
FROM improper_harm_term INNER JOIN improper_harm_param
ON improper_harm_term.param=improper_harm_param.id
'''
ON improper_harm_term.param=improper_harm_param.id
"""
for
p0
,
p1
,
p2
,
p3
,
phi0
,
fc
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
p3
,
phi0
,
fc
in
self
.
_conn
.
execute
(
q
):
harmonicTorsion
.
addTorsion
(
p0
,
p1
,
p2
,
p3
,
[
phi0
*
degree
,
fc
*
kilocalorie_per_mole
])
harmonicTorsion
.
addTorsion
(
p0
,
p1
,
p2
,
p3
,
[
phi0
*
degree
,
fc
*
kilocalorie_per_mole
])
def
_addCMAPToSystem
(
self
,
sys
):
def
_addCMAPToSystem
(
self
,
sys
):
'''
Create the CMAP terms
"""
Create the CMAP terms
'''
"""
if
not
self
.
_hasTable
(
'torsiontorsion_cmap_term'
):
if
not
self
.
_hasTable
(
'torsiontorsion_cmap_term'
):
return
return
...
@@ -354,30 +354,30 @@ class DesmondDMSFile(object):
...
@@ -354,30 +354,30 @@ class DesmondDMSFile(object):
index
=
cmap
.
addMap
(
size
,
map
*
kilocalorie_per_mole
)
index
=
cmap
.
addMap
(
size
,
map
*
kilocalorie_per_mole
)
cmap_indices
[
name
]
=
index
cmap_indices
[
name
]
=
index
q
=
'''
SELECT p0, p1, p2, p3, p4, p5, p6, p7, cmapid
q
=
"""
SELECT p0, p1, p2, p3, p4, p5, p6, p7, cmapid
FROM torsiontorsion_cmap_term INNER JOIN torsiontorsion_cmap_param
FROM torsiontorsion_cmap_term INNER JOIN torsiontorsion_cmap_param
ON torsiontorsion_cmap_term.param=torsiontorsion_cmap_param.id
'''
ON torsiontorsion_cmap_term.param=torsiontorsion_cmap_param.id
"""
for
p0
,
p1
,
p2
,
p3
,
p4
,
p5
,
p6
,
p7
,
cmapid
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
p3
,
p4
,
p5
,
p6
,
p7
,
cmapid
in
self
.
_conn
.
execute
(
q
):
cmap
.
addTorsion
(
cmap_indices
[
cmapid
],
p0
,
p1
,
p2
,
p3
,
p4
,
p5
,
p6
,
p7
)
cmap
.
addTorsion
(
cmap_indices
[
cmapid
],
p0
,
p1
,
p2
,
p3
,
p4
,
p5
,
p6
,
p7
)
def
_addNonbondedForceToSystem
(
self
,
sys
):
def
_addNonbondedForceToSystem
(
self
,
sys
):
'''
Create the nonbonded force
"""
Create the nonbonded force
'''
"""
nb
=
mm
.
NonbondedForce
()
nb
=
mm
.
NonbondedForce
()
sys
.
addForce
(
nb
)
sys
.
addForce
(
nb
)
q
=
'''
SELECT charge, sigma, epsilon
q
=
"""
SELECT charge, sigma, epsilon
FROM particle INNER JOIN nonbonded_param
FROM particle INNER JOIN nonbonded_param
ON particle.nbtype=nonbonded_param.id
'''
ON particle.nbtype=nonbonded_param.id
"""
for
charge
,
sigma
,
epsilon
in
self
.
_conn
.
execute
(
q
):
for
charge
,
sigma
,
epsilon
in
self
.
_conn
.
execute
(
q
):
nb
.
addParticle
(
charge
,
sigma
*
angstrom
,
epsilon
*
kilocalorie_per_mole
)
nb
.
addParticle
(
charge
,
sigma
*
angstrom
,
epsilon
*
kilocalorie_per_mole
)
for
p0
,
p1
in
self
.
_conn
.
execute
(
'SELECT p0, p1 FROM exclusion'
):
for
p0
,
p1
in
self
.
_conn
.
execute
(
'SELECT p0, p1 FROM exclusion'
):
nb
.
addException
(
p0
,
p1
,
0.0
,
1.0
,
0.0
)
nb
.
addException
(
p0
,
p1
,
0.0
,
1.0
,
0.0
)
q
=
'''
SELECT p0, p1, aij, bij, qij
q
=
"""
SELECT p0, p1, aij, bij, qij
FROM pair_12_6_es_term INNER JOIN pair_12_6_es_param
FROM pair_12_6_es_term INNER JOIN pair_12_6_es_param
ON pair_12_6_es_term.param=pair_12_6_es_param.id;
'''
ON pair_12_6_es_term.param=pair_12_6_es_param.id;
"""
for
p0
,
p1
,
a_ij
,
b_ij
,
q_ij
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
a_ij
,
b_ij
,
q_ij
in
self
.
_conn
.
execute
(
q
):
a_ij
=
(
a_ij
*
kilocalorie_per_mole
*
(
angstrom
**
12
)).
in_units_of
(
kilojoule_per_mole
*
(
nanometer
**
12
))
a_ij
=
(
a_ij
*
kilocalorie_per_mole
*
(
angstrom
**
12
)).
in_units_of
(
kilojoule_per_mole
*
(
nanometer
**
12
))
b_ij
=
(
b_ij
*
kilocalorie_per_mole
*
(
angstrom
**
6
)).
in_units_of
(
kilojoule_per_mole
*
(
nanometer
**
6
))
b_ij
=
(
b_ij
*
kilocalorie_per_mole
*
(
angstrom
**
6
)).
in_units_of
(
kilojoule_per_mole
*
(
nanometer
**
6
))
...
@@ -391,41 +391,41 @@ class DesmondDMSFile(object):
...
@@ -391,41 +391,41 @@ class DesmondDMSFile(object):
new_sigma
=
(
a_ij
/
b_ij
)
**
(
1.0
/
6.0
)
new_sigma
=
(
a_ij
/
b_ij
)
**
(
1.0
/
6.0
)
nb
.
addException
(
p0
,
p1
,
q_ij
,
new_sigma
,
new_epsilon
,
True
)
nb
.
addException
(
p0
,
p1
,
q_ij
,
new_sigma
,
new_epsilon
,
True
)
n_total
=
self
.
_conn
.
execute
(
'''
SELECT COUNT(*) FROM pair_12_6_es_term
'''
).
fetchone
()
n_total
=
self
.
_conn
.
execute
(
"""
SELECT COUNT(*) FROM pair_12_6_es_term
"""
).
fetchone
()
n_in_exclusions
=
self
.
_conn
.
execute
(
'''
SELECT COUNT(*)
n_in_exclusions
=
self
.
_conn
.
execute
(
"""
SELECT COUNT(*)
FROM exclusion INNER JOIN pair_12_6_es_term
FROM exclusion INNER JOIN pair_12_6_es_term
ON exclusion.p0==pair_12_6_es_term.p0 AND exclusion.p1==pair_12_6_es_term.p1
'''
).
fetchone
()
ON exclusion.p0==pair_12_6_es_term.p0 AND exclusion.p1==pair_12_6_es_term.p1
"""
).
fetchone
()
if
not
n_total
==
n_in_exclusions
:
if
not
n_total
==
n_in_exclusions
:
raise
NotImplementedError
(
'All pair_12_6_es_terms must have a corresponding exclusion'
)
raise
NotImplementedError
(
'All pair_12_6_es_terms must have a corresponding exclusion'
)
return
nb
return
nb
def
_addVirtualSitesToSystem
(
self
,
sys
):
def
_addVirtualSitesToSystem
(
self
,
sys
):
'''
Create any virtual sites in the systempy
"""
Create any virtual sites in the systempy
'''
"""
if
not
any
(
t
.
startswith
(
'virtual_'
)
for
t
in
self
.
_tables
.
keys
()):
if
not
any
(
t
.
startswith
(
'virtual_'
)
for
t
in
self
.
_tables
.
keys
()):
return
return
if
'virtual_lc2_term'
in
self
.
_tables
:
if
'virtual_lc2_term'
in
self
.
_tables
:
q
=
'''
SELECT p0, p1, p2, c1
q
=
"""
SELECT p0, p1, p2, c1
FROM virtual_lc2_term INNER JOIN virtual_lc2_param
FROM virtual_lc2_term INNER JOIN virtual_lc2_param
ON virtual_lc2_term.param=virtual_lc2_param.id
'''
ON virtual_lc2_term.param=virtual_lc2_param.id
"""
for
p0
,
p1
,
p2
,
c1
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
c1
in
self
.
_conn
.
execute
(
q
):
vsite
=
mm
.
TwoParticleAverageSite
(
p1
,
p2
,
(
1
-
c1
),
c1
)
vsite
=
mm
.
TwoParticleAverageSite
(
p1
,
p2
,
(
1
-
c1
),
c1
)
sys
.
setVirtualSite
(
p0
,
vsite
)
sys
.
setVirtualSite
(
p0
,
vsite
)
if
'virtual_lc3_term'
in
self
.
_tables
:
if
'virtual_lc3_term'
in
self
.
_tables
:
q
=
'''
SELECT p0, p1, p2, p3, c1, c2
q
=
"""
SELECT p0, p1, p2, p3, c1, c2
FROM virtual_lc3_term INNER JOIN virtual_lc3_param
FROM virtual_lc3_term INNER JOIN virtual_lc3_param
ON virtual_lc3_term.param=virtual_lc3_param.id
'''
ON virtual_lc3_term.param=virtual_lc3_param.id
"""
for
p0
,
p1
,
p2
,
p3
,
c1
,
c2
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
p3
,
c1
,
c2
in
self
.
_conn
.
execute
(
q
):
vsite
=
mm
.
ThreeParticleAverageSite
(
p1
,
p2
,
p3
,
(
1
-
c1
-
c2
),
c1
,
c2
)
vsite
=
mm
.
ThreeParticleAverageSite
(
p1
,
p2
,
p3
,
(
1
-
c1
-
c2
),
c1
,
c2
)
sys
.
setVirtualSite
(
p0
,
vsite
)
sys
.
setVirtualSite
(
p0
,
vsite
)
if
'virtual_out3_term'
in
self
.
_tables
:
if
'virtual_out3_term'
in
self
.
_tables
:
q
=
'''
SELECT p0, p1, p2, p3, c1, c2, c3
q
=
"""
SELECT p0, p1, p2, p3, c1, c2, c3
FROM virtual_out3_term INNER JOIN virtual_out3_param
FROM virtual_out3_term INNER JOIN virtual_out3_param
ON virtual_out3_term.param=virtual_out3_param.id
'''
ON virtual_out3_term.param=virtual_out3_param.id
"""
for
p0
,
p1
,
p2
,
p3
,
c1
,
c2
,
c3
in
self
.
_conn
.
execute
(
q
):
for
p0
,
p1
,
p2
,
p3
,
c1
,
c2
,
c3
in
self
.
_conn
.
execute
(
q
):
vsite
=
mm
.
OutOfPlaneSite
(
p1
,
p2
,
p3
,
c1
,
c2
,
c3
)
vsite
=
mm
.
OutOfPlaneSite
(
p1
,
p2
,
p3
,
c1
,
c2
,
c3
)
sys
.
setVirtualSite
(
p0
,
vsite
)
sys
.
setVirtualSite
(
p0
,
vsite
)
...
@@ -436,14 +436,14 @@ class DesmondDMSFile(object):
...
@@ -436,14 +436,14 @@ class DesmondDMSFile(object):
def
_hasTable
(
self
,
table_name
):
def
_hasTable
(
self
,
table_name
):
'''
Does our DMS file contain this table?
"""
Does our DMS file contain this table?
'''
"""
return
table_name
in
self
.
_tables
return
table_name
in
self
.
_tables
def
_readSchemas
(
self
):
def
_readSchemas
(
self
):
'''
Read the schemas of each of the tables in the dms file, populating
"""
Read the schemas of each of the tables in the dms file, populating
the `_tables` instance attribute
the `_tables` instance attribute
'''
"""
tables
=
{}
tables
=
{}
for
table
in
self
.
_conn
.
execute
(
"SELECT name FROM sqlite_master WHERE type='table'"
):
for
table
in
self
.
_conn
.
execute
(
"SELECT name FROM sqlite_master WHERE type='table'"
):
names
=
[]
names
=
[]
...
@@ -453,9 +453,9 @@ class DesmondDMSFile(object):
...
@@ -453,9 +453,9 @@ class DesmondDMSFile(object):
self
.
_tables
=
tables
self
.
_tables
=
tables
def
_checkForUnsupportedTerms
(
self
):
def
_checkForUnsupportedTerms
(
self
):
'''
Check the file for forcefield terms that are not currenty supported,
"""
Check the file for forcefield terms that are not currenty supported,
raising a NotImplementedError
raising a NotImplementedError
'''
"""
if
'posre_harm_term'
in
self
.
_tables
:
if
'posre_harm_term'
in
self
.
_tables
:
raise
NotImplementedError
(
'Position restraints are not implemented.'
)
raise
NotImplementedError
(
'Position restraints are not implemented.'
)
flat_bottom_potential_terms
=
[
'stretch_fbhw_term'
,
'angle_fbhw_term'
,
flat_bottom_potential_terms
=
[
'stretch_fbhw_term'
,
'angle_fbhw_term'
,
...
@@ -488,8 +488,8 @@ class DesmondDMSFile(object):
...
@@ -488,8 +488,8 @@ class DesmondDMSFile(object):
raise
NotImplementedError
(
'Drude particles are not currently supported'
)
raise
NotImplementedError
(
'Drude particles are not currently supported'
)
def
close
(
self
):
def
close
(
self
):
'''
Close the SQL connection
"""
Close the SQL connection
'''
"""
if
self
.
_open
:
if
self
.
_open
:
self
.
_conn
.
close
()
self
.
_conn
.
close
()
...
...
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