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
3aa4bb8c
Unverified
Commit
3aa4bb8c
authored
Feb 08, 2021
by
Peter Eastman
Committed by
GitHub
Feb 08, 2021
Browse files
Code cleanup (#3014)
parent
84a93cf8
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
69 additions
and
68 deletions
+69
-68
wrappers/python/openmm/app/charmmparameterset.py
wrappers/python/openmm/app/charmmparameterset.py
+0
-1
wrappers/python/openmm/app/charmmpsffile.py
wrappers/python/openmm/app/charmmpsffile.py
+0
-2
wrappers/python/openmm/app/checkpointreporter.py
wrappers/python/openmm/app/checkpointreporter.py
+0
-1
wrappers/python/openmm/app/dcdfile.py
wrappers/python/openmm/app/dcdfile.py
+1
-1
wrappers/python/openmm/app/dcdreporter.py
wrappers/python/openmm/app/dcdreporter.py
+0
-1
wrappers/python/openmm/app/desmonddmsfile.py
wrappers/python/openmm/app/desmonddmsfile.py
+0
-2
wrappers/python/openmm/app/forcefield.py
wrappers/python/openmm/app/forcefield.py
+21
-32
wrappers/python/openmm/app/gromacsgrofile.py
wrappers/python/openmm/app/gromacsgrofile.py
+1
-4
wrappers/python/openmm/app/internal/amber_file_parser.py
wrappers/python/openmm/app/internal/amber_file_parser.py
+1
-5
wrappers/python/openmm/app/internal/charmm/__init__.py
wrappers/python/openmm/app/internal/charmm/__init__.py
+0
-1
wrappers/python/openmm/app/internal/charmm/topologyobjects.py
...pers/python/openmm/app/internal/charmm/topologyobjects.py
+19
-2
wrappers/python/openmm/app/internal/pdbstructure.py
wrappers/python/openmm/app/internal/pdbstructure.py
+0
-2
wrappers/python/openmm/app/modeller.py
wrappers/python/openmm/app/modeller.py
+3
-7
wrappers/python/openmm/app/pdbfile.py
wrappers/python/openmm/app/pdbfile.py
+1
-1
wrappers/python/openmm/app/pdbreporter.py
wrappers/python/openmm/app/pdbreporter.py
+0
-1
wrappers/python/openmm/app/pdbxfile.py
wrappers/python/openmm/app/pdbxfile.py
+1
-1
wrappers/python/openmm/unit/basedimension.py
wrappers/python/openmm/unit/basedimension.py
+9
-0
wrappers/python/openmm/unit/quantity.py
wrappers/python/openmm/unit/quantity.py
+3
-1
wrappers/python/openmm/unit/unit.py
wrappers/python/openmm/unit/unit.py
+9
-1
wrappers/python/openmm/unit/unit_operators.py
wrappers/python/openmm/unit/unit_operators.py
+0
-2
No files found.
wrappers/python/openmm/app/charmmparameterset.py
View file @
3aa4bb8c
...
@@ -42,7 +42,6 @@ from openmm.app.internal.charmm.topologyobjects import (
...
@@ -42,7 +42,6 @@ from openmm.app.internal.charmm.topologyobjects import (
UreyBradleyType
,
NoUreyBradley
)
UreyBradleyType
,
NoUreyBradley
)
from
openmm.app.internal.charmm.exceptions
import
CharmmFileError
from
openmm.app.internal.charmm.exceptions
import
CharmmFileError
from
openmm.app.element
import
Element
,
get_by_symbol
from
openmm.app.element
import
Element
,
get_by_symbol
import
openmm.unit
as
u
import
warnings
import
warnings
class
CharmmParameterSet
(
object
):
class
CharmmParameterSet
(
object
):
...
...
wrappers/python/openmm/app/charmmpsffile.py
View file @
3aa4bb8c
...
@@ -1535,8 +1535,6 @@ class CharmmPsfFile(object):
...
@@ -1535,8 +1535,6 @@ class CharmmPsfFile(object):
# Multiply by 0.73 to account for ion exclusions, and multiply
# Multiply by 0.73 to account for ion exclusions, and multiply
# by 10 to convert to 1/nm from 1/angstroms
# by 10 to convert to 1/nm from 1/angstroms
implicitSolventKappa
*=
7.3
implicitSolventKappa
*=
7.3
elif
implicitSolvent
is
None
:
implicitSolventKappa
=
0.0
if
u
.
is_quantity
(
implicitSolventKappa
):
if
u
.
is_quantity
(
implicitSolventKappa
):
implicitSolventKappa
=
implicitSolventKappa
.
value_in_unit
(
implicitSolventKappa
=
implicitSolventKappa
.
value_in_unit
(
...
...
wrappers/python/openmm/app/checkpointreporter.py
View file @
3aa4bb8c
...
@@ -32,7 +32,6 @@ from __future__ import absolute_import
...
@@ -32,7 +32,6 @@ from __future__ import absolute_import
__author__
=
"Robert McGibbon"
__author__
=
"Robert McGibbon"
__version__
=
"1.0"
__version__
=
"1.0"
import
openmm
as
mm
import
os
import
os
import
os.path
import
os.path
...
...
wrappers/python/openmm/app/dcdfile.py
View file @
3aa4bb8c
...
@@ -37,7 +37,7 @@ import os
...
@@ -37,7 +37,7 @@ import os
import
time
import
time
import
struct
import
struct
import
math
import
math
from
openmm.unit
import
picoseconds
,
nanometers
,
angstroms
,
is_quantity
,
norm
from
openmm.unit
import
picoseconds
,
nanometers
,
is_quantity
,
norm
from
openmm
import
Vec3
from
openmm
import
Vec3
from
openmm.app.internal.unitcell
import
computeLengthsAndAngles
from
openmm.app.internal.unitcell
import
computeLengthsAndAngles
...
...
wrappers/python/openmm/app/dcdreporter.py
View file @
3aa4bb8c
...
@@ -32,7 +32,6 @@ from __future__ import absolute_import
...
@@ -32,7 +32,6 @@ from __future__ import absolute_import
__author__
=
"Peter Eastman"
__author__
=
"Peter Eastman"
__version__
=
"1.0"
__version__
=
"1.0"
import
openmm
as
mm
from
openmm.app
import
DCDFile
from
openmm.app
import
DCDFile
from
openmm.unit
import
nanometer
from
openmm.unit
import
nanometer
...
...
wrappers/python/openmm/app/desmonddmsfile.py
View file @
3aa4bb8c
...
@@ -285,7 +285,6 @@ class DesmondDMSFile(object):
...
@@ -285,7 +285,6 @@ class DesmondDMSFile(object):
gammaN
=
gamma_conv
*
(
igamma
+
0.
*
sgamma
)
#AGBNP must have only one gamma
gammaN
=
gamma_conv
*
(
igamma
+
0.
*
sgamma
)
#AGBNP must have only one gamma
alphaN
=
alpha_conv
*
(
ialpha
+
salpha
)
alphaN
=
alpha_conv
*
(
ialpha
+
salpha
)
# delta parameter is ignored
# delta parameter is ignored
hbtypeN
=
hbtype
hbwN
=
en_conv
*
hbw
hbwN
=
en_conv
*
hbw
gb_p
.
append
([
radiusN
,
chargeN
,
gammaN
,
alphaN
,
hbtype
,
hbwN
,
ishydrogenN
])
gb_p
.
append
([
radiusN
,
chargeN
,
gammaN
,
alphaN
,
hbtype
,
hbwN
,
ishydrogenN
])
return
gb_p
return
gb_p
...
@@ -831,7 +830,6 @@ class DesmondDMSFile(object):
...
@@ -831,7 +830,6 @@ class DesmondDMSFile(object):
go
.
append
(
True
)
go
.
append
(
True
)
if
go
[
fcounter
]
and
(
not
self
.
_hasTable
(
'posre_harm_param'
,
tables
)):
if
go
[
fcounter
]
and
(
not
self
.
_hasTable
(
'posre_harm_param'
,
tables
)):
raise
IOError
(
'DMS file lacks posre_harm_param table even though posre_harm_term table is present.'
)
raise
IOError
(
'DMS file lacks posre_harm_param table even though posre_harm_term table is present.'
)
return
if
not
any
(
go
):
if
not
any
(
go
):
return
return
...
...
wrappers/python/openmm/app/forcefield.py
View file @
3aa4bb8c
...
@@ -44,7 +44,6 @@ from collections import defaultdict
...
@@ -44,7 +44,6 @@ from collections import defaultdict
import
openmm
as
mm
import
openmm
as
mm
import
openmm.unit
as
unit
import
openmm.unit
as
unit
from
.
import
element
as
elem
from
.
import
element
as
elem
from
openmm.app
import
Topology
from
openmm.app.internal.singleton
import
Singleton
from
openmm.app.internal.singleton
import
Singleton
from
openmm.app.internal
import
compiled
from
openmm.app.internal
import
compiled
...
@@ -589,16 +588,16 @@ class ForceField(object):
...
@@ -589,16 +588,16 @@ class ForceField(object):
self
.
atomParameters
=
{}
self
.
atomParameters
=
{}
self
.
atomTemplateIndexes
=
{}
self
.
atomTemplateIndexes
=
{}
self
.
atoms
=
list
(
topology
.
atoms
())
self
.
atoms
=
list
(
topology
.
atoms
())
self
.
excludeAtomWith
=
[[]
for
a
in
self
.
atoms
]
self
.
excludeAtomWith
=
[[]
for
_
in
self
.
atoms
]
self
.
virtualSites
=
{}
self
.
virtualSites
=
{}
self
.
bonds
=
[
ForceField
.
_BondData
(
bond
[
0
].
index
,
bond
[
1
].
index
)
for
bond
in
topology
.
bonds
()]
self
.
bonds
=
[
ForceField
.
_BondData
(
bond
[
0
].
index
,
bond
[
1
].
index
)
for
bond
in
topology
.
bonds
()]
self
.
angles
=
[]
self
.
angles
=
[]
self
.
propers
=
[]
self
.
propers
=
[]
self
.
impropers
=
[]
self
.
impropers
=
[]
self
.
atomBonds
=
[[]
for
a
in
self
.
atoms
]
self
.
atomBonds
=
[[]
for
_
in
self
.
atoms
]
self
.
isAngleConstrained
=
[]
self
.
isAngleConstrained
=
[]
self
.
constraints
=
{}
self
.
constraints
=
{}
self
.
bondedToAtom
=
[
set
()
for
a
in
self
.
atoms
]
self
.
bondedToAtom
=
[
set
()
for
_
in
self
.
atoms
]
# Record which atoms are bonded to each other atom
# Record which atoms are bonded to each other atom
...
@@ -994,9 +993,7 @@ class ForceField(object):
...
@@ -994,9 +993,7 @@ class ForceField(object):
bondedToAtom[index] is the list of atom indices bonded to atom `index`
bondedToAtom[index] is the list of atom indices bonded to atom `index`
"""
"""
bondedToAtom
=
[]
bondedToAtom
=
[
set
()
for
_
in
topology
.
atoms
()]
for
atom
in
topology
.
atoms
():
bondedToAtom
.
append
(
set
())
for
(
atom1
,
atom2
)
in
topology
.
bonds
():
for
(
atom1
,
atom2
)
in
topology
.
bonds
():
bondedToAtom
[
atom1
.
index
].
add
(
atom2
.
index
)
bondedToAtom
[
atom1
.
index
].
add
(
atom2
.
index
)
bondedToAtom
[
atom2
.
index
].
add
(
atom1
.
index
)
bondedToAtom
[
atom2
.
index
].
add
(
atom1
.
index
)
...
@@ -2169,7 +2166,7 @@ class PeriodicTorsionGenerator(object):
...
@@ -2169,7 +2166,7 @@ class PeriodicTorsionGenerator(object):
force
.
addTorsion
(
torsion
[
0
],
torsion
[
1
],
torsion
[
2
],
torsion
[
3
],
match
.
periodicity
[
i
],
match
.
phase
[
i
],
match
.
k
[
i
])
force
.
addTorsion
(
torsion
[
0
],
torsion
[
1
],
torsion
[
2
],
torsion
[
3
],
match
.
periodicity
[
i
],
match
.
phase
[
i
],
match
.
k
[
i
])
impr_cache
=
{}
impr_cache
=
{}
for
torsion
in
data
.
impropers
:
for
torsion
in
data
.
impropers
:
t1
,
t2
,
t3
,
t4
=
tatoms
=
[
data
.
atomType
[
data
.
atoms
[
torsion
[
i
]]]
for
i
in
range
(
4
)]
t1
,
t2
,
t3
,
t4
=
[
data
.
atomType
[
data
.
atoms
[
torsion
[
i
]]]
for
i
in
range
(
4
)]
sig
=
(
t1
,
t2
,
t3
,
t4
)
sig
=
(
t1
,
t2
,
t3
,
t4
)
match
=
impr_cache
.
get
(
sig
,
None
)
match
=
impr_cache
.
get
(
sig
,
None
)
if
match
==
-
1
:
if
match
==
-
1
:
...
@@ -3086,7 +3083,7 @@ class CustomHbondGenerator(object):
...
@@ -3086,7 +3083,7 @@ class CustomHbondGenerator(object):
type1
=
data
.
atomType
[
atom
]
type1
=
data
.
atomType
[
atom
]
for
i
in
range
(
len
(
self
.
donorTypes1
)):
for
i
in
range
(
len
(
self
.
donorTypes1
)):
types1
=
self
.
donorTypes1
[
i
]
types1
=
self
.
donorTypes1
[
i
]
if
type1
in
self
.
donorT
ypes1
[
i
]
:
if
type1
in
t
ypes1
:
force
.
addDonor
(
atom
.
index
,
-
1
,
-
1
,
self
.
donorParamValues
[
i
])
force
.
addDonor
(
atom
.
index
,
-
1
,
-
1
,
self
.
donorParamValues
[
i
])
elif
self
.
particlesPerDonor
==
2
:
elif
self
.
particlesPerDonor
==
2
:
for
bond
in
data
.
bonds
:
for
bond
in
data
.
bonds
:
...
@@ -3118,7 +3115,7 @@ class CustomHbondGenerator(object):
...
@@ -3118,7 +3115,7 @@ class CustomHbondGenerator(object):
type1
=
data
.
atomType
[
atom
]
type1
=
data
.
atomType
[
atom
]
for
i
in
range
(
len
(
self
.
acceptorTypes1
)):
for
i
in
range
(
len
(
self
.
acceptorTypes1
)):
types1
=
self
.
acceptorTypes1
[
i
]
types1
=
self
.
acceptorTypes1
[
i
]
if
type1
in
self
.
acceptorT
ypes1
[
i
]
:
if
type1
in
t
ypes1
:
force
.
addAcceptor
(
atom
.
index
,
-
1
,
-
1
,
self
.
acceptorParamValues
[
i
])
force
.
addAcceptor
(
atom
.
index
,
-
1
,
-
1
,
self
.
acceptorParamValues
[
i
])
elif
self
.
particlesPerAcceptor
==
2
:
elif
self
.
particlesPerAcceptor
==
2
:
for
bond
in
data
.
bonds
:
for
bond
in
data
.
bonds
:
...
@@ -3685,7 +3682,6 @@ class AmoebaOutOfPlaneBendGenerator(object):
...
@@ -3685,7 +3682,6 @@ class AmoebaOutOfPlaneBendGenerator(object):
# find atom shared by both bonds making up the angle
# find atom shared by both bonds making up the angle
middleAtom
=
-
1
for
atomIndex
in
angle
:
for
atomIndex
in
angle
:
isMiddle
=
0
isMiddle
=
0
for
bond
in
data
.
atomBonds
[
atomIndex
]:
for
bond
in
data
.
atomBonds
[
atomIndex
]:
...
@@ -3733,8 +3729,6 @@ class AmoebaOutOfPlaneBendGenerator(object):
...
@@ -3733,8 +3729,6 @@ class AmoebaOutOfPlaneBendGenerator(object):
inPlaneAngles
=
[]
inPlaneAngles
=
[]
nonInPlaneAngles
=
[]
nonInPlaneAngles
=
[]
nonInPlaneAnglesConstrained
=
[]
idealAngles
=
[]
*
len
(
data
.
angles
)
for
(
angle
,
isConstrained
)
in
zip
(
data
.
angles
,
data
.
isAngleConstrained
):
for
(
angle
,
isConstrained
)
in
zip
(
data
.
angles
,
data
.
isAngleConstrained
):
...
@@ -4026,12 +4020,12 @@ class AmoebaPiTorsionGenerator(object):
...
@@ -4026,12 +4020,12 @@ class AmoebaPiTorsionGenerator(object):
else
:
else
:
force
=
existing
[
0
]
force
=
existing
[
0
]
for
bond
in
data
.
bonds
:
for
bond
1
in
data
.
bonds
:
# search for bonds with both atoms in bond having covalency == 3
# search for bonds with both atoms in bond having covalency == 3
atom1
=
bond
.
atom1
atom1
=
bond
1
.
atom1
atom2
=
bond
.
atom2
atom2
=
bond
1
.
atom2
if
(
len
(
data
.
atomBonds
[
atom1
])
==
3
and
len
(
data
.
atomBonds
[
atom2
])
==
3
):
if
(
len
(
data
.
atomBonds
[
atom1
])
==
3
and
len
(
data
.
atomBonds
[
atom2
])
==
3
):
...
@@ -4283,9 +4277,9 @@ class AmoebaTorsionTorsionGenerator(object):
...
@@ -4283,9 +4277,9 @@ class AmoebaTorsionTorsionGenerator(object):
ia
=
bondedAtom2
ia
=
bondedAtom2
if
(
ia
!=
ic
and
ia
!=
id
):
if
(
ia
!=
ic
and
ia
!=
id
):
for
bondIndex
in
data
.
atomBonds
[
id
]:
for
bondIndex
2
in
data
.
atomBonds
[
id
]:
bondedAtom1
=
data
.
bonds
[
bondIndex
].
atom1
bondedAtom1
=
data
.
bonds
[
bondIndex
2
].
atom1
bondedAtom2
=
data
.
bonds
[
bondIndex
].
atom2
bondedAtom2
=
data
.
bonds
[
bondIndex
2
].
atom2
if
(
bondedAtom1
!=
id
):
if
(
bondedAtom1
!=
id
):
ie
=
bondedAtom1
ie
=
bondedAtom1
else
:
else
:
...
@@ -4409,10 +4403,6 @@ class AmoebaStretchBendGenerator(object):
...
@@ -4409,10 +4403,6 @@ class AmoebaStretchBendGenerator(object):
for
angleDict
in
angleList
:
for
angleDict
in
angleList
:
angle
=
angleDict
[
'angle'
]
angle
=
angleDict
[
'angle'
]
if
(
'isConstrained'
in
angleDict
):
isConstrained
=
angleDict
[
'isConstrained'
]
else
:
isConstrained
=
0
type1
=
data
.
atomType
[
data
.
atoms
[
angle
[
0
]]]
type1
=
data
.
atomType
[
data
.
atoms
[
angle
[
0
]]]
type2
=
data
.
atomType
[
data
.
atoms
[
angle
[
1
]]]
type2
=
data
.
atomType
[
data
.
atoms
[
angle
[
1
]]]
...
@@ -4522,7 +4512,6 @@ class AmoebaVdwGenerator(object):
...
@@ -4522,7 +4512,6 @@ class AmoebaVdwGenerator(object):
generator
.
radiustype
!=
element
.
attrib
[
'radiustype'
]
or
generator
.
radiussize
!=
element
.
attrib
[
'radiussize'
]:
generator
.
radiustype
!=
element
.
attrib
[
'radiustype'
]
or
generator
.
radiussize
!=
element
.
attrib
[
'radiussize'
]:
raise
ValueError
(
'Found multiple AmoebaVdwForce tags with different combining rules'
)
raise
ValueError
(
'Found multiple AmoebaVdwForce tags with different combining rules'
)
generator
.
params
.
parseDefinitions
(
element
)
generator
.
params
.
parseDefinitions
(
element
)
two_six
=
1.122462048309372
#=============================================================================================
#=============================================================================================
...
@@ -5096,10 +5085,10 @@ class AmoebaMultipoleGenerator(object):
...
@@ -5096,10 +5085,10 @@ class AmoebaMultipoleGenerator(object):
zaxis
=
xaxis
zaxis
=
xaxis
xaxis
=
swapI
xaxis
=
swapI
else
:
else
:
for
bondedAtomXIndex
in
bondedAtomIndices
:
for
bondedAtomXIndex
2
in
bondedAtomIndices
:
bondedAtomX1Type
=
int
(
data
.
atomType
[
data
.
atoms
[
bondedAtomXIndex
]])
bondedAtomX1Type
=
int
(
data
.
atomType
[
data
.
atoms
[
bondedAtomXIndex
2
]])
if
(
bondedAtomX1Type
==
kx
and
bondedAtomXIndex
!=
bondedAtomZIndex
and
bondedAtomXIndex
<
xaxis
):
if
(
bondedAtomX1Type
==
kx
and
bondedAtomXIndex
2
!=
bondedAtomZIndex
and
bondedAtomXIndex
2
<
xaxis
):
xaxis
=
bondedAtomXIndex
xaxis
=
bondedAtomXIndex
2
savedMultipoleDict
=
multipoleDict
savedMultipoleDict
=
multipoleDict
hit
=
1
hit
=
1
...
@@ -5160,10 +5149,10 @@ class AmoebaMultipoleGenerator(object):
...
@@ -5160,10 +5149,10 @@ class AmoebaMultipoleGenerator(object):
# select xaxis w/ smallest index
# select xaxis w/ smallest index
for
bondedAtomXIndex
in
bondedAtom13Indices
:
for
bondedAtomXIndex
2
in
bondedAtom13Indices
:
bondedAtomX1Type
=
int
(
data
.
atomType
[
data
.
atoms
[
bondedAtomXIndex
]])
bondedAtomX1Type
=
int
(
data
.
atomType
[
data
.
atoms
[
bondedAtomXIndex
2
]])
if
(
bondedAtomX1Type
==
kx
and
bondedAtomXIndex
!=
bondedAtomZIndex
and
bondedAtomZIndex
in
bonded12ParticleSets
[
bondedAtomXIndex
]
and
bondedAtomXIndex
<
xaxis
):
if
(
bondedAtomX1Type
==
kx
and
bondedAtomXIndex
2
!=
bondedAtomZIndex
and
bondedAtomZIndex
in
bonded12ParticleSets
[
bondedAtomXIndex
2
]
and
bondedAtomXIndex
2
<
xaxis
):
xaxis
=
bondedAtomXIndex
xaxis
=
bondedAtomXIndex
2
savedMultipoleDict
=
multipoleDict
savedMultipoleDict
=
multipoleDict
hit
=
3
hit
=
3
...
...
wrappers/python/openmm/app/gromacsgrofile.py
View file @
3aa4bb8c
...
@@ -32,12 +32,10 @@ from __future__ import absolute_import
...
@@ -32,12 +32,10 @@ from __future__ import absolute_import
__author__
=
"Lee-Ping Wang"
__author__
=
"Lee-Ping Wang"
__version__
=
"1.0"
__version__
=
"1.0"
import
os
import
sys
from
openmm
import
Vec3
from
openmm
import
Vec3
from
openmm.app.internal.unitcell
import
reducePeriodicBoxVectors
from
openmm.app.internal.unitcell
import
reducePeriodicBoxVectors
from
re
import
sub
,
match
from
re
import
sub
,
match
from
openmm.unit
import
nanometers
,
angstroms
,
Quantity
from
openmm.unit
import
nanometers
,
Quantity
from
.
import
element
as
elem
from
.
import
element
as
elem
try
:
try
:
import
numpy
import
numpy
...
@@ -158,7 +156,6 @@ class GromacsGroFile(object):
...
@@ -158,7 +156,6 @@ class GromacsGroFile(object):
pos
=
[
float
(
line
[
20
+
i
*
digits
:
20
+
(
i
+
1
)
*
digits
])
for
i
in
range
(
3
)]
pos
=
[
float
(
line
[
20
+
i
*
digits
:
20
+
(
i
+
1
)
*
digits
])
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
(
_construct_box_vectors
(
line
))
boxes
.
append
(
_construct_box_vectors
(
line
))
xyzs
.
append
(
xyz
*
nanometers
)
xyzs
.
append
(
xyz
*
nanometers
)
xyz
=
[]
xyz
=
[]
...
...
wrappers/python/openmm/app/internal/amber_file_parser.py
View file @
3aa4bb8c
...
@@ -42,7 +42,7 @@ from __future__ import absolute_import, print_function
...
@@ -42,7 +42,7 @@ from __future__ import absolute_import, print_function
import
os
import
os
import
re
import
re
from
math
import
ceil
,
cos
,
sin
,
asin
,
sqrt
,
pi
from
math
import
ceil
,
cos
,
sin
,
asin
,
sqrt
import
warnings
import
warnings
try
:
try
:
...
@@ -1190,14 +1190,10 @@ class AmberAsciiRestart(object):
...
@@ -1190,14 +1190,10 @@ class AmberAsciiRestart(object):
coordinates
=
np
.
zeros
((
self
.
natom
,
3
),
np
.
float32
)
coordinates
=
np
.
zeros
((
self
.
natom
,
3
),
np
.
float32
)
if
hasvels
:
if
hasvels
:
velocities
=
np
.
zeros
((
self
.
natom
,
3
),
np
.
float32
)
velocities
=
np
.
zeros
((
self
.
natom
,
3
),
np
.
float32
)
if
hasbox
:
boxVectors
=
np
.
zeros
((
3
,
3
),
np
.
float32
)
else
:
else
:
coordinates
=
[
Vec3
(
0.0
,
0.0
,
0.0
)
for
i
in
range
(
self
.
natom
)]
coordinates
=
[
Vec3
(
0.0
,
0.0
,
0.0
)
for
i
in
range
(
self
.
natom
)]
if
hasvels
:
if
hasvels
:
velocities
=
[
Vec3
(
0.0
,
0.0
,
0.0
)
for
i
in
range
(
self
.
natom
)]
velocities
=
[
Vec3
(
0.0
,
0.0
,
0.0
)
for
i
in
range
(
self
.
natom
)]
if
hasbox
:
boxVectors
=
[[
0.0
,
0.0
,
0.0
]
for
i
in
range
(
3
)]
# Now it's time to parse. Coordinates first
# Now it's time to parse. Coordinates first
startline
=
2
startline
=
2
...
...
wrappers/python/openmm/app/internal/charmm/__init__.py
View file @
3aa4bb8c
...
@@ -21,7 +21,6 @@ simulation with CHARMM; specifically PSF, PAR, RTF, and STR files
...
@@ -21,7 +21,6 @@ simulation with CHARMM; specifically PSF, PAR, RTF, and STR files
field parameter files
field parameter files
"""
"""
__all__
=
[
'psf'
,
'parameters'
]
__authors__
=
'Jason Swails'
__authors__
=
'Jason Swails'
__contributors__
=
''
__contributors__
=
''
__license__
=
'MIT'
__license__
=
'MIT'
...
...
wrappers/python/openmm/app/internal/charmm/topologyobjects.py
View file @
3aa4bb8c
...
@@ -34,10 +34,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
...
@@ -34,10 +34,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
"""
from
__future__
import
absolute_import
from
__future__
import
absolute_import
from
openmm.app.internal.charmm.exceptions
import
(
from
openmm.app.internal.charmm.exceptions
import
(
SplitResidueWarning
,
BondError
,
ResidueError
,
CmapError
,
BondError
,
ResidueError
,
CmapError
,
MissingParameter
)
MissingParameter
)
import
openmm.unit
as
u
import
openmm.unit
as
u
import
warnings
TINY
=
1e-8
TINY
=
1e-8
...
@@ -160,6 +159,8 @@ class AtomType(object):
...
@@ -160,6 +159,8 @@ class AtomType(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
__hash__
=
None
def
set_lj_params
(
self
,
eps
,
rmin
,
eps14
=
None
,
rmin14
=
None
):
def
set_lj_params
(
self
,
eps
,
rmin
,
eps14
=
None
,
rmin14
=
None
):
""" Sets Lennard-Jones parameters on this atom type """
""" Sets Lennard-Jones parameters on this atom type """
if
eps14
is
None
:
if
eps14
is
None
:
...
@@ -229,6 +230,8 @@ class WildCard(AtomType):
...
@@ -229,6 +230,8 @@ class WildCard(AtomType):
def
__le__
(
self
,
other
):
return
True
def
__le__
(
self
,
other
):
return
True
def
__ge__
(
self
,
other
):
return
True
def
__ge__
(
self
,
other
):
return
True
__hash__
=
None
WildCard
=
WildCard
()
# Turn it into a singleton
WildCard
=
WildCard
()
# Turn it into a singleton
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...
@@ -473,6 +476,8 @@ class Residue(object):
...
@@ -473,6 +476,8 @@ class Residue(object):
def
__ne__
(
self
,
thing
):
def
__ne__
(
self
,
thing
):
return
not
self
.
__eq__
(
thing
)
return
not
self
.
__eq__
(
thing
)
__hash__
=
None
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class
ResidueList
(
list
):
class
ResidueList
(
list
):
...
@@ -992,6 +997,8 @@ class BondType(object):
...
@@ -992,6 +997,8 @@ class BondType(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
__hash__
=
None
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class
AngleType
(
object
):
class
AngleType
(
object
):
...
@@ -1015,6 +1022,8 @@ class AngleType(object):
...
@@ -1015,6 +1022,8 @@ class AngleType(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
__hash__
=
None
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class
UreyBradleyType
(
BondType
):
class
UreyBradleyType
(
BondType
):
...
@@ -1059,6 +1068,8 @@ class DihedralType(object):
...
@@ -1059,6 +1068,8 @@ class DihedralType(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
__hash__
=
None
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class
ImproperType
(
object
):
class
ImproperType
(
object
):
...
@@ -1082,6 +1093,8 @@ class ImproperType(object):
...
@@ -1082,6 +1093,8 @@ class ImproperType(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
__hash__
=
None
def
__repr__
(
self
):
def
__repr__
(
self
):
return
'<ImproperType; k=%s; phieq=%s>'
%
(
self
.
k
,
self
.
phieq
)
return
'<ImproperType; k=%s; phieq=%s>'
%
(
self
.
k
,
self
.
phieq
)
...
@@ -1120,6 +1133,8 @@ class CmapType(object):
...
@@ -1120,6 +1133,8 @@ class CmapType(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
__hash__
=
None
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Take the CmapGrid class from the Chamber prmtop topology objects
# Take the CmapGrid class from the Chamber prmtop topology objects
...
@@ -1220,6 +1235,8 @@ class _CmapGrid(object):
...
@@ -1220,6 +1235,8 @@ class _CmapGrid(object):
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
__hash__
=
None
def
switch_range
(
self
):
def
switch_range
(
self
):
"""
"""
Returns a grid object whose range is 0 to 360 degrees in both dimensions
Returns a grid object whose range is 0 to 360 degrees in both dimensions
...
...
wrappers/python/openmm/app/internal/pdbstructure.py
View file @
3aa4bb8c
...
@@ -1020,8 +1020,6 @@ if __name__=='__main__':
...
@@ -1020,8 +1020,6 @@ if __name__=='__main__':
# print str(a)
# print str(a)
assert
str
(
a
).
rstrip
()
==
pdb_line
.
rstrip
()
assert
str
(
a
).
rstrip
()
==
pdb_line
.
rstrip
()
a
=
Atom
(
"ATOM 2209 CB TYR A 299 6.167 22.607 20.046 1.00 8.12 C"
)
# misaligned residue name - bad
# misaligned residue name - bad
try
:
try
:
a
=
Atom
(
"ATOM 2209 CB TYRA 299 6.167 22.607 20.046 1.00 8.12 C"
)
a
=
Atom
(
"ATOM 2209 CB TYRA 299 6.167 22.607 20.046 1.00 8.12 C"
)
...
...
wrappers/python/openmm/app/modeller.py
View file @
3aa4bb8c
...
@@ -35,12 +35,11 @@ __author__ = "Peter Eastman"
...
@@ -35,12 +35,11 @@ __author__ = "Peter Eastman"
__version__
=
"1.0"
__version__
=
"1.0"
from
openmm.app
import
Topology
,
PDBFile
,
ForceField
from
openmm.app
import
Topology
,
PDBFile
,
ForceField
from
openmm.app.forcefield
import
HAngles
,
AllBonds
,
CutoffNonPeriodic
,
CutoffPeriodic
,
_createResidueSignature
,
DrudeGenerator
from
openmm.app.forcefield
import
AllBonds
,
CutoffNonPeriodic
,
CutoffPeriodic
,
DrudeGenerator
from
openmm.app.topology
import
Residue
from
openmm.app.internal
import
compiled
from
openmm.app.internal
import
compiled
from
openmm.vec3
import
Vec3
from
openmm.vec3
import
Vec3
from
openmm
import
System
,
Context
,
NonbondedForce
,
CustomNonbondedForce
,
HarmonicBondForce
,
HarmonicAngleForce
,
VerletIntegrator
,
LangevinIntegrator
,
LocalEnergyMinimizer
from
openmm
import
System
,
Context
,
NonbondedForce
,
CustomNonbondedForce
,
HarmonicBondForce
,
HarmonicAngleForce
,
VerletIntegrator
,
LangevinIntegrator
,
LocalEnergyMinimizer
from
openmm.unit
import
nanometer
,
molar
,
elementary_charge
,
amu
,
gram
,
liter
,
degree
,
sqrt
,
acos
,
is_quantity
,
dot
,
norm
,
kilojoules_per_mole
from
openmm.unit
import
nanometer
,
molar
,
elementary_charge
,
degree
,
acos
,
is_quantity
,
dot
,
norm
,
kilojoules_per_mole
import
openmm.unit
as
unit
import
openmm.unit
as
unit
from
.
import
element
as
elem
from
.
import
element
as
elem
import
gc
import
gc
...
@@ -478,7 +477,6 @@ class Modeller(object):
...
@@ -478,7 +477,6 @@ class Modeller(object):
vectors
=
self
.
topology
.
getPeriodicBoxVectors
().
value_in_unit
(
nanometer
)
vectors
=
self
.
topology
.
getPeriodicBoxVectors
().
value_in_unit
(
nanometer
)
if
box
is
None
:
if
box
is
None
:
raise
ValueError
(
'Neither the box size, box vectors, nor padding was specified, and the Topology does not define unit cell dimensions'
)
raise
ValueError
(
'Neither the box size, box vectors, nor padding was specified, and the Topology does not define unit cell dimensions'
)
invBox
=
Vec3
(
1.0
/
box
[
0
],
1.0
/
box
[
1
],
1.0
/
box
[
2
])
# Have the ForceField build a System for the solute from which we can determine van der Waals radii.
# Have the ForceField build a System for the solute from which we can determine van der Waals radii.
...
@@ -1030,9 +1028,7 @@ class Modeller(object):
...
@@ -1030,9 +1028,7 @@ class Modeller(object):
"""
"""
# Record which atoms are bonded to each other atom.
# Record which atoms are bonded to each other atom.
bondedToAtom
=
[]
bondedToAtom
=
[
set
()
for
_
in
self
.
topology
.
atoms
()]
for
atom
in
self
.
topology
.
atoms
():
bondedToAtom
.
append
(
set
())
for
atom1
,
atom2
in
self
.
topology
.
bonds
():
for
atom1
,
atom2
in
self
.
topology
.
bonds
():
bondedToAtom
[
atom1
.
index
].
add
(
atom2
.
index
)
bondedToAtom
[
atom1
.
index
].
add
(
atom2
.
index
)
bondedToAtom
[
atom2
.
index
].
add
(
atom1
.
index
)
bondedToAtom
[
atom2
.
index
].
add
(
atom1
.
index
)
...
...
wrappers/python/openmm/app/pdbfile.py
View file @
3aa4bb8c
...
@@ -42,7 +42,7 @@ from openmm import Vec3, Platform
...
@@ -42,7 +42,7 @@ from openmm import Vec3, Platform
from
openmm.app.internal.pdbstructure
import
PdbStructure
from
openmm.app.internal.pdbstructure
import
PdbStructure
from
openmm.app.internal.unitcell
import
computeLengthsAndAngles
from
openmm.app.internal.unitcell
import
computeLengthsAndAngles
from
openmm.app
import
Topology
from
openmm.app
import
Topology
from
openmm.unit
import
nanometers
,
angstroms
,
is_quantity
,
norm
,
Quantity
,
dot
from
openmm.unit
import
nanometers
,
angstroms
,
is_quantity
,
norm
,
Quantity
from
.
import
element
as
elem
from
.
import
element
as
elem
try
:
try
:
import
numpy
import
numpy
...
...
wrappers/python/openmm/app/pdbreporter.py
View file @
3aa4bb8c
...
@@ -32,7 +32,6 @@ from __future__ import absolute_import
...
@@ -32,7 +32,6 @@ from __future__ import absolute_import
__author__
=
"Peter Eastman"
__author__
=
"Peter Eastman"
__version__
=
"1.0"
__version__
=
"1.0"
import
openmm
as
mm
from
openmm.app
import
PDBFile
,
PDBxFile
from
openmm.app
import
PDBFile
,
PDBxFile
class
PDBReporter
(
object
):
class
PDBReporter
(
object
):
...
...
wrappers/python/openmm/app/pdbxfile.py
View file @
3aa4bb8c
...
@@ -40,7 +40,7 @@ from datetime import date
...
@@ -40,7 +40,7 @@ from datetime import date
from
openmm.app.internal.pdbx.reader.PdbxReader
import
PdbxReader
from
openmm.app.internal.pdbx.reader.PdbxReader
import
PdbxReader
from
openmm.app.internal.unitcell
import
computePeriodicBoxVectors
,
computeLengthsAndAngles
from
openmm.app.internal.unitcell
import
computePeriodicBoxVectors
,
computeLengthsAndAngles
from
openmm.app
import
Topology
,
PDBFile
from
openmm.app
import
Topology
,
PDBFile
from
openmm.unit
import
nanometers
,
angstroms
,
is_quantity
,
norm
,
Quantity
,
dot
from
openmm.unit
import
nanometers
,
angstroms
,
is_quantity
,
norm
,
Quantity
from
.
import
element
as
elem
from
.
import
element
as
elem
try
:
try
:
import
numpy
import
numpy
...
...
wrappers/python/openmm/unit/basedimension.py
View file @
3aa4bb8c
...
@@ -79,6 +79,15 @@ class BaseDimension(object):
...
@@ -79,6 +79,15 @@ class BaseDimension(object):
"""
"""
return
self
.
_index
<
other
.
_index
return
self
.
_index
<
other
.
_index
def
__le__
(
self
,
other
):
return
self
.
_index
<=
other
.
_index
def
__gt__
(
self
,
other
):
return
self
.
_index
>
other
.
_index
def
__ge__
(
self
,
other
):
return
self
.
_index
>=
other
.
_index
def
__hash__
(
self
):
def
__hash__
(
self
):
"""
"""
Needed for using BaseDimensions as hash keys.
Needed for using BaseDimensions as hash keys.
...
...
wrappers/python/openmm/unit/quantity.py
View file @
3aa4bb8c
...
@@ -118,7 +118,7 @@ class Quantity(object):
...
@@ -118,7 +118,7 @@ class Quantity(object):
# Is value a container?
# Is value a container?
is_container
=
True
is_container
=
True
try
:
try
:
i
=
iter
(
value
)
_
=
iter
(
value
)
except
TypeError
:
except
TypeError
:
is_container
=
False
is_container
=
False
if
is_container
:
if
is_container
:
...
@@ -287,6 +287,8 @@ class Quantity(object):
...
@@ -287,6 +287,8 @@ class Quantity(object):
def
__lt__
(
self
,
other
):
def
__lt__
(
self
,
other
):
return
self
.
_value
<
(
other
.
value_in_unit
(
self
.
unit
))
return
self
.
_value
<
(
other
.
value_in_unit
(
self
.
unit
))
__hash__
=
None
_reduce_cache
=
{}
_reduce_cache
=
{}
def
reduce_unit
(
self
,
guide_unit
=
None
):
def
reduce_unit
(
self
,
guide_unit
=
None
):
...
...
wrappers/python/openmm/unit/unit.py
View file @
3aa4bb8c
...
@@ -40,7 +40,6 @@ __version__ = "0.5"
...
@@ -40,7 +40,6 @@ __version__ = "0.5"
import
math
import
math
import
sys
import
sys
from
.mymatrix
import
MyMatrix
,
zeros
from
.mymatrix
import
MyMatrix
,
zeros
from
.basedimension
import
BaseDimension
from
.baseunit
import
BaseUnit
from
.baseunit
import
BaseUnit
from
.standard_dimensions
import
*
from
.standard_dimensions
import
*
...
@@ -192,6 +191,15 @@ class Unit(object):
...
@@ -192,6 +191,15 @@ class Unit(object):
raise
TypeError
(
'Unit "%s" is not compatible with Unit "%s".'
,
(
self
,
other
))
raise
TypeError
(
'Unit "%s" is not compatible with Unit "%s".'
,
(
self
,
other
))
return
self
.
conversion_factor_to
(
other
)
<
1.0
return
self
.
conversion_factor_to
(
other
)
<
1.0
def
__le__
(
self
,
other
):
return
self
.
__lt__
(
other
)
or
self
.
__eq__
(
other
)
def
__gt__
(
self
,
other
):
return
other
.
__lt__
(
self
)
def
__ge__
(
self
,
other
):
return
other
.
__lt__
(
self
)
or
other
.
__eq__
(
self
)
def
__hash__
(
self
):
def
__hash__
(
self
):
"""
"""
Compute a hash code for this object.
Compute a hash code for this object.
...
...
wrappers/python/openmm/unit/unit_operators.py
View file @
3aa4bb8c
...
@@ -129,8 +129,6 @@ def _unit_class_mul(self, other):
...
@@ -129,8 +129,6 @@ def _unit_class_mul(self, other):
return
Quantity
(
value
,
unit
).
reduce_unit
(
self
)
return
Quantity
(
value
,
unit
).
reduce_unit
(
self
)
else
:
else
:
# print "scalar * unit"
# print "scalar * unit"
value
=
other
unit
=
self
# Is reduce_unit needed here? I hope not, there is a performance issue...
# Is reduce_unit needed here? I hope not, there is a performance issue...
# return Quantity(other, self).reduce_unit(self)
# return Quantity(other, self).reduce_unit(self)
return
Quantity
(
other
,
self
)
return
Quantity
(
other
,
self
)
...
...
Prev
1
2
3
Next
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