Commit 71ec749c authored by Peter Eastman's avatar Peter Eastman
Browse files

Take virtual sites into account when identifying molecules

parent b593e034
......@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -245,6 +245,13 @@ const vector<vector<int> >& ContextImpl::getMolecules() const {
vector<pair<int, int> > forceBonds = forceImpls[i]->getBondedParticles();
bonds.insert(bonds.end(), forceBonds.begin(), forceBonds.end());
}
for (int i = 0; i < system.getNumParticles(); i++) {
if (system.isVirtualSite(i)) {
const VirtualSite& site = system.getVirtualSite(i);
for (int j = 0; j < site.getNumParticles(); j++)
bonds.push_back(std::make_pair(i, site.getParticle(j)));
}
}
// Make a list of every other particle to which each particle is connected
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment