Commit d7569df2 authored by Peter Eastman's avatar Peter Eastman
Browse files

Merge remote-tracking branch 'origin/master' into qc

parents 4089b688 0c00acd2
......@@ -191,7 +191,7 @@ public:
/**
* Get the cutoff distance.
*/
double getCutoff(void) const;
double getCutoff() const;
/**
* Get the method used for handling long range nonbonded interactions.
......
......@@ -61,7 +61,7 @@ void AmoebaMultipoleForce::setPolarizationType( AmoebaMultipoleForce::Polarizati
polarizationType = type;
}
double AmoebaMultipoleForce::getCutoffDistance( void ) const {
double AmoebaMultipoleForce::getCutoffDistance() const {
return cutoffDistance;
}
......
......@@ -106,7 +106,7 @@ void AmoebaVdwForce::setCutoff( double inputCutoff ){
cutoff = inputCutoff;
}
double AmoebaVdwForce::getCutoff( void ) const {
double AmoebaVdwForce::getCutoff() const {
return cutoff;
}
......
......@@ -97,11 +97,11 @@ extern "C" __global__ void computeBornSum(unsigned long long* __restrict__ bornS
// Extract the coordinates of this tile
const unsigned int tgx = threadIdx.x & (TILE_SIZE-1);
const unsigned int tbx = threadIdx.x - tgx;
unsigned int x, y;
int x, y;
AtomData1 data;
data.bornSum = 0;
if (pos < end) {
y = (unsigned int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-sqrt((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......@@ -232,10 +232,10 @@ extern "C" __global__ void computeGKForces(
// Extract the coordinates of this tile
const unsigned int tgx = threadIdx.x & (TILE_SIZE-1);
const unsigned int tbx = threadIdx.x - tgx;
unsigned int x, y;
int x, y;
AtomData2 data;
if (pos < end) {
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......@@ -471,10 +471,10 @@ extern "C" __global__ void computeChainRuleForce(
// Extract the coordinates of this tile
const unsigned int tgx = threadIdx.x & (TILE_SIZE-1);
const unsigned int tbx = threadIdx.x - tgx;
unsigned int x, y;
int x, y;
AtomData3 data;
if (pos < end) {
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......@@ -766,8 +766,8 @@ extern "C" __global__ void computeEDiffForce(
while (pos < end) {
// Extract the coordinates of this tile.
unsigned int x, y;
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
int x, y;
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......
......@@ -207,10 +207,10 @@ extern "C" __global__ void computeWCAForce(unsigned long long* __restrict__ forc
const unsigned int tgx = threadIdx.x & (TILE_SIZE-1);
const unsigned int tbx = threadIdx.x - tgx;
const unsigned int localGroupIndex = threadIdx.x/TILE_SIZE;
unsigned int x, y;
int x, y;
AtomData data;
if (pos < end) {
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......
......@@ -234,14 +234,14 @@ extern "C" __global__ void computeElectrostatics(
// Extract the coordinates of this tile.
unsigned int x, y;
int x, y;
#ifdef USE_CUTOFF
if (numTiles <= maxTiles)
x = tiles[pos];
else
#endif
{
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......
......@@ -599,14 +599,14 @@ extern "C" __global__ void computeFixedField(
// Extract the coordinates of this tile.
unsigned int x, y;
int x, y;
#ifdef USE_CUTOFF
if (numTiles <= maxTiles)
x = tiles[pos];
else
#endif
{
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......
......@@ -337,14 +337,14 @@ extern "C" __global__ void computeInducedField(
// Extract the coordinates of this tile.
unsigned int x, y;
int x, y;
#ifdef USE_CUTOFF
if (numTiles <= maxTiles)
x = tiles[pos];
else
#endif
{
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......
......@@ -321,14 +321,14 @@ extern "C" __global__ void computeElectrostatics(
// Extract the coordinates of this tile.
unsigned int x, y;
int x, y;
#ifdef USE_CUTOFF
if (numTiles <= maxTiles)
x = tiles[pos];
else
#endif
{
y = (unsigned int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
y += (x < y ? -1 : 1);
......
......@@ -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) 2010 Stanford University and the Authors. *
* Portions copyright (c) 2010-2014 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -79,7 +79,7 @@ public:
private:
static void serialize(const SerializationNode& node, std::ostream& stream);
static void* deserializeStream(std::istream& stream);
static TiXmlElement* encodeNode(const SerializationNode& node);
static void encodeNode(const SerializationNode& node, std::ostream& stream, int depth);
static void decodeNode(SerializationNode& node, const TiXmlElement& element);
};
......
......@@ -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) 2010 Stanford University and the Authors. *
* Portions copyright (c) 2010-2014 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -36,25 +36,32 @@ using namespace OpenMM;
using namespace std;
void XmlSerializer::serialize(const SerializationNode& node, std::ostream& stream) {
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild(decl);
doc.LinkEndChild(encodeNode(node));
TiXmlPrinter printer;
printer.SetIndent("\t");
doc.Accept(&printer);
stream << printer.Str();
stream << "<?xml version=\"1.0\" ?>\n";
encodeNode(node, stream, 0);
}
TiXmlElement* XmlSerializer::encodeNode(const SerializationNode& node) {
TiXmlElement* element = new TiXmlElement(node.getName());
void XmlSerializer::encodeNode(const SerializationNode& node, std::ostream& stream, int depth) {
for (int i = 0; i < depth; i++)
stream << '\t';
stream << '<' << node.getName();
const map<string, string>& properties = node.getProperties();
for (map<string, string>::const_iterator iter = properties.begin(); iter != properties.end(); ++iter)
element->SetAttribute(iter->first.c_str(), iter->second.c_str());
for (map<string, string>::const_iterator iter = properties.begin(); iter != properties.end(); ++iter) {
string name, value;
TiXmlBase::EncodeString(iter->first, &name);
TiXmlBase::EncodeString(iter->second, &value);
stream << ' ' << name << "=\"" << value << '\"';
}
const vector<SerializationNode>& children = node.getChildren();
for (int i = 0; i < (int) children.size(); i++)
element->LinkEndChild(encodeNode(children[i]));
return element;
if (children.size() == 0)
stream << "/>\n";
else {
stream << ">\n";
for (int i = 0; i < (int) children.size(); i++)
encodeNode(children[i], stream, depth+1);
for (int i = 0; i < depth; i++)
stream << '\t';
stream << "</" << node.getName() << ">\n";
}
}
void* XmlSerializer::deserializeStream(std::istream& stream) {
......
echo $TRAVIS_PULL_REQUEST $TRAVIS_BRANCH
if [[ "$TRAVIS_PULL_REQUEST" == "true" ]]; then
echo "This is a pull request. No deployment will be done."; exit 0
fi
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "No deployment on BRANCH='$TRAVIS_BRANCH'"; exit 0
fi
if [[ "2.7 3.3" =~ "$python" ]]; then
conda install --yes binstar
binstar -t $BINSTAR_TOKEN upload --force -u omnia -p openmm-dev $HOME/miniconda/conda-bld/linux-64/openmm-dev-*
fi
if [[ "$python" != "2.7" ]]; then
echo "No deploy on PYTHON_VERSION=${python}"; exit 0
fi
# Original OpenMM .travis.yml requirements.
sudo apt-get update -qq
sudo apt-get install -qq libpcre3 libpcre3-dev gromacs
sudo apt-get install -qq swig doxygen llvm-3.3
sudo apt-get install -qq libgl1-mesa-dev opencl-headers fglrx=2:8.960-0ubuntu1 # for opencl support
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.3
# New requirements.
sudo apt-get install -qq -y g++ gfortran csh
sudo apt-get install -qq -y g++-multilib gcc-multilib
wget http://repo.continuum.io/miniconda/Miniconda-3.0.5-Linux-x86_64.sh
bash Miniconda-3.0.5-Linux-x86_64.sh -b
PIP_ARGS="-U"
export PATH=$HOME/miniconda/bin:$PATH
conda update --yes conda
conda config --add channels http://conda.binstar.org/omnia
conda create --yes -n ${python} python=${python} --file tools/ci/requirements-conda.txt
source activate $python
$HOME/miniconda/envs/${python}/bin/pip install $PIP_ARGS nose-exclude
This is a recipe for building the current development package into a conda binary.
The installation on travis-ci is done by building the conda package, installing
it, running the tests, and then if successful pushing the package to binstar
(and the docs to AWS S3). The binstar auth token is an encrypted environment
variable generated using:
binstar auth -n openmm-travis -o omnia --max-age 22896000 -c --scopes api:write
and then saved in the environment variable BINSTAR_TOKEN.
You can set up travis to store an encrypted token via
gem install travis travis encrypt BINSTAR_TOKEN=xx
where xx is the token output by binstar. The final command should print a line (containing 'secure') for inclusion in your .travis.yml file.
#!/bin/bash
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=$PREFIX"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# setting the rpath so that libOpenMMPME.so finds the right libfftw3
CMAKE_FLAGS+=" -DCMAKE_INSTALL_RPATH=.."
CMAKE_FLAGS+=" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
#CMAKE_FLAGS+=" -DOPENCL_LIBRARY=/opt/AMDAPP/lib/x86_64/libOpenCL.so" # TEST
elif [[ "$OSTYPE" == "darwin"* ]]; then
export MACOSX_DEPLOYMENT_TARGET="10.7"
CMAKE_FLAGS+=" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
fi
# Set location for FFTW3 on both linux and mac
CMAKE_FLAGS+=" -DFFTW_INCLUDES=$PREFIX/include"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
CMAKE_FLAGS+=" -DFFTW_LIBRARY=$PREFIX/lib/libfftw3f.so"
CMAKE_FLAGS+=" -DFFTW_THREADS_LIBRARY=$PREFIX/lib/libfftw3f_threads.so"
elif [[ "$OSTYPE" == "darwin"* ]]; then
CMAKE_FLAGS+=" -DFFTW_LIBRARY=$PREFIX/lib/libfftw3f.dylib"
CMAKE_FLAGS+=" -DFFTW_THREADS_LIBRARY=$PREFIX/lib/libfftw3f_threads.dylib"
fi
# Copy source to current directory.
cp -r $RECIPE_DIR/../.. .
# Build in subdirectory.
mkdir build
cd build
cmake .. $CMAKE_FLAGS
make -j4
make install
# Run C tests.
# Exclude OpenCL tests because @peastman suspects mesa on travis implementation is broken.
# @jchodera and @pgrinaway suspect travis is working, but AMD OpenCL tests are actually failing due to a bug.
ctest -j2 -V -E "[A-Za-z]+OpenCL[A-Za-z]+"
# Install Python wrappers.
export OPENMM_INCLUDE_PATH=$PREFIX/include
export OPENMM_LIB_PATH=$PREFIX/lib
cd python
$PYTHON setup.py install
cd ..
# Remove one random file
#rm $PREFIX/bin/TestReferenceHarmonicBondForce
# Copy all tests to bin directory so they will be distributed with install package.
cp `find . -name "Test*" -type f -maxdepth 1` $PREFIX/bin
package:
name: openmm
version: !!str dev
requirements:
build:
- cmake
- python
- fftw3f
run:
- python
- fftw3f
- numpy
about:
home: https://simtk.org/home/openmm
license: GPL
diff --git wrappers/python/simtk/openmm/__init__.py wrappers/python/simtk/openmm/__init__.py
index 7e47b11..0ef290a 100644
--- wrappers/python/simtk/openmm/__init__.py
+++ wrappers/python/simtk/openmm/__init__.py
@@ -13,6 +13,10 @@ import os, os.path
from simtk.openmm.openmm import *
from simtk.openmm.vec3 import Vec3
from simtk.openmm import version
-if os.getenv('OPENMM_PLUGIN_DIR') is None and os.path.isdir(version.openmm_library_path):
+_plugin_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', '..', 'plugins'))
+if os.path.isdir(_plugin_dir):
+ pluginLoadedLibNames = Platform.loadPluginsFromDirectory(_plugin_dir)
+ del _plugin_dir
+elif os.getenv('OPENMM_PLUGIN_DIR') is None and os.path.isdir(version.openmm_library_path):
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(os.path.join(version.openmm_library_path, 'plugins'))
else:
pluginLoadedLibNames = Platform.loadPluginsFromDirectory(Platform.getDefaultPluginsDirectory())
\ No newline at end of file
......@@ -158,10 +158,13 @@ class CharmmPsfFile(object):
title = list()
for i in range(ntitle):
title.append(psf.readline().rstrip())
# Skip the blank line
psf.readline()
# Skip all blank lines. Most of the time there is only 1, but I've seen
# a file that has 2
line = psf.readline().strip()
while not line:
line = psf.readline().strip()
# Next is the number of atoms
natom = conv(psf.readline().strip(), int, 'natom')
natom = conv(line, int, 'natom')
# Parse all of the atoms
residue_list = ResidueList()
atom_list = AtomList()
......@@ -1182,8 +1185,11 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared '
'to the cutoff!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
if abs(switchDistance) != switchDistance:
# Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
else: # periodic
# Set up box vectors (from inpcrd if available, or fall back to
......@@ -1223,8 +1229,11 @@ class CharmmPsfFile(object):
if switchDistance >= nonbondedCutoff:
raise ValueError('switchDistance is too large compared '
'to the cutoff!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
if abs(switchDistance) != switchDistance:
# Detects negatives for both Quantity and float
raise ValueError('switchDistance must be non-negative!')
force.setUseSwitchingFunction(True)
force.setSwitchingDistance(switchDistance)
if ewaldErrorTolerance is not None:
force.setEwaldErrorTolerance(ewaldErrorTolerance)
......
#!/bin/env python
"""
element.py: Used for managing elements.
......
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