Unverified Commit 862e6ac7 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Fixed error in checking for circular virtual site definitions (#4822)

parent 8879bbf5
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2009-2022 Stanford University and the Authors. * * Portions copyright (c) 2009-2025 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -543,6 +543,7 @@ IntegrationUtilities::IntegrationUtilities(ComputeContext& context, const System ...@@ -543,6 +543,7 @@ IntegrationUtilities::IntegrationUtilities(ComputeContext& context, const System
while (sites.size() > 0) { while (sites.size() > 0) {
if (sites.size() == remainingSites) if (sites.size() == remainingSites)
throw OpenMMException("Virtual site definitions are circular"); throw OpenMMException("Virtual site definitions are circular");
remainingSites = sites.size();
for (auto index = sites.begin(); index != sites.end();) { for (auto index = sites.begin(); index != sites.end();) {
const VirtualSite& site = system.getVirtualSite(*index); const VirtualSite& site = system.getVirtualSite(*index);
bool canCompute = true; bool canCompute = true;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2012-2017 Stanford University and the Authors. * * Portions copyright (c) 2012-2025 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -47,6 +47,7 @@ ReferenceVirtualSites::ReferenceVirtualSites(const System& system) { ...@@ -47,6 +47,7 @@ ReferenceVirtualSites::ReferenceVirtualSites(const System& system) {
while (sites.size() > 0) { while (sites.size() > 0) {
if (sites.size() == remainingSites) if (sites.size() == remainingSites)
throw OpenMMException("Virtual site definitions are circular"); throw OpenMMException("Virtual site definitions are circular");
remainingSites = sites.size();
for (auto index = sites.begin(); index != sites.end();) { for (auto index = sites.begin(); index != sites.end();) {
const VirtualSite& site = system.getVirtualSite(*index); const VirtualSite& site = system.getVirtualSite(*index);
bool canCompute = true; bool canCompute = true;
......
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