Commit 309008f7 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Mods

parent cdee990d
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include <sstream>
#include "BrookBondParameters.h"
#include "OpenMMException.h"
using namespace OpenMM;
using namespace std;
/**
* BrookBondParameters constructor
*
* @param numberOfParticlesInBond no. of particles in each bond
* @param numberOfParametersInBond no. of parameters in each bond
* @param numberOfBonds no. of bonds
* @param log optional log reference
*
*/
BrookBondParameters::BrookBondParameters( std::string bondName, int numberOfParticlesInBond,
int numberOfParametersInBond, int numberOfBonds, FILE* log = NULL ) :
_bondName( bondName ), _numberOfParticlesInBond( numberOfParticlesInBond ),
_numberOfParametersInBond( numberOfParametersInBond ), _numberOfBonds( numberOfBonds ), _log( log ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookBondParameters::BrookBondParameters";
// ---------------------------------------------------------------------------------------
// allocate memory for particle indices/parameters
int* particleIndicesBlock = new int[numberOfParticlesInBond*numberOfBonds];
double* parametersBlock = new double[numberOfParametersInBond*numberOfBonds];
_particleIndices = new int*[numberOfBonds];
_bondParameters = new double*[numberOfBonds];
for( int ii = 0; ii < numberOfBonds; ii++ ){
_particleIndices[ii] = particleIndicesBlock;
particleIndicesBlock += numberOfParticlesInBond;
_bondParameters[ii] = parametersBlock;
parametersBlock += numberOfParametersInBond;
}
}
/**
* BrookBondParameters destructor
*
*/
BrookBondParameters::~BrookBondParameters( ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookBondParameters::BrookBondParameters";
// ---------------------------------------------------------------------------------------
delete[] _particleIndices[0];
delete[] _particleIndices;
delete[] _bondParameters[0];
delete[] _bondParameters;
}
/**
* Get log file reference
*
* @return log file reference
*
*/
FILE* BrookBondParameters::getLog( void ) const {
return _log;
}
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
int BrookBondParameters::setLog( FILE* log ){
_log = log;
return DefaultReturnValue;
}
/**
* Get number of bonds
*
* @return numberOfBonds
*
*/
int BrookBondParameters::getNumberOfBonds( void ) const {
return _numberOfBonds;
}
/**
* Get number of particles in bond
*
* @return numberOfParticlesInBond
*
*/
int BrookBondParameters::getNumberOfParticlesInBond( void ) const {
return _numberOfParticlesInBond;
}
/**
* Get number of parameters in bond
*
* @return numberOfParametersInBond
*
*/
int BrookBondParameters::getNumberOfParametersInBond( void ) const {
return _numberOfParametersInBond;
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param bondIndex bond index to be set
* @param particleIndices indices of particles (dimension=numberOfParticlesInBond)
* @param bondParameters bond parameters (dimension=numberOfParametersInBond)
*
* @return DefaultReturnValue
*
* @throw OpenMMException exeception if bond index is invalid
*
*/
int BrookBondParameters::setBond( int bondIndex, int* particleIndices, double* bondParameters ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookBondParameters::setBond";
// ---------------------------------------------------------------------------------------
FILE* log = getLog();
// ---------------------------------------------------------------------------------------
// validate bond index
if( bondIndex < 0 ){
std::stringstream message;
message << methodName << "BondIndex=" << bondIndex << " is < 0.";
throw OpenMMException( message.str() );
}
if( bondIndex >= getNumberOfBonds() ){
std::stringstream message;
message << methodName << "BondIndex=" << bondIndex << " is >= " << getNumberOfBonds() << ".";
throw OpenMMException( message.str() );
}
// load'em up
int numberOfParticlesInBond = getNumberOfParticlesInBond();
for( int ii = 0; ii < numberOfParticlesInBond; ii++ ){
_particleIndices[bondIndex][ii] = particleIndices[ii];
}
int numberOfParametersInBond = getNumberOfParametersInBond();
for( int ii = 0; ii < numberOfParametersInBond; ii++ ){
_bondParameters[bondIndex][ii] = bondParameters[ii];
}
// ---------------------------------------------------------------------------------------
return DefaultReturnValue;
}
/*
* Get contents of object
*
* @param tab tab
* @param description description
* @param value value
*
* @return string containing contents
*
* */
std::string BrookBondParameters::_getLine( const std::string& tab,
const std::string& description,
const std::string& value ) const {
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookStreamInternal::_getLine";
static const unsigned int MAX_LINE_CHARS = 256;
char line[MAX_LINE_CHARS];
// ---------------------------------------------------------------------------------------
std::stringstream message;
memset( line, ' ', MAX_LINE_CHARS );
#ifdef WIN32
(void) sprintf_s( line, MAX_LINE_CHARS, "%s %-40s %s", tab.c_str(), description.c_str(), value.c_str() );
#else
(void) sprintf( line, "%s %-40s %s", tab.c_str(), description.c_str(), value.c_str() );
#endif
message << std::string( line ) << std::endl;
return message.str();
}
/*
* Get contents of object
*
*
* @param level level of dump
*
* @return string containing contents
*
* */
std::string BrookBondParameters::getContentsString( int level ) const {
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookBondParameters::getContentsString";
static const unsigned int MAX_LINE_CHARS = 1024;
char value[MAX_LINE_CHARS];
static const char* Set = "Set";
static const char* NotSet = "Not set";
// ---------------------------------------------------------------------------------------
std::stringstream message;
std::string tab = " ";
#ifdef WIN32
#define LOCAL_SPRINTF(a,b,c) sprintf_s( (a), MAX_LINE_CHARS, (b), (c) );
#define LOCAL_2_SPRINTF(a,b,c,d) sprintf_s( (a), MAX_LINE_CHARS, (b), (c), (d) );
#else
#define LOCAL_SPRINTF(a,b,c) sprintf( (a), (b), (c) );
#define LOCAL_2_SPRINTF(a,b,c,d) sprintf( (a), (b), (c), (d) );
#endif
(void) LOCAL_SPRINTF( value, "%s", getBondName() );
message << _getLine( tab, "Bond name:", value );
(void) LOCAL_SPRINTF( value, "%d", getNumberOfBonds() );
message << _getLine( tab, "Number of bonds:", value );
(void) LOCAL_SPRINTF( value, "%d", getNumberOfParticlesInBond() );
message << _getLine( tab, "Particles/bond:", value );
(void) LOCAL_SPRINTF( value, "%d", getNumberOfParametersInBond() );
message << _getLine( tab, "Parameters/bond:", value );
message << "Bonds:" << std::endl;
for( int ii = 0; ii < getNumberOfBonds(); ii++ ){
char description[256];
char buffer[256];
(void) LOCAL_SPRINTF( description, "%6d [", ii );
// particle indices
for( int jj = 0; jj < getNumberOfParticlesInBond(); jj++ ){
(void) LOCAL_SPRINTF( buffer, "%6d ", _particleIndices[ii][jj] );
(void) strcat( description, buffer );
}
(void) strcat( description, "] [" );
// parameters
for( int jj = 0; jj < getNumberOfParametersInBond(); jj++ ){
(void) LOCAL_SPRINTF( buffer, "%18.10e ", _bondParameters[ii][jj] );
(void) strcat( description, buffer );
}
(void) strcat( description, "]" );
message << _getLine( tab, "", description );
}
#undef LOCAL_SPRINTF
#undef LOCAL_2_SPRINTF
return message.str();
}
#ifndef OPENMM_BROOK_CALC_PROPER_DIHEDRAL_FORCE_KERNEL_H_ #ifndef OPENMM_BROOK_BOND_PARAMETERS_H_
#define OPENMM_BROOK_CALC_PROPER_DIHEDRAL_FORCE_KERNEL_H_ #define OPENMM_BROOK_BOND_PARAMETERS_H_
/* -------------------------------------------------------------------------- * /* -------------------------------------------------------------------------- *
* OpenMM * * OpenMM *
...@@ -32,141 +32,166 @@ ...@@ -32,141 +32,166 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "kernels.h"
#include "BrookPlatform.h"
#include "BrookBondParameters.h"
#include "OpenMMBrookInterface.h"
namespace OpenMM { namespace OpenMM {
/** /**
* This kernel is invoked to calculate the harmonic angle forces acting on the system. * Container for bond parameters
*/ */
class BrookBondParameters {
class BrookCalcProperDihedralForceKernel : public CalcProperDihedralForceKernel {
public: public:
/** // return values
* BrookCalcProperDihedralForceKernel constructor
*/
BrookCalcProperDihedralForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system ); static const int DefaultReturnValue = 0;
static const int ErrorReturnValue = -1;
/** BrookBondParameters( std::string bondName, int numberOfParticlesInBond, int numberOfParametersInBond, int numberOfBonds, FILE* log );
* BrookCalcProperDihedralForceKernel destructor
*/
~BrookCalcProperDihedralForceKernel(); ~BrookBondParameters();
/** /**
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy * Set log file reference
* *
* @param system System reference * @param log file reference
* @param force ProperDihedralForce reference *
* @return DefaultReturnValue
* *
*/ */
void initialize( const System& system, const ProperDihedralForce& force ); int setLog( FILE* log );
/*
* Get contents of object
*
* @param level of dump
*
* @return string containing contents
*
* */
std::string getContents( int level ) const;
/** /**
* Execute the kernel to calculate the forces. * Get log file reference
* *
* @param positions atom coordiantes * @return log file reference
* @param forces output forces
* *
*/ */
void executeForces( OpenMMContextImpl& context ); FILE* getLog( void ) const;
/** /**
* Execute the kernel to calculate the energy. * Set bond info
* *
* @param context the context in which to execute this kernel * @param bondIndex index of bond
* @param particleIndices array of particle indices
* @param bondParameters array of bond parameters
* *
* @return potential energy associated with the harmonic angle force * @return DefaultReturnValue
*
* @throw OpenMMException exeception if bond index is invalid
* *
*/ */
double executeEnergy( OpenMMContextImpl& context ); int setBond( int bondIndex, int* particleIndices, double* bondParameters );
/** /**
* Set log file reference * Get bond name
*
* @param log file reference
* *
* @return DefaultReturnValue * @return bond name
* *
*/ */
int setLog( FILE* log ); std::string getBondName( void ) const;
/* /**
* Get contents of object * Set bond name
* *
* @param level of dump * @param bondName bond name
* *
* @return string containing contents * @return DefaultReturnValue
* *
* */ */
std::string getContents( int level ) const; //int setBondName( std::string bondName );
/** /**
* Get log file reference * Get NumberOfParticlesInBond
* *
* @return log file reference * @return NumberOfParticlesInBond
* *
*/ */
FILE* getLog( void ) const; int getNumberOfParticlesInBond( void ) const;
/** /**
* Get number of bonds * Get NumberOfParametersInBond
* *
* @return number of bonds * @return NumberOfParametersInBond
* *
*/ */
int getNumberOfBonds( void ) const; int getNumberOfParametersInBond( void ) const;
/** /**
* Get indices/parameters * Get NumberOfBonds
* *
* @return BrookBondParameters containing atom indices/parameters * @return NumberOfBonds
* *
*/ */
BrookBondParameters* getBrookBondParameters( void ) const; int getNumberOfBonds( void ) const;
private:
static const int NumberOfAtomsInBond = 3; /*
static const int NumberOfParametersInBond = 2; * Get contents of object
*
*
* @param level level of dump
*
* @return string containing contents
*
* */
// bond name std::string getContentsString( int level = 0 ) const;
static const std::string BondName; private:
// log file reference // log file reference
FILE* _log; FILE* _log;
// bond name
std::string _bondName;
// Brook bond parameters // number of bonds
BrookBondParameters* _brookBondParameters; int _numberOfBonds;
int _numberOfParticlesInBond;
int _numberOfParametersInBond;
// interface // particle indices and parameters
OpenMMBrookInterface& _openMMBrookInterface; int** _particleIndices;
double** _bondParameters;
// System reference /*
* Get contents of object
*
* @param tab tab
* @param description description
* @param value value
*
* @return string containing contents
*
* */
System& _system; std::string _getLine( const std::string& tab, const std::string& description,
const std::string& value ) const;
}; };
} // namespace OpenMM } // namespace OpenMM
#endif /* OPENMM_BROOK_CALC_PROPER_DIHEDRAL_FORCE_KERNEL_H_ */ #endif /* OPENMM_BROOK_BOND_PARAMETERS_H_ */
This diff is collapsed.
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
#include <vector> #include <vector>
#include "BrookFloatStreamInternal.h" #include "BrookStreamImpl.h"
#include "BrookIntStreamInternal.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "BrookCommon.h" #include "BrookCommon.h"
#include "OpenMMContext.h" #include "OpenMMContext.h"
...@@ -68,17 +67,17 @@ class BrookBonded : public BrookCommon { ...@@ -68,17 +67,17 @@ class BrookBonded : public BrookCommon {
/** /**
* Initialize the kernel, setting up the values of all the force field parameters. * Initialize the kernel, setting up the values of all the force field parameters.
* *
* @param bondIndices the two atoms connected by each bond term * @param bondIndices the two particles connected by each bond term
* @param bondParameters the force parameters (length, k) for each bond term * @param bondParameters the force parameters (length, k) for each bond term
* @param angleIndices the three atoms connected by each angle term * @param angleIndices the three particles connected by each angle term
* @param angleParameters the force parameters (angle, k) for each angle term * @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term * @param periodicTorsionIndices the four particles connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term * @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term * @param rbTorsionIndices the four particles connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term * @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since * @param bonded14Indices each element contains the indices of two particles whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair * they form a bonded 1-4 pair
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each atom * @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each particle
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs * @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs * @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs
* @param log log reference * @param log log reference
...@@ -87,7 +86,7 @@ class BrookBonded : public BrookCommon { ...@@ -87,7 +86,7 @@ class BrookBonded : public BrookCommon {
* *
*/ */
int setup( int numberOfAtoms, int setup( int numberOfParticles,
const std::vector<std::vector<int> >& bondIndices, const std::vector<std::vector<double> >& bondParameters, const std::vector<std::vector<int> >& bondIndices, const std::vector<std::vector<double> >& bondParameters,
const std::vector<std::vector<int> >& angleIndices, const std::vector<std::vector<double> >& angleParameters, const std::vector<std::vector<int> >& angleIndices, const std::vector<std::vector<double> >& angleParameters,
const std::vector<std::vector<int> >& periodicTorsionIndices, const std::vector<std::vector<double> >& periodicTorsionParameters, const std::vector<std::vector<int> >& periodicTorsionIndices, const std::vector<std::vector<double> >& periodicTorsionParameters,
...@@ -157,7 +156,7 @@ class BrookBonded : public BrookCommon { ...@@ -157,7 +156,7 @@ class BrookBonded : public BrookCommon {
* @return * @return
*/ */
BrookFloatStreamInternal* getBrookAtomIndices( void ) const; BrookFloatStreamInternal* getBrookParticleIndices( void ) const;
/** /**
* Get LJ 14 scale factor * Get LJ 14 scale factor
...@@ -178,13 +177,13 @@ class BrookBonded : public BrookCommon { ...@@ -178,13 +177,13 @@ class BrookBonded : public BrookCommon {
BrookOpenMMFloat getCoulombFactor( void ) const; BrookOpenMMFloat getCoulombFactor( void ) const;
/** /**
* Get bonded atom indices stream * Get bonded particle indices stream
* *
* @return atom indices stream * @return particle indices stream
* *
*/ */
BrookFloatStreamInternal* getAtomIndicesStream( void ) const; BrookFloatStreamInternal* getParticleIndicesStream( void ) const;
/** /**
* Get bonded charge stream * Get bonded charge stream
...@@ -268,6 +267,14 @@ class BrookBonded : public BrookCommon { ...@@ -268,6 +267,14 @@ class BrookBonded : public BrookCommon {
std::string getContentsString( int level = 0 ) const; std::string getContentsString( int level = 0 ) const;
/**
* Compute forces
*
*/
void computeForces( BrookStreamImpl& positionStream, BrookStreamImpl& forceStream );
private: private:
static const int NumberOfParameterStreams = 5; static const int NumberOfParameterStreams = 5;
...@@ -291,7 +298,7 @@ class BrookBonded : public BrookCommon { ...@@ -291,7 +298,7 @@ class BrookBonded : public BrookCommon {
// streams // streams
BrookFloatStreamInternal* _atomIndicesStream; BrookFloatStreamInternal* _particleIndicesStream;
BrookFloatStreamInternal* _bondedParameters[NumberOfParameterStreams]; BrookFloatStreamInternal* _bondedParameters[NumberOfParameterStreams];
BrookFloatStreamInternal* _bondedForceStreams[NumberOfForceStreams]; BrookFloatStreamInternal* _bondedForceStreams[NumberOfForceStreams];
BrookFloatStreamInternal* _chargeStream; BrookFloatStreamInternal* _chargeStream;
...@@ -302,93 +309,93 @@ class BrookBonded : public BrookCommon { ...@@ -302,93 +309,93 @@ class BrookBonded : public BrookCommon {
// helper methods in setup of parameters // helper methods in setup of parameters
void flipQuartet( int ibonded, int *atoms ); void flipQuartet( int ibonded, int *particles );
int matchTorsion( int i, int j, int k, int l, int nbondeds, int *atoms ); int matchTorsion( int i, int j, int k, int l, int nbondeds, int *particles );
int matchAngle( int i, int j, int k, int nbondeds, int *atoms, int *flag ); int matchAngle( int i, int j, int k, int nbondeds, int *particles, int *flag );
int matchBond( int i, int j, int nbondeds, int *atoms, int *flag ); int matchBond( int i, int j, int nbondeds, int *particles, int *flag );
int matchPair( int i, int j, int nbondeds, int *atoms ); int matchPair( int i, int j, int nbondeds, int *particles );
/** /**
* Setup Ryckaert-Bellemans parameters/atom indices * Setup Ryckaert-Bellemans parameters/particle indices
* *
* @param nbondeds number of bonded entries * @param nbondeds number of bonded entries
* @param atoms array of atom indices * @param particles array of particle indices
* @param params arrays of bond parameters * @param params arrays of bond parameters
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term * @param rbTorsionIndices the four particles connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term * @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* *
* @return nonzero value if error * @return nonzero value if error
* *
*/ */
int addRBDihedrals( int *nbondeds, int *atoms, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& rbTorsionIndices, int addRBDihedrals( int *nbondeds, int *particles, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& rbTorsionIndices,
const std::vector<std::vector<double> >& rbTorsionParameters ); const std::vector<std::vector<double> >& rbTorsionParameters );
/** /**
* Setup periodic torsion parameters/atom indices * Setup periodic torsion parameters/particle indices
* *
* @param nbondeds number of bonded entries * @param nbondeds number of bonded entries
* @param atoms array of atom indices * @param particles array of particle indices
* @param params arrays of bond parameters * @param params arrays of bond parameters
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term * @param periodicTorsionIndices the four particles connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term * @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
* *
* @return nonzero value if error * @return nonzero value if error
* *
*/ */
int addPDihedrals( int *nbondeds, int *atoms, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& periodicTorsionIndices, int addPDihedrals( int *nbondeds, int *particles, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& periodicTorsionIndices,
const std::vector<std::vector<double> >& periodicTorsionParameters ); const std::vector<std::vector<double> >& periodicTorsionParameters );
/** /**
* Setup angle bond parameters/atom indices * Setup angle bond parameters/particle indices
* *
* @param nbondeds number of bonded entries * @param nbondeds number of bonded entries
* @param atoms array of atom indices * @param particles array of particle indices
* @param params arrays of bond parameters * @param params arrays of bond parameters
* @param angleIndices the angle bond atom indices * @param angleIndices the angle bond particle indices
* @param angleParameters the angle parameters (angle in radians, force constant) * @param angleParameters the angle parameters (angle in radians, force constant)
* *
* @return nonzero value if error * @return nonzero value if error
* *
*/ */
int addAngles( int *nbondeds, int *atoms, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& angleIndices, int addAngles( int *nbondeds, int *particles, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& angleIndices,
const std::vector<std::vector<double> >& angleParameters ); const std::vector<std::vector<double> >& angleParameters );
/** /**
* Setup harmonic bond parameters/atom indices * Setup harmonic bond parameters/particle indices
* *
* @param nbondeds number of bonded entries * @param nbondeds number of bonded entries
* @param atoms array of atom indices * @param particles array of particle indices
* @param params arrays of bond parameters * @param params arrays of bond parameters
* @param bondIndices two harmonic bond atom indices * @param bondIndices two harmonic bond particle indices
* @param bondParameters the force parameters (distance, k) * @param bondParameters the force parameters (distance, k)
* *
* @return nonzero value if error * @return nonzero value if error
* *
*/ */
int addBonds( int *nbondeds, int *atoms, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& bondIndices, int addBonds( int *nbondeds, int *particles, BrookOpenMMFloat* params[], const std::vector<std::vector<int> >& bondIndices,
const std::vector<std::vector<double> >& bondParameters ); const std::vector<std::vector<double> >& bondParameters );
/** /**
* Setup LJ/Coulomb 1-4 parameters/atom indices * Setup LJ/Coulomb 1-4 parameters/particle indices
* *
* @param nbondeds number of bonded entries * @param nbondeds number of bonded entries
* @param atoms array of atom indices * @param particles array of particle indices
* @param params arrays of bond parameters * @param params arrays of bond parameters
* @param charges array of charges * @param charges array of charges
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since * @param bonded14Indices each element contains the indices of two particles whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair * they form a bonded 1-4 pair
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each atom * @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each particle
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs * @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* *
* @return nonzero value if error * @return nonzero value if error
* *
*/ */
int addPairs( int *nbondeds, int *atoms, BrookOpenMMFloat* params[], BrookOpenMMFloat* charges, int addPairs( int *nbondeds, int *particles, BrookOpenMMFloat* params[], BrookOpenMMFloat* charges,
const std::vector<std::vector<int> >& bonded14Indices, const std::vector<std::vector<double> >& nonbondedParameters, const std::vector<std::vector<int> >& bonded14Indices, const std::vector<std::vector<double> >& nonbondedParameters,
double lj14Scale, double coulombScale ); double lj14Scale, double coulombScale );
...@@ -396,8 +403,8 @@ class BrookBonded : public BrookCommon { ...@@ -396,8 +403,8 @@ class BrookBonded : public BrookCommon {
* Create and load inverse maps for bonded ixns * Create and load inverse maps for bonded ixns
* *
* @param nbondeds number of bonded entries * @param nbondeds number of bonded entries
* @param natoms number of atoms * @param nparticles number of particles
* @param atoms arrays of atom indices (atoms[numberOfBonds][4]) * @param particles arrays of particle indices (particles[numberOfBonds][4])
* @param platform BrookPlatform reference * @param platform BrookPlatform reference
* @param log log file reference (optional) * @param log log file reference (optional)
* *
...@@ -405,7 +412,7 @@ class BrookBonded : public BrookCommon { ...@@ -405,7 +412,7 @@ class BrookBonded : public BrookCommon {
* *
*/ */
int loadInvMaps( int nbondeds, int natoms, int *atoms, const BrookPlatform& platform ); int loadInvMaps( int nbondeds, int nparticles, int *particles, const BrookPlatform& platform );
/** /**
* Validate inverse map count * Validate inverse map count
...@@ -425,23 +432,23 @@ class BrookBonded : public BrookCommon { ...@@ -425,23 +432,23 @@ class BrookBonded : public BrookCommon {
* Helper functions for building inverse maps for * Helper functions for building inverse maps for
* torsions, impropers and angles. * torsions, impropers and angles.
* *
* For each atom, calculates the positions at which it's * For each particle, calculates the positions at which it's
* forces are to be picked up from and stores the position * forces are to be picked up from and stores the position
* in the appropriate index. * in the appropriate index.
* *
* Input: number of dihedrals, the atom indices, and a flag indicating * Input: number of dihedrals, the particle indices, and a flag indicating
* whether we're doing i(0), j(1), k(2) or l(3) * whether we're doing i(0), j(1), k(2) or l(3)
* Output: an array of counts per atom * Output: an array of counts per particle
* arrays of inversemaps * arrays of inversemaps
* nimaps - the number of invmaps actually used. * nimaps - the number of invmaps actually used.
* *
* @param posflag 0-niatoms-1 * @param posflag 0-niparticles-1
* @param niatoms 3 for angles, 4 for torsions, impropers * @param niparticles 3 for angles, 4 for torsions, impropers
* @param nints number of interactions * @param nints number of interactions
* @param natoms number of atoms * @param nparticles number of particles
* @param *atoms gromacs interaction list * @param *particles gromacs interaction list
* @param nmaps maximum number of inverse maps * @param nmaps maximum number of inverse maps
* @param counts[] output counts of how many places each atom occurs * @param counts[] output counts of how many places each particle occurs
* @param *invmaps[] output array of nmaps inverse maps * @param *invmaps[] output array of nmaps inverse maps
* @param *nimaps, output max number of inverse maps actually used * @param *nimaps, output max number of inverse maps actually used
* *
...@@ -449,11 +456,11 @@ class BrookBonded : public BrookCommon { ...@@ -449,11 +456,11 @@ class BrookBonded : public BrookCommon {
* *
**/ **/
int gpuCalcInvMap( int posflag, int niatoms, int nints, int natoms, int gpuCalcInvMap( int posflag, int niparticles, int nints, int nparticles,
int *atoms, int nmaps, int counts[], float4 *invmaps[], int *particles, int nmaps, int counts[], float4 *invmaps[],
int *nimaps ); int *nimaps );
void gpuPrintInvMaps( int nmaps, int natoms, int counts[], float4 *invmap[], FILE* logFile ); void gpuPrintInvMaps( int nmaps, int nparticles, int counts[], float4 *invmap[], FILE* logFile );
/* We are still plagued by kernel call overheads. This is for a big fat /* We are still plagued by kernel call overheads. This is for a big fat
* merged inverse gather kernel: * merged inverse gather kernel:
...@@ -463,14 +470,14 @@ class BrookBonded : public BrookCommon { ...@@ -463,14 +470,14 @@ class BrookBonded : public BrookCommon {
* lookup. This assumes that nints < 100000, preferably nints << 100000 * lookup. This assumes that nints < 100000, preferably nints << 100000
* which should always be true * which should always be true
* */ * */
int gpuCalcInvMap_merged( int nints, int natoms, int *atoms, int nmaps, int counts[], float4 *invmaps[], int *nimaps ); int gpuCalcInvMap_merged( int nints, int nparticles, int *particles, int nmaps, int counts[], float4 *invmaps[], int *nimaps );
/* Repacks the invmap streams for more efficient access in the /* Repacks the invmap streams for more efficient access in the
* merged inverse gather kernel * merged inverse gather kernel
* *
* buf should be nimaps * natoms large. * buf should be nimaps * nparticles large.
* */ * */
int gpuRepackInvMap_merged( int natoms, int nmaps, int *counts, float4 *invmaps[], float4 *buf ); int gpuRepackInvMap_merged( int nparticles, int nmaps, int *counts, float4 *invmaps[], float4 *buf );
}; };
......
...@@ -64,13 +64,13 @@ BrookBrownianDynamics::BrookBrownianDynamics( ){ ...@@ -64,13 +64,13 @@ BrookBrownianDynamics::BrookBrownianDynamics( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
_numberOfAtoms = -1; _numberOfParticles = -1;
// mark stream dimension variables as unset // mark stream dimension variables as unset
_bdAtomStreamWidth = -1; _bdParticleStreamWidth = -1;
_bdAtomStreamHeight = -1; _bdParticleStreamHeight = -1;
_bdAtomStreamSize = -1; _bdParticleStreamSize = -1;
for( int ii = 0; ii < LastStreamIndex; ii++ ){ for( int ii = 0; ii < LastStreamIndex; ii++ ){
_streams[ii] = NULL; _streams[ii] = NULL;
...@@ -376,9 +376,9 @@ int BrookBrownianDynamics::updateParameters( double temperature, double friction ...@@ -376,9 +376,9 @@ int BrookBrownianDynamics::updateParameters( double temperature, double friction
/** /**
* Update * Update
* *
* @param positions atom positions * @param positions particle positions
* @param velocities atom velocities * @param velocities particle velocities
* @param forces atom forces * @param forces particle forces
* @param brookShakeAlgorithm BrookShakeAlgorithm reference * @param brookShakeAlgorithm BrookShakeAlgorithm reference
* @param brookRandomNumberGenerator BrookRandomNumberGenerator reference * @param brookRandomNumberGenerator BrookRandomNumberGenerator reference
* *
...@@ -413,7 +413,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities, ...@@ -413,7 +413,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
static int showAux = 1; static int showAux = 1;
if( PrintOn ){ if( showAux ){
(void) fprintf( getLog(), "%s shake=%d\n", methodName, brookShakeAlgorithm.getNumberOfConstraints() ); (void) fprintf( getLog(), "%s shake=%d\n", methodName, brookShakeAlgorithm.getNumberOfConstraints() );
(void) fflush( getLog() ); (void) fflush( getLog() );
} }
...@@ -434,10 +434,51 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities, ...@@ -434,10 +434,51 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
} }
} }
// diagnostics
if( (1 || PrintOn) ){
(void) fprintf( getLog(), "\nPre kintegrate_bd: %d rngStrW=%3d rngOff=%5d "
"ForceScale=%12.5e NoiseAmplitude=%12.5e\n",
getBrownianDynamicsParticleStreamWidth(),
brookRandomNumberGenerator.getRandomNumberStreamWidth(),
brookRandomNumberGenerator.getRvStreamOffset(),
getForceScale(), getNoiseAmplitude() );
// (void) fprintf( getLog(), "\nInverseMassStream\n" );
//getInverseMassStream()->printToFile( getLog() );
//StreamImpl& positionStreamImpl = positionStream.getImpl();
//const BrookStreamImpl brookPositions = dynamic_cast<BrookStreamImpl&> (positionStreamImpl);
/*
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
*/
double forceSum[3];
BrookStreamInternal* brookStreamInternalFF = forceStream.getBrookStreamImpl();
BrookFloatStreamInternal* brookStreamInternalF = dynamic_cast<BrookFloatStreamInternal*> (brookStreamInternalFF);
brookStreamInternalF->sumByDimension( getNumberOfParticles(), forceSum );
(void) fprintf( getLog(), "\nForceStream [%18.10e %18.10e %18.10e]\n", forceSum[0], forceSum[1], forceSum[2] );
brookStreamInternalF->printToFile( getLog() );
/*
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nRvStreamIndex=%d\n", brookRandomNumberGenerator.getRvStreamIndex() );
*/
// brookRandomNumberGenerator.getRandomNumberStream( brookRandomNumberGenerator.getRvStreamIndex() )->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalVel = velocityStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nVelocityStream\n" );
brookStreamInternalVel->printToFile( getLog() );
}
// integration step -- deltas returned in XPrime // integration step -- deltas returned in XPrime
kintegrate_bd( kintegrate_bd(
(float) getBrownianDynamicsAtomStreamWidth(), (float) getBrownianDynamicsParticleStreamWidth(),
(float) brookRandomNumberGenerator.getRandomNumberStreamWidth(), (float) brookRandomNumberGenerator.getRandomNumberStreamWidth(),
(float) brookRandomNumberGenerator.getRvStreamOffset(), (float) brookRandomNumberGenerator.getRvStreamOffset(),
getForceScale(), getNoiseAmplitude(), getForceScale(), getNoiseAmplitude(),
...@@ -450,7 +491,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities, ...@@ -450,7 +491,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
if( PrintOn ){ if( PrintOn ){
(void) fprintf( getLog(), "\nPost kintegrate_bd: %d rngStrW=%3d rngOff=%5d " (void) fprintf( getLog(), "\nPost kintegrate_bd: %d rngStrW=%3d rngOff=%5d "
"ForceScale=%12.5e NoiseAmplitude=%12.5e\n", "ForceScale=%12.5e NoiseAmplitude=%12.5e\n",
getBrownianDynamicsAtomStreamWidth(), getBrownianDynamicsParticleStreamWidth(),
brookRandomNumberGenerator.getRandomNumberStreamWidth(), brookRandomNumberGenerator.getRandomNumberStreamWidth(),
brookRandomNumberGenerator.getRvStreamOffset(), brookRandomNumberGenerator.getRvStreamOffset(),
getForceScale(), getNoiseAmplitude() ); getForceScale(), getNoiseAmplitude() );
...@@ -477,20 +518,20 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities, ...@@ -477,20 +518,20 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
// advance random number cursor // advance random number cursor
brookRandomNumberGenerator.advanceGVCursor( getNumberOfAtoms() ); brookRandomNumberGenerator.advanceGVCursor( getNumberOfParticles() );
// Shake // Shake
if( brookShakeAlgorithm.getNumberOfConstraints() > 0 ){ if( brookShakeAlgorithm.getNumberOfConstraints() > 0 ){
kshakeh_fix1( kshakeh_fix1(
10.0f, 10.0f,
(float) getBrownianDynamicsAtomStreamWidth(), (float) getBrownianDynamicsParticleStreamWidth(),
brookShakeAlgorithm.getInverseHydrogenMass(), brookShakeAlgorithm.getInverseHydrogenMass(),
omega, omega,
brookShakeAlgorithm.getShakeAtomIndicesStream()->getBrookStream(), brookShakeAlgorithm.getShakeParticleIndicesStream()->getBrookStream(),
positionStream.getBrookStream(), positionStream.getBrookStream(),
getXPrimeStream()->getBrookStream(), getXPrimeStream()->getBrookStream(),
brookShakeAlgorithm.getShakeAtomParameterStream()->getBrookStream(), brookShakeAlgorithm.getShakeParticleParameterStream()->getBrookStream(),
brookShakeAlgorithm.getShakeXCons0Stream()->getBrookStream(), brookShakeAlgorithm.getShakeXCons0Stream()->getBrookStream(),
brookShakeAlgorithm.getShakeXCons1Stream()->getBrookStream(), brookShakeAlgorithm.getShakeXCons1Stream()->getBrookStream(),
brookShakeAlgorithm.getShakeXCons2Stream()->getBrookStream(), brookShakeAlgorithm.getShakeXCons2Stream()->getBrookStream(),
...@@ -499,7 +540,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities, ...@@ -499,7 +540,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
// second Shake gather // second Shake gather
kshakeh_update2_fix1( kshakeh_update2_fix1(
(float) getBrownianDynamicsAtomStreamWidth(), (float) getBrownianDynamicsParticleStreamWidth(),
brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(), brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(),
positionStream.getBrookStream(), positionStream.getBrookStream(),
getXPrimeStream()->getBrookStream(), getXPrimeStream()->getBrookStream(),
...@@ -539,7 +580,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities, ...@@ -539,7 +580,7 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
// diagnostics // diagnostics
if( PrintOn ){ if( (1 || PrintOn) ){
(void) fprintf( getLog(), "\nPost kupdate_bd2: velocityScale=%12.5e\n", velocityScale ); (void) fprintf( getLog(), "\nPost kupdate_bd2: velocityScale=%12.5e\n", velocityScale );
...@@ -563,35 +604,35 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities, ...@@ -563,35 +604,35 @@ int BrookBrownianDynamics::update( Stream& positions, Stream& velocities,
}; };
/** /**
* Get Atom stream size * Get Particle stream size
* *
* @return Atom stream size * @return Particle stream size
* *
*/ */
int BrookBrownianDynamics::getBrownianDynamicsAtomStreamSize( void ) const { int BrookBrownianDynamics::getBrownianDynamicsParticleStreamSize( void ) const {
return _bdAtomStreamSize; return _bdParticleStreamSize;
} }
/** /**
* Get atom stream width * Get particle stream width
* *
* @return atom stream width * @return particle stream width
* *
*/ */
int BrookBrownianDynamics::getBrownianDynamicsAtomStreamWidth( void ) const { int BrookBrownianDynamics::getBrownianDynamicsParticleStreamWidth( void ) const {
return _bdAtomStreamWidth; return _bdParticleStreamWidth;
} }
/** /**
* Get atom stream height * Get particle stream height
* *
* @return atom stream height * @return particle stream height
*/ */
int BrookBrownianDynamics::getBrownianDynamicsAtomStreamHeight( void ) const { int BrookBrownianDynamics::getBrownianDynamicsParticleStreamHeight( void ) const {
return _bdAtomStreamHeight; return _bdParticleStreamHeight;
} }
/** /**
...@@ -619,14 +660,14 @@ BrookFloatStreamInternal* BrookBrownianDynamics::getInverseMassStream( void ) co ...@@ -619,14 +660,14 @@ BrookFloatStreamInternal* BrookBrownianDynamics::getInverseMassStream( void ) co
/** /**
* Initialize stream dimensions * Initialize stream dimensions
* *
* @param numberOfAtoms number of atoms * @param numberOfParticles number of particles
* @param platform platform * @param platform platform
* *
* @return ErrorReturnValue if error, else DefaultReturnValue * @return ErrorReturnValue if error, else DefaultReturnValue
* *
*/ */
int BrookBrownianDynamics::_initializeStreamSizes( int numberOfAtoms, const Platform& platform ){ int BrookBrownianDynamics::_initializeStreamSizes( int numberOfParticles, const Platform& platform ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -634,9 +675,9 @@ int BrookBrownianDynamics::_initializeStreamSizes( int numberOfAtoms, const Plat ...@@ -634,9 +675,9 @@ int BrookBrownianDynamics::_initializeStreamSizes( int numberOfAtoms, const Plat
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
_bdAtomStreamSize = getAtomStreamSize( platform ); _bdParticleStreamSize = getParticleStreamSize( platform );
_bdAtomStreamWidth = getAtomStreamWidth( platform ); _bdParticleStreamWidth = getParticleStreamWidth( platform );
_bdAtomStreamHeight = getAtomStreamHeight( platform ); _bdParticleStreamHeight = getParticleStreamHeight( platform );
return DefaultReturnValue; return DefaultReturnValue;
} }
...@@ -660,19 +701,19 @@ int BrookBrownianDynamics::_initializeStreams( const Platform& platform ){ ...@@ -660,19 +701,19 @@ int BrookBrownianDynamics::_initializeStreams( const Platform& platform ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
int sdAtomStreamSize = getBrownianDynamicsAtomStreamSize(); int sdParticleStreamSize = getBrownianDynamicsParticleStreamSize();
int sdAtomStreamWidth = getBrownianDynamicsAtomStreamWidth(); int sdParticleStreamWidth = getBrownianDynamicsParticleStreamWidth();
_streams[VPrimeStream] = new BrookFloatStreamInternal( BrookCommon::VPrimeStream, _streams[VPrimeStream] = new BrookFloatStreamInternal( BrookCommon::VPrimeStream,
sdAtomStreamSize, sdAtomStreamWidth, sdParticleStreamSize, sdParticleStreamWidth,
BrookStreamInternal::Float3, dangleValue ); BrookStreamInternal::Float3, dangleValue );
_streams[XPrimeStream] = new BrookFloatStreamInternal( BrookCommon::XPrimeStream, _streams[XPrimeStream] = new BrookFloatStreamInternal( BrookCommon::XPrimeStream,
sdAtomStreamSize, sdAtomStreamWidth, sdParticleStreamSize, sdParticleStreamWidth,
BrookStreamInternal::Float3, dangleValue ); BrookStreamInternal::Float3, dangleValue );
_streams[InverseMassStream] = new BrookFloatStreamInternal( BrookCommon::InverseMassStream, _streams[InverseMassStream] = new BrookFloatStreamInternal( BrookCommon::InverseMassStream,
sdAtomStreamSize, sdAtomStreamWidth, sdParticleStreamSize, sdParticleStreamWidth,
BrookStreamInternal::Float, dangleValue ); BrookStreamInternal::Float, dangleValue );
return DefaultReturnValue; return DefaultReturnValue;
...@@ -693,7 +734,7 @@ int BrookBrownianDynamics::_updateStreams( void ){ ...@@ -693,7 +734,7 @@ int BrookBrownianDynamics::_updateStreams( void ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//int atomStreamSize = getBrownianDynamicsAtomStreamSize(); //int particleStreamSize = getBrownianDynamicsParticleStreamSize();
return DefaultReturnValue; return DefaultReturnValue;
...@@ -702,7 +743,7 @@ int BrookBrownianDynamics::_updateStreams( void ){ ...@@ -702,7 +743,7 @@ int BrookBrownianDynamics::_updateStreams( void ){
/** /**
* Set masses * Set masses
* *
* @param masses atomic masses * @param masses particle masses
* *
*/ */
...@@ -754,12 +795,12 @@ int BrookBrownianDynamics::setup( const std::vector<double>& masses, const Platf ...@@ -754,12 +795,12 @@ int BrookBrownianDynamics::setup( const std::vector<double>& masses, const Platf
const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform); const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform);
setLog( brookPlatform.getLog() ); setLog( brookPlatform.getLog() );
int numberOfAtoms = (int) masses.size(); int numberOfParticles = (int) masses.size();
setNumberOfAtoms( numberOfAtoms ); setNumberOfParticles( numberOfParticles );
// set stream sizes and then create streams // set stream sizes and then create streams
_initializeStreamSizes( numberOfAtoms, platform ); _initializeStreamSizes( numberOfParticles, platform );
_initializeStreams( platform ); _initializeStreams( platform );
_setInverseSqrtMasses( masses ); _setInverseSqrtMasses( masses );
...@@ -798,17 +839,17 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const { ...@@ -798,17 +839,17 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const {
#define LOCAL_SPRINTF(a,b,c) sprintf( (a), (b), (c) ); #define LOCAL_SPRINTF(a,b,c) sprintf( (a), (b), (c) );
#endif #endif
(void) LOCAL_SPRINTF( value, "%d", getNumberOfAtoms() ); (void) LOCAL_SPRINTF( value, "%d", getNumberOfParticles() );
message << _getLine( tab, "Number of atoms:", value ); message << _getLine( tab, "Number of particles:", value );
(void) LOCAL_SPRINTF( value, "%d", getAtomStreamWidth() ); (void) LOCAL_SPRINTF( value, "%d", getParticleStreamWidth() );
message << _getLine( tab, "Atom stream width:", value ); message << _getLine( tab, "Particle stream width:", value );
(void) LOCAL_SPRINTF( value, "%d", getAtomStreamHeight() ); (void) LOCAL_SPRINTF( value, "%d", getParticleStreamHeight() );
message << _getLine( tab, "Atom stream height:", value ); message << _getLine( tab, "Particle stream height:", value );
(void) LOCAL_SPRINTF( value, "%d", getAtomStreamSize() ); (void) LOCAL_SPRINTF( value, "%d", getParticleStreamSize() );
message << _getLine( tab, "Atom stream size:", value ); message << _getLine( tab, "Particle stream size:", value );
(void) LOCAL_SPRINTF( value, "%.5f", getTau() ); (void) LOCAL_SPRINTF( value, "%.5f", getTau() );
message << _getLine( tab, "Tau:", value ); message << _getLine( tab, "Tau:", value );
...@@ -819,10 +860,10 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const { ...@@ -819,10 +860,10 @@ std::string BrookBrownianDynamics::getContentsString( int level ) const {
(void) LOCAL_SPRINTF( value, "%.5f", getStepSize() ); (void) LOCAL_SPRINTF( value, "%.5f", getStepSize() );
message << _getLine( tab, "Step size:", value ); message << _getLine( tab, "Step size:", value );
(void) LOCAL_SPRINTF( value, "%.5f", getForceScale() ); (void) LOCAL_SPRINTF( value, "%.5e", getForceScale() );
message << _getLine( tab, "Force scale:", value ); message << _getLine( tab, "Force scale:", value );
(void) LOCAL_SPRINTF( value, "%.5f", getNoiseAmplitude() ); (void) LOCAL_SPRINTF( value, "%.5e", getNoiseAmplitude() );
message << _getLine( tab, "Noise amplitude:", value ); message << _getLine( tab, "Noise amplitude:", value );
(void) LOCAL_SPRINTF( value, "%.5f", getTemperature() ); (void) LOCAL_SPRINTF( value, "%.5f", getTemperature() );
......
...@@ -116,28 +116,28 @@ class BrookBrownianDynamics : public BrookCommon { ...@@ -116,28 +116,28 @@ class BrookBrownianDynamics : public BrookCommon {
BrookOpenMMFloat getForceScale( void ) const; BrookOpenMMFloat getForceScale( void ) const;
/** /**
* Get BrownianDynamics atom stream width * Get BrownianDynamics particle stream width
* *
* @return atom stream width * @return particle stream width
*/ */
int getBrownianDynamicsAtomStreamWidth( void ) const; int getBrownianDynamicsParticleStreamWidth( void ) const;
/** /**
* Get BrownianDynamics atom stream height * Get BrownianDynamics particle stream height
* *
* @return atom stream height * @return particle stream height
*/ */
int getBrownianDynamicsAtomStreamHeight( void ) const; int getBrownianDynamicsParticleStreamHeight( void ) const;
/** /**
* Get BrownianDynamics atom stream size * Get BrownianDynamics particle stream size
* *
* @return atom stream size * @return particle stream size
*/ */
int getBrownianDynamicsAtomStreamSize( void ) const; int getBrownianDynamicsParticleStreamSize( void ) const;
/** /**
* Update parameters * Update parameters
...@@ -155,9 +155,9 @@ class BrookBrownianDynamics : public BrookCommon { ...@@ -155,9 +155,9 @@ class BrookBrownianDynamics : public BrookCommon {
/** /**
* Update * Update
* *
* @param positions atom positions * @param positions particle positions
* @param velocities atom velocities * @param velocities particle velocities
* @param forces atom forces * @param forces particle forces
* @param brookShakeAlgorithm BrookShakeAlgorithm reference * @param brookShakeAlgorithm BrookShakeAlgorithm reference
* @param brookRandomNumberGenerator BrookRandomNumberGenerator reference * @param brookRandomNumberGenerator BrookRandomNumberGenerator reference
* *
...@@ -181,7 +181,7 @@ class BrookBrownianDynamics : public BrookCommon { ...@@ -181,7 +181,7 @@ class BrookBrownianDynamics : public BrookCommon {
/* /*
* Setup of BrownianDynamics parameters * Setup of BrownianDynamics parameters
* *
* @param masses atom masses * @param masses particle masses
* @param platform Brook platform * @param platform Brook platform
* *
* @return ErrorReturnValue value if error, else DefaultReturnValue * @return ErrorReturnValue value if error, else DefaultReturnValue
...@@ -240,11 +240,11 @@ class BrookBrownianDynamics : public BrookCommon { ...@@ -240,11 +240,11 @@ class BrookBrownianDynamics : public BrookCommon {
BrookOpenMMFloat _forceScale; BrookOpenMMFloat _forceScale;
BrookOpenMMFloat _noiseAmplitude; BrookOpenMMFloat _noiseAmplitude;
// Atom stream dimensions // Particle stream dimensions
int _bdAtomStreamWidth; int _bdParticleStreamWidth;
int _bdAtomStreamHeight; int _bdParticleStreamHeight;
int _bdAtomStreamSize; int _bdParticleStreamSize;
/* /*
* Update streams * Update streams
...@@ -328,26 +328,26 @@ class BrookBrownianDynamics : public BrookCommon { ...@@ -328,26 +328,26 @@ class BrookBrownianDynamics : public BrookCommon {
/* /*
* Setup of stream dimensions * Setup of stream dimensions
* *
* @param atomStreamSize atom stream size * @param particleStreamSize particle stream size
* @param atomStreamWidth atom stream width * @param particleStreamWidth particle stream width
* *
* @return ErrorReturnValue if error, else DefaultReturnValue * @return ErrorReturnValue if error, else DefaultReturnValue
* *
* */ * */
int _initializeStreamSizes( int atomStreamSize, int atomStreamWidth ); int _initializeStreamSizes( int particleStreamSize, int particleStreamWidth );
/** /**
* Initialize stream dimensions * Initialize stream dimensions
* *
* @param numberOfAtoms number of atoms * @param numberOfParticles number of particles
* @param platform platform * @param platform platform
* *
* @return ErrorReturnValue if error, else DefaultReturnValue * @return ErrorReturnValue if error, else DefaultReturnValue
* *
*/ */
int _initializeStreamSizes( int numberOfAtoms, const Platform& platform ); int _initializeStreamSizes( int numberOfParticles, const Platform& platform );
/** /**
* Initialize stream dimensions and streams * Initialize stream dimensions and streams
...@@ -363,7 +363,7 @@ class BrookBrownianDynamics : public BrookCommon { ...@@ -363,7 +363,7 @@ class BrookBrownianDynamics : public BrookCommon {
/** /**
* Set masses * Set masses
* *
* @param masses atomic masses * @param masses particleic masses
* *
*/ */
......
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include <cmath>
#include <limits>
#include "OpenMMException.h"
#include <sstream>
#include "BrookStreamImpl.h"
#include "BrookCalcGBSAOBCForceKernel.h"
#include "gpu/kgbsa.h"
#include "gpu/kforce.h"
#include "math.h"
using namespace OpenMM;
using namespace std;
/**
* BrookCalcGBSAOBCForceKernel constructor
*
* @param name kernel name
* @param platform platform
*
*/
BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel( std::string name, const Platform& platform ) :
CalcGBSAOBCForceKernel( name, platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
_numberOfAtoms = 0;
_brookGbsa = NULL;
_log = NULL;
const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform);
if( brookPlatform.getLog() != NULL ){
setLog( brookPlatform.getLog() );
}
}
/**
* BrookCalcGBSAOBCForceKernel destructor
*
*/
BrookCalcGBSAOBCForceKernel::~BrookCalcGBSAOBCForceKernel( ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
delete _brookGbsa;
}
/**
* Get log file reference
*
* @return log file reference
*
*/
FILE* BrookCalcGBSAOBCForceKernel::getLog( void ) const {
return _log;
}
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
int BrookCalcGBSAOBCForceKernel::setLog( FILE* log ){
_log = log;
return BrookCommon::DefaultReturnValue;
}
/**
* Initialize the kernel, setting up the values of all the force field parameters.
*
* @param atomParameters vector containing atom index, charge, radius, scalingFactor
* @param solventDielectric solvent dielectric
* @param soluteDielectric solute dielectric
*
*/
void BrookCalcGBSAOBCForceKernel::initialize( const std::vector<std::vector<double> >& atomParameters,
double solventDielectric, double soluteDielectric ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcGBSAOBCForceKernel::initialize";
// ---------------------------------------------------------------------------------------
FILE* log = getLog();
_numberOfAtoms = (int) atomParameters.size();
// ---------------------------------------------------------------------------------------
// bonded
if( _brookGbsa ){
delete _brookGbsa;
}
_brookGbsa = new BrookGbsa();
_brookGbsa->setLog( log );
_brookGbsa->setup( atomParameters, solventDielectric, soluteDielectric, getPlatform() );
if( log ){
std::string contents = _brookGbsa->getContentsString( );
(void) fprintf( log, "%s brookGbsa::contents\n%s", methodName.c_str(), contents.c_str() );
(void) fflush( log );
}
// ---------------------------------------------------------------------------------------
}
/**
* Compute forces given atom coordinates
*
* @param positions atom coordinates
* @param forces output forces
*
*/
void BrookCalcGBSAOBCForceKernel::executeForces( const Stream& positions, Stream& forces ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcGBSAOBCForceKernel::executeForces";
static const int PrintOn = 0;
// ---------------------------------------------------------------------------------------
// OBC
const BrookStreamImpl& positionStreamC = dynamic_cast<const BrookStreamImpl&> (positions.getImpl());
BrookStreamImpl& positionStream = const_cast<BrookStreamImpl&> (positionStreamC);
BrookStreamImpl& forceStream = dynamic_cast<BrookStreamImpl&> (forces.getImpl());
float includeAce = (float) (_brookGbsa->includeAce());
BrookFloatStreamInternal** gbsaForceStreams = _brookGbsa->getForceStreams();
// calculate Born radii first time thru and initialize on board
if( !_brookGbsa->haveBornRadiiBeenInitialized() ){
_brookGbsa->calculateBornRadii( positions );
}
// first major loop
kObcLoop1( (float) _brookGbsa->getNumberOfAtoms(),
(float) _brookGbsa->getAtomSizeCeiling(),
(float) _brookGbsa->getDuplicationFactor(),
(float) _brookGbsa->getAtomStreamWidth( ),
(float) _brookGbsa->getPartialForceStreamWidth( ),
_brookGbsa->getSoluteDielectric(),
_brookGbsa->getSolventDielectric(),
includeAce,
positionStream.getBrookStream(),
_brookGbsa->getObcBornRadii()->getBrookStream(),
_brookGbsa->getObcAtomicRadii()->getBrookStream(),
gbsaForceStreams[0]->getBrookStream(),
gbsaForceStreams[1]->getBrookStream(),
gbsaForceStreams[2]->getBrookStream(),
gbsaForceStreams[3]->getBrookStream()
);
// ---------------------------------------------------------------------------------------
// diagnostics
if( 1 && PrintOn && getLog() ){
(void) fprintf( getLog(), "\nPost kObcLoop1: atms=%d ceil=%d dup=%d atomStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
_brookGbsa->getNumberOfAtoms(),
_brookGbsa->getAtomSizeCeiling(),
_brookGbsa->getDuplicationFactor(),
_brookGbsa->getAtomStreamWidth( ),
_brookGbsa->getPartialForceStreamWidth( ),
_brookGbsa->getSoluteDielectric(),
_brookGbsa->getSolventDielectric(), includeAce );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nBornR\n" );
_brookGbsa->getObcBornRadii()->printToFile( getLog() );
(void) fprintf( getLog(), "\nAtomR\n" );
_brookGbsa->getObcAtomicRadii()->printToFile( getLog() );
(void) fprintf( getLog(), "\nForceStreams output\n" );
for( int ii = 0; ii < 4; ii++ ){
gbsaForceStreams[ii]->printToFile( getLog() );
}
}
// ---------------------------------------------------------------------------------------
// gather for first loop
kPostObcLoop1_nobranch(
(float) _brookGbsa->getDuplicationFactor(),
(float) _brookGbsa->getAtomStreamWidth( ),
(float) _brookGbsa->getPartialForceStreamWidth( ),
(float) _brookGbsa->getNumberOfAtoms(),
(float) _brookGbsa->getAtomSizeCeiling(),
(float) _brookGbsa->getInnerLoopUnroll(),
gbsaForceStreams[0]->getBrookStream(),
gbsaForceStreams[1]->getBrookStream(),
gbsaForceStreams[2]->getBrookStream(),
gbsaForceStreams[3]->getBrookStream(),
_brookGbsa->getObcChain()->getBrookStream(),
_brookGbsa->getObcBornRadii()->getBrookStream(),
_brookGbsa->getObcIntermediateForce()->getBrookStream(),
_brookGbsa->getObcBornRadii2()->getBrookStream() );
// ---------------------------------------------------------------------------------------
// diagnostics
if( PrintOn && getLog()){
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: dup=%d aStrW=%d pStrW=%d no.atms=%3d ceil=%3d Unroll=%1d\n",
_brookGbsa->getDuplicationFactor(),
_brookGbsa->getAtomStreamWidth( ),
_brookGbsa->getPartialForceStreamWidth( ),
_brookGbsa->getNumberOfAtoms(),
_brookGbsa->getAtomSizeCeiling(),
_brookGbsa->getInnerLoopUnroll() );
(void) fprintf( getLog(), "\nForceStreams\n" );
for( int ii = 0; ii < 4; ii++ ){
gbsaForceStreams[ii]->printToFile( getLog() );
}
(void) fprintf( getLog(), "\nObcChain\n" );
_brookGbsa->getObcChain()->printToFile( getLog() );
(void) fprintf( getLog(), "\nBornR\n" );
_brookGbsa->getObcBornRadii()->printToFile( getLog() );
// output
(void) fprintf( getLog(), "\nObcIntermediateForce output\n" );
_brookGbsa->getObcIntermediateForce()->printToFile( getLog() );
// output
(void) fprintf( getLog(), "\nObcBornRadii2 output\n" );
_brookGbsa->getObcBornRadii2()->printToFile( getLog() );
}
// ---------------------------------------------------------------------------------------
// second major loop
kObcLoop2( (float) _brookGbsa->getNumberOfAtoms(),
(float) _brookGbsa->getAtomSizeCeiling(),
(float) _brookGbsa->getDuplicationFactor(),
(float) _brookGbsa->getAtomStreamWidth( ),
(float) _brookGbsa->getPartialForceStreamWidth( ),
positionStream.getBrookStream(),
_brookGbsa->getObcScaledAtomicRadii()->getBrookStream(),
_brookGbsa->getObcBornRadii2()->getBrookStream(),
gbsaForceStreams[0]->getBrookStream(),
gbsaForceStreams[1]->getBrookStream(),
gbsaForceStreams[2]->getBrookStream(),
gbsaForceStreams[3]->getBrookStream()
);
// ---------------------------------------------------------------------------------------
// diagnostics
if( PrintOn && getLog() ){
(void) fprintf( getLog(), "\nPost kObcLoop2: no.atms=%5d ceil=%3d dup=%3d strW=%3d pStrW=%3d\n",
_brookGbsa->getNumberOfAtoms(),
_brookGbsa->getAtomSizeCeiling(),
_brookGbsa->getDuplicationFactor(),
_brookGbsa->getAtomStreamWidth( ),
_brookGbsa->getPartialForceStreamWidth( ) );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nObcScaledAtomicRadii\n" );
_brookGbsa->getObcScaledAtomicRadii()->printToFile( getLog() );
(void) fprintf( getLog(), "\ngetObcBornRadii2\n" );
_brookGbsa->getObcBornRadii2()->printToFile( getLog() );
(void) fprintf( getLog(), "\nForceStreams\n" );
for( int ii = 0; ii < 4; ii++ ){
gbsaForceStreams[ii]->printToFile( getLog() );
}
}
// ---------------------------------------------------------------------------------------
// gather for second loop
float mergeNonObcForces = 1.0f;
float kcalMolTokJNM = -0.4184f;
kPostObcLoop2_nobranch(
(float) _brookGbsa->getDuplicationFactor(),
(float) _brookGbsa->getAtomStreamWidth( ),
(float) _brookGbsa->getPartialForceStreamWidth( ),
(float) _brookGbsa->getNumberOfAtoms(),
(float) _brookGbsa->getAtomSizeCeiling(),
(float) _brookGbsa->getInnerLoopUnroll(),
kcalMolTokJNM,
mergeNonObcForces,
_brookGbsa->getObcIntermediateForce()->getBrookStream(),
forceStream.getBrookStream(),
gbsaForceStreams[0]->getBrookStream(),
gbsaForceStreams[1]->getBrookStream(),
gbsaForceStreams[2]->getBrookStream(),
gbsaForceStreams[3]->getBrookStream(),
_brookGbsa->getObcAtomicRadii()->getBrookStream(),
_brookGbsa->getObcBornRadii()->getBrookStream(),
_brookGbsa->getObcChain()->getBrookStream(),
forceStream.getBrookStream()
);
// ---------------------------------------------------------------------------------------
// diagnostics
if( PrintOn && getLog() ){
(void) fprintf( getLog(), "\nPost kPostObcLoop2_nobranch: atms=%d ceil=%d dup=%d atomStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
_brookGbsa->getNumberOfAtoms(),
_brookGbsa->getAtomSizeCeiling(),
_brookGbsa->getDuplicationFactor(),
_brookGbsa->getAtomStreamWidth( ),
_brookGbsa->getPartialForceStreamWidth( ),
_brookGbsa->getSoluteDielectric(),
_brookGbsa->getSolventDielectric(), includeAce );
(void) fprintf( getLog(), "\nPartialForceStreams\n" );
for( int ii = 0; ii < 4; ii++ ){
gbsaForceStreams[ii]->printToFile( getLog() );
}
BrookStreamInternal* brookStreamInternalF = forceStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nForceStream\n" );
brookStreamInternalF->printToFile( getLog() );
(void) fprintf( getLog(), "\nChain\n" );
_brookGbsa->getObcChain()->printToFile( getLog() );
(void) fprintf( getLog(), "\nBornR\n" );
_brookGbsa->getObcBornRadii()->printToFile( getLog() );
}
// ---------------------------------------------------------------------------------------
}
/**
* Execute the kernel to calculate the OBC energy
*
* @param positions atom positions
*
* @return potential energy due to the OBC forces
*
*/
double BrookCalcGBSAOBCForceKernel::executeEnergy( const Stream& positions ){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcGBSAOBCForceKernel::executeEnergy";
// ---------------------------------------------------------------------------------------
return (double) _brookGbsa->getEnergy( positions );
}
...@@ -29,17 +29,22 @@ ...@@ -29,17 +29,22 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include <cmath>
#include <limits>
#include "OpenMMException.h" #include "OpenMMException.h"
#include <sstream> #include <sstream>
#include "BrookNonbonded14ForceKernel.h"
#include "BrookStreamImpl.h"
#include "BrookCalcGBSAOBCForceKernel.h"
#include "gpu/kgbsa.h"
#include "gpu/kforce.h"
#include "math.h"
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
const std::string BrookNonbonded14ForceKernel::BondName = "HarmonicLJ14";
/** /**
* BrookNonbonded14ForceKernel constructor * BrookCalcGBSAOBCForceKernel constructor
* *
* @param name kernel name * @param name kernel name
* @param platform platform * @param platform platform
...@@ -48,18 +53,18 @@ const std::string BrookNonbonded14ForceKernel::BondName = "HarmonicLJ14"; ...@@ -48,18 +53,18 @@ const std::string BrookNonbonded14ForceKernel::BondName = "HarmonicLJ14";
* *
*/ */
BrookNonbonded14ForceKernel::BrookNonbonded14ForceKernel( std::string name, const Platform& platform, BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system ) :
OpenMMBrookInterface& openMMBrookInterface, System& system ) : CalcGBSAOBCForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){
CalcHarmonicLJ14ForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookNonbonded14ForceKernel::BrookNonbonded14ForceKernel"; // static const std::string methodName = "BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel";
// static const int debug = 1; // static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
_brookBondParameters = NULL; _numberOfParticles = 0;
_brookGbsa = NULL;
_log = NULL; _log = NULL;
const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform); const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform);
...@@ -70,20 +75,20 @@ BrookNonbonded14ForceKernel::BrookNonbonded14ForceKernel( std::string name, cons ...@@ -70,20 +75,20 @@ BrookNonbonded14ForceKernel::BrookNonbonded14ForceKernel( std::string name, cons
} }
/** /**
* BrookNonbonded14ForceKernel destructor * BrookCalcGBSAOBCForceKernel destructor
* *
*/ */
BrookNonbonded14ForceKernel::~BrookNonbonded14ForceKernel( ){ BrookCalcGBSAOBCForceKernel::~BrookCalcGBSAOBCForceKernel( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookNonbonded14ForceKernel::BrookNonbonded14ForceKernel"; // static const std::string methodName = "BrookCalcGBSAOBCForceKernel::BrookCalcGBSAOBCForceKernel";
// static const int debug = 1; // static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
delete _brookBondParameters; delete _brookGbsa;
} }
/** /**
...@@ -93,7 +98,7 @@ BrookNonbonded14ForceKernel::~BrookNonbonded14ForceKernel( ){ ...@@ -93,7 +98,7 @@ BrookNonbonded14ForceKernel::~BrookNonbonded14ForceKernel( ){
* *
*/ */
FILE* BrookNonbonded14ForceKernel::getLog( void ) const { FILE* BrookCalcGBSAOBCForceKernel::getLog( void ) const {
return _log; return _log;
} }
...@@ -106,7 +111,7 @@ FILE* BrookNonbonded14ForceKernel::getLog( void ) const { ...@@ -106,7 +111,7 @@ FILE* BrookNonbonded14ForceKernel::getLog( void ) const {
* *
*/ */
int BrookNonbonded14ForceKernel::setLog( FILE* log ){ int BrookCalcGBSAOBCForceKernel::setLog( FILE* log ){
_log = log; _log = log;
return BrookCommon::DefaultReturnValue; return BrookCommon::DefaultReturnValue;
} }
...@@ -114,16 +119,16 @@ int BrookNonbonded14ForceKernel::setLog( FILE* log ){ ...@@ -114,16 +119,16 @@ int BrookNonbonded14ForceKernel::setLog( FILE* log ){
/** /**
* Initialize the kernel, setting up the values of all the force field parameters. * Initialize the kernel, setting up the values of all the force field parameters.
* *
* @param system System reference * @param system system this kernel will be applied to
* @param force HarmonicLJ14Force reference * @param force GBSAOBCForce this kernel will be used for
* *
*/ */
void BrookNonbonded14ForceKernel::initialize( const System& system, const HarmonicLJ14Force& force ){ void BrookCalcGBSAOBCForceKernel::initialize( const System& system, const GBSAOBCForce& force ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookNonbonded14ForceKernel::initialize"; static const std::string methodName = "BrookCalcGBSAOBCForceKernel::initialize";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -131,39 +136,36 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon ...@@ -131,39 +136,36 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing atom indices/parameters if( _brookGbsa ){
delete _brookGbsa;
int numberOfBonds = force.getNumLJ14s();
if( _brookBondParameters ){
delete _brookBondParameters;
} }
_brookBondParameters = new BrookBondParameters( BondName, NumberOfAtomsInBond, NumberOfParametersInBond, numberOfBonds, getLog() ); _brookGbsa = new BrookGbsa();
_brookGbsa->setLog( log );
for( int ii = 0; ii < numberOfBonds; ii++ ){ // get parameters from force object
// and initialize brookGbsa
int particle1, particle2, particle3; _numberOfParticles = system.getNumParticles();
double angle, k; std::vector<std::vector<double> > particleParameters;
for( int ii = 0; ii < _numberOfParticles; ii++ ){
int particles[NumberOfAtomsInBond]; double charge, radius, scalingFactor;
double parameters[NumberOfParametersInBond]; force.getParticleParameters( ii, charge, radius, scalingFactor );
force.getLJ14Parameters( ii, particle1, particle2, particle3, angle, k ); std::vector<double> parameters;
particles[0] = particle1; particleParameters[ii] = parameters;
particles[1] = particle2;
particles[2] = particle3;
parameters[0] = angle; parameters[0] = charge;
parameters[1] = k; parameters[1] = radius;
parameters[2] = scalingFactor;
_brookBondParameters->setBond( ii, particles, parameters );
} }
_openMMBrookInterface.setHarmonicLJ14ForceParameters( _brookBondParameters ); _brookGbsa->setup( particleParameters, force.getSolventDielectric(), force.getSoluteDielectric(), getPlatform() );
_openMMBrookInterface.setTriggerForceKernel( this ); _openMMBrookInterface.setTriggerForceKernel( this );
_openMMBrookInterface.setTriggerEnergyKernel( this ); _openMMBrookInterface.setTriggerEnergyKernel( this );
if( log ){ if( log ){
std::string contents = _brookBondParameters->getContentsString( ); std::string contents = _brookGbsa->getContentsString( );
(void) fprintf( log, "%s brookGbsa::contents\n%s", methodName.c_str(), contents.c_str() ); (void) fprintf( log, "%s brookGbsa::contents\n%s", methodName.c_str(), contents.c_str() );
(void) fflush( log ); (void) fflush( log );
} }
...@@ -173,17 +175,17 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon ...@@ -173,17 +175,17 @@ void BrookNonbonded14ForceKernel::initialize( const System& system, const Harmon
} }
/** /**
* Compute forces given atom coordinates * Compute forces given particle coordinates
* *
* @param context OpenMMContextImpl context * @param context OpenMMContextImpl context
* *
*/ */
void BrookNonbonded14ForceKernel::executeForces( OpenMMContextImpl& context ){ void BrookCalcGBSAOBCForceKernel::executeForces( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookNonbonded14ForceKernel::executeForces"; //static const std::string methodName = "BrookCalcGBSAOBCForceKernel::executeForces";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -191,25 +193,22 @@ void BrookNonbonded14ForceKernel::executeForces( OpenMMContextImpl& context ){ ...@@ -191,25 +193,22 @@ void BrookNonbonded14ForceKernel::executeForces( OpenMMContextImpl& context ){
_openMMBrookInterface.computeForces( context ); _openMMBrookInterface.computeForces( context );
} }
return;
// ---------------------------------------------------------------------------------------
} }
/** /**
* Execute the kernel to calculate the energy * Execute the kernel to calculate the OBC energy
* *
* @param context OpenMMContextImpl context * @param context OpenMMContextImpl context
* *
* @return potential energy * @return energy
* *
*/ */
double BrookNonbonded14ForceKernel::executeEnergy( OpenMMContextImpl& context ){ double BrookCalcGBSAOBCForceKernel::executeEnergy( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookNonbonded14ForceKernel::executeEnergy"; //static const std::string methodName = "BrookCalcGBSAOBCForceKernel::executeEnergy";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
#ifndef OPENMM_BROOK__CALCL_GBSAOBC_FORCEFIELD_KERNEL_H_ #ifndef OPENMM_BROOK_CALC_GBSAOBC_FORCE_KERNEL_H_
#define OPENMM_BROOK__CALCL_GBSAOBC_FORCEFIELD_KERNEL_H_ #define OPENMM_BROOK_CALC_GBSAOBC_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- * /* -------------------------------------------------------------------------- *
* OpenMM * * OpenMM *
...@@ -35,12 +35,14 @@ ...@@ -35,12 +35,14 @@
#include "kernels.h" #include "kernels.h"
#include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h" #include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h"
#include "BrookGbsa.h" #include "BrookGbsa.h"
#include "OpenMMBrookInterface.h"
namespace OpenMM { namespace OpenMM {
/** /**
* This kernel is invoked by NonbondedForce to calculate the forces acting on the system. * This kernel is invoked to calculate the OBC forces acting on the system.
*/ */
class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel { class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
public: public:
...@@ -49,7 +51,7 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel { ...@@ -49,7 +51,7 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
* BrookCalcGBSAOBCForceKernel constructor * BrookCalcGBSAOBCForceKernel constructor
*/ */
BrookCalcGBSAOBCForceKernel( std::string name, const Platform& platform ); BrookCalcGBSAOBCForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system );
/** /**
* BrookCalcGBSAOBCForceKernel destructor * BrookCalcGBSAOBCForceKernel destructor
...@@ -60,35 +62,34 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel { ...@@ -60,35 +62,34 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
/** /**
* Initialize the kernel, setting up the values of all the force field parameters. * Initialize the kernel, setting up the values of all the force field parameters.
* *
* @param atomParameters vector containing atom index, charge, radius, scalingFactor * @param system system this kernel will be applied to
* @param solventDielectric solvent dielectric * @param force GBSAOBCForce this kernel will be used for
* @param soluteDielectric solute dielectric
* *
*/ */
void initialize( const std::vector<std::vector<double> >& atomParameters, double solventDielectric, double soluteDielectric ); void initialize( const System& system, const GBSAOBCForce& force );
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces.
* *
* @param positions atom coordiantes * @param positions particle coordiantes
* @param forces output forces * @param forces output forces
* *
*/ */
void executeForces( const Stream& positions, Stream& forces ); void executeForces( OpenMMContextImpl& context );
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param positions atom positions * @param positions particle positions
* *
* @return potential energy due to the NonbondedForce * @return potential energy due to the NonbondedForce
* Currently always return 0.0 since energies not calculated on gpu * Currently always return 0.0 since energies not calculated on gpu
* *
*/ */
double executeEnergy( const Stream& positions ); double executeEnergy( OpenMMContextImpl& context );
/** /**
* Set log file reference * Set log file reference
...@@ -127,16 +128,24 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel { ...@@ -127,16 +128,24 @@ class BrookCalcGBSAOBCForceKernel : public CalcGBSAOBCForceKernel {
FILE* _log; FILE* _log;
// number of atoms // number of particles
int _numberOfAtoms; int _numberOfParticles;
// Brook Gbsa // Brook Gbsa
BrookGbsa* _brookGbsa; BrookGbsa* _brookGbsa;
// interface
OpenMMBrookInterface& _openMMBrookInterface;
// System reference
System& _system;
}; };
} // namespace OpenMM } // namespace OpenMM
#endif /* OPENMM_BROOK__CALCL_GBSAOBC_FORCEFIELD_KERNEL_H_ */ #endif /* OPENMM_BROOK_CALC_GBSAOBC_FORCE_KERNEL_H_ */
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
#include "OpenMMException.h" #include "OpenMMException.h"
#include <sstream> #include <sstream>
#include "BrookCalcHarmonicLJ14ForceKernel.h" #include "BrookCalcHarmonicAngleForceKernel.h"
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
const std::string BrookCalcHarmonicLJ14ForceKernel::BondName = "HarmonicLJ14"; const std::string BrookCalcHarmonicAngleForceKernel::BondName = "HarmonicAngle";
/** /**
* BrookCalcHarmonicLJ14ForceKernel constructor * BrookCalcHarmonicAngleForceKernel constructor
* *
* @param name kernel name * @param name kernel name
* @param platform platform * @param platform platform
...@@ -48,13 +48,13 @@ const std::string BrookCalcHarmonicLJ14ForceKernel::BondName = "HarmonicLJ14"; ...@@ -48,13 +48,13 @@ const std::string BrookCalcHarmonicLJ14ForceKernel::BondName = "HarmonicLJ14";
* *
*/ */
BrookCalcHarmonicLJ14ForceKernel::BrookCalcHarmonicLJ14ForceKernel( std::string name, const Platform& platform, BrookCalcHarmonicAngleForceKernel::BrookCalcHarmonicAngleForceKernel( std::string name, const Platform& platform,
OpenMMBrookInterface& openMMBrookInterface, System& system ) : OpenMMBrookInterface& openMMBrookInterface, System& system ) :
CalcHarmonicLJ14ForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){ CalcHarmonicAngleForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcHarmonicLJ14ForceKernel::BrookCalcHarmonicLJ14ForceKernel"; // static const std::string methodName = "BrookCalcHarmonicAngleForceKernel::BrookCalcHarmonicAngleForceKernel";
// static const int debug = 1; // static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -70,15 +70,15 @@ BrookCalcHarmonicLJ14ForceKernel::BrookCalcHarmonicLJ14ForceKernel( std::string ...@@ -70,15 +70,15 @@ BrookCalcHarmonicLJ14ForceKernel::BrookCalcHarmonicLJ14ForceKernel( std::string
} }
/** /**
* BrookCalcHarmonicLJ14ForceKernel destructor * BrookCalcHarmonicAngleForceKernel destructor
* *
*/ */
BrookCalcHarmonicLJ14ForceKernel::~BrookCalcHarmonicLJ14ForceKernel( ){ BrookCalcHarmonicAngleForceKernel::~BrookCalcHarmonicAngleForceKernel( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcHarmonicLJ14ForceKernel::BrookCalcHarmonicLJ14ForceKernel"; // static const std::string methodName = "BrookCalcHarmonicAngleForceKernel::BrookCalcHarmonicAngleForceKernel";
// static const int debug = 1; // static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -93,7 +93,7 @@ BrookCalcHarmonicLJ14ForceKernel::~BrookCalcHarmonicLJ14ForceKernel( ){ ...@@ -93,7 +93,7 @@ BrookCalcHarmonicLJ14ForceKernel::~BrookCalcHarmonicLJ14ForceKernel( ){
* *
*/ */
FILE* BrookCalcHarmonicLJ14ForceKernel::getLog( void ) const { FILE* BrookCalcHarmonicAngleForceKernel::getLog( void ) const {
return _log; return _log;
} }
...@@ -106,7 +106,7 @@ FILE* BrookCalcHarmonicLJ14ForceKernel::getLog( void ) const { ...@@ -106,7 +106,7 @@ FILE* BrookCalcHarmonicLJ14ForceKernel::getLog( void ) const {
* *
*/ */
int BrookCalcHarmonicLJ14ForceKernel::setLog( FILE* log ){ int BrookCalcHarmonicAngleForceKernel::setLog( FILE* log ){
_log = log; _log = log;
return BrookCommon::DefaultReturnValue; return BrookCommon::DefaultReturnValue;
} }
...@@ -115,15 +115,15 @@ int BrookCalcHarmonicLJ14ForceKernel::setLog( FILE* log ){ ...@@ -115,15 +115,15 @@ int BrookCalcHarmonicLJ14ForceKernel::setLog( FILE* log ){
* Initialize the kernel, setting up the values of all the force field parameters. * Initialize the kernel, setting up the values of all the force field parameters.
* *
* @param system System reference * @param system System reference
* @param force HarmonicLJ14Force reference * @param force HarmonicAngleForce reference
* *
*/ */
void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const HarmonicLJ14Force& force ){ void BrookCalcHarmonicAngleForceKernel::initialize( const System& system, const HarmonicAngleForce& force ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcHarmonicLJ14ForceKernel::initialize"; static const std::string methodName = "BrookCalcHarmonicAngleForceKernel::initialize";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -131,24 +131,24 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H ...@@ -131,24 +131,24 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing atom indices/parameters // create _brookBondParameters object containing particle indices/parameters
int numberOfBonds = force.getNumLJ14s(); int numberOfBonds = force.getNumAngles();
if( _brookBondParameters ){ if( _brookBondParameters ){
delete _brookBondParameters; delete _brookBondParameters;
} }
_brookBondParameters = new BrookBondParameters( BondName, NumberOfAtomsInBond, NumberOfParametersInBond, numberOfBonds, getLog() ); _brookBondParameters = new BrookBondParameters( BondName, NumberOfParticlesInBond, NumberOfParametersInBond, numberOfBonds, getLog() );
for( int ii = 0; ii < numberOfBonds; ii++ ){ for( int ii = 0; ii < numberOfBonds; ii++ ){
int particle1, particle2, particle3; int particle1, particle2, particle3;
double angle, k; double angle, k;
int particles[NumberOfAtomsInBond]; int particles[NumberOfParticlesInBond];
double parameters[NumberOfParametersInBond]; double parameters[NumberOfParametersInBond];
force.getLJ14Parameters( ii, particle1, particle2, particle3, angle, k ); force.getAngleParameters( ii, particle1, particle2, particle3, angle, k );
particles[0] = particle1; particles[0] = particle1;
particles[1] = particle2; particles[1] = particle2;
particles[2] = particle3; particles[2] = particle3;
...@@ -158,7 +158,7 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H ...@@ -158,7 +158,7 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
_brookBondParameters->setBond( ii, particles, parameters ); _brookBondParameters->setBond( ii, particles, parameters );
} }
_openMMBrookInterface.setHarmonicLJ14ForceParameters( _brookBondParameters ); _openMMBrookInterface.setHarmonicAngleForceParameters( _brookBondParameters );
_openMMBrookInterface.setTriggerForceKernel( this ); _openMMBrookInterface.setTriggerForceKernel( this );
_openMMBrookInterface.setTriggerEnergyKernel( this ); _openMMBrookInterface.setTriggerEnergyKernel( this );
...@@ -173,17 +173,17 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H ...@@ -173,17 +173,17 @@ void BrookCalcHarmonicLJ14ForceKernel::initialize( const System& system, const H
} }
/** /**
* Compute forces given atom coordinates * Compute forces given particle coordinates
* *
* @param context OpenMMContextImpl context * @param context OpenMMContextImpl context
* *
*/ */
void BrookCalcHarmonicLJ14ForceKernel::executeForces( OpenMMContextImpl& context ){ void BrookCalcHarmonicAngleForceKernel::executeForces( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcHarmonicLJ14ForceKernel::executeForces"; //static const std::string methodName = "BrookCalcHarmonicAngleForceKernel::executeForces";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -205,11 +205,11 @@ void BrookCalcHarmonicLJ14ForceKernel::executeForces( OpenMMContextImpl& context ...@@ -205,11 +205,11 @@ void BrookCalcHarmonicLJ14ForceKernel::executeForces( OpenMMContextImpl& context
* *
*/ */
double BrookCalcHarmonicLJ14ForceKernel::executeEnergy( OpenMMContextImpl& context ){ double BrookCalcHarmonicAngleForceKernel::executeEnergy( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcHarmonicLJ14ForceKernel::executeEnergy"; //static const std::string methodName = "BrookCalcHarmonicAngleForceKernel::executeEnergy";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
#ifndef OPENMM_BROOK_CALC_RB_DIHEDRAL_FORCE_KERNEL_H_ #ifndef OPENMM_BROOK_CALC_HARMONIC_ANGLE_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_RB_DIHEDRAL_FORCE_KERNEL_H_ #define OPENMM_BROOK_CALC_HARMONIC_ANGLE_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- * /* -------------------------------------------------------------------------- *
* OpenMM * * OpenMM *
...@@ -43,36 +43,36 @@ namespace OpenMM { ...@@ -43,36 +43,36 @@ namespace OpenMM {
* This kernel is invoked to calculate the harmonic angle forces acting on the system. * This kernel is invoked to calculate the harmonic angle forces acting on the system.
*/ */
class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel { class BrookCalcHarmonicAngleForceKernel : public CalcHarmonicAngleForceKernel {
public: public:
/** /**
* BrookCalcRbDihedralForceKernel constructor * BrookCalcHarmonicAngleForceKernel constructor
*/ */
BrookCalcRbDihedralForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system ); BrookCalcHarmonicAngleForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system );
/** /**
* BrookCalcRbDihedralForceKernel destructor * BrookCalcHarmonicAngleForceKernel destructor
*/ */
~BrookCalcRbDihedralForceKernel(); ~BrookCalcHarmonicAngleForceKernel();
/** /**
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy * Initialize the kernel, setting up the values to calculate harmonic bond force & energy
* *
* @param system System reference * @param system System reference
* @param force RbDihedralForce reference * @param force HarmonicAngleForce reference
* *
*/ */
void initialize( const System& system, const RBTorsionForce& force ); void initialize( const System& system, const HarmonicAngleForce& force );
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces.
* *
* @param positions atom coordiantes * @param positions particle coordiantes
* @param forces output forces * @param forces output forces
* *
*/ */
...@@ -133,7 +133,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel { ...@@ -133,7 +133,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
/** /**
* Get indices/parameters * Get indices/parameters
* *
* @return BrookBondParameters containing atom indices/parameters * @return BrookBondParameters containing particle indices/parameters
* *
*/ */
...@@ -141,7 +141,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel { ...@@ -141,7 +141,7 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
private: private:
static const int NumberOfAtomsInBond = 3; static const int NumberOfParticlesInBond = 3;
static const int NumberOfParametersInBond = 2; static const int NumberOfParametersInBond = 2;
// bond name // bond name
...@@ -169,4 +169,4 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel { ...@@ -169,4 +169,4 @@ class BrookCalcRbDihedralForceKernel : public CalcRBTorsionForceKernel {
} // namespace OpenMM } // namespace OpenMM
#endif /* OPENMM_BROOK_CALC_RB_DIHEDRAL_FORCE_KERNEL_H_ */ #endif /* OPENMM_BROOK_CALC_HARMONIC_ANGLE_FORCE_KERNEL_H_ */
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
#include "OpenMMException.h" #include "OpenMMException.h"
#include <sstream> #include <sstream>
#include "BrookCalcRBDihedralBondForceKernel.h" #include "BrookCalcHarmonicBondForceKernel.h"
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
const std::string BrookCalcRbDihedralForceKernel::BondName = "RbDihedral"; const std::string BrookCalcHarmonicBondForceKernel::BondName = "HarmonicBond";
/** /**
* BrookCalcRbDihedralForceKernel constructor * BrookCalcHarmonicBondForceKernel constructor
* *
* @param name kernel name * @param name kernel name
* @param platform platform * @param platform platform
...@@ -48,13 +48,13 @@ const std::string BrookCalcRbDihedralForceKernel::BondName = "RbDihedral"; ...@@ -48,13 +48,13 @@ const std::string BrookCalcRbDihedralForceKernel::BondName = "RbDihedral";
* *
*/ */
BrookCalcRbDihedralForceKernel::BrookCalcRbDihedralForceKernel( std::string name, const Platform& platform, BrookCalcHarmonicBondForceKernel::BrookCalcHarmonicBondForceKernel( std::string name, const Platform& platform,
OpenMMBrookInterface& openMMBrookInterface, System& system ) : OpenMMBrookInterface& openMMBrookInterface, System& system ) :
CalcRbDihedralForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){ CalcHarmonicBondForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcRbDihedralForceKernel::BrookCalcRbDihedralForceKernel"; // static const std::string methodName = "BrookCalcHarmonicBondForceKernel::BrookCalcHarmonicBondForceKernel";
// static const int debug = 1; // static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -70,15 +70,15 @@ BrookCalcRbDihedralForceKernel::BrookCalcRbDihedralForceKernel( std::string name ...@@ -70,15 +70,15 @@ BrookCalcRbDihedralForceKernel::BrookCalcRbDihedralForceKernel( std::string name
} }
/** /**
* BrookCalcRbDihedralForceKernel destructor * BrookCalcHarmonicBondForceKernel destructor
* *
*/ */
BrookCalcRbDihedralForceKernel::~BrookCalcRbDihedralForceKernel( ){ BrookCalcHarmonicBondForceKernel::~BrookCalcHarmonicBondForceKernel( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcRbDihedralForceKernel::BrookCalcRbDihedralForceKernel"; // static const std::string methodName = "BrookCalcHarmonicBondForceKernel::BrookCalcHarmonicBondForceKernel";
// static const int debug = 1; // static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -93,7 +93,7 @@ BrookCalcRbDihedralForceKernel::~BrookCalcRbDihedralForceKernel( ){ ...@@ -93,7 +93,7 @@ BrookCalcRbDihedralForceKernel::~BrookCalcRbDihedralForceKernel( ){
* *
*/ */
FILE* BrookCalcRbDihedralForceKernel::getLog( void ) const { FILE* BrookCalcHarmonicBondForceKernel::getLog( void ) const {
return _log; return _log;
} }
...@@ -106,7 +106,7 @@ FILE* BrookCalcRbDihedralForceKernel::getLog( void ) const { ...@@ -106,7 +106,7 @@ FILE* BrookCalcRbDihedralForceKernel::getLog( void ) const {
* *
*/ */
int BrookCalcRbDihedralForceKernel::setLog( FILE* log ){ int BrookCalcHarmonicBondForceKernel::setLog( FILE* log ){
_log = log; _log = log;
return BrookCommon::DefaultReturnValue; return BrookCommon::DefaultReturnValue;
} }
...@@ -115,15 +115,15 @@ int BrookCalcRbDihedralForceKernel::setLog( FILE* log ){ ...@@ -115,15 +115,15 @@ int BrookCalcRbDihedralForceKernel::setLog( FILE* log ){
* Initialize the kernel, setting up the values of all the force field parameters. * Initialize the kernel, setting up the values of all the force field parameters.
* *
* @param system System reference * @param system System reference
* @param force RbDihedralForce reference * @param force HarmonicBondForce reference
* *
*/ */
void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbDihedralForce& force ){ void BrookCalcHarmonicBondForceKernel::initialize( const System& system, const HarmonicBondForce& force ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcRbDihedralForceKernel::initialize"; static const std::string methodName = "BrookCalcHarmonicBondForceKernel::initialize";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -131,40 +131,39 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD ...@@ -131,40 +131,39 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing atom indices/parameters // create _brookBondParameters object containing particle indices/parameters
int numberOfBonds = force.getNumAngles(); int numberOfBonds = force.getNumBonds();
if( _brookBondParameters ){ if( _brookBondParameters ){
delete _brookBondParameters; delete _brookBondParameters;
} }
_brookBondParameters = new BrookBondParameters( BondName, NumberOfAtomsInBond, NumberOfParametersInBond, numberOfBonds, getLog() ); _brookBondParameters = new BrookBondParameters( BondName, NumberOfParticlesInBond, NumberOfParametersInBond, numberOfBonds, getLog() );
for( int ii = 0; ii < numberOfBonds; ii++ ){ for( int ii = 0; ii < numberOfBonds; ii++ ){
int particle1, particle2, particle3; int particle1, particle2;
double angle, k; double length, k;
int particles[NumberOfAtomsInBond]; int particles[NumberOfParticlesInBond];
double parameters[NumberOfParametersInBond]; double parameters[NumberOfParametersInBond];
force.getAngleParameters( ii, particle1, particle2, particle3, angle, k ); force.getBondParameters( ii, particle1, particle2, length, k );
particles[0] = particle1; particles[0] = particle1;
particles[1] = particle2; particles[1] = particle2;
particles[2] = particle3;
parameters[0] = angle; parameters[0] = length;
parameters[1] = k; parameters[1] = k;
_brookBondParameters->setBond( ii, particles, parameters ); _brookBondParameters->setBond( ii, particles, parameters );
} }
_openMMBrookInterface.setRbDihedralForceParameters( _brookBondParameters ); _openMMBrookInterface.setHarmonicBondForceParameters( _brookBondParameters );
_openMMBrookInterface.setTriggerForceKernel( this ); _openMMBrookInterface.setTriggerForceKernel( this );
_openMMBrookInterface.setTriggerEnergyKernel( this ); _openMMBrookInterface.setTriggerEnergyKernel( this );
if( log ){ if( log ){
std::string contents = _brookBondParameters->getContentsString( ); std::string contents = _brookBondParameters->getContentsString( );
(void) fprintf( log, "%s brookGbsa::contents\n%s", methodName.c_str(), contents.c_str() ); (void) fprintf( log, "%s contents\n%s", methodName.c_str(), contents.c_str() );
(void) fflush( log ); (void) fflush( log );
} }
...@@ -173,17 +172,17 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD ...@@ -173,17 +172,17 @@ void BrookCalcRbDihedralForceKernel::initialize( const System& system, const RbD
} }
/** /**
* Compute forces given atom coordinates * Compute forces given particle coordinates
* *
* @param context OpenMMContextImpl context * @param context OpenMMContextImpl context
* *
*/ */
void BrookCalcRbDihedralForceKernel::executeForces( OpenMMContextImpl& context ){ void BrookCalcHarmonicBondForceKernel::executeForces( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcRbDihedralForceKernel::executeForces"; //static const std::string methodName = "BrookCalcHarmonicBondForceKernel::executeForces";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -205,11 +204,11 @@ void BrookCalcRbDihedralForceKernel::executeForces( OpenMMContextImpl& context ) ...@@ -205,11 +204,11 @@ void BrookCalcRbDihedralForceKernel::executeForces( OpenMMContextImpl& context )
* *
*/ */
double BrookCalcRbDihedralForceKernel::executeEnergy( OpenMMContextImpl& context ){ double BrookCalcHarmonicBondForceKernel::executeEnergy( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcRbDihedralForceKernel::executeEnergy"; //static const std::string methodName = "BrookCalcHarmonicBondForceKernel::executeEnergy";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
......
#ifndef OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_ #ifndef OPENMM_BROOK_CALC_HARMONIC_BOND_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_ #define OPENMM_BROOK_CALC_HARMONIC_BOND_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- * /* -------------------------------------------------------------------------- *
* OpenMM * * OpenMM *
...@@ -43,36 +43,36 @@ namespace OpenMM { ...@@ -43,36 +43,36 @@ namespace OpenMM {
* This kernel is invoked to calculate the harmonic angle forces acting on the system. * This kernel is invoked to calculate the harmonic angle forces acting on the system.
*/ */
class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel { class BrookCalcHarmonicBondForceKernel : public CalcHarmonicBondForceKernel {
public: public:
/** /**
* BrookCalcHarmonicLJ14ForceKernel constructor * BrookCalcHarmonicBondForceKernel constructor
*/ */
BrookCalcHarmonicLJ14ForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system ); BrookCalcHarmonicBondForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system );
/** /**
* BrookCalcHarmonicLJ14ForceKernel destructor * BrookCalcHarmonicBondForceKernel destructor
*/ */
~BrookCalcHarmonicLJ14ForceKernel(); ~BrookCalcHarmonicBondForceKernel();
/** /**
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy * Initialize the kernel, setting up the values to calculate harmonic bond force & energy
* *
* @param system System reference * @param system System reference
* @param force HarmonicLJ14Force reference * @param force HarmonicBondForce reference
* *
*/ */
void initialize( const System& system, const HarmonicLJ14Force& force ); void initialize( const System& system, const HarmonicBondForce& force );
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces.
* *
* @param positions atom coordiantes * @param positions particle coordiantes
* @param forces output forces * @param forces output forces
* *
*/ */
...@@ -133,7 +133,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel { ...@@ -133,7 +133,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
/** /**
* Get indices/parameters * Get indices/parameters
* *
* @return BrookBondParameters containing atom indices/parameters * @return BrookBondParameters containing particle indices/parameters
* *
*/ */
...@@ -141,7 +141,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel { ...@@ -141,7 +141,7 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
private: private:
static const int NumberOfAtomsInBond = 3; static const int NumberOfParticlesInBond = 2;
static const int NumberOfParametersInBond = 2; static const int NumberOfParametersInBond = 2;
// bond name // bond name
...@@ -152,7 +152,6 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel { ...@@ -152,7 +152,6 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
FILE* _log; FILE* _log;
// Brook bond parameters // Brook bond parameters
BrookBondParameters* _brookBondParameters; BrookBondParameters* _brookBondParameters;
...@@ -169,4 +168,4 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel { ...@@ -169,4 +168,4 @@ class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
} // namespace OpenMM } // namespace OpenMM
#endif /* OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_ */ #endif /* OPENMM_BROOK_CALC_HARMONIC_BOND_FORCE_KERNEL_H_ */
...@@ -77,7 +77,7 @@ BrookCalcKineticEnergyKernel::~BrookCalcKineticEnergyKernel( ){ ...@@ -77,7 +77,7 @@ BrookCalcKineticEnergyKernel::~BrookCalcKineticEnergyKernel( ){
/** /**
* Initialize the kernel * Initialize the kernel
* *
* @param masses mass of each atom * @param masses mass of each particle
* *
*/ */
...@@ -107,7 +107,7 @@ void BrookCalcKineticEnergyKernel::initialize( const vector<double>& masses ){ ...@@ -107,7 +107,7 @@ void BrookCalcKineticEnergyKernel::initialize( const vector<double>& masses ){
/** /**
* Execute kernel * Execute kernel
* *
* @param velocities stream of atom velocities * @param velocities stream of particle velocities
* *
* @return kinetic energy of the system * @return kinetic energy of the system
* *
......
...@@ -65,7 +65,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel { ...@@ -65,7 +65,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel {
/** /**
* Initialize the kernel * Initialize the kernel
* *
* @param masses mass of each atom * @param masses mass of each particle
* *
*/ */
void initialize( const std::vector<double>& masses ); void initialize( const std::vector<double>& masses );
...@@ -73,7 +73,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel { ...@@ -73,7 +73,7 @@ class BrookCalcKineticEnergyKernel : public CalcKineticEnergyKernel {
/** /**
* Execute the kernel. * Execute the kernel.
* *
* @param velocities stream of atom velocities * @param velocities stream of particle velocities
* *
*/ */
......
#ifndef OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "kernels.h"
#include "BrookPlatform.h"
#include "BrookBondParameters.h"
#include "OpenMMBrookInterface.h"
namespace OpenMM {
/**
* This kernel is invoked to calculate the harmonic angle forces acting on the system.
*/
class BrookCalcHarmonicLJ14ForceKernel : public CalcHarmonicLJ14ForceKernel {
public:
/**
* BrookCalcHarmonicLJ14ForceKernel constructor
*/
BrookCalcHarmonicLJ14ForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system );
/**
* BrookCalcHarmonicLJ14ForceKernel destructor
*/
~BrookCalcHarmonicLJ14ForceKernel();
/**
* Initialize the kernel, setting up the values to calculate harmonic bond force & energy
*
* @param system System reference
* @param force HarmonicLJ14Force reference
*
*/
void initialize( const System& system, const HarmonicLJ14Force& force );
/**
* Execute the kernel to calculate the forces.
*
* @param positions atom coordiantes
* @param forces output forces
*
*/
void executeForces( OpenMMContextImpl& context );
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
*
* @return potential energy associated with the harmonic angle force
*
*/
double executeEnergy( OpenMMContextImpl& context );
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
int setLog( FILE* log );
/*
* Get contents of object
*
* @param level of dump
*
* @return string containing contents
*
* */
std::string getContents( int level ) const;
/**
* Get log file reference
*
* @return log file reference
*
*/
FILE* getLog( void ) const;
/**
* Get number of bonds
*
* @return number of bonds
*
*/
int getNumberOfBonds( void ) const;
/**
* Get indices/parameters
*
* @return BrookBondParameters containing atom indices/parameters
*
*/
BrookBondParameters* getBrookBondParameters( void ) const;
private:
static const int NumberOfAtomsInBond = 3;
static const int NumberOfParametersInBond = 2;
// bond name
static const std::string BondName;
// log file reference
FILE* _log;
// Brook bond parameters
BrookBondParameters* _brookBondParameters;
// interface
OpenMMBrookInterface& _openMMBrookInterface;
// System reference
System& _system;
};
} // namespace OpenMM
#endif /* OPENMM_BROOK_CALC_LJ14_FORCE_KERNEL_H_ */
...@@ -29,39 +29,50 @@ ...@@ -29,39 +29,50 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. * * USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include <cmath>
#include <limits>
#include "OpenMMException.h" #include "OpenMMException.h"
#include <sstream> #include <sstream>
#include "BrookCalcProperDihedralForceKernel.h"
#include "BrookStreamImpl.h"
#include "BrookCalcNonbondedForceKernel.h"
#include "NonbondedForce.h"
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
const std::string BrookCalcProperDihedralForceKernel::BondName = "ProperDihedral"; const std::string BrookCalcNonbondedForceKernel::BondName = "LJ14";
/** /**
* BrookCalcProperDihedralForceKernel constructor * BrookCalcNonbondedForceKernel constructor
* *
* @param name kernel name * @param name kernel name
* @param platform platform * @param platform platform
* @param OpenMMBrookInterface OpenMM-Brook interface
* @param System System reference
* *
*/ */
BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel( std::string name, const Platform& platform, BrookCalcNonbondedForceKernel::BrookCalcNonbondedForceKernel( std::string name, const Platform& platform,
OpenMMBrookInterface& openMMBrookInterface, System& system ) : OpenMMBrookInterface& openMMBrookInterface, System& system ) :
CalcProperDihedralForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){ CalcNonbondedForceKernel( name, platform ), _openMMBrookInterface( openMMBrookInterface ), _system( system ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel"; // static const std::string methodName = "BrookCalcNonbondedForceKernel::BrookCalcNonbondedForceKernel";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
_numberOfParticles = 0;
_brookNonBonded = NULL;
_brookBondParameters = NULL; _brookBondParameters = NULL;
_log = NULL; _log = NULL;
_refForceField = NULL;
_refSystem = NULL;
_refOpenMMContext = NULL;
_referencePlatform = NULL;
_refVerletIntegrator = NULL;
const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform); const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform);
if( brookPlatform.getLog() != NULL ){ if( brookPlatform.getLog() != NULL ){
setLog( brookPlatform.getLog() ); setLog( brookPlatform.getLog() );
...@@ -70,20 +81,30 @@ BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel( std::str ...@@ -70,20 +81,30 @@ BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel( std::str
} }
/** /**
* BrookCalcProperDihedralForceKernel destructor * BrookCalcNonbondedForceKernel destructor
* *
*/ */
BrookCalcProperDihedralForceKernel::~BrookCalcProperDihedralForceKernel( ){ BrookCalcNonbondedForceKernel::~BrookCalcNonbondedForceKernel( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCalcProperDihedralForceKernel::BrookCalcProperDihedralForceKernel"; // static const std::string methodName = "BrookCalcNonbondedForceKernel::BrookCalcNonbondedForceKernel";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
delete _brookBondParameters; //delete _brookBondParameters;
delete _brookNonBonded;
// deleted w/ kernel delete? If activated, program crashes
//delete _refForceField;
/*
delete _refSystem;
delete _refOpenMMContext;
delete _referencePlatform;
delete _refVerletIntegrator;
*/
} }
/** /**
...@@ -93,7 +114,7 @@ BrookCalcProperDihedralForceKernel::~BrookCalcProperDihedralForceKernel( ){ ...@@ -93,7 +114,7 @@ BrookCalcProperDihedralForceKernel::~BrookCalcProperDihedralForceKernel( ){
* *
*/ */
FILE* BrookCalcProperDihedralForceKernel::getLog( void ) const { FILE* BrookCalcNonbondedForceKernel::getLog( void ) const {
return _log; return _log;
} }
...@@ -106,24 +127,98 @@ FILE* BrookCalcProperDihedralForceKernel::getLog( void ) const { ...@@ -106,24 +127,98 @@ FILE* BrookCalcProperDihedralForceKernel::getLog( void ) const {
* *
*/ */
int BrookCalcProperDihedralForceKernel::setLog( FILE* log ){ int BrookCalcNonbondedForceKernel::setLog( FILE* log ){
_log = log; _log = log;
return BrookCommon::DefaultReturnValue; return BrookCommon::DefaultReturnValue;
} }
/**
* Set log file reference
*
* @param log file reference
*
* @return DefaultReturnValue
*
*/
void BrookCalcNonbondedForceKernel::initialize( const System& system, const NonbondedForce& force, const std::vector<std::set<int> >& exclusions ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcNonbondedForceKernel::initialize";
// ---------------------------------------------------------------------------------------
FILE* log = getLog();
_numberOfParticles = force.getNumParticles();
/*
nonbondedMethod = CalcNonbondedForceKernel::NonbondedMethod(force.getNonbondedMethod());
nonbondedCutoff = (RealOpenMM) force.getCutoffDistance();
Vec3 boxVectors[3];
force.getPeriodicBoxVectors(boxVectors[0], boxVectors[1], boxVectors[2]);
periodicBoxSize[0] = (RealOpenMM) boxVectors[0][0];
periodicBoxSize[1] = (RealOpenMM) boxVectors[1][1];
periodicBoxSize[2] = (RealOpenMM) boxVectors[2][2];
if (nonbondedMethod == NoCutoff)
neighborList = NULL;
else
neighborList = new NeighborList();
*/
// ---------------------------------------------------------------------------------------
// nonbonded
if( _brookNonBonded ){
delete _brookNonBonded;
}
_brookNonBonded = new BrookNonBonded();
_brookNonBonded->setLog( log );
// charge & LJ parameters
std::vector<std::vector<double> > nonbondedParameters;
for( int ii = 0; ii < _numberOfParticles; ii++ ){
double charge, radius, depth;
force.getParticleParameters( ii, charge, radius, depth );
std::vector<double> particleParamArray;
nonbondedParameters[ii] = particleParamArray;
particleParamArray[0] = radius;
particleParamArray[1] = depth;
particleParamArray[2] = charge;
}
_brookNonBonded->setup( _numberOfParticles, nonbondedParameters, exclusions, getPlatform() );
_openMMBrookInterface.setTriggerForceKernel( this );
_openMMBrookInterface.setTriggerEnergyKernel( this );
// echo contents
if( log ){
std::string contents = _brookNonBonded->getContentsString( );
(void) fprintf( log, "%s brookNonBonded::contents\n%s", methodName.c_str(), contents.c_str() );
(void) fflush( log );
}
// nonbonded 14 ixns
initialize14Interactions( system, force );
}
/** /**
* Initialize the kernel, setting up the values of all the force field parameters. * Initialize the kernel, setting up the values of all the force field parameters.
* *
* @param system System reference * @param system System reference
* @param force ProperDihedralForce reference * @param force HarmonicLJ14Force reference
* *
*/ */
void BrookCalcProperDihedralForceKernel::initialize( const System& system, const ProperDihedralForce& force ){ void BrookCalcNonbondedForceKernel::initialize14Interactions( const System& system, const NonbondedForce& force ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcProperDihedralForceKernel::initialize"; static const std::string methodName = "BrookCalcNonbondedForceKernel::initialize14Interactions";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -131,59 +226,54 @@ void BrookCalcProperDihedralForceKernel::initialize( const System& system, const ...@@ -131,59 +226,54 @@ void BrookCalcProperDihedralForceKernel::initialize( const System& system, const
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing atom indices/parameters // create _brookBondParameters object containing particle indices/parameters
int numberOfBonds = force.getNumAngles(); int numberOf14Forces = force.getNumNonbonded14();
if( _brookBondParameters ){ //delete _brookBondParameters;
delete _brookBondParameters; _brookBondParameters = new BrookBondParameters( BondName, NumberOfParticlesInBond, NumberOfParametersInBond, numberOf14Forces, getLog() );
}
_brookBondParameters = new BrookBondParameters( BondName, NumberOfAtomsInBond, NumberOfParametersInBond, numberOfBonds, getLog() );
for( int ii = 0; ii < numberOfBonds; ii++ ){ for( int ii = 0; ii < numberOf14Forces; ii++ ){
int particle1, particle2, particle3; int particle1, particle2;
double angle, k; double charge, radius, depth;
int particles[NumberOfAtomsInBond]; int particles[NumberOfParticlesInBond];
double parameters[NumberOfParametersInBond]; double parameters[NumberOfParametersInBond];
force.getAngleParameters( ii, particle1, particle2, particle3, angle, k ); force.getNonbonded14Parameters( ii, particle1, particle2, charge, radius, depth );
particles[0] = particle1; particles[0] = particle1;
particles[1] = particle2; particles[1] = particle2;
particles[2] = particle3;
parameters[0] = angle; parameters[0] = charge;
parameters[1] = k; parameters[1] = radius;
parameters[2] = depth;
_brookBondParameters->setBond( ii, particles, parameters ); _brookBondParameters->setBond( ii, particles, parameters );
} }
_openMMBrookInterface.setProperDihedralForceParameters( _brookBondParameters ); _openMMBrookInterface.setNonBonded14ForceParameters( _brookBondParameters );
_openMMBrookInterface.setTriggerForceKernel( this );
_openMMBrookInterface.setTriggerEnergyKernel( this );
if( log ){ if( log ){
std::string contents = _brookBondParameters->getContentsString( ); std::string contents = _brookBondParameters->getContentsString( );
(void) fprintf( log, "%s brookGbsa::contents\n%s", methodName.c_str(), contents.c_str() ); (void) fprintf( log, "%s contents:\n%s", methodName.c_str(), contents.c_str() );
(void) fflush( log ); (void) fflush( log );
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
} }
/** /**
* Compute forces given atom coordinates * Execute the kernel to calculate the nonbonded forces
* *
* @param context OpenMMContextImpl context * @param context OpenMMContextImpl context
* *
*/ */
void BrookCalcProperDihedralForceKernel::executeForces( OpenMMContextImpl& context ){ void BrookCalcNonbondedForceKernel::executeForces( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcProperDihedralForceKernel::executeForces"; static const std::string methodName = "BrookCalcNonbondedForceKernel::executeForces";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -191,25 +281,24 @@ void BrookCalcProperDihedralForceKernel::executeForces( OpenMMContextImpl& conte ...@@ -191,25 +281,24 @@ void BrookCalcProperDihedralForceKernel::executeForces( OpenMMContextImpl& conte
_openMMBrookInterface.computeForces( context ); _openMMBrookInterface.computeForces( context );
} }
return;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
} }
/** /**
* Execute the kernel to calculate the energy * Execute the kernel to calculate the energy.
* *
* @param context OpenMMContextImpl context * @param context OpenMMContextImpl context
* *
* @return potential energy * @return potential energy due to the NonbondedForce
* Currently always return 0.0 since energies not calculated on gpu
* *
*/ */
double BrookCalcProperDihedralForceKernel::executeEnergy( OpenMMContextImpl& context ){ double BrookCalcNonbondedForceKernel::executeEnergy( OpenMMContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcProperDihedralForceKernel::executeEnergy"; //static const std::string methodName = "BrookCalcNonbondedForceKernel::executeEnergy";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -220,3 +309,35 @@ double BrookCalcProperDihedralForceKernel::executeEnergy( OpenMMContextImpl& con ...@@ -220,3 +309,35 @@ double BrookCalcProperDihedralForceKernel::executeEnergy( OpenMMContextImpl& con
} }
} }
/**
* Get reference Context
*
* @param numberOfParticles number of particles
*
* @return OpenMMContext
*
*/
OpenMMContext* BrookCalcNonbondedForceKernel::getReferenceOpenMMContext( int numberOfParticles ){
// ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookCalcNonbondedForceKernel::getReferenceOpenMMContext";
// ---------------------------------------------------------------------------------------
if( _refOpenMMContext == NULL ){
_referencePlatform = new ReferencePlatform();
_refSystem = new System( numberOfParticles, 0 );
_refVerletIntegrator = new VerletIntegrator( 0.01 );
_refSystem->addForce( _refForceField );
_refOpenMMContext = new OpenMMContext( *_refSystem, *_refVerletIntegrator, *_referencePlatform );
}
return _refOpenMMContext;
}
#ifndef OPENMM_BROOK_CALC_STANDARD_MM_FORCEFIELD_KERNEL_H_ #ifndef OPENMM_BROOK_CALC_NONBONDED_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_STANDARD_MM_FORCEFIELD_KERNEL_H_ #define OPENMM_BROOK_CALC_NONBONDED_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- * /* -------------------------------------------------------------------------- *
* OpenMM * * OpenMM *
...@@ -33,14 +33,9 @@ ...@@ -33,14 +33,9 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "kernels.h" #include "kernels.h"
#include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h" //#include "../../reference/src/SimTKUtilities/SimTKOpenMMRealType.h"
#include "BrookBonded.h" #include "OpenMMBrookInterface.h"
#include "BrookNonBonded.h"
#include "NonbondedForce.h" #include "NonbondedForce.h"
#include "OpenMMContext.h"
#include "System.h"
#include "ReferencePlatform.h"
#include "VerletIntegrator.h"
namespace OpenMM { namespace OpenMM {
...@@ -51,57 +46,53 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel { ...@@ -51,57 +46,53 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
public: public:
BrookCalcNonbondedForceKernel( std::string name, const Platform& platform ); BrookCalcNonbondedForceKernel( std::string name, const Platform& platform, OpenMMBrookInterface& openMMBrookInterface, System& system );
~BrookCalcNonbondedForceKernel(); ~BrookCalcNonbondedForceKernel();
/** /**
* Initialize the kernel, setting up the values of all the force field parameters. * Initialize the kernel
* *
* @param bondIndices the two atoms connected by each bond term * @param system the System this kernel will be applied to
* @param bondParameters the force parameters (length, k) for each bond term * @param force the NonbondedForce this kernel will be used for
* @param angleIndices the three atoms connected by each angle term * @param exclusions the i'th element lists the indices of all particles with which the i'th particle should not interact through
* @param angleParameters the force parameters (angle, k) for each angle term
* @param periodicTorsionIndices the four atoms connected by each periodic torsion term
* @param periodicTorsionParameters the force parameters (k, phase, periodicity) for each periodic torsion term
* @param rbTorsionIndices the four atoms connected by each Ryckaert-Bellemans torsion term
* @param rbTorsionParameters the coefficients (in order of increasing powers) for each Ryckaert-Bellemans torsion term
* @param bonded14Indices each element contains the indices of two atoms whose nonbonded interactions should be reduced since
* they form a bonded 1-4 pair
* @param lj14Scale the factor by which van der Waals interactions should be reduced for bonded 1-4 pairs
* @param coulomb14Scale the factor by which Coulomb interactions should be reduced for bonded 1-4 pairs
* @param exclusions the i'th element lists the indices of all atoms with which the i'th atom should not interact through
* nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from * nonbonded forces. Bonded 1-4 pairs are also included in this list, since they should be omitted from
* the standard nonbonded calculation. * the standard nonbonded calculation.
* @param nonbondedParameters the nonbonded force parameters (charge, sigma, epsilon) for each atom */
* @param nonbondedMethod the method to use for handling long range nonbonded interactions
* @param nonbondedCutoff the cutoff distance for nonbonded interactions (if nonbondedMethod involves a cutoff) void initialize( const System& system, const NonbondedForce& force, const std::vector<std::set<int> >& exclusions );
* @param periodicBoxSize the size of the periodic box (if nonbondedMethod involves a periodic boundary conditions)
/**
* Initialize the 14 ixns
* *
* @param system the System this kernel will be applied to
* @param force the NonbondedForce this kernel will be used for
*/ */
void initialize( const std::vector<std::vector<int> >& bondIndices, const std::vector<std::vector<double> >& bondParameters, void initialize14Interactions( const System& system, const NonbondedForce& force );
const std::vector<std::vector<int> >& angleIndices, const std::vector<std::vector<double> >& angleParameters,
const std::vector<std::vector<int> >& periodicTorsionIndices, const std::vector<std::vector<double> >& periodicTorsionParameters,
const std::vector<std::vector<int> >& rbTorsionIndices, const std::vector<std::vector<double> >& rbTorsionParameters,
const std::vector<std::vector<int> >& bonded14Indices, double lj14Scale, double coulomb14Scale,
const std::vector<std::set <int> >& exclusions, const std::vector<std::vector<double> >& nonbondedParameters,
NonbondedMethod nonbondedMethod, double nonbondedCutoff, double periodicBoxSize[3] );
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces.
* *
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom * @param positions a Stream of type Double3 containing the position (x, y, z) of each particle
* @param forces a Stream of type Double3 containing the force (x, y, z) on each atom. On entry, this contains the forces that * @param forces a Stream of type Double3 containing the force (x, y, z) on each particle. On entry, this contains the forces that
* have been calculated so far. The kernel should add its own forces to the values already in the stream. * have been calculated so far. The kernel should add its own forces to the values already in the stream.
*/ */
void executeForces( const Stream& positions, Stream& forces ); void executeForces( const Stream& positions, Stream& forces );
/**
* Execute the kernel to calculate the forces.
*
* @param context the context in which to execute this kernel
*/
void executeForces( OpenMMContextImpl& context );
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param positions a Stream of type Double3 containing the position (x, y, z) of each atom * @param positions a Stream of type Double3 containing the position (x, y, z) of each particle
* *
* @return the potential energy due to the NonbondedForce * @return the potential energy due to the NonbondedForce
* *
...@@ -109,19 +100,26 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel { ...@@ -109,19 +100,26 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
*/ */
double executeEnergy( const Stream& positions ); double executeEnergy( const Stream& positions );
double executeEnergyOld( const Stream& positions );
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the NonbondedForce
*/
double executeEnergy( OpenMMContextImpl& context );
/** /**
* Get reference Context * Get reference Context
* *
* @param numberOfAtoms number of atoms * @param numberOfParticles number of particles
* *
* @return OpenMMContext * @return OpenMMContext
* *
*/ */
OpenMMContext* getReferenceOpenMMContext( int numberOfAtoms ); OpenMMContext* getReferenceOpenMMContext( int numberOfParticles );
/** /**
* Set log file reference * Set log file reference
...@@ -156,19 +154,30 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel { ...@@ -156,19 +154,30 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
private: private:
// LJ14 'bond' name
static const std::string BondName;
static const int NumberOfParticlesInBond = 2;
static const int NumberOfParametersInBond = 3;
// log file reference // log file reference
FILE* _log; FILE* _log;
// number of atoms // number of particles
int _numberOfAtoms; int _numberOfParticles;
// Brook bonded & nonbonded // Brook nonbonded
BrookBonded* _brookBonded;
BrookNonBonded* _brookNonBonded; BrookNonBonded* _brookNonBonded;
OpenMMBrookInterface& _openMMBrookInterface;
System& _system;
BrookBondParameters* _brookBondParameters;
// used to calculate energy // used to calculate energy
NonbondedForce* _refForceField; NonbondedForce* _refForceField;
...@@ -181,4 +190,4 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel { ...@@ -181,4 +190,4 @@ class BrookCalcNonbondedForceKernel : public CalcNonbondedForceKernel {
} // namespace OpenMM } // namespace OpenMM
#endif /* OPENMM_BROOK_CALC_STANDARD_MM_FORCEFIELD_KERNEL_H_ */ #endif /* OPENMM_BROOK_CALC_NONBONDED_FORCE_KERNEL_H_ */
...@@ -131,21 +131,21 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons ...@@ -131,21 +131,21 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing atom indices/parameters // create _brookBondParameters object containing particle indices/parameters
int numberOfBonds = force.getNumTorsions(); int numberOfBonds = force.getNumTorsions();
if( _brookBondParameters ){ if( _brookBondParameters ){
delete _brookBondParameters; delete _brookBondParameters;
} }
_brookBondParameters = new BrookBondParameters( BondName, NumberOfAtomsInBond, NumberOfParametersInBond, numberOfBonds, getLog() ); _brookBondParameters = new BrookBondParameters( BondName, NumberOfParticlesInBond, NumberOfParametersInBond, numberOfBonds, getLog() );
for( int ii = 0; ii < numberOfBonds; ii++ ){ for( int ii = 0; ii < numberOfBonds; ii++ ){
int particle1, particle2, particle3, particle4, periodicity; int particle1, particle2, particle3, particle4, periodicity;
double phase, k; double phase, k;
int particles[NumberOfAtomsInBond]; int particles[NumberOfParticlesInBond];
double parameters[NumberOfParametersInBond]; double parameters[NumberOfParametersInBond];
force.getTorsionParameters( ii, particle1, particle2, particle3, particle4, periodicity, phase, k ); force.getTorsionParameters( ii, particle1, particle2, particle3, particle4, periodicity, phase, k );
...@@ -175,7 +175,7 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons ...@@ -175,7 +175,7 @@ void BrookCalcPeriodicTorsionForceKernel::initialize( const System& system, cons
} }
/** /**
* Compute forces given atom coordinates * Compute forces given particle coordinates
* *
* @param context OpenMMContextImpl context * @param context OpenMMContextImpl context
* *
......
#ifndef OPENMM_BROOK_CALC_PROPER_DIHEDRAL_FORCE_KERNEL_H_ #ifndef OPENMM_BROOK_CALC_PERIODIC_TORSION_FORCE_KERNEL_H_
#define OPENMM_BROOK_CALC_PROPER_DIHEDRAL_FORCE_KERNEL_H_ #define OPENMM_BROOK_CALC_PERIODIC_TORSION_FORCE_KERNEL_H_
/* -------------------------------------------------------------------------- * /* -------------------------------------------------------------------------- *
* OpenMM * * OpenMM *
...@@ -72,7 +72,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne ...@@ -72,7 +72,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces.
* *
* @param positions atom coordiantes * @param positions particle coordiantes
* @param forces output forces * @param forces output forces
* *
*/ */
...@@ -133,7 +133,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne ...@@ -133,7 +133,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
/** /**
* Get indices/parameters * Get indices/parameters
* *
* @return BrookBondParameters containing atom indices/parameters * @return BrookBondParameters containing particle indices/parameters
* *
*/ */
...@@ -141,7 +141,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne ...@@ -141,7 +141,7 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
private: private:
static const int NumberOfAtomsInBond = 4; static const int NumberOfParticlesInBond = 4;
static const int NumberOfParametersInBond = 3; static const int NumberOfParametersInBond = 3;
// bond name // bond name
...@@ -169,4 +169,4 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne ...@@ -169,4 +169,4 @@ class BrookCalcPeriodicTorsionForceKernel : public CalcPeriodicTorsionForceKerne
} // namespace OpenMM } // namespace OpenMM
#endif /* OPENMM_BROOK_CALC_PROPER_DIHEDRAL_FORCE_KERNEL_H_ */ #endif /* OPENMM_BROOK_CALC_PERIODIC_TORSION_FORCE_KERNEL_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