Skip to content

Commit 5eeb296

Browse files
committed
Merge branch 'upstream-objcryst'
# Conflicts: # ObjCryst/doc/Doxyfile # ObjCryst/doc/doc-main.h
2 parents fbf2c5e + b6435af commit 5eeb296

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/ObjCryst/ObjCryst/Molecule.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -5373,6 +5373,13 @@ void Molecule::BuildConnectivityTable()const
53735373
VFN_DEBUG_ENTRY("Molecule::BuildConnectivityTable()",5)
53745374
TAU_PROFILE("Molecule::BuildConnectivityTable()","void ()",TAU_DEFAULT);
53755375
mConnectivityTable.clear();
5376+
5377+
// First create an entry for all atoms in the table - avoids empty pointers
5378+
// in the (pathological) case where some (or all) atoms are not connected
5379+
for (unsigned long i = 0; i < mvpAtom.size(); ++i)
5380+
mConnectivityTable[mvpAtom[i]];
5381+
5382+
// Then build the table from existing bonds
53765383
for(unsigned long i=0;i<mvpBond.size();++i)
53775384
{
53785385
mConnectivityTable[&(mvpBond[i]->GetAtom1())].insert(&(mvpBond[i]->GetAtom2()));
@@ -5396,6 +5403,13 @@ void Molecule::BuildConnectivityTable()const
53965403
}
53975404
}
53985405
#endif
5406+
// No atom should be un-connected, so warn if that happens
5407+
// In fact all atoms should be inter-connected to all others...
5408+
for (unsigned long i = 0; i < mvpAtom.size(); ++i)
5409+
if (mConnectivityTable[mvpAtom[i]].size() == 0)
5410+
cout << "Warning: Molecule '" << this->GetName() << "' ConnectivityTable: Atom #"
5411+
<< i << "(" << mvpAtom[i]->GetName() << ") has no bond !" << endl;
5412+
53995413
mClockConnectivityTable.Click();
54005414
VFN_DEBUG_EXIT("Molecule::BuildConnectivityTable()",5)
54015415
}

0 commit comments

Comments
 (0)