Commit 170e493a authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Added Brownian dynamics code (including kernels); renamed StochasticDynamics LangevinDynamics

Added license to kernel and kernel include files
parent d3614c8b
This diff is collapsed.
#ifndef OPENMM_BROOK_BROWNIAN_DYNAMCIS_H_
#define OPENMM_BROOK_BROWNIAN_DYNAMCIS_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 <vector>
#include <set>
#include "BrookFloatStreamInternal.h"
#include "BrookShakeAlgorithm.h"
#include "BrookRandomNumberGenerator.h"
#include "BrookPlatform.h"
#include "BrookCommon.h"
namespace OpenMM {
/**
*
* Encapsulates stochastic dynamics algorithm
*
*/
class BrookBrownianDynamics : public BrookCommon {
public:
/**
* Constructor
*
*/
BrookBrownianDynamics( );
/**
* Destructor
*
*/
~BrookBrownianDynamics();
/**
* Get tau
*
* @return tau
*/
BrookOpenMMFloat getTau( void ) const;
/**
* Get friction
*
* @return friction
*/
BrookOpenMMFloat getFriction( void ) const;
/**
* Get temperature
*
* @return temperature
*/
BrookOpenMMFloat getTemperature( void ) const;
/**
* Get step size
*
* @return step size
*/
BrookOpenMMFloat getStepSize( void ) const;
/**
* Get noise amplitude
*
* @return noise amplitude
*/
BrookOpenMMFloat getNoiseAmplitude( void ) const;
/**
* Get force scale
*
* @return force scale
*/
BrookOpenMMFloat getForceScale( void ) const;
/**
* Get BrownianDynamics atom stream width
*
* @return atom stream width
*/
int getBrownianDynamicsAtomStreamWidth( void ) const;
/**
* Get BrownianDynamics atom stream height
*
* @return atom stream height
*/
int getBrownianDynamicsAtomStreamHeight( void ) const;
/**
* Get BrownianDynamics atom stream size
*
* @return atom stream size
*/
int getBrownianDynamicsAtomStreamSize( void ) const;
/**
* Update parameters
*
* @param temperature temperature
* @param friction friction
* @param step size step size
*
* @return DefaultReturnValue
*
*/
int updateParameters( double temperature, double friction, double stepSize );
/**
* Update
*
* @param positions atom positions
* @param velocities atom velocities
* @param forces atom forces
* @param brookShakeAlgorithm BrookShakeAlgorithm reference
* @param brookRandomNumberGenerator BrookRandomNumberGenerator reference
*
* @return DefaultReturnValue
*
*/
int update( Stream& positions, Stream& velocities,
const Stream& forces, BrookShakeAlgorithm& brookShakeAlgorithm,
BrookRandomNumberGenerator& brookRandomNumberGenerator );
/**
* Get array of BrownianDynamics streams
*
* @return array ofstreams
*
*/
BrookFloatStreamInternal** getStreams( void );
/*
* Setup of BrownianDynamics parameters
*
* @param masses atom masses
* @param platform Brook platform
*
* @return ErrorReturnValue value if error, else DefaultReturnValue
*
* */
int setup( const std::vector<double>& masses, const Platform& platform );
/*
* Get contents of object
*
* @param level of dump
*
* @return string containing contents
*
* */
std::string getContentsString( int level = 0 ) const;
/**
* Get X-prime stream
*
* @return X-prime stream
*
*/
BrookFloatStreamInternal* getXPrimeStream( void ) const;
/**
* Get inverse sqrt masses
*
* @return inverse sqrt masses stream
*
*/
BrookFloatStreamInternal* getInverseMassStream( void ) const;
private:
// streams indices
enum BrookBrownianDynamicsStreams {
VPrimeStream,
XPrimeStream,
InverseMassStream,
LastStreamIndex
};
// randomNumberSeed
unsigned int _randomNumberSeed;
BrookOpenMMFloat _tau;
BrookOpenMMFloat _temperature;
BrookOpenMMFloat _stepSize;
BrookOpenMMFloat _forceScale;
BrookOpenMMFloat _noiseAmplitude;
// Atom stream dimensions
int _bdAtomStreamWidth;
int _bdAtomStreamHeight;
int _bdAtomStreamSize;
/*
* Update streams
*
* @return DefaultReturn
*
*/
int _updateStreams( void );
// inverse sqrt masses
BrookOpenMMFloat* _inverseSqrtMasses;
// internal streams
BrookFloatStreamInternal* _streams[LastStreamIndex];
/**
* Set tau
*
* @param tau new tau value
*
* @return DefaultReturn
*
*/
int _setTau( BrookOpenMMFloat tau );
/**
* Set friction = 1/tau
*
* @param friction new friction value
*
* @return DefaultReturn
*
*/
int _setFriction( BrookOpenMMFloat friction );
/**
* Set temperature
*
* @parameter temperature
*
* @return DefaultReturn
*
*/
int _setTemperature( BrookOpenMMFloat temperature );
/**
* Set stepSize
*
* @param stepSize
*
* @return DefaultReturn
*
*/
int _setStepSize( BrookOpenMMFloat stepSize );
/**
* Set force scale
*
* @return DefaultReturn
*
*/
int _setForceScale( void );
/**
* Set noise amplitude
*
* @return DefaultReturn
*
*/
int _setNoiseAmplitude( void );
/*
* Setup of stream dimensions
*
* @param atomStreamSize atom stream size
* @param atomStreamWidth atom stream width
*
* @return ErrorReturnValue if error, else DefaultReturnValue
*
* */
int _initializeStreamSizes( int atomStreamSize, int atomStreamWidth );
/**
* Initialize stream dimensions
*
* @param numberOfAtoms number of atoms
* @param platform platform
*
* @return ErrorReturnValue if error, else DefaultReturnValue
*
*/
int _initializeStreamSizes( int numberOfAtoms, const Platform& platform );
/**
* Initialize stream dimensions and streams
*
* @param platform platform
*
* @return nonzero value if error
*
*/
int _initializeStreams( const Platform& platform );
/**
* Set masses
*
* @param masses atomic masses
*
*/
int _setInverseSqrtMasses( const std::vector<double>& masses );
};
} // namespace OpenMM
#endif /* OPENMM_BROOK_BROWNIAN_DYNAMCIS_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 *
* 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 "BrookIntegrateBrownianStepKernel.h"
#include "BrookStreamInternal.h"
using namespace OpenMM;
using namespace std;
/**
* BrookIntegrateBrownianStepKernel constructor
*
* @param name name of the stream to create
* @param platform platform
*
*/
BrookIntegrateBrownianStepKernel::BrookIntegrateBrownianStepKernel( std::string name, const Platform& platform ) :
IntegrateBrownianStepKernel( name, platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookIntegrateBrownianStepKernel::BrookIntegrateBrownianStepKernel";
// ---------------------------------------------------------------------------------------
_brookBrownianDynamics = NULL;
_brookShakeAlgorithm = NULL;
_brookRandomNumberGenerator = NULL;
}
/**
* BrookIntegrateVerletStepKernel destructor
*
*/
BrookIntegrateBrownianStepKernel::~BrookIntegrateBrownianStepKernel( ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookIntegrateBrownianStepKernel::~BrookIntegrateBrownianStepKernel";
// ---------------------------------------------------------------------------------------
delete _brookBrownianDynamics;
delete _brookShakeAlgorithm;
delete _brookRandomNumberGenerator;
}
/**
* Initialize the kernel, setting up all parameters related to integrator.
*
* @param masses the mass of each atom
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths the required distance between each pair of constrained atoms
*
*/
void BrookIntegrateBrownianStepKernel::initialize( const vector<double>& masses,
const vector<vector<int> >& constraintIndices,
const vector<double>& constraintLengths ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookIntegrateBrownianStepKernel::initialize";
// ---------------------------------------------------------------------------------------
_brookBrownianDynamics = new BrookBrownianDynamics( );
_brookBrownianDynamics->setup( masses, getPlatform() );
_brookShakeAlgorithm = new BrookShakeAlgorithm( );
_brookShakeAlgorithm->setup( masses, constraintIndices, constraintLengths, getPlatform() );
// assert( (_brookShakeAlgorithm->getNumberOfConstraints() > 0) );
_brookRandomNumberGenerator = new BrookRandomNumberGenerator( );
_brookRandomNumberGenerator->setup( (int) masses.size(), getPlatform() );
_brookRandomNumberGenerator->setVerbosity( 1 );
}
/**
* Execute kernel
*
* @param positions atom coordinates
* @param velocities atom velocities
* @param forces atom forces
* @param temperature heat bath temperature
* @param friction friction coefficient coupling the system to the heat bath
* @param stepSize integration step size
*
*/
void BrookIntegrateBrownianStepKernel::execute( Stream& positions, Stream& velocities,
const Stream& forces, double temperature,
double friction, double stepSize ){
// ---------------------------------------------------------------------------------------
double epsilon = 1.0e-04;
static const std::string methodName = "BrookIntegrateBrownianStepKernel::execute";
// ---------------------------------------------------------------------------------------
// first time through initialize _brookBrownianDynamics
// for each subsequent call, check if parameters need to be updated due to a change
// in T, gamma, or the step size
// take step
double differences[3];
differences[0] = temperature - (double) _brookBrownianDynamics->getTemperature();
differences[1] = friction - (double) _brookBrownianDynamics->getFriction();
differences[2] = stepSize - (double) _brookBrownianDynamics->getStepSize();
if( fabs( differences[0] ) > epsilon || fabs( differences[1] ) > epsilon || fabs( differences[2] ) > epsilon ){
//printf( "%s calling updateParameters\n", methodName.c_str() );
_brookBrownianDynamics->updateParameters( temperature, friction, stepSize );
} else {
//printf( "%s NOT calling updateParameters\n", methodName.c_str() );
}
_brookBrownianDynamics->update( positions, velocities, forces, *_brookShakeAlgorithm, *_brookRandomNumberGenerator );
}
#ifndef OPENMM_BROOK_INTEGRATE_BROWNIAN_STEP_KERNEL_H_
#define OPENMM_BROOK_INTEGRATE_BROWNIAN_STEP_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 "BrookBrownianDynamics.h"
#include "BrookShakeAlgorithm.h"
#include "BrookRandomNumberGenerator.h"
namespace OpenMM {
/**
* This is the base class of Float and Double streams in the Brook Platform.
*/
class BrookIntegrateBrownianStepKernel : public IntegrateBrownianStepKernel {
public:
// return values
static const int DefaultReturnValue = 0;
static const int ErrorReturnValue = -1;
/**
* BrookIntegrateBrownianStepKernel constructor
*
* @param name name of the stream to create
* @param platform platform
*
*/
BrookIntegrateBrownianStepKernel( std::string name, const Platform& platform );
/**
* BrookIntegrateBrownianStepKernel destructor
*
*/
~BrookIntegrateBrownianStepKernel();
/**
* Initialize the kernel, setting up all parameters related to integrator.
*
* @param masses atom masses
* @param constraintIndices each element contains the indices of two atoms whose distance should be constrained
* @param constraintLengths required distance between each pair of constrained atoms
*/
void initialize( const std::vector<double>& masses, const std::vector<std::vector<int> >& constraintIndices,
const std::vector<double>& constraintLengths );
/**
* Execute kernel
*
* @param positions coordinates
* @param velocities velocities
* @param forces forces
* @param temperature heat bath temperature
* @param friction friction coefficient coupling the system to the heat bath
* @param stepSize step size
*
*/
void execute( Stream& positions, Stream& velocities, const Stream& forces, double temperature, double friction, double stepSize );
protected:
BrookBrownianDynamics* _brookBrownianDynamics;
BrookShakeAlgorithm* _brookShakeAlgorithm;
BrookRandomNumberGenerator* _brookRandomNumberGenerator;
};
} // namespace OpenMM
#endif /* OPENMM_BROOK_INTEGRATE_BROWNIAN_STEP_KERNEL_H_ */
...@@ -52,7 +52,7 @@ BrookIntegrateLangevinStepKernel::BrookIntegrateLangevinStepKernel( std::string ...@@ -52,7 +52,7 @@ BrookIntegrateLangevinStepKernel::BrookIntegrateLangevinStepKernel( std::string
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
_brookStochasticDynamics = NULL; _brookLangevinDynamics = NULL;
_brookShakeAlgorithm = NULL; _brookShakeAlgorithm = NULL;
_brookRandomNumberGenerator = NULL; _brookRandomNumberGenerator = NULL;
...@@ -71,7 +71,7 @@ BrookIntegrateLangevinStepKernel::~BrookIntegrateLangevinStepKernel( ){ ...@@ -71,7 +71,7 @@ BrookIntegrateLangevinStepKernel::~BrookIntegrateLangevinStepKernel( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
delete _brookStochasticDynamics; delete _brookLangevinDynamics;
delete _brookShakeAlgorithm; delete _brookShakeAlgorithm;
delete _brookRandomNumberGenerator; delete _brookRandomNumberGenerator;
...@@ -96,8 +96,8 @@ void BrookIntegrateLangevinStepKernel::initialize( const vector<double>& masses, ...@@ -96,8 +96,8 @@ void BrookIntegrateLangevinStepKernel::initialize( const vector<double>& masses,
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
_brookStochasticDynamics = new BrookStochasticDynamics( ); _brookLangevinDynamics = new BrookLangevinDynamics( );
_brookStochasticDynamics->setup( masses, getPlatform() ); _brookLangevinDynamics->setup( masses, getPlatform() );
_brookShakeAlgorithm = new BrookShakeAlgorithm( ); _brookShakeAlgorithm = new BrookShakeAlgorithm( );
_brookShakeAlgorithm->setup( masses, constraintIndices, constraintLengths, getPlatform() ); _brookShakeAlgorithm->setup( masses, constraintIndices, constraintLengths, getPlatform() );
...@@ -132,7 +132,7 @@ void BrookIntegrateLangevinStepKernel::execute( Stream& positions, Stream& veloc ...@@ -132,7 +132,7 @@ void BrookIntegrateLangevinStepKernel::execute( Stream& positions, Stream& veloc
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// first time through initialize _brookStochasticDynamics // first time through initialize _brookLangevinDynamics
// for each subsequent call, check if parameters need to be updated due to a change // for each subsequent call, check if parameters need to be updated due to a change
// in T, gamma, or the step size // in T, gamma, or the step size
...@@ -140,16 +140,16 @@ void BrookIntegrateLangevinStepKernel::execute( Stream& positions, Stream& veloc ...@@ -140,16 +140,16 @@ void BrookIntegrateLangevinStepKernel::execute( Stream& positions, Stream& veloc
// take step // take step
double differences[3]; double differences[3];
differences[0] = temperature - (double) _brookStochasticDynamics->getTemperature(); differences[0] = temperature - (double) _brookLangevinDynamics->getTemperature();
differences[1] = friction - (double) _brookStochasticDynamics->getFriction(); differences[1] = friction - (double) _brookLangevinDynamics->getFriction();
differences[2] = stepSize - (double) _brookStochasticDynamics->getStepSize(); differences[2] = stepSize - (double) _brookLangevinDynamics->getStepSize();
if( fabs( differences[0] ) > epsilon || fabs( differences[1] ) > epsilon || fabs( differences[2] ) > epsilon ){ if( fabs( differences[0] ) > epsilon || fabs( differences[1] ) > epsilon || fabs( differences[2] ) > epsilon ){
//printf( "%s calling updateParameters\n", methodName.c_str() ); //printf( "%s calling updateParameters\n", methodName.c_str() );
_brookStochasticDynamics->updateParameters( temperature, friction, stepSize ); _brookLangevinDynamics->updateParameters( temperature, friction, stepSize );
} else { } else {
//printf( "%s NOT calling updateParameters\n", methodName.c_str() ); //printf( "%s NOT calling updateParameters\n", methodName.c_str() );
} }
_brookStochasticDynamics->update( positions, velocities, forces, *_brookShakeAlgorithm, *_brookRandomNumberGenerator ); _brookLangevinDynamics->update( positions, velocities, forces, *_brookShakeAlgorithm, *_brookRandomNumberGenerator );
} }
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include "kernels.h" #include "kernels.h"
#include "BrookStochasticDynamics.h" #include "BrookLangevinDynamics.h"
#include "BrookShakeAlgorithm.h" #include "BrookShakeAlgorithm.h"
#include "BrookRandomNumberGenerator.h" #include "BrookRandomNumberGenerator.h"
...@@ -95,7 +95,7 @@ class BrookIntegrateLangevinStepKernel : public IntegrateLangevinStepKernel { ...@@ -95,7 +95,7 @@ class BrookIntegrateLangevinStepKernel : public IntegrateLangevinStepKernel {
protected: protected:
BrookStochasticDynamics* _brookStochasticDynamics; BrookLangevinDynamics* _brookLangevinDynamics;
BrookShakeAlgorithm* _brookShakeAlgorithm; BrookShakeAlgorithm* _brookShakeAlgorithm;
BrookRandomNumberGenerator* _brookRandomNumberGenerator; BrookRandomNumberGenerator* _brookRandomNumberGenerator;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "BrookCalcStandardMMForceFieldKernel.h" #include "BrookCalcStandardMMForceFieldKernel.h"
#include "BrookIntegrateLangevinStepKernel.h" #include "BrookIntegrateLangevinStepKernel.h"
#include "BrookIntegrateVerletStepKernel.h" #include "BrookIntegrateVerletStepKernel.h"
#include "BrookIntegrateBrownianStepKernel.h"
#include "BrookCalcKineticEnergyKernel.h" #include "BrookCalcKineticEnergyKernel.h"
#include "BrookCalcGBSAOBCForceFieldKernel.h" #include "BrookCalcGBSAOBCForceFieldKernel.h"
#include "BrookRemoveCMMotionKernel.h" #include "BrookRemoveCMMotionKernel.h"
...@@ -69,7 +70,7 @@ KernelImpl* BrookKernelFactory::createKernelImpl( std::string name, const Platfo ...@@ -69,7 +70,7 @@ KernelImpl* BrookKernelFactory::createKernelImpl( std::string name, const Platfo
} else if( name == IntegrateBrownianStepKernel::Name() ){ } else if( name == IntegrateBrownianStepKernel::Name() ){
// return new BrookIntegrateBrownianStepKernel( name, platform ); return new BrookIntegrateBrownianStepKernel( name, platform );
// Andersen thermostat // Andersen thermostat
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
#include <sstream> #include <sstream>
#include "BrookStochasticDynamics.h" #include "BrookLangevinDynamics.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "OpenMMException.h" #include "OpenMMException.h"
#include "BrookStreamImpl.h" #include "BrookStreamImpl.h"
...@@ -51,11 +51,11 @@ using namespace std; ...@@ -51,11 +51,11 @@ using namespace std;
* *
*/ */
BrookStochasticDynamics::BrookStochasticDynamics( ){ BrookLangevinDynamics::BrookLangevinDynamics( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookStochasticDynamics::BrookStochasticDynamics"; //static const std::string methodName = "BrookLangevinDynamics::BrookLangevinDynamics";
BrookOpenMMFloat zero = (BrookOpenMMFloat) 0.0; BrookOpenMMFloat zero = (BrookOpenMMFloat) 0.0;
BrookOpenMMFloat one = (BrookOpenMMFloat) 1.0; BrookOpenMMFloat one = (BrookOpenMMFloat) 1.0;
...@@ -100,11 +100,11 @@ BrookStochasticDynamics::BrookStochasticDynamics( ){ ...@@ -100,11 +100,11 @@ BrookStochasticDynamics::BrookStochasticDynamics( ){
* *
*/ */
BrookStochasticDynamics::~BrookStochasticDynamics( ){ BrookLangevinDynamics::~BrookLangevinDynamics( ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookStochasticDynamics::~BrookStochasticDynamics"; //static const std::string methodName = "BrookLangevinDynamics::~BrookLangevinDynamics";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -123,7 +123,7 @@ BrookStochasticDynamics::~BrookStochasticDynamics( ){ ...@@ -123,7 +123,7 @@ BrookStochasticDynamics::~BrookStochasticDynamics( ){
* *
*/ */
BrookOpenMMFloat BrookStochasticDynamics::getTau( void ) const { BrookOpenMMFloat BrookLangevinDynamics::getTau( void ) const {
return _tau; return _tau;
} }
...@@ -134,7 +134,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getTau( void ) const { ...@@ -134,7 +134,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getTau( void ) const {
* *
*/ */
BrookOpenMMFloat BrookStochasticDynamics::getFriction( void ) const { BrookOpenMMFloat BrookLangevinDynamics::getFriction( void ) const {
static const BrookOpenMMFloat zero = (BrookOpenMMFloat) 0.0; static const BrookOpenMMFloat zero = (BrookOpenMMFloat) 0.0;
static const BrookOpenMMFloat one = (BrookOpenMMFloat) 1.0; static const BrookOpenMMFloat one = (BrookOpenMMFloat) 1.0;
return ( (_tau == zero) ? zero : (one/_tau) ); return ( (_tau == zero) ? zero : (one/_tau) );
...@@ -147,7 +147,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getFriction( void ) const { ...@@ -147,7 +147,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getFriction( void ) const {
* *
*/ */
BrookOpenMMFloat BrookStochasticDynamics::getTemperature( void ) const { BrookOpenMMFloat BrookLangevinDynamics::getTemperature( void ) const {
return _temperature; return _temperature;
} }
...@@ -158,7 +158,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getTemperature( void ) const { ...@@ -158,7 +158,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getTemperature( void ) const {
* *
*/ */
BrookOpenMMFloat BrookStochasticDynamics::getStepSize( void ) const { BrookOpenMMFloat BrookLangevinDynamics::getStepSize( void ) const {
return _stepSize; return _stepSize;
} }
...@@ -171,7 +171,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getStepSize( void ) const { ...@@ -171,7 +171,7 @@ BrookOpenMMFloat BrookStochasticDynamics::getStepSize( void ) const {
* *
*/ */
int BrookStochasticDynamics::_setTau( BrookOpenMMFloat tau ){ int BrookLangevinDynamics::_setTau( BrookOpenMMFloat tau ){
_tau = tau; _tau = tau;
return DefaultReturnValue; return DefaultReturnValue;
} }
...@@ -185,7 +185,7 @@ int BrookStochasticDynamics::_setTau( BrookOpenMMFloat tau ){ ...@@ -185,7 +185,7 @@ int BrookStochasticDynamics::_setTau( BrookOpenMMFloat tau ){
* *
*/ */
int BrookStochasticDynamics::_setFriction( BrookOpenMMFloat friction ){ int BrookLangevinDynamics::_setFriction( BrookOpenMMFloat friction ){
_tau = (BrookOpenMMFloat) ( (friction != 0.0) ? 1.0/friction : 0.0); _tau = (BrookOpenMMFloat) ( (friction != 0.0) ? 1.0/friction : 0.0);
return DefaultReturnValue; return DefaultReturnValue;
} }
...@@ -199,7 +199,7 @@ int BrookStochasticDynamics::_setFriction( BrookOpenMMFloat friction ){ ...@@ -199,7 +199,7 @@ int BrookStochasticDynamics::_setFriction( BrookOpenMMFloat friction ){
* *
*/ */
int BrookStochasticDynamics::_setTemperature( BrookOpenMMFloat temperature ){ int BrookLangevinDynamics::_setTemperature( BrookOpenMMFloat temperature ){
_temperature = temperature; _temperature = temperature;
return DefaultReturnValue; return DefaultReturnValue;
} }
...@@ -213,7 +213,7 @@ int BrookStochasticDynamics::_setTemperature( BrookOpenMMFloat temperature ){ ...@@ -213,7 +213,7 @@ int BrookStochasticDynamics::_setTemperature( BrookOpenMMFloat temperature ){
* *
*/ */
int BrookStochasticDynamics::_setStepSize( BrookOpenMMFloat stepSize ){ int BrookLangevinDynamics::_setStepSize( BrookOpenMMFloat stepSize ){
_stepSize = stepSize; _stepSize = stepSize;
return DefaultReturnValue; return DefaultReturnValue;
} }
...@@ -227,11 +227,11 @@ int BrookStochasticDynamics::_setStepSize( BrookOpenMMFloat stepSize ){ ...@@ -227,11 +227,11 @@ int BrookStochasticDynamics::_setStepSize( BrookOpenMMFloat stepSize ){
* *
*/ */
int BrookStochasticDynamics::_updateDerivedParameters( void ){ int BrookLangevinDynamics::_updateDerivedParameters( void ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const char* methodName = "\nBrookStochasticDynamics::_updateDerivedParameters"; static const char* methodName = "\nBrookLangevinDynamics::_updateDerivedParameters";
static const BrookOpenMMFloat zero = 0.0; static const BrookOpenMMFloat zero = 0.0;
static const BrookOpenMMFloat one = 1.0; static const BrookOpenMMFloat one = 1.0;
...@@ -318,13 +318,13 @@ int BrookStochasticDynamics::_updateDerivedParameters( void ){ ...@@ -318,13 +318,13 @@ int BrookStochasticDynamics::_updateDerivedParameters( void ){
* *
*/ */
int BrookStochasticDynamics::updateParameters( double temperature, double friction, double stepSize ){ int BrookLangevinDynamics::updateParameters( double temperature, double friction, double stepSize ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static int showUpdate = 1; static int showUpdate = 1;
static int maxShowUpdate = 3; static int maxShowUpdate = 3;
static const char* methodName = "\nBrookStochasticDynamics::updateParameters"; static const char* methodName = "\nBrookLangevinDynamics::updateParameters";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -362,7 +362,7 @@ int BrookStochasticDynamics::updateParameters( double temperature, double fricti ...@@ -362,7 +362,7 @@ int BrookStochasticDynamics::updateParameters( double temperature, double fricti
* *
*/ */
int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, int BrookLangevinDynamics::update( Stream& positions, Stream& velocities,
const Stream& forces, const Stream& forces,
BrookShakeAlgorithm& brookShakeAlgorithm, BrookShakeAlgorithm& brookShakeAlgorithm,
BrookRandomNumberGenerator& brookRandomNumberGenerator ){ BrookRandomNumberGenerator& brookRandomNumberGenerator ){
...@@ -373,7 +373,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -373,7 +373,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
float omega = 1.0f; float omega = 1.0f;
static const char* methodName = "\nBrookStochasticDynamics::update"; static const char* methodName = "\nBrookLangevinDynamics::update";
static const int PrintOn = 0; static const int PrintOn = 0;
...@@ -414,7 +414,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -414,7 +414,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
// first integration step // first integration step
kupdate_sd1_fix1( kupdate_sd1_fix1(
(float) getStochasticDynamicsAtomStreamWidth(), (float) getLangevinDynamicsAtomStreamWidth(),
(float) brookRandomNumberGenerator.getRandomNumberStreamWidth(), (float) brookRandomNumberGenerator.getRandomNumberStreamWidth(),
(float) brookRandomNumberGenerator.getRvStreamOffset(), (float) brookRandomNumberGenerator.getRvStreamOffset(),
derivedParameters[EM], derivedParameters[EM],
...@@ -438,7 +438,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -438,7 +438,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
if( PrintOn ){ if( PrintOn ){
(void) fprintf( getLog(), "\nPost kupdate_sd1_fix1: atomStrW=%3d rngStrW=%3d rngOff=%5d " (void) fprintf( getLog(), "\nPost kupdate_sd1_fix1: atomStrW=%3d rngStrW=%3d rngOff=%5d "
"EM=%12.5e Sd1pc[]=[%12.5e %12.5e %12.5e]", "EM=%12.5e Sd1pc[]=[%12.5e %12.5e %12.5e]",
getStochasticDynamicsAtomStreamWidth(), getLangevinDynamicsAtomStreamWidth(),
brookRandomNumberGenerator.getRandomNumberStreamWidth(), brookRandomNumberGenerator.getRandomNumberStreamWidth(),
brookRandomNumberGenerator.getRvStreamOffset(), brookRandomNumberGenerator.getRvStreamOffset(),
derivedParameters[EM], derivedParameters[Sd1pc1], derivedParameters[Sd1pc2], derivedParameters[Sd1pc3] ); derivedParameters[EM], derivedParameters[Sd1pc1], derivedParameters[Sd1pc2], derivedParameters[Sd1pc3] );
...@@ -488,7 +488,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -488,7 +488,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
if( brookShakeAlgorithm.getNumberOfConstraints() > 0 ){ if( brookShakeAlgorithm.getNumberOfConstraints() > 0 ){
kshakeh_fix1( kshakeh_fix1(
10.0f, 10.0f,
(float) getStochasticDynamicsAtomStreamWidth(), (float) getLangevinDynamicsAtomStreamWidth(),
brookShakeAlgorithm.getInverseHydrogenMass(), brookShakeAlgorithm.getInverseHydrogenMass(),
omega, omega,
brookShakeAlgorithm.getShakeAtomIndicesStream()->getBrookStream(), brookShakeAlgorithm.getShakeAtomIndicesStream()->getBrookStream(),
...@@ -503,7 +503,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -503,7 +503,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
// first Shake gather // first Shake gather
kshakeh_update1_fix1( kshakeh_update1_fix1(
(float) getStochasticDynamicsAtomStreamWidth(), (float) getLangevinDynamicsAtomStreamWidth(),
derivedParameters[Sd2pc1], derivedParameters[Sd2pc1],
brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(), brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(),
positionStream.getBrookStream(), positionStream.getBrookStream(),
...@@ -519,7 +519,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -519,7 +519,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
// second integration step // second integration step
kupdate_sd2_fix1( kupdate_sd2_fix1(
(float) getStochasticDynamicsAtomStreamWidth(), (float) getLangevinDynamicsAtomStreamWidth(),
(float) brookRandomNumberGenerator.getRandomNumberStreamWidth(), (float) brookRandomNumberGenerator.getRandomNumberStreamWidth(),
(float) brookRandomNumberGenerator.getRvStreamOffset(), (float) brookRandomNumberGenerator.getRvStreamOffset(),
derivedParameters[Sd2pc1], derivedParameters[Sd2pc1],
...@@ -540,7 +540,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -540,7 +540,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
if( PrintOn ){ if( PrintOn ){
(void) fprintf( getLog(), "\nPost kupdate_sd2_fix1: atomStrW=%3d rngStrW=%3d rngOff=%5d " (void) fprintf( getLog(), "\nPost kupdate_sd2_fix1: atomStrW=%3d rngStrW=%3d rngOff=%5d "
"Sd2pc[]=[%12.5e %12.5e]", "Sd2pc[]=[%12.5e %12.5e]",
getStochasticDynamicsAtomStreamWidth(), getLangevinDynamicsAtomStreamWidth(),
brookRandomNumberGenerator.getRandomNumberStreamWidth(), brookRandomNumberGenerator.getRandomNumberStreamWidth(),
brookRandomNumberGenerator.getRvStreamOffset(), brookRandomNumberGenerator.getRvStreamOffset(),
derivedParameters[Sd2pc1], derivedParameters[Sd2pc2] ); derivedParameters[Sd2pc1], derivedParameters[Sd2pc2] );
...@@ -581,7 +581,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -581,7 +581,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
if( brookShakeAlgorithm.getNumberOfConstraints() > 0 ){ if( brookShakeAlgorithm.getNumberOfConstraints() > 0 ){
kshakeh_fix1( kshakeh_fix1(
10.0f, 10.0f,
(float) getStochasticDynamicsAtomStreamWidth(), (float) getLangevinDynamicsAtomStreamWidth(),
brookShakeAlgorithm.getInverseHydrogenMass(), brookShakeAlgorithm.getInverseHydrogenMass(),
omega, omega,
brookShakeAlgorithm.getShakeAtomIndicesStream()->getBrookStream(), brookShakeAlgorithm.getShakeAtomIndicesStream()->getBrookStream(),
...@@ -596,7 +596,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -596,7 +596,7 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
// second Shake gather // second Shake gather
kshakeh_update2_fix1( kshakeh_update2_fix1(
(float) getStochasticDynamicsAtomStreamWidth(), (float) getLangevinDynamicsAtomStreamWidth(),
brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(), brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(),
positionStream.getBrookStream(), positionStream.getBrookStream(),
getXPrimeStream()->getBrookStream(), getXPrimeStream()->getBrookStream(),
...@@ -623,11 +623,11 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities, ...@@ -623,11 +623,11 @@ int BrookStochasticDynamics::update( Stream& positions, Stream& velocities,
* *
*/ */
const BrookOpenMMFloat* BrookStochasticDynamics::getDerivedParameters( void ) const { const BrookOpenMMFloat* BrookLangevinDynamics::getDerivedParameters( void ) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const char* methodName = "\nBrookStochasticDynamics::getDerivedParameters"; // static const char* methodName = "\nBrookLangevinDynamics::getDerivedParameters";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -641,7 +641,7 @@ const BrookOpenMMFloat* BrookStochasticDynamics::getDerivedParameters( void ) co ...@@ -641,7 +641,7 @@ const BrookOpenMMFloat* BrookStochasticDynamics::getDerivedParameters( void ) co
* *
*/ */
int BrookStochasticDynamics::getStochasticDynamicsAtomStreamSize( void ) const { int BrookLangevinDynamics::getLangevinDynamicsAtomStreamSize( void ) const {
return _sdAtomStreamSize; return _sdAtomStreamSize;
} }
...@@ -652,7 +652,7 @@ int BrookStochasticDynamics::getStochasticDynamicsAtomStreamSize( void ) const { ...@@ -652,7 +652,7 @@ int BrookStochasticDynamics::getStochasticDynamicsAtomStreamSize( void ) const {
* *
*/ */
int BrookStochasticDynamics::getStochasticDynamicsAtomStreamWidth( void ) const { int BrookLangevinDynamics::getLangevinDynamicsAtomStreamWidth( void ) const {
return _sdAtomStreamWidth; return _sdAtomStreamWidth;
} }
...@@ -662,7 +662,7 @@ int BrookStochasticDynamics::getStochasticDynamicsAtomStreamWidth( void ) const ...@@ -662,7 +662,7 @@ int BrookStochasticDynamics::getStochasticDynamicsAtomStreamWidth( void ) const
* @return atom stream height * @return atom stream height
*/ */
int BrookStochasticDynamics::getStochasticDynamicsAtomStreamHeight( void ) const { int BrookLangevinDynamics::getLangevinDynamicsAtomStreamHeight( void ) const {
return _sdAtomStreamHeight; return _sdAtomStreamHeight;
} }
...@@ -673,7 +673,7 @@ int BrookStochasticDynamics::getStochasticDynamicsAtomStreamHeight( void ) const ...@@ -673,7 +673,7 @@ int BrookStochasticDynamics::getStochasticDynamicsAtomStreamHeight( void ) const
* *
*/ */
BrookFloatStreamInternal* BrookStochasticDynamics::getSDPC1Stream( void ) const { BrookFloatStreamInternal* BrookLangevinDynamics::getSDPC1Stream( void ) const {
return _sdStreams[SDPC1Stream]; return _sdStreams[SDPC1Stream];
} }
...@@ -684,7 +684,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSDPC1Stream( void ) const ...@@ -684,7 +684,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSDPC1Stream( void ) const
* *
*/ */
BrookFloatStreamInternal* BrookStochasticDynamics::getSDPC2Stream( void ) const { BrookFloatStreamInternal* BrookLangevinDynamics::getSDPC2Stream( void ) const {
return _sdStreams[SDPC2Stream]; return _sdStreams[SDPC2Stream];
} }
...@@ -695,7 +695,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSDPC2Stream( void ) const ...@@ -695,7 +695,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSDPC2Stream( void ) const
* *
*/ */
BrookFloatStreamInternal* BrookStochasticDynamics::getSD2XStream( void ) const { BrookFloatStreamInternal* BrookLangevinDynamics::getSD2XStream( void ) const {
return _sdStreams[SD2XStream]; return _sdStreams[SD2XStream];
} }
...@@ -706,7 +706,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSD2XStream( void ) const { ...@@ -706,7 +706,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSD2XStream( void ) const {
* *
*/ */
BrookFloatStreamInternal* BrookStochasticDynamics::getSD1VStream( void ) const { BrookFloatStreamInternal* BrookLangevinDynamics::getSD1VStream( void ) const {
return _sdStreams[SD1VStream]; return _sdStreams[SD1VStream];
} }
...@@ -717,7 +717,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSD1VStream( void ) const { ...@@ -717,7 +717,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getSD1VStream( void ) const {
* *
*/ */
BrookFloatStreamInternal* BrookStochasticDynamics::getVPrimeStream( void ) const { BrookFloatStreamInternal* BrookLangevinDynamics::getVPrimeStream( void ) const {
return _sdStreams[VPrimeStream]; return _sdStreams[VPrimeStream];
} }
...@@ -728,7 +728,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getVPrimeStream( void ) const ...@@ -728,7 +728,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getVPrimeStream( void ) const
* *
*/ */
BrookFloatStreamInternal* BrookStochasticDynamics::getXPrimeStream( void ) const { BrookFloatStreamInternal* BrookLangevinDynamics::getXPrimeStream( void ) const {
return _sdStreams[XPrimeStream]; return _sdStreams[XPrimeStream];
} }
...@@ -739,7 +739,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getXPrimeStream( void ) const ...@@ -739,7 +739,7 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getXPrimeStream( void ) const
* *
*/ */
BrookFloatStreamInternal* BrookStochasticDynamics::getInverseMassStream( void ) const { BrookFloatStreamInternal* BrookLangevinDynamics::getInverseMassStream( void ) const {
return _sdStreams[InverseMassStream]; return _sdStreams[InverseMassStream];
} }
...@@ -753,11 +753,11 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getInverseMassStream( void ) ...@@ -753,11 +753,11 @@ BrookFloatStreamInternal* BrookStochasticDynamics::getInverseMassStream( void )
* *
*/ */
int BrookStochasticDynamics::_initializeStreamSizes( int numberOfAtoms, const Platform& platform ){ int BrookLangevinDynamics::_initializeStreamSizes( int numberOfAtoms, const Platform& platform ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookStochasticDynamics::_initializeStreamSizes"; //static const std::string methodName = "BrookLangevinDynamics::_initializeStreamSizes";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -778,12 +778,12 @@ int BrookStochasticDynamics::_initializeStreamSizes( int numberOfAtoms, const Pl ...@@ -778,12 +778,12 @@ int BrookStochasticDynamics::_initializeStreamSizes( int numberOfAtoms, const Pl
* *
*/ */
//std::string BrookStochasticDynamics::_getDerivedParametersString( BrookStochasticDynamics::DerivedParameters derivedParametersIndex ) const { //std::string BrookLangevinDynamics::_getDerivedParametersString( BrookLangevinDynamics::DerivedParameters derivedParametersIndex ) const {
std::string BrookStochasticDynamics::_getDerivedParametersString( int derivedParametersIndex ) const { std::string BrookLangevinDynamics::_getDerivedParametersString( int derivedParametersIndex ) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookStochasticDynamics::_getDerivedParametersString"; //static const std::string methodName = "BrookLangevinDynamics::_getDerivedParametersString";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -876,18 +876,18 @@ std::string BrookStochasticDynamics::_getDerivedParametersString( int derivedPar ...@@ -876,18 +876,18 @@ std::string BrookStochasticDynamics::_getDerivedParametersString( int derivedPar
* *
*/ */
int BrookStochasticDynamics::_initializeStreams( const Platform& platform ){ int BrookLangevinDynamics::_initializeStreams( const Platform& platform ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookStochasticDynamics::_initializeStreams"; //static const std::string methodName = "BrookLangevinDynamics::_initializeStreams";
BrookOpenMMFloat dangleValue = (BrookOpenMMFloat) 0.0; BrookOpenMMFloat dangleValue = (BrookOpenMMFloat) 0.0;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
int sdAtomStreamSize = getStochasticDynamicsAtomStreamSize(); int sdAtomStreamSize = getLangevinDynamicsAtomStreamSize();
int sdAtomStreamWidth = getStochasticDynamicsAtomStreamWidth(); int sdAtomStreamWidth = getLangevinDynamicsAtomStreamWidth();
_sdStreams[SDPC1Stream] = new BrookFloatStreamInternal( BrookCommon::SDPC1Stream, _sdStreams[SDPC1Stream] = new BrookFloatStreamInternal( BrookCommon::SDPC1Stream,
sdAtomStreamSize, sdAtomStreamWidth, sdAtomStreamSize, sdAtomStreamWidth,
...@@ -927,15 +927,15 @@ int BrookStochasticDynamics::_initializeStreams( const Platform& platform ){ ...@@ -927,15 +927,15 @@ int BrookStochasticDynamics::_initializeStreams( const Platform& platform ){
* *
*/ */
int BrookStochasticDynamics::_updateSdStreams( void ){ int BrookLangevinDynamics::_updateSdStreams( void ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookStochasticDynamics::_updateSdStreams"; static const std::string methodName = "BrookLangevinDynamics::_updateSdStreams";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
int sdAtomStreamSize = getStochasticDynamicsAtomStreamSize(); int sdAtomStreamSize = getLangevinDynamicsAtomStreamSize();
BrookOpenMMFloat* sdpc[2]; BrookOpenMMFloat* sdpc[2];
for( int ii = 0; ii < 2; ii++ ){ for( int ii = 0; ii < 2; ii++ ){
...@@ -998,11 +998,11 @@ int BrookStochasticDynamics::_updateSdStreams( void ){ ...@@ -998,11 +998,11 @@ int BrookStochasticDynamics::_updateSdStreams( void ){
* *
*/ */
int BrookStochasticDynamics::_setInverseSqrtMasses( const std::vector<double>& masses ){ int BrookLangevinDynamics::_setInverseSqrtMasses( const std::vector<double>& masses ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
//static const std::string methodName = "BrookStochasticDynamics::_setInverseSqrtMasses"; //static const std::string methodName = "BrookLangevinDynamics::_setInverseSqrtMasses";
BrookOpenMMFloat zero = (BrookOpenMMFloat) 0.0; BrookOpenMMFloat zero = (BrookOpenMMFloat) 0.0;
BrookOpenMMFloat one = (BrookOpenMMFloat) 1.0; BrookOpenMMFloat one = (BrookOpenMMFloat) 1.0;
...@@ -1026,7 +1026,7 @@ int BrookStochasticDynamics::_setInverseSqrtMasses( const std::vector<double>& m ...@@ -1026,7 +1026,7 @@ int BrookStochasticDynamics::_setInverseSqrtMasses( const std::vector<double>& m
} }
/* /*
* Setup of StochasticDynamics parameters * Setup of LangevinDynamics parameters
* *
* @param masses masses * @param masses masses
* @param platform Brook platform * @param platform Brook platform
...@@ -1035,11 +1035,11 @@ int BrookStochasticDynamics::_setInverseSqrtMasses( const std::vector<double>& m ...@@ -1035,11 +1035,11 @@ int BrookStochasticDynamics::_setInverseSqrtMasses( const std::vector<double>& m
* *
* */ * */
int BrookStochasticDynamics::setup( const std::vector<double>& masses, const Platform& platform ){ int BrookLangevinDynamics::setup( const std::vector<double>& masses, const Platform& platform ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookStochasticDynamics::setup"; static const std::string methodName = "BrookLangevinDynamics::setup";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -1068,11 +1068,11 @@ int BrookStochasticDynamics::setup( const std::vector<double>& masses, const Pla ...@@ -1068,11 +1068,11 @@ int BrookStochasticDynamics::setup( const std::vector<double>& masses, const Pla
* *
* */ * */
std::string BrookStochasticDynamics::getContentsString( int level ) const { std::string BrookLangevinDynamics::getContentsString( int level ) const {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookStochasticDynamics::getContentsString"; static const std::string methodName = "BrookLangevinDynamics::getContentsString";
static const unsigned int MAX_LINE_CHARS = 256; static const unsigned int MAX_LINE_CHARS = 256;
char value[MAX_LINE_CHARS]; char value[MAX_LINE_CHARS];
......
#ifndef OPENMM_BROOK_STOCHASTIC_DYNAMCIS_H_ #ifndef OPENMM_BROOK_LANGEVIN_DYNAMICS_H_
#define OPENMM_BROOK_STOCHASTIC_DYNAMCIS_H_ #define OPENMM_BROOK_LANGEVIN_DYNAMICS_H_
/* -------------------------------------------------------------------------- * /* -------------------------------------------------------------------------- *
* OpenMM * * OpenMM *
...@@ -49,7 +49,7 @@ namespace OpenMM { ...@@ -49,7 +49,7 @@ namespace OpenMM {
* *
*/ */
class BrookStochasticDynamics : public BrookCommon { class BrookLangevinDynamics : public BrookCommon {
public: public:
...@@ -58,14 +58,14 @@ class BrookStochasticDynamics : public BrookCommon { ...@@ -58,14 +58,14 @@ class BrookStochasticDynamics : public BrookCommon {
* *
*/ */
BrookStochasticDynamics( ); BrookLangevinDynamics( );
/** /**
* Destructor * Destructor
* *
*/ */
~BrookStochasticDynamics(); ~BrookLangevinDynamics();
/** /**
* Get tau * Get tau
...@@ -110,28 +110,28 @@ class BrookStochasticDynamics : public BrookCommon { ...@@ -110,28 +110,28 @@ class BrookStochasticDynamics : public BrookCommon {
const BrookOpenMMFloat* getDerivedParameters( void ) const; const BrookOpenMMFloat* getDerivedParameters( void ) const;
/** /**
* Get StochasticDynamics atom stream width * Get LangevinDynamics atom stream width
* *
* @return atom stream width * @return atom stream width
*/ */
int getStochasticDynamicsAtomStreamWidth( void ) const; int getLangevinDynamicsAtomStreamWidth( void ) const;
/** /**
* Get StochasticDynamics atom stream height * Get LangevinDynamics atom stream height
* *
* @return atom stream height * @return atom stream height
*/ */
int getStochasticDynamicsAtomStreamHeight( void ) const; int getLangevinDynamicsAtomStreamHeight( void ) const;
/** /**
* Get StochasticDynamics atom stream size * Get LangevinDynamics atom stream size
* *
* @return atom stream size * @return atom stream size
*/ */
int getStochasticDynamicsAtomStreamSize( void ) const; int getLangevinDynamicsAtomStreamSize( void ) const;
/** /**
* Update parameters * Update parameters
...@@ -163,7 +163,7 @@ class BrookStochasticDynamics : public BrookCommon { ...@@ -163,7 +163,7 @@ class BrookStochasticDynamics : public BrookCommon {
const Stream& forces, BrookShakeAlgorithm& brookShakeAlgorithm, const Stream& forces, BrookShakeAlgorithm& brookShakeAlgorithm,
BrookRandomNumberGenerator& brookRandomNumberGenerator ); BrookRandomNumberGenerator& brookRandomNumberGenerator );
/** /**
* Get array of StochasticDynamics streams * Get array of LangevinDynamics streams
* *
* @return array ofstreams * @return array ofstreams
* *
...@@ -172,7 +172,7 @@ class BrookStochasticDynamics : public BrookCommon { ...@@ -172,7 +172,7 @@ class BrookStochasticDynamics : public BrookCommon {
BrookFloatStreamInternal** getStreams( void ); BrookFloatStreamInternal** getStreams( void );
/* /*
* Setup of StochasticDynamics parameters * Setup of LangevinDynamics parameters
* *
* @param masses atom masses * @param masses atom masses
* @param platform Brook platform * @param platform Brook platform
...@@ -266,7 +266,7 @@ class BrookStochasticDynamics : public BrookCommon { ...@@ -266,7 +266,7 @@ class BrookStochasticDynamics : public BrookCommon {
// streams indices // streams indices
enum BrookStochasticDynamicsStreams { enum BrookLangevinDynamicsStreams {
SDPC1Stream, SDPC1Stream,
SDPC2Stream, SDPC2Stream,
SD2XStream, SD2XStream,
...@@ -298,7 +298,7 @@ class BrookStochasticDynamics : public BrookCommon { ...@@ -298,7 +298,7 @@ class BrookStochasticDynamics : public BrookCommon {
* *
*/ */
//std::string _getDerivedParametersString( BrookStochasticDynamics::DerivedParameters ) const; //std::string _getDerivedParametersString( BrookLangevinDynamics::DerivedParameters ) const;
std::string _getDerivedParametersString( int id ) const; std::string _getDerivedParametersString( int id ) const;
/** /**
...@@ -419,4 +419,4 @@ class BrookStochasticDynamics : public BrookCommon { ...@@ -419,4 +419,4 @@ class BrookStochasticDynamics : public BrookCommon {
} // namespace OpenMM } // namespace OpenMM
#endif /* OPENMM_BROOK_STOCHASTIC_DYNAMCIS_H_ */ #endif /* OPENMM_BROOK_LANGEVIN_DYNAMICS_H_ */
...@@ -157,7 +157,7 @@ void BrookPlatform::_initializeKernelFactory( void ){ ...@@ -157,7 +157,7 @@ void BrookPlatform::_initializeKernelFactory( void ){
registerKernelFactory( CalcGBSAOBCForceFieldKernel::Name(), factory); registerKernelFactory( CalcGBSAOBCForceFieldKernel::Name(), factory);
registerKernelFactory( IntegrateVerletStepKernel::Name(), factory); registerKernelFactory( IntegrateVerletStepKernel::Name(), factory);
registerKernelFactory( IntegrateLangevinStepKernel::Name(), factory); registerKernelFactory( IntegrateLangevinStepKernel::Name(), factory);
//registerKernelFactory( IntegrateBrownianStepKernel::Name(), factory); registerKernelFactory( IntegrateBrownianStepKernel::Name(), factory);
//registerKernelFactory( ApplyAndersenThermostatKernel::Name(), factory); //registerKernelFactory( ApplyAndersenThermostatKernel::Name(), factory);
registerKernelFactory( CalcKineticEnergyKernel::Name(), factory); registerKernelFactory( CalcKineticEnergyKernel::Name(), factory);
registerKernelFactory( RemoveCMMotionKernel::Name(), factory); registerKernelFactory( RemoveCMMotionKernel::Name(), factory);
......
#ifndef __INVMAP_H__ #ifndef __INVMAP_H__
#define __INVMAP_H__ #define __INVMAP_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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
/* /*
* For each atom, calculates the positions at which it's * For each atom, 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
......
/* -------------------------------------------------------------------------- *
/**************************************************************** * OpenMM *
* This file is part of the gpu acceleration library for gromacs. * -------------------------------------------------------------------------- *
* Author: Mark Friedrichs * This is part of the OpenMM molecular simulation toolkit originating from *
* * Simbios, the NIH National Center for Physics-Based Simulation of *
* This kernel was developed in collaboration with * Biological Structures at Stanford, funded under the NIH Roadmap for *
* * Medical Research, grant U54 GM072970. See https://simtk.org. *
* Copyright (C) Pande Group, Stanford, 2006 * *
*****************************************************************/ * Portions copyright (c) 2008 Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
kernel void loop2Internal( float3 d1, float3 d2, float3 d3, float3 d4, float4 jAtomicRadiiScaled, kernel void loop2Internal( float3 d1, float3 d2, float3 d3, float3 d4, float4 jAtomicRadiiScaled,
float bornForce, float iAtomicRadii, out float4 de<>, out float4 bornSum<> ){ float bornForce, float iAtomicRadii, out float4 de<>, out float4 bornSum<> ){
......
/**************************************************************** /* -------------------------------------------------------------------------- *
* This file is part of the gpu acceleration library for gromacs. * OpenMM *
* Author: V. Vishal * -------------------------------------------------------------------------- *
* Copyright (C) Pande Group, Stanford, 2006 * 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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
//Harmonic bonds kernel //Harmonic bonds kernel
//Input is a stream of i, j pairs //Input is a stream of i, j pairs
......
/* Portions copyright (c) 2006 Stanford University and Simbios. /* -------------------------------------------------------------------------- *
* Contributors: Pande Group * OpenMM *
* * -------------------------------------------------------------------------- *
* Permission is hereby granted, free of charge, to any person obtaining * This is part of the OpenMM molecular simulation toolkit originating from *
* a copy of this software and associated documentation files (the * Simbios, the NIH National Center for Physics-Based Simulation of *
* "Software"), to deal in the Software without restriction, including * Biological Structures at Stanford, funded under the NIH Roadmap for *
* without limitation the rights to use, copy, modify, merge, publish, * Medical Research, grant U54 GM072970. See https://simtk.org. *
* distribute, sublicense, and/or sell copies of the Software, and to * *
* permit persons to whom the Software is furnished to do so, subject * Portions copyright (c) 2008 Stanford University and the Authors. *
* to the following conditions: * Authors: Peter Eastman, Mark Friedrichs, Chris Bruns *
* * Contributors: *
* The above copyright notice and this permission notice shall be included * *
* in all copies or substantial portions of the Software. * Permission is hereby granted, free of charge, to any person obtaining a *
* * copy of this software and associated documentation files (the "Software"), *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * to deal in the Software without restriction, including without limitation *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * and/or sell copies of the Software, and to permit persons to whom the *
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE * Software is furnished to do so, subject to the following conditions: *
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * *
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * The above copyright notice and this permission notice shall be included in *
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 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. *
* -------------------------------------------------------------------------- */
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
/* -------------------------------------------------------------------------- *
* 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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
void kCalculateLinearMomentum( ::brook::stream mass, ::brook::stream velocities, ::brook::stream linearMomentum ); void kCalculateLinearMomentum( ::brook::stream mass, ::brook::stream velocities, ::brook::stream linearMomentum );
void kReduceLinearMomentum( ::brook::stream momentum, ::brook::stream linearMomentum ); void kReduceLinearMomentum( ::brook::stream momentum, ::brook::stream linearMomentum );
......
/**************************************************************** /* -------------------------------------------------------------------------- *
* This file is part of the gpu acceleration library for gromacs. * OpenMM *
* Author: V. Vishal * -------------------------------------------------------------------------- *
* Copyright (C) Pande Group, Stanford, 2006 * 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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
//Inverse of above //Inverse of above
kernel void kgetxyz( float4 instr<>, out float3 outstr<> ) { kernel void kgetxyz( float4 instr<>, out float3 outstr<> ) {
......
#ifndef __KCOMMON_H__ #ifndef __KCOMMON_H__
#define __KCOMMON_H__ #define __KCOMMON_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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
void kgetxyz (::brook::stream instr, void kgetxyz (::brook::stream instr,
::brook::stream outstr); ::brook::stream outstr);
......
#ifndef __KFORCE_H__ #ifndef __KFORCE_H__
#define __KFORCE_H__ #define __KFORCE_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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
//Define a generic force kernel prototype //Define a generic force kernel prototype
//To make switching easier to look at //To make switching easier to look at
//This should match the kernels from kforce.br //This should match the kernels from kforce.br
......
/* -------------------------------------------------------------------------- *
* 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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
kernel float4 scalar_force_CDLJ( float4 qq, float epsfac, float4 sig, float4 eps, float4 r2, float4 params ) { kernel float4 scalar_force_CDLJ( float4 qq, float epsfac, float4 sig, float4 eps, float4 r2, float4 params ) {
float4 invr, invrsig2, invrsig6; float4 invr, invrsig2, invrsig6;
float4 f; float4 f;
......
#ifndef __KGBSA_H__ #ifndef __KGBSA_H__
#define __KGBSA_H__ #define __KGBSA_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, Chris Bruns *
* 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. *
* -------------------------------------------------------------------------- */
void kMergeFloat4( void kMergeFloat4(
const float repfac, const float repfac,
const float atomStrWidth, const float atomStrWidth,
......
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