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

Minor mods

parent 7f561d68
...@@ -42,11 +42,7 @@ using OpenMM::RealVec; ...@@ -42,11 +42,7 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
CpuGBVISoftcore::CpuGBVISoftcore( GBVISoftcoreParameters* gbviParameters ){ CpuGBVISoftcore::CpuGBVISoftcore( GBVISoftcoreParameters* gbviParameters ) : _gbviParameters(gbviParameters) {
// ---------------------------------------------------------------------------------------
_gbviParameters = gbviParameters;
_switchDeriviative.resize(_gbviParameters->getNumberOfAtoms()); _switchDeriviative.resize(_gbviParameters->getNumberOfAtoms());
} }
...@@ -69,9 +65,6 @@ CpuGBVISoftcore::~CpuGBVISoftcore( ){ ...@@ -69,9 +65,6 @@ CpuGBVISoftcore::~CpuGBVISoftcore( ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
GBVISoftcoreParameters* CpuGBVISoftcore::getGBVISoftcoreParameters( void ) const { GBVISoftcoreParameters* CpuGBVISoftcore::getGBVISoftcoreParameters( void ) const {
// ---------------------------------------------------------------------------------------
return _gbviParameters; return _gbviParameters;
} }
......
...@@ -44,10 +44,12 @@ using OpenMM::RealVec; ...@@ -44,10 +44,12 @@ using OpenMM::RealVec;
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
CpuObcSoftcore::CpuObcSoftcore( ObcSoftcoreParameters* obcSoftcoreParameters ){ CpuObcSoftcore::CpuObcSoftcore( ObcSoftcoreParameters* obcSoftcoreParameters ) :
_obcSoftcoreParameters = obcSoftcoreParameters; _obcSoftcoreParameters(obcSoftcoreParameters),
_includeAceApproximation = 1; _includeAceApproximation(1) {
_obcChain.resize(_obcSoftcoreParameters->getNumberOfAtoms()); _obcChain.resize(_obcSoftcoreParameters->getNumberOfAtoms());
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
...@@ -132,7 +134,7 @@ void CpuObcSoftcore::setIncludeAceApproximation( int includeAceApproximation ){ ...@@ -132,7 +134,7 @@ void CpuObcSoftcore::setIncludeAceApproximation( int includeAceApproximation ){
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void CpuObcSoftcore::computeBornRadii( vector<RealVec>& atomCoordinates, RealOpenMMVector& bornRadii ){ void CpuObcSoftcore::computeBornRadii( const vector<RealVec>& atomCoordinates, RealOpenMMVector& bornRadii ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -191,6 +193,7 @@ void CpuObcSoftcore::computeBornRadii( vector<RealVec>& atomCoordinates, RealOp ...@@ -191,6 +193,7 @@ void CpuObcSoftcore::computeBornRadii( vector<RealVec>& atomCoordinates, RealOp
RealOpenMM rScaledRadiusJ = r + scaledRadiusJ; RealOpenMM rScaledRadiusJ = r + scaledRadiusJ;
if( offsetRadiusI < rScaledRadiusJ ){ if( offsetRadiusI < rScaledRadiusJ ){
RealOpenMM rInverse = one/r; RealOpenMM rInverse = one/r;
RealOpenMM l_ij = offsetRadiusI > FABS( r - scaledRadiusJ ) ? offsetRadiusI : FABS( r - scaledRadiusJ ); RealOpenMM l_ij = offsetRadiusI > FABS( r - scaledRadiusJ ) ? offsetRadiusI : FABS( r - scaledRadiusJ );
l_ij = one/l_ij; l_ij = one/l_ij;
...@@ -248,7 +251,8 @@ void CpuObcSoftcore::computeAceNonPolarForce( const ObcSoftcoreParameters* obcSo ...@@ -248,7 +251,8 @@ void CpuObcSoftcore::computeAceNonPolarForce( const ObcSoftcoreParameters* obcSo
const vector<RealOpenMM>& bornRadii, RealOpenMM* energy, const vector<RealOpenMM>& bornRadii, RealOpenMM* energy,
vector<RealOpenMM>& forces ) const { vector<RealOpenMM>& forces ) const {
static const RealOpenMM minusSix = -6.0; static const RealOpenMM zero = 0.0;
static const RealOpenMM six = 6.0;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -277,12 +281,12 @@ void CpuObcSoftcore::computeAceNonPolarForce( const ObcSoftcoreParameters* obcSo ...@@ -277,12 +281,12 @@ void CpuObcSoftcore::computeAceNonPolarForce( const ObcSoftcoreParameters* obcSo
// no paper to cite. // no paper to cite.
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
if( bornRadii[atomI] > 0.0 ){ if( bornRadii[atomI] > zero ){
RealOpenMM r = atomicRadii[atomI] + probeRadius; RealOpenMM r = atomicRadii[atomI] + probeRadius;
RealOpenMM ratio6 = POW( atomicRadii[atomI]/bornRadii[atomI], static_cast<RealOpenMM>( 6.0 ) ); RealOpenMM ratio6 = POW( atomicRadii[atomI]/bornRadii[atomI], six );
RealOpenMM saTerm = nonPolarScaleFactors[atomI]*surfaceAreaFactor*r*r*ratio6; RealOpenMM saTerm = nonPolarScaleFactors[atomI]*surfaceAreaFactor*r*r*ratio6;
*energy += saTerm; *energy += saTerm;
forces[atomI] += minusSix*saTerm/bornRadii[atomI]; forces[atomI] -= six*saTerm/bornRadii[atomI];
} }
} }
} }
...@@ -295,7 +299,7 @@ void CpuObcSoftcore::computeAceNonPolarForce( const ObcSoftcoreParameters* obcSo ...@@ -295,7 +299,7 @@ void CpuObcSoftcore::computeAceNonPolarForce( const ObcSoftcoreParameters* obcSo
@param partialCharges partial charges @param partialCharges partial charges
@param forces forces @param forces forces
The array bornRadii is also updated and the obcEnergy @return energy
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
...@@ -369,6 +373,7 @@ RealOpenMM CpuObcSoftcore::computeBornEnergyForces( vector<RealVec>& atomCoordin ...@@ -369,6 +373,7 @@ RealOpenMM CpuObcSoftcore::computeBornEnergyForces( vector<RealVec>& atomCoordin
ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR ); ReferenceForce::getDeltaR( atomCoordinates[atomI], atomCoordinates[atomJ], deltaR );
if (_obcSoftcoreParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _obcSoftcoreParameters->getCutoffDistance()) if (_obcSoftcoreParameters->getUseCutoff() && deltaR[ReferenceForce::RIndex] > _obcSoftcoreParameters->getCutoffDistance())
continue; continue;
RealOpenMM r2 = deltaR[ReferenceForce::R2Index]; RealOpenMM r2 = deltaR[ReferenceForce::R2Index];
RealOpenMM deltaX = deltaR[ReferenceForce::XIndex]; RealOpenMM deltaX = deltaR[ReferenceForce::XIndex];
RealOpenMM deltaY = deltaR[ReferenceForce::YIndex]; RealOpenMM deltaY = deltaR[ReferenceForce::YIndex];
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#define __CpuObcSoftcore_H__ #define __CpuObcSoftcore_H__
#include "ObcSoftcoreParameters.h" #include "ObcSoftcoreParameters.h"
#include "gbsa/CpuImplicitSolvent.h"
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -109,17 +108,6 @@ class CpuObcSoftcore { ...@@ -109,17 +108,6 @@ class CpuObcSoftcore {
void setIncludeAceApproximation( int includeAceApproximation ); void setIncludeAceApproximation( int includeAceApproximation );
/**---------------------------------------------------------------------------------------
Get energy
@return energy
--------------------------------------------------------------------------------------- */
RealOpenMM getEnergy( void ) const;
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Return OBC chain derivative: size = _implicitSolventParameters->getNumberOfAtoms() Return OBC chain derivative: size = _implicitSolventParameters->getNumberOfAtoms()
...@@ -142,7 +130,7 @@ class CpuObcSoftcore { ...@@ -142,7 +130,7 @@ class CpuObcSoftcore {
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
void computeBornRadii( std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMMVector& bornRadii ); void computeBornRadii( const std::vector<OpenMM::RealVec>& atomCoordinates, RealOpenMMVector& bornRadii );
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
......
...@@ -41,10 +41,16 @@ ...@@ -41,10 +41,16 @@
ObcSoftcoreParameters::ObcSoftcoreParameters( int numberOfAtoms, ObcSoftcoreParameters::ObcType obcType ) : ObcSoftcoreParameters::ObcSoftcoreParameters( int numberOfAtoms, ObcSoftcoreParameters::ObcType obcType ) :
_numberOfAtoms(numberOfAtoms), _numberOfAtoms(numberOfAtoms),
_obcType(obcType), _dielectricOffset(0.009), _nonPolarPreFactor(2.25936), _obcType(obcType),
_soluteDielectric(1.0), _solventDielectric(78.3), _probeRadius(0.14), _dielectricOffset(0.009),
_electricConstant(-0.5*ONE_4PI_EPS0), _pi4Asolv( 28.3919551), _nonPolarPreFactor(2.25936),
_cutoff(false), _periodic(false) { _soluteDielectric(1.0),
_solventDielectric(78.3),
_probeRadius(0.14),
_electricConstant(-0.5*ONE_4PI_EPS0),
_pi4Asolv( 28.3919551),
_cutoff(false),
_periodic(false) {
_atomicRadii.resize( numberOfAtoms ); _atomicRadii.resize( numberOfAtoms );
_scaledRadiusFactors.resize( numberOfAtoms ); _scaledRadiusFactors.resize( numberOfAtoms );
...@@ -156,6 +162,7 @@ RealOpenMM ObcSoftcoreParameters::getBetaObc( void ) const { ...@@ -156,6 +162,7 @@ RealOpenMM ObcSoftcoreParameters::getBetaObc( void ) const {
RealOpenMM ObcSoftcoreParameters::getGammaObc( void ) const { RealOpenMM ObcSoftcoreParameters::getGammaObc( void ) const {
return _gammaObc; return _gammaObc;
} }
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Get solvent dielectric Get solvent dielectric
......
...@@ -77,7 +77,7 @@ class ObcSoftcoreParameters { ...@@ -77,7 +77,7 @@ class ObcSoftcoreParameters {
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
ObcSoftcoreParameters constructor (Simbios) ObcSoftcoreParameters constructor
@param numberOfAtoms number of atoms @param numberOfAtoms number of atoms
...@@ -87,7 +87,7 @@ class ObcSoftcoreParameters { ...@@ -87,7 +87,7 @@ class ObcSoftcoreParameters {
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
ObcSoftcoreParameters destructor (Simbios) ObcSoftcoreParameters destructor
--------------------------------------------------------------------------------------- */ --------------------------------------------------------------------------------------- */
...@@ -115,7 +115,7 @@ class ObcSoftcoreParameters { ...@@ -115,7 +115,7 @@ class ObcSoftcoreParameters {
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Get probe radius (Simbios) Get probe radius
@return probeRadius @return probeRadius
...@@ -125,7 +125,7 @@ class ObcSoftcoreParameters { ...@@ -125,7 +125,7 @@ class ObcSoftcoreParameters {
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Set probe radius (Simbios) Set probe radius
@param probeRadius probe radius @param probeRadius probe radius
...@@ -136,7 +136,7 @@ class ObcSoftcoreParameters { ...@@ -136,7 +136,7 @@ class ObcSoftcoreParameters {
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Get pi4Asolv: used in ACE approximation for nonpolar term Get pi4Asolv: used in ACE approximation for nonpolar term
((RealOpenMM) M_PI)*4.0f*0.0049f*1000.0f; (Simbios) ((RealOpenMM) M_PI)*4.0f*0.0049f*1000.0f;
@return pi4Asolv @return pi4Asolv
...@@ -236,7 +236,7 @@ class ObcSoftcoreParameters { ...@@ -236,7 +236,7 @@ class ObcSoftcoreParameters {
/**--------------------------------------------------------------------------------------- /**---------------------------------------------------------------------------------------
Get solvent dielectric (Simbios) Get solvent dielectric
@return dielectricOffset dielectric offset @return dielectricOffset dielectric offset
......
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