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
ed31a458
Commit
ed31a458
authored
Jan 31, 2014
by
peastman
Browse files
ForceField supports all types of tabulated functions in CustomGBForce
parent
75c9f3d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
wrappers/python/simtk/openmm/app/data/absinth.xml
wrappers/python/simtk/openmm/app/data/absinth.xml
+1
-1
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+24
-3
No files found.
wrappers/python/simtk/openmm/app/data/absinth.xml
View file @
ed31a458
...
@@ -4151,7 +4151,7 @@
...
@@ -4151,7 +4151,7 @@
<EnergyTerm
type=
"ParticlePairNoExclusions"
>
<EnergyTerm
type=
"ParticlePairNoExclusions"
>
include(chargeGroup1*numChargeGroups+chargeGroup2)*screening1*screening2*138.935456*charge1*charge2/r
include(chargeGroup1*numChargeGroups+chargeGroup2)*screening1*screening2*138.935456*charge1*charge2/r
</EnergyTerm>
</EnergyTerm>
<Function
name=
"sigma"
min=
"0"
max=
"675
"
>
<Function
name=
"sigma"
type=
"Discrete1D
"
>
0.27 0.3 0.285 0.185 0.27 0.285 0.315 0.27 0.235 0.295 0.27 0.30152225 0.355862 0.2932777648 0.235 0.29253280555 0.235 0.29267889715 0.235 0.3817314 0.366188 0.47079995 0.405 0.315 0.3099 0.241
0.27 0.3 0.285 0.185 0.27 0.285 0.315 0.27 0.235 0.295 0.27 0.30152225 0.355862 0.2932777648 0.235 0.29253280555 0.235 0.29267889715 0.235 0.3817314 0.366188 0.47079995 0.405 0.315 0.3099 0.241
0.3 0.33 0.315 0.265 0.3 0.315 0.345 0.3 0.265 0.325 0.3 0.33152225 0.385862 0.3232777648 0.265 0.32253280555 0.265 0.32267889715 0.265 0.4117314 0.396188 0.50079995 0.435 0.345 0.3399 0.271
0.3 0.33 0.315 0.265 0.3 0.315 0.345 0.3 0.265 0.325 0.3 0.33152225 0.385862 0.3232777648 0.265 0.32253280555 0.265 0.32267889715 0.265 0.4117314 0.396188 0.50079995 0.435 0.345 0.3399 0.271
0.285 0.315 0.3 0.25 0.285 0.3 0.33 0.285 0.25 0.31 0.285 0.31652225 0.370862 0.3082777648 0.25 0.30753280555 0.25 0.30767889715 0.25 0.3967314 0.381188 0.48579995 0.42 0.33 0.3249 0.256
0.285 0.315 0.3 0.25 0.285 0.3 0.33 0.285 0.25 0.31 0.285 0.31652225 0.370862 0.3082777648 0.25 0.30753280555 0.25 0.30767889715 0.25 0.3967314 0.381188 0.48579995 0.42 0.33 0.3249 0.256
...
...
wrappers/python/simtk/openmm/app/forcefield.py
View file @
ed31a458
...
@@ -1509,7 +1509,17 @@ class CustomGBGenerator:
...
@@ -1509,7 +1509,17 @@ class CustomGBGenerator:
generator
.
energyTerms
.
append
((
term
.
text
,
computationMap
[
term
.
attrib
[
'type'
]]))
generator
.
energyTerms
.
append
((
term
.
text
,
computationMap
[
term
.
attrib
[
'type'
]]))
for
function
in
element
.
findall
(
"Function"
):
for
function
in
element
.
findall
(
"Function"
):
values
=
[
float
(
x
)
for
x
in
function
.
text
.
split
()]
values
=
[
float
(
x
)
for
x
in
function
.
text
.
split
()]
generator
.
functions
.
append
((
function
.
attrib
[
'name'
],
values
,
float
(
function
.
attrib
[
'min'
]),
float
(
function
.
attrib
[
'max'
])))
if
'type'
in
function
.
attrib
:
type
=
function
.
attrib
[
'type'
]
else
:
type
=
'Continuous1D'
params
=
{}
for
key
in
function
.
attrib
:
if
key
.
endswith
(
'size'
):
params
[
key
]
=
int
(
function
.
attrib
[
key
])
elif
key
.
endswith
(
'min'
)
or
key
.
endswith
(
'max'
):
params
[
key
]
=
float
(
function
.
attrib
[
key
])
generator
.
functions
.
append
((
function
.
attrib
[
'name'
],
type
,
values
,
params
))
def
createForce
(
self
,
sys
,
data
,
nonbondedMethod
,
nonbondedCutoff
,
args
):
def
createForce
(
self
,
sys
,
data
,
nonbondedMethod
,
nonbondedCutoff
,
args
):
methodMap
=
{
NoCutoff
:
mm
.
CustomGBForce
.
NoCutoff
,
methodMap
=
{
NoCutoff
:
mm
.
CustomGBForce
.
NoCutoff
,
...
@@ -1526,8 +1536,19 @@ class CustomGBGenerator:
...
@@ -1526,8 +1536,19 @@ class CustomGBGenerator:
force
.
addComputedValue
(
value
[
0
],
value
[
1
],
value
[
2
])
force
.
addComputedValue
(
value
[
0
],
value
[
1
],
value
[
2
])
for
term
in
self
.
energyTerms
:
for
term
in
self
.
energyTerms
:
force
.
addEnergyTerm
(
term
[
0
],
term
[
1
])
force
.
addEnergyTerm
(
term
[
0
],
term
[
1
])
for
function
in
self
.
functions
:
for
(
name
,
type
,
values
,
params
)
in
self
.
functions
:
force
.
addFunction
(
function
[
0
],
function
[
1
],
function
[
2
],
function
[
3
])
if
type
==
'Continuous1D'
:
force
.
addTabulatedFunction
(
name
,
mm
.
Continuous1DFunction
(
values
,
params
[
'min'
],
params
[
'max'
]))
elif
type
==
'Continuous2D'
:
force
.
addTabulatedFunction
(
name
,
mm
.
Continuous2DFunction
(
params
[
'xsize'
],
params
[
'ysize'
],
values
,
params
[
'xmin'
],
params
[
'xmax'
],
params
[
'ymin'
],
params
[
'ymax'
]))
elif
type
==
'Continuous3D'
:
force
.
addTabulatedFunction
(
name
,
mm
.
Continuous2DFunction
(
params
[
'xsize'
],
params
[
'ysize'
],
params
[
'zsize'
],
values
,
params
[
'xmin'
],
params
[
'xmax'
],
params
[
'ymin'
],
params
[
'ymax'
],
params
[
'zmin'
],
params
[
'zmax'
]))
elif
type
==
'Discrete1D'
:
force
.
addTabulatedFunction
(
name
,
mm
.
Discrete1DFunction
(
values
))
elif
type
==
'Discrete2D'
:
force
.
addTabulatedFunction
(
name
,
mm
.
Discrete2DFunction
(
params
[
'xsize'
],
params
[
'ysize'
],
values
))
elif
type
==
'Discrete3D'
:
force
.
addTabulatedFunction
(
name
,
mm
.
Discrete2DFunction
(
params
[
'xsize'
],
params
[
'ysize'
],
params
[
'zsize'
],
values
))
for
atom
in
data
.
atoms
:
for
atom
in
data
.
atoms
:
t
=
data
.
atomType
[
atom
]
t
=
data
.
atomType
[
atom
]
if
t
in
self
.
typeMap
:
if
t
in
self
.
typeMap
:
...
...
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