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
38d40527
Commit
38d40527
authored
Feb 09, 2016
by
ChayaSt
Browse files
fixed parseElements
parent
f7bfc6b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+8
-10
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
38d40527
...
@@ -1679,13 +1679,11 @@ class NBFixGenerator(object):
...
@@ -1679,13 +1679,11 @@ class NBFixGenerator(object):
def
__init__
(
self
,
forcefield
):
def
__init__
(
self
,
forcefield
):
self
.
ff
=
forcefield
self
.
ff
=
forcefield
self
.
parmas
=
ForceField
.
_AtomTypeParameters
(
forcefield
,
'NonbondedForce'
,
'Atom'
,
(
'charge'
,
'sigma'
,
'epsilon'
))
# I don't need charge but if I don't list it I get an error when calling parseDefinitions. ValueError:
# NonBondedForce: <UseAttributeFromResidue> specified an invalid attribute: charge
self
.
types1
=
[]
self
.
types1
=
[]
self
.
types2
=
[]
self
.
types2
=
[]
self
.
emin
=
[]
self
.
emin
=
[]
self
.
rmin
=
[]
self
.
rmin
=
[]
self
.
nbfrc
=
[
f
for
f
in
forcefield
.
_forces
if
isinstance
(
f
,
NonbondedGenerator
)]
def
registerNBFix
(
self
,
parameters
):
def
registerNBFix
(
self
,
parameters
):
types
=
self
.
ff
.
_findAtomTypes
(
parameters
,
2
)
types
=
self
.
ff
.
_findAtomTypes
(
parameters
,
2
)
...
@@ -1708,30 +1706,30 @@ class NBFixGenerator(object):
...
@@ -1708,30 +1706,30 @@ class NBFixGenerator(object):
for
nbfix
in
element
.
findall
(
'NBFix'
):
for
nbfix
in
element
.
findall
(
'NBFix'
):
generator
.
registerNBFix
(
nbfix
.
attrib
)
generator
.
registerNBFix
(
nbfix
.
attrib
)
generator
.
params
.
parseDefinitions
(
element
)
def
createForce
(
self
,
sys
,
data
,
nonbfrc
,
nonbondedMethod
):
def
createForce
(
self
,
sys
,
data
,
nonbondedMethod
):
"""
"""
Parameters
Parameters
----------
----------
sys
sys
data
data
nonbfrc: NonbondedForce
NonBondedForce for the "standard" nonbonded interactions. This will be modified (specifically, L-J ixns
will be zeroed)
nonbondedMethod: NonbondedMethod (e.g., NoCutoff, PME, etc)
nonbondedMethod: NonbondedMethod (e.g., NoCutoff, PME, etc)
The nonbonded method to apply here. Ewald and PME will be interpreted as CutoffPeriodic for the
The nonbonded method to apply here. Ewald and PME will be interpreted as CutoffPeriodic for the
CustomNonbondedForce
CustomNonbondedForce
"""
"""
# NonBondedForce for 'standard' nonbonded interactions. This will be modified
nonbfrc
=
self
.
nbfrc
[
0
]
# We need a CustomNonbondedForce to implement the NBFIX functionality.
# We need a CustomNonbondedForce to implement the NBFIX functionality.
# First derive the lookup tables
# First derive the lookup tables
lj_indx_list
=
[
0
for
atom
in
data
.
atoms
]
lj_indx_list
=
[
0
for
atom
in
data
.
atoms
]
li_radii
,
lj_depths
=
[],
[]
li_radii
,
lj_depths
=
[],
[]
num_lj_types
=
0
num_lj_types
=
0
lj_type_list
=
[]
lj_type_list
=
[]
for
i
,
atom
in
enumerate
(
data
.
atoms
):
for
i
,
atom
in
enumerate
(
data
.
atoms
):
atype
=
data
.
atomTypes
[
atom
]
atype
=
data
.
atomTypes
[
atom
]
values
=
self
.
params
.
paramsForType
[
atype
]
values
=
nonbfrc
.
params
.
paramsForType
[
atype
]
if
lj_indx_list
[
i
]:
continue
# already assigned
if
lj_indx_list
[
i
]:
continue
# already assigned
num_lj_types
+=
1
num_lj_types
+=
1
lj_indx_list
[
i
]
=
num_lj_types
lj_indx_list
[
i
]
=
num_lj_types
...
@@ -1746,7 +1744,7 @@ class NBFixGenerator(object):
...
@@ -1746,7 +1744,7 @@ class NBFixGenerator(object):
lj_indx_list
[
j
]
=
num_lj_types
lj_indx_list
[
j
]
=
num_lj_types
elif
not
atype
in
self
.
types1
or
self
.
types2
:
elif
not
atype
in
self
.
types1
or
self
.
types2
:
# Only non-NBFix atom types can be compressed
# Only non-NBFix atom types can be compressed
values
=
self
.
params
.
paramsForType
[
atype2
]
values
=
nonbfrc
.
params
.
paramsForType
[
atype2
]
ljtype2
=
(
values
[
'sigma'
],
abs
(
values
[
'epsilon'
]))
ljtype2
=
(
values
[
'sigma'
],
abs
(
values
[
'epsilon'
]))
if
ljtype
==
ljtype2
:
if
ljtype
==
ljtype2
:
lj_indx_list
[
j
]
=
num_lj_types
lj_indx_list
[
j
]
=
num_lj_types
...
...
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