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

Fixed numeric overflow (#4650)

parent b28d2e66
......@@ -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) 2013-2018 Stanford University and the Authors. *
* Portions copyright (c) 2013-2024 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
......@@ -37,13 +37,13 @@ using namespace std;
CpuSETTLE::CpuSETTLE(const System& system, const ReferenceSETTLEAlgorithm& settle, ThreadPool& threads) : threads(threads) {
int numBlocks = 10*threads.getNumThreads();
int numClusters = settle.getNumClusters();
long long numClusters = settle.getNumClusters();
vector<double> mass(system.getNumParticles());
for (int i = 0; i < system.getNumParticles(); i++)
mass[i] = system.getParticleMass(i);
for (int i = 0; i < numBlocks; i++) {
int start = i*numClusters/numBlocks;
int end = (i+1)*numClusters/numBlocks;
int start = (int) (i*numClusters/numBlocks);
int end = (int) ((i+1)*numClusters/numBlocks);
if (start != end) {
int numThreadClusters = end-start;
vector<int> atom1(numThreadClusters), atom2(numThreadClusters), atom3(numThreadClusters);
......
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