Commit 51828eaa authored by Peter Eastman's avatar Peter Eastman
Browse files

Merge branch 'master' into qc

parents cf8a03e8 5ed9dd65
......@@ -10,15 +10,16 @@ before_install:
- export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.3
script:
- cmake -DCMAKE_INSTALL_PREFIX=~/OpenMM -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG="-g -fsanitize=address -fno-omit-frame-pointer -O2" .
- cmake -DCMAKE_INSTALL_PREFIX=$HOME/OpenMM .
- make
- make test
- make install
- ls ~/OpenMM/include
- export LD_LIBRARY_PATH=~/OpenMM/lib/
- export OPENMM_LIB_PATH=~/OpenMM/lib/
- export OPENMM_INCLUDE_PATH=~/OpenMM/include/
- cd python
- sudo -E python setup.py install
- cd tests
- sudo make PythonInstall
- # run all of the tests
- ctest -V
- # get a list of all of the failed tests into this stupid ctest format
- python -c 'fn = "Testing/Temporary/LastTestsFailed.log"; import os; os.path.exists(fn) or exit(0); l = [line.split(":")[0] for line in open(fn)]; triplets = zip(l, l, [","]*len(l)); print "".join(",".join(t) for t in triplets)' > FailedTests.log
- # rerun all of the failed tests
- if [ -s FailedTests.log ]; then ctest -V -I FailedTests.log; fi;
- # run the python tests too
- cd python/tests
- nosetests -vv
#---------------------------------------------------
# OpenMM
#
# Creates OpenMM library, base name=OpenMM.
# Default libraries are shared & optimized. Variants
# are created for static (_static) and debug (_d).
# Creates OpenMM library.
#
# Windows:
# OpenMM[_d].dll
# OpenMM[_d].lib
# OpenMM_static[_d].lib
# OpenMM.dll
# OpenMM.lib
# OpenMM_static.lib
# Unix:
# libOpenMM[_d].so
# libOpenMM_static[_d].a
# libOpenMM.so
# libOpenMM_static.a
#----------------------------------------------------
find_program(PYTHON_EXECUTABLE NAMES python)
......@@ -211,18 +209,6 @@ ENDIF(NOT LIBRARY_OUTPUT_PATH)
SET(${PROJECT_NAME}_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
SET(${PROJECT_NAME}_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (MSVC)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (MSVC)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
SET(STATIC_TARGET ${STATIC_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# used by plugin
SET(OPENMM_DIR ${CMAKE_CURRENT_SOURCE_DIR})
......
......@@ -13,6 +13,6 @@ Getting Help
Need Help? Check out the [documentation](https://simtk.org/docman/?group_id=161) and [discussion forums](https://simtk.org/forums/viewforum.php?f=161).
[C++ API Reference](https://simtk.org/api_docs/openmm/api5_0/c++/)
[C++ API Reference](https://simtk.org/api_docs/openmm/api6_0/c++/)
[Python API Reference](https://simtk.org/api_docs/openmm/api5_0/python/)
[Python API Reference](https://simtk.org/api_docs/openmm/api6_0/python/)
......@@ -95,7 +95,7 @@ in the new window.
If you plan to use the CUDA platform, OpenMM also needs to locate the CUDA
kernel compiler (nvcc). By default it looks for it in the location
/usr/local/cuda/bin/nvcc. If you have installed the CUDA toolkit in a different
:file:`/usr/local/cuda/bin/nvcc`. If you have installed the CUDA toolkit in a different
location, you can set OPENMM_CUDA_COMPILER to tell OpenMM where to find it. For
example,
::
......@@ -174,7 +174,7 @@ the new window.
If you plan to use the CUDA platform, OpenMM also needs to locate the CUDA
kernel compiler (nvcc). By default it looks for it in the location
/usr/local/cuda/bin/nvcc. If you have installed the CUDA toolkit in a different
:file:`/usr/local/cuda/bin/nvcc`. If you have installed the CUDA toolkit in a different
location, you can set OPENMM_CUDA_COMPILER to tell OpenMM where to find it. For
example,
::
......@@ -197,8 +197,8 @@ Installing on Windows
*********************
1. Download the pre-compiled binary of OpenMM for Windows, then double click the
.zip file to expand it. Move the files to C:\\Program Files\\OpenMM. (On 64 bit
Windows, use C:\\Program Files (x86)\\OpenMM).
.zip file to expand it. Move the files to :file:`C:\\Program Files\\OpenMM`. (On 64 bit
Windows, use :file:`C:\\Program Files (x86)\\OpenMM`).
2. Make sure you have the 32-bit version of Python 3.3 (other versions will not
work) installed on your computer. To do this, launch the Python program (either
......@@ -248,7 +248,7 @@ your PATH.
dir C:\py*
The files are typically located in a directory like C:\\Python33. Remember this
The files are typically located in a directory like :file:`C:\\Python33`. Remember this
location. You will need to enter it, along with the location of the OpenMM
libraries, later in this process.
......@@ -257,7 +257,7 @@ your PATH.
* Click on the Advanced tab or the Advanced system settings link
* Click Environment Variables
* Under System variables, select the line for Path and click Edit…”
* Add C:\\Program Files\\OpenMM\\lib and C:\\Program Files\\OpenMM\\lib\\plugins
* Add :file:`C:\\Program Files\\OpenMM\\lib` and :file:`C:\\Program Files\\OpenMM\\lib\\plugins`
to the Variable value. If you also need to add Python or FFTW to your
PATH, enter their directory locations here. Directory locations need to be
separated by semi-colons (;).
......@@ -265,8 +265,8 @@ your PATH.
If you installed OpenMM somewhere other than the default location, you must also
set OPENMM_PLUGIN_DIR to point to the plugins directory. If this variable is
not set, it will assume plugins are in the default location (C:\\Program
Files\\OpenMM\\lib\\plugins or C:\\Program Files (x86)\\OpenMM\\lib\\plugins).
not set, it will assume plugins are in the default location (:file:`C:\\Program
Files\\OpenMM\\lib\\plugins` or :file:`C:\\Program Files (x86)\\OpenMM\\lib\\plugins`).
7. Verify your installation by running the testInstallation.py script found in
the examples folder of your OpenMM installation. To run it, open a command
......@@ -328,8 +328,8 @@ on setting up the window to use OpenMM). Navigate to the “examples” folder
cd <examples_directory>
where the typical directory is :code:`/usr/local/openmm/examples` on Linux
and Mac machines and \ :code:`C:\\Program Files\\OpenMM\\examples` on Windows
where the typical directory is :file:`/usr/local/openmm/examples` on Linux
and Mac machines and :file:`C:\\Program Files\\OpenMM\\examples` on Windows
machines.
Then type
......@@ -566,8 +566,8 @@ which stores all the force field parameters directly in a prmtop file, Gromacs j
references to force field definition files that are installed with the Gromacs
application. OpenMM needs to know where to find these files, so the
:code:`includeDir` parameter specifies the directory containing them. If you
omit this parameter, OpenMM will assume the default location
/usr/local/gromacs/share/gromacs/top, which is often where they are installed on
omit this parameter, OpenMM will assume the default location :file:`/usr/local/gromacs/share/gromacs/top`,
which is often where they are installed on
Unix-like operating systems. So in :numref:`Example,Gromacs example` we actually could have omitted
this parameter, but if the Gromacs files were installed in any other location,
we would need to include it.
......@@ -620,7 +620,7 @@ The following lines specify to use the CUDA Platform:
platform = Platform.getPlatformByName('CUDA')
simulation = Simulation(prmtop.topology, system, integrator, platform)
The Platform name should be :code:`OpenCL`\ , :code:`CUDA`\ , or
The Platform name should be :code:`OpenCL`\ , :code:`CUDA`\ , :code:`CPU`\, or
:code:`Reference`\ .
You also can specify Platform-specific properties that customize how
......
......@@ -11,7 +11,7 @@ OpenMM consists of two parts:
to run simulations
This guide is devided into three sections:
This guide is divided into three sections:
* Part I (Chapters :ref:`the-openmm-application-layer-introduction`\ -\ :ref:`creating-force-fields`\ )
describes the application layer. It is relevant to all users, but especially relevant to people
......
......@@ -2733,7 +2733,7 @@ Multiplication or division of two Units results in a composite Unit.
mps = meter / second
Unlike amount (moles), angle (radians) is arguably dimensionless.  Butsimtk.unit
Unlike amount (moles), angle (radians) is arguably dimensionless.  But simtk.unit
treats angle as another dimension.   Use the trigonometric functions from the
simtk.unit module (not those from the Python math module!) when dealing with
Units and Quantities.
......
......@@ -1334,3 +1334,33 @@ specific types of rules. They are:
:math:`\mathbf{r}_{13} = \mathbf{r}_{3}-\mathbf{r}_{1}`\ . This allows
the virtual site to be located outside the plane of the three particles.
* LocalCoordinatesSite: The locations of three other particles are used to compute a local
coordinate system, and the virtual site is placed at a fixed location in that coordinate
system. The origin of the coordinate system and the directions of its x and y axes
are each specified as a weighted sum of the locations of the three particles:
.. math::
\mathbf{o}={w}^{o}_{1}\mathbf{r}_{1} + {w}^{o}_{2}\mathbf{r}_{2} + {w}^{o}_{3}\mathbf{r}_{3}
\mathbf{dx}={w}^{x}_{1}\mathbf{r}_{1} + {w}^{x}_{2}\mathbf{r}_{2} + {w}^{x}_{3}\mathbf{r}_{3}
\mathbf{dy}={w}^{y}_{1}\mathbf{r}_{1} + {w}^{y}_{2}\mathbf{r}_{2} + {w}^{y}_{3}\mathbf{r}_{3}
\mathbf{dz}=\mathbf{dx}\times \mathbf{dy}
..
These vectors are then used to construct a set of orthonormal coordinate axes as follows:
.. math::
\mathbf{\hat{x}}=\mathbf{dx}/|\mathbf{dx}|
\mathbf{\hat{z}}=\mathbf{dz}/|\mathbf{dz}|
\mathbf{\hat{y}}=\mathbf{\hat{z}}\times \mathbf{\hat{x}}
..
Finally, the position of the virtual site is set to
.. math::
\mathbf{r}=\mathbf{o}+p_1\mathbf{\hat{x}}+p_2\mathbf{\hat{y}}+p_3\mathbf{\hat{z}}
..
REMARK *
REMARK DATE: 8/ 5/ 9 14:44:19 CREATED BY USER: mjw
ATOM 1 N ALA 1 0.024 -0.103 -0.101 1.00 0.00 AAL
ATOM 2 HT1 ALA 1 0.027 -1.132 -0.239 1.00 0.00 AAL
ATOM 3 HT2 ALA 1 -0.805 0.163 0.471 1.00 0.00 AAL
ATOM 4 HT3 ALA 1 -0.059 0.384 -1.019 1.00 0.00 AAL
ATOM 5 CA ALA 1 1.247 0.375 0.636 1.00 0.00 AAL
ATOM 6 HA ALA 1 0.814 0.861 1.495 1.00 0.00 AAL
ATOM 7 CB ALA 1 2.057 -0.772 1.289 1.00 0.00 AAL
ATOM 8 HB1 ALA 1 3.136 -0.752 1.032 1.00 0.00 AAL
ATOM 9 HB2 ALA 1 1.990 -0.641 2.395 1.00 0.00 AAL
ATOM 10 HB3 ALA 1 1.656 -1.782 1.063 1.00 0.00 AAL
ATOM 11 C ALA 1 1.956 1.579 0.036 1.00 0.00 AAL
ATOM 12 O ALA 1 1.219 2.525 -0.201 1.00 0.00 AAL
ATOM 13 N ALA 2 3.289 1.631 -0.202 1.00 0.00 AAL
ATOM 14 HN ALA 2 3.939 0.868 -0.174 1.00 0.00 AAL
ATOM 15 CA ALA 2 3.990 2.909 -0.215 1.00 0.00 AAL
ATOM 16 HA ALA 2 3.742 3.440 0.695 1.00 0.00 AAL
ATOM 17 CB ALA 2 3.662 3.802 -1.434 1.00 0.00 AAL
ATOM 18 HB1 ALA 2 4.192 4.778 -1.358 1.00 0.00 AAL
ATOM 19 HB2 ALA 2 3.956 3.311 -2.382 1.00 0.00 AAL
ATOM 20 HB3 ALA 2 2.577 4.027 -1.467 1.00 0.00 AAL
ATOM 21 C ALA 2 5.487 2.654 -0.128 1.00 0.00 AAL
ATOM 22 O ALA 2 5.889 1.489 -0.137 1.00 0.00 AAL
ATOM 23 N ALA 3 6.275 3.733 -0.037 1.00 0.00 AAL
ATOM 24 HN ALA 3 5.963 4.691 -0.028 1.00 0.00 AAL
ATOM 25 CA ALA 3 7.707 3.802 0.068 1.00 0.00 AAL
ATOM 26 HA ALA 3 8.160 3.418 -0.833 1.00 0.00 AAL
ATOM 27 CB ALA 3 8.233 3.093 1.333 1.00 0.00 AAL
ATOM 28 HB1 ALA 3 9.342 3.149 1.356 1.00 0.00 AAL
ATOM 29 HB2 ALA 3 7.835 3.593 2.240 1.00 0.00 AAL
ATOM 30 HB3 ALA 3 7.923 2.030 1.332 1.00 0.00 AAL
ATOM 31 C ALA 3 8.018 5.323 0.136 1.00 0.00 AAL
ATOM 32 OT1 ALA 3 7.032 6.119 0.127 1.00 0.00 AAL
ATOM 33 OT2 ALA 3 9.219 5.692 0.188 1.00 0.00 AAL
TER 34 ALA 3
END
PSF CMAP CHEQ
2 !NTITLE
**
* DATE: 8/ 5/ 9 14:44:19 CREATED BY USER: mjw
33 !NATOM
1 AAL 1 ALA N 56 -0.300000 14.0070 0 0.00000 -0.301140E-02
2 AAL 1 ALA HT1 2 0.330000 1.00800 0 0.00000 -0.301140E-02
3 AAL 1 ALA HT2 2 0.330000 1.00800 0 0.00000 -0.301140E-02
4 AAL 1 ALA HT3 2 0.330000 1.00800 0 0.00000 -0.301140E-02
5 AAL 1 ALA CA 22 0.210000 12.0110 0 0.00000 -0.301140E-02
6 AAL 1 ALA HA 6 0.100000 1.00800 0 0.00000 -0.301140E-02
7 AAL 1 ALA CB 24 -0.270000 12.0110 0 0.00000 -0.301140E-02
8 AAL 1 ALA HB1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
9 AAL 1 ALA HB2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
10 AAL 1 ALA HB3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
11 AAL 1 ALA C 20 0.510000 12.0110 0 0.00000 -0.301140E-02
12 AAL 1 ALA O 70 -0.510000 15.9990 0 0.00000 -0.301140E-02
13 AAL 2 ALA N 54 -0.470000 14.0070 0 0.00000 -0.301140E-02
14 AAL 2 ALA HN 1 0.310000 1.00800 0 0.00000 -0.301140E-02
15 AAL 2 ALA CA 22 0.700000E-01 12.0110 0 0.00000 -0.301140E-02
16 AAL 2 ALA HA 6 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
17 AAL 2 ALA CB 24 -0.270000 12.0110 0 0.00000 -0.301140E-02
18 AAL 2 ALA HB1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
19 AAL 2 ALA HB2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
20 AAL 2 ALA HB3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
21 AAL 2 ALA C 20 0.510000 12.0110 0 0.00000 -0.301140E-02
22 AAL 2 ALA O 70 -0.510000 15.9990 0 0.00000 -0.301140E-02
23 AAL 3 ALA N 54 -0.470000 14.0070 0 0.00000 -0.301140E-02
24 AAL 3 ALA HN 1 0.310000 1.00800 0 0.00000 -0.301140E-02
25 AAL 3 ALA CA 22 0.700000E-01 12.0110 0 0.00000 -0.301140E-02
26 AAL 3 ALA HA 6 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
27 AAL 3 ALA CB 24 -0.270000 12.0110 0 0.00000 -0.301140E-02
28 AAL 3 ALA HB1 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
29 AAL 3 ALA HB2 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
30 AAL 3 ALA HB3 3 0.900000E-01 1.00800 0 0.00000 -0.301140E-02
31 AAL 3 ALA C 32 0.340000 12.0110 0 0.00000 -0.301140E-02
32 AAL 3 ALA OT1 72 -0.670000 15.9990 0 0.00000 -0.301140E-02
33 AAL 3 ALA OT2 72 -0.670000 15.9990 0 0.00000 -0.301140E-02
32 !NBOND: bonds
2 1 3 1 4 1 7 5
1 5 11 5 11 13 5 6
7 8 7 9 7 10 12 11
17 15 13 14 13 15 21 15
21 23 15 16 17 18 17 19
17 20 22 21 27 25 23 24
23 25 31 25 25 26 27 28
27 29 27 30 31 33 31 32
57 !NTHETA: angles
2 1 3 2 1 4 2 1 5
3 1 4 3 1 5 4 1 5
1 5 6 1 5 7 1 5 11
6 5 7 6 5 11 7 5 11
5 7 8 5 7 9 5 7 10
8 7 9 8 7 10 9 7 10
5 11 12 5 11 13 12 11 13
11 13 14 11 13 15 14 13 15
13 15 16 13 15 17 13 15 21
16 15 17 16 15 21 17 15 21
15 17 18 15 17 19 15 17 20
18 17 19 18 17 20 19 17 20
15 21 22 15 21 23 22 21 23
21 23 24 21 23 25 24 23 25
23 25 26 23 25 27 23 25 31
26 25 27 26 25 31 27 25 31
25 27 28 25 27 29 25 27 30
28 27 29 28 27 30 29 27 30
25 31 32 25 31 33 32 31 33
74 !NPHI: dihedrals
1 5 7 8 1 5 7 9
1 5 7 10 1 5 11 12
1 5 11 13 2 1 5 6
2 1 5 7 2 1 5 11
3 1 5 6 3 1 5 7
3 1 5 11 4 1 5 6
4 1 5 7 4 1 5 11
5 11 13 14 5 11 13 15
6 5 7 8 6 5 7 9
6 5 7 10 6 5 11 12
6 5 11 13 7 5 11 12
7 5 11 13 8 7 5 11
9 7 5 11 10 7 5 11
11 13 15 16 11 13 15 17
11 13 15 21 12 11 13 14
12 11 13 15 13 15 17 18
13 15 17 19 13 15 17 20
13 15 21 22 13 15 21 23
14 13 15 16 14 13 15 17
14 13 15 21 15 21 23 24
15 21 23 25 16 15 17 18
16 15 17 19 16 15 17 20
16 15 21 22 16 15 21 23
17 15 21 22 17 15 21 23
18 17 15 21 19 17 15 21
20 17 15 21 21 23 25 26
21 23 25 27 21 23 25 31
22 21 23 24 22 21 23 25
23 25 27 28 23 25 27 29
23 25 27 30 23 25 31 32
23 25 31 33 24 23 25 26
24 23 25 27 24 23 25 31
26 25 27 28 26 25 27 29
26 25 27 30 26 25 31 32
26 25 31 33 27 25 31 32
27 25 31 33 28 27 25 31
29 27 25 31 30 27 25 31
5 !NIMPHI: impropers
11 5 13 12 13 11 15 14
21 15 23 22 23 21 25 24
31 25 33 32
5 !NDON: donors
1 2 1 3 1 4 13 14
23 24
4 !NACC: acceptors
12 11 22 21 32 31 33 31
0 !NNB
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0
9 0 !NGRP NST2
0 2 0 6 1 0 10 1 0
12 1 0 16 1 0 20 1 0
22 1 0 26 1 0 30 2 0
1 !MOLNT
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1
0 0 !NUMLP NUMLPH
1 !NCRTERM: cross-terms
11 13 15 21 13 15 21 23
This diff is collapsed.
This diff is collapsed.
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout, exit, stderr
# Read the PSF
psf = CharmmPsfFile('ala_ala_ala.psf')
# Get the coordinates from the PDB
pdb = PDBFile('ala_ala_ala.pdb')
# Load the parameter set.
params = CharmmParameterSet('charmm22.rtf', 'charmm22.par')
# NOTICE:
# -------
# The CHARMM 22 parameter set is out-of-date and NOT recommended for general
# use. It is included here as an illustrative example, but for production
# simulations you should download the latest versions of the force fields at
# http://mackerell.umaryland.edu/CHARMM_ff_params.html
# Instantiate the system
system = psf.createSystem(params, nonbondedMethod=NoCutoff,
nonbondedCutoff=None)
integrator = LangevinIntegrator(300*kelvin, 1/picosecond, 0.002*picoseconds)
simulation = Simulation(psf.topology, system, integrator)
simulation.context.setPositions(pdb.getPositions())
simulation.minimizeEnergy()
simulation.reporters.append(PDBReporter('ch_output.pdb', 1000))
simulation.reporters.append(
StateDataReporter(stdout, 1000, step=True, potentialEnergy=True,
temperature=True)
)
simulation.step(10000)
......@@ -552,7 +552,7 @@ ForceValidationResult* ValidateOpenMMForces::compareForce(Context& context, std:
if( forceName.compare( "NA" ) == 0 ){
std::stringstream message;
message << "Force at index=" << ii << " not found -- aborting!";
std::cerr << message << std::endl;
std::cerr << message.str() << std::endl;
throw OpenMM::OpenMMException(message.str());
}
systemForceNameMap[forceName] = ii;
......
File mode changed from 100755 to 100644
......@@ -247,6 +247,15 @@ public:
* @param stream an input stream the checkpoint data should be read from
*/
void loadCheckpoint(std::istream& stream);
/**
* Get a description of how the particles in the system are grouped into molecules. Two particles are in the
* same molecule if they are connected by constraints or bonds, where every Force object can define bonds
* in whatever way are appropriate to that force.
*
* Each element lists the indices of all particles in a single molecule. Every particle is guaranteed to
* belong to exactly one molecule.
*/
const std::vector<std::vector<int> >& getMolecules() const;
private:
friend class Force;
friend class Platform;
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -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) 2012 Stanford University and the Authors. *
* Portions copyright (c) 2012-2014 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -32,6 +32,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include <openmm/Vec3.h>
#include "internal/windowsExport.h"
#include <vector>
......@@ -166,6 +167,65 @@ private:
double weight12, weight13, weightCross;
};
/**
* This is a VirtualSite that uses the locations of three other particles to compute a local
* coordinate system, then places the virtual site at a fixed location in that coordinate
* system. The origin of the coordinate system and the directions of its x and y axes
* are each specified as a weighted sum of the locations of the three particles:
*
* origin = w<sup>o</sup><sub>1</sub>r<sub>1</sub> + w<sup>o</sup><sub>2</sub>r<sub>2</sub> + w<sup>o</sup><sub>3</sub>r<sub>3</sub>
*
* xdir = w<sup>x</sup><sub>1</sub>r<sub>1</sub> + w<sup>x</sup><sub>2</sub>r<sub>2</sub> + w<sup>x</sup><sub>3</sub>r<sub>3</sub>
*
* ydir = w<sup>y</sup><sub>1</sub>r<sub>1</sub> + w<sup>y</sup><sub>2</sub>r<sub>2</sub> + w<sup>y</sup><sub>3</sub>r<sub>3</sub>
*
* For the origin, the three weights must add to one. For example if
* (w<sup>o</sup><sub>1</sub>, w<sup>o</sup><sub>2</sub>, w<sup>o</sup><sub>3</sub>) = (1.0, 0.0, 0.0),
* the origin of the local coordinate system is at the location of particle 1. For xdir and ydir,
* the weights must add to zero. For excample, if
* (w<sup>x</sup><sub>1</sub>, w<sup>x</sup><sub>2</sub>, w<sup>x</sup><sub>3</sub>) = (-1.0, 0.5, 0.5),
* the x axis points from particle 1 toward the midpoint between particles 2 and 3.
*
* The z direction is computed as zdir = xdir x ydir. To ensure the axes are all orthogonal,
* ydir is then recomputed as ydir = zdir x xdir. All three axis vectors are then normalized, and
* the virtual site location is set to
*
* origin + x*xdir + y*ydir + z*zdir
*/
class OPENMM_EXPORT LocalCoordinatesSite : public VirtualSite {
public:
/**
* Create a new LocalCoordinatesSite virtual site.
*
* @param particle1 the index of the first particle
* @param particle2 the index of the second particle
* @param particle3 the index of the third particle
* @param originWeights the weight factors for the three particles when computing the origin location
* @param xWeights the weight factors for the three particles when computing xdir
* @param yWeights the weight factors for the three particles when computing ydir
* @param localPosition the position of the virtual site in the local coordinate system
*/
LocalCoordinatesSite(int particle1, int particle2, int particle3, const Vec3& originWeights, const Vec3& xWeights, const Vec3& yWeights, const Vec3& localPosition);
/**
* Get the weight factors for the three particles when computing the origin location.
*/
const Vec3& getOriginWeights() const;
/**
* Get the weight factors for the three particles when computing xdir.
*/
const Vec3& getXWeights() const;
/**
* Get the weight factors for the three particles when computing ydir.
*/
const Vec3& getYWeights() const;
/**
* Get the position of the virtual site in the local coordinate system.
*/
const Vec3& getLocalPosition() const;
private:
Vec3 originWeights, xWeights, yWeights, localPosition;
};
} // namespace OpenMM
#endif /*OPENMM_VIRTUALSITE_H_*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment