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

Merge Development Updates into MEMC_Liq #538

Merged
merged 23 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
21f20ce
Extend and optimize implementation of the XYZ operators
LSchwiebert May 14, 2024
3c7b0bb
Fix calls to Mersenne Twister for CBMC functions
LSchwiebert Jul 12, 2024
124ff98
Fix grammar in comment
LSchwiebert Aug 7, 2024
6b2a8ea
Remove duplicate dihedrals with the same periodicity and issue a warning
LSchwiebert Aug 7, 2024
02bfcf6
Generate error instead of warning if duplicates have different parame…
LSchwiebert Aug 8, 2024
61d0398
Also check for duplicate Bonds, Angles, etc. and minor code cleanup
LSchwiebert Aug 21, 2024
34c80ab
Enhance patch to print filename in warnings
LSchwiebert Aug 23, 2024
0dd9bcd
Update new warning messages
LSchwiebert Aug 24, 2024
a3a7c1c
Update warning message for duplicated dihedrals
LSchwiebert Aug 24, 2024
f332038
Fix log message for Intra-MEMC1 move
LSchwiebert Oct 12, 2024
8f05a7f
Explicitly call std library sqrt function
LSchwiebert Oct 28, 2024
a505e46
Merge pull request #530 from GOMC-WSU/duplicate-dihedral
LSchwiebert Nov 27, 2024
aeb47e5
Merge pull request #532 from GOMC-WSU/MEMC-patch
HamiedAsadi Dec 5, 2024
6bd545e
Merge pull request #524 from GOMC-WSU/basictypes
LSchwiebert Dec 5, 2024
9563e13
Pass more forcefield parameters to the GPU for consistency
LSchwiebert Dec 13, 2024
b0b0b3f
Reformat per clang formatting rules
LSchwiebert Dec 13, 2024
a27ca12
Merge pull request #535 from GOMC-WSU/forcefield-params
HamiedAsadi Dec 13, 2024
303f1f7
Merge pull request #527 from GOMC-WSU/mersenne-twister
HamiedAsadi Dec 13, 2024
4bd3279
Recognize newer OpenMP version date-codes
LSchwiebert Jan 20, 2025
ec61655
Terminate GOMC (with an error message) if the initial configuration h…
LSchwiebert Jan 20, 2025
a3138bf
Reformat updated code and revise comment
LSchwiebert Jan 20, 2025
cef510c
Merge pull request #537 from GOMC-WSU/openmp-versions
jpotoff Jan 27, 2025
c7a79c5
Merge pull request #536 from GOMC-WSU/bad-config
jpotoff Jan 27, 2025
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
63 changes: 30 additions & 33 deletions lib/BasicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,44 +97,38 @@ inline void record_debug(uint *x, uint len, std::string filename,

//******************************************************************************

typedef unsigned int uint;
typedef unsigned long int ulong;

#define UNUSED(x) (void)(x)

// single XYZ for use as a temporary and return type
struct XYZ {
double x, y, z;

// single XYZ coordinate for use as a temporary and return type
class XYZ {
public:
XYZ() : x(0.0), y(0.0), z(0.0) {}
XYZ(double xVal, double yVal, double zVal) : x(xVal), y(yVal), z(zVal) {}

friend inline std::ostream &operator<<(std::ostream &stream, const XYZ &p);

inline double getX() const { return x; }
inline double getY() const { return y; }
inline double getZ() const { return z; }

void Reset() { x = y = z = 0.0; }
XYZ &operator=(XYZ const &rhs) {
x = rhs.x;
y = rhs.y;
z = rhs.z;
return *this;
}
bool operator==(XYZ const &rhs) {
if (x == rhs.x && y == rhs.y && z == rhs.z)
return true;
return false;
inline bool operator==(XYZ const &rhs) const {
return (x == rhs.x && y == rhs.y && z == rhs.z);
}
bool operator!=(XYZ const &rhs) {
if (x != rhs.x || y != rhs.y || z != rhs.z)
return true;
return false;
inline bool operator!=(XYZ const &rhs) const {
return (x != rhs.x || y != rhs.y || z != rhs.z);
}
bool operator<(XYZ const &rhs) {
if (x < rhs.x && y < rhs.y && z < rhs.z)
return true;
return false;
inline bool operator<(XYZ const &rhs) const {
return (x < rhs.x && y < rhs.y && z < rhs.z);
}
bool operator>(XYZ const &rhs) {
if (x > rhs.x || y > rhs.y || z > rhs.z)
return true;
return false;
inline bool operator>(XYZ const &rhs) const {
return (x > rhs.x || y > rhs.y || z > rhs.z);
}

XYZ &operator+=(XYZ const &rhs) {
x += rhs.x;
y += rhs.y;
Expand Down Expand Up @@ -167,26 +161,26 @@ struct XYZ {
return *this;
}

XYZ operator+(XYZ const &rhs) const { return XYZ(*this) += rhs; }
XYZ operator-(XYZ const &rhs) const { return XYZ(*this) -= rhs; }
XYZ operator*(XYZ const &rhs) const { return XYZ(*this) *= rhs; }
XYZ operator/(XYZ const &rhs) const { return XYZ(*this) /= rhs; }
XYZ operator+(XYZ const &rhs) const { return XYZ(x+rhs.x, y+rhs.y, z+rhs.z); }
XYZ operator-(XYZ const &rhs) const { return XYZ(x-rhs.x, y-rhs.y, z-rhs.z); }
XYZ operator*(XYZ const &rhs) const { return XYZ(x*rhs.x, y*rhs.y, z*rhs.z); }
XYZ operator/(XYZ const &rhs) const { return XYZ(x/rhs.x, y/rhs.y, z/rhs.z); }

XYZ operator*(const double a) const { return XYZ(*this) *= a; }
XYZ operator*(const double a) const { return XYZ(x*a, y*a, z*a); }

XYZ operator-() const { return XYZ(*this) * -1.0; }
XYZ operator-() const { return XYZ(-x, -y, -z); }

void Inverse() {
x = 1.0 / x;
y = 1.0 / y;
z = 1.0 / z;
}

double Length() const { return sqrt(LengthSq()); }
double LengthSq() const { return x * x + y * y + z * z; }
double Length() const { return std::sqrt(LengthSq()); }

XYZ &Normalize() {
*this *= (1 / Length());
*this *= (1.0 / Length());
return *this;
}

Expand All @@ -207,6 +201,9 @@ struct XYZ {
m = z;
return m;
}

public:
double x, y, z;
};

inline std::ostream &operator<<(std::ostream &stream, const XYZ &p) {
Expand Down
8 changes: 4 additions & 4 deletions src/BlockOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ struct BlockAverages : OutputableBase {
stepsPerOut = event.frequency;
invSteps = 1.0 / stepsPerOut;
firstInvSteps = invSteps;
//Handle the case where we are restarting from a checkpoint and the first
//interval is smaller than expected because we create a checkpoint more
//often than the Block output frequency.
// Handle the case where we are restarting from a checkpoint and the first
// interval is smaller than expected because we create a checkpoint more
// often than the Block output frequency.
if (startStep != 0 && (startStep % stepsPerOut) != 0) {
ulong diff;
diff = stepsPerOut - (startStep % stepsPerOut);
firstInvSteps = 1.0/diff;
firstInvSteps = 1.0 / diff;
}
enableOut = event.enable;
}
Expand Down
61 changes: 34 additions & 27 deletions src/ConfigSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const *const &multisim) {
} else if (CheckString(line[0], "IntraMEMC-1Freq")) {
if (stringtod(line[1]) > 0.0) {
sys.moves.intraMemc = stringtod(line[1]);
printf("%-40s %-4.4f \n", "Info: IntraMEMC-2 move frequency",
printf("%-40s %-4.4f \n", "Info: IntraMEMC-1 move frequency",
sys.moves.intraMemc);
sys.intraMemcVal.enable = true;
sys.intraMemcVal.MEMC1 = true;
Expand Down Expand Up @@ -1897,15 +1897,13 @@ void ConfigSetup::verifyInputs(void) {
std::cout << "ERROR: Impulse Pressure Correction cannot be "
<< "used with LJ long-range corrections." << std::endl;
exit(EXIT_FAILURE);

}
if (((sys.ff.VDW_KIND == sys.ff.VDW_SHIFT_KIND) ||
(sys.ff.VDW_KIND == sys.ff.VDW_SWITCH_KIND)) &&
sys.ff.doImpulsePressureCorr) {
std::cout << "ERROR: Impulse Pressure Correction is not supported "
<< "for SWITCH or SHIFT potentials." << std::endl;
exit(EXIT_FAILURE);

}
if (sys.ff.doImpulsePressureCorr && sys.ff.doTailCorr) {
std::cout << "ERROR: Both LRC (Long Range Correction) and "
Expand Down Expand Up @@ -2104,9 +2102,10 @@ void ConfigSetup::verifyInputs(void) {
if (in.restart.restartFromBinaryCoorFile) {
for (i = 0; i < BOX_TOTAL; i++) {
if (!in.files.binaryCoorInput.defined[i]) {
std::cout << "ERROR: Binary coordinate file was not specified for box "
"number "
<< i << "!" << std::endl;
std::cout
<< "ERROR: Binary coordinate file was not specified for box "
"number "
<< i << "!" << std::endl;
exit(EXIT_FAILURE);
}
}
Expand Down Expand Up @@ -2174,25 +2173,30 @@ void ConfigSetup::verifyInputs(void) {
if ((sys.memcVal.MEMC1 && sys.memcVal.MEMC2) ||
(sys.memcVal.MEMC1 && sys.memcVal.MEMC3) ||
(sys.memcVal.MEMC2 && sys.memcVal.MEMC3)) {
std::cout << "ERROR: Multiple MEMC methods were specified, but only one is allowed!\n";
std::cout << "ERROR: Multiple MEMC methods were specified, but only one "
"is allowed!\n";
exit(EXIT_FAILURE);
}
if ((sys.intraMemcVal.MEMC1 && sys.intraMemcVal.MEMC2) ||
(sys.intraMemcVal.MEMC1 && sys.intraMemcVal.MEMC3) ||
(sys.intraMemcVal.MEMC2 && sys.intraMemcVal.MEMC3)) {
std::cout << "ERROR: Multiple Intra-MEMC methods are specified, but only one is allowed!\n";
std::cout << "ERROR: Multiple Intra-MEMC methods are specified, but only "
"one is allowed!\n";
exit(EXIT_FAILURE);
}
if (!sys.memcVal.readVol || !sys.intraMemcVal.readVol) {
std::cout << "ERROR: In the MEMC method, the Sub-Volume was not specified!\n";
std::cout
<< "ERROR: In the MEMC method, the Sub-Volume was not specified!\n";
exit(EXIT_FAILURE);
}
if (!sys.memcVal.readRatio || !sys.intraMemcVal.readRatio) {
std::cout << "ERROR: In the MEMC method, Exchange Ratio was not specified!\n";
std::cout
<< "ERROR: In the MEMC method, Exchange Ratio was not specified!\n";
exit(EXIT_FAILURE);
}
if (sys.memcVal.largeKind.size() != sys.memcVal.exchangeRatio.size()) {
std::cout << "ERROR: In the MEMC method, the specified number of Large Kinds was "
std::cout << "ERROR: In the MEMC method, the specified number of Large "
"Kinds was "
<< sys.memcVal.largeKind.size() << ", but "
<< sys.memcVal.exchangeRatio.size()
<< " exchange ratio was specified!\n";
Expand All @@ -2209,49 +2213,52 @@ void ConfigSetup::verifyInputs(void) {
if ((sys.memcVal.largeKind.size() != sys.memcVal.smallKind.size()) ||
(sys.intraMemcVal.largeKind.size() !=
sys.intraMemcVal.smallKind.size())) {
std::cout
<< "ERROR: In the MEMC method, the specified number of Large Kinds is not "
<< " equal as specified number of Small Kinds!\n";
std::cout << "ERROR: In the MEMC method, the specified number of Large "
"Kinds is not "
<< " equal as specified number of Small Kinds!\n";
exit(EXIT_FAILURE);
}
if (!sys.memcVal.readLargeBB || !sys.intraMemcVal.readLargeBB) {
std::cout
<< "ERROR: In the MEMC method, Large Kind BackBone was not specified!\n";
std::cout << "ERROR: In the MEMC method, Large Kind BackBone was not "
"specified!\n";
exit(EXIT_FAILURE);
}
if (sys.memcVal.largeKind.size() != sys.memcVal.largeBBAtom1.size()) {
std::cout << "ERROR: In the MEMC method, the specified number of Large Kinds was "
std::cout << "ERROR: In the MEMC method, the specified number of Large "
"Kinds was "
<< sys.memcVal.largeKind.size() << ", but "
<< sys.memcVal.largeBBAtom1.size()
<< " sets of Large Molecule BackBone was specified!\n";
exit(EXIT_FAILURE);
}
if (sys.memcVal.MEMC2 && !sys.memcVal.readSmallBB) {
std::cout
<< "ERROR: In the MEMC-2 method, Small Kind BackBone was not specified!\n";
std::cout << "ERROR: In the MEMC-2 method, Small Kind BackBone was not "
"specified!\n";
exit(EXIT_FAILURE);
}

if (sys.memcVal.MEMC2 &&
(sys.memcVal.smallKind.size() != sys.memcVal.smallBBAtom1.size())) {
std::cout
<< "ERROR: In the MEMC-2 method, the specified number of Small Kinds was "
<< sys.memcVal.smallKind.size() << ", but "
<< sys.memcVal.smallBBAtom1.size()
<< " sets of Small Molecule BackBone was specified!\n";
std::cout << "ERROR: In the MEMC-2 method, the specified number of Small "
"Kinds was "
<< sys.memcVal.smallKind.size() << ", but "
<< sys.memcVal.smallBBAtom1.size()
<< " sets of Small Molecule BackBone was specified!\n";
exit(EXIT_FAILURE);
}

if (sys.intraMemcVal.MEMC2 && !sys.intraMemcVal.readSmallBB) {
std::cout << "ERROR: In the Intra-MEMC-2 method, Small Kind BackBone was not "
"specified!\n";
std::cout
<< "ERROR: In the Intra-MEMC-2 method, Small Kind BackBone was not "
"specified!\n";
exit(EXIT_FAILURE);
}
if (sys.memcVal.enable && sys.intraMemcVal.enable) {
if ((sys.memcVal.MEMC1 && !sys.intraMemcVal.MEMC1) ||
(sys.memcVal.MEMC2 && !sys.intraMemcVal.MEMC2) ||
(sys.memcVal.MEMC3 && !sys.intraMemcVal.MEMC3)) {
std::cout << "ERROR: The selected intra-MEMC method was not same as the inter-MEMC method!\n";
std::cout << "ERROR: The selected intra-MEMC method was not same as "
"the inter-MEMC method!\n";
exit(EXIT_FAILURE);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Ewald.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1530,8 +1530,7 @@ void Ewald::BoxForceReciprocal(XYZArray const &molCoords,
CallBoxForceReciprocalGPU(
ff.particles->getCUDAVars(), atomForceRec, molForceRec, particleCharge,
particleMol, particleHasNoCharge, particleUsed, startMol, lengthMol,
ff.alpha[box], ff.alphaSq[box], constValue, imageSizeRef[box],
molCoords, currentAxes, box);
constValue, imageSizeRef[box], molCoords, currentAxes, box);
delete[] particleUsed;
#else
// molecule iterator
Expand Down
7 changes: 4 additions & 3 deletions src/FFParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ void FFParticle::Init(ff_setup::Particle const &mie,
double diElectric_1 = 1.0 / forcefield.dielectric;
InitGPUForceField(*varCUDA, sigmaSq, epsilon_cn, n, forcefield.vdwKind,
forcefield.isMartini, count, forcefield.rCut,
forcefield.rCutCoulomb, forcefield.rCutLow,
forcefield.rswitch, forcefield.alpha, forcefield.ewald,
diElectric_1);
forcefield.rCutSq, forcefield.rCutCoulomb,
forcefield.rCutCoulombSq, forcefield.rCutLow,
forcefield.rswitch, forcefield.alpha, forcefield.alphaSq,
forcefield.ewald, diElectric_1);
#endif
}

Expand Down
Loading
Loading