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
7132e1d3
Commit
7132e1d3
authored
Mar 29, 2020
by
Charlles Abreu
Browse files
BiasVariable allows arguments with units of measurement
parent
1f4451ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
wrappers/python/simtk/openmm/app/metadynamics.py
wrappers/python/simtk/openmm/app/metadynamics.py
+9
-4
No files found.
wrappers/python/simtk/openmm/app/metadynamics.py
View file @
7132e1d3
...
...
@@ -440,15 +440,20 @@ class BiasVariable(object):
a reasonable value is chosen automatically.
"""
self
.
force
=
force
self
.
minValue
=
minValue
self
.
maxValue
=
maxValue
self
.
biasWidth
=
biasWidth
self
.
minValue
=
self
.
_standardize
(
minValue
)
self
.
maxValue
=
self
.
_standardize
(
maxValue
)
self
.
biasWidth
=
self
.
_standardize
(
biasWidth
)
self
.
periodic
=
periodic
if
gridWidth
is
None
:
self
.
gridWidth
=
int
(
np
.
ceil
(
5
*
(
maxValue
-
minValue
)
/
biasWidth
))
else
:
self
.
gridWidth
=
gridWidth
self
.
_scaledVariance
=
(
biasWidth
/
(
maxValue
-
minValue
))
**
2
self
.
_scaledVariance
=
(
self
.
biasWidth
/
(
self
.
maxValue
-
self
.
minValue
))
**
2
def
_standardize
(
self
,
quantity
):
if
unit
.
is_quantity
(
quantity
):
return
quantity
.
value_in_unit_system
(
unit
.
md_unit_system
)
else
:
return
quantity
_LoadedBias
=
namedtuple
(
'LoadedBias'
,
[
'id'
,
'index'
,
'bias'
])
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