Skip to content

Commit 88fd6a2

Browse files
committed
Merge branch 'MEMC_Liq' of https://github.com/GOMC-WSU/GOMC into MEMC_Liq
Merge updates into local MEMC_liq
2 parents 9320eea + 24a694b commit 88fd6a2

25 files changed

+732
-900
lines changed

lib/BasicTypes.h

+30-33
Original file line numberDiff line numberDiff line change
@@ -97,44 +97,38 @@ inline void record_debug(uint *x, uint len, std::string filename,
9797

9898
//******************************************************************************
9999

100-
typedef unsigned int uint;
101-
typedef unsigned long int ulong;
102-
103-
#define UNUSED(x) (void)(x)
104-
105-
// single XYZ for use as a temporary and return type
106-
struct XYZ {
107-
double x, y, z;
108-
100+
// single XYZ coordinate for use as a temporary and return type
101+
class XYZ {
102+
public:
109103
XYZ() : x(0.0), y(0.0), z(0.0) {}
110104
XYZ(double xVal, double yVal, double zVal) : x(xVal), y(yVal), z(zVal) {}
105+
106+
friend inline std::ostream &operator<<(std::ostream &stream, const XYZ &p);
107+
108+
inline double getX() const { return x; }
109+
inline double getY() const { return y; }
110+
inline double getZ() const { return z; }
111+
111112
void Reset() { x = y = z = 0.0; }
112113
XYZ &operator=(XYZ const &rhs) {
113114
x = rhs.x;
114115
y = rhs.y;
115116
z = rhs.z;
116117
return *this;
117118
}
118-
bool operator==(XYZ const &rhs) {
119-
if (x == rhs.x && y == rhs.y && z == rhs.z)
120-
return true;
121-
return false;
119+
inline bool operator==(XYZ const &rhs) const {
120+
return (x == rhs.x && y == rhs.y && z == rhs.z);
122121
}
123-
bool operator!=(XYZ const &rhs) {
124-
if (x != rhs.x || y != rhs.y || z != rhs.z)
125-
return true;
126-
return false;
122+
inline bool operator!=(XYZ const &rhs) const {
123+
return (x != rhs.x || y != rhs.y || z != rhs.z);
127124
}
128-
bool operator<(XYZ const &rhs) {
129-
if (x < rhs.x && y < rhs.y && z < rhs.z)
130-
return true;
131-
return false;
125+
inline bool operator<(XYZ const &rhs) const {
126+
return (x < rhs.x && y < rhs.y && z < rhs.z);
132127
}
133-
bool operator>(XYZ const &rhs) {
134-
if (x > rhs.x || y > rhs.y || z > rhs.z)
135-
return true;
136-
return false;
128+
inline bool operator>(XYZ const &rhs) const {
129+
return (x > rhs.x || y > rhs.y || z > rhs.z);
137130
}
131+
138132
XYZ &operator+=(XYZ const &rhs) {
139133
x += rhs.x;
140134
y += rhs.y;
@@ -167,26 +161,26 @@ struct XYZ {
167161
return *this;
168162
}
169163

170-
XYZ operator+(XYZ const &rhs) const { return XYZ(*this) += rhs; }
171-
XYZ operator-(XYZ const &rhs) const { return XYZ(*this) -= rhs; }
172-
XYZ operator*(XYZ const &rhs) const { return XYZ(*this) *= rhs; }
173-
XYZ operator/(XYZ const &rhs) const { return XYZ(*this) /= rhs; }
164+
XYZ operator+(XYZ const &rhs) const { return XYZ(x+rhs.x, y+rhs.y, z+rhs.z); }
165+
XYZ operator-(XYZ const &rhs) const { return XYZ(x-rhs.x, y-rhs.y, z-rhs.z); }
166+
XYZ operator*(XYZ const &rhs) const { return XYZ(x*rhs.x, y*rhs.y, z*rhs.z); }
167+
XYZ operator/(XYZ const &rhs) const { return XYZ(x/rhs.x, y/rhs.y, z/rhs.z); }
174168

175-
XYZ operator*(const double a) const { return XYZ(*this) *= a; }
169+
XYZ operator*(const double a) const { return XYZ(x*a, y*a, z*a); }
176170

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

179173
void Inverse() {
180174
x = 1.0 / x;
181175
y = 1.0 / y;
182176
z = 1.0 / z;
183177
}
184178

185-
double Length() const { return sqrt(LengthSq()); }
186179
double LengthSq() const { return x * x + y * y + z * z; }
180+
double Length() const { return std::sqrt(LengthSq()); }
187181

188182
XYZ &Normalize() {
189-
*this *= (1 / Length());
183+
*this *= (1.0 / Length());
190184
return *this;
191185
}
192186

@@ -207,6 +201,9 @@ struct XYZ {
207201
m = z;
208202
return m;
209203
}
204+
205+
public:
206+
double x, y, z;
210207
};
211208

212209
inline std::ostream &operator<<(std::ostream &stream, const XYZ &p) {

src/BlockOutput.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ struct BlockAverages : OutputableBase {
111111
stepsPerOut = event.frequency;
112112
invSteps = 1.0 / stepsPerOut;
113113
firstInvSteps = invSteps;
114-
//Handle the case where we are restarting from a checkpoint and the first
115-
//interval is smaller than expected because we create a checkpoint more
116-
//often than the Block output frequency.
114+
// Handle the case where we are restarting from a checkpoint and the first
115+
// interval is smaller than expected because we create a checkpoint more
116+
// often than the Block output frequency.
117117
if (startStep != 0 && (startStep % stepsPerOut) != 0) {
118118
ulong diff;
119119
diff = stepsPerOut - (startStep % stepsPerOut);
120-
firstInvSteps = 1.0/diff;
120+
firstInvSteps = 1.0 / diff;
121121
}
122122
enableOut = event.enable;
123123
}

src/ConfigSetup.cpp

+34-27
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const *const &multisim) {
836836
} else if (CheckString(line[0], "IntraMEMC-1Freq")) {
837837
if (stringtod(line[1]) > 0.0) {
838838
sys.moves.intraMemc = stringtod(line[1]);
839-
printf("%-40s %-4.4f \n", "Info: IntraMEMC-2 move frequency",
839+
printf("%-40s %-4.4f \n", "Info: IntraMEMC-1 move frequency",
840840
sys.moves.intraMemc);
841841
sys.intraMemcVal.enable = true;
842842
sys.intraMemcVal.MEMC1 = true;
@@ -1913,15 +1913,13 @@ void ConfigSetup::verifyInputs(void) {
19131913
std::cout << "ERROR: Impulse Pressure Correction cannot be "
19141914
<< "used with LJ long-range corrections." << std::endl;
19151915
exit(EXIT_FAILURE);
1916-
19171916
}
19181917
if (((sys.ff.VDW_KIND == sys.ff.VDW_SHIFT_KIND) ||
19191918
(sys.ff.VDW_KIND == sys.ff.VDW_SWITCH_KIND)) &&
19201919
sys.ff.doImpulsePressureCorr) {
19211920
std::cout << "ERROR: Impulse Pressure Correction is not supported "
19221921
<< "for SWITCH or SHIFT potentials." << std::endl;
19231922
exit(EXIT_FAILURE);
1924-
19251923
}
19261924
if (sys.ff.doImpulsePressureCorr && sys.ff.doTailCorr) {
19271925
std::cout << "ERROR: Both LRC (Long Range Correction) and "
@@ -2120,9 +2118,10 @@ void ConfigSetup::verifyInputs(void) {
21202118
if (in.restart.restartFromBinaryCoorFile) {
21212119
for (i = 0; i < BOX_TOTAL; i++) {
21222120
if (!in.files.binaryCoorInput.defined[i]) {
2123-
std::cout << "ERROR: Binary coordinate file was not specified for box "
2124-
"number "
2125-
<< i << "!" << std::endl;
2121+
std::cout
2122+
<< "ERROR: Binary coordinate file was not specified for box "
2123+
"number "
2124+
<< i << "!" << std::endl;
21262125
exit(EXIT_FAILURE);
21272126
}
21282127
}
@@ -2190,7 +2189,8 @@ void ConfigSetup::verifyInputs(void) {
21902189
if ((sys.memcVal.MEMC1 && sys.memcVal.MEMC2) ||
21912190
(sys.memcVal.MEMC1 && sys.memcVal.MEMC3) ||
21922191
(sys.memcVal.MEMC2 && sys.memcVal.MEMC3)) {
2193-
std::cout << "ERROR: Multiple MEMC methods were specified, but only one is allowed!\n";
2192+
std::cout << "ERROR: Multiple MEMC methods were specified, but only one "
2193+
"is allowed!\n";
21942194
exit(EXIT_FAILURE);
21952195
}
21962196
if ((sys.memcVal.MEMC1 && sys.memcVal.MEMC2) ||
@@ -2204,19 +2204,23 @@ void ConfigSetup::verifyInputs(void) {
22042204
if ((sys.intraMemcVal.MEMC1 && sys.intraMemcVal.MEMC2) ||
22052205
(sys.intraMemcVal.MEMC1 && sys.intraMemcVal.MEMC3) ||
22062206
(sys.intraMemcVal.MEMC2 && sys.intraMemcVal.MEMC3)) {
2207-
std::cout << "ERROR: Multiple Intra-MEMC methods are specified, but only one is allowed!\n";
2207+
std::cout << "ERROR: Multiple Intra-MEMC methods are specified, but only "
2208+
"one is allowed!\n";
22082209
exit(EXIT_FAILURE);
22092210
}
22102211
if (!sys.memcVal.readVol || !sys.intraMemcVal.readVol) {
2211-
std::cout << "ERROR: In the MEMC method, the Sub-Volume was not specified!\n";
2212+
std::cout
2213+
<< "ERROR: In the MEMC method, the Sub-Volume was not specified!\n";
22122214
exit(EXIT_FAILURE);
22132215
}
22142216
if (!sys.memcVal.readRatio || !sys.intraMemcVal.readRatio) {
2215-
std::cout << "ERROR: In the MEMC method, Exchange Ratio was not specified!\n";
2217+
std::cout
2218+
<< "ERROR: In the MEMC method, Exchange Ratio was not specified!\n";
22162219
exit(EXIT_FAILURE);
22172220
}
22182221
if (sys.memcVal.largeKind.size() != sys.memcVal.exchangeRatio.size()) {
2219-
std::cout << "ERROR: In the MEMC method, the specified number of Large Kinds was "
2222+
std::cout << "ERROR: In the MEMC method, the specified number of Large "
2223+
"Kinds was "
22202224
<< sys.memcVal.largeKind.size() << ", but "
22212225
<< sys.memcVal.exchangeRatio.size()
22222226
<< " exchange ratio was specified!\n";
@@ -2233,36 +2237,37 @@ void ConfigSetup::verifyInputs(void) {
22332237
if ((sys.memcVal.largeKind.size() != sys.memcVal.smallKind.size()) ||
22342238
(sys.intraMemcVal.largeKind.size() !=
22352239
sys.intraMemcVal.smallKind.size())) {
2236-
std::cout
2237-
<< "ERROR: In the MEMC method, the specified number of Large Kinds is not "
2238-
<< " equal as specified number of Small Kinds!\n";
2240+
std::cout << "ERROR: In the MEMC method, the specified number of Large "
2241+
"Kinds is not "
2242+
<< " equal as specified number of Small Kinds!\n";
22392243
exit(EXIT_FAILURE);
22402244
}
22412245
if (!sys.memcVal.readLargeBB || !sys.intraMemcVal.readLargeBB) {
2242-
std::cout
2243-
<< "ERROR: In the MEMC method, Large Kind BackBone was not specified!\n";
2246+
std::cout << "ERROR: In the MEMC method, Large Kind BackBone was not "
2247+
"specified!\n";
22442248
exit(EXIT_FAILURE);
22452249
}
22462250
if (sys.memcVal.largeKind.size() != sys.memcVal.largeBBAtom1.size()) {
2247-
std::cout << "ERROR: In the MEMC method, the specified number of Large Kinds was "
2251+
std::cout << "ERROR: In the MEMC method, the specified number of Large "
2252+
"Kinds was "
22482253
<< sys.memcVal.largeKind.size() << ", but "
22492254
<< sys.memcVal.largeBBAtom1.size()
22502255
<< " sets of Large Molecule BackBone was specified!\n";
22512256
exit(EXIT_FAILURE);
22522257
}
22532258
if (sys.memcVal.MEMC2 && !sys.memcVal.readSmallBB) {
2254-
std::cout
2255-
<< "ERROR: In the MEMC-2 method, Small Kind BackBone was not specified!\n";
2259+
std::cout << "ERROR: In the MEMC-2 method, Small Kind BackBone was not "
2260+
"specified!\n";
22562261
exit(EXIT_FAILURE);
22572262
}
22582263

22592264
if (sys.memcVal.MEMC2 &&
22602265
(sys.memcVal.smallKind.size() != sys.memcVal.smallBBAtom1.size())) {
2261-
std::cout
2262-
<< "ERROR: In the MEMC-2 method, the specified number of Small Kinds was "
2263-
<< sys.memcVal.smallKind.size() << ", but "
2264-
<< sys.memcVal.smallBBAtom1.size()
2265-
<< " sets of Small Molecule BackBone was specified!\n";
2266+
std::cout << "ERROR: In the MEMC-2 method, the specified number of Small "
2267+
"Kinds was "
2268+
<< sys.memcVal.smallKind.size() << ", but "
2269+
<< sys.memcVal.smallBBAtom1.size()
2270+
<< " sets of Small Molecule BackBone was specified!\n";
22662271
exit(EXIT_FAILURE);
22672272
}
22682273
if(sys.memcVal.MEMC2Liq && !sys.memcVal.readSmallBB) {
@@ -2279,15 +2284,17 @@ void ConfigSetup::verifyInputs(void) {
22792284
}
22802285

22812286
if (sys.intraMemcVal.MEMC2 && !sys.intraMemcVal.readSmallBB) {
2282-
std::cout << "ERROR: In the Intra-MEMC-2 method, Small Kind BackBone was not "
2283-
"specified!\n";
2287+
std::cout
2288+
<< "ERROR: In the Intra-MEMC-2 method, Small Kind BackBone was not "
2289+
"specified!\n";
22842290
exit(EXIT_FAILURE);
22852291
}
22862292
if (sys.memcVal.enable && sys.intraMemcVal.enable) {
22872293
if ((sys.memcVal.MEMC1 && !sys.intraMemcVal.MEMC1) ||
22882294
(sys.memcVal.MEMC2 && !sys.intraMemcVal.MEMC2) ||
22892295
(sys.memcVal.MEMC3 && !sys.intraMemcVal.MEMC3)) {
2290-
std::cout << "ERROR: The selected intra-MEMC method was not same as the inter-MEMC method!\n";
2296+
std::cout << "ERROR: The selected intra-MEMC method was not same as "
2297+
"the inter-MEMC method!\n";
22912298
exit(EXIT_FAILURE);
22922299
}
22932300
}

src/Ewald.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1530,8 +1530,7 @@ void Ewald::BoxForceReciprocal(XYZArray const &molCoords,
15301530
CallBoxForceReciprocalGPU(
15311531
ff.particles->getCUDAVars(), atomForceRec, molForceRec, particleCharge,
15321532
particleMol, particleHasNoCharge, particleUsed, startMol, lengthMol,
1533-
ff.alpha[box], ff.alphaSq[box], constValue, imageSizeRef[box],
1534-
molCoords, currentAxes, box);
1533+
constValue, imageSizeRef[box], molCoords, currentAxes, box);
15351534
delete[] particleUsed;
15361535
#else
15371536
// molecule iterator

src/FFParticle.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ void FFParticle::Init(ff_setup::Particle const &mie,
8888
double diElectric_1 = 1.0 / forcefield.dielectric;
8989
InitGPUForceField(*varCUDA, sigmaSq, epsilon_cn, n, forcefield.vdwKind,
9090
forcefield.isMartini, count, forcefield.rCut,
91-
forcefield.rCutCoulomb, forcefield.rCutLow,
92-
forcefield.rswitch, forcefield.alpha, forcefield.ewald,
93-
diElectric_1);
91+
forcefield.rCutSq, forcefield.rCutCoulomb,
92+
forcefield.rCutCoulombSq, forcefield.rCutLow,
93+
forcefield.rswitch, forcefield.alpha, forcefield.alphaSq,
94+
forcefield.ewald, diElectric_1);
9495
#endif
9596
}
9697

0 commit comments

Comments
 (0)