Skip to content

Commit 5c637a0

Browse files
astyle
1 parent 78d4d5a commit 5c637a0

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

src/xsprint/Xsprint.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ static std::string replaceR0(const std::string& input, double newval) {
9999
while((pos = result.find(needle, pos)) != std::string::npos) {
100100
size_t valstart = pos + needle.length();
101101
size_t valend = result.find_first_of(" \t},", valstart);
102-
if(valend == std::string::npos) valend = result.length();
103-
result = result.substr(0, valstart) + newvalstr + result.substr(valend);
102+
if(valend == std::string::npos) {
103+
valend = result.length();
104+
}
105+
result.replace(valstart, valend - valstart, newvalstr);
104106
pos = valstart + newvalstr.length();
105107
}
106108
return result;
@@ -155,10 +157,12 @@ Xsprint::Xsprint(const ActionOptions& ao):
155157
std::string inum;
156158
Tools::convert( i, inum );
157159
ActionWithValue* av = plumed.getActionSet().selectWithLabel<ActionWithValue*>(
158-
label + "_sprint_coord-" + inum );
159-
if( !av ) break;
160+
label + "_sprint_coord-" + inum );
161+
if( !av ) {
162+
break;
163+
}
160164
readInputLine( label + "_coord-" + inum + ": COMBINE ARG=" +
161-
label + "_sprint_coord-" + inum + " PERIODIC=NO" );
165+
label + "_sprint_coord-" + inum + " PERIODIC=NO" );
162166
}
163167
return;
164168
}
@@ -178,15 +182,17 @@ Xsprint::Xsprint(const ActionOptions& ao):
178182
std::string inum;
179183
Tools::convert( i, inum );
180184
ActionWithValue* av = plumed.getActionSet().selectWithLabel<ActionWithValue*>( mat1 + inum + inum );
181-
if( !av ) break;
185+
if( !av ) {
186+
break;
187+
}
182188
nin_group.push_back( (av->copyOutput(0))->getShape()[0] );
183189
}
184190
if( nin_group.empty() ) {
185191
ActionWithValue* av = plumed.getActionSet().selectWithLabel<ActionWithValue*>( mat1 );
186192
nin_group.push_back( (av->copyOutput(0))->getShape()[0] );
187193
}
188194

189-
// For shells 2..N: create CONTACT_MATRIX with R_0=s*r0,
195+
// For shells 2..N: create CONTACT_MATRIX with R_0=s*r0,
190196
// subtract inner shell, compute SPRINT, respectively
191197
for(unsigned s = 2; s <= nshells; ++s) {
192198
std::string snum, sprev;

0 commit comments

Comments
 (0)