@@ -216,7 +216,8 @@ class ToolOptions : public opts::OptionsPackage {
216216// @endcond
217217// ----------------------------------------------------------------
218218
219- int main (int argc, char *argv[]) {
219+ int main (int argc, char *argv[])
220+ {
220221
221222 string header = invocationHeader (argc, argv);
222223 opts::BasicOptions *bopts = new opts::BasicOptions (msg);
@@ -236,18 +237,19 @@ int main(int argc, char *argv[]) {
236237 AtomicGroup scope = selectAtoms (model, sopts->selection );
237238 bool all_bonds_in_scope = scope.allHaveProperty (Atom::bits::bondsbit);
238239 if (all_bonds_in_scope) {
240+ scope.pruneBonds ();
239241 } else if (topts->bondlength > 0 )
240242 if (scope.hasCoords ())
241243 scope.findBonds (topts->bondlength );
242244 else {
243245 throw (LOOSError (
244- " Model does not have coordinates with which to infer connectivity.\n "
245- ));
246+ " Model does not have coordinates with which to infer connectivity.\n " ));
246247 }
247- else
248+ else {
248249 throw (LOOSError (
249250 " Model selection does not appear to have chemical connectivity, and "
250251 " infer-connectivity has not been set to a positive value.\n " ));
252+ }
251253 pTraj traj = tropts->trajectory ;
252254 traj->updateGroupCoords (model);
253255 // should be a vector of two-atom AGs, each a pair of atoms in a bond
@@ -257,41 +259,49 @@ int main(int argc, char *argv[]) {
257259
258260 // Operating in scanning mode;
259261 // don't report anything except the presence of an unacceptable bond
260- if (topts->timeseries .empty ()) {
262+ if (topts->timeseries .empty ())
263+ {
261264 // if thrown, don't even write invocation to stdout
262265 if (!topts->quiet )
263266 cout << " # " << header << " \n " ;
264-
267+
265268 float dist2 = 0 ;
266- for (auto frame_index : tropts->frameList ()) {
269+ for (auto frame_index : tropts->frameList ())
270+ {
267271 traj->readFrame (frame_index);
268272 traj->updateGroupCoords (scope);
269- for (auto b : bond_list) {
273+ for (auto b : bond_list)
274+ {
270275 dist2 = b[0 ]->coords ().distance2 (b[1 ]->coords ());
271- if (dist2 > max_bond2) {
276+ if (dist2 > max_bond2)
277+ {
272278 if (!topts->quiet )
273- cout << " Issue in frame " << frame_index << " ; bond between atomIDs " << b[0 ]->id () << " and " << b[1 ]->id () <<
274- " is " << sqrtf (dist2) << " Angstroms. Exiting..." << endl;
279+ cout << " Issue in frame " << frame_index << " ; bond between atomIDs " << b[0 ]->id () << " and " << b[1 ]->id () << " is " << sqrtf (dist2) << " Angstroms. Exiting..." << endl;
275280 return EXIT_FAILURE;
276281 }
277282 }
278283 }
279- } else {
284+ }
285+ else
286+ {
280287 // Operating in timeseries mode;
281288 // write a timeseries to file name provided by user
282289 ofstream tsf (topts->timeseries );
283290 bool found_viol = false ;
284291 tsf << " # " << header << " \n "
285292 << " # frame atomID1 atomID2 bondlength\n " ;
286- for (auto frame_index : tropts->frameList ()) {
293+ for (auto frame_index : tropts->frameList ())
294+ {
287295 traj->readFrame (frame_index);
288296 traj->updateGroupCoords (scope);
289297 float dist2 = 0 ;
290- for (auto b : bond_list) {
298+ for (auto b : bond_list)
299+ {
291300 dist2 = b[0 ]->coords ().distance2 (b[1 ]->coords ());
292- if (dist2 > max_bond2) {
301+ if (dist2 > max_bond2)
302+ {
293303 found_viol = true ;
294- tsf << frame_index << " " << b[0 ]->id () << " " << b[1 ]->id ()
304+ tsf << frame_index << " " << b[0 ]->id () << " " << b[1 ]->id ()
295305 << " " << sqrtf (dist2) << " \n " ;
296306 }
297307 }
0 commit comments