Skip to content

Commit

Permalink
Don't call RotationMatrix::UniformRandom with prng() calls as functio…
Browse files Browse the repository at this point in the history
…n parameters so that gcc and intel give consistent results
  • Loading branch information
LSchwiebert committed Jul 10, 2024
1 parent 55726de commit afe876d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 10 deletions.
14 changes: 12 additions & 2 deletions src/cbmc/DCFreeCycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
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 +222,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
14 changes: 12 additions & 2 deletions src/cbmc/DCFreeCycleSeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
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 +221,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
14 changes: 12 additions & 2 deletions src/cbmc/DCFreeHedron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
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 +201,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
14 changes: 12 additions & 2 deletions src/cbmc/DCFreeHedronSeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
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 +200,14 @@ 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);
// RotationMatrix spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
for (uint b = 0; b < hed.NumBond() + 1; ++b) {
// find positions
positions[b].Set(lj, spin.Apply(positions[b][0]));
Expand Down
14 changes: 12 additions & 2 deletions src/cbmc/DCRotateCOM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ 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);
// spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
}

for (uint a = 0; a < atomNumber; ++a) {
Expand Down Expand Up @@ -287,7 +292,12 @@ 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);
// spin = RotationMatrix::UniformRandom(prng(), prng(), prng());
}

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

0 comments on commit afe876d

Please sign in to comment.