@@ -233,20 +233,21 @@ int main(int argc, char *argv[]) {
233233
234234 // set up system for looping. Load coords from frame 0 into scope.
235235 AtomicGroup model = tropts->model ;
236- if (model.hasBonds ()) {
236+ AtomicGroup scope = selectAtoms (model, sopts->selection );
237+ bool all_bonds_in_scope = scope.allHaveProperty (Atom::bits::bondsbit);
238+ if (all_bonds_in_scope) {
237239 } else if (topts->bondlength > 0 )
238- if (model .hasCoords ())
239- model .findBonds (topts->bondlength );
240+ if (scope .hasCoords ())
241+ scope .findBonds (topts->bondlength );
240242 else {
241243 throw (LOOSError (
242244 " Model does not have coordinates with which to infer connectivity.\n "
243245 ));
244246 }
245247 else
246248 throw (LOOSError (
247- " Model does not appear to have chemical connectivity, and "
249+ " Model selection does not appear to have chemical connectivity, and "
248250 " infer-connectivity has not been set to a positive value.\n " ));
249- AtomicGroup scope = selectAtoms (model, sopts->selection );
250251 pTraj traj = tropts->trajectory ;
251252 traj->updateGroupCoords (model);
252253 // should be a vector of two-atom AGs, each a pair of atoms in a bond
@@ -260,11 +261,17 @@ int main(int argc, char *argv[]) {
260261 // if thrown, don't even write invocation to stdout
261262 if (!topts->quiet )
262263 cout << " # " << header << " \n " ;
264+
265+ float dist2 = 0 ;
263266 for (auto frame_index : tropts->frameList ()) {
264267 traj->readFrame (frame_index);
265268 traj->updateGroupCoords (scope);
266269 for (auto b : bond_list) {
267- if (b[0 ]->coords ().distance2 (b[1 ]->coords ()) > max_bond2) {
270+ dist2 = b[0 ]->coords ().distance2 (b[1 ]->coords ());
271+ if (dist2 > max_bond2) {
272+ 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;
268275 return EXIT_FAILURE;
269276 }
270277 }
0 commit comments