Skip to content

Commit

Permalink
Merge pull request #412 from michellab/feature_pmefep_2023
Browse files Browse the repository at this point in the history
Support for PME in SOMD FEP [ci skip]
  • Loading branch information
lohedges authored Nov 16, 2022
2 parents 485c0c6 + 3d5296b commit 13e5112
Show file tree
Hide file tree
Showing 20 changed files with 19,430 additions and 769 deletions.
2 changes: 2 additions & 0 deletions corelib/src/libs/SireMove/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ set ( SIREMOVE_OPENMM_HEADERS
openmmmdintegrator.h
openmmfrenergydt.h
openmmfrenergyst.h
openmmpmefep.h
)

set ( SIREMOVE_OPENMM_SOURCES
openmmmdintegrator.cpp
openmmfrenergydt.cpp
openmmfrenergyst.cpp
openmmpmefep.cpp
)

if ( ${SIRE_USE_OPENMM} )
Expand Down
142 changes: 89 additions & 53 deletions corelib/src/libs/SireMove/openmmfrenergyst.cpp

Large diffs are not rendered by default.

20 changes: 11 additions & 9 deletions corelib/src/libs/SireMove/openmmfrenergyst.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ SIREMOVE_EXPORT QDataStream& operator>>(QDataStream&, SireMove::OpenMMFrEnergyST

namespace SireMove {

/** This class implements single topology a free energy method using OpenMM.
/** This class implements single topology a free energy method using OpenMM.
@author Julien Michel,Gaetano Calabro and Antonia Mey
*/
class SIREMOVE_EXPORT OpenMMFrEnergyST
Expand Down Expand Up @@ -108,7 +108,7 @@ namespace SireMove {

QString getCombiningRules(void);
void setCombiningRules(QString);

QString getCutoffType(void);
void setCutoffType(QString);

Expand Down Expand Up @@ -200,17 +200,19 @@ namespace SireMove {
int getRandomSeed(void);
void setRandomSeed(int);

void setDebug(bool);

private:
void createContext(IntegratorWorkspace &workspace,
SireUnits::Dimension::Time timestep);
void destroyContext();
void updateBoxDimensions(OpenMM::State &state_openmm,
QVector<QVector<Vector>> &buffered_dimensions, bool Debug,
AtomicVelocityWorkspace &ws);
void updateBoxDimensions(OpenMM::State &state_openmm,
QVector<QVector<Vector>> &buffered_dimensions,
AtomicVelocityWorkspace &ws);

double getPotentialEnergyAtLambda(double lambda);
void updateOpenMMContextLambda(double lambda);
boost::tuples::tuple<double, double, double> calculateGradient(double increment_plus,
boost::tuples::tuple<double, double, double> calculateGradient(double increment_plus,
double increment_minus, double potential_energy_lambda, double beta);
QVector<double> computeReducedPerturbedEnergies(double);
void emptyContainers(void);
Expand Down Expand Up @@ -282,7 +284,7 @@ namespace SireMove {
QVector<double> pot_energies;

QVector<double> forward_Metropolis;

QVector<double> backward_Metropolis;

QVector<QVector <double> > reduced_perturbed_energies;
Expand Down
9 changes: 4 additions & 5 deletions corelib/src/libs/SireMove/openmmmdintegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ void OpenMMMDIntegrator::initialise()
flag_cutoff = CUTOFFPERIODIC;
else if (CutoffType == "ewald")
flag_cutoff = EWALD;
else if (CutoffType == "pme")
else if (CutoffType == "PME")
flag_cutoff = PME;
else
throw SireError::program_bug(QObject::tr(
"The CutOff method has not been specified. Possible choices: nocutoff, cutoffnonperiodic, cutoffperiodic,ewal,pme"), CODELOC);
"The CutOff method has not been specified. Possible choices: nocutoff, cutoffnonperiodic, cutoffperiodic,ewal,PME"), CODELOC);

if (Debug)
qDebug() << "\nCutoffType = " << CutoffType << "\n";
Expand Down Expand Up @@ -1485,8 +1485,7 @@ System OpenMMMDIntegrator::equilibrateSystem(System &system,

const int nmols = ws.nMolecules();
int k = 0;
double Ekin_sire = 0;
double Ekin_openmm = 0;

for (int i = 0; i < nmols; i++)
{

Expand Down Expand Up @@ -1713,7 +1712,7 @@ void OpenMMMDIntegrator::integrate(IntegratorWorkspace &workspace, const Symbol

int k = 0;
double Ekin_openmm=0;
double Ekin_sire=0;

for (int i = 0; i < nmols; i++)
{
Vector *sire_coords = ws.coordsArray(i);
Expand Down
Loading

0 comments on commit 13e5112

Please sign in to comment.