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

Mods

parent cdee990d
......@@ -131,21 +131,21 @@ void BrookCalcRBTorsionForceKernel::initialize( const System& system, const RBTo
// ---------------------------------------------------------------------------------------
// create _brookBondParameters object containing atom indices/parameters
// create _brookBondParameters object containing particle indices/parameters
int numberOfBonds = force.getNumTorsions();
if( _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++ ){
int particle1, particle2, particle3, particle4;
double c0, c1, c2, c3, c4, c5;
int particles[NumberOfAtomsInBond];
int particles[NumberOfParticlesInBond];
double parameters[NumberOfParametersInBond];
force.getTorsionParameters( ii, particle1, particle2, particle3, particle4, c0, c1, c2, c3, c4, c5 );
......@@ -178,7 +178,7 @@ void BrookCalcRBTorsionForceKernel::initialize( const System& system, const RBTo
}
/**
* Compute forces given atom coordinates
* Compute forces given particle coordinates
*
* @param context OpenMMContextImpl context
*
......
......@@ -72,7 +72,7 @@ class BrookCalcRBTorsionForceKernel : public CalcRBTorsionForceKernel {
/**
* Execute the kernel to calculate the forces.
*
* @param positions atom coordiantes
* @param positions particle coordiantes
* @param forces output forces
*
*/
......@@ -133,7 +133,7 @@ class BrookCalcRBTorsionForceKernel : public CalcRBTorsionForceKernel {
/**
* Get indices/parameters
*
* @return BrookBondParameters containing atom indices/parameters
* @return BrookBondParameters containing particle indices/parameters
*
*/
......@@ -141,7 +141,7 @@ class BrookCalcRBTorsionForceKernel : public CalcRBTorsionForceKernel {
private:
static const int NumberOfAtomsInBond = 4;
static const int NumberOfParticlesInBond = 4;
static const int NumberOfParametersInBond = 6;
// bond name
......
......@@ -44,7 +44,7 @@ using namespace std;
// bonded streams
const std::string BrookCommon::BondedAtomIndicesStream = "BondedAtomIndicesStream";
const std::string BrookCommon::BondedParticleIndicesStream = "BondedParticleIndicesStream";
const std::string BrookCommon::BondedParametersStream = "BondedParametersStream";
const std::string BrookCommon::UnrolledForceStream = "UnrolledForceStream";
const std::string BrookCommon::BondedChargeStream = "BondedChargeStream";
......@@ -61,9 +61,9 @@ const std::string BrookCommon::PartialForceStream
// OBC Gbsa streams
const std::string BrookCommon::ObcAtomicRadiiStream = "ObcAtomicRadiiStream";
const std::string BrookCommon::ObcScaledAtomicRadiiStream = "ObcScaledAtomicRadiiStream";
const std::string BrookCommon::ObcAtomicRadiiWithDielectricOffsetStream = "ObcAtomicRadiiWithDielectricOffsetStream";
const std::string BrookCommon::ObcParticleRadiiStream = "ObcParticleRadiiStream";
const std::string BrookCommon::ObcScaledParticleRadiiStream = "ObcScaledParticleRadiiStream";
const std::string BrookCommon::ObcParticleRadiiWithDielectricOffsetStream = "ObcParticleRadiiWithDielectricOffsetStream";
const std::string BrookCommon::ObcBornRadiiStream = "ObcBornRadiiStream";
const std::string BrookCommon::ObcBornRadii2Stream = "ObcBornRadii2Stream";
const std::string BrookCommon::ObcIntermediateForceStream = "ObcIntermediateForceStream";
......@@ -81,8 +81,8 @@ const std::string BrookCommon::InverseMassStream
// Shake streams
const std::string BrookCommon::ShakeAtomIndicesStream = "ShakeAtomIndicesStream";
const std::string BrookCommon::ShakeAtomParameterStream = "ShakeAtomParameterStream";
const std::string BrookCommon::ShakeParticleIndicesStream = "ShakeParticleIndicesStream";
const std::string BrookCommon::ShakeParticleParameterStream = "ShakeParticleParameterStream";
const std::string BrookCommon::ShakeXCons0Stream = "ShakeXCons0Stream";
const std::string BrookCommon::ShakeXCons1Stream = "ShakeXCons1Stream";
const std::string BrookCommon::ShakeXCons2Stream = "ShakeXCons2Stream";
......@@ -112,12 +112,12 @@ BrookCommon::BrookCommon( ){
// ---------------------------------------------------------------------------------------
_numberOfAtoms = 0;
_atomSizeModified = 0;
_numberOfParticles = 0;
_particleSizeModified = 0;
_atomStreamWidth = -1;
_atomStreamHeight = -1;
_atomStreamSize = -1;
_particleStreamWidth = -1;
_particleStreamHeight = -1;
_particleStreamSize = -1;
_log = NULL;
_verbosity = 0;
......@@ -141,182 +141,182 @@ BrookCommon::~BrookCommon( ){
}
/**
* Get number of atoms
* Get number of particles
*
* @return number of atoms
* @return number of particles
*
*/
int BrookCommon::getNumberOfAtoms( void ) const {
return _numberOfAtoms;
int BrookCommon::getNumberOfParticles( void ) const {
return _numberOfParticles;
}
/**
* Get number of atoms
* Get number of particles
*
* @param numberOfAtoms number of atoms
* @return number of atoms
* @param numberOfParticles number of particles
* @return number of particles
*
*/
int BrookCommon::setNumberOfAtoms( int numberOfAtoms ){
if( numberOfAtoms != _numberOfAtoms ){
_atomSizeModified = numberOfAtoms;
int BrookCommon::setNumberOfParticles( int numberOfParticles ){
if( numberOfParticles != _numberOfParticles ){
_particleSizeModified = numberOfParticles;
}
_numberOfAtoms = numberOfAtoms;
return _numberOfAtoms;
_numberOfParticles = numberOfParticles;
return _numberOfParticles;
}
/**
* Get atom stream width
* Get particle stream width
*
* @param platform platform
*
* @return atom stream width
* @return particle stream width
*
*/
int BrookCommon::getAtomStreamWidth( const Platform& platform ){
int BrookCommon::getParticleStreamWidth( const Platform& platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCommon::getAtomStreamWidth";
// static const std::string methodName = "BrookCommon::getParticleStreamWidth";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// get atom stream width
// get particle stream width
if( _atomStreamWidth < 0 ){
_getAtomStreamDimensions( platform );
if( _particleStreamWidth < 0 ){
_getParticleStreamDimensions( platform );
}
return _atomStreamWidth;
return _particleStreamWidth;
}
/**
* Get atom stream width
* Get particle stream width
*
* @return atom stream width
* @return particle stream width
*
*/
int BrookCommon::getAtomStreamWidth( void ) const {
int BrookCommon::getParticleStreamWidth( void ) const {
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCommon::getAtomStreamWidth";
// static const std::string methodName = "BrookCommon::getParticleStreamWidth";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
return _atomStreamWidth;
return _particleStreamWidth;
}
/**
* Get atom stream height
* Get particle stream height
*
* @param platform platform
*
* @return atom stream height
* @return particle stream height
*
*/
int BrookCommon::getAtomStreamHeight( const Platform& platform ){
int BrookCommon::getParticleStreamHeight( const Platform& platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCommon::getAtomStreamHeight";
// static const std::string methodName = "BrookCommon::getParticleStreamHeight";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// get atom stream height
// get particle stream height
if( _atomStreamHeight < 0 ){
_getAtomStreamDimensions( platform );
if( _particleStreamHeight < 0 ){
_getParticleStreamDimensions( platform );
}
return _atomStreamHeight;
return _particleStreamHeight;
}
/**
* Get atom stream height
* Get particle stream height
*
* @return atom stream height
* @return particle stream height
*
*/
int BrookCommon::getAtomStreamHeight( void ) const {
int BrookCommon::getParticleStreamHeight( void ) const {
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCommon::getAtomStreamHeight";
// static const std::string methodName = "BrookCommon::getParticleStreamHeight";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
return _atomStreamHeight;
return _particleStreamHeight;
}
/**
* Get atom stream size
* Get particle stream size
*
* @param platform platform
*
* @return atom stream size
* @return particle stream size
*
*/
int BrookCommon::getAtomStreamSize( const Platform& platform ){
int BrookCommon::getParticleStreamSize( const Platform& platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCommon::getAtomStreamSize";
// static const std::string methodName = "BrookCommon::getParticleStreamSize";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// get atom stream size
// get particle stream size
if( _atomStreamSize < 0 ){
_getAtomStreamDimensions( platform );
if( _particleStreamSize < 0 ){
_getParticleStreamDimensions( platform );
}
return _atomStreamSize;
return _particleStreamSize;
}
/**
* Get atom stream size
* Get particle stream size
*
* @return atom stream size
* @return particle stream size
*
*/
int BrookCommon::getAtomStreamSize( void ) const {
return _atomStreamSize;
int BrookCommon::getParticleStreamSize( void ) const {
return _particleStreamSize;
}
/**
* Get atom stream dimensions
* Get particle stream dimensions
*
* @param platform platform
*
*/
void BrookCommon::_getAtomStreamDimensions( const Platform& platform ){
void BrookCommon::_getParticleStreamDimensions( const Platform& platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookCommon::_getAtomStreamDimensions";
// static const std::string methodName = "BrookCommon::_getParticleStreamDimensions";
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
// get atom stream size
// get particle stream size
const BrookPlatform brookPlatform = dynamic_cast<const BrookPlatform&> (platform);
const BrookStreamFactory& brookStreamFactory = dynamic_cast<const BrookStreamFactory&> (platform.getDefaultStreamFactory() );
_atomStreamWidth = brookStreamFactory.getDefaultAtomStreamWidth();
_atomStreamSize = brookPlatform.getStreamSize( getNumberOfAtoms(), _atomStreamWidth, NULL );
_atomStreamHeight = (int) ( ((float) _atomStreamSize)/( (float) _atomStreamWidth) + 0.001);
_particleStreamWidth = brookStreamFactory.getDefaultParticleStreamWidth();
_particleStreamSize = brookPlatform.getStreamSize( getNumberOfParticles(), _particleStreamWidth, NULL );
_particleStreamHeight = (int) ( ((float) _particleStreamSize)/( (float) _particleStreamWidth) + 0.001);
return;
}
......
This diff is collapsed.
......@@ -46,6 +46,8 @@ using namespace OpenMM;
* @param inputStreamWidth stream width
* @param inputDefaultDangleValue default dangle value
*
* @throw exception if stream type not recognized or stream width < 1
*
*/
BrookFloatStreamInternal::BrookFloatStreamInternal( const std::string& name, int size, int streamWidth, BrookStreamInternal::DataType type,
......@@ -278,6 +280,18 @@ void BrookFloatStreamInternal::loadFromArray( const void* array, BrookStreamInte
_aStream.read( _data );
}
/**
* Save data to input array
*
* @param array a pointer to the start of the array. The array is assumed to have the same length as this stream,
* and to contain elements of the correct _data type for this stream. If the stream has a compound _data type, all
* the values should be packed into a single array: all the values for the first element, followed by all the values
* for the next element, etc.
*
* @throw exception if baseType not float, double, or integer
*
*/
void BrookFloatStreamInternal::saveToArray( void* array ){
// ---------------------------------------------------------------------------------------
......@@ -571,3 +585,53 @@ void* BrookFloatStreamInternal::getDataArray( void ){
return new float[totalSize];
}
/**
* BrookFloatStreamInternal constructor
*
* @param stopIndex index to stop sum
* @param sum array of size=getWidth()
*
* @return DefaultReturnValue
*
* @throw exception if stopIndex is too large
*/
int BrookFloatStreamInternal::sumByDimension( int stopIndex, double* sum ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookFloatStreamInternal::sumByDimension";
// ---------------------------------------------------------------------------------------
if( stopIndex > getSize() ){
std::stringstream message;
message << methodName << " stream=" << getName() << " input topIndex" << stopIndex << " is too large: stream size=" << getSize();
throw OpenMMException( message.str() );
}
// get _data from GPU
_aStream.write( _data );
int width = getWidth();
int widthM1 = getWidth() - 1;
stopIndex *= width;
for( int ii = 0; ii < width; ii++ ){
sum[ii] = 0.0;
}
int index = 0;
for( int ii = 0; ii < stopIndex; ii++ ){
sum[index] += (double) _data[ii];
if( index == widthM1 ){
index = 0;
} else {
index++;
}
}
return DefaultReturnValue;
}
......@@ -159,6 +159,19 @@ class BrookFloatStreamInternal : public BrookStreamInternal {
const std::string getContentsString( int level = 0 ) const;
/**
* Sum over stream dimensions
*
* @param stopIndex index to stop sum
* @param sum array of size=getWidth()
*
* @return DefaultReturnValue
*
* @throw exception if stopIndex is too large
*/
int sumByDimension( int stopIndex, double* sum );
private:
BrookOpenMMFloat _defaultDangleValue;
......
This diff is collapsed.
This diff is collapsed.
......@@ -154,6 +154,19 @@ public:
const std::string getContentsString( int level = 0 ) const;
/**
* BrookFloatStreamInternal constructor
*
* @param stopIndex index to stop sum
* @param sum array of size=getWidth()
*
* @return DefaultReturnValue
*
* @throw exception if stopIndex is too large
*/
int sumByDimension( int stopIndex, double* sum );
private:
int _dangleValue;
......
This diff is collapsed.
This diff is collapsed.
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