Skip to content

Commit

Permalink
Add cutoff setting in DMFF model.
Browse files Browse the repository at this point in the history
dingye18 committed Jan 1, 2024
1 parent 5ce196d commit 2547786
Showing 4 changed files with 26 additions and 2 deletions.
12 changes: 11 additions & 1 deletion backend/openmm_dmff_plugin/openmmapi/include/DMFFForce.h
Original file line number Diff line number Diff line change
@@ -77,7 +77,17 @@ class OPENMM_EXPORT_DMFF DMFFForce : public OpenMM::Force {
* @param hasAux : true if model was saved with auxilary input.
*/
void setHasAux(const bool hasAux);

/**
* @brief Set the Cutoff for neighbor list fetching.
*
* @param cutoff
*/
void setCutoff(const double cutoff);
/**
* @brief get the DMFF graph file.
*
* @return const std::string&
*/
const std::string& getDMFFGraphFile() const;
/**
* @brief Get the Coord Unit Coefficient.
4 changes: 4 additions & 0 deletions backend/openmm_dmff_plugin/openmmapi/src/DMFFForce.cpp
Original file line number Diff line number Diff line change
@@ -58,6 +58,10 @@ void DMFFForce::setHasAux(const bool hasAux){
this->has_aux = hasAux;
}

void DMFFForce::setCutoff(const double cutoff){
this->cutoff = cutoff;
}

double DMFFForce::getCoordUnitCoefficient() const {return coordCoeff;}
double DMFFForce::getForceUnitCoefficient() const {return forceCoeff;}
double DMFFForce::getEnergyUnitCoefficient() const {return energyCoeff;}
2 changes: 1 addition & 1 deletion backend/openmm_dmff_plugin/python/OpenMMDMFFPlugin.i
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public:

void setUnitTransformCoefficients(const double coordCoefficient, const double forceCoefficient, const double energyCoefficient);
void setHasAux(const bool hasAux);

void setCutoff(const double cutoff);
/*
* Add methods for casting a Force to a DMFFForce.
*/
10 changes: 10 additions & 0 deletions backend/openmm_dmff_plugin/python/OpenMMDMFFPlugin/tools.py
Original file line number Diff line number Diff line change
@@ -78,6 +78,16 @@ def setHasAux(self, has_aux = False):
has_aux (bool, optional): Defaults to False.
"""
self.dmff_force.setHasAux(has_aux)
return

def setCutoff(self, cutoff = 1.2):
"""Set the cutoff for the DMFF model.
Args:
cutoff (float, optional): Defaults to 1.2.
"""
self.dmff_force.setCutoff(cutoff)
return

def createSystem(self, topology):
"""Create the OpenMM System object for the DMFF model.

0 comments on commit 2547786

Please sign in to comment.