Commit e7c41fb6 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Mods for OBC Gbsa

parent b53cd947
...@@ -1054,7 +1054,7 @@ int BrookBonded::loadInvMaps( int nbondeds, int natoms, int *atoms, const BrookP ...@@ -1054,7 +1054,7 @@ int BrookBonded::loadInvMaps( int nbondeds, int natoms, int *atoms, const BrookP
for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){ for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){
for( int jj = 0; jj < getMaxInverseMapStreamCount(ii); jj++ ){ for( int jj = 0; jj < getMaxInverseMapStreamCount(ii); jj++ ){
_inverseStreamMaps[ii][jj] = new BrookFloatStreamInternal( BrookStreamFactory::BondedInverseMapStreams, atomStreamSize, _inverseStreamMaps[ii][jj] = new BrookFloatStreamInternal( BrookCommon::BondedInverseMapStreams, atomStreamSize,
atomStreamWidth, BrookStreamInternal::Float4, dangleValue ); atomStreamWidth, BrookStreamInternal::Float4, dangleValue );
} }
} }
...@@ -1239,16 +1239,16 @@ int BrookBonded::setup( int numberOfAtoms, ...@@ -1239,16 +1239,16 @@ int BrookBonded::setup( int numberOfAtoms,
// build streams // build streams
_atomIndicesStream = new BrookFloatStreamInternal( BrookStreamFactory::BondedAtomIndicesStream, nbondeds, atomStreamWidth, _atomIndicesStream = new BrookFloatStreamInternal( BrookCommon::BondedAtomIndicesStream, nbondeds, atomStreamWidth,
BrookStreamInternal::Float4, dangleValue ); BrookStreamInternal::Float4, dangleValue );
_atomIndicesStream->loadFromArray( atoms, BrookStreamInternal::Integer ); _atomIndicesStream->loadFromArray( atoms, BrookStreamInternal::Integer );
_chargeStream = new BrookFloatStreamInternal( BrookStreamFactory::BondedChargeStream, numberOfAtoms, atomStreamWidth, _chargeStream = new BrookFloatStreamInternal( BrookCommon::BondedChargeStream, numberOfAtoms, atomStreamWidth,
BrookStreamInternal::Float, dangleValue ); BrookStreamInternal::Float, dangleValue );
_chargeStream->loadFromArray( charges ); _chargeStream->loadFromArray( charges );
for( int ii = 0; ii < getNumberOfParameterStreams(); ii++ ){ for( int ii = 0; ii < getNumberOfParameterStreams(); ii++ ){
_bondedParameters[ii] = new BrookFloatStreamInternal( BrookStreamFactory::BondedParametersStream, nbondeds, atomStreamWidth, _bondedParameters[ii] = new BrookFloatStreamInternal( BrookCommon::BondedParametersStream, nbondeds, atomStreamWidth,
BrookStreamInternal::Float4, dangleValue ); BrookStreamInternal::Float4, dangleValue );
_bondedParameters[ii]->loadFromArray( params[ii] ); _bondedParameters[ii]->loadFromArray( params[ii] );
} }
...@@ -1316,7 +1316,7 @@ int BrookBonded::setup( int numberOfAtoms, ...@@ -1316,7 +1316,7 @@ int BrookBonded::setup( int numberOfAtoms,
// initialize output streams // initialize output streams
for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){ for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){
_bondedForceStreams[ii] = new BrookFloatStreamInternal( BrookStreamFactory::UnrolledForceStream, nbondeds, atomStreamWidth, _bondedForceStreams[ii] = new BrookFloatStreamInternal( BrookCommon::UnrolledForceStream, nbondeds, atomStreamWidth,
BrookStreamInternal::Float3, dangleValue ); BrookStreamInternal::Float3, dangleValue );
} }
......
...@@ -182,6 +182,12 @@ void BrookCalcGBSAOBCForceFieldKernel::executeForces( const Stream& positions, S ...@@ -182,6 +182,12 @@ void BrookCalcGBSAOBCForceFieldKernel::executeForces( const Stream& positions, S
float includeAce = (float) (_brookGbsa->includeAce()); float includeAce = (float) (_brookGbsa->includeAce());
BrookFloatStreamInternal** gbsaForceStreams = _brookGbsa->getForceStreams(); BrookFloatStreamInternal** gbsaForceStreams = _brookGbsa->getForceStreams();
// calculate Born radii first time thru and initialize on board
if( _brookGbsa->haveBornRadiiBeenInitialized() ){
_brookGbsa->calculateBornRadii( positions );
}
// first major loop // first major loop
kObcLoop1( (float) _brookGbsa->getNumberOfAtoms(), kObcLoop1( (float) _brookGbsa->getNumberOfAtoms(),
......
...@@ -39,6 +39,33 @@ ...@@ -39,6 +39,33 @@
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
// bonded streams
const std::string BrookCommon::BondedAtomIndicesStream = "BondedAtomIndicesStream";
const std::string BrookCommon::BondedParametersStream = "BondedParametersStream";
const std::string BrookCommon::UnrolledForceStream = "UnrolledForceStream";
const std::string BrookCommon::BondedChargeStream = "BondedChargeStream";
const std::string BrookCommon::BondedInverseMapStreams = "BondedInverseMapStreams";
// non-bonded streams
const std::string BrookCommon::NonBondedExclusionStream = "NonBondedExclusionStream";
const std::string BrookCommon::OuterVdwStream = "OuterVdwStream";
const std::string BrookCommon::InnerSigmaStream = "InnerSigmaStream";
const std::string BrookCommon::InnerEpsilonStream = "InnerEpsilonStream";
const std::string BrookCommon::NonBondedChargeStream = "NonBondedChargeStream";
const std::string BrookCommon::PartialForceStream = "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::ObcBornRadiiStream = "ObcBornRadiiStream";
const std::string BrookCommon::ObcBornRadii2Stream = "ObcBornRadii2Stream";
const std::string BrookCommon::ObcIntermediateForceStream = "ObcIntermediateForceStream";
const std::string BrookCommon::ObcChainStream = "ObcChainStream";
/** /**
* Constructor * Constructor
* *
......
...@@ -53,8 +53,51 @@ class BrookCommon { ...@@ -53,8 +53,51 @@ class BrookCommon {
static const int DefaultReturnValue = 0; static const int DefaultReturnValue = 0;
static const int ErrorReturnValue = -1; static const int ErrorReturnValue = -1;
// ---------------------------------------------------------------------------------------
// Stream names
// bonded stream names
static const std::string BondedAtomIndicesStream;
static const std::string BondedParametersStream;
static const std::string UnrolledForceStream;
static const std::string BondedChargeStream;
static const std::string BondedInverseMapStreams;
// nonbonded stream names
static const std::string NonBondedExclusionStream;
static const std::string OuterVdwStream;
static const std::string InnerSigmaStream;
static const std::string InnerEpsilonStream;
static const std::string NonBondedChargeStream;
static const std::string PartialForceStream;
// OBC Gbsa streams
static const std::string ObcAtomicRadiiStream;
static const std::string ObcScaledAtomicRadiiStream;
static const std::string ObcAtomicRadiiWithDielectricOffsetStream;
static const std::string ObcBornRadiiStream;
static const std::string ObcBornRadii2Stream;
static const std::string ObcIntermediateForceStream;
static const std::string ObcChainStream;
// ---------------------------------------------------------------------------------------
/**
* Constructor
*
*/
BrookCommon( ); BrookCommon( );
/**
* Destructor
*
*/
~BrookCommon(); ~BrookCommon();
/** /**
......
...@@ -357,34 +357,29 @@ void BrookFloatStreamInternal::fillWithValue( void* value ){ ...@@ -357,34 +357,29 @@ void BrookFloatStreamInternal::fillWithValue( void* value ){
} }
const RealOpenMM* const * BrookFloatStreamInternal::getData() const { /**
return NULL; * Get data
} *
* @param readFromBoard if set, read values on board
// problem w/ const here -- _data is modified (cast away?) *
* @return data array
*
*/
/* void* BrookFloatStreamInternal::getData( int readFromBoard ){
const RealOpenMM* const * BrookFloatStreamInternal::getData() const {
// retrieve _data from GPU // ---------------------------------------------------------------------------------------
_aStream.write( _data ); // static const std::string methodName = "BrookFloatStreamInternal::getData";
// check if RealOpenMM is float; if not, then // ---------------------------------------------------------------------------------------
// copy into realOpenMMData[][] array
if( realOpenMMData ){ if( readFromBoard ){
for( int i = 0; i < getSize(); i++ ){ _aStream.write( _data );
for( int j = 0; j < getWidth(); j++ ){
realOpenMMData[i][j] = (RealOpenMM) _data[i][j];
}
}
return realOpenMMData;
} else {
return _data;
} }
return (void*) _data;
} }
*/
/** /**
* Get data * Get data
...@@ -393,28 +388,15 @@ const RealOpenMM* const * BrookFloatStreamInternal::getData() const { ...@@ -393,28 +388,15 @@ const RealOpenMM* const * BrookFloatStreamInternal::getData() const {
* *
*/ */
RealOpenMM** BrookFloatStreamInternal::getData( void ){ void* BrookFloatStreamInternal::getData( void ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookFloatStreamInternal::getData"; // static const std::string methodName = "BrookFloatStreamInternal::getData";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
/* return getData( 0 );
_aStream.write( _data );
if( _realOpenMMData ){
int totalSize = getSize()*getWidth();
for( int ii = 0; ii < totalSize; ii++ ){
_realOpenMMData[ii] = (RealOpenMM) _data[ii];
}
return _realOpenMMData;
} else {
return _data;
}
*/
return NULL;
} }
/** /**
......
...@@ -104,10 +104,33 @@ class BrookFloatStreamInternal : public BrookStreamInternal { ...@@ -104,10 +104,33 @@ class BrookFloatStreamInternal : public BrookStreamInternal {
void saveToArray( void* array ); void saveToArray( void* array );
/**
* Fill data w/ input value
*
* @param value to set array to
*
*
*/
void fillWithValue( void* value ); void fillWithValue( void* value );
const RealOpenMM* const * getData( ) const; /**
RealOpenMM** getData( void ); * Get data array -- no read from board!
*
* @return data array
*/
void* getData( void );
/**
* Get data array
*
* @param readFromBoard if set, read values on board
*
* @return data array
*/
void* getData( int readFromBoard );
/** /**
* Get dangle value * Get dangle value
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <sstream> #include <sstream>
#include "BrookGbsa.h" #include "BrookGbsa.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "OpenMMException.h"
#include "BrookStreamImpl.h"
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
...@@ -57,14 +59,15 @@ BrookGbsa::BrookGbsa( ){ ...@@ -57,14 +59,15 @@ BrookGbsa::BrookGbsa( ){
_partialForceStreamHeight = -1; _partialForceStreamHeight = -1;
_partialForceStreamSize = -1; _partialForceStreamSize = -1;
_gbsaStreamWidth = -1; _gbsaAtomStreamWidth = -1;
_gbsaStreamHeight = -1; _gbsaAtomStreamHeight = -1;
_gbsaStreamSize = -1; _gbsaAtomStreamSize = -1;
_duplicationFactor = 4; _duplicationFactor = 4;
_solventDielectric = 78.3; _solventDielectric = 78.3;
_soluteDielectric = 1.0; _soluteDielectric = 1.0;
_dielectricOffset = 0.09;
for( int ii = 0; ii < LastStreamIndex; ii++ ){ for( int ii = 0; ii < LastStreamIndex; ii++ ){
_gbsaStreams[ii] = NULL; _gbsaStreams[ii] = NULL;
...@@ -74,6 +77,8 @@ BrookGbsa::BrookGbsa( ){ ...@@ -74,6 +77,8 @@ BrookGbsa::BrookGbsa( ){
_gbsaForceStreams[ii] = NULL; _gbsaForceStreams[ii] = NULL;
} }
_bornRadiiInitialized = 0;
_cpuObc = NULL;
} }
/** /**
...@@ -97,6 +102,8 @@ BrookGbsa::~BrookGbsa( ){ ...@@ -97,6 +102,8 @@ BrookGbsa::~BrookGbsa( ){
delete _gbsaForceStreams[ii]; delete _gbsaForceStreams[ii];
} }
delete _cpuObc;
} }
/** /**
...@@ -139,8 +146,8 @@ int BrookGbsa::getOuterLoopUnroll( void ) const { ...@@ -139,8 +146,8 @@ int BrookGbsa::getOuterLoopUnroll( void ) const {
* *
*/ */
double BrookGbsa::getSoluteDielectric( void ) const { float BrookGbsa::getSoluteDielectric( void ) const {
return _soluteDielectric; return (float) _soluteDielectric;
} }
/** /**
...@@ -150,8 +157,19 @@ double BrookGbsa::getSoluteDielectric( void ) const { ...@@ -150,8 +157,19 @@ double BrookGbsa::getSoluteDielectric( void ) const {
* *
*/ */
double BrookGbsa::getSolventDielectric( void ) const { float BrookGbsa::getSolventDielectric( void ) const {
return _solventDielectric; return (float) _solventDielectric;
}
/**
* Get OBC dielectric offset
*
* @return OBC dielectric offset
*
*/
float BrookGbsa::getDielectricOffset( void ) const {
return (float) _dielectricOffset;
} }
/** /**
...@@ -208,31 +226,6 @@ int BrookGbsa::getDuplicationFactor( void ) const { ...@@ -208,31 +226,6 @@ int BrookGbsa::getDuplicationFactor( void ) const {
return _duplicationFactor; return _duplicationFactor;
} }
/**
* Get partial force stream width
*
* @param platform platform
*
* @return partial force stream width
*
*/
int BrookGbsa::getPartialForceStreamWidth( const Platform& platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookGbsa::getPartialForceStreamWidth";
// ---------------------------------------------------------------------------------------
// get partial force stream width
if( _partialForceStreamWidth < 0 ){
//_getPartialForceStreamDimensions( platform );
}
return _partialForceStreamWidth;
}
/** /**
* Get partial force stream width * Get partial force stream width
* *
...@@ -252,31 +245,6 @@ int BrookGbsa::getPartialForceStreamWidth( void ) const { ...@@ -252,31 +245,6 @@ int BrookGbsa::getPartialForceStreamWidth( void ) const {
return _partialForceStreamWidth; return _partialForceStreamWidth;
} }
/**
* Get partial force stream height
*
* @param platform platform
*
* @return partial force stream height
*
*/
int BrookGbsa::getPartialForceStreamHeight( const Platform& platform ){
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookGbsa::getPartialForceStreamHeight";
// ---------------------------------------------------------------------------------------
// get partial force stream height
if( _partialForceStreamHeight < 0 ){
//_getPartialForceStreamDimensions( platform );
}
return _partialForceStreamHeight;
}
/** /**
* Get partial force stream height * Get partial force stream height
* *
...@@ -298,59 +266,44 @@ int BrookGbsa::getPartialForceStreamHeight( void ) const { ...@@ -298,59 +266,44 @@ int BrookGbsa::getPartialForceStreamHeight( void ) const {
/** /**
* Get partial force stream size * Get partial force stream size
* *
* @param platform platform
*
* @return partial force stream size * @return partial force stream size
* *
*/ */
int BrookGbsa::getPartialForceStreamSize( const Platform& platform ){ int BrookGbsa::getPartialForceStreamSize( void ) const {
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookGbsa::getPartialForceStreamSize";
// ---------------------------------------------------------------------------------------
// get partial force stream size
if( _partialForceStreamSize < 0 ){
//_getPartialForceStreamDimensions( platform );
}
return _partialForceStreamSize; return _partialForceStreamSize;
} }
/** /**
* Get partial force stream size * Get Atom stream size
* *
* @return partial force stream size * @return Atom stream size
* *
*/ */
int BrookGbsa::getPartialForceStreamSize( void ) const { int BrookGbsa::getGbsaAtomStreamSize( void ) const {
return _partialForceStreamSize; return _gbsaAtomStreamSize;
} }
/** /**
* Get Gbsa stream size * Get atom stream width
* *
* @return Gbsa stream size * @return atom stream width
* *
*/ */
int BrookGbsa::getGbsaStreamSize( void ) const { int BrookGbsa::getGbsaAtomStreamWidth( void ) const {
return _gbsaStreamSize; return _gbsaAtomStreamWidth;
} }
/** /**
* Get gbsa stream width * Get atom stream height
*
* @return gbsa stream width
* *
* @return atom stream height
*/ */
int BrookGbsa::getGbsaStreamWidth( void ) const { int BrookGbsa::getGbsaAtomStreamHeight( void ) const {
return _gbsaStreamWidth; return _gbsaAtomStreamHeight;
} }
/** /**
...@@ -453,6 +406,80 @@ int BrookGbsa::isForceStreamSet( int index ) const { ...@@ -453,6 +406,80 @@ int BrookGbsa::isForceStreamSet( int index ) const {
return (index >= 0 && index < getNumberOfForceStreams() && _gbsaForceStreams[index]) ? 1 : 0; return (index >= 0 && index < getNumberOfForceStreams() && _gbsaForceStreams[index]) ? 1 : 0;
} }
/**
* Return true if Born radii have been initialized
*
* @return true if Born radii have been initialized
*
*/
int BrookGbsa::haveBornRadiiBeenInitialized( void ) const {
return _bornRadiiInitialized;
}
/**
* Calculate Born radii
*
* @return calculate Born radii
*
*/
int BrookGbsa::calculateBornRadii( const Stream& positions ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookGbsa::calculateBornRadii";
// ---------------------------------------------------------------------------------------
const BrookStreamImpl& positionStreamC = dynamic_cast<const BrookStreamImpl&> (positions.getImpl());
BrookStreamImpl& positionStream = const_cast<BrookStreamImpl&> (positionStreamC);
const RealOpenMM* coordinates = (RealOpenMM*) positionStream.getData( );
// load coordinates into RealOpenMM 2d array
int numberOfAtoms = getNumberOfAtoms();
RealOpenMM** atomCoordinates = new RealOpenMM*[numberOfAtoms];
RealOpenMM* atomCoordinatesBlk = new RealOpenMM[3*numberOfAtoms];
// Born radii array size needs to match stream size since it will
// be written down to board
int streamSize = getGbsaAtomStreamSize();
RealOpenMM* bornRadii = new RealOpenMM[streamSize];
memset( bornRadii, 0, sizeof( RealOpenMM )*streamSize );
int index = 0;
for( int ii = 0; ii < numberOfAtoms; ii++ ){
atomCoordinates[ii] = atomCoordinatesBlk;
atomCoordinatesBlk += 3;
atomCoordinates[ii][0] = coordinates[index++];
atomCoordinates[ii][1] = coordinates[index++];
atomCoordinates[ii][2] = coordinates[index++];
}
// calculate Born radii
_cpuObc->computeBornRadii( atomCoordinates, bornRadii );
// write radii to board and set flag to indicate radii calculated once
_gbsaStreams[ObcBornRadiiStream]->loadFromArray( bornRadii );
_bornRadiiInitialized = 1;
// free memory
delete[] atomCoordinatesBlk;
delete[] atomCoordinates;
delete[] bornRadii;
return DefaultReturnValue;
}
/** /**
* Initialize stream dimensions * Initialize stream dimensions
* *
...@@ -468,17 +495,12 @@ int BrookGbsa::initializeStreamSizes( int numberOfAtoms, const Platform& platfor ...@@ -468,17 +495,12 @@ int BrookGbsa::initializeStreamSizes( int numberOfAtoms, const Platform& platfor
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookGbsa::initializeStreamSizes"; static const std::string methodName = "BrookGbsa::initializeStreamSizes";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
int atomStreamSize = getAtomStreamSize( platform ); _gbsaAtomStreamSize = getAtomStreamSize( platform );
int atomStreamWidth = getAtomStreamWidth( platform ); _gbsaAtomStreamWidth = getAtomStreamWidth( platform );
_gbsaAtomStreamHeight = getAtomStreamHeight( platform );
initializeExclusionStreamSize( atomStreamSize, atomStreamWidth );
initializeJStreamSize( atomStreamSize, atomStreamWidth );
initializeOuterVdwStreamSize( atomStreamSize, atomStreamWidth );
initializePartialForceStreamSize( atomStreamSize, atomStreamWidth );
return DefaultReturnValue; return DefaultReturnValue;
} }
...@@ -498,39 +520,57 @@ int BrookGbsa::initializeStreams( const Platform& platform ){ ...@@ -498,39 +520,57 @@ int BrookGbsa::initializeStreams( const Platform& platform ){
static const std::string methodName = "BrookGbsa::initializeStreams"; static const std::string methodName = "BrookGbsa::initializeStreams";
static const double dangleValue = 0.0; static const double dangleValue = 0.0;
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
const BrookStreamFactory& brookStreamFactory = dynamic_cast<const BrookStreamFactory&> (platform.getDefaultStreamFactory()); int gbsaAtomStreamSize = getGbsaAtomStreamSize();
int gbsaAtomStreamWidth = getGbsaAtomStreamWidth();
// atomic radii & charge
// exclusion _gbsaStreams[ObcAtomicRadiiStream] = new BrookFloatStreamInternal( BrookCommon::ObcAtomicRadiiStream,
gbsaAtomStreamSize, gbsaAtomStreamWidth,
BrookStreamInternal::Float2, dangleValue );
_gbsaStreams[ExclusionStream] = new BrookFloatStreamInternal( BrookStreamFactory::NonBondedExclusionStream, // scaled atomic radii
getExclusionStreamSize(), getExclusionStreamWidth(),
_gbsaStreams[ObcScaledAtomicRadiiStream] = new BrookFloatStreamInternal( BrookCommon::ObcScaledAtomicRadiiStream,
gbsaAtomStreamSize, gbsaAtomStreamWidth,
BrookStreamInternal::Float2, dangleValue );
// atomic radii w/ DielectricOffset
_gbsaStreams[ObcAtomicRadiiWithDielectricOffsetStream] = new BrookFloatStreamInternal( BrookCommon::ObcAtomicRadiiWithDielectricOffsetStream,
gbsaAtomStreamSize, gbsaAtomStreamWidth,
BrookStreamInternal::Float, dangleValue ); BrookStreamInternal::Float, dangleValue );
// outer vdw // Born radii
_gbsaStreams[ObcBornRadiiStream] = new BrookFloatStreamInternal( BrookCommon::ObcBornRadiiStream,
gbsaAtomStreamSize, gbsaAtomStreamWidth,
BrookStreamInternal::Float, dangleValue );
_gbsaStreams[OuterVdwStream] = new BrookFloatStreamInternal( BrookStreamFactory::OuterVdwStream, getAtomStreamSize(), // Born2 radii
getAtomStreamWidth(), BrookStreamInternal::Float2, dangleValue );
// inner sigma & epsilon _gbsaStreams[ObcBornRadii2Stream] = new BrookFloatStreamInternal( BrookCommon::ObcBornRadii2Stream,
gbsaAtomStreamSize, gbsaAtomStreamWidth,
BrookStreamInternal::Float, dangleValue );
_gbsaStreams[InnerSigmaStream] = new BrookFloatStreamInternal( BrookStreamFactory::InnerSigmaStream, getJStreamSize(), // IntermediateForce
getJStreamWidth(), BrookStreamInternal::Float4, dangleValue );
_gbsaStreams[InnerEpsilonStream] = new BrookFloatStreamInternal( BrookStreamFactory::InnerEpsilonStream, getJStreamSize(), _gbsaStreams[ObcIntermediateForceStream] = new BrookFloatStreamInternal( BrookCommon::ObcIntermediateForceStream,
getJStreamWidth(), BrookStreamInternal::Float4, dangleValue ); gbsaAtomStreamSize, gbsaAtomStreamWidth,
BrookStreamInternal::Float, dangleValue );
// charge stream // Born2 radii
_gbsaStreams[ChargeStream] = new BrookFloatStreamInternal( BrookStreamFactory::NonBondedChargeStream, getAtomStreamSize(), _gbsaStreams[ObcChainStream] = new BrookFloatStreamInternal( BrookCommon::ObcChainStream,
getAtomStreamWidth(), BrookStreamInternal::Float, dangleValue ); gbsaAtomStreamSize, gbsaAtomStreamWidth,
BrookStreamInternal::Float, dangleValue );
// partial force streams
// partial force stream std::string partialForceStream = BrookCommon::PartialForceStream;
std::string partialForceStream = BrookStreamFactory::PartialForceStream;
for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){ for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){
std::stringstream name; std::stringstream name;
name << partialForceStream << ii; name << partialForceStream << ii;
...@@ -544,34 +584,116 @@ int BrookGbsa::initializeStreams( const Platform& platform ){ ...@@ -544,34 +584,116 @@ int BrookGbsa::initializeStreams( const Platform& platform ){
/* /*
* Setup of Gbsa parameters * Setup of Gbsa parameters
* *
* @param atomParameters vector of OBC parameters [atomI][0=index] * @param atomParameters vector of OBC parameters [atomI][0=charge]
* [atomI][1=charge] * [atomI][1=radius]
* [atomI][2=radius]
* [atomI][2=scaling factor] * [atomI][2=scaling factor]
* @param solventDielectric solvent dielectric * @param solventDielectric solvent dielectric
* @param soluteDielectric solute dielectric * @param soluteDielectric solute dielectric
* @param platform Brook platform
* *
* @return nonzero value if error * @return nonzero value if error
* *
* */ * */
int BrookGbsa::setup( const std::vector<std::vector<double> >& atomParameters, int BrookGbsa::setup( const std::vector<std::vector<double> >& vectorOfAtomParameters,
double solventDielectric, double soluteDielectric ); double solventDielectric, double soluteDielectric, const Platform& platform ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const int atomParametersSize = 4;
static const int maxErrors = 20;
static const std::string methodName = "BrookGbsa::setup"; static const std::string methodName = "BrookGbsa::setup";
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
setNumberOfAtoms( (int) atomParameters.size() ); int numberOfAtoms = (int) vectorOfAtomParameters.size();
setNumberOfAtoms( numberOfAtoms );
_solventDielectric = solventDielectric;
_soluteDielectric = soluteDielectric;
solventDielectric = _solventDielectric; // initialize stream sizes and then Brook streams
soluteDielectric = _soluteDielectric;
initializeStreamSizes( getNumberOfAtoms(), platform ); initializeStreamSizes( numberOfAtoms, platform );
initializeStreams( platform ); initializeStreams( platform );
BrookOpenMMFloat* radiiAndCharge = new BrookOpenMMFloat[getNumberOfAtoms()*2];
BrookOpenMMFloat* scaledRadiiAndOffset = new BrookOpenMMFloat[getNumberOfAtoms()*2];
// used by CpuObc to calculate initial Born radii
vector<RealOpenMM> atomicRadii(numberOfAtoms);
vector<RealOpenMM> scaleFactors(numberOfAtoms);
float dielectricOffset = getDielectricOffset();
// loop over atom parameters
// track any errors and then throw exception
// check parameter vector is right size
// set parameter entries or board and arrays used by CpuObc
int vectorIndex = 0;
int errors = 0;
std::stringstream message;
typedef std::vector< std::vector<double> > VectorOfDoubleVectors;
typedef VectorOfDoubleVectors::const_iterator VectorOfDoubleVectorsCI;
for( VectorOfDoubleVectorsCI ii = vectorOfAtomParameters.begin(); ii != vectorOfAtomParameters.end(); ii++ ){
std::vector<double> atomParameters = *ii;
if( atomParameters.size() != atomParametersSize && errors < maxErrors ){
message << methodName << " parameter size=" << atomParameters.size() << " for parameter vector index=" << vectorIndex << " is less than expected.\n";
errors++;
} else {
double charge = atomParameters[0];
double radius = atomParameters[1];
double scalingFactor = atomParameters[2];
int streamIndex = 2*vectorIndex;
atomicRadii[vectorIndex] = static_cast<RealOpenMM> (radius);
scaleFactors[vectorIndex] = static_cast<RealOpenMM> (scalingFactor);
radiiAndCharge[streamIndex] = static_cast<BrookOpenMMFloat> (radius);
radiiAndCharge[streamIndex+1] = static_cast<BrookOpenMMFloat> (charge);
scaledRadiiAndOffset[streamIndex] = static_cast<BrookOpenMMFloat> (radius*scalingFactor);
scaledRadiiAndOffset[streamIndex+1] = static_cast<BrookOpenMMFloat> (radius - dielectricOffset);
}
vectorIndex++;
}
// throw exception if errors detected
if( errors ){
throw OpenMMException( message.str() );
}
// load streams
_gbsaStreams[ObcAtomicRadiiStream]->loadFromArray( radiiAndCharge );
_gbsaStreams[ObcScaledAtomicRadiiStream]->loadFromArray( scaledRadiiAndOffset );
delete[] radiiAndCharge;
delete[] scaledRadiiAndOffset;
// setup for Born radii
ObcParameters* obcParameters = new ObcParameters( numberOfAtoms, ObcParameters::ObcTypeII );
obcParameters->setAtomicRadii( atomicRadii, SimTKOpenMMCommon::MdUnits);
obcParameters->setScaledRadiusFactors( scaleFactors );
obcParameters->setSolventDielectric( static_cast<RealOpenMM>(solventDielectric) );
obcParameters->setSoluteDielectric( static_cast<RealOpenMM>(soluteDielectric) );
_cpuObc = new CpuObc(obcParameters);
_cpuObc->setIncludeAceApproximation( true );
return DefaultReturnValue; return DefaultReturnValue;
} }
...@@ -686,9 +808,6 @@ std::string BrookGbsa::getContentsString( int level ) const { ...@@ -686,9 +808,6 @@ std::string BrookGbsa::getContentsString( int level ) const {
(void) LOCAL_SPRINTF( value, "%d", getPartialForceStreamSize() ); (void) LOCAL_SPRINTF( value, "%d", getPartialForceStreamSize() );
message << _getLine( tab, "Partial force stream size:", value ); message << _getLine( tab, "Partial force stream size:", value );
(void) LOCAL_SPRINTF( value, "%d", getExclusionStreamWidth() );
message << _getLine( tab, "Exclusion stream width:", value );
message << _getLine( tab, "Log:", (getLog() ? Set : NotSet) ); message << _getLine( tab, "Log:", (getLog() ? Set : NotSet) );
/* /*
message << _getLine( tab, "ExclusionStream:", (getExclusionStream() ? Set : NotSet) ); message << _getLine( tab, "ExclusionStream:", (getExclusionStream() ? Set : NotSet) );
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "BrookFloatStreamInternal.h" #include "BrookFloatStreamInternal.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "BrookCommon.h" #include "BrookCommon.h"
#include "../../../platforms/reference/src/gbsa/CpuObc.h"
namespace OpenMM { namespace OpenMM {
...@@ -53,8 +54,18 @@ class BrookGbsa : public BrookCommon { ...@@ -53,8 +54,18 @@ class BrookGbsa : public BrookCommon {
static const int DefaultReturnValue = 0; static const int DefaultReturnValue = 0;
static const int ErrorReturnValue = -1; static const int ErrorReturnValue = -1;
/**
* Constructor
*
*/
BrookGbsa( ); BrookGbsa( );
/**
* Destructor
*
*/
~BrookGbsa(); ~BrookGbsa();
/** /**
...@@ -144,6 +155,30 @@ class BrookGbsa : public BrookCommon { ...@@ -144,6 +155,30 @@ class BrookGbsa : public BrookCommon {
int getPartialForceStreamSize( void ) const; int getPartialForceStreamSize( void ) const;
/**
* Get Gbsa atom stream width
*
* @return atom stream width
*/
int getGbsaAtomStreamWidth( void ) const;
/**
* Get Gbsa atom stream height
*
* @return atom stream height
*/
int getGbsaAtomStreamHeight( void ) const;
/**
* Get Gbsa atom stream size
*
* @return atom stream size
*/
int getGbsaAtomStreamSize( void ) const;
/** /**
* Get solute dielectric * Get solute dielectric
* *
...@@ -160,6 +195,14 @@ class BrookGbsa : public BrookCommon { ...@@ -160,6 +195,14 @@ class BrookGbsa : public BrookCommon {
float getSolventDielectric( void ) const; float getSolventDielectric( void ) const;
/**
* Get OBC dielectric offset
*
* @return dielectric offset
*/
float getDielectricOffset( void ) const;
/** /**
* Get atomic radii * Get atomic radii
* *
...@@ -232,6 +275,15 @@ class BrookGbsa : public BrookCommon { ...@@ -232,6 +275,15 @@ class BrookGbsa : public BrookCommon {
BrookFloatStreamInternal** getForceStreams( void ); BrookFloatStreamInternal** getForceStreams( void );
/**
* Get array of Gbsa streams
*
* @return array ofstreams
*
*/
BrookFloatStreamInternal** getStreams( void );
/** /**
* Return true if force[index] stream is set * Return true if force[index] stream is set
* *
...@@ -241,22 +293,40 @@ class BrookGbsa : public BrookCommon { ...@@ -241,22 +293,40 @@ class BrookGbsa : public BrookCommon {
int isForceStreamSet( int index ) const; int isForceStreamSet( int index ) const;
/**
* Return true if Born radii have been initialized
*
* @return true if Born radii have been initialized
*
*/
int haveBornRadiiBeenInitialized( void ) const;
/**
* Calculate Born radii
*
* @return calculate Born radii
*
*/
int BrookGbsa::calculateBornRadii( const Stream& positions );
/* /*
* Setup of Gbsa parameters * Setup of Gbsa parameters
* *
* @param atomParameters vector of OBC parameters [atomI][0=index] * @param atomParameters vector of OBC parameters [atomI][0=charge]
* [atomI][1=charge] * [atomI][1=radius]
* [atomI][2=radius]
* [atomI][2=scaling factor] * [atomI][2=scaling factor]
* @param solventDielectric solvent dielectric * @param solventDielectric solvent dielectric
* @param soluteDielectric solute dielectric * @param soluteDielectric solute dielectric
* @param platform Brook platform
* *
* @return nonzero value if error * @return nonzero value if error
* *
* */ * */
int setup( const std::vector<std::vector<double> >& atomParameters, int setup( const std::vector<std::vector<double> >& atomParameters,
double solventDielectric, double soluteDielectric ); double solventDielectric, double soluteDielectric, const Platform& platform );
/* /*
* Get contents of object * Get contents of object
...@@ -279,7 +349,6 @@ class BrookGbsa : public BrookCommon { ...@@ -279,7 +349,6 @@ class BrookGbsa : public BrookCommon {
enum { enum {
ObcAtomicRadiiStream, ObcAtomicRadiiStream,
ObcRadiiStreamStream,
ObcScaledAtomicRadiiStream, ObcScaledAtomicRadiiStream,
ObcAtomicRadiiWithDielectricOffsetStream, ObcAtomicRadiiWithDielectricOffsetStream,
ObcBornRadiiStream, ObcBornRadiiStream,
...@@ -308,22 +377,32 @@ class BrookGbsa : public BrookCommon { ...@@ -308,22 +377,32 @@ class BrookGbsa : public BrookCommon {
int _partialForceStreamHeight; int _partialForceStreamHeight;
int _partialForceStreamSize; int _partialForceStreamSize;
// Gbsa stream dimensions // Atom stream dimensions
int _gbsaStreamWidth; int _gbsaAtomStreamWidth;
int _gbsaStreamHeight; int _gbsaAtomStreamHeight;
int _gbsaStreamSize; int _gbsaAtomStreamSize;
// dielectrics // dielectrics
double _solventDielectric double _solventDielectric;
double _soluteDielectric double _soluteDielectric;
// dielectric offset
double _dielectricOffset;
// internal streams // internal streams
BrookFloatStreamInternal* _gbsaStreams[LastStreamIndex]; BrookFloatStreamInternal* _gbsaStreams[LastStreamIndex];
BrookFloatStreamInternal* _gbsaForceStreams[NumberOfForceStreams]; BrookFloatStreamInternal* _gbsaForceStreams[NumberOfForceStreams];
int _bornRadiiInitialized;
// CpuObc reference
CpuObc* _cpuObc;
/* /*
* Setup of stream dimensions * Setup of stream dimensions
* *
......
...@@ -39,18 +39,21 @@ using namespace OpenMM; ...@@ -39,18 +39,21 @@ using namespace OpenMM;
* BrookIntStreamInternal constructor * BrookIntStreamInternal constructor
* *
* @param name stream name * @param name stream name
* @param size stream size * @param size array size
* @param platform platform * @param streamWidth stream width
* @param type stream type (Integer, Integer2, ...)
* @param dangleValue fill value for tail of stream beyond array size
* *
*/ */
BrookIntStreamInternal::BrookIntStreamInternal( std::string name, int size, int width, BrookStreamInternal::DataType type, BrookIntStreamInternal::BrookIntStreamInternal( std::string name, int size, int streamWidth,
int dangleValue ) : BrookStreamInternal( name, size, width, type ){ BrookStreamInternal::DataType type,
int dangleValue ) :
BrookStreamInternal( name, size, streamWidth, type ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookIntStreamInternal::BrookIntStreamInternal"; static const std::string methodName = "BrookIntStreamInternal::BrookIntStreamInternal";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -59,32 +62,34 @@ BrookIntStreamInternal::BrookIntStreamInternal( std::string name, int size, int ...@@ -59,32 +62,34 @@ BrookIntStreamInternal::BrookIntStreamInternal( std::string name, int size, int
switch( type ){ switch( type ){
case BrookStreamInternal::Integer: case BrookStreamInternal::Integer:
width = 1;
_width = 1;
break; break;
case BrookStreamInternal::Integer2: case BrookStreamInternal::Integer2:
width = 2;
_width = 2;
break; break;
case BrookStreamInternal::Integer3: case BrookStreamInternal::Integer3:
width = 3;
_width = 3;
break; break;
case BrookStreamInternal::Integer4: case BrookStreamInternal::Integer4:
width = 4;
_width = 4;
break; break;
default: default:
std::stringstream message; std::stringstream message;
message << methodName << " type=" << type << " not recognized."; message << methodName << " type=" << type << " not recognized.";
throw OpenMMException( message.str() ); throw OpenMMException( message.str() );
} }
data = new int*[size]; _data = new int[size*_width];
for( int ii = 0; ii < size; ii++ ){
data[ii] = new int[width];
}
} }
/** /**
...@@ -93,7 +98,7 @@ BrookIntStreamInternal::BrookIntStreamInternal( std::string name, int size, int ...@@ -93,7 +98,7 @@ BrookIntStreamInternal::BrookIntStreamInternal( std::string name, int size, int
*/ */
BrookIntStreamInternal::~BrookIntStreamInternal() { BrookIntStreamInternal::~BrookIntStreamInternal() {
delete[] data; delete[] _data;
} }
/** /**
...@@ -127,7 +132,6 @@ void BrookIntStreamInternal::loadFromArray( const void* array, BrookStreamIntern ...@@ -127,7 +132,6 @@ void BrookIntStreamInternal::loadFromArray( const void* array, BrookStreamIntern
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookIntStreamInternal::loadFromArray(1)"; static const std::string methodName = "BrookIntStreamInternal::loadFromArray(1)";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -138,11 +142,10 @@ void BrookIntStreamInternal::loadFromArray( const void* array, BrookStreamIntern ...@@ -138,11 +142,10 @@ void BrookIntStreamInternal::loadFromArray( const void* array, BrookStreamIntern
} }
int* arrayData = (int*) array; int* arrayData = (int*) array;
int index = 0; int totalSize = getSize()*getWidth();
for( int ii = 0; ii < getSize(); ii++ ){
for( int jj = 0; jj < getWidth(); jj++ ){ for( int ii = 0; ii < totalSize; ii++ ){
data[ii][jj] = arrayData[index++]; _data[ii] = arrayData[ii];
}
} }
} }
...@@ -158,16 +161,13 @@ void BrookIntStreamInternal::saveToArray( void* array ){ ...@@ -158,16 +161,13 @@ void BrookIntStreamInternal::saveToArray( void* array ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookIntStreamInternal::saveToArray"; // static const std::string methodName = "BrookIntStreamInternal::saveToArray";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
int* arrayData = (int*) array; int* arrayData = (int*) array;
int index = 0; int totalSize = getSize()*getWidth();
for( int ii = 0; ii < getSize(); ii++ ){ for( int ii = 0; ii < totalSize; ii++ ){
for( int jj = 0; jj < getWidth(); jj++ ){ arrayData[ii] = _data[ii];
arrayData[index++] = data[ii][jj];
}
} }
} }
...@@ -183,27 +183,15 @@ void BrookIntStreamInternal::fillWithValue( void* value ){ ...@@ -183,27 +183,15 @@ void BrookIntStreamInternal::fillWithValue( void* value ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookIntStreamInternal::fillWithValue"; // static const std::string methodName = "BrookIntStreamInternal::fillWithValue";
// static const int debug = 1;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
int valueData = *((int*) value); int valueData = *((int*) value);
for( int ii = 0; ii < getSize(); ii++ ){ int totalSize = getSize()*getWidth();
for (int jj = 0; jj < getWidth(); jj++ ){
data[ii][jj] = valueData;
}
}
}
/**
* Get data
*
* @return data ptr
*
*/
const int* const * BrookIntStreamInternal::getData( void ) const { for( int ii = 0; ii < totalSize; ii++ ){
return data; _data[ii] = valueData;
}
} }
/** /**
...@@ -213,7 +201,7 @@ const int* const * BrookIntStreamInternal::getData( void ) const { ...@@ -213,7 +201,7 @@ const int* const * BrookIntStreamInternal::getData( void ) const {
* *
*/ */
int** BrookIntStreamInternal::getData( void ){ void* BrookIntStreamInternal::getData( void ){
return data; return _data;
} }
...@@ -45,10 +45,36 @@ class BrookIntStreamInternal : public BrookStreamInternal { ...@@ -45,10 +45,36 @@ class BrookIntStreamInternal : public BrookStreamInternal {
public: public:
/**
* BrookIntStreamInternal constructor
*
* @param name stream name
* @param size size of array
* @param streamWidth stream width
* @param type stream type (float, float2, ...)
* @param inputDefaultDangleValue default dangle value
*
*/
BrookIntStreamInternal( std::string name, int size, int streamWidth, BrookStreamInternal::DataType type, int dangleValue ); BrookIntStreamInternal( std::string name, int size, int streamWidth, BrookStreamInternal::DataType type, int dangleValue );
/**
* BrookIntStreamInternal destructor
*
*/
~BrookIntStreamInternal( ); ~BrookIntStreamInternal( );
/**
* Copy the contents of an array into this stream.
*
* @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.
*
*/
void loadFromArray( const void* array ); void loadFromArray( const void* array );
/** /**
...@@ -58,19 +84,50 @@ public: ...@@ -58,19 +84,50 @@ public:
* and to contain elements of the correct data type for this stream. If the stream has a compound data type, all * 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 * 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. * for the next element, etc.
*
* @param baseType data type of input array (float, double, int)
*
*/ */
void loadFromArray( const void* array, BrookStreamInternal::DataType baseType ); void loadFromArray( const void* array, BrookStreamInternal::DataType baseType );
/**
* 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 or double
*
*/
void saveToArray( void* array ); void saveToArray( void* array );
/**
* Fill data w/ input value
*
* @param value to set array to
*
*
*/
void fillWithValue( void* value ); void fillWithValue( void* value );
const int* const * getData( void ) const;
int** getData( void ); /**
* Get data array
*
* @return data array
*/
void* getData( void );
private: private:
int _dangleValue; int _dangleValue;
int** data; int* _data;
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -516,31 +516,31 @@ int BrookNonBonded::initializeStreams( const Platform& platform ){ ...@@ -516,31 +516,31 @@ int BrookNonBonded::initializeStreams( const Platform& platform ){
// exclusion // exclusion
_nonbondedStreams[ExclusionStream] = new BrookFloatStreamInternal( BrookStreamFactory::NonBondedExclusionStream, _nonbondedStreams[ExclusionStream] = new BrookFloatStreamInternal( BrookCommon::NonBondedExclusionStream,
getExclusionStreamSize(), getExclusionStreamWidth(), getExclusionStreamSize(), getExclusionStreamWidth(),
BrookStreamInternal::Float, dangleValue ); BrookStreamInternal::Float, dangleValue );
// outer vdw // outer vdw
_nonbondedStreams[OuterVdwStream] = new BrookFloatStreamInternal( BrookStreamFactory::OuterVdwStream, getAtomStreamSize(), _nonbondedStreams[OuterVdwStream] = new BrookFloatStreamInternal( BrookCommon::OuterVdwStream, getAtomStreamSize(),
getAtomStreamWidth(), BrookStreamInternal::Float2, dangleValue ); getAtomStreamWidth(), BrookStreamInternal::Float2, dangleValue );
// inner sigma & epsilon // inner sigma & epsilon
_nonbondedStreams[InnerSigmaStream] = new BrookFloatStreamInternal( BrookStreamFactory::InnerSigmaStream, getJStreamSize(), _nonbondedStreams[InnerSigmaStream] = new BrookFloatStreamInternal( BrookCommon::InnerSigmaStream, getJStreamSize(),
getJStreamWidth(), BrookStreamInternal::Float4, dangleValue ); getJStreamWidth(), BrookStreamInternal::Float4, dangleValue );
_nonbondedStreams[InnerEpsilonStream] = new BrookFloatStreamInternal( BrookStreamFactory::InnerEpsilonStream, getJStreamSize(), _nonbondedStreams[InnerEpsilonStream] = new BrookFloatStreamInternal( BrookCommon::InnerEpsilonStream, getJStreamSize(),
getJStreamWidth(), BrookStreamInternal::Float4, dangleValue ); getJStreamWidth(), BrookStreamInternal::Float4, dangleValue );
// charge stream // charge stream
_nonbondedStreams[ChargeStream] = new BrookFloatStreamInternal( BrookStreamFactory::NonBondedChargeStream, getAtomStreamSize(), _nonbondedStreams[ChargeStream] = new BrookFloatStreamInternal( BrookCommon::NonBondedChargeStream, getAtomStreamSize(),
getAtomStreamWidth(), BrookStreamInternal::Float, dangleValue ); getAtomStreamWidth(), BrookStreamInternal::Float, dangleValue );
// partial force stream // partial force stream
std::string partialForceStream = BrookStreamFactory::PartialForceStream; std::string partialForceStream = BrookCommon::PartialForceStream;
for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){ for( int ii = 0; ii < getNumberOfForceStreams(); ii++ ){
std::stringstream name; std::stringstream name;
name << partialForceStream << ii; name << partialForceStream << ii;
......
...@@ -40,23 +40,6 @@ const std::string BrookStreamFactory::AtomPositions = "atomPosition ...@@ -40,23 +40,6 @@ const std::string BrookStreamFactory::AtomPositions = "atomPosition
const std::string BrookStreamFactory::AtomVelocities = "atomVelocities"; const std::string BrookStreamFactory::AtomVelocities = "atomVelocities";
const std::string BrookStreamFactory::AtomForces = "atomForces"; const std::string BrookStreamFactory::AtomForces = "atomForces";
// bonded streams
const std::string BrookStreamFactory::BondedAtomIndicesStream = "BondedAtomIndicesStream";
const std::string BrookStreamFactory::BondedParametersStream = "BondedParametersStream";
const std::string BrookStreamFactory::UnrolledForceStream = "UnrolledForceStream";
const std::string BrookStreamFactory::BondedChargeStream = "BondedChargeStream";
const std::string BrookStreamFactory::BondedInverseMapStreams = "BondedInverseMapStreams";
// non-bonded streams
const std::string BrookStreamFactory::NonBondedExclusionStream = "NonBondedExclusionStream";
const std::string BrookStreamFactory::OuterVdwStream = "OuterVdwStream";
const std::string BrookStreamFactory::InnerSigmaStream = "InnerSigmaStream";
const std::string BrookStreamFactory::InnerEpsilonStream = "InnerEpsilonStream";
const std::string BrookStreamFactory::NonBondedChargeStream = "NonBondedChargeStream";
const std::string BrookStreamFactory::PartialForceStream = "PartialForceStream";
const double DefaultDangleValue = 1.0e+38; const double DefaultDangleValue = 1.0e+38;
/** /**
* BrookStreamFactory constructor * BrookStreamFactory constructor
......
...@@ -262,6 +262,15 @@ void BrookStreamImpl::fillWithValue( void* value ){ ...@@ -262,6 +262,15 @@ void BrookStreamImpl::fillWithValue( void* value ){
return _brookStreamInternal->fillWithValue( value ); return _brookStreamInternal->fillWithValue( value );
} }
/**
* Set every element of this stream to the same value.
*
* @return data array
*/
void* BrookStreamImpl::getData( void* value ){
return _brookStreamInternal->getData( );
}
/** /**
* Get Brook stream * Get Brook stream
* *
......
...@@ -108,6 +108,13 @@ class BrookStreamImpl : public StreamImpl { ...@@ -108,6 +108,13 @@ class BrookStreamImpl : public StreamImpl {
*/ */
void fillWithValue( void* value ); void fillWithValue( void* value );
/**
* Get data array
*
* @return data array
*/
void* getData( void );
/** /**
* Get Brook stream * Get Brook stream
* *
......
...@@ -130,6 +130,13 @@ class BrookStreamInternal { ...@@ -130,6 +130,13 @@ class BrookStreamInternal {
*/ */
virtual void fillWithValue(void* value) = 0; virtual void fillWithValue(void* value) = 0;
/**
* Get data
*
* @return data array
*/
virtual void* getData( void ) = 0;
/** /**
* Get type string * Get type string
* *
......
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