Skip to content
Snippets Groups Projects
Commit 855a6f3f authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Improved implementation of multi keyword

Also allow a hybrid syntax such as
AT={1 @multi:{5 6 7} 2}

In this case the first and third arguments are the same across replicas,
whereas the second is 5/6/7 on the three replicas respectively
parent b9d42870
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,11 @@ f: COMBINE ARG=d,p1.x,p2.y COEFFICIENTS=@multi:{{1,2,3} {0,0,0} {2,4,6}} PERIODI
PRINT ARG=f FILE=colvar
# equivalent syntax:
#g: COMBINE ARG=d,p1.x,p2.y COEFFICIENTS=@multi:{{1,2,3} {1,0,3} {1,4,3}} PERIODIC=NO
g: COMBINE ARG=d,p1.x,p2.y COEFFICIENTS={1 @multi:{2 0 4} 3} PERIODIC=NO
PRINT ARG=g FILE=colvarg
# different arguments in different replicas
PRINT ARG=@multi:{d,p1.x,p2.x} FILE=multi
......
......@@ -154,7 +154,15 @@ bool Tools::parseVector(std::vector<std::string>&line,const std::string&key,std:
std::vector<std::string> words=getWords(s,"\t\n ,");
for(unsigned i=0;i<words.size();++i){
T v;
if(!convert(words[i],v))return false;
std::string s=words[i];
const std::string multi("@multi:");
if(rep>=0 && startWith(s,multi)){
s=s.substr(multi.length(),s.length());
std::vector<std::string> words=getWords(s,"\t\n ,");
plumed_assert(rep<words.size());
s=words[rep];
}
if(!convert(s,v))return false;
val.push_back(v);
}
return true;
......
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