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

Better formatting output

For a few actions that typically write long lists,
I fixed the format to write only 25 fields per line.
parent 867be1a3
No related branches found
No related tags found
No related merge requests found
...@@ -149,10 +149,13 @@ Gyration::Gyration(const ActionOptions&ao): ...@@ -149,10 +149,13 @@ Gyration::Gyration(const ActionOptions&ao):
if(rg_type>TRACE) log<<" Bibliography "<<plumed.cite("Jirí Vymetal and Jirí Vondrasek, J. Phys. Chem. A 115, 11455 (2011)"); log<<"\n"; if(rg_type>TRACE) log<<" Bibliography "<<plumed.cite("Jirí Vymetal and Jirí Vondrasek, J. Phys. Chem. A 115, 11455 (2011)"); log<<"\n";
log.printf(" atoms involved : "); log.printf(" atoms involved : ");
for(unsigned i=0; i<atoms.size(); ++i) log.printf("%d ",atoms[i].serial()); for(unsigned i=0; i<atoms.size(); ++i) {
if(i%25==0) log<<"\n";
log.printf("%d ",atoms[i].serial());
}
log.printf("\n"); log.printf("\n");
if(!nopbc) { if(nopbc) {
log<<" PBC will be ignored\n"; log<<" PBC will be ignored\n";
} else { } else {
log<<" broken molecules will be rebuilt assuming atoms are in the proper order\n"; log<<" broken molecules will be rebuilt assuming atoms are in the proper order\n";
......
...@@ -175,11 +175,14 @@ Group::Group(const ActionOptions&ao): ...@@ -175,11 +175,14 @@ Group::Group(const ActionOptions&ao):
parseAtomList("REMOVE",remove); parseAtomList("REMOVE",remove);
if(remove.size()>0) { if(remove.size()>0) {
std::vector<AtomNumber> notfound; std::vector<AtomNumber> notfound;
unsigned k=0;
log<<" removing these atoms from the list:"; log<<" removing these atoms from the list:";
for(unsigned i=0; i<remove.size(); i++) { for(unsigned i=0; i<remove.size(); i++) {
const auto it = find(atoms.begin(),atoms.end(),remove[i]); const auto it = find(atoms.begin(),atoms.end(),remove[i]);
if(it!=atoms.end()) { if(it!=atoms.end()) {
if(k%25==0) log<<"\n";
log<<" "<<(*it).serial(); log<<" "<<(*it).serial();
k++;
atoms.erase(it); atoms.erase(it);
} else notfound.push_back(remove[i]); } else notfound.push_back(remove[i]);
} }
...@@ -205,8 +208,11 @@ Group::Group(const ActionOptions&ao): ...@@ -205,8 +208,11 @@ Group::Group(const ActionOptions&ao):
} }
this->atoms.insertGroup(getLabel(),atoms); this->atoms.insertGroup(getLabel(),atoms);
log.printf(" list of atoms "); log.printf(" list of atoms:");
for(unsigned i=0; i<atoms.size(); i++) log<<" "<<atoms[i].serial(); for(unsigned i=0; i<atoms.size(); i++) {
if(i%25==0) log<<"\n";
log<<" "<<atoms[i].serial();
}
log.printf("\n"); log.printf("\n");
} }
......
...@@ -94,7 +94,10 @@ COM::COM(const ActionOptions&ao): ...@@ -94,7 +94,10 @@ COM::COM(const ActionOptions&ao):
parseFlag("NOPBC",nopbc); parseFlag("NOPBC",nopbc);
checkRead(); checkRead();
log.printf(" of atoms"); log.printf(" of atoms");
for(unsigned i=0; i<atoms.size(); ++i) log.printf(" %d",atoms[i].serial()); for(unsigned i=0; i<atoms.size(); ++i) {
if(i%25==0) log<<"\n";
log.printf(" %d",atoms[i].serial());
}
log.printf("\n"); log.printf("\n");
if(!nopbc) { if(!nopbc) {
log<<" PBC will be ignored\n"; log<<" PBC will be ignored\n";
......
...@@ -108,20 +108,29 @@ Center::Center(const ActionOptions&ao): ...@@ -108,20 +108,29 @@ Center::Center(const ActionOptions&ao):
parseFlag("MASS",weight_mass); parseFlag("MASS",weight_mass);
parseFlag("NOPBC",nopbc); parseFlag("NOPBC",nopbc);
checkRead(); checkRead();
log.printf(" of atoms"); log.printf(" of atoms:");
for(unsigned i=0; i<atoms.size(); ++i) log.printf(" %d",atoms[i].serial()); for(unsigned i=0; i<atoms.size(); ++i) {
if(i%25==0) log<<"\n";
log.printf(" %d",atoms[i].serial());
}
log<<"\n";
if(weight_mass) { if(weight_mass) {
log<<" mass weighted\n"; log<<" mass weighted\n";
if(weights.size()!=0) error("WEIGHTS and MASS keywords should not be used simultaneously"); if(weights.size()!=0) error("WEIGHTS and MASS keywords should not be used simultaneously");
} else { } else {
if( weights.size()==0) { if( weights.size()==0) {
log<<" using the geometric center\n";
weights.resize( atoms.size() ); weights.resize( atoms.size() );
for(unsigned i=0; i<atoms.size(); i++) weights[i] = 1.; for(unsigned i=0; i<atoms.size(); i++) weights[i] = 1.;
} else {
log<<" with weights:";
if( weights.size()!=atoms.size() ) error("number of elements in weight vector does not match the number of atoms");
for(unsigned i=0; i<weights.size(); ++i) {
if(i%25==0) log<<"\n";
log.printf(" %f",weights[i]);
}
log.printf("\n");
} }
log<<" with weights";
if( weights.size()!=atoms.size() ) error("number of elements in weight vector does not match the number of atoms");
for(unsigned i=0; i<weights.size(); ++i) log.printf(" %f",weights[i]);
log.printf("\n");
} }
if(!nopbc) { if(!nopbc) {
log<<" PBC will be ignored\n"; log<<" PBC will be ignored\n";
......
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