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
cd874b2b
Commit
cd874b2b
authored
Feb 22, 2017
by
peastman
Browse files
Merged changes from main branch
parents
a783b996
b84e22ba
Changes
112
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
526 additions
and
424 deletions
+526
-424
.travis.yml
.travis.yml
+5
-0
CMakeLists.txt
CMakeLists.txt
+14
-139
appveyor.yml
appveyor.yml
+7
-5
devtools/packaging/scripts/windows/prepare.ps1
devtools/packaging/scripts/windows/prepare.ps1
+6
-6
docs-source/usersguide/application.rst
docs-source/usersguide/application.rst
+4
-3
docs-source/usersguide/library.rst
docs-source/usersguide/library.rst
+2
-2
docs-source/usersguide/references.bib
docs-source/usersguide/references.bib
+12
-0
docs-source/usersguide/theory.rst
docs-source/usersguide/theory.rst
+33
-1
libraries/lbfgs/src/lbfgs.cpp
libraries/lbfgs/src/lbfgs.cpp
+192
-171
olla/include/openmm/kernels.h
olla/include/openmm/kernels.h
+63
-2
openmmapi/include/openmm/NonbondedForce.h
openmmapi/include/openmm/NonbondedForce.h
+45
-6
openmmapi/include/openmm/internal/NonbondedForceImpl.h
openmmapi/include/openmm/internal/NonbondedForceImpl.h
+2
-1
openmmapi/include/openmm/internal/ThreadPool.h
openmmapi/include/openmm/internal/ThreadPool.h
+8
-1
openmmapi/src/LocalEnergyMinimizer.cpp
openmmapi/src/LocalEnergyMinimizer.cpp
+70
-64
openmmapi/src/NonbondedForce.cpp
openmmapi/src/NonbondedForce.cpp
+20
-1
openmmapi/src/NonbondedForceImpl.cpp
openmmapi/src/NonbondedForceImpl.cpp
+23
-11
openmmapi/src/ThreadPool.cpp
openmmapi/src/ThreadPool.cpp
+17
-5
platforms/cpu/include/CpuBondForce.h
platforms/cpu/include/CpuBondForce.h
+1
-2
platforms/cpu/include/CpuCustomGBForce.h
platforms/cpu/include/CpuCustomGBForce.h
+1
-2
platforms/cpu/include/CpuCustomManyParticleForce.h
platforms/cpu/include/CpuCustomManyParticleForce.h
+1
-2
No files found.
.travis.yml
View file @
cd874b2b
...
...
@@ -108,6 +108,11 @@ before_install:
brew install doxygen fftw;
sudo easy_install pytest;
fi
-
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="https://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;
export PATH=${HOME}/cmake/bin:${PATH};
fi
-
if [[ "$OPENCL" == "true" ]]; then
wget http://s3.amazonaws.com/omnia-ci/AMD-APP-SDKInstaller-v3.0.130.135-GA-linux64.tar.bz2;
tar -xjf AMD-APP-SDK*.tar.bz2;
...
...
CMakeLists.txt
View file @
cd874b2b
...
...
@@ -21,39 +21,18 @@ IF( NOT PROJECT_NAME )
PROJECT
(
OpenMM
)
ENDIF
(
NOT PROJECT_NAME
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
if
(
"
${
CMAKE_VERSION
}
"
VERSION_GREATER
"3.0"
OR
"
${
CMAKE_VERSION
}
"
VERSION_EQUAL
"3.0"
)
CMAKE_POLICY
(
SET CMP0042 OLD
)
endif
()
CMAKE_MINIMUM_REQUIRED
(
VERSION 3.1
)
CMAKE_POLICY
(
SET CMP0042 OLD
)
CMAKE_POLICY
(
SET CMP0003 NEW
)
CMAKE_POLICY
(
SET CMP0005 NEW
)
CMAKE_POLICY
(
SET CMP0011 NEW
)
#SET(CMAKE_VERBOSE_MAKEFILE 1)
# CMake 2.4 on dart server only needs to know about Dart
INCLUDE
(
Dart
)
MARK_AS_ADVANCED
(
DART_ROOT
)
# Avoid dart server problem with cmake 2.4 --cmb
set
(
cmv
"
${
CMAKE_MAJOR_VERSION
}
.
${
CMAKE_MINOR_VERSION
}
"
)
IF
(
NOT cmv EQUAL
"2.4"
)
# This whole file...
# We have custom cmake modules for FindOpenMM and running python tests
SET
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake_modules"
)
# Older cmake versions do not have cmake_policy command
# Cmake 2.4.5, the default cmake on red hat linux, has the
# cmake_policy command, but it does not work
# "if(POLICY ..." does not work with cmake 2.4.[56] on red hat
# (cmake 2.4.7 is OK)
if
(
COMMAND cmake_policy
)
if
(
CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 5
)
cmake_policy
(
SET CMP0003 NEW
)
cmake_policy
(
SET CMP0005 NEW
)
endif
(
CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 5
)
if
(
CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 6 OR CMAKE_PATCH_VERSION GREATER 2
)
cmake_policy
(
SET CMP0011 NEW
)
endif
(
CMAKE_MAJOR_VERSION GREATER 2 OR CMAKE_MINOR_VERSION GREATER 6 OR CMAKE_PATCH_VERSION GREATER 2
)
endif
(
COMMAND cmake_policy
)
# Where to install
IF
(
WIN32
)
IF
(
NOT OPENMM_INSTALL_PREFIX
)
...
...
@@ -69,6 +48,9 @@ IF(WIN32)
ADD_DEFINITIONS
(
-DWIN32
)
ENDIF
(
WIN32
)
# What type of libraries to build
SET
(
OPENMM_BUILD_SHARED_LIB ON CACHE BOOL
"Whether to build shared OpenMM libraries"
)
SET
(
OPENMM_BUILD_STATIC_LIB OFF CACHE BOOL
"Whether to build static OpenMM libraries"
)
# Include CPU-Features for Android
IF
(
ANDROID
)
...
...
@@ -98,22 +80,7 @@ ELSE(WIN32)
ENDIF
(
NOT ANDROID
)
ENDIF
(
WIN32
)
# The build system will set ARCH64 for 64 bit builds, which require
# use of the lib64/ library directories rather than lib/.
#SET( ARCH64 OFF CACHE BOOL "ON for 64bit builds, OFF for 32bit builds")
#MARK_AS_ADVANCED( ARCH64 )
#IF (ARCH64)
# SET(LIB64 64)
#ELSE (ARCH64)
# SET(LIB64) # nothing
#ENDIF (ARCH64)
IF
(
CMAKE_SIZEOF_VOID_P EQUAL 8
)
SET
(
LIB64 64
)
ELSE
(
CMAKE_SIZEOF_VOID_P EQUAL 8
)
SET
(
LIB64
)
ENDIF
(
CMAKE_SIZEOF_VOID_P EQUAL 8
)
SET
(
CMAKE_CXX_STANDARD 11
)
IF
(
APPLE
AND
(
NOT PNACL
))
# Build 64 bit binaries compatible with OS X 10.7
...
...
@@ -177,37 +144,11 @@ SET(OPENMM_MAJOR_VERSION 7)
SET
(
OPENMM_MINOR_VERSION 1
)
SET
(
OPENMM_BUILD_VERSION 0
)
SET
(
OPENMM_COPYRIGHT_YEARS
"2008-2015"
)
# underbar separated list of dotted authors, no spaces or commas
SET
(
OPENMM_AUTHORS
"Peter.Eastman"
)
ADD_DEFINITIONS
(
-DOPENMM_LIBRARY_NAME=
${
OPENMM_LIBRARY_NAME
}
-DOPENMM_MAJOR_VERSION=
${
OPENMM_MAJOR_VERSION
}
-DOPENMM_MINOR_VERSION=
${
OPENMM_MINOR_VERSION
}
-DOPENMM_BUILD_VERSION=
${
OPENMM_BUILD_VERSION
}
)
# CMake quotes automatically when building Visual Studio projects but we need
# to add them ourselves for Linux or Cygwin. Two cases to avoid duplicate quotes
# in Visual Studio which end up in the binary.
IF
(
MSVC
)
SET
(
NEED_QUOTES FALSE
)
ELSE
(
MSVC
)
SET
(
NEED_QUOTES TRUE
)
ENDIF
(
MSVC
)
##TODO: doesn't work without quotes in nightly build
SET
(
NEED_QUOTES TRUE
)
IF
(
NEED_QUOTES
)
ADD_DEFINITIONS
(
-DOPENMM_COPYRIGHT_YEARS=
"
${
OPENMM_COPYRIGHT_YEARS
}
"
-DOPENMM_AUTHORS=
"
${
OPENMM_AUTHORS
}
"
)
ELSE
(
NEED_QUOTES
)
ADD_DEFINITIONS
(
-DOPENMM_COPYRIGHT_YEARS=
${
OPENMM_COPYRIGHT_YEARS
}
-DOPENMM_AUTHORS=
${
OPENMM_AUTHORS
}
)
ENDIF
(
NEED_QUOTES
)
# -DOPENMM_TYPE has to be defined in the target subdirectories.
# -Dsimbody_EXPORTS defined automatically when Windows DLL build is being done.
...
...
@@ -283,7 +224,7 @@ IF (ANDROID OR PNACL)
ELSE
(
ANDROID OR PNACL
)
SET_SOURCE_FILES_PROPERTIES
(
${
CMAKE_SOURCE_DIR
}
/libraries/sfmt/src/SFMT.cpp PROPERTIES COMPILE_FLAGS
"-DHAVE_SSE2=1"
)
ENDIF
(
ANDROID OR PNACL
)
IF
(
NOT
(
ANDROID OR PNACL
))
IF
(
NOT
(
ANDROID OR PNACL
OR
(
WIN32 AND OPENMM_BUILD_STATIC_LIB
)
))
FILE
(
GLOB src_files
${
CMAKE_CURRENT_SOURCE_DIR
}
/libraries/asmjit/*/*.cpp
)
FILE
(
GLOB incl_files
${
CMAKE_CURRENT_SOURCE_DIR
}
/libraries/asmjit/*.h
)
SET
(
SOURCE_FILES
${
SOURCE_FILES
}
${
src_files
}
)
...
...
@@ -302,8 +243,6 @@ ENDIF(OPENMM_BUILD_C_AND_FORTRAN_WRAPPERS)
INCLUDE_DIRECTORIES
(
BEFORE
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
)
SET
(
OPENMM_BUILD_SHARED_LIB ON CACHE BOOL
"Whether to build shared OpenMM libraries"
)
SET
(
EXTRA_LINK_FLAGS
${
EXTRA_COMPILE_FLAGS
}
)
IF
(
CMAKE_SYSTEM_NAME MATCHES
"Linux"
)
IF
(
NOT ANDROID
)
...
...
@@ -319,7 +258,6 @@ IF(OPENMM_BUILD_SHARED_LIB)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_BUILDING_SHARED_LIBRARY -DLEPTON_BUILDING_SHARED_LIBRARY -DPTHREAD_BUILDING_SHARED_LIBRARY"
)
ENDIF
(
OPENMM_BUILD_SHARED_LIB
)
SET
(
OPENMM_BUILD_STATIC_LIB OFF CACHE BOOL
"Whether to build static OpenMM libraries"
)
IF
(
OPENMM_BUILD_STATIC_LIB
)
ADD_LIBRARY
(
${
STATIC_TARGET
}
STATIC
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
SET
(
EXTRA_COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_USE_STATIC_LIBRARIES -DLEPTON_USE_STATIC_LIBRARIES -DPTW32_STATIC_LIB"
)
...
...
@@ -363,63 +301,19 @@ IF(BUILD_TESTING AND OPENMM_BUILD_REFERENCE_TESTS)
ADD_SUBDIRECTORY
(
platforms/reference/tests
)
ENDIF
(
BUILD_TESTING AND OPENMM_BUILD_REFERENCE_TESTS
)
#
Which hardware platforms to build
#
CUDA platform
# A bit of tedium because we are using custom FindCUDA files that happen to work...
SET
(
FINDCUDA_DIR
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake_modules/FindCUDA"
)
SET
(
CUDA_BUILD_CUBIN OFF
)
FIND_PACKAGE
(
CUDA QUIET
)
IF
(
CUDA_FOUND
)
IF
(
NOT CUDA_NVCC_FLAGS
)
SET
(
FLAGS
""
)
# Note that cmake will insert semicolons between these item automatically...
SET
(
FLAGS
${
FLAGS
}
-gencode arch=compute_11,code=sm_11
)
SET
(
FLAGS
${
FLAGS
}
-gencode arch=compute_12,code=sm_12
)
SET
(
FLAGS
${
FLAGS
}
-gencode arch=compute_13,code=sm_13
)
SET
(
FLAGS
${
FLAGS
}
-gencode arch=compute_20,code=sm_20
)
SET
(
FLAGS
${
FLAGS
}
-use_fast_math
)
IF
(
MSVC
)
# Unfortunately the variables CUDA_NVCC_FLAGS_RELEASE and CUDA_NVCC_FLAGS_DEBUG
# appear to be unused, at least in CMake 2.6
# Release /MD linkage
set
(
FLAGS
${
FLAGS
}
"-Xcompiler
\"
/MD
\"
-DOPENMMCUDA_BUILDING_SHARED_LIBRARY"
)
ENDIF
(
MSVC
)
SET
(
CUDA_NVCC_FLAGS
"
${
FLAGS
}
"
CACHE STRING
"Semicolon delimit multiple arguments"
)
ENDIF
(
NOT CUDA_NVCC_FLAGS
)
SET
(
OPENMM_BUILD_CUDA_LIB ON CACHE BOOL
"Build OpenMMCuda library for Nvidia GPUs"
)
# I wish I was not hardcoding /MD here
# Avoid strange windows link error with cuda free energy
# plugin by specifying /MD to CUDA_NVCC_FLAGS
MARK_AS_ADVANCED
(
CLEAR CUDA_NVCC_FLAGS
)
IF
(
MSVC
)
# Unfortunately the variables CUDA_NVCC_FLAGS_RELEASE and CUDA_NVCC_FLAGS_DEBUG
# appear to be unused, at least in CMake 2.6
# Release /MD linkage
SET
(
HAS_NVCC_FLAG FALSE
)
IF
(
CUDA_NVCC_FLAGS MATCHES
"-Xcompiler"
)
SET
(
HAS_NVCC_FLAG TRUE
)
ENDIF
(
CUDA_NVCC_FLAGS MATCHES
"-Xcompiler"
)
IF
(
NOT HAS_NVCC_FLAG
)
set
(
new_flags
"-Xcompiler
\"
/MD
\"
-DOPENMMCUDA_BUILDING_SHARED_LIBRARY"
)
if
(
CUDA_NVCC_FLAGS
)
set
(
new_flags
"
${
CUDA_NVCC_FLAGS
}
;
${
new_flags
}
"
)
endif
(
CUDA_NVCC_FLAGS
)
SET
(
CUDA_NVCC_FLAGS
"
${
new_flags
}
"
CACHE STRING
"Semicolon delimit multiple arguments"
FORCE
)
ENDIF
(
NOT HAS_NVCC_FLAG
)
ENDIF
(
MSVC
)
ELSE
(
CUDA_FOUND
)
SET
(
OPENMM_BUILD_CUDA_LIB OFF CACHE BOOL
"Build OpenMMCuda library for Nvidia GPUs"
)
ENDIF
(
CUDA_FOUND
)
IF
(
OPENMM_BUILD_CUDA_LIB
)
ADD_SUBDIRECTORY
(
platforms/cuda
)
ENDIF
(
OPENMM_BUILD_CUDA_LIB
)
MARK_AS_ADVANCED
(
CUDA_VERBOSE_BUILD
)
MARK_AS_ADVANCED
(
CUDA_BUILD_CUBIN
)
MARK_AS_ADVANCED
(
CUDA_BUILD_EMULATION
)
MARK_AS_ADVANCED
(
CUDA_HOST_COMPILER CUDA_HOST_COMPILER_OPTIONS
)
# OpenCL platform
FIND_PACKAGE
(
OpenCL QUIET
)
IF
(
OPENCL_FOUND
)
...
...
@@ -517,7 +411,7 @@ INSTALL_FILES(/include/sfmt FILES ${SFMT_HEADERS})
ADD_SUBDIRECTORY
(
serialization
)
FILE
(
GLOB serialization_files
${
CMAKE_SOURCE_DIR
}
/serialization/src/*.cpp
)
SET_SOURCE_FILES_PROPERTIES
(
${
serialization_files
}
PROPERTIES COMPILE_FLAGS
"-DOPENMM_BUILDING_SHARED_LIBRARY
-DTIXML_USE_STL
-DIEEE_8087"
)
SET_SOURCE_FILES_PROPERTIES
(
${
serialization_files
}
PROPERTIES COMPILE_FLAGS
"-DOPENMM_BUILDING_SHARED_LIBRARY -DIEEE_8087"
)
# Python wrappers
...
...
@@ -535,23 +429,6 @@ IF(OPENMM_BUILD_PYTHON_WRAPPERS)
ADD_SUBDIRECTORY
(
wrappers/python
)
ENDIF
(
OPENMM_BUILD_PYTHON_WRAPPERS
)
#
# Allow automated build and dashboard.
#
# redundant INCLUDE(Dart) statement
# INCLUDE (Dart)
#IF (UNIX AND NOT CYGWIN AND NOT APPLE)
# IF (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug)
# ADD_DEFINITIONS(-fprofile-arcs -ftest-coverage)
# LINK_LIBRARIES(gcov)
# ENDIF (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug)
#ENDIF (UNIX AND NOT CYGWIN AND NOT APPLE)
#
# Testing
#
...
...
@@ -573,5 +450,3 @@ SET(OPENMM_BUILD_EXAMPLES ON CACHE BOOL "Build example executables")
IF
(
OPENMM_BUILD_EXAMPLES
)
ADD_SUBDIRECTORY
(
examples
)
ENDIF
(
OPENMM_BUILD_EXAMPLES
)
ENDIF
(
NOT cmv EQUAL
"2.4"
)
# This whole file...
appveyor.yml
View file @
cd874b2b
os
:
Windows Server 2012 R2
os
:
Visual Studio
2015
platform
:
x64
configuration
:
Release
shallow_clone
:
true
install
:
# Setup shell for VS2010, x64, release mode
-
>
"%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
# Setup shell for VS2015, x64
-
call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# Set path to python, git-bash tools.
-
"
set
PATH=C:
\\
Python3
4
-x64;C:
\\
Python3
4
-x64
\\
Scripts;%PATH%"
-
"
set
PATH=C:
\\
Python3
5
-x64;C:
\\
Python3
5
-x64
\\
Scripts;%PATH%"
-
"
set
PATH=C:
\\
Program
Files
(x86)
\\
Git
\\
bin;%PATH%"
-
pip install pytest
-
pip install numpy
# Use cclash for compiler caching (experimental)
-
ps
:
wget https://github.com/inorton/cclash/releases/download/0.3.14/cclash-0.3.14.zip -OutFile cclash-0.3.14.zip
...
...
devtools/packaging/scripts/windows/prepare.ps1
View file @
cd874b2b
cd
C:\Users\vagrant
# Install everything we can with choco.
choco
install
-y
doxygen.portable
swig
cmake
doxygen.install
vcbuildtools
git
jom
# Install CUDA.
wget
https://developer.nvidia.com/compute/cuda/8.0/prod/network_installers/cuda_8.0.44_win10_network-exe
-UseBasicParsing
-OutFile
cuda_8.0.44_win10_network.exe
...
...
@@ -21,5 +17,9 @@ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe -U
# Install software with conda.
&
"C:\Miniconda3\Scripts\conda.exe"
install
-y
-c
omnia
fftw3f
jinja2
lxml
sphinx
sphinxcontrib-autodoc_doxygen
sphinxcontrib-lunrsearch
conda-build
&
"C:\Miniconda3\Scripts\conda.exe"
install
-y
-c
omnia
fftw3f
jinja2
lxml
sphinx
sphinxcontrib-autodoc_doxygen
sphinxcontrib-lunrsearch
conda-build
anaconda-client
&
"C:\Miniconda3\Scripts\pip.exe"
install
sphinxcontrib.bibtex
# Install software with choco.
choco
install
-y
doxygen.portable
swig
cmake
doxygen.install
vcbuildtools
git
jom
docs-source/usersguide/application.rst
View file @
cd874b2b
...
...
@@ -916,8 +916,9 @@ Value Meaning
:
code
:`
NoCutoff
`
No
cutoff
is
applied
.
:
code
:`
CutoffNonPeriodic
`
The
reaction
field
method
is
used
to
eliminate
all
interactions
beyond
a
cutoff
distance
.
Not
valid
for
AMOEBA
.
:
code
:`
CutoffPeriodic
`
The
reaction
field
method
is
used
to
eliminate
all
interactions
beyond
a
cutoff
distance
.
Periodic
boundary
conditions
are
applied
,
so
each
atom
interacts
only
with
the
nearest
periodic
copy
of
every
other
atom
.
Not
valid
for
AMOEBA
.
:
code
:`
Ewald
`
Periodic
boundary
conditions
are
applied
.
Ewald
summation
is
used
to
compute
long
range
interactions
.
(
This
option
is
rarely
used
,
since
PME
is
much
faster
for
all
but
the
smallest
systems
.)
Not
valid
for
AMOEBA
.
:
code
:`
PME
`
Periodic
boundary
conditions
are
applied
.
The
Particle
Mesh
Ewald
method
is
used
to
compute
long
range
interactions
.
:
code
:`
Ewald
`
Periodic
boundary
conditions
are
applied
.
Ewald
summation
is
used
to
compute
long
range
Coulomb
interactions
.
(
This
option
is
rarely
used
,
since
PME
is
much
faster
for
all
but
the
smallest
systems
.)
Not
valid
for
AMOEBA
.
:
code
:`
PME
`
Periodic
boundary
conditions
are
applied
.
The
Particle
Mesh
Ewald
method
is
used
to
compute
long
range
Coulomb
interactions
.
:
code
:`
LJPME
`
Periodic
boundary
conditions
are
applied
.
The
Particle
Mesh
Ewald
method
is
used
to
compute
long
range
interactions
for
both
Coulomb
and
Lennard
-
Jones
.
=========================
===========================================================================================================================================================================================================================================
...
...
@@ -926,7 +927,7 @@ cutoff distance. Be sure to specify units, as shown in the examples above. For
example
,
:
code
:`
nonbondedCutoff
=
1.5
*
nanometers
`
or
:
code
:`
nonbondedCutoff
=
12
*
angstroms
`
are
legal
values
.
When
using
:
code
:`
Ewald
`
or
:
code
:`
PME
`\
,
you
can
optionally
specify
an
When
using
:
code
:`
Ewald
`
,
:
code
:`
PME
`,
or
:
code
:`
LJ
PME
`\
,
you
can
optionally
specify
an
error
tolerance
for
the
force
computation
.
For
example
:
::
...
...
docs-source/usersguide/library.rst
View file @
cd874b2b
...
...
@@ -404,7 +404,7 @@ version of Visual Studio.
Install
CMake
=============
CMake
is
the
build
system
used
for
OpenMM
.
You
must
install
CMake
version
2.8
CMake
is
the
build
system
used
for
OpenMM
.
You
must
install
CMake
version
3.1
or
higher
before
attempting
to
build
OpenMM
from
source
.
You
can
get
CMake
from
http
://
www
.
cmake
.
org
/.
If
you
choose
to
build
CMake
from
source
on
Linux
,
make
sure
you
have
the
curses
library
installed
beforehand
,
so
that
you
will
be
able
...
...
@@ -509,7 +509,7 @@ Windows
On
Windows
,
perform
the
following
steps
:
#.
Click
Start
->
All
Programs
->
CMake
2.8
->
CMake
#.
Click
Start
->
All
Programs
->
CMake
3.1
->
CMake
#.
In
the
box
labeled
"Where is the source code:"
browse
to
OpenMM
src
directory
(
containing
top
CMakeLists
.
txt
)
#.
In
the
box
labeled
"Where to build the binaries"
browse
to
your
build_openmm
...
...
docs-source/usersguide/references.bib
View file @
cd874b2b
...
...
@@ -517,3 +517,15 @@
year = {2014},
type = {Journal Article}
}
@article
{
Wennberg2015
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},
journal = {Journal of Chemical Theory and Computation},
volume = {11},
number = {12},
pages = {5737-5746},
year = {2015},
type = {Journal Article}
}
docs-source/usersguide/theory.rst
View file @
cd874b2b
...
...
@@ -412,7 +412,7 @@ and the number of nodes in the mesh along each dimension as
.. math::
n_\mathit{mesh}=\frac{2\alpha d}{{3
d
}^{1/5}}
n_\mathit{mesh}=\frac{2\alpha d}{{3
\delta
}^{1/5}}
where *d* is the width of the periodic box along that dimension. Alternatively,
...
...
@@ -432,6 +432,38 @@ to numerical round-off error than Ewald summation. For Platforms that do
calculations in single precision, making :math:`\delta` too small (typically below about
5·10\ :sup:`-5`\ ) can actually cause the error to increase.
Lennard-Jones Interaction With Particle Mesh Ewald
==================================================
The PME algorithm can also be used for Lennard-Jones interactions. Usually this
is not necessary, since Lennard-Jones forces are short ranged, but there are
situations (such as membrane simulations) where neglecting interactions beyond
the cutoff can measurably affect results.
For computational efficiency, certain approximations are made\ :cite:`Wennberg2015`.
Interactions beyond the cutoff distance include only the attractive :math:`1/r^6`
term, not the repulsive :math:`1/r^{12}` term. Since the latter is much smaller
than the former at long distances, this usually has negligible effect. Also,
the interaction between particles farther apart than the cutoff distance is
computed using geometric combination rules:
.. math::
\sigma=\sqrt{\sigma_1 \sigma_2}
The effect of this approximation is also quite small, and it is still far more
accurate than ignoring the interactions altogether (which is what would happen
with PME).
The formula used to compute the number of nodes along each dimension of the mesh
is slightly different from the one used for Coulomb interactions:
.. math::
n_\mathit{mesh}=\frac{\alpha d}{{3\delta}^{1/5}}
As before, this is an empirical formula. It will usually produce an average
relative error in the forces less than or similar to :math:`\delta`\ , but that
is not guaranteed.
.. _gbsaobcforce:
GBSAOBCForce
...
...
libraries/lbfgs/src/lbfgs.cpp
View file @
cd874b2b
...
...
@@ -408,6 +408,7 @@ int lbfgs(
pf
=
(
lbfgsfloatval_t
*
)
vecalloc
(
param
.
past
*
sizeof
(
lbfgsfloatval_t
));
}
try
{
/* Evaluate the function value and its gradient. */
fx
=
cd
.
proc_evaluate
(
cd
.
instance
,
x
,
g
,
cd
.
n
,
0
);
if
(
0.
!=
param
.
orthantwise_c
)
{
...
...
@@ -613,6 +614,26 @@ int lbfgs(
*/
step
=
1.0
;
}
}
catch
(...)
{
vecfree
(
pf
);
/* Free memory blocks used by this function. */
if
(
lm
!=
NULL
)
{
for
(
i
=
0
;
i
<
m
;
++
i
)
{
vecfree
(
lm
[
i
].
s
);
vecfree
(
lm
[
i
].
y
);
}
vecfree
(
lm
);
}
vecfree
(
pg
);
vecfree
(
w
);
vecfree
(
d
);
vecfree
(
gp
);
vecfree
(
g
);
vecfree
(
xp
);
throw
;
}
lbfgs_exit:
/* Return the final value of the objective function. */
...
...
olla/include/openmm/kernels.h
View file @
cd874b2b
...
...
@@ -555,7 +555,8 @@ public:
CutoffNonPeriodic
=
1
,
CutoffPeriodic
=
2
,
Ewald
=
3
,
PME
=
4
PME
=
4
,
LJPME
=
5
};
static
std
::
string
Name
()
{
return
"CalcNonbondedForce"
;
...
...
@@ -596,6 +597,15 @@ public:
* @param nz the number of grid points along the Z axis
*/
virtual
void
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
=
0
;
/**
* Get the parameters being used for the dispersion terms in LJPME.
*
* @param alpha the separation parameter
* @param nx the number of grid points along the X axis
* @param ny the number of grid points along the Y axis
* @param nz the number of grid points along the Z axis
*/
virtual
void
getLJPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
=
0
;
};
/**
...
...
@@ -1335,6 +1345,57 @@ public:
};
/**
* This kernel performs the dispersion reciprocal space calculation for LJPME. In most cases, this
* calculation is done directly by CalcNonbondedForceKernel so this kernel is unneeded.
* In some cases it may want to outsource the work to a different kernel. In particular,
* GPU based platforms sometimes use a CPU based implementation provided by a separate
* plugin.
*/
class
CalcDispersionPmeReciprocalForceKernel
:
public
KernelImpl
{
public:
class
IO
;
static
std
::
string
Name
()
{
return
"CalcDispersionPmeReciprocalForce"
;
}
CalcDispersionPmeReciprocalForceKernel
(
std
::
string
name
,
const
Platform
&
platform
)
:
KernelImpl
(
name
,
platform
)
{
}
/**
* Initialize the kernel.
*
* @param gridx the x size of the PME grid
* @param gridy the y size of the PME grid
* @param gridz the z size of the PME grid
* @param numParticles the number of particles in the system
* @param alpha the Ewald blending parameter
*/
virtual
void
initialize
(
int
gridx
,
int
gridy
,
int
gridz
,
int
numParticles
,
double
alpha
)
=
0
;
/**
* Begin computing the force and energy.
*
* @param io an object that coordinates data transfer
* @param periodicBoxVectors the vectors defining the periodic box (measured in nm)
* @param includeEnergy true if potential energy should be computed
*/
virtual
void
beginComputation
(
IO
&
io
,
const
Vec3
*
periodicBoxVectors
,
bool
includeEnergy
)
=
0
;
/**
* Finish computing the force and energy.
*
* @param io an object that coordinates data transfer
* @return the potential energy due to the PME reciprocal space interactions
*/
virtual
double
finishComputation
(
IO
&
io
)
=
0
;
/**
* Get the parameters being used for PME.
*
* @param alpha the separation parameter
* @param nx the number of grid points along the X axis
* @param ny the number of grid points along the Y axis
* @param nz the number of grid points along the Z axis
*/
virtual
void
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
=
0
;
};
}
// namespace OpenMM
#endif
/*OPENMM_KERNELS_H_*/
openmmapi/include/openmm/NonbondedForce.h
View file @
cd874b2b
...
...
@@ -101,15 +101,20 @@ public:
*/
CutoffPeriodic
=
2
,
/**
* Periodic boundary conditions are used, and Ewald summation is used to compute the interaction of each particle
* Periodic boundary conditions are used, and Ewald summation is used to compute the
Coulomb
interaction of each particle
* with all periodic copies of every other particle.
*/
Ewald
=
3
,
/**
* Periodic boundary conditions are used, and Particle-Mesh Ewald (PME) summation is used to compute the interaction of each particle
* Periodic boundary conditions are used, and Particle-Mesh Ewald (PME) summation is used to compute the
Coulomb
interaction of each particle
* with all periodic copies of every other particle.
*/
PME
=
4
PME
=
4
,
/**
* Periodic boundary conditions are used, and Particle-Mesh Ewald (PME) summation is used to compute the interaction of each particle
* with all periodic copies of every other particle for both Coulomb and Lennard-Jones. No switching is used for either interaction.
*/
LJPME
=
5
};
/**
* Create a NonbondedForce.
...
...
@@ -207,6 +212,16 @@ public:
* @param[out] nz the number of grid points along the Z axis
*/
void
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
/**
* Get the parameters to use for dispersion term in LJ-PME calculations. If alpha is 0 (the default),
* these parameters are ignored and instead their values are chosen based on the Ewald error tolerance.
*
* @param[out] alpha the separation parameter
* @param[out] nx the number of dispersion grid points along the X axis
* @param[out] ny the number of dispersion grid points along the Y axis
* @param[out] nz the number of dispersion grid points along the Z axis
*/
void
getLJPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
/**
* Set the parameters to use for PME calculations. If alpha is 0 (the default), these parameters are
* ignored and instead their values are chosen based on the Ewald error tolerance.
...
...
@@ -217,6 +232,16 @@ public:
* @param nz the number of grid points along the Z axis
*/
void
setPMEParameters
(
double
alpha
,
int
nx
,
int
ny
,
int
nz
);
/**
* Set the parameters to use for the dispersion term in LJPME calculations. If alpha is 0 (the default),
* these parameters are ignored and instead their values are chosen based on the Ewald error tolerance.
*
* @param alpha the separation parameter
* @param nx the number of grid points along the X axis
* @param ny the number of grid points along the Y axis
* @param nz the number of grid points along the Z axis
*/
void
setLJPMEParameters
(
double
alpha
,
int
nx
,
int
ny
,
int
nz
);
/**
* Get the parameters being used for PME in a particular Context. Because some platforms have restrictions
* on the allowed grid sizes, the values that are actually used may be slightly different from those
...
...
@@ -230,6 +255,19 @@ public:
* @param[out] nz the number of grid points along the Z axis
*/
void
getPMEParametersInContext
(
const
Context
&
context
,
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
/**
* Get the PME parameters being used for the dispersion term for LJPME in a particular Context. Because some
* platforms have restrictions on the allowed grid sizes, the values that are actually used may be slightly different
* from those specified with setPMEParameters(), or the standard values calculated based on the Ewald error tolerance.
* See the manual for details.
*
* @param context the Context for which to get the parameters
* @param[out] alpha the separation parameter
* @param[out] nx the number of grid points along the X axis
* @param[out] ny the number of grid points along the Y axis
* @param[out] nz the number of grid points along the Z axis
*/
void
getLJPMEParametersInContext
(
const
Context
&
context
,
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
/**
* Add the nonbonded force parameters for a particle. This should be called once for each particle
* in the System. When it is called for the i'th time, it specifies the parameters for the i'th particle.
...
...
@@ -374,7 +412,8 @@ public:
bool
usesPeriodicBoundaryConditions
()
const
{
return
nonbondedMethod
==
NonbondedForce
::
CutoffPeriodic
||
nonbondedMethod
==
NonbondedForce
::
Ewald
||
nonbondedMethod
==
NonbondedForce
::
PME
;
nonbondedMethod
==
NonbondedForce
::
PME
||
nonbondedMethod
==
NonbondedForce
::
LJPME
;
}
protected:
ForceImpl
*
createImpl
()
const
;
...
...
@@ -382,9 +421,9 @@ private:
class
ParticleInfo
;
class
ExceptionInfo
;
NonbondedMethod
nonbondedMethod
;
double
cutoffDistance
,
switchingDistance
,
rfDielectric
,
ewaldErrorTol
,
alpha
;
double
cutoffDistance
,
switchingDistance
,
rfDielectric
,
ewaldErrorTol
,
alpha
,
dalpha
;
bool
useSwitchingFunction
,
useDispersionCorrection
;
int
recipForceGroup
,
nx
,
ny
,
nz
;
int
recipForceGroup
,
nx
,
ny
,
nz
,
dnx
,
dny
,
dnz
;
void
addExclusionsToSet
(
const
std
::
vector
<
std
::
set
<
int
>
>&
bonded12
,
std
::
set
<
int
>&
exclusions
,
int
baseParticle
,
int
fromParticle
,
int
currentLevel
)
const
;
std
::
vector
<
ParticleInfo
>
particles
;
std
::
vector
<
ExceptionInfo
>
exceptions
;
...
...
openmmapi/include/openmm/internal/NonbondedForceImpl.h
View file @
cd874b2b
...
...
@@ -65,6 +65,7 @@ public:
std
::
vector
<
std
::
string
>
getKernelNames
();
void
updateParametersInContext
(
ContextImpl
&
context
);
void
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
void
getLJPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
/**
* This is a utility routine that calculates the values to use for alpha and kmax when using
* Ewald summation.
...
...
@@ -74,7 +75,7 @@ public:
* This is a utility routine that calculates the values to use for alpha and grid size when using
* Particle Mesh Ewald.
*/
static
void
calcPMEParameters
(
const
System
&
system
,
const
NonbondedForce
&
force
,
double
&
alpha
,
int
&
xsize
,
int
&
ysize
,
int
&
zsize
);
static
void
calcPMEParameters
(
const
System
&
system
,
const
NonbondedForce
&
force
,
double
&
alpha
,
int
&
xsize
,
int
&
ysize
,
int
&
zsize
,
bool
lj
);
/**
* Compute the coefficient which, when divided by the periodic box volume, gives the
* long range dispersion correction to the energy.
...
...
openmmapi/include/openmm/internal/ThreadPool.h
View file @
cd874b2b
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2013 Stanford University and the Authors.
*
* Portions copyright (c) 2013
-2017
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -34,6 +34,7 @@
#define NOMINMAX
#include "windowsExport.h"
#include <functional>
#include <pthread.h>
#include <vector>
...
...
@@ -69,6 +70,10 @@ public:
* Execute a Task in parallel on the worker threads.
*/
void
execute
(
Task
&
task
);
/**
* Execute a function in parallel on the worker threads.
*/
void
execute
(
std
::
function
<
void
(
ThreadPool
&
,
int
)
>
task
);
/**
* This is called by the worker threads to block until all threads have reached the same point
* and the master thread instructs them to continue by calling resumeThreads().
...
...
@@ -90,6 +95,8 @@ private:
std
::
vector
<
ThreadData
*>
threadData
;
pthread_cond_t
startCondition
,
endCondition
;
pthread_mutex_t
lock
;
Task
*
currentTask
;
std
::
function
<
void
(
ThreadPool
&
pool
,
int
)
>
currentFunction
;
};
/**
...
...
openmmapi/src/LocalEnergyMinimizer.cpp
View file @
cd874b2b
...
...
@@ -105,12 +105,13 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
void
LocalEnergyMinimizer
::
minimize
(
Context
&
context
,
double
tolerance
,
int
maxIterations
)
{
const
System
&
system
=
context
.
getSystem
();
int
numParticles
=
system
.
getNumParticles
();
lbfgsfloatval_t
*
x
=
lbfgs_malloc
(
numParticles
*
3
);
if
(
x
==
NULL
)
throw
OpenMMException
(
"LocalEnergyMinimizer: Failed to allocate memory"
);
double
constraintTol
=
context
.
getIntegrator
().
getConstraintTolerance
();
double
workingConstraintTol
=
std
::
max
(
1e-4
,
constraintTol
);
double
k
=
tolerance
/
workingConstraintTol
;
lbfgsfloatval_t
*
x
=
lbfgs_malloc
(
numParticles
*
3
);
if
(
x
==
NULL
)
throw
OpenMMException
(
"LocalEnergyMinimizer: Failed to allocate memory"
);
try
{
// Initialize the minimizer.
...
...
@@ -182,6 +183,11 @@ void LocalEnergyMinimizer::minimize(Context& context, double tolerance, int maxI
}
}
}
}
catch
(...)
{
lbfgs_free
(
x
);
throw
;
}
lbfgs_free
(
x
);
// If necessary, do a final constraint projection to make sure they are satisfied
...
...
openmmapi/src/NonbondedForce.cpp
View file @
cd874b2b
...
...
@@ -48,7 +48,8 @@ using std::stringstream;
using
std
::
vector
;
NonbondedForce
::
NonbondedForce
()
:
nonbondedMethod
(
NoCutoff
),
cutoffDistance
(
1.0
),
switchingDistance
(
-
1.0
),
rfDielectric
(
78.3
),
ewaldErrorTol
(
5e-4
),
alpha
(
0.0
),
useSwitchingFunction
(
false
),
useDispersionCorrection
(
true
),
recipForceGroup
(
-
1
),
nx
(
0
),
ny
(
0
),
nz
(
0
)
{
ewaldErrorTol
(
5e-4
),
alpha
(
0.0
),
dalpha
(
0.0
),
useSwitchingFunction
(
false
),
useDispersionCorrection
(
true
),
recipForceGroup
(
-
1
),
nx
(
0
),
ny
(
0
),
nz
(
0
),
dnx
(
0
),
dny
(
0
),
dnz
(
0
)
{
}
NonbondedForce
::
NonbondedMethod
NonbondedForce
::
getNonbondedMethod
()
const
{
...
...
@@ -106,6 +107,13 @@ void NonbondedForce::getPMEParameters(double& alpha, int& nx, int& ny, int& nz)
nz
=
this
->
nz
;
}
void
NonbondedForce
::
getLJPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
alpha
=
this
->
dalpha
;
nx
=
this
->
dnx
;
ny
=
this
->
dny
;
nz
=
this
->
dnz
;
}
void
NonbondedForce
::
setPMEParameters
(
double
alpha
,
int
nx
,
int
ny
,
int
nz
)
{
this
->
alpha
=
alpha
;
this
->
nx
=
nx
;
...
...
@@ -113,10 +121,21 @@ void NonbondedForce::setPMEParameters(double alpha, int nx, int ny, int nz) {
this
->
nz
=
nz
;
}
void
NonbondedForce
::
setLJPMEParameters
(
double
alpha
,
int
nx
,
int
ny
,
int
nz
)
{
this
->
dalpha
=
alpha
;
this
->
dnx
=
nx
;
this
->
dny
=
ny
;
this
->
dnz
=
nz
;
}
void
NonbondedForce
::
getPMEParametersInContext
(
const
Context
&
context
,
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
dynamic_cast
<
const
NonbondedForceImpl
&>
(
getImplInContext
(
context
)).
getPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
}
void
NonbondedForce
::
getLJPMEParametersInContext
(
const
Context
&
context
,
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
dynamic_cast
<
const
NonbondedForceImpl
&>
(
getImplInContext
(
context
)).
getLJPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
}
int
NonbondedForce
::
addParticle
(
double
charge
,
double
sigma
,
double
epsilon
)
{
particles
.
push_back
(
ParticleInfo
(
charge
,
sigma
,
epsilon
));
return
particles
.
size
()
-
1
;
...
...
openmmapi/src/NonbondedForceImpl.cpp
View file @
cd874b2b
...
...
@@ -90,9 +90,7 @@ void NonbondedForceImpl::initialize(ContextImpl& context) {
exceptions
[
particle1
].
insert
(
particle2
);
exceptions
[
particle2
].
insert
(
particle1
);
}
if
(
owner
.
getNonbondedMethod
()
==
NonbondedForce
::
CutoffPeriodic
||
owner
.
getNonbondedMethod
()
==
NonbondedForce
::
Ewald
||
owner
.
getNonbondedMethod
()
==
NonbondedForce
::
PME
)
{
if
(
owner
.
getNonbondedMethod
()
!=
NonbondedForce
::
NoCutoff
&&
owner
.
getNonbondedMethod
()
!=
NonbondedForce
::
CutoffNonPeriodic
)
{
Vec3
boxVectors
[
3
];
system
.
getDefaultPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoffDistance
();
...
...
@@ -151,19 +149,29 @@ void NonbondedForceImpl::calcEwaldParameters(const System& system, const Nonbond
kmaxz
++
;
}
void
NonbondedForceImpl
::
calcPMEParameters
(
const
System
&
system
,
const
NonbondedForce
&
force
,
double
&
alpha
,
int
&
xsize
,
int
&
ysize
,
int
&
zsize
)
{
void
NonbondedForceImpl
::
calcPMEParameters
(
const
System
&
system
,
const
NonbondedForce
&
force
,
double
&
alpha
,
int
&
xsize
,
int
&
ysize
,
int
&
zsize
,
bool
lj
)
{
if
(
lj
)
force
.
getLJPMEParameters
(
alpha
,
xsize
,
ysize
,
zsize
);
else
force
.
getPMEParameters
(
alpha
,
xsize
,
ysize
,
zsize
);
if
(
alpha
==
0.0
)
{
Vec3
boxVectors
[
3
];
system
.
getDefaultPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
tol
=
force
.
getEwaldErrorTolerance
();
alpha
=
(
1.0
/
force
.
getCutoffDistance
())
*
std
::
sqrt
(
-
log
(
2.0
*
tol
));
if
(
lj
)
{
xsize
=
(
int
)
ceil
(
alpha
*
boxVectors
[
0
][
0
]
/
(
3
*
pow
(
tol
,
0.2
)));
ysize
=
(
int
)
ceil
(
alpha
*
boxVectors
[
1
][
1
]
/
(
3
*
pow
(
tol
,
0.2
)));
zsize
=
(
int
)
ceil
(
alpha
*
boxVectors
[
2
][
2
]
/
(
3
*
pow
(
tol
,
0.2
)));
}
else
{
xsize
=
(
int
)
ceil
(
2
*
alpha
*
boxVectors
[
0
][
0
]
/
(
3
*
pow
(
tol
,
0.2
)));
ysize
=
(
int
)
ceil
(
2
*
alpha
*
boxVectors
[
1
][
1
]
/
(
3
*
pow
(
tol
,
0.2
)));
zsize
=
(
int
)
ceil
(
2
*
alpha
*
boxVectors
[
2
][
2
]
/
(
3
*
pow
(
tol
,
0.2
)));
xsize
=
max
(
xsize
,
5
);
ysize
=
max
(
ysize
,
5
);
zsize
=
max
(
zsize
,
5
);
}
xsize
=
max
(
xsize
,
6
);
ysize
=
max
(
ysize
,
6
);
zsize
=
max
(
zsize
,
6
);
}
}
...
...
@@ -283,3 +291,7 @@ void NonbondedForceImpl::updateParametersInContext(ContextImpl& context) {
void
NonbondedForceImpl
::
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
kernel
.
getAs
<
CalcNonbondedForceKernel
>
().
getPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
}
void
NonbondedForceImpl
::
getLJPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
kernel
.
getAs
<
CalcNonbondedForceKernel
>
().
getLJPMEParameters
(
alpha
,
nx
,
ny
,
nz
);
}
openmmapi/src/ThreadPool.cpp
View file @
cd874b2b
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2013-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2013-201
7
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -40,10 +40,17 @@ class ThreadPool::ThreadData {
public:
ThreadData
(
ThreadPool
&
owner
,
int
index
)
:
owner
(
owner
),
index
(
index
),
isDeleted
(
false
)
{
}
void
executeTask
()
{
if
(
owner
.
currentTask
!=
NULL
)
owner
.
currentTask
->
execute
(
owner
,
index
);
else
owner
.
currentFunction
(
owner
,
index
);
}
ThreadPool
&
owner
;
int
index
;
bool
isDeleted
;
Task
*
currentTask
;
function
<
void
(
ThreadPool
&
pool
,
int
)
>
currentFunction
;
};
static
void
*
threadBody
(
void
*
args
)
{
...
...
@@ -54,13 +61,13 @@ static void* threadBody(void* args) {
data
.
owner
.
syncThreads
();
if
(
data
.
isDeleted
)
break
;
data
.
currentTask
->
execute
(
data
.
owner
,
data
.
index
);
data
.
executeTask
(
);
}
delete
&
data
;
return
0
;
}
ThreadPool
::
ThreadPool
(
int
numThreads
)
{
ThreadPool
::
ThreadPool
(
int
numThreads
)
:
currentTask
(
NULL
)
{
if
(
numThreads
<=
0
)
numThreads
=
getNumProcessors
();
this
->
numThreads
=
numThreads
;
...
...
@@ -99,8 +106,13 @@ int ThreadPool::getNumThreads() const {
}
void
ThreadPool
::
execute
(
Task
&
task
)
{
for
(
int
i
=
0
;
i
<
(
int
)
threadData
.
size
();
i
++
)
threadData
[
i
]
->
currentTask
=
&
task
;
currentTask
=
&
task
;
resumeThreads
();
}
void
ThreadPool
::
execute
(
function
<
void
(
ThreadPool
&
,
int
)
>
task
)
{
currentTask
=
NULL
;
currentFunction
=
task
;
resumeThreads
();
}
...
...
platforms/cpu/include/CpuBondForce.h
View file @
cd874b2b
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2014 Stanford University and the Authors.
*
* Portions copyright (c) 2014
-2017
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -46,7 +46,6 @@ namespace OpenMM {
*/
class
OPENMM_EXPORT_CPU
CpuBondForce
{
public:
class
ComputeForceTask
;
CpuBondForce
();
/**
* Analyze the set of bonds and decide which to compute with each thread.
...
...
platforms/cpu/include/CpuCustomGBForce.h
View file @
cd874b2b
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
7
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -39,7 +39,6 @@ namespace OpenMM {
class
CpuCustomGBForce
{
private:
class
ComputeForceTask
;
class
ThreadData
;
bool
cutoff
;
...
...
platforms/cpu/include/CpuCustomManyParticleForce.h
View file @
cd874b2b
/* Portions copyright (c) 2009-201
4
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
7
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -48,7 +48,6 @@ private:
class
DistanceTermInfo
;
class
AngleTermInfo
;
class
DihedralTermInfo
;
class
ComputeForceTask
;
class
ThreadData
;
int
numParticles
,
numParticlesPerSet
,
numPerParticleParameters
,
numTypes
;
bool
useCutoff
,
usePeriodic
,
triclinic
,
centralParticleMode
;
...
...
Prev
1
2
3
4
5
6
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