diff --git a/src/cltools/Driver.cpp b/src/cltools/Driver.cpp index ddedf50b1c..95c0b3916a 100644 --- a/src/cltools/Driver.cpp +++ b/src/cltools/Driver.cpp @@ -791,10 +791,13 @@ int Driver::main(FILE* in,FILE*out,Communicator& pc) { if( firsta ) { valuefile.printf(" \"%s\" : {\n \"action\" : \"%s\"", av->getLabel().c_str(), keys.getDisplayName().c_str() ); firsta=false; } else valuefile.printf(",\n \"%s\" : {\n \"action\" : \"%s\"", av->getLabel().c_str(), keys.getDisplayName().c_str() ); for(unsigned i=0; igetNumberOfComponents(); ++i) { - Value* myval = av->copyOutput(i); std::string compname = myval->getName(), description; std::size_t dot=compname.find("."); - if( dot!=std::string::npos ) { - std::string cname = compname.substr(dot+1); description = av->getOutputComponentDescription( cname, keys ); - } else description = keys.getOutputComponentDescription(".#!value"); + Value* myval = av->copyOutput(i); std::string compname = myval->getName(), description; + if( av->getLabel()==compname ) { + description = keys.getOutputComponentDescription(".#!value"); + } else { + std::size_t dot=compname.find(av->getLabel() + "."); std::string cname = compname.substr(dot + av->getLabel().length() + 1); + description = av->getOutputComponentDescription( cname, keys ); + } if( description.find("\\")!=std::string::npos ) error("found invalid backslash character in documentation for component " + compname + " in action " + av->getName() + " with label " + av->getLabel() ); valuefile.printf(",\n \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), myval->getValueType().c_str(), description.c_str() ); } @@ -819,10 +822,13 @@ int Driver::main(FILE* in,FILE*out,Communicator& pc) { valuefile.printf(",\n \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), myval->getValueType().c_str(), description.c_str() ); } else { for(unsigned j=0; jgetNumberOfComponents(); ++j) { - Value* myval = av2->copyOutput(j); std::string compname = myval->getName(), description; std::size_t dot=compname.find("."); - if( dot!=std::string::npos ) { - std::string cname = compname.substr(dot+1); description = av2->getOutputComponentDescription( cname, keys ); - } else plumed_merror("should not be outputting description of value from action when using shortcuts"); + Value* myval = av2->copyOutput(j); std::string compname = myval->getName(), description; + if( av2->getLabel()==compname ) { + plumed_merror("should not be outputting description of value from action when using shortcuts"); + } else { + std::size_t dot=compname.find(av2->getLabel() + "."); std::string cname = compname.substr(dot+av2->getLabel().length() + 1); + description = av2->getOutputComponentDescription( cname, keys ); + } if( description.find("\\")!=std::string::npos ) error("found invalid backslash character in documentation for component " + compname + " in action " + av2->getName() + " with label " + av2->getLabel() ); valuefile.printf(",\n \"%s\" : { \"type\": \"%s\", \"description\": \"%s\" }", myval->getName().c_str(), myval->getValueType().c_str(), description.c_str() ); } diff --git a/src/core/Action.cpp b/src/core/Action.cpp index f8f9084bca..27e3bb8272 100644 --- a/src/core/Action.cpp +++ b/src/core/Action.cpp @@ -97,7 +97,7 @@ Action::Action(const ActionOptions&ao): if(label.length()==0) { std::string s; Tools::convert(plumed.getActionSet().size()-plumed.getActionSet().select().size(),s); label="@"+s; - } + } else if ( label.find(".")!=std::string::npos ) warning("using full stop in an action label should be avaoided as . has a special meaning in PLUMED action labels"); if( plumed.getActionSet().selectWithLabel(label) ) error("label " + label + " has been already used"); if( !keywords.exists("NO_ACTION_LOG") ) log.printf(" with label %s\n",label.c_str()); if ( keywords.exists("UPDATE_FROM") ) parse("UPDATE_FROM",update_from);