Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/secondarystructure/AlphaRMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ AlphaRMSD::AlphaRMSD(const ActionOptions&ao):
std::string structure;
SecondaryStructureInput::addStructure( structure, 1, reference );

bool nopbc=false;
std::string distanceAction = SecondaryStructureInput::readDistanceAction( this, nopbc );
std::string nopbc, usegpu;
std::string distanceAction = SecondaryStructureInput::readDistanceAction( this, nopbc, usegpu );
std::string lab = getShortcutLabel() + "_rmsd";
if( uselessthan ) {
lab = getShortcutLabel();
Expand All @@ -194,7 +194,7 @@ AlphaRMSD::AlphaRMSD(const ActionOptions&ao):
}
readInputLine( lab + ": " + distanceAction + seglist + structure + " " + atoms );
// Create the less than object
readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}");
readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}" + usegpu );
SecondaryStructureInput::addSum( this, uselessthan );
}

Expand Down
10 changes: 5 additions & 5 deletions src/secondarystructure/AntibetaRMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ AntibetaRMSD::AntibetaRMSD(const ActionOptions&ao):
std::string structure;
SecondaryStructureInput::addStructure( structure, 1, reference );

bool nopbc=false;
std::string distanceAction = SecondaryStructureInput::readDistanceAction( this, nopbc );
std::string nopbc, usegpu;
std::string distanceAction = SecondaryStructureInput::readDistanceAction( this, nopbc, usegpu );
std::string lab = getShortcutLabel() + "_rmsd";
if( uselessthan ) {
lab = getShortcutLabel();
Expand All @@ -306,7 +306,7 @@ AntibetaRMSD::AntibetaRMSD(const ActionOptions&ao):

if( strands_cutoff>0 ) {
// The distance used for the cutoff has to treat the periodic boundary conditions as the rest of the calculation
readInputLine( scutoff_action + (nopbc ? " NOPBC" : "") );
readInputLine( scutoff_action + nopbc + usegpu );
std::string str_cut;
Tools::convert( strands_cutoff, str_cut );
readInputLine( getShortcutLabel() + "_cut: CUSTOM ARG=" + getShortcutLabel()
Expand All @@ -315,15 +315,15 @@ AntibetaRMSD::AntibetaRMSD(const ActionOptions&ao):
readInputLine(inputLine);
// Create the less than object
readInputLine( getShortcutLabel() + "_ltu: LESS_THAN ARG=" + lab
+ " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut");
+ " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut" + usegpu );
// Multiply by the strands cutoff
readInputLine( getShortcutLabel()
+ "_lt: CUSTOM ARG=" + getShortcutLabel() + "_ltu,"
+ getShortcutLabel() + "_cut"
" FUNC=x*y PERIODIC=NO");
} else {
readInputLine(inputLine);
readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}");
readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}" + usegpu );
}
SecondaryStructureInput::addSum( this, uselessthan );
}
Expand Down
10 changes: 5 additions & 5 deletions src/secondarystructure/ParabetaRMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ ParabetaRMSD::ParabetaRMSD(const ActionOptions&ao):
reference[29]=Vector( 0.486, 4.430, -0.415); // O
SecondaryStructureInput::addStructure( structure, 2, reference );

bool nopbc=false;
std::string distanceAction = SecondaryStructureInput::readDistanceAction( this, nopbc );
std::string nopbc, usegpu;
std::string distanceAction = SecondaryStructureInput::readDistanceAction( this, nopbc, usegpu );
std::string lab = getShortcutLabel() + "_low";
if( uselessthan ) {
lab = getShortcutLabel();
Expand All @@ -344,7 +344,7 @@ ParabetaRMSD::ParabetaRMSD(const ActionOptions&ao):

if( strands_cutoff>0 ) {
// The distance used for the cutoff has to treat the periodic boundary conditions as the rest of the calculation
readInputLine( scutoff_action + (nopbc ? " NOPBC" : "") );
readInputLine( scutoff_action + nopbc + usegpu );
std::string str_cut;
Tools::convert( strands_cutoff, str_cut );
readInputLine( getShortcutLabel() + "_cut: CUSTOM ARG=" + getShortcutLabel()
Expand All @@ -356,7 +356,7 @@ ParabetaRMSD::ParabetaRMSD(const ActionOptions&ao):
+ getShortcutLabel() + "_both.struct-2 MASK=" + getShortcutLabel() + "_cut");
// Create the less than object
readInputLine( getShortcutLabel() + "_ltu: LESS_THAN ARG=" + lab
+ " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut");
+ " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut" + usegpu );
// Multiply by the strands cutoff
readInputLine( getShortcutLabel()
+ "_lt: CUSTOM ARG=" + getShortcutLabel() + "_ltu,"
Expand All @@ -368,7 +368,7 @@ ParabetaRMSD::ParabetaRMSD(const ActionOptions&ao):
readInputLine( lab + ": LOWEST ARG=" + getShortcutLabel() + "_both.struct-1,"
+ getShortcutLabel() + "_both.struct-2" );
// Create the less than object
readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}");
readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}" + usegpu );
}
SecondaryStructureInput::addSum( this, uselessthan );
}
Expand Down
26 changes: 12 additions & 14 deletions src/secondarystructure/SecondaryStructureBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ class SecondaryStructureBase: public ActionWithVector {
static void registerKeywords( Keywords& keys );
static void readBackboneAtoms( ActionShortcut* action, PlumedMain& plumed, const std::string& backnames, std::vector<unsigned>& chain_lengths, std::vector<std::string>& all_atoms );
static bool readShortcutWords( std::string& ltmap, ActionShortcut* action );
/// Read TYPE, NOPBC and USEGPU in a shortcut: returns the name and the keywords of the action that computes the distances
static std::string readDistanceAction( ActionShortcut* action, bool& nopbc );
/// Read TYPE, NOPBC and USEGPU in a shortcut: returns the name and the keywords of the action that computes the distances.
/// nopbc and usegpu are set to " NOPBC" and " USEGPU" (or empty) for the other actions of the shortcut
static std::string readDistanceAction( ActionShortcut* action, std::string& nopbc, std::string& usegpu );
/// Append " SEGMENTnum=nlist[0],nlist[1],..." to line
static void addSegment( std::string& line, unsigned num, const std::vector<unsigned>& nlist );
/// Append " STRUCTUREnum=x0,y0,z0,x1,..." (in Angstrom) to line
Expand Down Expand Up @@ -131,25 +132,22 @@ bool SecondaryStructureBase<T,myPTM>::readShortcutWords( std::string& ltmap, Act
}

template <class T,typename myPTM>
std::string SecondaryStructureBase<T,myPTM>::readDistanceAction( ActionShortcut* action, bool& nopbc ) {
std::string SecondaryStructureBase<T,myPTM>::readDistanceAction( ActionShortcut* action, std::string& nopbc, std::string& usegpu ) {
std::string type;
action->parse("TYPE",type);
// RMSD only accepts upper case names
std::transform( type.begin(), type.end(), type.begin(), [](unsigned char c) {
return std::toupper(c);
} );
bool flag=false;
action->parseFlag("NOPBC",flag);
nopbc = flag ? " NOPBC" : "";
// with USEGPU the shortcuts also run on the GPU the actions that the openaccPTM plugin provides (DISTANCE and LESS_THAN)
flag=false;
action->parseFlag("USEGPU",flag);
usegpu = flag ? " USEGPU" : "";
// BONDLENGTH is in nm, see the constructor
std::string line = type=="DRMSD" ? "SECONDARY_STRUCTURE_DRMSD BONDLENGTH=0.17" : "SECONDARY_STRUCTURE_RMSD TYPE=" + type;
action->parseFlag("NOPBC",nopbc);
if( nopbc ) {
line += " NOPBC";
}
bool usegpu=false;
action->parseFlag("USEGPU",usegpu);
if( usegpu ) {
line += " USEGPU";
}
return line;
return (type=="DRMSD" ? "SECONDARY_STRUCTURE_DRMSD BONDLENGTH=0.17" : "SECONDARY_STRUCTURE_RMSD TYPE=" + type) + nopbc + usegpu;
}

template <class T,typename myPTM>
Expand Down
Loading