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
0a2439ce
"openmmapi/vscode:/vscode.git/clone" did not exist on "8647eaadbb41587f2f52ff56af668ffb653c0467"
Commit
0a2439ce
authored
Apr 20, 2017
by
Rafal P. Wiewiora
Browse files
Merge branch 'master' of
https://github.com/rafwiewiora/openmm
parents
c29de611
6ed5bc4e
Changes
121
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
169 additions
and
118 deletions
+169
-118
.travis.yml
.travis.yml
+7
-4
docs-source/developerguide/conf.py
docs-source/developerguide/conf.py
+7
-1
docs-source/usersguide/application.rst
docs-source/usersguide/application.rst
+29
-1
docs-source/usersguide/conf.py
docs-source/usersguide/conf.py
+7
-1
docs-source/usersguide/references.bib
docs-source/usersguide/references.bib
+12
-1
olla/src/Platform.cpp
olla/src/Platform.cpp
+19
-19
openmmapi/src/AndersenThermostatImpl.cpp
openmmapi/src/AndersenThermostatImpl.cpp
+3
-3
openmmapi/src/CompiledExpressionSet.cpp
openmmapi/src/CompiledExpressionSet.cpp
+5
-5
openmmapi/src/Context.cpp
openmmapi/src/Context.cpp
+10
-12
openmmapi/src/ContextImpl.cpp
openmmapi/src/ContextImpl.cpp
+20
-20
openmmapi/src/CustomCentroidBondForce.cpp
openmmapi/src/CustomCentroidBondForce.cpp
+2
-2
openmmapi/src/CustomCentroidBondForceImpl.cpp
openmmapi/src/CustomCentroidBondForceImpl.cpp
+8
-8
openmmapi/src/CustomCompoundBondForce.cpp
openmmapi/src/CustomCompoundBondForce.cpp
+2
-2
openmmapi/src/CustomCompoundBondForceImpl.cpp
openmmapi/src/CustomCompoundBondForceImpl.cpp
+5
-5
openmmapi/src/CustomGBForce.cpp
openmmapi/src/CustomGBForce.cpp
+4
-2
openmmapi/src/CustomHbondForce.cpp
openmmapi/src/CustomHbondForce.cpp
+4
-2
openmmapi/src/CustomHbondForceImpl.cpp
openmmapi/src/CustomHbondForceImpl.cpp
+2
-2
openmmapi/src/CustomIntegrator.cpp
openmmapi/src/CustomIntegrator.cpp
+3
-4
openmmapi/src/CustomIntegratorUtilities.cpp
openmmapi/src/CustomIntegratorUtilities.cpp
+7
-12
openmmapi/src/CustomManyParticleForce.cpp
openmmapi/src/CustomManyParticleForce.cpp
+13
-12
No files found.
.travis.yml
View file @
0a2439ce
...
@@ -73,6 +73,7 @@ matrix:
...
@@ -73,6 +73,7 @@ matrix:
addons
:
{
apt
:
{
packages
:
[]}}
addons
:
{
apt
:
{
packages
:
[]}}
-
sudo
:
false
-
sudo
:
false
dist
:
trusty
python
:
2.7_with_system_site_packages
python
:
2.7_with_system_site_packages
env
:
==STATIC_LIB==
env
:
==STATIC_LIB==
OPENCL=false
OPENCL=false
...
@@ -82,6 +83,7 @@ matrix:
...
@@ -82,6 +83,7 @@ matrix:
CMAKE_FLAGS="-DOPENMM_BUILD_STATIC_LIB=ON"
CMAKE_FLAGS="-DOPENMM_BUILD_STATIC_LIB=ON"
-
sudo
:
false
-
sudo
:
false
dist
:
trusty
python
:
2.7_with_system_site_packages
python
:
2.7_with_system_site_packages
env
:
==PYTHON_2==
env
:
==PYTHON_2==
OPENCL=false
OPENCL=false
...
@@ -92,6 +94,7 @@ matrix:
...
@@ -92,6 +94,7 @@ matrix:
CMAKE_FLAGS="-DOPENMM_GENERATE_API_DOCS=ON"
CMAKE_FLAGS="-DOPENMM_GENERATE_API_DOCS=ON"
-
sudo
:
false
-
sudo
:
false
dist
:
trusty
python
:
3.4
python
:
3.4
env
:
==PYTHON_3==
env
:
==PYTHON_3==
OPENCL=false
OPENCL=false
...
@@ -102,7 +105,7 @@ matrix:
...
@@ -102,7 +105,7 @@ matrix:
before_install
:
before_install
:
-
START_TIME=$(date +%s)
-
START_TIME=$(date +%s)
-
wget http
s
://anaconda.org/omnia/ccache/3.2.4/download/${TRAVIS_OS_NAME}-64/ccache-3.2.4-0.tar.bz2
-
wget http://anaconda.org/omnia/ccache/3.2.4/download/${TRAVIS_OS_NAME}-64/ccache-3.2.4-0.tar.bz2
-
mkdir -p $HOME/ccache && tar xf ccache-3.2.4-0.tar.bz2 -C $HOME/ccache
-
mkdir -p $HOME/ccache && tar xf ccache-3.2.4-0.tar.bz2 -C $HOME/ccache
-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew install fftw;
brew install fftw;
...
@@ -110,7 +113,7 @@ before_install:
...
@@ -110,7 +113,7 @@ before_install:
sudo easy_install pytest;
sudo easy_install pytest;
fi
fi
-
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
-
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http
s
://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz";
CMAKE_URL="http://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz";
mkdir $HOME/cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C $HOME/cmake;
mkdir $HOME/cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C $HOME/cmake;
export PATH=${HOME}/cmake/bin:${PATH};
export PATH=${HOME}/cmake/bin:${PATH};
fi
fi
...
@@ -131,14 +134,14 @@ before_install:
...
@@ -131,14 +134,14 @@ before_install:
# but this is a fast way to get an apparently functional precompiled
# but this is a fast way to get an apparently functional precompiled
# build of swig that's more modern than what's in apt.
# build of swig that's more modern than what's in apt.
-
if [[ "$OPENCL" == "false" && "$CUDA" == "false" && "$TRAVIS_OS_NAME" == "linux" ]]; then
-
if [[ "$OPENCL" == "false" && "$CUDA" == "false" && "$TRAVIS_OS_NAME" == "linux" ]]; then
wget http
s
://anaconda.org/omnia/swig/3.0.7/download/linux-64/swig-3.0.7-0.tar.bz2;
wget http://anaconda.org/omnia/swig/3.0.7/download/linux-64/swig-3.0.7-0.tar.bz2;
mkdir $HOME/swig;
mkdir $HOME/swig;
tar -xjvf swig-3.0.7-0.tar.bz2 -C $HOME/swig;
tar -xjvf swig-3.0.7-0.tar.bz2 -C $HOME/swig;
export PATH=$HOME/swig/bin:$PATH;
export PATH=$HOME/swig/bin:$PATH;
export SWIG_LIB=$HOME/swig/share/swig/3.0.7;
export SWIG_LIB=$HOME/swig/share/swig/3.0.7;
fi
fi
-
if [[ "$OPENCL" == "false" && "$CUDA" == "false" && "$TRAVIS_OS_NAME" == "osx" ]]; then
-
if [[ "$OPENCL" == "false" && "$CUDA" == "false" && "$TRAVIS_OS_NAME" == "osx" ]]; then
wget http
s
://anaconda.org/omnia/swig/3.0.7/download/osx-64/swig-3.0.7-0.tar.bz2;
wget http://anaconda.org/omnia/swig/3.0.7/download/osx-64/swig-3.0.7-0.tar.bz2;
mkdir $HOME/swig;
mkdir $HOME/swig;
tar -xjvf swig-3.0.7-0.tar.bz2 -C $HOME/swig;
tar -xjvf swig-3.0.7-0.tar.bz2 -C $HOME/swig;
export PATH=$HOME/swig/bin:$PATH;
export PATH=$HOME/swig/bin:$PATH;
...
...
docs-source/developerguide/conf.py
View file @
0a2439ce
...
@@ -185,10 +185,16 @@ latex_elements = {
...
@@ -185,10 +185,16 @@ latex_elements = {
\\
usepackage{caption}
\\
usepackage{caption}
\\
setcounter{tocdepth}{3}
\\
setcounter{tocdepth}{3}
\\
captionsetup[figure]{labelformat=empty}
\\
captionsetup[figure]{labelformat=empty}
% Backwards compatibility for sphinx < 1.5
\\
let
\\
DUspan
\\
null % force DUspan to be defined
\\
renewcommand{\DUspan}[2]{%
\\
renewcommand{\DUspan}[2]{%
\\
IfEqCase{#1}{%
\\
IfEqCase{#1}{%
{code}{
\\
small{}
\\
texttt{#2}
\\
normalsize{}}
%
{code}{
\\
small{}
\\
texttt{#2}
\\
normalsize{}}
}[
\\
PackageError{DUspan}{Unrecognized option passed to DUspan: #1}{}]%
}[
\\
PackageError{DUspan}{Unrecognized option passed to DUspan: #1}{}]%
}%
% Sphinx > 1.5 compatibility (github.com/sphinx-doc/sphinx/issues/2231)
\\
newcommand{
\\
DUrolecode}[1]{%
\\
small{}
\\
texttt{#1}
\\
normalsize{}%
}%"""
,
}%"""
,
}
}
...
...
docs-source/usersguide/application.rst
View file @
0a2439ce
...
@@ -775,7 +775,9 @@ File Force Field
...
@@ -775,7 +775,9 @@ File Force Field
:
code
:`
amber99sbnmr
.
xml
`
Amber99SB
with
modifications
to
fit
NMR
data
\
:
cite
:`
Li2010
`
:
code
:`
amber99sbnmr
.
xml
`
Amber99SB
with
modifications
to
fit
NMR
data
\
:
cite
:`
Li2010
`
:
code
:`
amber03
.
xml
`
Amber03
\
:
cite
:`
Duan2003
`
:
code
:`
amber03
.
xml
`
Amber03
\
:
cite
:`
Duan2003
`
:
code
:`
amber10
.
xml
`
Amber10
(
documented
in
the
AmberTools_
manual
as
`
ff10
`)
:
code
:`
amber10
.
xml
`
Amber10
(
documented
in
the
AmberTools_
manual
as
`
ff10
`)
:
code
:`
amoeba2009
.
xml
`
AMOEBA
2009
\
:
cite
:`
Ren2002
`.
This
force
field
is
deprecated
.
It
is
:
code
:`
amberfb15
.
xml
`
AMBER
-
FB15
\
:
cite
:`
Wang2017
`.
Intramolecular
parameters
optimized
with
ForceBalance
using
high
-
level
ab
initio
data
.
:
code
:`
amoeba2009
.
xml
`
AMOEBA
2009
\
:
cite
:`
Ren2002
`.
This
force
field
is
deprecated
.
It
is
recommended
to
use
AMOEBA
2013
instead
.
recommended
to
use
AMOEBA
2013
instead
.
:
code
:`
amoeba2013
.
xml
`
AMOEBA
2013
\
:
cite
:`
Shi2013
`
:
code
:`
amoeba2013
.
xml
`
AMOEBA
2013
\
:
cite
:`
Shi2013
`
:
code
:`
charmm_polar_2013
.
xml
`
CHARMM
2013
polarizable
force
field
\
:
cite
:`
Lopes2013
`
:
code
:`
charmm_polar_2013
.
xml
`
CHARMM
2013
polarizable
force
field
\
:
cite
:`
Lopes2013
`
...
@@ -2935,6 +2937,32 @@ need to be specified once for each class. The atom charges, which are different
...
@@ -2935,6 +2937,32 @@ need to be specified once for each class. The atom charges, which are different
for
each
type
,
are
taken
from
the
residue
template
instead
.
for
each
type
,
are
taken
from
the
residue
template
instead
.
Including
Other
Files
=====================
Sometimes
it
is
useful
to
split
a
force
field
definition
into
multiple
files
,
but
still
be
able
to
use
the
force
field
by
specifying
only
a
single
file
.
You
can
accomplish
this
with
the
:
code
:`<
Include
>`
tag
.
For
example
:
..
code
-
block
::
xml
<
ForceField
>
<
Include
file
=
"definitions.xml"
/>
...
</
ForceField
>
The
:
code
:`
file
`
attribute
gives
the
path
of
the
file
to
include
.
It
may
be
relative
either
to
the
directory
containing
the
parent
XML
file
(
the
one
with
the
:
code
:`<
Include
>`
tag
)
or
the
OpenMM
data
directory
(
the
one
containing
built
in
force
fields
).
The
included
file
is
fully
processed
before
any
other
tags
in
the
parent
file
are
processed
,
and
its
definitions
are
added
to
the
force
field
.
This
means
the
parent
file
can
refer
to
atom
types
defined
in
the
included
file
,
but
not
the
other
way
around
.
If
there
are
multiple
:
code
:`<
Include
>`
tags
,
they
are
processed
in
the
order
they
appear
in
the
file
.
Using
Multiple
Files
Using
Multiple
Files
********************
********************
...
...
docs-source/usersguide/conf.py
View file @
0a2439ce
...
@@ -185,10 +185,16 @@ latex_elements = {
...
@@ -185,10 +185,16 @@ latex_elements = {
\\
usepackage{caption}
\\
usepackage{caption}
\\
setcounter{tocdepth}{3}
\\
setcounter{tocdepth}{3}
\\
captionsetup[figure]{labelformat=empty}
\\
captionsetup[figure]{labelformat=empty}
% Backwards compatibility for sphinx < 1.5
\\
let
\\
DUspan
\\
null % force DUspan to be defined
\\
renewcommand{\DUspan}[2]{%
\\
renewcommand{\DUspan}[2]{%
\\
IfEqCase{#1}{%
\\
IfEqCase{#1}{%
{code}{
\\
small{}
\\
texttt{#2}
\\
normalsize{}}
%
{code}{
\\
small{}
\\
texttt{#2}
\\
normalsize{}}
}[
\\
PackageError{DUspan}{Unrecognized option passed to DUspan: #1}{}]%
}[
\\
PackageError{DUspan}{Unrecognized option passed to DUspan: #1}{}]%
}%
% Sphinx > 1.5 compatibility (github.com/sphinx-doc/sphinx/issues/2231)
\\
newcommand{
\\
DUrolecode}[1]{%
\\
small{}
\\
texttt{#1}
\\
normalsize{}%
}%"""
,
}%"""
,
# Omit the index.
# Omit the index.
...
...
docs-source/usersguide/references.bib
View file @
0a2439ce
...
@@ -518,6 +518,18 @@
...
@@ -518,6 +518,18 @@
type = {Journal Article}
type = {Journal Article}
}
}
@article
{
Wang2017
author
=
{Wang,
Lee-Ping
and
McKiernan,
Keri
A.
and
Gomes,
Joseph
and
Beauchamp,
Kyle
A.
and
Head-Gordon,
Teresa
and
Rice,
Julia
E.
and
Swope,
William
C.
and
Martínez,
Todd
J.
and
Pande,
Vijay
S.
}
,
title = {Building a More Predictive Protein Force Field: A Systematic and Reproducible Route to AMBER-FB15},
journal = {Journal of Physical Chemistry B},
volume = {0},
number = {ja},
pages = {null},
year = {2017},
type = {Journal Article},
doi = {10.1021/acs.jpcb.7b02320},
}
@article
{
Wennberg2015
@article
{
Wennberg2015
author
=
{Wennberg,
Christian
L.
and
Murtola,
Teemu
and
Páll,
Szilárd
and
Abraham,
Mark
J.
and
Hess,
Berk
and
Lindahl,
Erik
}
,
author
=
{Wennberg,
Christian
L.
and
Murtola,
Teemu
and
Páll,
Szilárd
and
Abraham,
Mark
J.
and
Hess,
Berk
and
Lindahl,
Erik
}
,
title = {Direct-Space Corrections Enable Fast and Accurate {Lorentz–Berthelot} Combination Rule {Lennard-Jones} Lattice Summation},
title = {Direct-Space Corrections Enable Fast and Accurate {Lorentz–Berthelot} Combination Rule {Lennard-Jones} Lattice Summation},
...
@@ -528,4 +540,3 @@
...
@@ -528,4 +540,3 @@
year = {2015},
year = {2015},
type = {Journal Article}
type = {Journal Article}
}
}
olla/src/Platform.cpp
View file @
0a2439ce
...
@@ -70,10 +70,10 @@ static int platformInitializer = registerPlatforms();
...
@@ -70,10 +70,10 @@ static int platformInitializer = registerPlatforms();
Platform
::~
Platform
()
{
Platform
::~
Platform
()
{
set
<
KernelFactory
*>
uniqueKernelFactories
;
set
<
KernelFactory
*>
uniqueKernelFactories
;
for
(
map
<
string
,
KernelFactory
*>::
const_iterator
iter
=
kernelFactories
.
begin
();
iter
!=
kernelFactories
.
end
();
++
iter
)
for
(
auto
&
factory
:
kernelFactories
)
uniqueKernelFactories
.
insert
(
iter
->
second
);
uniqueKernelFactories
.
insert
(
factory
.
second
);
for
(
set
<
KernelFactory
*>::
const_iterator
iter
=
uniqueKernelFactories
.
begin
();
iter
!=
uniqueKernelFactories
.
end
();
++
iter
)
for
(
auto
factory
:
uniqueKernelFactories
)
delete
*
iter
;
delete
factory
;
}
}
const
vector
<
string
>&
Platform
::
getPropertyNames
()
const
{
const
vector
<
string
>&
Platform
::
getPropertyNames
()
const
{
...
@@ -102,8 +102,8 @@ void Platform::setPropertyDefaultValue(const string& property, const string& val
...
@@ -102,8 +102,8 @@ void Platform::setPropertyDefaultValue(const string& property, const string& val
string
propertyName
=
property
;
string
propertyName
=
property
;
if
(
deprecatedPropertyReplacements
.
find
(
property
)
!=
deprecatedPropertyReplacements
.
end
())
if
(
deprecatedPropertyReplacements
.
find
(
property
)
!=
deprecatedPropertyReplacements
.
end
())
propertyName
=
deprecatedPropertyReplacements
.
find
(
property
)
->
second
;
propertyName
=
deprecatedPropertyReplacements
.
find
(
property
)
->
second
;
for
(
int
i
=
0
;
i
<
(
int
)
platformProperties
.
size
();
i
++
)
for
(
auto
&
prop
:
platformProperties
)
if
(
p
latformProperties
[
i
]
==
propertyName
)
{
if
(
p
rop
==
propertyName
)
{
defaultProperties
[
propertyName
]
=
value
;
defaultProperties
[
propertyName
]
=
value
;
return
;
return
;
}
}
...
@@ -121,8 +121,8 @@ void Platform::registerKernelFactory(const string& name, KernelFactory* factory)
...
@@ -121,8 +121,8 @@ void Platform::registerKernelFactory(const string& name, KernelFactory* factory)
}
}
bool
Platform
::
supportsKernels
(
const
vector
<
string
>&
kernelNames
)
const
{
bool
Platform
::
supportsKernels
(
const
vector
<
string
>&
kernelNames
)
const
{
for
(
int
i
=
0
;
i
<
(
int
)
kernelNames
.
size
();
++
i
)
for
(
auto
&
name
:
kernelNames
)
if
(
kernelFactories
.
find
(
kernelNames
[
i
]
)
==
kernelFactories
.
end
())
if
(
kernelFactories
.
find
(
name
)
==
kernelFactories
.
end
())
return
false
;
return
false
;
return
true
;
return
true
;
}
}
...
@@ -167,9 +167,9 @@ Platform& Platform::findPlatform(const vector<string>& kernelNames) {
...
@@ -167,9 +167,9 @@ Platform& Platform::findPlatform(const vector<string>& kernelNames) {
Platform
*
best
=
0
;
Platform
*
best
=
0
;
vector
<
Platform
*>&
platforms
=
getPlatforms
();
vector
<
Platform
*>&
platforms
=
getPlatforms
();
double
speed
=
0.0
;
double
speed
=
0.0
;
for
(
int
i
=
0
;
i
<
(
int
)
platforms
.
size
();
++
i
)
{
for
(
auto
platform
:
platforms
)
{
if
(
platform
s
[
i
]
->
supportsKernels
(
kernelNames
)
&&
platform
s
[
i
]
->
getSpeed
()
>
speed
)
{
if
(
platform
->
supportsKernels
(
kernelNames
)
&&
platform
->
getSpeed
()
>
speed
)
{
best
=
platform
s
[
i
]
;
best
=
platform
;
speed
=
best
->
getSpeed
();
speed
=
best
->
getSpeed
();
}
}
}
}
...
@@ -193,15 +193,15 @@ static HMODULE loadOneLibrary(const string& file) {
...
@@ -193,15 +193,15 @@ static HMODULE loadOneLibrary(const string& file) {
}
}
static
void
initializePlugins
(
vector
<
HMODULE
>&
plugins
)
{
static
void
initializePlugins
(
vector
<
HMODULE
>&
plugins
)
{
for
(
int
i
=
0
;
i
<
(
int
)
plugins
.
size
();
i
++
)
{
for
(
auto
plugin
:
plugins
)
{
void
(
*
init
)();
void
(
*
init
)();
*
(
void
**
)(
&
init
)
=
(
void
*
)
GetProcAddress
(
plugin
s
[
i
]
,
"registerPlatforms"
);
*
(
void
**
)(
&
init
)
=
(
void
*
)
GetProcAddress
(
plugin
,
"registerPlatforms"
);
if
(
init
!=
NULL
)
if
(
init
!=
NULL
)
(
*
init
)();
(
*
init
)();
}
}
for
(
int
i
=
0
;
i
<
(
int
)
plugins
.
size
();
i
++
)
{
for
(
auto
plugin
:
plugins
)
{
void
(
*
init
)();
void
(
*
init
)();
*
(
void
**
)(
&
init
)
=
(
void
*
)
GetProcAddress
(
plugin
s
[
i
]
,
"registerKernelFactories"
);
*
(
void
**
)(
&
init
)
=
(
void
*
)
GetProcAddress
(
plugin
,
"registerKernelFactories"
);
if
(
init
!=
NULL
)
if
(
init
!=
NULL
)
(
*
init
)();
(
*
init
)();
}
}
...
@@ -221,15 +221,15 @@ static void* loadOneLibrary(const string& file) {
...
@@ -221,15 +221,15 @@ static void* loadOneLibrary(const string& file) {
static
void
initializePlugins
(
vector
<
void
*>&
plugins
)
{
static
void
initializePlugins
(
vector
<
void
*>&
plugins
)
{
#ifndef __PNACL__
#ifndef __PNACL__
for
(
int
i
=
0
;
i
<
(
int
)
plugins
.
size
();
i
++
)
{
for
(
auto
plugin
:
plugins
)
{
void
(
*
init
)();
void
(
*
init
)();
*
(
void
**
)(
&
init
)
=
dlsym
(
plugin
s
[
i
]
,
"registerPlatforms"
);
*
(
void
**
)(
&
init
)
=
dlsym
(
plugin
,
"registerPlatforms"
);
if
(
init
!=
NULL
)
if
(
init
!=
NULL
)
(
*
init
)();
(
*
init
)();
}
}
for
(
int
i
=
0
;
i
<
(
int
)
plugins
.
size
();
i
++
)
{
for
(
auto
plugin
:
plugins
)
{
void
(
*
init
)();
void
(
*
init
)();
*
(
void
**
)(
&
init
)
=
dlsym
(
plugin
s
[
i
]
,
"registerKernelFactories"
);
*
(
void
**
)(
&
init
)
=
dlsym
(
plugin
,
"registerKernelFactories"
);
if
(
init
!=
NULL
)
if
(
init
!=
NULL
)
(
*
init
)();
(
*
init
)();
}
}
...
...
openmmapi/src/AndersenThermostatImpl.cpp
View file @
0a2439ce
...
@@ -94,7 +94,7 @@ void AndersenThermostatImpl::tagParticlesInGroup(int particle, int group, vector
...
@@ -94,7 +94,7 @@ void AndersenThermostatImpl::tagParticlesInGroup(int particle, int group, vector
// Recursively tag particles as belonging to a particular group.
// Recursively tag particles as belonging to a particular group.
particleGroup
[
particle
]
=
group
;
particleGroup
[
particle
]
=
group
;
for
(
int
i
=
0
;
i
<
(
int
)
particleConstraints
[
particle
]
.
size
();
i
++
)
for
(
int
constrained
:
particleConstraints
[
particle
])
if
(
particleGroup
[
particleConstraints
[
particle
][
i
]
]
==
-
1
)
if
(
particleGroup
[
constrained
]
==
-
1
)
tagParticlesInGroup
(
particleConstraints
[
particle
][
i
]
,
group
,
particleGroup
,
particleConstraints
);
tagParticlesInGroup
(
constrained
,
group
,
particleGroup
,
particleConstraints
);
}
}
openmmapi/src/CompiledExpressionSet.cpp
View file @
0a2439ce
...
@@ -44,15 +44,15 @@ int CompiledExpressionSet::getVariableIndex(const std::string& name) {
...
@@ -44,15 +44,15 @@ int CompiledExpressionSet::getVariableIndex(const std::string& name) {
int
index
=
variables
.
size
();
int
index
=
variables
.
size
();
variables
.
push_back
(
name
);
variables
.
push_back
(
name
);
variableReferences
.
push_back
(
vector
<
double
*>
());
variableReferences
.
push_back
(
vector
<
double
*>
());
for
(
int
i
=
0
;
i
<
(
int
)
expressions
.
size
();
i
++
)
for
(
auto
expression
:
expressions
)
if
(
expression
s
[
i
]
->
getVariables
().
find
(
name
)
!=
expression
s
[
i
]
->
getVariables
().
end
())
if
(
expression
->
getVariables
().
find
(
name
)
!=
expression
->
getVariables
().
end
())
variableReferences
[
index
].
push_back
(
&
expression
s
[
i
]
->
getVariableReference
(
name
));
variableReferences
[
index
].
push_back
(
&
expression
->
getVariableReference
(
name
));
return
index
;
return
index
;
}
}
void
CompiledExpressionSet
::
setVariable
(
int
index
,
double
value
)
{
void
CompiledExpressionSet
::
setVariable
(
int
index
,
double
value
)
{
for
(
int
i
=
0
;
i
<
(
int
)
variableReferences
[
index
]
.
size
();
i
++
)
for
(
auto
ref
:
variableReferences
[
index
])
*
variableReferences
[
index
][
i
]
=
value
;
*
ref
=
value
;
}
}
int
CompiledExpressionSet
::
getNumVariables
()
const
{
int
CompiledExpressionSet
::
getNumVariables
()
const
{
...
...
openmmapi/src/Context.cpp
View file @
0a2439ce
...
@@ -97,8 +97,8 @@ State Context::getState(int types, bool enforcePeriodicBox, int groups) const {
...
@@ -97,8 +97,8 @@ State Context::getState(int types, bool enforcePeriodicBox, int groups) const {
}
}
if
(
types
&
State
::
Parameters
)
{
if
(
types
&
State
::
Parameters
)
{
map
<
string
,
double
>
params
;
map
<
string
,
double
>
params
;
for
(
map
<
string
,
double
>::
const_iterator
iter
=
impl
->
parameters
.
begin
();
iter
!=
impl
->
parameters
.
end
();
iter
++
)
for
(
auto
&
param
:
impl
->
parameters
)
params
[
iter
->
first
]
=
iter
->
second
;
params
[
param
.
first
]
=
param
.
second
;
builder
.
setParameters
(
params
);
builder
.
setParameters
(
params
);
}
}
if
(
types
&
State
::
ParameterDerivatives
)
{
if
(
types
&
State
::
ParameterDerivatives
)
{
...
@@ -111,13 +111,13 @@ State Context::getState(int types, bool enforcePeriodicBox, int groups) const {
...
@@ -111,13 +111,13 @@ State Context::getState(int types, bool enforcePeriodicBox, int groups) const {
impl
->
getPositions
(
positions
);
impl
->
getPositions
(
positions
);
if
(
enforcePeriodicBox
)
{
if
(
enforcePeriodicBox
)
{
const
vector
<
vector
<
int
>
>&
molecules
=
impl
->
getMolecules
();
const
vector
<
vector
<
int
>
>&
molecules
=
impl
->
getMolecules
();
for
(
int
i
=
0
;
i
<
(
int
)
molecules
.
size
();
i
++
)
{
for
(
auto
&
mol
:
molecules
)
{
// Find the molecule center.
// Find the molecule center.
Vec3
center
;
Vec3
center
;
for
(
int
j
=
0
;
j
<
(
int
)
molecules
[
i
].
size
();
j
++
)
for
(
int
j
:
mol
)
center
+=
positions
[
molecules
[
i
][
j
]
];
center
+=
positions
[
j
];
center
*=
1.0
/
mol
ecules
[
i
]
.
size
();
center
*=
1.0
/
mol
.
size
();
// Find the displacement to move it into the first periodic box.
// Find the displacement to move it into the first periodic box.
Vec3
diff
;
Vec3
diff
;
...
@@ -126,10 +126,8 @@ State Context::getState(int types, bool enforcePeriodicBox, int groups) const {
...
@@ -126,10 +126,8 @@ State Context::getState(int types, bool enforcePeriodicBox, int groups) const {
diff
+=
periodicBoxSize
[
0
]
*
floor
((
center
[
0
]
-
diff
[
0
])
/
periodicBoxSize
[
0
][
0
]);
diff
+=
periodicBoxSize
[
0
]
*
floor
((
center
[
0
]
-
diff
[
0
])
/
periodicBoxSize
[
0
][
0
]);
// Translate all the particles in the molecule.
// Translate all the particles in the molecule.
for
(
int
j
=
0
;
j
<
(
int
)
molecules
[
i
].
size
();
j
++
)
{
for
(
int
j
:
mol
)
Vec3
&
pos
=
positions
[
molecules
[
i
][
j
]];
positions
[
j
]
-=
diff
;
pos
-=
diff
;
}
}
}
}
}
builder
.
setPositions
(
positions
);
builder
.
setPositions
(
positions
);
...
@@ -152,8 +150,8 @@ void Context::setState(const State& state) {
...
@@ -152,8 +150,8 @@ void Context::setState(const State& state) {
if
((
state
.
getDataTypes
()
&
State
::
Velocities
)
!=
0
)
if
((
state
.
getDataTypes
()
&
State
::
Velocities
)
!=
0
)
setVelocities
(
state
.
getVelocities
());
setVelocities
(
state
.
getVelocities
());
if
((
state
.
getDataTypes
()
&
State
::
Parameters
)
!=
0
)
if
((
state
.
getDataTypes
()
&
State
::
Parameters
)
!=
0
)
for
(
map
<
string
,
double
>::
const_iterator
iter
=
state
.
getParameters
().
begin
();
iter
!=
state
.
getParameters
()
.
end
();
++
iter
)
for
(
auto
&
param
:
state
.
getParameters
())
setParameter
(
iter
->
first
,
iter
->
second
);
setParameter
(
param
.
first
,
param
.
second
);
}
}
void
Context
::
setTime
(
double
time
)
{
void
Context
::
setTime
(
double
time
)
{
...
...
openmmapi/src/ContextImpl.cpp
View file @
0a2439ce
...
@@ -95,19 +95,19 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
...
@@ -95,19 +95,19 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
const
vector
<
string
>&
platformProperties
=
platform
->
getPropertyNames
();
const
vector
<
string
>&
platformProperties
=
platform
->
getPropertyNames
();
map
<
string
,
string
>
validatedProperties
;
map
<
string
,
string
>
validatedProperties
;
for
(
map
<
string
,
string
>::
const_iterator
iter
=
properties
.
begin
();
iter
!=
properties
.
end
();
++
iter
)
{
for
(
auto
&
prop
:
properties
)
{
string
property
=
iter
->
first
;
string
property
=
prop
.
first
;
if
(
platform
->
deprecatedPropertyReplacements
.
find
(
property
)
!=
platform
->
deprecatedPropertyReplacements
.
end
())
if
(
platform
->
deprecatedPropertyReplacements
.
find
(
property
)
!=
platform
->
deprecatedPropertyReplacements
.
end
())
property
=
platform
->
deprecatedPropertyReplacements
[
property
];
property
=
platform
->
deprecatedPropertyReplacements
[
property
];
bool
valid
=
false
;
bool
valid
=
false
;
for
(
int
i
=
0
;
i
<
(
int
)
platformProperties
.
size
();
i
++
)
for
(
auto
&
p
:
platformProperties
)
if
(
p
latformProperties
[
i
]
==
property
)
{
if
(
p
==
property
)
{
valid
=
true
;
valid
=
true
;
break
;
break
;
}
}
if
(
!
valid
)
if
(
!
valid
)
throw
OpenMMException
(
"Illegal property name: "
+
iter
->
first
);
throw
OpenMMException
(
"Illegal property name: "
+
prop
.
first
);
validatedProperties
[
property
]
=
iter
->
second
;
validatedProperties
[
property
]
=
prop
.
second
;
}
}
// Find the list of kernels required.
// Find the list of kernels required.
...
@@ -184,8 +184,8 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
...
@@ -184,8 +184,8 @@ ContextImpl::ContextImpl(Context& owner, const System& system, Integrator& integ
}
}
ContextImpl
::~
ContextImpl
()
{
ContextImpl
::~
ContextImpl
()
{
for
(
int
i
=
0
;
i
<
(
int
)
forceImpls
.
size
();
++
i
)
for
(
auto
force
:
forceImpls
)
delete
force
Impls
[
i
]
;
delete
force
;
// Make sure all kernels get properly deleted before contextDestroyed() is called.
// Make sure all kernels get properly deleted before contextDestroyed() is called.
...
@@ -292,8 +292,8 @@ double ContextImpl::calcForcesAndEnergy(bool includeForces, bool includeEnergy,
...
@@ -292,8 +292,8 @@ double ContextImpl::calcForcesAndEnergy(bool includeForces, bool includeEnergy,
while
(
true
)
{
while
(
true
)
{
double
energy
=
0.0
;
double
energy
=
0.0
;
kernel
.
beginComputation
(
*
this
,
includeForces
,
includeEnergy
,
groups
);
kernel
.
beginComputation
(
*
this
,
includeForces
,
includeEnergy
,
groups
);
for
(
int
i
=
0
;
i
<
(
int
)
forceImpls
.
size
();
++
i
)
for
(
auto
force
:
forceImpls
)
energy
+=
force
Impls
[
i
]
->
calcForcesAndEnergy
(
*
this
,
includeForces
,
includeEnergy
,
groups
);
energy
+=
force
->
calcForcesAndEnergy
(
*
this
,
includeForces
,
includeEnergy
,
groups
);
bool
valid
=
true
;
bool
valid
=
true
;
energy
+=
kernel
.
finishComputation
(
*
this
,
includeForces
,
includeEnergy
,
groups
,
valid
);
energy
+=
kernel
.
finishComputation
(
*
this
,
includeForces
,
includeEnergy
,
groups
,
valid
);
if
(
valid
)
if
(
valid
)
...
@@ -310,8 +310,8 @@ double ContextImpl::calcKineticEnergy() {
...
@@ -310,8 +310,8 @@ double ContextImpl::calcKineticEnergy() {
}
}
void
ContextImpl
::
updateContextState
()
{
void
ContextImpl
::
updateContextState
()
{
for
(
int
i
=
0
;
i
<
(
int
)
forceImpls
.
size
();
++
i
)
for
(
auto
force
:
forceImpls
)
force
Impls
[
i
]
->
updateContextState
(
*
this
);
force
->
updateContextState
(
*
this
);
}
}
const
vector
<
ForceImpl
*>&
ContextImpl
::
getForceImpls
()
const
{
const
vector
<
ForceImpl
*>&
ContextImpl
::
getForceImpls
()
const
{
...
@@ -349,8 +349,8 @@ const vector<vector<int> >& ContextImpl::getMolecules() const {
...
@@ -349,8 +349,8 @@ const vector<vector<int> >& ContextImpl::getMolecules() const {
system
.
getConstraintParameters
(
i
,
particle1
,
particle2
,
distance
);
system
.
getConstraintParameters
(
i
,
particle1
,
particle2
,
distance
);
bonds
.
push_back
(
std
::
make_pair
(
particle1
,
particle2
));
bonds
.
push_back
(
std
::
make_pair
(
particle1
,
particle2
));
}
}
for
(
int
i
=
0
;
i
<
(
int
)
forceImpls
.
size
();
i
++
)
{
for
(
auto
force
:
forceImpls
)
{
vector
<
pair
<
int
,
int
>
>
forceBonds
=
force
Impls
[
i
]
->
getBondedParticles
();
vector
<
pair
<
int
,
int
>
>
forceBonds
=
force
->
getBondedParticles
();
bonds
.
insert
(
bonds
.
end
(),
forceBonds
.
begin
(),
forceBonds
.
end
());
bonds
.
insert
(
bonds
.
end
(),
forceBonds
.
begin
(),
forceBonds
.
end
());
}
}
for
(
int
i
=
0
;
i
<
system
.
getNumParticles
();
i
++
)
{
for
(
int
i
=
0
;
i
<
system
.
getNumParticles
();
i
++
)
{
...
@@ -365,9 +365,9 @@ const vector<vector<int> >& ContextImpl::getMolecules() const {
...
@@ -365,9 +365,9 @@ const vector<vector<int> >& ContextImpl::getMolecules() const {
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
vector
<
vector
<
int
>
>
particleBonds
(
numParticles
);
vector
<
vector
<
int
>
>
particleBonds
(
numParticles
);
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
size
();
i
++
)
{
for
(
auto
&
bond
:
bonds
)
{
particleBonds
[
bond
s
[
i
]
.
first
].
push_back
(
bond
s
[
i
]
.
second
);
particleBonds
[
bond
.
first
].
push_back
(
bond
.
second
);
particleBonds
[
bond
s
[
i
]
.
second
].
push_back
(
bond
s
[
i
]
.
first
);
particleBonds
[
bond
.
second
].
push_back
(
bond
.
first
);
}
}
// Now identify particles by which molecule they belong to.
// Now identify particles by which molecule they belong to.
...
@@ -441,9 +441,9 @@ void ContextImpl::createCheckpoint(ostream& stream) {
...
@@ -441,9 +441,9 @@ void ContextImpl::createCheckpoint(ostream& stream) {
stream
.
write
((
char
*
)
&
numParticles
,
sizeof
(
int
));
stream
.
write
((
char
*
)
&
numParticles
,
sizeof
(
int
));
int
numParameters
=
parameters
.
size
();
int
numParameters
=
parameters
.
size
();
stream
.
write
((
char
*
)
&
numParameters
,
sizeof
(
int
));
stream
.
write
((
char
*
)
&
numParameters
,
sizeof
(
int
));
for
(
map
<
string
,
double
>::
const_iterator
iter
=
parameters
.
begin
();
iter
!=
parameters
.
end
();
++
iter
)
{
for
(
auto
&
param
:
parameters
)
{
writeString
(
stream
,
iter
->
first
);
writeString
(
stream
,
param
.
first
);
stream
.
write
((
char
*
)
&
iter
->
second
,
sizeof
(
double
));
stream
.
write
((
char
*
)
&
param
.
second
,
sizeof
(
double
));
}
}
updateStateDataKernel
.
getAs
<
UpdateStateDataKernel
>
().
createCheckpoint
(
*
this
,
stream
);
updateStateDataKernel
.
getAs
<
UpdateStateDataKernel
>
().
createCheckpoint
(
*
this
,
stream
);
stream
.
flush
();
stream
.
flush
();
...
...
openmmapi/src/CustomCentroidBondForce.cpp
View file @
0a2439ce
...
@@ -52,8 +52,8 @@ CustomCentroidBondForce::CustomCentroidBondForce(int numGroups, const string& en
...
@@ -52,8 +52,8 @@ CustomCentroidBondForce::CustomCentroidBondForce(int numGroups, const string& en
}
}
CustomCentroidBondForce
::~
CustomCentroidBondForce
()
{
CustomCentroidBondForce
::~
CustomCentroidBondForce
()
{
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
size
();
i
++
)
for
(
auto
function
:
functions
)
delete
function
s
[
i
]
.
function
;
delete
function
.
function
;
}
}
const
string
&
CustomCentroidBondForce
::
getEnergyFunction
()
const
{
const
string
&
CustomCentroidBondForce
::
getEnergyFunction
()
const
{
...
...
openmmapi/src/CustomCentroidBondForceImpl.cpp
View file @
0a2439ce
...
@@ -83,11 +83,11 @@ void CustomCentroidBondForceImpl::initialize(ContextImpl& context) {
...
@@ -83,11 +83,11 @@ void CustomCentroidBondForceImpl::initialize(ContextImpl& context) {
vector
<
double
>
weights
;
vector
<
double
>
weights
;
for
(
int
i
=
0
;
i
<
owner
.
getNumGroups
();
i
++
)
{
for
(
int
i
=
0
;
i
<
owner
.
getNumGroups
();
i
++
)
{
owner
.
getGroupParameters
(
i
,
particles
,
weights
);
owner
.
getGroupParameters
(
i
,
particles
,
weights
);
for
(
int
j
=
0
;
j
<
(
int
)
particles
.
size
();
j
++
)
for
(
int
particle
:
particles
)
if
(
particle
s
[
j
]
<
0
||
particle
s
[
j
]
>=
system
.
getNumParticles
())
{
if
(
particle
<
0
||
particle
>=
system
.
getNumParticles
())
{
stringstream
msg
;
stringstream
msg
;
msg
<<
"CustomCentroidBondForce: Illegal particle index for a group: "
;
msg
<<
"CustomCentroidBondForce: Illegal particle index for a group: "
;
msg
<<
particle
s
[
j
]
;
msg
<<
particle
;
throw
OpenMMException
(
msg
.
str
());
throw
OpenMMException
(
msg
.
str
());
}
}
if
(
weights
.
size
()
!=
particles
.
size
()
&&
weights
.
size
()
>
0
)
{
if
(
weights
.
size
()
!=
particles
.
size
()
&&
weights
.
size
()
>
0
)
{
...
@@ -102,11 +102,11 @@ void CustomCentroidBondForceImpl::initialize(ContextImpl& context) {
...
@@ -102,11 +102,11 @@ void CustomCentroidBondForceImpl::initialize(ContextImpl& context) {
int
numBondParameters
=
owner
.
getNumPerBondParameters
();
int
numBondParameters
=
owner
.
getNumPerBondParameters
();
for
(
int
i
=
0
;
i
<
owner
.
getNumBonds
();
i
++
)
{
for
(
int
i
=
0
;
i
<
owner
.
getNumBonds
();
i
++
)
{
owner
.
getBondParameters
(
i
,
groups
,
parameters
);
owner
.
getBondParameters
(
i
,
groups
,
parameters
);
for
(
int
j
=
0
;
j
<
(
int
)
groups
.
size
();
j
++
)
for
(
int
group
:
groups
)
if
(
group
s
[
j
]
<
0
||
group
s
[
j
]
>=
owner
.
getNumGroups
())
{
if
(
group
<
0
||
group
>=
owner
.
getNumGroups
())
{
stringstream
msg
;
stringstream
msg
;
msg
<<
"CustomCentroidBondForce: Illegal group index for a bond: "
;
msg
<<
"CustomCentroidBondForce: Illegal group index for a bond: "
;
msg
<<
group
s
[
j
]
;
msg
<<
group
;
throw
OpenMMException
(
msg
.
str
());
throw
OpenMMException
(
msg
.
str
());
}
}
if
(
parameters
.
size
()
!=
numBondParameters
)
{
if
(
parameters
.
size
()
!=
numBondParameters
)
{
...
@@ -179,8 +179,8 @@ ExpressionTreeNode CustomCentroidBondForceImpl::replaceFunctions(const Expressio
...
@@ -179,8 +179,8 @@ ExpressionTreeNode CustomCentroidBondForceImpl::replaceFunctions(const Expressio
// This is not an angle or dihedral, so process its children.
// This is not an angle or dihedral, so process its children.
vector
<
ExpressionTreeNode
>
children
;
vector
<
ExpressionTreeNode
>
children
;
for
(
int
i
=
0
;
i
<
(
int
)
node
.
getChildren
()
.
size
();
i
++
)
for
(
auto
&
child
:
node
.
getChildren
())
children
.
push_back
(
replaceFunctions
(
node
.
getChildren
()[
i
]
,
groups
,
distances
,
angles
,
dihedrals
,
variables
));
children
.
push_back
(
replaceFunctions
(
child
,
groups
,
distances
,
angles
,
dihedrals
,
variables
));
return
ExpressionTreeNode
(
op
.
clone
(),
children
);
return
ExpressionTreeNode
(
op
.
clone
(),
children
);
}
}
const
Operation
::
Custom
&
custom
=
static_cast
<
const
Operation
::
Custom
&>
(
op
);
const
Operation
::
Custom
&
custom
=
static_cast
<
const
Operation
::
Custom
&>
(
op
);
...
...
openmmapi/src/CustomCompoundBondForce.cpp
View file @
0a2439ce
...
@@ -53,8 +53,8 @@ CustomCompoundBondForce::CustomCompoundBondForce(int numParticles, const string&
...
@@ -53,8 +53,8 @@ CustomCompoundBondForce::CustomCompoundBondForce(int numParticles, const string&
CustomCompoundBondForce
::~
CustomCompoundBondForce
()
{
CustomCompoundBondForce
::~
CustomCompoundBondForce
()
{
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
size
();
i
++
)
for
(
auto
function
:
functions
)
delete
function
s
[
i
]
.
function
;
delete
function
.
function
;
}
}
const
string
&
CustomCompoundBondForce
::
getEnergyFunction
()
const
{
const
string
&
CustomCompoundBondForce
::
getEnergyFunction
()
const
{
...
...
openmmapi/src/CustomCompoundBondForceImpl.cpp
View file @
0a2439ce
...
@@ -88,11 +88,11 @@ void CustomCompoundBondForceImpl::initialize(ContextImpl& context) {
...
@@ -88,11 +88,11 @@ void CustomCompoundBondForceImpl::initialize(ContextImpl& context) {
int
numBondParameters
=
owner
.
getNumPerBondParameters
();
int
numBondParameters
=
owner
.
getNumPerBondParameters
();
for
(
int
i
=
0
;
i
<
owner
.
getNumBonds
();
i
++
)
{
for
(
int
i
=
0
;
i
<
owner
.
getNumBonds
();
i
++
)
{
owner
.
getBondParameters
(
i
,
particles
,
parameters
);
owner
.
getBondParameters
(
i
,
particles
,
parameters
);
for
(
int
j
=
0
;
j
<
(
int
)
particles
.
size
();
j
++
)
for
(
int
particle
:
particles
)
if
(
particle
s
[
j
]
<
0
||
particle
s
[
j
]
>=
system
.
getNumParticles
())
{
if
(
particle
<
0
||
particle
>=
system
.
getNumParticles
())
{
stringstream
msg
;
stringstream
msg
;
msg
<<
"CustomCompoundBondForce: Illegal particle index for a bond: "
;
msg
<<
"CustomCompoundBondForce: Illegal particle index for a bond: "
;
msg
<<
particle
s
[
j
]
;
msg
<<
particle
;
throw
OpenMMException
(
msg
.
str
());
throw
OpenMMException
(
msg
.
str
());
}
}
if
(
parameters
.
size
()
!=
numBondParameters
)
{
if
(
parameters
.
size
()
!=
numBondParameters
)
{
...
@@ -165,8 +165,8 @@ ExpressionTreeNode CustomCompoundBondForceImpl::replaceFunctions(const Expressio
...
@@ -165,8 +165,8 @@ ExpressionTreeNode CustomCompoundBondForceImpl::replaceFunctions(const Expressio
// This is not an angle or dihedral, so process its children.
// This is not an angle or dihedral, so process its children.
vector
<
ExpressionTreeNode
>
children
;
vector
<
ExpressionTreeNode
>
children
;
for
(
int
i
=
0
;
i
<
(
int
)
node
.
getChildren
()
.
size
();
i
++
)
for
(
auto
&
child
:
node
.
getChildren
())
children
.
push_back
(
replaceFunctions
(
node
.
getChildren
()[
i
]
,
atoms
,
distances
,
angles
,
dihedrals
,
variables
));
children
.
push_back
(
replaceFunctions
(
child
,
atoms
,
distances
,
angles
,
dihedrals
,
variables
));
return
ExpressionTreeNode
(
op
.
clone
(),
children
);
return
ExpressionTreeNode
(
op
.
clone
(),
children
);
}
}
const
Operation
::
Custom
&
custom
=
static_cast
<
const
Operation
::
Custom
&>
(
op
);
const
Operation
::
Custom
&
custom
=
static_cast
<
const
Operation
::
Custom
&>
(
op
);
...
...
openmmapi/src/CustomGBForce.cpp
View file @
0a2439ce
...
@@ -51,8 +51,8 @@ CustomGBForce::CustomGBForce() : nonbondedMethod(NoCutoff), cutoffDistance(1.0)
...
@@ -51,8 +51,8 @@ CustomGBForce::CustomGBForce() : nonbondedMethod(NoCutoff), cutoffDistance(1.0)
}
}
CustomGBForce
::~
CustomGBForce
()
{
CustomGBForce
::~
CustomGBForce
()
{
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
size
();
i
++
)
for
(
auto
function
:
functions
)
delete
function
s
[
i
]
.
function
;
delete
function
.
function
;
}
}
CustomGBForce
::
NonbondedMethod
CustomGBForce
::
getNonbondedMethod
()
const
{
CustomGBForce
::
NonbondedMethod
CustomGBForce
::
getNonbondedMethod
()
const
{
...
@@ -60,6 +60,8 @@ CustomGBForce::NonbondedMethod CustomGBForce::getNonbondedMethod() const {
...
@@ -60,6 +60,8 @@ CustomGBForce::NonbondedMethod CustomGBForce::getNonbondedMethod() const {
}
}
void
CustomGBForce
::
setNonbondedMethod
(
NonbondedMethod
method
)
{
void
CustomGBForce
::
setNonbondedMethod
(
NonbondedMethod
method
)
{
if
(
method
<
0
||
method
>
2
)
throw
OpenMMException
(
"CustomGBForce: Illegal value for nonbonded method"
);
nonbondedMethod
=
method
;
nonbondedMethod
=
method
;
}
}
...
...
openmmapi/src/CustomHbondForce.cpp
View file @
0a2439ce
...
@@ -52,8 +52,8 @@ CustomHbondForce::CustomHbondForce(const string& energy) : energyExpression(ener
...
@@ -52,8 +52,8 @@ CustomHbondForce::CustomHbondForce(const string& energy) : energyExpression(ener
CustomHbondForce
::~
CustomHbondForce
()
{
CustomHbondForce
::~
CustomHbondForce
()
{
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
size
();
i
++
)
for
(
auto
function
:
functions
)
delete
function
s
[
i
]
.
function
;
delete
function
.
function
;
}
}
const
string
&
CustomHbondForce
::
getEnergyFunction
()
const
{
const
string
&
CustomHbondForce
::
getEnergyFunction
()
const
{
...
@@ -69,6 +69,8 @@ CustomHbondForce::NonbondedMethod CustomHbondForce::getNonbondedMethod() const {
...
@@ -69,6 +69,8 @@ CustomHbondForce::NonbondedMethod CustomHbondForce::getNonbondedMethod() const {
}
}
void
CustomHbondForce
::
setNonbondedMethod
(
NonbondedMethod
method
)
{
void
CustomHbondForce
::
setNonbondedMethod
(
NonbondedMethod
method
)
{
if
(
method
<
0
||
method
>
2
)
throw
OpenMMException
(
"CustomHbondForce: Illegal value for nonbonded method"
);
nonbondedMethod
=
method
;
nonbondedMethod
=
method
;
}
}
...
...
openmmapi/src/CustomHbondForceImpl.cpp
View file @
0a2439ce
...
@@ -235,8 +235,8 @@ ExpressionTreeNode CustomHbondForceImpl::replaceFunctions(const ExpressionTreeNo
...
@@ -235,8 +235,8 @@ ExpressionTreeNode CustomHbondForceImpl::replaceFunctions(const ExpressionTreeNo
// This is not an angle or dihedral, so process its children.
// This is not an angle or dihedral, so process its children.
vector
<
ExpressionTreeNode
>
children
;
vector
<
ExpressionTreeNode
>
children
;
for
(
int
i
=
0
;
i
<
(
int
)
node
.
getChildren
()
.
size
();
i
++
)
for
(
auto
&
child
:
node
.
getChildren
())
children
.
push_back
(
replaceFunctions
(
node
.
getChildren
()[
i
]
,
atoms
,
distances
,
angles
,
dihedrals
,
variables
));
children
.
push_back
(
replaceFunctions
(
child
,
atoms
,
distances
,
angles
,
dihedrals
,
variables
));
return
ExpressionTreeNode
(
op
.
clone
(),
children
);
return
ExpressionTreeNode
(
op
.
clone
(),
children
);
}
}
const
Operation
::
Custom
&
custom
=
static_cast
<
const
Operation
::
Custom
&>
(
op
);
const
Operation
::
Custom
&
custom
=
static_cast
<
const
Operation
::
Custom
&>
(
op
);
...
...
openmmapi/src/CustomIntegrator.cpp
View file @
0a2439ce
...
@@ -55,8 +55,7 @@ void CustomIntegrator::initialize(ContextImpl& contextRef) {
...
@@ -55,8 +55,7 @@ void CustomIntegrator::initialize(ContextImpl& contextRef) {
set
<
std
::
string
>
variableSet
;
set
<
std
::
string
>
variableSet
;
variableList
.
insert
(
variableList
.
end
(),
globalNames
.
begin
(),
globalNames
.
end
());
variableList
.
insert
(
variableList
.
end
(),
globalNames
.
begin
(),
globalNames
.
end
());
variableList
.
insert
(
variableList
.
end
(),
perDofNames
.
begin
(),
perDofNames
.
end
());
variableList
.
insert
(
variableList
.
end
(),
perDofNames
.
begin
(),
perDofNames
.
end
());
for
(
int
i
=
0
;
i
<
(
int
)
variableList
.
size
();
i
++
)
{
for
(
auto
&
name
:
variableList
)
{
string
&
name
=
variableList
[
i
];
if
(
variableSet
.
find
(
name
)
!=
variableSet
.
end
())
if
(
variableSet
.
find
(
name
)
!=
variableSet
.
end
())
throw
OpenMMException
(
"The Integrator defines two variables with the same name: "
+
name
);
throw
OpenMMException
(
"The Integrator defines two variables with the same name: "
+
name
);
variableSet
.
insert
(
name
);
variableSet
.
insert
(
name
);
...
@@ -66,8 +65,8 @@ void CustomIntegrator::initialize(ContextImpl& contextRef) {
...
@@ -66,8 +65,8 @@ void CustomIntegrator::initialize(ContextImpl& contextRef) {
set
<
std
::
string
>
globalTargets
;
set
<
std
::
string
>
globalTargets
;
globalTargets
.
insert
(
globalNames
.
begin
(),
globalNames
.
end
());
globalTargets
.
insert
(
globalNames
.
begin
(),
globalNames
.
end
());
globalTargets
.
insert
(
"dt"
);
globalTargets
.
insert
(
"dt"
);
for
(
map
<
string
,
double
>::
const_iterator
iter
=
contextRef
.
getParameters
().
begin
();
iter
!=
contextRef
.
getParameters
()
.
end
();
++
iter
)
for
(
auto
&
param
:
contextRef
.
getParameters
())
globalTargets
.
insert
(
iter
->
first
);
globalTargets
.
insert
(
param
.
first
);
for
(
int
i
=
0
;
i
<
computations
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
computations
.
size
();
i
++
)
{
if
(
computations
[
i
].
type
==
ComputeGlobal
&&
globalTargets
.
find
(
computations
[
i
].
variable
)
==
globalTargets
.
end
())
if
(
computations
[
i
].
type
==
ComputeGlobal
&&
globalTargets
.
find
(
computations
[
i
].
variable
)
==
globalTargets
.
end
())
throw
OpenMMException
(
"Unknown global variable: "
+
computations
[
i
].
variable
);
throw
OpenMMException
(
"Unknown global variable: "
+
computations
[
i
].
variable
);
...
...
openmmapi/src/CustomIntegratorUtilities.cpp
View file @
0a2439ce
...
@@ -59,8 +59,8 @@ bool CustomIntegratorUtilities::usesVariable(const Lepton::ExpressionTreeNode& n
...
@@ -59,8 +59,8 @@ bool CustomIntegratorUtilities::usesVariable(const Lepton::ExpressionTreeNode& n
const
Lepton
::
Operation
&
op
=
node
.
getOperation
();
const
Lepton
::
Operation
&
op
=
node
.
getOperation
();
if
(
op
.
getId
()
==
Lepton
::
Operation
::
VARIABLE
&&
op
.
getName
()
==
variable
)
if
(
op
.
getId
()
==
Lepton
::
Operation
::
VARIABLE
&&
op
.
getName
()
==
variable
)
return
true
;
return
true
;
for
(
int
i
=
0
;
i
<
(
int
)
node
.
getChildren
()
.
size
();
i
++
)
for
(
auto
&
child
:
node
.
getChildren
())
if
(
usesVariable
(
node
.
getChildren
()[
i
]
,
variable
))
if
(
usesVariable
(
child
,
variable
))
return
true
;
return
true
;
return
false
;
return
false
;
}
}
...
@@ -107,11 +107,9 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
...
@@ -107,11 +107,9 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
set
<
string
>
affectsForce
;
set
<
string
>
affectsForce
;
affectsForce
.
insert
(
"x"
);
affectsForce
.
insert
(
"x"
);
for
(
vector
<
ForceImpl
*>::
const_iterator
iter
=
context
.
getForceImpls
().
begin
();
iter
!=
context
.
getForceImpls
().
end
();
++
iter
)
{
for
(
auto
force
:
context
.
getForceImpls
())
const
map
<
string
,
double
>
params
=
(
*
iter
)
->
getDefaultParameters
();
for
(
auto
&
param
:
force
->
getDefaultParameters
())
for
(
map
<
string
,
double
>::
const_iterator
param
=
params
.
begin
();
param
!=
params
.
end
();
++
param
)
affectsForce
.
insert
(
param
.
first
);
affectsForce
.
insert
(
param
->
first
);
}
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
invalidatesForces
[
i
]
=
(
stepType
[
i
]
==
CustomIntegrator
::
ConstrainPositions
||
affectsForce
.
find
(
stepVariable
[
i
])
!=
affectsForce
.
end
());
invalidatesForces
[
i
]
=
(
stepType
[
i
]
==
CustomIntegrator
::
ConstrainPositions
||
affectsForce
.
find
(
stepVariable
[
i
])
!=
affectsForce
.
end
());
...
@@ -253,8 +251,7 @@ void CustomIntegratorUtilities::analyzeForceComputationsForPath(vector<int>& ste
...
@@ -253,8 +251,7 @@ void CustomIntegratorUtilities::analyzeForceComputationsForPath(vector<int>& ste
const
vector
<
bool
>&
invalidatesForces
,
const
vector
<
int
>&
forceGroup
,
vector
<
bool
>&
computeBoth
)
{
const
vector
<
bool
>&
invalidatesForces
,
const
vector
<
int
>&
forceGroup
,
vector
<
bool
>&
computeBoth
)
{
vector
<
int
>
candidatePoints
;
vector
<
int
>
candidatePoints
;
int
currentGroup
=
-
1
;
int
currentGroup
=
-
1
;
for
(
int
i
=
0
;
i
<
(
int
)
steps
.
size
();
i
++
)
{
for
(
int
step
:
steps
)
{
int
step
=
steps
[
i
];
if
(
invalidatesForces
[
step
]
||
((
needsForces
[
step
]
||
needsEnergy
[
step
])
&&
forceGroup
[
step
]
!=
currentGroup
))
{
if
(
invalidatesForces
[
step
]
||
((
needsForces
[
step
]
||
needsEnergy
[
step
])
&&
forceGroup
[
step
]
!=
currentGroup
))
{
// Forces and energies are invalidated at this step, or it changes to a different force group,
// Forces and energies are invalidated at this step, or it changes to a different force group,
// so anything from this point on won't affect what we do at earlier steps.
// so anything from this point on won't affect what we do at earlier steps.
...
@@ -264,11 +261,9 @@ void CustomIntegratorUtilities::analyzeForceComputationsForPath(vector<int>& ste
...
@@ -264,11 +261,9 @@ void CustomIntegratorUtilities::analyzeForceComputationsForPath(vector<int>& ste
if
(
needsForces
[
step
]
||
needsEnergy
[
step
])
{
if
(
needsForces
[
step
]
||
needsEnergy
[
step
])
{
// See if this step affects what we do at earlier points.
// See if this step affects what we do at earlier points.
for
(
int
j
=
0
;
j
<
(
int
)
candidatePoints
.
size
();
j
++
)
{
for
(
int
candidate
:
candidatePoints
)
int
candidate
=
candidatePoints
[
j
];
if
((
needsForces
[
candidate
]
&&
needsEnergy
[
step
])
||
(
needsEnergy
[
candidate
]
&&
needsForces
[
step
]))
if
((
needsForces
[
candidate
]
&&
needsEnergy
[
step
])
||
(
needsEnergy
[
candidate
]
&&
needsForces
[
step
]))
computeBoth
[
candidate
]
=
true
;
computeBoth
[
candidate
]
=
true
;
}
// Add this to the list of candidates that might be affected by later steps.
// Add this to the list of candidates that might be affected by later steps.
...
...
openmmapi/src/CustomManyParticleForce.cpp
View file @
0a2439ce
...
@@ -48,8 +48,8 @@ CustomManyParticleForce::CustomManyParticleForce(int particlesPerSet, const stri
...
@@ -48,8 +48,8 @@ CustomManyParticleForce::CustomManyParticleForce(int particlesPerSet, const stri
}
}
CustomManyParticleForce
::~
CustomManyParticleForce
()
{
CustomManyParticleForce
::~
CustomManyParticleForce
()
{
for
(
int
i
=
0
;
i
<
(
int
)
functions
.
size
();
i
++
)
for
(
auto
function
:
functions
)
delete
function
s
[
i
]
.
function
;
delete
function
.
function
;
}
}
const
string
&
CustomManyParticleForce
::
getEnergyFunction
()
const
{
const
string
&
CustomManyParticleForce
::
getEnergyFunction
()
const
{
...
@@ -65,6 +65,8 @@ CustomManyParticleForce::NonbondedMethod CustomManyParticleForce::getNonbondedMe
...
@@ -65,6 +65,8 @@ CustomManyParticleForce::NonbondedMethod CustomManyParticleForce::getNonbondedMe
}
}
void
CustomManyParticleForce
::
setNonbondedMethod
(
NonbondedMethod
method
)
{
void
CustomManyParticleForce
::
setNonbondedMethod
(
NonbondedMethod
method
)
{
if
(
method
<
0
||
method
>
2
)
throw
OpenMMException
(
"CustomManyParticleForce: Illegal value for nonbonded method"
);
nonbondedMethod
=
method
;
nonbondedMethod
=
method
;
}
}
...
@@ -162,9 +164,9 @@ void CustomManyParticleForce::createExclusionsFromBonds(const vector<pair<int, i
...
@@ -162,9 +164,9 @@ void CustomManyParticleForce::createExclusionsFromBonds(const vector<pair<int, i
return
;
return
;
vector
<
set
<
int
>
>
exclusions
(
particles
.
size
());
vector
<
set
<
int
>
>
exclusions
(
particles
.
size
());
vector
<
set
<
int
>
>
bonded12
(
exclusions
.
size
());
vector
<
set
<
int
>
>
bonded12
(
exclusions
.
size
());
for
(
int
i
=
0
;
i
<
(
int
)
bonds
.
size
();
++
i
)
{
for
(
auto
&
bond
:
bonds
)
{
int
p1
=
bond
s
[
i
]
.
first
;
int
p1
=
bond
.
first
;
int
p2
=
bond
s
[
i
]
.
second
;
int
p2
=
bond
.
second
;
exclusions
[
p1
].
insert
(
p2
);
exclusions
[
p1
].
insert
(
p2
);
exclusions
[
p2
].
insert
(
p1
);
exclusions
[
p2
].
insert
(
p1
);
bonded12
[
p1
].
insert
(
p2
);
bonded12
[
p1
].
insert
(
p2
);
...
@@ -172,15 +174,14 @@ void CustomManyParticleForce::createExclusionsFromBonds(const vector<pair<int, i
...
@@ -172,15 +174,14 @@ void CustomManyParticleForce::createExclusionsFromBonds(const vector<pair<int, i
}
}
for
(
int
level
=
0
;
level
<
bondCutoff
-
1
;
level
++
)
{
for
(
int
level
=
0
;
level
<
bondCutoff
-
1
;
level
++
)
{
vector
<
set
<
int
>
>
currentExclusions
=
exclusions
;
vector
<
set
<
int
>
>
currentExclusions
=
exclusions
;
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
particles
.
size
();
i
++
)
for
(
set
<
int
>::
const_iterator
iter
=
currentExclusions
[
i
].
begin
();
iter
!=
currentExclusions
[
i
].
end
();
++
iter
)
for
(
int
j
:
currentExclusions
[
i
])
exclusions
[
*
iter
].
insert
(
bonded12
[
i
].
begin
(),
bonded12
[
i
].
end
());
exclusions
[
j
].
insert
(
bonded12
[
i
].
begin
(),
bonded12
[
i
].
end
());
}
}
}
for
(
int
i
=
0
;
i
<
(
int
)
exclusions
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
exclusions
.
size
();
++
i
)
for
(
set
<
int
>::
const_iterator
iter
=
exclusions
[
i
].
begin
();
iter
!=
exclusions
[
i
].
end
();
++
iter
)
for
(
int
j
:
exclusions
[
i
]
)
if
(
*
iter
<
i
)
if
(
j
<
i
)
addExclusion
(
*
iter
,
i
);
addExclusion
(
j
,
i
);
}
}
void
CustomManyParticleForce
::
getTypeFilter
(
int
index
,
set
<
int
>&
types
)
const
{
void
CustomManyParticleForce
::
getTypeFilter
(
int
index
,
set
<
int
>&
types
)
const
{
...
...
Prev
1
2
3
4
5
…
7
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