Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calls to Mersenne Twister for CBMC functions #527

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/cbmc/DCFreeCycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ void DCFreeCycle::BuildNew(TrialMol &newMol, uint molIndex) {
positions[hed.NumBond()].Set(0, newMol.RawRectCoords(anchorBond, 0, 0));

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 0;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down Expand Up @@ -217,9 +221,13 @@ void DCFreeCycle::BuildOld(TrialMol &oldMol, uint molIndex) {
positions[hed.NumBond()].Add(0, -center);

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 1;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
12 changes: 10 additions & 2 deletions src/cbmc/DCFreeCycleSeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,13 @@ void DCFreeCycleSeed::BuildNew(TrialMol &newMol, uint molIndex) {
positions[hed.NumBond()].Set(0, newMol.RawRectCoords(anchorBond, 0, 0));

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 0;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down Expand Up @@ -216,9 +220,13 @@ void DCFreeCycleSeed::BuildOld(TrialMol &oldMol, uint molIndex) {
positions[hed.NumBond()].Add(0, -center);

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 1;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
12 changes: 10 additions & 2 deletions src/cbmc/DCFreeHedron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ void DCFreeHedron::BuildNew(TrialMol &newMol, uint molIndex) {
positions[hed.NumBond()].Set(0, newMol.RawRectCoords(anchorBond, 0, 0));

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 0;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down Expand Up @@ -196,9 +200,13 @@ void DCFreeHedron::BuildOld(TrialMol &oldMol, uint molIndex) {
positions[hed.NumBond()].Add(0, -center);

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 1;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
12 changes: 10 additions & 2 deletions src/cbmc/DCFreeHedronSeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ void DCFreeHedronSeed::BuildNew(TrialMol &newMol, uint molIndex) {
positions[hed.NumBond()].Set(0, newMol.RawRectCoords(anchorBond, 0, 0));

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 0;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down Expand Up @@ -195,9 +199,13 @@ void DCFreeHedronSeed::BuildOld(TrialMol &oldMol, uint molIndex) {
positions[hed.NumBond()].Add(0, -center);

// counting backward to preserve prototype
double u1, u2, u3;
for (uint lj = nLJTrials; lj-- > 1;) {
// convert chosen torsion to 3D positions
RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
u1 = prng();
u2 = prng();
u3 = prng();
RotationMatrix spin = RotationMatrix::UniformRandom(u1, u2, u3);
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
12 changes: 10 additions & 2 deletions src/cbmc/DCRotateCOM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ void DCRotateCOM::BuildNew(TrialMol &newMol, uint molIndex) {
RandRotateZ();
} else {
// convert chosen torsion to 3D positions
spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
double u1, u2, u3;
u1 = prng();
u2 = prng();
u3 = prng();
spin = RotationMatrix::UniformRandom(u1, u2, u3);
}

for (uint a = 0; a < atomNumber; ++a) {
Expand Down Expand Up @@ -287,7 +291,11 @@ void DCRotateCOM::BuildOld(TrialMol &oldMol, uint molIndex) {
RandRotateZ();
} else {
// convert chosen torsion to 3D positions
spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
double u1, u2, u3;
u1 = prng();
u2 = prng();
u3 = prng();
spin = RotationMatrix::UniformRandom(u1, u2, u3);
}

for (uint a = 0; a < atomNumber; ++a) {
Expand Down