49 |
|
|
50 |
|
using namespace std; |
51 |
|
namespace OpenMD { |
52 |
+ |
|
53 |
+ |
/* GB is the Gay-Berne interaction for ellipsoidal particles. The original |
54 |
+ |
* paper (for identical uniaxial particles) is: |
55 |
+ |
* J. G. Gay and B. J. Berne, J. Chem. Phys., 74, 3316-3319 (1981). |
56 |
+ |
* A more-general GB potential for dissimilar uniaxial particles: |
57 |
+ |
* D. J. Cleaver, C. M. Care, M. P. Allen and M. P. Neal, Phys. Rev. E, |
58 |
+ |
* 54, 559-567 (1996). |
59 |
+ |
* Further parameterizations can be found in: |
60 |
+ |
* A. P. J. Emerson, G. R. Luckhurst and S. G. Whatling, Mol. Phys., |
61 |
+ |
* 82, 113-124 (1994). |
62 |
+ |
* And a nice force expression: |
63 |
+ |
* G. R. Luckhurst and R. A. Stephens, Liq. Cryst. 8, 451-464 (1990). |
64 |
+ |
* Even clearer force and torque expressions: |
65 |
+ |
* P. A. Golubkov and P. Y. Ren, J. Chem. Phys., 125, 64103 (2006). |
66 |
+ |
* New expressions for cross interactions of strength parameters: |
67 |
+ |
* J. Wu, X. Zhen, H. Shen, G. Li, and P. Ren, J. Chem. Phys., |
68 |
+ |
* 135, 155104 (2011). |
69 |
+ |
* |
70 |
+ |
* In this version of the GB interaction, each uniaxial ellipsoidal type |
71 |
+ |
* is described using a set of 6 parameters: |
72 |
+ |
* d: range parameter for side-by-side (S) and cross (X) configurations |
73 |
+ |
* l: range parameter for end-to-end (E) configuration |
74 |
+ |
* epsilon_X: well-depth parameter for cross (X) configuration |
75 |
+ |
* epsilon_S: well-depth parameter for side-by-side (S) configuration |
76 |
+ |
* epsilon_E: well depth parameter for end-to-end (E) configuration |
77 |
+ |
* dw: "softness" of the potential |
78 |
+ |
* |
79 |
+ |
* Additionally, there are two "universal" paramters to govern the overall |
80 |
+ |
* importance of the purely orientational (nu) and the mixed |
81 |
+ |
* orientational / translational (mu) parts of strength of the interactions. |
82 |
+ |
* These parameters have default or "canonical" values, but may be changed |
83 |
+ |
* as a force field option: |
84 |
+ |
* nu_: purely orientational part : defaults to 1 |
85 |
+ |
* mu_: mixed orientational / translational part : defaults to 2 |
86 |
+ |
*/ |
87 |
|
|
88 |
+ |
|
89 |
|
GB::GB() : name_("GB"), initialized_(false), mu_(2.0), nu_(1.0), forceField_(NULL) {} |
90 |
|
|
91 |
|
GayBerneParam GB::getGayBerneParam(AtomType* atomType) { |
209 |
|
simError(); |
210 |
|
} |
211 |
|
|
212 |
< |
RealType d1, l1, e1, er1, dw1; |
212 |
> |
RealType d1, l1, eX1, eS1, eE1, dw1; |
213 |
|
|
214 |
|
if (atomType->isGayBerne()) { |
215 |
|
GayBerneParam gb1 = getGayBerneParam(atomType); |
216 |
|
d1 = gb1.GB_d; |
217 |
|
l1 = gb1.GB_l; |
218 |
< |
e1 = gb1.GB_eps; |
219 |
< |
er1 = gb1.GB_eps_ratio; |
218 |
> |
eX1 = gb1.GB_eps_X; |
219 |
> |
eS1 = gb1.GB_eps_S; |
220 |
> |
eE1 = gb1.GB_eps_E; |
221 |
|
dw1 = gb1.GB_dw; |
222 |
|
} else if (atomType->isLennardJones()) { |
223 |
|
d1 = getLJSigma(atomType) / sqrt(2.0); |
187 |
– |
e1 = getLJEpsilon(atomType); |
224 |
|
l1 = d1; |
225 |
< |
er1 = 1.0; |
225 |
> |
eX1 = getLJEpsilon(atomType); |
226 |
> |
eS1 = eX1; |
227 |
> |
eE1 = eX1; |
228 |
|
dw1 = 1.0; |
229 |
|
} else { |
230 |
|
sprintf( painCave.errMsg, |
244 |
|
|
245 |
|
AtomType* atype2 = (*it).second; |
246 |
|
|
247 |
< |
RealType d2, l2, e2, er2, dw2; |
247 |
> |
RealType d2, l2, eX2, eS2, eE2, dw2; |
248 |
|
|
249 |
|
if (atype2->isGayBerne()) { |
250 |
|
GayBerneParam gb2 = getGayBerneParam(atype2); |
251 |
|
d2 = gb2.GB_d; |
252 |
|
l2 = gb2.GB_l; |
253 |
< |
e2 = gb2.GB_eps; |
254 |
< |
er2 = gb2.GB_eps_ratio; |
253 |
> |
eX2 = gb2.GB_eps_X; |
254 |
> |
eS2 = gb2.GB_eps_S; |
255 |
> |
eE2 = gb2.GB_eps_E; |
256 |
|
dw2 = gb2.GB_dw; |
257 |
|
} else if (atype2->isLennardJones()) { |
258 |
|
d2 = getLJSigma(atype2) / sqrt(2.0); |
220 |
– |
e2 = getLJEpsilon(atype2); |
259 |
|
l2 = d2; |
260 |
< |
er2 = 1.0; |
260 |
> |
eX2 = getLJEpsilon(atype2); |
261 |
> |
eS2 = eX2; |
262 |
> |
eE2 = eX2; |
263 |
|
dw2 = 1.0; |
264 |
|
} |
265 |
|
|
284 |
|
// assumed LB mixing rules for now: |
285 |
|
|
286 |
|
mixer1.dw = 0.5 * (dw1 + dw2); |
287 |
< |
mixer1.eps0 = sqrt(e1 * e2); |
287 |
> |
mixer1.eps0 = sqrt(eX1 * eX2); |
288 |
|
|
289 |
|
mixer2.dw = mixer1.dw; |
290 |
|
mixer2.eps0 = mixer1.eps0; |
291 |
+ |
|
292 |
+ |
RealType mi = RealType(1.0)/mu_; |
293 |
|
|
294 |
< |
RealType er = sqrt(er1 * er2); |
295 |
< |
RealType ermu = pow(er, (RealType(1.0) / mu_)); |
296 |
< |
RealType xp = (1.0 - ermu) / (1.0 + ermu); |
297 |
< |
RealType ap2 = 1.0 / (1.0 + ermu); |
256 |
< |
|
257 |
< |
mixer1.xp2 = xp * xp; |
258 |
< |
mixer1.xpap2 = xp * ap2; |
259 |
< |
mixer1.xpapi2 = xp / ap2; |
294 |
> |
mixer1.xpap2 = (pow(eS1, mi) - pow(eE1, mi)) / (pow(eS1, mi) + pow(eE2, mi)); |
295 |
> |
mixer1.xpapi2 = (pow(eS2, mi) - pow(eE2, mi)) / (pow(eS2, mi) + pow(eE1, mi)); |
296 |
> |
mixer1.xp2 = (pow(eS1, mi) - pow(eE1, mi)) * (pow(eS2, mi) - pow(eE2, mi)) / |
297 |
> |
(pow(eS2, mi) + pow(eE1, mi)) / (pow(eS1, mi) + pow(eE2, mi)) ; |
298 |
|
|
299 |
+ |
// xpap2 and xpapi2 for j-i pairs are reversed from the same i-j pairing. |
300 |
+ |
// Swapping the particles reverses the anisotropy parameters: |
301 |
+ |
mixer2.xpap2 = mixer1.xpapi2; |
302 |
+ |
mixer2.xpapi2 = mixer1.xpap2; |
303 |
|
mixer2.xp2 = mixer1.xp2; |
262 |
– |
mixer2.xpap2 = mixer1.xpap2; |
263 |
– |
mixer2.xpapi2 = mixer1.xpapi2; |
304 |
|
|
305 |
|
// only add this pairing if at least one of the atoms is a Gay-Berne atom |
306 |
|
|
334 |
|
RealType xpap2 = mixer.xpap2; |
335 |
|
RealType xpapi2 = mixer.xpapi2; |
336 |
|
|
337 |
+ |
// cerr << "atypes = " << idat.atypes.first->getName() << " " << idat.atypes.second->getName() << "\n"; |
338 |
+ |
// cerr << "sigma0 = " <<mixer.sigma0 <<"\n"; |
339 |
+ |
// cerr << "dw = " <<mixer.dw <<"\n"; |
340 |
+ |
// cerr << "eps0 = " <<mixer.eps0 <<"\n"; |
341 |
+ |
// cerr << "x2 = " <<mixer.x2 <<"\n"; |
342 |
+ |
// cerr << "xa2 = " <<mixer.xa2 <<"\n"; |
343 |
+ |
// cerr << "xai2 = " <<mixer.xai2 <<"\n"; |
344 |
+ |
// cerr << "xp2 = " <<mixer.xp2 <<"\n"; |
345 |
+ |
// cerr << "xpap2 = " <<mixer.xpap2 <<"\n"; |
346 |
+ |
// cerr << "xpapi2 = " <<mixer.xpapi2 <<"\n"; |
347 |
+ |
|
348 |
|
Vector3d ul1 = idat.A1->getRow(2); |
349 |
|
Vector3d ul2 = idat.A2->getRow(2); |
350 |
|
|
351 |
+ |
// cerr << "ul1 = " <<ul1<<"\n"; |
352 |
+ |
// cerr << "ul2 = " <<ul2<<"\n"; |
353 |
+ |
|
354 |
|
RealType a, b, g; |
355 |
|
|
356 |
|
bool i_is_LJ = idat.atypes.first->isLennardJones(); |
381 |
|
RealType au2 = au * au; |
382 |
|
RealType bu2 = bu * bu; |
383 |
|
RealType g2 = g * g; |
384 |
< |
|
384 |
> |
|
385 |
|
RealType H = (xa2 * au2 + xai2 * bu2 - 2.0*x2*au*bu*g) / (1.0 - x2*g2); |
386 |
|
RealType Hp = (xpap2*au2 + xpapi2*bu2 - 2.0*xp2*au*bu*g) / (1.0 - xp2*g2); |
387 |
|
|
388 |
+ |
// cerr << "au2 = " << au2 << "\n"; |
389 |
+ |
// cerr << "bu2 = " << bu2 << "\n"; |
390 |
+ |
// cerr << "g2 = " << g2 << "\n"; |
391 |
+ |
// cerr << "H = " << H << "\n"; |
392 |
+ |
// cerr << "Hp = " << Hp << "\n"; |
393 |
+ |
|
394 |
|
RealType sigma = sigma0 / sqrt(1.0 - H); |
395 |
|
RealType e1 = 1.0 / sqrt(1.0 - x2*g2); |
396 |
|
RealType e2 = 1.0 - Hp; |
408 |
|
RealType s3 = sigma*sigma*sigma; |
409 |
|
RealType s03 = sigma0*sigma0*sigma0; |
410 |
|
|
411 |
+ |
// cerr << "vdwMult = " << *(idat.vdwMult) << "\n"; |
412 |
+ |
// cerr << "eps = " << eps <<"\n"; |
413 |
+ |
// cerr << "mu = " << mu_ << "\n"; |
414 |
+ |
// cerr << "R12 = " << R12 << "\n"; |
415 |
+ |
// cerr << "R6 = " << R6 << "\n"; |
416 |
+ |
// cerr << "R13 = " << R13 << "\n"; |
417 |
+ |
// cerr << "R7 = " << R7 << "\n"; |
418 |
+ |
// cerr << "e2 = " << e2 << "\n"; |
419 |
+ |
// cerr << "rij = " << *(idat.rij) << "\n"; |
420 |
+ |
// cerr << "s3 = " << s3 << "\n"; |
421 |
+ |
// cerr << "s03 = " << s03 << "\n"; |
422 |
+ |
// cerr << "dw = " << dw << "\n"; |
423 |
+ |
|
424 |
|
RealType pref1 = - *(idat.vdwMult) * 8.0 * eps * mu_ * (R12 - R6) / |
425 |
|
(e2 * *(idat.rij)); |
426 |
|
|
441 |
|
(1.0 - xp2 * g2) / e2 + 8.0 * eps * s3 * (3.0 * R7 - 6.0 * R13) * |
442 |
|
(x2 * au * bu - H * x2 * g) / (1.0 - x2 * g2) / (dw * s03); |
443 |
|
|
444 |
+ |
// cerr << "pref = " << pref1 << " " << pref2 << "\n"; |
445 |
+ |
// cerr << "dU = " << dUdr << " " << dUda <<" " << dUdb << " " << dUdg << "\n"; |
446 |
+ |
|
447 |
|
Vector3d rhat = *(idat.d) / *(idat.rij); |
448 |
|
Vector3d rxu1 = cross(*(idat.d), ul1); |
449 |
|
Vector3d rxu2 = cross(*(idat.d), ul2); |
455 |
|
*(idat.t2) += (dUdb * rxu2 + dUdg * uxu) * *(idat.sw); |
456 |
|
*(idat.vpair) += U; |
457 |
|
|
458 |
+ |
// cerr << "f1 term = " << (dUdr * rhat + dUda * ul1 + dUdb * ul2) * *(idat.sw) << "\n"; |
459 |
+ |
// cerr << "t1 term = " << (dUda * rxu1 - dUdg * uxu) * *(idat.sw) << "\n"; |
460 |
+ |
// cerr << "t2 term = " << (dUdb * rxu2 + dUdg * uxu) * *(idat.sw) << "\n"; |
461 |
+ |
// cerr << "vp term = " << U << "\n"; |
462 |
+ |
|
463 |
|
return; |
464 |
|
|
465 |
|
} |