Skip to content
Snippets Groups Projects
Commit 58d4332b authored by Gareth Tribello's avatar Gareth Tribello
Browse files

Added checks for manual construction

This is for vessels.  Basically you now can't create a FunctionVessel
without adding a description to the manual of the quantity it
calculates
parent b32a22c0
No related branches found
No related tags found
No related merge requests found
#! FIELDS time p2.sss p2.zzz p3.sss p3.zzz #! FIELDS time p2.spath p2.zpath p3.sss p3.zzz
0.000000 1.9434 0.0001 1.9434 0.0001 0.000000 1.9434 0.0001 1.9434 0.0001
0.250000 1.0090 0.0001 1.0090 0.0001 0.250000 1.0090 0.0001 1.0090 0.0001
0.500000 1.0579 0.0001 1.0579 0.0001 0.500000 1.0579 0.0001 1.0579 0.0001
......
#! FIELDS time parameter p2.sss p2.zzz p3.sss p3.zzz #! FIELDS time parameter p2.spath p2.zpath p3.sss p3.zzz
0.000000 0 2.9260 0.0007 2.9260 0.0007 0.000000 0 2.9260 0.0007 2.9260 0.0007
0.000000 1 -3.2521 -0.0011 -3.2521 -0.0011 0.000000 1 -3.2521 -0.0011 -3.2521 -0.0011
0.000000 2 4.2465 -0.0003 4.2465 -0.0003 0.000000 2 4.2465 -0.0003 4.2465 -0.0003
p2: PATH REFERENCE=all.pdb LAMBDA=69087 p2: PATH REFERENCE=all.pdb LAMBDA=69087
p3: PATHMSD REFERENCE=all.pdb LAMBDA=69087 NEIGH_SIZE=8 NEIGH_STRIDE=5 p3: PATHMSD REFERENCE=all.pdb LAMBDA=69087 NEIGH_SIZE=8 NEIGH_STRIDE=5
PRINT ARG=p2.sss,p2.zzz,p3.sss,p3.zzz STRIDE=1 FILE=colvar FMT=%8.4f PRINT ARG=p2.spath,p2.zpath,p3.sss,p3.zzz STRIDE=1 FILE=colvar FMT=%8.4f
DUMPDERIVATIVES ARG=p2.sss,p2.zzz,p3.sss,p3.zzz STRIDE=1 FILE=deriv FMT=%8.4f DUMPDERIVATIVES ARG=p2.spath,p2.zpath,p3.sss,p3.zzz STRIDE=1 FILE=deriv FMT=%8.4f
#! FIELDS time p2.X p2.Y p2.zzz p3.X p3.Y p3.zzz #! FIELDS time p2.X p2.Y p2.zpath p3.X p3.Y p3.zzz
0.000000 1.9434 2.9434 0.0001 1.9434 2.9434 0.0001 0.000000 1.9434 2.9434 0.0001 1.9434 2.9434 0.0001
0.250000 1.0090 2.0090 0.0001 1.0090 2.0090 0.0001 0.250000 1.0090 2.0090 0.0001 1.0090 2.0090 0.0001
0.500000 1.0579 2.0579 0.0001 1.0579 2.0579 0.0001 0.500000 1.0579 2.0579 0.0001 1.0579 2.0579 0.0001
......
#! FIELDS time parameter p2.X p2.Y p2.zzz p3.X p3.Y p3.zzz #! FIELDS time parameter p2.X p2.Y p2.zpath p3.X p3.Y p3.zzz
0.000000 0 2.9260 2.9260 0.0007 2.9260 2.9260 0.0007 0.000000 0 2.9260 2.9260 0.0007 2.9260 2.9260 0.0007
0.000000 1 -3.2521 -3.2521 -0.0011 -3.2521 -3.2521 -0.0011 0.000000 1 -3.2521 -3.2521 -0.0011 -3.2521 -3.2521 -0.0011
0.000000 2 4.2465 4.2465 -0.0003 4.2465 4.2465 -0.0003 0.000000 2 4.2465 4.2465 -0.0003 4.2465 4.2465 -0.0003
p2: GPROPERTYMAP REFERENCE=allv.pdb PROPERTY=X,Y LAMBDA=69087 p2: GPROPERTYMAP REFERENCE=allv.pdb PROPERTY=X,Y LAMBDA=69087
p3: PROPERTYMAP REFERENCE=allv.pdb PROPERTY=X,Y LAMBDA=69087 NEIGH_SIZE=8 NEIGH_STRIDE=5 p3: PROPERTYMAP REFERENCE=allv.pdb PROPERTY=X,Y LAMBDA=69087 NEIGH_SIZE=8 NEIGH_STRIDE=5
PRINT ARG=p2.X,p2.Y,p2.zzz,p3.X,p3.Y,p3.zzz STRIDE=1 FILE=colvar FMT=%8.4f PRINT ARG=p2.X,p2.Y,p2.zpath,p3.X,p3.Y,p3.zzz STRIDE=1 FILE=colvar FMT=%8.4f
DUMPDERIVATIVES ARG=p2.X,p2.Y,p2.zzz,p3.X,p3.Y,p3.zzz STRIDE=1 FILE=deriv FMT=%8.4f DUMPDERIVATIVES ARG=p2.X,p2.Y,p2.zpath,p3.X,p3.Y,p3.zzz STRIDE=1 FILE=deriv FMT=%8.4f
...@@ -65,7 +65,7 @@ ActionWithVessel(ao) ...@@ -65,7 +65,7 @@ ActionWithVessel(ao)
mymap->setPropertyNames( property, false ); mymap->setPropertyNames( property, false );
} else { } else {
std::vector<std::string> property(1); std::vector<std::string> property(1);
property[0]="sss"; property[0]="spath";
mymap->setPropertyNames( property, true ); mymap->setPropertyNames( property, true );
} }
......
...@@ -76,10 +76,10 @@ PathBase(ao) ...@@ -76,10 +76,10 @@ PathBase(ao)
std::string empty; std::string empty;
if(!nos){ if(!nos){
if( getPropertyIndex("sss")!=0 || getNumberOfProperties()>1 ){ if( getPropertyIndex("spath")!=0 || getNumberOfProperties()>1 ){
error("paths only work when there is a single property called sss being calculated"); error("paths only work when there is a single property called sss being calculated");
} }
empty="LABEL=sss"; empty="LABEL=spath";
addVessel("SPATH",empty,0); addVessel("SPATH",empty,0);
} }
readVesselKeywords(); readVesselKeywords();
......
...@@ -41,7 +41,7 @@ Mapping(ao) ...@@ -41,7 +41,7 @@ Mapping(ao)
// Create the list of tasks // Create the list of tasks
for(unsigned i=0;i<getNumberOfReferencePoints();++i) addTaskToList( i ); for(unsigned i=0;i<getNumberOfReferencePoints();++i) addTaskToList( i );
std::string empty="LABEL=zzz"; std::string empty="LABEL=zpath";
if(!noz) addVessel("ZPATH",empty,0); if(!noz) addVessel("ZPATH",empty,0);
} }
......
...@@ -49,7 +49,7 @@ void SpathVessel::registerKeywords( Keywords& keys ){ ...@@ -49,7 +49,7 @@ void SpathVessel::registerKeywords( Keywords& keys ){
void SpathVessel::reserveKeyword( Keywords& keys ){ void SpathVessel::reserveKeyword( Keywords& keys ){
keys.reserveFlag("SPATH",false,"docs should not appear",true); keys.reserveFlag("SPATH",false,"docs should not appear",true);
keys.addOutputComponent("sss","SPATH","the position on the path"); keys.addOutputComponent("spath","SPATH","the position on the path");
} }
SpathVessel::SpathVessel( const vesselbase::VesselOptions& da ): SpathVessel::SpathVessel( const vesselbase::VesselOptions& da ):
......
...@@ -46,7 +46,7 @@ void ZpathVessel::registerKeywords( Keywords& keys ){ ...@@ -46,7 +46,7 @@ void ZpathVessel::registerKeywords( Keywords& keys ){
void ZpathVessel::reserveKeyword( Keywords& keys ){ void ZpathVessel::reserveKeyword( Keywords& keys ){
keys.reserveFlag("ZPATH",false,"calculate the distance from the low dimensionality manifold",true); keys.reserveFlag("ZPATH",false,"calculate the distance from the low dimensionality manifold",true);
keys.addOutputComponent("zzz","ZPATH","the distance from the path"); keys.addOutputComponent("zpath","ZPATH","the distance from the path");
} }
ZpathVessel::ZpathVessel( const vesselbase::VesselOptions& da ): ZpathVessel::ZpathVessel( const vesselbase::VesselOptions& da ):
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "StoreDataVessel.h" #include "StoreDataVessel.h"
#include "VesselRegister.h" #include "VesselRegister.h"
#include "BridgeVessel.h" #include "BridgeVessel.h"
#include "FunctionVessel.h"
using namespace std; using namespace std;
namespace PLMD{ namespace PLMD{
...@@ -80,7 +81,12 @@ ActionWithVessel::~ActionWithVessel(){ ...@@ -80,7 +81,12 @@ ActionWithVessel::~ActionWithVessel(){
void ActionWithVessel::addVessel( const std::string& name, const std::string& input, const int numlab ){ void ActionWithVessel::addVessel( const std::string& name, const std::string& input, const int numlab ){
VesselOptions da(name,"",numlab,input,this); VesselOptions da(name,"",numlab,input,this);
Vessel* vv=vesselRegister().create(name,da); Vessel* vv=vesselRegister().create(name,da);
FunctionVessel* fv=dynamic_cast<FunctionVessel*>(vv);
if( fv ){
std::string mylabel=Vessel::transformName( name );
plumed_massert( keywords.outputComponentExists(mylabel,false), "a description of the value calculated by vessel " + name + " has not been added to the manual");
}
addVessel(vv); addVessel(vv);
} }
......
...@@ -55,6 +55,19 @@ void Vessel::registerKeywords( Keywords& keys ){ ...@@ -55,6 +55,19 @@ void Vessel::registerKeywords( Keywords& keys ){
keys.add("optional","LABEL","the label used to reference this particular quantity"); keys.add("optional","LABEL","the label used to reference this particular quantity");
} }
std::string Vessel::transformName( const std::string& name ){
std::string tlabel=name;
// Convert to lower case
std::transform( tlabel.begin(), tlabel.end(), tlabel.begin(), tolower );
// Remove any underscore characters (as these are reserved)
for(unsigned i=0;;++i){
std::size_t num=tlabel.find_first_of("_");
if( num==std::string::npos ) break;
tlabel.erase( tlabel.begin() + num, tlabel.begin() + num + 1 );
}
return tlabel;
}
Vessel::Vessel( const VesselOptions& da ): Vessel::Vessel( const VesselOptions& da ):
myname(da.myname), myname(da.myname),
numlab(da.numlab), numlab(da.numlab),
...@@ -70,15 +83,7 @@ log((da.action)->log) ...@@ -70,15 +83,7 @@ log((da.action)->log)
} else { } else {
if( keywords.exists("LABEL") ) parse("LABEL",mylabel); if( keywords.exists("LABEL") ) parse("LABEL",mylabel);
if( mylabel.length()==0 && numlab>=0 ){ if( mylabel.length()==0 && numlab>=0 ){
mylabel=myname; std::string nn; mylabel=transformName( myname ); std::string nn;
// Convert to lower case
std::transform( mylabel.begin(), mylabel.end(), mylabel.begin(), tolower );
// Remove any underscore characters (as these are reserved)
for(unsigned i=0;;++i){
std::size_t num=mylabel.find_first_of("_");
if( num==std::string::npos ) break;
mylabel.erase( mylabel.begin() + num, mylabel.begin() + num + 1 );
}
if(numlab>0){ Tools::convert( numlab, nn ); mylabel = mylabel + "-" + nn; } if(numlab>0){ Tools::convert( numlab, nn ); mylabel = mylabel + "-" + nn; }
else { mylabel = mylabel; } else { mylabel = mylabel; }
} }
......
...@@ -129,6 +129,8 @@ public: ...@@ -129,6 +129,8 @@ public:
Log& log; Log& log;
/// Reserve any keywords for this particular vessel /// Reserve any keywords for this particular vessel
static void registerKeywords( Keywords& keys ); static void registerKeywords( Keywords& keys );
/// Convert the name to the label of the component
static std::string transformName( const std::string& name );
/// The constructor /// The constructor
Vessel( const VesselOptions& da ); Vessel( const VesselOptions& da );
/// Virtual destructor needed for proper inheritance /// Virtual destructor needed for proper inheritance
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment