whitespace cleanup: remove (evil) tabs

This commit is contained in:
Axel Kohlmeyer
2019-11-03 10:57:18 -05:00
parent 9159a43d5d
commit 9e7ca428aa
47 changed files with 626 additions and 626 deletions

View File

@ -116,7 +116,7 @@ double BodyRoundedPolygon::enclosing_radius(struct AtomVecBody::Bonus *bonus)
{ {
int nvertices = bonus->ivalue[0]; int nvertices = bonus->ivalue[0];
if (nvertices == 1 || nvertices == 2) if (nvertices == 1 || nvertices == 2)
return *(bonus->dvalue+3*nsub(bonus)+2); return *(bonus->dvalue+3*nsub(bonus)+2);
return *(bonus->dvalue + 3*nsub(bonus) + 2*nsub(bonus)); return *(bonus->dvalue + 3*nsub(bonus) + 2*nsub(bonus));
} }
@ -126,7 +126,7 @@ double BodyRoundedPolygon::rounded_radius(struct AtomVecBody::Bonus *bonus)
{ {
int nvertices = bonus->ivalue[0]; int nvertices = bonus->ivalue[0];
if (nvertices == 1 || nvertices == 2) if (nvertices == 1 || nvertices == 2)
return *(bonus->dvalue+3*nsub(bonus)+2+1); return *(bonus->dvalue+3*nsub(bonus)+2+1);
return *(bonus->dvalue + 3*nsub(bonus) + 2*nsub(bonus)+1); return *(bonus->dvalue + 3*nsub(bonus) + 2*nsub(bonus)+1);
} }
@ -156,7 +156,7 @@ int BodyRoundedPolygon::unpack_border_body(AtomVecBody::Bonus *bonus,
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble, void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble,
int *ifile, double *dfile) int *ifile, double *dfile)
{ {
AtomVecBody::Bonus *bonus = &avec->bonus[ibonus]; AtomVecBody::Bonus *bonus = &avec->bonus[ibonus];
@ -327,7 +327,7 @@ void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble,
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double BodyRoundedPolygon::radius_body(int /*ninteger*/, int ndouble, double BodyRoundedPolygon::radius_body(int /*ninteger*/, int ndouble,
int *ifile, double *dfile) int *ifile, double *dfile)
{ {
int nsub = ifile[0]; int nsub = ifile[0];
if (nsub < 1) if (nsub < 1)

View File

@ -134,7 +134,7 @@ double BodyRoundedPolyhedron::enclosing_radius(struct AtomVecBody::Bonus *bonus)
{ {
int nvertices = bonus->ivalue[0]; int nvertices = bonus->ivalue[0];
if (nvertices == 1 || nvertices == 2) if (nvertices == 1 || nvertices == 2)
return *(bonus->dvalue+3*nsub(bonus)+2); return *(bonus->dvalue+3*nsub(bonus)+2);
return *(bonus->dvalue+3*nsub(bonus) + 2*nedges(bonus) + return *(bonus->dvalue+3*nsub(bonus) + 2*nedges(bonus) +
MAX_FACE_SIZE*nfaces(bonus)); MAX_FACE_SIZE*nfaces(bonus));
} }
@ -385,7 +385,7 @@ void BodyRoundedPolyhedron::data_body(int ibonus, int ninteger, int ndouble,
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double BodyRoundedPolyhedron::radius_body(int /*ninteger*/, int ndouble, double BodyRoundedPolyhedron::radius_body(int /*ninteger*/, int ndouble,
int *ifile, double *dfile) int *ifile, double *dfile)
{ {
int nsub = ifile[0]; int nsub = ifile[0];
int ned = ifile[1]; int ned = ifile[1];

View File

@ -188,8 +188,8 @@ void PairLJClass2::compute_inner()
if (rsq < cut_out_off_sq) { if (rsq < cut_out_off_sq) {
r2inv = 1.0/rsq; r2inv = 1.0/rsq;
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
jtype = type[j]; jtype = type[j];
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
@ -268,8 +268,8 @@ void PairLJClass2::compute_middle()
if (rsq < cut_out_off_sq && rsq > cut_in_off_sq) { if (rsq < cut_out_off_sq && rsq > cut_in_off_sq) {
r2inv = 1.0/rsq; r2inv = 1.0/rsq;
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
jtype = type[j]; jtype = type[j];
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
@ -352,8 +352,8 @@ void PairLJClass2::compute_outer(int eflag, int vflag)
if (rsq < cutsq[itype][jtype]) { if (rsq < cutsq[itype][jtype]) {
if (rsq > cut_in_off_sq) { if (rsq > cut_in_off_sq) {
r2inv = 1.0/rsq; r2inv = 1.0/rsq;
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
fpair = factor_lj*forcelj*r2inv; fpair = factor_lj*forcelj*r2inv;
@ -374,8 +374,8 @@ void PairLJClass2::compute_outer(int eflag, int vflag)
if (eflag) { if (eflag) {
r2inv = 1.0/rsq; r2inv = 1.0/rsq;
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) - evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype]; offset[itype][jtype];
@ -385,8 +385,8 @@ void PairLJClass2::compute_outer(int eflag, int vflag)
if (vflag) { if (vflag) {
if (rsq <= cut_in_off_sq) { if (rsq <= cut_in_off_sq) {
r2inv = 1.0/rsq; r2inv = 1.0/rsq;
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
fpair = factor_lj*forcelj*r2inv; fpair = factor_lj*forcelj*r2inv;

View File

@ -262,8 +262,8 @@ void PairLJClass2CoulLong::compute_inner()
jtype = type[j]; jtype = type[j];
if (rsq < cut_ljsq[itype][jtype]) { if (rsq < cut_ljsq[itype][jtype]) {
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
} else forcelj = 0.0; } else forcelj = 0.0;
@ -354,8 +354,8 @@ void PairLJClass2CoulLong::compute_middle()
jtype = type[j]; jtype = type[j];
if (rsq < cut_ljsq[itype][jtype]) { if (rsq < cut_ljsq[itype][jtype]) {
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
} else forcelj = 0.0; } else forcelj = 0.0;
@ -487,9 +487,9 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
} else forcecoul = 0.0; } else forcecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype] && rsq > cut_in_off_sq) { if (rsq < cut_ljsq[itype][jtype] && rsq > cut_in_off_sq) {
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
if (rsq < cut_in_on_sq) { if (rsq < cut_in_on_sq) {
rsw = (sqrt(rsq) - cut_in_off)/cut_in_diff; rsw = (sqrt(rsq) - cut_in_off)/cut_in_diff;
@ -525,9 +525,9 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
} else ecoul = 0.0; } else ecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype]) { if (rsq < cut_ljsq[itype][jtype]) {
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) - evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
offset[itype][jtype]; offset[itype][jtype];
evdwl *= factor_lj; evdwl *= factor_lj;
@ -552,13 +552,13 @@ void PairLJClass2CoulLong::compute_outer(int eflag, int vflag)
if (rsq <= cut_in_off_sq) { if (rsq <= cut_in_off_sq) {
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
} else if (rsq <= cut_in_on_sq) { } else if (rsq <= cut_in_on_sq) {
rinv = sqrt(r2inv); rinv = sqrt(r2inv);
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
r6inv = r3inv*r3inv; r6inv = r3inv*r3inv;
forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]); forcelj = r6inv * (lj1[itype][jtype]*r3inv - lj2[itype][jtype]);
} }
fpair = (forcecoul + factor_lj*forcelj) * r2inv; fpair = (forcecoul + factor_lj*forcelj) * r2inv;
@ -672,14 +672,14 @@ void PairLJClass2CoulLong::init_style()
if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) { if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
} }
irequest = neighbor->request(this,instance_me); irequest = neighbor->request(this,instance_me);
if (respa >= 1) { if (respa >= 1) {
neighbor->requests[irequest]->respaouter = 1; neighbor->requests[irequest]->respaouter = 1;
neighbor->requests[irequest]->respainner = 1; neighbor->requests[irequest]->respainner = 1;
} }
if (respa == 2) neighbor->requests[irequest]->respamiddle = 1; if (respa == 2) neighbor->requests[irequest]->respamiddle = 1;
@ -690,7 +690,7 @@ void PairLJClass2CoulLong::init_style()
if (strstr(update->integrate_style,"respa") && if (strstr(update->integrate_style,"respa") &&
((Respa *) update->integrate)->level_inner >= 0) ((Respa *) update->integrate)->level_inner >= 0)
cut_respa = ((Respa *) update->integrate)->cutoff; cut_respa = ((Respa *) update->integrate)->cutoff;
else cut_respa = NULL; else cut_respa = NULL;
// insure use of KSpace long-range solver, set g_ewald // insure use of KSpace long-range solver, set g_ewald

View File

@ -247,13 +247,13 @@ struct AtomVecSphereKokkos_PackComm {
_buf(i,2) = _x(j,2); _buf(i,2) = _x(j,2);
} else { } else {
if (TRICLINIC == 0) { if (TRICLINIC == 0) {
_buf(i,0) = _x(j,0) + _pbc[0]*_xprd; _buf(i,0) = _x(j,0) + _pbc[0]*_xprd;
_buf(i,1) = _x(j,1) + _pbc[1]*_yprd; _buf(i,1) = _x(j,1) + _pbc[1]*_yprd;
_buf(i,2) = _x(j,2) + _pbc[2]*_zprd; _buf(i,2) = _x(j,2) + _pbc[2]*_zprd;
} else { } else {
_buf(i,0) = _x(j,0) + _pbc[0]*_xprd + _pbc[5]*_xy + _pbc[4]*_xz; _buf(i,0) = _x(j,0) + _pbc[0]*_xprd + _pbc[5]*_xy + _pbc[4]*_xz;
_buf(i,1) = _x(j,1) + _pbc[1]*_yprd + _pbc[3]*_yz; _buf(i,1) = _x(j,1) + _pbc[1]*_yprd + _pbc[3]*_yz;
_buf(i,2) = _x(j,2) + _pbc[2]*_zprd; _buf(i,2) = _x(j,2) + _pbc[2]*_zprd;
} }
} }
_buf(i,3) = _radius(j); _buf(i,3) = _radius(j);
@ -419,13 +419,13 @@ struct AtomVecSphereKokkos_PackCommVel {
_buf(i,2) = _x(j,2); _buf(i,2) = _x(j,2);
} else { } else {
if (TRICLINIC == 0) { if (TRICLINIC == 0) {
_buf(i,0) = _x(j,0) + _pbc[0]*_xprd; _buf(i,0) = _x(j,0) + _pbc[0]*_xprd;
_buf(i,1) = _x(j,1) + _pbc[1]*_yprd; _buf(i,1) = _x(j,1) + _pbc[1]*_yprd;
_buf(i,2) = _x(j,2) + _pbc[2]*_zprd; _buf(i,2) = _x(j,2) + _pbc[2]*_zprd;
} else { } else {
_buf(i,0) = _x(j,0) + _pbc[0]*_xprd + _pbc[5]*_xy + _pbc[4]*_xz; _buf(i,0) = _x(j,0) + _pbc[0]*_xprd + _pbc[5]*_xy + _pbc[4]*_xz;
_buf(i,1) = _x(j,1) + _pbc[1]*_yprd + _pbc[3]*_yz; _buf(i,1) = _x(j,1) + _pbc[1]*_yprd + _pbc[3]*_yz;
_buf(i,2) = _x(j,2) + _pbc[2]*_zprd; _buf(i,2) = _x(j,2) + _pbc[2]*_zprd;
} }
} }
if (DEFORM_VREMAP == 0) { if (DEFORM_VREMAP == 0) {
@ -772,13 +772,13 @@ struct AtomVecSphereKokkos_PackCommSelf {
_xw(i+_nfirst,2) = _x(j,2); _xw(i+_nfirst,2) = _x(j,2);
} else { } else {
if (TRICLINIC == 0) { if (TRICLINIC == 0) {
_xw(i+_nfirst,0) = _x(j,0) + _pbc[0]*_xprd; _xw(i+_nfirst,0) = _x(j,0) + _pbc[0]*_xprd;
_xw(i+_nfirst,1) = _x(j,1) + _pbc[1]*_yprd; _xw(i+_nfirst,1) = _x(j,1) + _pbc[1]*_yprd;
_xw(i+_nfirst,2) = _x(j,2) + _pbc[2]*_zprd; _xw(i+_nfirst,2) = _x(j,2) + _pbc[2]*_zprd;
} else { } else {
_xw(i+_nfirst,0) = _x(j,0) + _pbc[0]*_xprd + _pbc[5]*_xy + _pbc[4]*_xz; _xw(i+_nfirst,0) = _x(j,0) + _pbc[0]*_xprd + _pbc[5]*_xy + _pbc[4]*_xz;
_xw(i+_nfirst,1) = _x(j,1) + _pbc[1]*_yprd + _pbc[3]*_yz; _xw(i+_nfirst,1) = _x(j,1) + _pbc[1]*_yprd + _pbc[3]*_yz;
_xw(i+_nfirst,2) = _x(j,2) + _pbc[2]*_zprd; _xw(i+_nfirst,2) = _x(j,2) + _pbc[2]*_zprd;
} }
} }
_radius(i+_nfirst) = _radius(j); _radius(i+_nfirst) = _radius(j);
@ -799,39 +799,39 @@ int AtomVecSphereKokkos::pack_comm_self(
atomKK->modified(Host,X_MASK|RADIUS_MASK|RMASS_MASK); atomKK->modified(Host,X_MASK|RADIUS_MASK|RMASS_MASK);
if(pbc_flag) { if(pbc_flag) {
if(domain->triclinic) { if(domain->triclinic) {
struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,1,1> f( struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,1,1> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} else { } else {
struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,1,0> f( struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,1,0> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} }
} else { } else {
if(domain->triclinic) { if(domain->triclinic) {
struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,0,1> f( struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,0,1> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} else { } else {
struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,0,0> f( struct AtomVecSphereKokkos_PackCommSelf<LMPHostType,0,0> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} }
} }
} else { } else {
@ -839,39 +839,39 @@ int AtomVecSphereKokkos::pack_comm_self(
atomKK->modified(Device,X_MASK|RADIUS_MASK|RMASS_MASK); atomKK->modified(Device,X_MASK|RADIUS_MASK|RMASS_MASK);
if(pbc_flag) { if(pbc_flag) {
if(domain->triclinic) { if(domain->triclinic) {
struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,1,1> f( struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,1,1> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} else { } else {
struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,1,0> f( struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,1,0> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} }
} else { } else {
if(domain->triclinic) { if(domain->triclinic) {
struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,0,1> f( struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,0,1> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} else { } else {
struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,0,0> f( struct AtomVecSphereKokkos_PackCommSelf<LMPDeviceType,0,0> f(
atomKK->k_x, atomKK->k_x,
atomKK->k_radius,atomKK->k_rmass, atomKK->k_radius,atomKK->k_rmass,
nfirst,list,iswap, nfirst,list,iswap,
domain->xprd,domain->yprd,domain->zprd, domain->xprd,domain->yprd,domain->zprd,
domain->xy,domain->xz,domain->yz,pbc); domain->xy,domain->xz,domain->yz,pbc);
Kokkos::parallel_for(n,f); Kokkos::parallel_for(n,f);
} }
} }
} }
@ -1037,7 +1037,7 @@ void AtomVecSphereKokkos::unpack_comm_vel_kokkos(
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int AtomVecSphereKokkos::pack_comm(int n, int *list, double *buf, int AtomVecSphereKokkos::pack_comm(int n, int *list, double *buf,
int pbc_flag, int *pbc) int pbc_flag, int *pbc)
{ {
int i,j,m; int i,j,m;
double dx,dy,dz; double dx,dy,dz;
@ -1109,7 +1109,7 @@ int AtomVecSphereKokkos::pack_comm(int n, int *list, double *buf,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int AtomVecSphereKokkos::pack_comm_vel(int n, int *list, double *buf, int AtomVecSphereKokkos::pack_comm_vel(int n, int *list, double *buf,
int pbc_flag, int *pbc) int pbc_flag, int *pbc)
{ {
int i,j,m; int i,j,m;
double dx,dy,dz,dvx,dvy,dvz; double dx,dy,dz,dvx,dvy,dvz;
@ -1926,7 +1926,7 @@ struct AtomVecSphereKokkos_UnpackBorder {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void AtomVecSphereKokkos::unpack_border_kokkos(const int &n, const int &first, void AtomVecSphereKokkos::unpack_border_kokkos(const int &n, const int &first,
const DAT::tdual_xfloat_2d &buf,ExecutionSpace space) { const DAT::tdual_xfloat_2d &buf,ExecutionSpace space) {
while (first+n >= nmax) grow(0); while (first+n >= nmax) grow(0);
if(space==Host) { if(space==Host) {
struct AtomVecSphereKokkos_UnpackBorder<LMPHostType> f(buf.view<LMPHostType>(), struct AtomVecSphereKokkos_UnpackBorder<LMPHostType> f(buf.view<LMPHostType>(),
@ -1943,7 +1943,7 @@ void AtomVecSphereKokkos::unpack_border_kokkos(const int &n, const int &first,
} }
atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK| atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|
RADIUS_MASK|RMASS_MASK); RADIUS_MASK|RMASS_MASK);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2053,7 +2053,7 @@ void AtomVecSphereKokkos::unpack_border_vel_kokkos(
} }
atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK| atomKK->modified(space,X_MASK|TAG_MASK|TYPE_MASK|MASK_MASK|
RADIUS_MASK|RMASS_MASK|V_MASK|OMEGA_MASK); RADIUS_MASK|RMASS_MASK|V_MASK|OMEGA_MASK);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -2496,7 +2496,7 @@ int AtomVecSphereKokkos::unpack_restart(double *buf)
atomKK->modified(Host,X_MASK | TAG_MASK | TYPE_MASK | atomKK->modified(Host,X_MASK | TAG_MASK | TYPE_MASK |
MASK_MASK | IMAGE_MASK | V_MASK | MASK_MASK | IMAGE_MASK | V_MASK |
RADIUS_MASK | RMASS_MASK | OMEGA_MASK); RADIUS_MASK | RMASS_MASK | OMEGA_MASK);
atom->nlocal++; atom->nlocal++;
return m; return m;

View File

@ -34,10 +34,10 @@ FixEnforce2DKokkos<DeviceType>::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char *
execution_space = ExecutionSpaceFromDevice<DeviceType>::space; execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
datamask_read = V_MASK | F_MASK | OMEGA_MASK | MASK_MASK datamask_read = V_MASK | F_MASK | OMEGA_MASK | MASK_MASK
| TORQUE_MASK | ANGMOM_MASK; | TORQUE_MASK | ANGMOM_MASK;
datamask_modify = V_MASK | F_MASK | OMEGA_MASK datamask_modify = V_MASK | F_MASK | OMEGA_MASK
| TORQUE_MASK | ANGMOM_MASK; | TORQUE_MASK | ANGMOM_MASK;
} }

View File

@ -122,21 +122,21 @@ void FixNeighHistoryKokkos<DeviceType>::pre_exchange_item(const int &ii) const
j &= NEIGHMASK; j &= NEIGHMASK;
int m = Kokkos::atomic_fetch_add(&d_npartner[i],1); int m = Kokkos::atomic_fetch_add(&d_npartner[i],1);
if (m < maxpartner) { if (m < maxpartner) {
d_partner(i,m) = tag[j]; d_partner(i,m) = tag[j];
for (int k = 0; k < dnum; k++) for (int k = 0; k < dnum; k++)
d_valuepartner(i,dnum*m+k) = d_firstvalue(i,dnum*jj+k); d_valuepartner(i,dnum*m+k) = d_firstvalue(i,dnum*jj+k);
} else { } else {
d_resize() = 1; d_resize() = 1;
} }
if (j < nlocal_neigh) { if (j < nlocal_neigh) {
m = Kokkos::atomic_fetch_add(&d_npartner[j],1); m = Kokkos::atomic_fetch_add(&d_npartner[j],1);
if (m < maxpartner) { if (m < maxpartner) {
d_partner(j,m) = tag[i]; d_partner(j,m) = tag[i];
for (int k = 0; k < dnum; k++) for (int k = 0; k < dnum; k++)
d_valuepartner(j,dnum*m+k) = d_firstvalue(i,dnum*jj+k); d_valuepartner(j,dnum*m+k) = d_firstvalue(i,dnum*jj+k);
} else { } else {
d_resize() = 1; d_resize() = 1;
} }
} }
} }
} }
@ -205,22 +205,22 @@ void FixNeighHistoryKokkos<DeviceType>::post_neighbor_item(const int &ii) const
if (rflag) { if (rflag) {
int jtag = tag(j); int jtag = tag(j);
for (m = 0; m < np; m++) for (m = 0; m < np; m++)
if (d_partner(i, m) == jtag) break; if (d_partner(i, m) == jtag) break;
if (m < np) { if (m < np) {
d_firstflag(i,jj) = 1; d_firstflag(i,jj) = 1;
for (int k = 0; k < dnum; k++) { for (int k = 0; k < dnum; k++) {
d_firstvalue(i, dnum*jj+k) = d_valuepartner(i, dnum*m+k); d_firstvalue(i, dnum*jj+k) = d_valuepartner(i, dnum*m+k);
} }
} else { } else {
d_firstflag(i,jj) = 0; d_firstflag(i,jj) = 0;
for (int k = 0; k < dnum; k++) { for (int k = 0; k < dnum; k++) {
d_firstvalue(i, dnum*jj+k) = 0; d_firstvalue(i, dnum*jj+k) = 0;
} }
} }
} else { } else {
d_firstflag(i,jj) = 0; d_firstflag(i,jj) = 0;
for (int k = 0; k < dnum; k++) { for (int k = 0; k < dnum; k++) {
d_firstvalue(i, dnum*jj+k) = 0; d_firstvalue(i, dnum*jj+k) = 0;
} }
} }
} }

View File

@ -224,49 +224,49 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
} else { } else {
if (newton_pair) { if (newton_pair) {
if (SIZE) { if (SIZE) {
NPairKokkosBuildFunctorSize<DeviceType,TRI?0:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); NPairKokkosBuildFunctorSize<DeviceType,TRI?0:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
#ifdef KOKKOS_ENABLE_CUDA #ifdef KOKKOS_ENABLE_CUDA
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) if (ExecutionSpaceFromDevice<DeviceType>::space == Device)
Kokkos::parallel_for(config, f); Kokkos::parallel_for(config, f);
else else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#else #else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#endif #endif
} else { } else {
NPairKokkosBuildFunctor<DeviceType,TRI?0:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); NPairKokkosBuildFunctor<DeviceType,TRI?0:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
#ifdef KOKKOS_ENABLE_CUDA #ifdef KOKKOS_ENABLE_CUDA
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) if (ExecutionSpaceFromDevice<DeviceType>::space == Device)
Kokkos::parallel_for(config, f); Kokkos::parallel_for(config, f);
else else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#else #else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#endif #endif
} }
} else { } else {
if (SIZE) { if (SIZE) {
NPairKokkosBuildFunctorSize<DeviceType,HALF_NEIGH,0,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); NPairKokkosBuildFunctorSize<DeviceType,HALF_NEIGH,0,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
#ifdef KOKKOS_ENABLE_CUDA #ifdef KOKKOS_ENABLE_CUDA
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) if (ExecutionSpaceFromDevice<DeviceType>::space == Device)
Kokkos::parallel_for(config, f); Kokkos::parallel_for(config, f);
else else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#else #else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#endif #endif
} else { } else {
NPairKokkosBuildFunctor<DeviceType,HALF_NEIGH,0,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); NPairKokkosBuildFunctor<DeviceType,HALF_NEIGH,0,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
#ifdef KOKKOS_ENABLE_CUDA #ifdef KOKKOS_ENABLE_CUDA
if (ExecutionSpaceFromDevice<DeviceType>::space == Device) if (ExecutionSpaceFromDevice<DeviceType>::space == Device)
Kokkos::parallel_for(config, f); Kokkos::parallel_for(config, f);
else else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#else #else
Kokkos::parallel_for(nall, f); Kokkos::parallel_for(nall, f);
#endif #endif
} }
} }
} }
Kokkos::deep_copy(h_scalars, d_scalars); Kokkos::deep_copy(h_scalars, d_scalars);
@ -871,8 +871,8 @@ void NeighborKokkosExecute<DeviceType>::
if(rsq <= cutsq) { if(rsq <= cutsq) {
if(n<neigh_list.maxneighs) { if(n<neigh_list.maxneighs) {
if(neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history; if(neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history;
else neighbors_i(n++) = j; else neighbors_i(n++) = j;
} }
else n++; else n++;
} }
@ -892,14 +892,14 @@ void NeighborKokkosExecute<DeviceType>::
if(HalfNeigh && !Newton && (j < i)) continue; if(HalfNeigh && !Newton && (j < i)) continue;
if(!HalfNeigh && j==i) continue; if(!HalfNeigh && j==i) continue;
if(Tri) { if(Tri) {
if (x(j,2) < ztmp) continue; if (x(j,2) < ztmp) continue;
if (x(j,2) == ztmp) { if (x(j,2) == ztmp) {
if (x(j,1) < ytmp) continue; if (x(j,1) < ytmp) continue;
if (x(j,1) == ytmp) { if (x(j,1) == ytmp) {
if (x(j,0) < xtmp) continue; if (x(j,0) < xtmp) continue;
if (x(j,0) == xtmp && j <= i) continue; if (x(j,0) == xtmp && j <= i) continue;
} }
} }
} }
if(exclude && exclusion(i,j,itype,jtype)) continue; if(exclude && exclusion(i,j,itype,jtype)) continue;
@ -911,11 +911,11 @@ void NeighborKokkosExecute<DeviceType>::
const X_FLOAT cutsq = (radsum + skin) * (radsum + skin); const X_FLOAT cutsq = (radsum + skin) * (radsum + skin);
if(rsq <= cutsq) { if(rsq <= cutsq) {
if(n<neigh_list.maxneighs) { if(n<neigh_list.maxneighs) {
if(neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history; if(neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history;
else neighbors_i(n++) = j; else neighbors_i(n++) = j;
} }
else n++; else n++;
} }
} }
} }
@ -990,17 +990,17 @@ void NeighborKokkosExecute<DeviceType>::build_ItemSizeCuda(typename Kokkos::Team
if(i >= 0 && i < nlocal) { if(i >= 0 && i < nlocal) {
#pragma unroll 4 #pragma unroll 4
for(int m = 0; m < bincount_current; m++) { for(int m = 0; m < bincount_current; m++) {
int j = other_id[m]; int j = other_id[m];
const int jtype = other_x[m + 3 * atoms_per_bin]; const int jtype = other_x[m + 3 * atoms_per_bin];
//for same bin as atom i skip j if i==j and skip atoms "below and to the left" if using halfneighborlists //for same bin as atom i skip j if i==j and skip atoms "below and to the left" if using halfneighborlists
if((j == i) || if((j == i) ||
(HalfNeigh && !Newton && (j < i)) || (HalfNeigh && !Newton && (j < i)) ||
(HalfNeigh && Newton && (HalfNeigh && Newton &&
((j < i) || ((j < i) ||
((j >= nlocal) && ((x(j, 2) < ztmp) || (x(j, 2) == ztmp && x(j, 1) < ytmp) || ((j >= nlocal) && ((x(j, 2) < ztmp) || (x(j, 2) == ztmp && x(j, 1) < ytmp) ||
(x(j, 2) == ztmp && x(j, 1) == ytmp && x(j, 0) < xtmp))))) (x(j, 2) == ztmp && x(j, 1) == ytmp && x(j, 0) < xtmp)))))
) continue; ) continue;
if(Tri) { if(Tri) {
if (x(j,2) < ztmp) continue; if (x(j,2) < ztmp) continue;
if (x(j,2) == ztmp) { if (x(j,2) == ztmp) {
@ -1011,21 +1011,21 @@ void NeighborKokkosExecute<DeviceType>::build_ItemSizeCuda(typename Kokkos::Team
} }
} }
} }
if(exclude && exclusion(i,j,itype,jtype)) continue; if(exclude && exclusion(i,j,itype,jtype)) continue;
const X_FLOAT delx = xtmp - other_x[m]; const X_FLOAT delx = xtmp - other_x[m];
const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin]; const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin];
const X_FLOAT delz = ztmp - other_x[m + 2 * atoms_per_bin]; const X_FLOAT delz = ztmp - other_x[m + 2 * atoms_per_bin];
const X_FLOAT rsq = delx * delx + dely * dely + delz * delz; const X_FLOAT rsq = delx * delx + dely * dely + delz * delz;
const X_FLOAT radsum = radi + other_x[m + 4 * atoms_per_bin]; const X_FLOAT radsum = radi + other_x[m + 4 * atoms_per_bin];
const X_FLOAT cutsq = (radsum + skin) * (radsum + skin); const X_FLOAT cutsq = (radsum + skin) * (radsum + skin);
if(rsq <= cutsq) { if(rsq <= cutsq) {
if(n<neigh_list.maxneighs) { if(n<neigh_list.maxneighs) {
if (neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history; if (neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history;
else neighbors_i(n++) = j; else neighbors_i(n++) = j;
} }
else n++; else n++;
} }
} }
} }
__syncthreads(); __syncthreads();
@ -1041,11 +1041,11 @@ void NeighborKokkosExecute<DeviceType>::build_ItemSizeCuda(typename Kokkos::Team
int j = MY_II < bincount_current ? c_bins(jbin, MY_II) : -1; int j = MY_II < bincount_current ? c_bins(jbin, MY_II) : -1;
if(j >= 0) { if(j >= 0) {
other_x[MY_II] = x(j, 0); other_x[MY_II] = x(j, 0);
other_x[MY_II + atoms_per_bin] = x(j, 1); other_x[MY_II + atoms_per_bin] = x(j, 1);
other_x[MY_II + 2 * atoms_per_bin] = x(j, 2); other_x[MY_II + 2 * atoms_per_bin] = x(j, 2);
other_x[MY_II + 3 * atoms_per_bin] = type(j); other_x[MY_II + 3 * atoms_per_bin] = type(j);
other_x[MY_II + 4 * atoms_per_bin] = radius(j); other_x[MY_II + 4 * atoms_per_bin] = radius(j);
} }
other_id[MY_II] = j; other_id[MY_II] = j;
@ -1054,40 +1054,40 @@ void NeighborKokkosExecute<DeviceType>::build_ItemSizeCuda(typename Kokkos::Team
if(i >= 0 && i < nlocal) { if(i >= 0 && i < nlocal) {
#pragma unroll 8 #pragma unroll 8
for(int m = 0; m < bincount_current; m++) { for(int m = 0; m < bincount_current; m++) {
const int j = other_id[m]; const int j = other_id[m];
const int jtype = other_x[m + 3 * atoms_per_bin]; const int jtype = other_x[m + 3 * atoms_per_bin];
if(HalfNeigh && (j < i)) continue; if(HalfNeigh && (j < i)) continue;
if(HalfNeigh && !Newton && (j < i)) continue; if(HalfNeigh && !Newton && (j < i)) continue;
if(!HalfNeigh && j==i) continue; if(!HalfNeigh && j==i) continue;
if(Tri) { if(Tri) {
if (x(j,2) < ztmp) continue; if (x(j,2) < ztmp) continue;
if (x(j,2) == ztmp) { if (x(j,2) == ztmp) {
if (x(j,1) < ytmp) continue; if (x(j,1) < ytmp) continue;
if (x(j,1) == ytmp) { if (x(j,1) == ytmp) {
if (x(j,0) < xtmp) continue; if (x(j,0) < xtmp) continue;
if (x(j,0) == xtmp && j <= i) continue; if (x(j,0) == xtmp && j <= i) continue;
} }
} }
} }
if(exclude && exclusion(i,j,itype,jtype)) continue; if(exclude && exclusion(i,j,itype,jtype)) continue;
const X_FLOAT delx = xtmp - other_x[m]; const X_FLOAT delx = xtmp - other_x[m];
const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin]; const X_FLOAT dely = ytmp - other_x[m + atoms_per_bin];
const X_FLOAT delz = ztmp - other_x[m + 2 * atoms_per_bin]; const X_FLOAT delz = ztmp - other_x[m + 2 * atoms_per_bin];
const X_FLOAT rsq = delx * delx + dely * dely + delz * delz; const X_FLOAT rsq = delx * delx + dely * dely + delz * delz;
const X_FLOAT radsum = radi + other_x[m + 4 * atoms_per_bin]; const X_FLOAT radsum = radi + other_x[m + 4 * atoms_per_bin];
const X_FLOAT cutsq = (radsum + skin) * (radsum + skin); const X_FLOAT cutsq = (radsum + skin) * (radsum + skin);
if(rsq <= cutsq) { if(rsq <= cutsq) {
if(n<neigh_list.maxneighs) { if(n<neigh_list.maxneighs) {
if (neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history; if (neigh_list.history && rsq < radsum*radsum) neighbors_i(n++) = j ^ mask_history;
else neighbors_i(n++) = j; else neighbors_i(n++) = j;
} }
else n++; else n++;
} }
} }
} }
__syncthreads(); __syncthreads();
} }

View File

@ -174,85 +174,85 @@ void PairGranHookeHistoryKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (lmp->kokkos->neighflag == HALF) { if (lmp->kokkos->neighflag == HALF) {
if (force->newton_pair) { if (force->newton_pair) {
if (vflag_atom) { if (vflag_atom) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,2,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,2,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,2,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,2,0>>(0,inum),*this);
} }
} else if (vflag_global) { } else if (vflag_global) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,1,1>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,1,1>>(0,inum),*this, ev);
} else { } else {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,1,0>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,1,0>>(0,inum),*this, ev);
} }
} else { } else {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,0,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,0,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,0,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,1,0,0>>(0,inum),*this);
} }
} }
} else { } else {
if (vflag_atom) { if (vflag_atom) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,2,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,2,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,2,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,2,0>>(0,inum),*this);
} }
} else if (vflag_global) { } else if (vflag_global) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,1,1>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,1,1>>(0,inum),*this, ev);
} else { } else {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,1,0>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,1,0>>(0,inum),*this, ev);
} }
} else { } else {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,0,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,0,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,0,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALF,0,0,0>>(0,inum),*this);
} }
} }
} }
} else { // HALFTHREAD } else { // HALFTHREAD
if (force->newton_pair) { if (force->newton_pair) {
if (vflag_atom) { if (vflag_atom) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,2,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,2,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,2,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,2,0>>(0,inum),*this);
} }
} else if (vflag_global) { } else if (vflag_global) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,1,1>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,1,1>>(0,inum),*this, ev);
} else { } else {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,1,0>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,1,0>>(0,inum),*this, ev);
} }
} else { } else {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,0,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,0,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,0,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,1,0,0>>(0,inum),*this);
} }
} }
} else { } else {
if (vflag_atom) { if (vflag_atom) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,2,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,2,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,2,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,2,0>>(0,inum),*this);
} }
} else if (vflag_global) { } else if (vflag_global) {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,1,1>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,1,1>>(0,inum),*this, ev);
} else { } else {
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,1,0>>(0,inum),*this, ev); Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,1,0>>(0,inum),*this, ev);
} }
} else { } else {
if (shearupdate) { if (shearupdate) {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,0,1>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,0,1>>(0,inum),*this);
} else { } else {
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,0,0>>(0,inum),*this); Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairGranHookeHistoryCompute<HALFTHREAD,0,0,0>>(0,inum),*this);
} }
} }
} }
} }
@ -408,7 +408,7 @@ void PairGranHookeHistoryKokkos<DeviceType>::operator()(TagPairGranHookeHistoryC
shear3 += vtr3*dt; shear3 += vtr3*dt;
} }
X_FLOAT shrmag = sqrt(shear1*shear1 + shear2*shear2 + X_FLOAT shrmag = sqrt(shear1*shear1 + shear2*shear2 +
shear3*shear3); shear3*shear3);
// rotate shear displacements // rotate shear displacements
@ -433,15 +433,15 @@ void PairGranHookeHistoryKokkos<DeviceType>::operator()(TagPairGranHookeHistoryC
if (fs > fn) { if (fs > fn) {
if (shrmag != 0.0) { if (shrmag != 0.0) {
shear1 = (fn/fs) * (shear1 + meff*gammat*vtr1/kt) - shear1 = (fn/fs) * (shear1 + meff*gammat*vtr1/kt) -
meff*gammat*vtr1/kt; meff*gammat*vtr1/kt;
shear2 = (fn/fs) * (shear2 + meff*gammat*vtr2/kt) - shear2 = (fn/fs) * (shear2 + meff*gammat*vtr2/kt) -
meff*gammat*vtr2/kt; meff*gammat*vtr2/kt;
shear3 = (fn/fs) * (shear3 + meff*gammat*vtr3/kt) - shear3 = (fn/fs) * (shear3 + meff*gammat*vtr3/kt) -
meff*gammat*vtr3/kt; meff*gammat*vtr3/kt;
fs1 *= fn/fs; fs1 *= fn/fs;
fs2 *= fn/fs; fs2 *= fn/fs;
fs3 *= fn/fs; fs3 *= fn/fs;
} else fs1 = fs2 = fs3 = 0.0; } else fs1 = fs2 = fs3 = 0.0;
} }
@ -503,8 +503,8 @@ template<class DeviceType>
template<int NEWTON_PAIR> template<int NEWTON_PAIR>
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
void PairGranHookeHistoryKokkos<DeviceType>::ev_tally_xyz(EV_FLOAT &ev, int i, int j, void PairGranHookeHistoryKokkos<DeviceType>::ev_tally_xyz(EV_FLOAT &ev, int i, int j,
F_FLOAT fx, F_FLOAT fy, F_FLOAT fz, F_FLOAT fx, F_FLOAT fy, F_FLOAT fz,
X_FLOAT delx, X_FLOAT dely, X_FLOAT delz) const X_FLOAT delx, X_FLOAT dely, X_FLOAT delz) const
{ {
F_FLOAT v[6]; F_FLOAT v[6];
@ -546,8 +546,8 @@ template<class DeviceType>
template<int NEIGHFLAG, int NEWTON_PAIR> template<int NEIGHFLAG, int NEWTON_PAIR>
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
void PairGranHookeHistoryKokkos<DeviceType>::ev_tally_xyz_atom(EV_FLOAT &ev, int i, int j, void PairGranHookeHistoryKokkos<DeviceType>::ev_tally_xyz_atom(EV_FLOAT &ev, int i, int j,
F_FLOAT fx, F_FLOAT fy, F_FLOAT fz, F_FLOAT fx, F_FLOAT fy, F_FLOAT fz,
X_FLOAT delx, X_FLOAT dely, X_FLOAT delz) const X_FLOAT delx, X_FLOAT dely, X_FLOAT delz) const
{ {
Kokkos::View<F_FLOAT*[6], typename DAT::t_virial_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > v_vatom = k_vatom.view<DeviceType>(); Kokkos::View<F_FLOAT*[6], typename DAT::t_virial_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > v_vatom = k_vatom.view<DeviceType>();

View File

@ -614,8 +614,8 @@ void VerletKokkos::force_clear()
atomKK->modified(Device,F_MASK); atomKK->modified(Device,F_MASK);
if (torqueflag) { if (torqueflag) {
Kokkos::parallel_for(range, Zero<typename ArrayTypes<LMPDeviceType>::t_f_array>(atomKK->k_torque.view<LMPDeviceType>())); Kokkos::parallel_for(range, Zero<typename ArrayTypes<LMPDeviceType>::t_f_array>(atomKK->k_torque.view<LMPDeviceType>()));
atomKK->modified(Device,TORQUE_MASK); atomKK->modified(Device,TORQUE_MASK);
} }
} }
} }

View File

@ -131,7 +131,7 @@ void EwaldDisp::init()
else if (ewald_mix==Pair::ARITHMETIC) { k = 2; break; } else if (ewald_mix==Pair::ARITHMETIC) { k = 2; break; }
error->all(FLERR, error->all(FLERR,
"Unsupported mixing rule in kspace_style ewald/disp"); "Unsupported mixing rule in kspace_style ewald/disp");
break; break;
default: default:
error->all(FLERR,"Unsupported order in kspace_style ewald/disp"); error->all(FLERR,"Unsupported order in kspace_style ewald/disp");
} }

View File

@ -320,8 +320,8 @@ void PPPMDisp::init()
mixflag == 1) && mixflag!= 2) { k = 1; break; } mixflag == 1) && mixflag!= 2) { k = 1; break; }
else if (ewald_mix==Pair::ARITHMETIC && mixflag!=2) { k = 2; break; } else if (ewald_mix==Pair::ARITHMETIC && mixflag!=2) { k = 2; break; }
else if (mixflag == 2) { k = 3; break; } else if (mixflag == 2) { k = 3; break; }
else error->all(FLERR,"Unsupported mixing rule in kspace_style pppm/disp"); else error->all(FLERR,"Unsupported mixing rule in kspace_style pppm/disp");
break; break;
default: default:
sprintf(str, "Unsupported order in kspace_style " sprintf(str, "Unsupported order in kspace_style "
"pppm/disp, pair_style %s", force->pair_style); "pppm/disp, pair_style %s", force->pair_style);

View File

@ -67,13 +67,13 @@ class AtomVecSpin : public AtomVec {
tagint *tag; tagint *tag;
int *type,*mask; int *type,*mask;
imageint *image; imageint *image;
double **x,**v,**f; // lattice quantities double **x,**v,**f; // lattice quantities
// spin quantities // spin quantities
double **sp; // sp[i][0-2] direction of the spin i double **sp; // sp[i][0-2] direction of the spin i
// sp[i][3] atomic magnetic moment of the spin i // sp[i][3] atomic magnetic moment of the spin i
double **fm; // fm[i][0-2] direction of magnetic precession double **fm; // fm[i][0-2] direction of magnetic precession
double **fm_long; // storage of long-range spin prec. components double **fm_long; // storage of long-range spin prec. components
}; };
} }

View File

@ -32,17 +32,17 @@ class FixLangevinSpin : public Fix {
void init(); void init();
void setup(int); void setup(int);
void post_force_respa(int, int, int); void post_force_respa(int, int, int);
void add_tdamping(double spi[3], double fmi[3]); // add transverse damping void add_tdamping(double spi[3], double fmi[3]); // add transverse damping
void add_temperature(double fmi[3]); // add temperature void add_temperature(double fmi[3]); // add temperature
int tdamp_flag, ldamp_flag, temp_flag; // damping and temperature flags int tdamp_flag, ldamp_flag, temp_flag; // damping and temperature flags
protected: protected:
double *spi, *fmi; double *spi, *fmi;
double alpha_t; // transverse mag. damping double alpha_t; // transverse mag. damping
double dts; // magnetic timestep double dts; // magnetic timestep
double temp; // spin bath temperature double temp; // spin bath temperature
double D,sigma; // bath intensity var. double D,sigma; // bath intensity var.
double gil_factor; // gilbert's prefactor double gil_factor; // gilbert's prefactor
char *id_temp; char *id_temp;
class Compute *temperature; class Compute *temperature;

View File

@ -60,20 +60,20 @@ class FixNEBSpin : public Fix {
double **spprev,**spnext,**fmnext; double **spprev,**spnext,**fmnext;
double **springF; double **springF;
double **tangent; double **tangent;
double **xsend,**xrecv; // coords to send/recv to/from other replica double **xsend,**xrecv; // coords to send/recv to/from other replica
double **fsend,**frecv; // coords to send/recv to/from other replica double **fsend,**frecv; // coords to send/recv to/from other replica
double **spsend,**sprecv; // sp to send/recv to/from other replica double **spsend,**sprecv; // sp to send/recv to/from other replica
double **fmsend,**fmrecv; // fm to send/recv to/from other replica double **fmsend,**fmrecv; // fm to send/recv to/from other replica
tagint *tagsend,*tagrecv; // ditto for atom IDs tagint *tagsend,*tagrecv; // ditto for atom IDs
// info gathered from all procs in my replica // info gathered from all procs in my replica
double **xsendall,**xrecvall; // coords to send/recv to/from other replica double **xsendall,**xrecvall; // coords to send/recv to/from other replica
double **fsendall,**frecvall; // force to send/recv to/from other replica double **fsendall,**frecvall; // force to send/recv to/from other replica
double **spsendall,**sprecvall; // sp to send/recv to/from other replica double **spsendall,**sprecvall; // sp to send/recv to/from other replica
double **fmsendall,**fmrecvall; // fm to send/recv to/from other replica double **fmsendall,**fmrecvall; // fm to send/recv to/from other replica
tagint *tagsendall,*tagrecvall; // ditto for atom IDs tagint *tagsendall,*tagrecvall; // ditto for atom IDs
int *counts,*displacements; // used for MPI_Gather int *counts,*displacements; // used for MPI_Gather
double geodesic_distance(double *, double *); double geodesic_distance(double *, double *);
void inter_replica_comm(); void inter_replica_comm();

View File

@ -307,7 +307,7 @@ void FixNVESpin::initial_integrate(int /*vflag*/)
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i); AdvanceSingleSpin(i);
i = forward_stacks[i]; i = forward_stacks[i];
} }
} }
} }
for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal
@ -318,7 +318,7 @@ void FixNVESpin::initial_integrate(int /*vflag*/)
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i); AdvanceSingleSpin(i);
i = backward_stacks[i]; i = backward_stacks[i];
} }
} }
} }
} else if (sector_flag == 0) { // serial seq. update } else if (sector_flag == 0) { // serial seq. update
@ -360,7 +360,7 @@ void FixNVESpin::initial_integrate(int /*vflag*/)
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i); AdvanceSingleSpin(i);
i = forward_stacks[i]; i = forward_stacks[i];
} }
} }
} }
for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal
@ -371,7 +371,7 @@ void FixNVESpin::initial_integrate(int /*vflag*/)
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i); AdvanceSingleSpin(i);
i = backward_stacks[i]; i = backward_stacks[i];
} }
} }
} }
} else if (sector_flag == 0) { // serial seq. update } else if (sector_flag == 0) { // serial seq. update

View File

@ -34,30 +34,30 @@ friend class PairSpin;
virtual void initial_integrate(int); virtual void initial_integrate(int);
virtual void final_integrate(); virtual void final_integrate();
void ComputeInteractionsSpin(int); // compute and advance single spin functions void ComputeInteractionsSpin(int); // compute and advance single spin functions
void AdvanceSingleSpin(int); void AdvanceSingleSpin(int);
void sectoring(); // sectoring operation functions void sectoring(); // sectoring operation functions
int coords2sector(double *); int coords2sector(double *);
void setup_pre_neighbor(); void setup_pre_neighbor();
void pre_neighbor(); void pre_neighbor();
int lattice_flag; // lattice_flag = 0 if spins only int lattice_flag; // lattice_flag = 0 if spins only
// lattice_flag = 1 if spin-lattice calc. // lattice_flag = 1 if spin-lattice calc.
protected: protected:
int sector_flag; // sector_flag = 0 if serial algorithm int sector_flag; // sector_flag = 0 if serial algorithm
// sector_flag = 1 if parallel algorithm // sector_flag = 1 if parallel algorithm
double dtv, dtf, dts; // velocity, force, and spin timesteps double dtv, dtf, dts; // velocity, force, and spin timesteps
int nlocal_max; // max value of nlocal (for size of lists) int nlocal_max; // max value of nlocal (for size of lists)
int pair_spin_flag; // magnetic pair flags int pair_spin_flag; // magnetic pair flags
int long_spin_flag; // magnetic long-range flag int long_spin_flag; // magnetic long-range flag
int precession_spin_flag; // magnetic precession flags int precession_spin_flag; // magnetic precession flags
int maglangevin_flag; // magnetic langevin flags int maglangevin_flag; // magnetic langevin flags
int tdamp_flag, temp_flag; int tdamp_flag, temp_flag;
int setforce_spin_flag; int setforce_spin_flag;
@ -69,9 +69,9 @@ friend class PairSpin;
// pointers to magnetic pair styles // pointers to magnetic pair styles
int npairs, npairspin; // # of pairs, and # of spin pairs int npairs, npairspin; // # of pairs, and # of spin pairs
class Pair *pair; class Pair *pair;
class PairSpin **spin_pairs; // vector of spin pairs class PairSpin **spin_pairs; // vector of spin pairs
// sectoring variables // sectoring variables
@ -80,10 +80,10 @@ friend class PairSpin;
// stacking variables for sectoring algorithm // stacking variables for sectoring algorithm
int *stack_head; // index of first atom in backward_stacks int *stack_head; // index of first atom in backward_stacks
int *stack_foot; // index of first atom in forward_stacks int *stack_foot; // index of first atom in forward_stacks
int *backward_stacks; // index of next atom in backward stack int *backward_stacks; // index of next atom in backward stack
int *forward_stacks; // index of next atom in forward stack int *forward_stacks; // index of next atom in forward stack
}; };

View File

@ -236,7 +236,7 @@ void FixPrecessionSpin::post_force(int /* vflag */)
if (varflag != CONSTANT) { if (varflag != CONSTANT) {
modify->clearstep_compute(); modify->clearstep_compute();
modify->addstep_compute(update->ntimestep + 1); modify->addstep_compute(update->ntimestep + 1);
set_magneticprecession(); // update mag. field if time-dep. set_magneticprecession(); // update mag. field if time-dep.
} }
int *mask = atom->mask; int *mask = atom->mask;
@ -265,9 +265,9 @@ void FixPrecessionSpin::post_force(int /* vflag */)
epreci -= compute_anisotropy_energy(spi); epreci -= compute_anisotropy_energy(spi);
} }
if (cubic_flag) { // compute cubic anisotropy if (cubic_flag) { // compute cubic anisotropy
compute_cubic(spi,fmi); compute_cubic(spi,fmi);
epreci -= compute_cubic_energy(spi); epreci -= compute_cubic_energy(spi);
} }
eprec += epreci; eprec += epreci;

View File

@ -54,7 +54,7 @@ class FixPrecessionSpin : public Fix {
double compute_cubic_energy(double *); double compute_cubic_energy(double *);
protected: protected:
int style; // style of the magnetic precession int style; // style of the magnetic precession
double degree2rad; double degree2rad;
double hbar; double hbar;
@ -72,19 +72,19 @@ class FixPrecessionSpin : public Fix {
double H_field; double H_field;
double nhx, nhy, nhz; double nhx, nhy, nhz;
double hx, hy, hz; // temp. force variables double hx, hy, hz; // temp. force variables
// magnetic anisotropy intensity and direction // magnetic anisotropy intensity and direction
double Ka; // aniso const. in eV double Ka; // aniso const. in eV
double Kah; // aniso const. in rad.THz double Kah; // aniso const. in rad.THz
double nax, nay, naz; double nax, nay, naz;
double Kax, Kay, Kaz; // temp. force variables double Kax, Kay, Kaz; // temp. force variables
// cubic anisotropy intensity // cubic anisotropy intensity
double k1c,k2c; // cubic const. in eV double k1c,k2c; // cubic const. in eV
double k1ch,k2ch; // cubic const. in rad.THz double k1ch,k2ch; // cubic const. in rad.THz
double nc1x,nc1y,nc1z; double nc1x,nc1y,nc1z;
double nc2x,nc2y,nc2z; double nc2x,nc2y,nc2z;
double nc3x,nc3y,nc3z; double nc3x,nc3y,nc3z;

View File

@ -165,9 +165,9 @@ int MinSpin::iterate(int maxiter)
fmdotfm = fmsq = 0.0; fmdotfm = fmsq = 0.0;
if (update->ftol > 0.0) { if (update->ftol > 0.0) {
if (normstyle == MAX) fmsq = max_torque(); // max torque norm if (normstyle == MAX) fmsq = max_torque(); // max torque norm
else if (normstyle == INF) fmsq = inf_torque(); // inf torque norm else if (normstyle == INF) fmsq = inf_torque(); // inf torque norm
else if (normstyle == TWO) fmsq = total_torque(); // Euclidean torque 2-norm else if (normstyle == TWO) fmsq = total_torque(); // Euclidean torque 2-norm
else error->all(FLERR,"Illegal min_modify command"); else error->all(FLERR,"Illegal min_modify command");
fmdotfm = fmsq*fmsq; fmdotfm = fmsq*fmsq;
if (update->multireplica == 0) { if (update->multireplica == 0) {

View File

@ -270,9 +270,9 @@ int MinSpinCG::iterate(int maxiter)
fmdotfm = fmsq = 0.0; fmdotfm = fmsq = 0.0;
if (update->ftol > 0.0) { if (update->ftol > 0.0) {
if (normstyle == MAX) fmsq = max_torque(); // max torque norm if (normstyle == MAX) fmsq = max_torque(); // max torque norm
else if (normstyle == INF) fmsq = inf_torque(); // inf torque norm else if (normstyle == INF) fmsq = inf_torque(); // inf torque norm
else if (normstyle == TWO) fmsq = total_torque(); // Euclidean torque 2-norm else if (normstyle == TWO) fmsq = total_torque(); // Euclidean torque 2-norm
else error->all(FLERR,"Illegal min_modify command"); else error->all(FLERR,"Illegal min_modify command");
fmdotfm = fmsq*fmsq; fmdotfm = fmsq*fmsq;
if (update->multireplica == 0) { if (update->multireplica == 0) {
@ -347,12 +347,12 @@ void MinSpinCG::calc_search_direction()
factor = 0.0; factor = 0.0;
if (local_iter == 0 || local_iter % 5 == 0){ // steepest descent direction if (local_iter == 0 || local_iter % 5 == 0){ // steepest descent direction
for (int i = 0; i < 3 * nlocal; i++) { for (int i = 0; i < 3 * nlocal; i++) {
p_s[i] = -g_cur[i] * factor; p_s[i] = -g_cur[i] * factor;
g_old[i] = g_cur[i] * factor; g_old[i] = g_cur[i] * factor;
} }
} else { // conjugate direction } else { // conjugate direction
for (int i = 0; i < 3 * nlocal; i++) { for (int i = 0; i < 3 * nlocal; i++) {
g2old += g_old[i] * g_old[i]; g2old += g_old[i] * g_old[i];
g2 += g_cur[i] * g_cur[i]; g2 += g_cur[i] * g_cur[i];
@ -394,7 +394,7 @@ void MinSpinCG::advance_spins()
{ {
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
double **sp = atom->sp; double **sp = atom->sp;
double rot_mat[9]; // exponential of matrix made of search direction double rot_mat[9]; // exponential of matrix made of search direction
double s_new[3]; double s_new[3];
// loop on all spins on proc. // loop on all spins on proc.

View File

@ -35,21 +35,21 @@ class MinSpinCG: public Min {
int iterate(int); int iterate(int);
private: private:
int local_iter; // for neb int local_iter; // for neb
int nlocal_max; // max value of nlocal (for size of lists) int nlocal_max; // max value of nlocal (for size of lists)
int use_line_search; // use line search or not. int use_line_search; // use line search or not.
int ireplica,nreplica; // for neb int ireplica,nreplica; // for neb
double dt; // global timestep double dt; // global timestep
double dts; // spin timestep double dts; // spin timestep
double discrete_factor; // factor for spin timestep evaluation double discrete_factor; // factor for spin timestep evaluation
double der_e_cur; // current derivative along search dir. double der_e_cur; // current derivative along search dir.
double der_e_pr; // previous derivative along search dir. double der_e_pr; // previous derivative along search dir.
double *spvec; // variables for atomic dof, as 1d vector double *spvec; // variables for atomic dof, as 1d vector
double *fmvec; // variables for atomic dof, as 1d vector double *fmvec; // variables for atomic dof, as 1d vector
double *g_old; // gradient vector at previous step double *g_old; // gradient vector at previous step
double *g_cur; // current gradient vector double *g_cur; // current gradient vector
double *p_s; // search direction vector double *p_s; // search direction vector
double **sp_copy; // copy of the spins double **sp_copy; // copy of the spins
void advance_spins(); void advance_spins();
void calc_gradient(); void calc_gradient();

View File

@ -285,9 +285,9 @@ int MinSpinLBFGS::iterate(int maxiter)
fmdotfm = fmsq = 0.0; fmdotfm = fmsq = 0.0;
if (update->ftol > 0.0) { if (update->ftol > 0.0) {
if (normstyle == MAX) fmsq = max_torque(); // max torque norm if (normstyle == MAX) fmsq = max_torque(); // max torque norm
else if (normstyle == INF) fmsq = inf_torque(); // inf torque norm else if (normstyle == INF) fmsq = inf_torque(); // inf torque norm
else if (normstyle == TWO) fmsq = total_torque(); // Euclidean torque 2-norm else if (normstyle == TWO) fmsq = total_torque(); // Euclidean torque 2-norm
else error->all(FLERR,"Illegal min_modify command"); else error->all(FLERR,"Illegal min_modify command");
fmdotfm = fmsq*fmsq; fmdotfm = fmsq*fmsq;
if (update->multireplica == 0) { if (update->multireplica == 0) {
@ -372,7 +372,7 @@ void MinSpinLBFGS::calc_search_direction()
factor = 1.0; factor = 1.0;
} }
if (local_iter == 0){ // steepest descent direction if (local_iter == 0){ // steepest descent direction
//if no line search then calculate maximum rotation //if no line search then calculate maximum rotation
if (use_line_search == 0) if (use_line_search == 0)

View File

@ -35,18 +35,18 @@ class MinSpinLBFGS: public Min {
int iterate(int); int iterate(int);
private: private:
int local_iter; // for neb int local_iter; // for neb
int use_line_search; // use line search or not. int use_line_search; // use line search or not.
int nlocal_max; // max value of nlocal (for size of lists) int nlocal_max; // max value of nlocal (for size of lists)
int ireplica,nreplica; // for neb int ireplica,nreplica; // for neb
double der_e_cur; // current derivative along search dir. double der_e_cur; // current derivative along search dir.
double der_e_pr; // previous derivative along search dir. double der_e_pr; // previous derivative along search dir.
double maxepsrot; double maxepsrot;
double *spvec; // variables for atomic dof, as 1d vector double *spvec; // variables for atomic dof, as 1d vector
double *fmvec; // variables for atomic dof, as 1d vector double *fmvec; // variables for atomic dof, as 1d vector
double *g_old; // gradient vector at previous step double *g_old; // gradient vector at previous step
double *g_cur; // current gradient vector double *g_cur; // current gradient vector
double *p_s; // search direction vector double *p_s; // search direction vector
void advance_spins(); void advance_spins();
void calc_gradient(); void calc_gradient();
@ -58,11 +58,11 @@ class MinSpinLBFGS: public Min {
int adescent(double, double); int adescent(double, double);
double maximum_rotation(double *); double maximum_rotation(double *);
double *rho; // estimation of curvature double *rho; // estimation of curvature
double **ds; // change in rotation matrix between two iterations, da double **ds; // change in rotation matrix between two iterations, da
double **dy; // change in gradients between two iterations, dg double **dy; // change in gradients between two iterations, dg
double **sp_copy; // copy of the spins double **sp_copy; // copy of the spins
int num_mem; // number of stored steps int num_mem; // number of stored steps
bigint last_negative; bigint last_negative;
}; };

View File

@ -179,7 +179,7 @@ void NEBSpin::run()
update->whichflag = 2; update->whichflag = 2;
update->etol = etol; update->etol = etol;
update->ftol = ttol; // update->ftol is a torque tolerance update->ftol = ttol; // update->ftol is a torque tolerance
update->multireplica = 1; update->multireplica = 1;
lmp->init(); lmp->init();
@ -214,7 +214,7 @@ void NEBSpin::run()
fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque " fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc EBF EBR RDT " "GradV0 GradV1 GradVc EBF EBR RDT "
"RD1 PE1 RD2 PE2 ... RDN PEN " "RD1 PE1 RD2 PE2 ... RDN PEN "
"GradV0dottan DN0 ... GradVNdottan DNN\n"); "GradV0dottan DN0 ... GradVNdottan DNN\n");
} else { } else {
fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque " fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc EBF EBR RDT RD1 PE1 RD2 PE2 ... " "GradV0 GradV1 GradVc EBF EBR RDT RD1 PE1 RD2 PE2 ... "
@ -224,10 +224,10 @@ void NEBSpin::run()
if (ulogfile) { if (ulogfile) {
if (verbose) { if (verbose) {
fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque " fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc EBF EBR RDT " "GradV0 GradV1 GradVc EBF EBR RDT "
"RD1 PE1 RD2 PE2 ... RDN PEN " "RD1 PE1 RD2 PE2 ... RDN PEN "
"GradV0dottan DN0 ... GradVNdottan DNN\n"); "GradV0dottan DN0 ... GradVNdottan DNN\n");
} else { } else {
fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque " fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc EBF EBR RDT RD1 PE1 RD2 PE2 ... " "GradV0 GradV1 GradVc EBF EBR RDT RD1 PE1 RD2 PE2 ... "
@ -301,7 +301,7 @@ void NEBSpin::run()
fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque " fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc EBF EBR RDT " "GradV0 GradV1 GradVc EBF EBR RDT "
"RD1 PE1 RD2 PE2 ... RDN PEN " "RD1 PE1 RD2 PE2 ... RDN PEN "
"GradV0dottan DN0... GradVNdottan DNN\n"); "GradV0dottan DN0... GradVNdottan DNN\n");
} else { } else {
fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque " fprintf(uscreen,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc " "GradV0 GradV1 GradVc "
@ -311,10 +311,10 @@ void NEBSpin::run()
} }
if (ulogfile) { if (ulogfile) {
if (verbose) { if (verbose) {
fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque " fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc EBF EBR RDT " "GradV0 GradV1 GradVc EBF EBR RDT "
"RD1 PE1 RD2 PE2 ... RDN PEN " "RD1 PE1 RD2 PE2 ... RDN PEN "
"GradV0dottan DN0 ... GradVNdottan DNN\n"); "GradV0dottan DN0 ... GradVNdottan DNN\n");
} else { } else {
fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque " fprintf(ulogfile,"Step MaxReplicaTorque MaxAtomTorque "
"GradV0 GradV1 GradVc " "GradV0 GradV1 GradVc "
@ -472,8 +472,8 @@ void NEBSpin::readfile(char *file, int flag)
m = atom->map(tag); m = atom->map(tag);
if (m >= 0 && m < nlocal) { if (m >= 0 && m < nlocal) {
ncount++; ncount++;
musp = atof(values[1]); musp = atof(values[1]);
xx = atof(values[2]); xx = atof(values[2]);
yy = atof(values[3]); yy = atof(values[3]);
zz = atof(values[4]); zz = atof(values[4]);
spx = atof(values[5]); spx = atof(values[5]);
@ -482,39 +482,39 @@ void NEBSpin::readfile(char *file, int flag)
if (flag == 0) { if (flag == 0) {
spinit[0] = sp[m][0]; spinit[0] = sp[m][0];
spinit[1] = sp[m][1]; spinit[1] = sp[m][1];
spinit[2] = sp[m][2]; spinit[2] = sp[m][2];
spfinal[0] = spx; spfinal[0] = spx;
spfinal[1] = spy; spfinal[1] = spy;
spfinal[2] = spz; spfinal[2] = spz;
// interpolate intermediate spin states // interpolate intermediate spin states
sp[m][3] = musp; sp[m][3] = musp;
if (fraction == 0.0) { if (fraction == 0.0) {
sp[m][0] = spinit[0]; sp[m][0] = spinit[0];
sp[m][1] = spinit[1]; sp[m][1] = spinit[1];
sp[m][2] = spinit[2]; sp[m][2] = spinit[2];
} else if (fraction == 1.0) { } else if (fraction == 1.0) {
sp[m][0] = spfinal[0]; sp[m][0] = spfinal[0];
sp[m][1] = spfinal[1]; sp[m][1] = spfinal[1];
sp[m][2] = spfinal[2]; sp[m][2] = spfinal[2];
} else { } else {
temp_flag = initial_rotation(spinit,spfinal,fraction); temp_flag = initial_rotation(spinit,spfinal,fraction);
rot_flag = MAX(temp_flag,rot_flag); rot_flag = MAX(temp_flag,rot_flag);
sp[m][0] = spfinal[0]; sp[m][0] = spfinal[0];
sp[m][1] = spfinal[1]; sp[m][1] = spfinal[1];
sp[m][2] = spfinal[2]; sp[m][2] = spfinal[2];
} }
} else { } else {
sp[m][3] = musp; sp[m][3] = musp;
x[m][0] = xx; x[m][0] = xx;
x[m][1] = yy; x[m][1] = yy;
x[m][2] = zz; x[m][2] = zz;
sp[m][0] = spx; sp[m][0] = spx;
sp[m][1] = spy; sp[m][1] = spy;
sp[m][2] = spz; sp[m][2] = spz;
} }
} }
@ -602,24 +602,24 @@ int NEBSpin::initial_rotation(double *spi, double *sploc, double fraction)
// Rodrigues' formula breaks, needs to define another axis k // Rodrigues' formula breaks, needs to define another axis k
if (knormsq == 0.0) { if (knormsq == 0.0) {
if (sidotsf > 0.0) { // spins aligned and in same direction if (sidotsf > 0.0) { // spins aligned and in same direction
return 0; return 0;
} else if (sidotsf < 0.0) { // spins aligned and in opposite directions } else if (sidotsf < 0.0) { // spins aligned and in opposite directions
// defining a rotation axis // defining a rotation axis
// first guess, k = spi x [100] // first guess, k = spi x [100]
// second guess, k = spi x [010] // second guess, k = spi x [010]
if (spiy*spiy + spiz*spiz != 0.0) { // spin not along [100] if (spiy*spiy + spiz*spiz != 0.0) { // spin not along [100]
kx = 0.0; kx = 0.0;
ky = spiz; ky = spiz;
kz = -spiy; kz = -spiy;
knormsq = ky*ky + kz*kz; knormsq = ky*ky + kz*kz;
} else if (spix*spix + spiz*spiz != 0.0) { // spin not along [010] } else if (spix*spix + spiz*spiz != 0.0) { // spin not along [010]
kx = -spiz; kx = -spiz;
ky = 0.0; ky = 0.0;
kz = spix; kz = spix;
knormsq = kx*kx + kz*kz; knormsq = kx*kx + kz*kz;
} else error->all(FLERR,"Incorrect initial rotation operation"); } else error->all(FLERR,"Incorrect initial rotation operation");
rot_flag = 1; rot_flag = 1;
} }
@ -822,9 +822,9 @@ void NEBSpin::print_status()
for (int i = 0; i < nreplica; i++) for (int i = 0; i < nreplica; i++)
fprintf(uscreen,"%12.8g %12.8g ",rdist[i],all[i][0]); fprintf(uscreen,"%12.8g %12.8g ",rdist[i],all[i][0]);
if (verbose) { if (verbose) {
for (int i = 0; i < nreplica-1; i++) for (int i = 0; i < nreplica-1; i++)
fprintf(uscreen,"%12.8g %12.8g ",all[i][2],all[i][5]); fprintf(uscreen,"%12.8g %12.8g ",all[i][2],all[i][5]);
fprintf(uscreen,"%12.8g %12.8g ",NAN,all[nreplica-1][5]); fprintf(uscreen,"%12.8g %12.8g ",NAN,all[nreplica-1][5]);
} }
fprintf(uscreen,"\n"); fprintf(uscreen,"\n");
} }
@ -838,9 +838,9 @@ void NEBSpin::print_status()
for (int i = 0; i < nreplica; i++) for (int i = 0; i < nreplica; i++)
fprintf(ulogfile,"%12.8g %12.8g ",rdist[i],all[i][0]); fprintf(ulogfile,"%12.8g %12.8g ",rdist[i],all[i][0]);
if (verbose) { if (verbose) {
for (int i = 0; i < nreplica-1; i++) for (int i = 0; i < nreplica-1; i++)
fprintf(ulogfile,"%12.8g %12.8g ",all[i][2],all[i][5]); fprintf(ulogfile,"%12.8g %12.8g ",all[i][2],all[i][5]);
fprintf(ulogfile,"%12.8g %12.8g ",NAN,all[nreplica-1][5]); fprintf(ulogfile,"%12.8g %12.8g ",NAN,all[nreplica-1][5]);
} }
fprintf(ulogfile,"\n"); fprintf(ulogfile,"\n");
fflush(ulogfile); fflush(ulogfile);

View File

@ -33,8 +33,8 @@ friend class FixNVESpin;
virtual void compute_single_pair(int, double *) {} virtual void compute_single_pair(int, double *) {}
protected: protected:
double hbar; // Planck constant (eV.ps.rad-1) double hbar; // Planck constant (eV.ps.rad-1)
int lattice_flag; // flag for mech force computation int lattice_flag; // flag for mech force computation
virtual void allocate() {} virtual void allocate() {}
}; };

View File

@ -46,11 +46,11 @@ PairSpinDipoleCut::PairSpinDipoleCut(LAMMPS *lmp) : PairSpin(lmp)
{ {
spinflag = 1; spinflag = 1;
hbar = force->hplanck/MY_2PI; // eV/(rad.THz) hbar = force->hplanck/MY_2PI; // eV/(rad.THz)
mub = 9.274e-4; // in A.Ang^2 mub = 9.274e-4; // in A.Ang^2
mu_0 = 785.15; // in eV/Ang/A^2 mu_0 = 785.15; // in eV/Ang/A^2
mub2mu0 = mub * mub * mu_0 / (4.0*MY_PI); // in eV.Ang^3 mub2mu0 = mub * mub * mu_0 / (4.0*MY_PI); // in eV.Ang^3
//mub2mu0 = mub * mub * mu_0 / (4.0*MY_PI); // in eV //mub2mu0 = mub * mub * mu_0 / (4.0*MY_PI); // in eV
mub2mu0hbinv = mub2mu0 / hbar; // in rad.THz mub2mu0hbinv = mub2mu0 / hbar; // in rad.THz
} }
@ -178,7 +178,7 @@ void PairSpinDipoleCut::compute(int eflag, int vflag)
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;
double **fm = atom->fm; double **fm = atom->fm;
double **sp = atom->sp; double **sp = atom->sp;
inum = list->inum; inum = list->inum;
ilist = list->ilist; ilist = list->ilist;
@ -228,36 +228,36 @@ void PairSpinDipoleCut::compute(int eflag, int vflag)
if (rsq < local_cut2) { if (rsq < local_cut2) {
r2inv = 1.0/rsq; r2inv = 1.0/rsq;
r3inv = r2inv*rinv; r3inv = r2inv*rinv;
compute_dipolar(i,j,eij,fmi,spi,spj,r3inv); compute_dipolar(i,j,eij,fmi,spi,spj,r3inv);
if (lattice_flag) compute_dipolar_mech(i,j,eij,fi,spi,spj,r2inv); if (lattice_flag) compute_dipolar_mech(i,j,eij,fi,spi,spj,r2inv);
} }
// force accumulation // force accumulation
f[i][0] += fi[0]; f[i][0] += fi[0];
f[i][1] += fi[1]; f[i][1] += fi[1];
f[i][2] += fi[2]; f[i][2] += fi[2];
fm[i][0] += fmi[0]; fm[i][0] += fmi[0];
fm[i][1] += fmi[1]; fm[i][1] += fmi[1];
fm[i][2] += fmi[2]; fm[i][2] += fmi[2];
if (newton_pair || j < nlocal) { if (newton_pair || j < nlocal) {
f[j][0] -= fi[0]; f[j][0] -= fi[0];
f[j][1] -= fi[1]; f[j][1] -= fi[1];
f[j][2] -= fi[2]; f[j][2] -= fi[2];
} }
if (eflag) { if (eflag) {
if (rsq <= local_cut2) { if (rsq <= local_cut2) {
evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]); evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]);
evdwl *= hbar; evdwl *= hbar;
} }
} else evdwl = 0.0; } else evdwl = 0.0;
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair, if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
evdwl,ecoul,fi[0],fi[1],fi[2],rij[0],rij[1],rij[2]); evdwl,ecoul,fi[0],fi[1],fi[2],rij[0],rij[1],rij[2]);
} }
} }
@ -277,7 +277,7 @@ void PairSpinDipoleCut::compute_single_pair(int ii, double fmi[3])
int k,locflag; int k,locflag;
int *type = atom->type; int *type = atom->type;
double **x = atom->x; double **x = atom->x;
double **sp = atom->sp; double **sp = atom->sp;
numneigh = list->numneigh; numneigh = list->numneigh;
firstneigh = list->firstneigh; firstneigh = list->firstneigh;
@ -427,7 +427,7 @@ void PairSpinDipoleCut::write_restart(FILE *fp)
for (j = i; j <= atom->ntypes; j++) { for (j = i; j <= atom->ntypes; j++) {
fwrite(&setflag[i][j],sizeof(int),1,fp); fwrite(&setflag[i][j],sizeof(int),1,fp);
if (setflag[i][j]) { if (setflag[i][j]) {
fwrite(&cut_spin_long[i][j],sizeof(int),1,fp); fwrite(&cut_spin_long[i][j],sizeof(int),1,fp);
} }
} }
} }
@ -450,10 +450,10 @@ void PairSpinDipoleCut::read_restart(FILE *fp)
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error);
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
if (setflag[i][j]) { if (setflag[i][j]) {
if (me == 0) { if (me == 0) {
utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error); utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error);
} }
MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world); MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world);
} }
} }
} }

View File

@ -49,16 +49,16 @@ class PairSpinDipoleCut : public PairSpin {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double cut_spin_long_global; // global long cutoff distance double cut_spin_long_global; // global long cutoff distance
protected: protected:
double hbar; // reduced Planck's constant double hbar; // reduced Planck's constant
double mub; // Bohr's magneton double mub; // Bohr's magneton
double mu_0; // vacuum permeability double mu_0; // vacuum permeability
double mub2mu0; // prefactor for mech force double mub2mu0; // prefactor for mech force
double mub2mu0hbinv; // prefactor for mag force double mub2mu0hbinv; // prefactor for mag force
double **cut_spin_long; // cutoff distance long double **cut_spin_long; // cutoff distance long
double g_ewald; double g_ewald;
int ewald_order; int ewald_order;

View File

@ -50,16 +50,16 @@ class PairSpinDipoleLong : public PairSpin {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double cut_spin_long_global; // global long cutoff distance double cut_spin_long_global; // global long cutoff distance
protected: protected:
double hbar; // reduced Planck's constant double hbar; // reduced Planck's constant
double mub; // Bohr's magneton double mub; // Bohr's magneton
double mu_0; // vacuum permeability double mu_0; // vacuum permeability
double mub2mu0; // prefactor for mech force double mub2mu0; // prefactor for mech force
double mub2mu0hbinv; // prefactor for mag force double mub2mu0hbinv; // prefactor for mag force
double **cut_spin_long; // cutoff distance long double **cut_spin_long; // cutoff distance long
double g_ewald; double g_ewald;
int ewald_order; int ewald_order;

View File

@ -44,13 +44,13 @@ class PairSpinDmi : public PairSpin {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double cut_spin_dmi_global; // short range pair cutoff double cut_spin_dmi_global; // short range pair cutoff
protected: protected:
double **DM; // dmi coeff in eV double **DM; // dmi coeff in eV
double **v_dmx, **v_dmy, **v_dmz; // dmi direction double **v_dmx, **v_dmy, **v_dmz; // dmi direction
double **vmech_dmx, **vmech_dmy, **vmech_dmz; // dmi mech direction double **vmech_dmx, **vmech_dmy, **vmech_dmz; // dmi mech direction
double **cut_spin_dmi; // cutoff distance dmi double **cut_spin_dmi; // cutoff distance dmi
void allocate(); void allocate();
}; };

View File

@ -44,13 +44,13 @@ class PairSpinExchange : public PairSpin {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double cut_spin_exchange_global; // global exchange cutoff distance double cut_spin_exchange_global; // global exchange cutoff distance
protected: protected:
double **J1_mag; // exchange coeffs in eV double **J1_mag; // exchange coeffs in eV
double **J1_mech; // mech exchange coeffs in double **J1_mech; // mech exchange coeffs in
double **J2, **J3; // J1 in eV, J2 adim, J3 in Ang double **J2, **J3; // J1 in eV, J2 adim, J3 in Ang
double **cut_spin_exchange; // cutoff distance exchange double **cut_spin_exchange; // cutoff distance exchange
void allocate(); void allocate();
}; };

View File

@ -44,12 +44,12 @@ class PairSpinMagelec : public PairSpin {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double cut_spin_magelec_global; // global me cutoff double cut_spin_magelec_global; // global me cutoff
protected: protected:
double **ME, **ME_mech; // magelec coeff in eV double **ME, **ME_mech; // magelec coeff in eV
double **v_mex, **v_mey, **v_mez; // magelec direction double **v_mex, **v_mey, **v_mez; // magelec direction
double **cut_spin_magelec; // magelec cutoff distance double **cut_spin_magelec; // magelec cutoff distance
void allocate(); void allocate();
}; };

View File

@ -44,17 +44,17 @@ class PairSpinNeel : public PairSpin {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double cut_spin_neel_global; // global neel cutoff distance double cut_spin_neel_global; // global neel cutoff distance
protected: protected:
// pseudo-dipolar and pseudo-quadrupolar coeff. // pseudo-dipolar and pseudo-quadrupolar coeff.
double **g1, **g1_mech; // neel coeffs gij double **g1, **g1_mech; // neel coeffs gij
double **g2, **g3; // g1 in eV, g2 adim, g3 in Ang double **g2, **g3; // g1 in eV, g2 adim, g3 in Ang
double **q1, **q1_mech; // neel coeffs qij double **q1, **q1_mech; // neel coeffs qij
double **q2, **q3; // q1 in eV, q2 adim, q3 in Ang double **q2, **q3; // q1 in eV, q2 adim, q3 in Ang
double **cut_spin_neel; // cutoff distance exchange double **cut_spin_neel; // cutoff distance exchange
void allocate(); void allocate();
}; };

View File

@ -457,7 +457,7 @@ double ComputeHMA::virial_compute(int n)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int ComputeHMA::pack_forward_comm(int n, int *list, double *buf, int ComputeHMA::pack_forward_comm(int n, int *list, double *buf,
int /* pbc_flag */, int * /* pbc */) int /* pbc_flag */, int * /* pbc */)
{ {
int m = 0; int m = 0;
for (int ii = 0; ii < n; ii++) { for (int ii = 0; ii < n; ii++) {

View File

@ -259,12 +259,12 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
"probability seed must be positive"); "probability seed must be positive");
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"max_rxn") == 0) { } else if (strcmp(arg[iarg],"max_rxn") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: "
"'max_rxn' has too few arguments"); "'max_rxn' has too few arguments");
max_rxn[rxn] = force->inumeric(FLERR,arg[iarg+1]); max_rxn[rxn] = force->inumeric(FLERR,arg[iarg+1]);
if (max_rxn[rxn] < 0) error->all(FLERR,"Illegal fix bond/react command: " if (max_rxn[rxn] < 0) error->all(FLERR,"Illegal fix bond/react command: "
"'max_rxn' cannot be negative"); "'max_rxn' cannot be negative");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"stabilize_steps") == 0) { } else if (strcmp(arg[iarg],"stabilize_steps") == 0) {
if (stabilization_flag == 0) error->all(FLERR,"Stabilize_steps keyword " if (stabilization_flag == 0) error->all(FLERR,"Stabilize_steps keyword "
"used without stabilization keyword"); "used without stabilization keyword");

View File

@ -523,7 +523,7 @@ void PairILPGrapheneHBN::calc_FvdW(int eflag, int /* vflag */)
// derivatives // derivatives
fpair = -6.0*p.C6*r8inv/TSvdw + p.C6*p.d/p.seff*(TSvdw-1.0)*TSvdw2inv*r8inv*r; fpair = -6.0*p.C6*r8inv/TSvdw + p.C6*p.d/p.seff*(TSvdw-1.0)*TSvdw2inv*r8inv*r;
fsum = fpair*Tap - Vilp*dTap/r; fsum = fpair*Tap - Vilp*dTap/r;
f[i][0] += fsum*delx; f[i][0] += fsum*delx;
f[i][1] += fsum*dely; f[i][1] += fsum*dely;
@ -634,12 +634,12 @@ void PairILPGrapheneHBN::calc_FRep(int eflag, int /* vflag */)
dprodnorm1[0] = dnormdri[0][0][i]*delx + dnormdri[1][0][i]*dely + dnormdri[2][0][i]*delz; dprodnorm1[0] = dnormdri[0][0][i]*delx + dnormdri[1][0][i]*dely + dnormdri[2][0][i]*delz;
dprodnorm1[1] = dnormdri[0][1][i]*delx + dnormdri[1][1][i]*dely + dnormdri[2][1][i]*delz; dprodnorm1[1] = dnormdri[0][1][i]*delx + dnormdri[1][1][i]*dely + dnormdri[2][1][i]*delz;
dprodnorm1[2] = dnormdri[0][2][i]*delx + dnormdri[1][2][i]*dely + dnormdri[2][2][i]*delz; dprodnorm1[2] = dnormdri[0][2][i]*delx + dnormdri[1][2][i]*dely + dnormdri[2][2][i]*delz;
fp1[0] = prodnorm1*normal[i][0]*fpair1; fp1[0] = prodnorm1*normal[i][0]*fpair1;
fp1[1] = prodnorm1*normal[i][1]*fpair1; fp1[1] = prodnorm1*normal[i][1]*fpair1;
fp1[2] = prodnorm1*normal[i][2]*fpair1; fp1[2] = prodnorm1*normal[i][2]*fpair1;
fprod1[0] = prodnorm1*dprodnorm1[0]*fpair1; fprod1[0] = prodnorm1*dprodnorm1[0]*fpair1;
fprod1[1] = prodnorm1*dprodnorm1[1]*fpair1; fprod1[1] = prodnorm1*dprodnorm1[1]*fpair1;
fprod1[2] = prodnorm1*dprodnorm1[2]*fpair1; fprod1[2] = prodnorm1*dprodnorm1[2]*fpair1;
fkcx = (delx*fsum - fp1[0])*Tap - Vilp*dTap*delx/r; fkcx = (delx*fsum - fp1[0])*Tap - Vilp*dTap*delx/r;
fkcy = (dely*fsum - fp1[1])*Tap - Vilp*dTap*dely/r; fkcy = (dely*fsum - fp1[1])*Tap - Vilp*dTap*dely/r;

View File

@ -519,11 +519,11 @@ void PairKolmogorovCrespiFull::calc_FvdW(int eflag, int /* vflag */)
dTap = calc_dTap(r,Rcut); dTap = calc_dTap(r,Rcut);
} else {Tap = 1.0; dTap = 0.0;} } else {Tap = 1.0; dTap = 0.0;}
Vkc = -p.A*p.z06*r6inv; Vkc = -p.A*p.z06*r6inv;
// derivatives // derivatives
fpair = -6.0*p.A*p.z06*r8inv; fpair = -6.0*p.A*p.z06*r8inv;
fsum = fpair*Tap - Vkc*dTap/r; fsum = fpair*Tap - Vkc*dTap/r;
f[i][0] += fsum*delx; f[i][0] += fsum*delx;
f[i][1] += fsum*dely; f[i][1] += fsum*dely;
@ -607,11 +607,11 @@ void PairKolmogorovCrespiFull::calc_FRep(int eflag, int /* vflag */)
r = sqrt(rsq); r = sqrt(rsq);
// turn on/off taper function // turn on/off taper function
if (tap_flag) { if (tap_flag) {
Tap = calc_Tap(r,sqrt(cutsq[itype][jtype])); Tap = calc_Tap(r,sqrt(cutsq[itype][jtype]));
dTap = calc_dTap(r,sqrt(cutsq[itype][jtype])); dTap = calc_dTap(r,sqrt(cutsq[itype][jtype]));
} else {Tap = 1.0; dTap = 0.0;} } else {Tap = 1.0; dTap = 0.0;}
// Calculate the transverse distance // Calculate the transverse distance
prodnorm1 = normal[i][0]*delx + normal[i][1]*dely + normal[i][2]*delz; prodnorm1 = normal[i][0]*delx + normal[i][1]*dely + normal[i][2]*delz;
@ -626,7 +626,7 @@ void PairKolmogorovCrespiFull::calc_FRep(int eflag, int /* vflag */)
sumC11 = (p.C2 + 2.0*p.C4*rho_ij)*p.delta2inv; sumC11 = (p.C2 + 2.0*p.C4*rho_ij)*p.delta2inv;
frho_ij = exp1*sumC1; frho_ij = exp1*sumC1;
sumCff = 0.5*p.C + frho_ij; sumCff = 0.5*p.C + frho_ij;
Vkc = exp0*sumCff; Vkc = exp0*sumCff;
// derivatives // derivatives
fpair = p.lambda*exp0/r*sumCff; fpair = p.lambda*exp0/r*sumCff;
@ -653,10 +653,10 @@ void PairKolmogorovCrespiFull::calc_FRep(int eflag, int /* vflag */)
f[j][1] -= fkcy; f[j][1] -= fkcy;
f[j][2] -= fkcz; f[j][2] -= fkcz;
// calculate the forces acted on the neighbors of atom i from atom j // calculate the forces acted on the neighbors of atom i from atom j
KC_neighs_i = KC_firstneigh[i]; KC_neighs_i = KC_firstneigh[i];
for (kk = 0; kk < KC_numneigh[i]; kk++) { for (kk = 0; kk < KC_numneigh[i]; kk++) {
k = KC_neighs_i[kk]; k = KC_neighs_i[kk];
if (k == i) continue; if (k == i) continue;
// derivatives of the product of rij and ni respect to rk, k=0,1,2, where atom k is the neighbors of atom i // derivatives of the product of rij and ni respect to rk, k=0,1,2, where atom k is the neighbors of atom i
dprodnorm1[0] = dnormal[0][0][kk][i]*delx + dnormal[1][0][kk][i]*dely + dnormal[2][0][kk][i]*delz; dprodnorm1[0] = dnormal[0][0][kk][i]*delx + dnormal[1][0][kk][i]*dely + dnormal[2][0][kk][i]*delz;
@ -672,7 +672,7 @@ void PairKolmogorovCrespiFull::calc_FRep(int eflag, int /* vflag */)
delkj[1] = x[k][1] - x[j][1]; delkj[1] = x[k][1] - x[j][1];
delkj[2] = x[k][2] - x[j][2]; delkj[2] = x[k][2] - x[j][2];
if (evflag) ev_tally_xyz(k,j,nlocal,newton_pair,0.0,0.0,fk[0],fk[1],fk[2],delkj[0],delkj[1],delkj[2]); if (evflag) ev_tally_xyz(k,j,nlocal,newton_pair,0.0,0.0,fk[0],fk[1],fk[2],delkj[0],delkj[1],delkj[2]);
} }
if (eflag) { if (eflag) {
if (tap_flag) pvector[1] += evdwl = Tap*Vkc; if (tap_flag) pvector[1] += evdwl = Tap*Vkc;
@ -790,7 +790,7 @@ void PairKolmogorovCrespiFull::calc_normal()
memory->create(dnormal,3,3,3,nmax,"KolmogorovCrespiFull:dnormal"); memory->create(dnormal,3,3,3,nmax,"KolmogorovCrespiFull:dnormal");
} }
inum = list->inum; inum = list->inum;
ilist = list->ilist; ilist = list->ilist;
//Calculate normals //Calculate normals
for (ii = 0; ii < inum; ii++) { for (ii = 0; ii < inum; ii++) {

View File

@ -786,9 +786,9 @@ double PairLJExpandCoulLong::init_one(int i, int j)
(1.0/3.0 + 2.0*shift1/(4.0*rc1) + shift2/(5.0*rc2))/rc3); (1.0/3.0 + 2.0*shift1/(4.0*rc1) + shift2/(5.0*rc2))/rc3);
ptail_ij = 16.0*MY_PI*all[0]*all[1]*epsilon[i][j] * sig6 * ptail_ij = 16.0*MY_PI*all[0]*all[1]*epsilon[i][j] * sig6 *
((1.0/9.0 + 3.0*shift1/(10.0*rc1) + ((1.0/9.0 + 3.0*shift1/(10.0*rc1) +
3.0*shift2/(11.0*rc2) + shift3/(12.0*rc3))*2.0*sig6/rc9 - 3.0*shift2/(11.0*rc2) + shift3/(12.0*rc3))*2.0*sig6/rc9 -
(1.0/3.0 + 3.0*shift1/(4.0*rc1) + (1.0/3.0 + 3.0*shift1/(4.0*rc1) +
3.0*shift2/(5.0*rc2) + shift3/(6.0*rc3))/rc3); 3.0*shift2/(5.0*rc2) + shift3/(6.0*rc3))/rc3);
} }
return cut; return cut;

View File

@ -61,7 +61,7 @@ static const char cite_pair_local_density[] =
PairLocalDensity::PairLocalDensity(LAMMPS *lmp) : Pair(lmp) PairLocalDensity::PairLocalDensity(LAMMPS *lmp) : Pair(lmp)
{ {
restartinfo = 0; restartinfo = 0;
one_coeff = 1; one_coeff = 1;
single_enable = 1; single_enable = 1;
// stuff read from tabulated file // stuff read from tabulated file
@ -117,7 +117,7 @@ PairLocalDensity::~PairLocalDensity()
memory->destroy(rho_min); memory->destroy(rho_min);
memory->destroy(rho_max); memory->destroy(rho_max);
memory->destroy(delta_rho); memory->destroy(delta_rho);
memory->destroy(c0); memory->destroy(c0);
memory->destroy(c2); memory->destroy(c2);
memory->destroy(c4); memory->destroy(c4);
@ -144,7 +144,7 @@ void PairLocalDensity::compute(int eflag, int vflag)
double p, *coeff; double p, *coeff;
int *ilist,*jlist,*numneigh,**firstneigh; int *ilist,*jlist,*numneigh,**firstneigh;
phi = uLD = evdwl = fpair = rsqinv = 0.0; phi = uLD = evdwl = fpair = rsqinv = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag); if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; else evflag = vflag_fdotr = eflag_global = eflag_atom = 0;
@ -180,11 +180,11 @@ void PairLocalDensity::compute(int eflag, int vflag)
if (newton_pair) { if (newton_pair) {
m = nlocal + atom->nghost; m = nlocal + atom->nghost;
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
for (i = 0; i < m; i++) { for (i = 0; i < m; i++) {
localrho[k][i] = 0.0; localrho[k][i] = 0.0;
fp[k][i] = 0.0; fp[k][i] = 0.0;
} }
} }
} }
else { else {
for (k = 0; k < nLD; k++){ for (k = 0; k < nLD; k++){
@ -209,14 +209,14 @@ void PairLocalDensity::compute(int eflag, int vflag)
for (jj = 0; jj < jnum; jj++) { for (jj = 0; jj < jnum; jj++) {
j = jlist[jj]; j = jlist[jj];
j &= NEIGHMASK; j &= NEIGHMASK;
jtype = type[j]; jtype = type[j];
// calculate distance-squared between i,j atom-types // calculate distance-squared between i,j atom-types
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];
delz = ztmp - x[j][2]; delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
// calculating LDs based on central and neigh filters // calculating LDs based on central and neigh filters
@ -239,7 +239,7 @@ void PairLocalDensity::compute(int eflag, int vflag)
localrho[k][j] += (phi * b[k][itype]); localrho[k][j] += (phi * b[k][itype]);
} }
} }
} }
} }
// communicate and sum LDs over all procs // communicate and sum LDs over all procs
@ -247,10 +247,10 @@ void PairLocalDensity::compute(int eflag, int vflag)
// //
for (ii = 0; ii < inum; ii++) { for (ii = 0; ii < inum; ii++) {
i = ilist[ii]; i = ilist[ii];
itype = type[i]; itype = type[i];
uLD = 0.0; uLD = 0.0;
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
@ -284,7 +284,7 @@ void PairLocalDensity::compute(int eflag, int vflag)
if (eflag) { if (eflag) {
if (eflag_global) eng_vdwl += uLD; if (eflag_global) eng_vdwl += uLD;
if (eflag_atom) eatom[i] += uLD; if (eflag_atom) eatom[i] += uLD;
} }
} }
@ -306,7 +306,7 @@ void PairLocalDensity::compute(int eflag, int vflag)
jnum = numneigh[i]; jnum = numneigh[i];
for (jj = 0; jj < jnum; jj++) { for (jj = 0; jj < jnum; jj++) {
j = jlist[jj]; j = jlist[jj];
j &= NEIGHMASK; j &= NEIGHMASK;
jtype = type[j]; jtype = type[j];
@ -326,7 +326,7 @@ void PairLocalDensity::compute(int eflag, int vflag)
dphi = rsq * (2.0*c2[k] + rsq * (4.0*c4[k] + 6.0*c6[k]*rsq)); dphi = rsq * (2.0*c2[k] + rsq * (4.0*c4[k] + 6.0*c6[k]*rsq));
fpair += -(a[k][itype]*b[k][jtype]*fp[k][i] + a[k][jtype]*b[k][itype]*fp[k][j]) * dphi; fpair += -(a[k][itype]*b[k][jtype]*fp[k][i] + a[k][jtype]*b[k][itype]*fp[k][j]) * dphi;
} }
} }
fpair *= rsqinv; fpair *= rsqinv;
f[i][0] += delx*fpair; f[i][0] += delx*fpair;
@ -459,8 +459,8 @@ double PairLocalDensity::init_one(int /* i */, int /* j */)
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
double PairLocalDensity::single(int /* i */, int /* j */, int itype, int jtype, double PairLocalDensity::single(int /* i */, int /* j */, int itype, int jtype,
double rsq, double /* factor_coul */, double rsq, double /* factor_coul */,
double /* factor_lj */, double &fforce) double /* factor_lj */, double &fforce)
{ {
int m, k, index; int m, k, index;
double rsqinv, p, uLD; double rsqinv, p, uLD;
@ -473,7 +473,7 @@ double PairLocalDensity::single(int /* i */, int /* j */, int itype, int jtype,
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
LD[k][1] = 0.0; // itype:- 1 LD[k][1] = 0.0; // itype:- 1
LD[k][2] = 0.0; // jtype:- 2 LD[k][2] = 0.0; // jtype:- 2
} }
rsqinv = 1.0/rsq; rsqinv = 1.0/rsq;
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
@ -556,24 +556,24 @@ void PairLocalDensity::interpolate_cbspl(int n, double delta,
{ {
/* inputs: /* inputs:
n number of interpolating points n number of interpolating points
f array containing function values to f array containing function values to
be interpolated; f[i] is the function be interpolated; f[i] is the function
value corresponding to x[i] value corresponding to x[i]
('x' refers to the independent var) ('x' refers to the independent var)
delta difference in tabulated values of x delta difference in tabulated values of x
outputs: (packaged as columns of the coeff matrix) outputs: (packaged as columns of the coeff matrix)
coeff_b coeffs of linear terms coeff_b coeffs of linear terms
coeff_c coeffs of quadratic terms coeff_c coeffs of quadratic terms
coeff_d coeffs of cubic terms coeff_d coeffs of cubic terms
spline matrix that collects b,c,d spline matrix that collects b,c,d
other parameters: other parameters:
fpa derivative of function at x=a fpa derivative of function at x=a
fpb derivative of function at x=b fpb derivative of function at x=b
*/ */
double *dl, *dd, *du; double *dl, *dd, *du;
@ -684,12 +684,12 @@ void PairLocalDensity::parse_file(char *filename) {
// broadcast number of LD potentials and number of (rho,frho) pairs // broadcast number of LD potentials and number of (rho,frho) pairs
if (me == 0) { if (me == 0) {
// first 2 comment lines ignored // first 2 comment lines ignored
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error); utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error); utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
// extract number of potentials and number of (frho, rho) points // extract number of potentials and number of (frho, rho) points
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error); utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
sscanf(line, "%d %d", &nLD, &nrho); sscanf(line, "%d %d", &nLD, &nrho);
utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error); utils::sfgets(FLERR,line,MAXLINE,fptr,filename,error);
} }
@ -711,9 +711,9 @@ void PairLocalDensity::parse_file(char *filename) {
memory->create(delta_rho, nLD,"pairLD:delta_rho"); memory->create(delta_rho, nLD,"pairLD:delta_rho");
memory->create(ftmp, nrho*nLD, "pairLD:ftmp"); memory->create(ftmp, nrho*nLD, "pairLD:ftmp");
// setting up central and neighbor atom filters // setting up central and neighbor atom filters
memory->create(a, nLD, atom->ntypes+1 , "pairLD:a"); memory->create(a, nLD, atom->ntypes+1 , "pairLD:a");
memory->create(b, nLD, atom->ntypes+1, "pairLD:b"); memory->create(b, nLD, atom->ntypes+1, "pairLD:b");
if (me == 0) { if (me == 0) {
for (n = 1; n <= atom->ntypes; n++){ for (n = 1; n <= atom->ntypes; n++){
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
@ -721,14 +721,14 @@ void PairLocalDensity::parse_file(char *filename) {
b[k][n] = 0; b[k][n] = 0;
} }
} }
} }
// read file block by block // read file block by block
if (me == 0) { if (me == 0) {
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
// parse upper and lower cut values // parse upper and lower cut values
if (fgets(line,MAXLINE,fptr)==NULL) break; if (fgets(line,MAXLINE,fptr)==NULL) break;
sscanf(line, "%lf %lf", &lowercut[k], &uppercut[k]); sscanf(line, "%lf %lf", &lowercut[k], &uppercut[k]);
@ -743,7 +743,7 @@ void PairLocalDensity::parse_file(char *filename) {
// parse neighbor atom filter // parse neighbor atom filter
utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error); utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error);
tmp = strtok(line, " /t/n/r/f"); tmp = strtok(line, " /t/n/r/f");
while (tmp != NULL) { while (tmp != NULL) {
b[k][atoi(tmp)] = 1; b[k][atoi(tmp)] = 1;
tmp = strtok(NULL, " /t/n/r/f"); tmp = strtok(NULL, " /t/n/r/f");
} }
@ -778,7 +778,7 @@ void PairLocalDensity::parse_file(char *filename) {
} }
} }
// Broadcast all parsed arrays // Broadcast all parsed arrays
MPI_Bcast(&lowercut[0], nLD, MPI_DOUBLE, 0, world); MPI_Bcast(&lowercut[0], nLD, MPI_DOUBLE, 0, world);
MPI_Bcast(&uppercut[0], nLD, MPI_DOUBLE, 0, world); MPI_Bcast(&uppercut[0], nLD, MPI_DOUBLE, 0, world);
MPI_Bcast(&lowercutsq[0], nLD, MPI_DOUBLE, 0, world); MPI_Bcast(&lowercutsq[0], nLD, MPI_DOUBLE, 0, world);
@ -818,16 +818,16 @@ void PairLocalDensity::parse_file(char *filename) {
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
int PairLocalDensity::pack_comm(int n, int *list, double *buf, int PairLocalDensity::pack_comm(int n, int *list, double *buf,
int /* pbc_flag */, int * /* pbc */) { int /* pbc_flag */, int * /* pbc */) {
int i,j,k; int i,j,k;
int m; int m;
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
buf[m++] = fp[k][j]; buf[m++] = fp[k][j];
} }
} }
return nLD; return nLD;
@ -845,7 +845,7 @@ void PairLocalDensity::unpack_comm(int n, int first, double *buf) {
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
fp[k][i] = buf[m++]; fp[k][i] = buf[m++];
} }
} }
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -876,7 +876,7 @@ void PairLocalDensity::unpack_reverse_comm(int n, int *list, double *buf) {
j = list[i]; j = list[i];
for (k = 0; k < nLD; k++) { for (k = 0; k < nLD; k++) {
localrho[k][j] += buf[m++]; localrho[k][j] += buf[m++];
} }
} }
} }

View File

@ -72,13 +72,13 @@ class PairLocalDensity : public Pair {
void allocate(); void allocate();
// read tabulated input file // read tabulated input file
void parse_file(char *); void parse_file(char *);
// convert array to spline // convert array to spline
void array2spline(); void array2spline();
// cubic spline interpolation // cubic spline interpolation
void interpolate_cbspl(int, double, double *, double **); void interpolate_cbspl(int, double, double *, double **);
}; };

View File

@ -46,8 +46,8 @@ extern int Init_Workspace(reax_system*, control_params*, storage*, char*);
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int Init_ListsOMP(reax_system *system, control_params *control, int Init_ListsOMP(reax_system *system, control_params *control,
simulation_data * /* data */, storage * /* workspace */, simulation_data * /* data */, storage * /* workspace */,
reax_list **lists, mpi_datatypes * /* mpi_data */, char * /* msg */) reax_list **lists, mpi_datatypes * /* mpi_data */, char * /* msg */)
{ {
int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop; int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop;
int *hb_top, *bond_top; int *hb_top, *bond_top;

View File

@ -154,7 +154,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax,
/* Sanity checks */ /* Sanity checks */
if (c == 2 && !lgflag) if (c == 2 && !lgflag)
control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'");
if (c < 9) { if (c < 9) {
snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s);

View File

@ -204,17 +204,17 @@ void Force::init()
if (!bond && (atom->nbonds > 0)) { if (!bond && (atom->nbonds > 0)) {
error->warning(FLERR,"Bonds are defined but no bond style is set"); error->warning(FLERR,"Bonds are defined but no bond style is set");
if ((special_lj[1] != 1.0) || (special_coul[1] != 1.0)) if ((special_lj[1] != 1.0) || (special_coul[1] != 1.0))
error->warning(FLERR,"Likewise 1-2 special neighbor interactions != 1.0"); error->warning(FLERR,"Likewise 1-2 special neighbor interactions != 1.0");
} }
if (!angle && (atom->nangles > 0)) { if (!angle && (atom->nangles > 0)) {
error->warning(FLERR,"Angles are defined but no angle style is set"); error->warning(FLERR,"Angles are defined but no angle style is set");
if ((special_lj[2] != 1.0) || (special_coul[2] != 1.0)) if ((special_lj[2] != 1.0) || (special_coul[2] != 1.0))
error->warning(FLERR,"Likewise 1-3 special neighbor interactions != 1.0"); error->warning(FLERR,"Likewise 1-3 special neighbor interactions != 1.0");
} }
if (!dihedral && (atom->ndihedrals > 0)) { if (!dihedral && (atom->ndihedrals > 0)) {
error->warning(FLERR,"Dihedrals are defined but no dihedral style is set"); error->warning(FLERR,"Dihedrals are defined but no dihedral style is set");
if ((special_lj[3] != 1.0) || (special_coul[3] != 1.0)) if ((special_lj[3] != 1.0) || (special_coul[3] != 1.0))
error->warning(FLERR,"Likewise 1-4 special neighbor interactions != 1.0"); error->warning(FLERR,"Likewise 1-4 special neighbor interactions != 1.0");
} }
if (!improper && (atom->nimpropers > 0)) if (!improper && (atom->nimpropers > 0))
error->warning(FLERR,"Impropers are defined but no improper style is set"); error->warning(FLERR,"Impropers are defined but no improper style is set");

View File

@ -64,11 +64,11 @@ class Min : protected Pointers {
int virial_style; // compute virial explicitly or implicitly int virial_style; // compute virial explicitly or implicitly
int external_force_clear; // clear forces locally or externally int external_force_clear; // clear forces locally or externally
double dmax; // max dist to move any atom in one step double dmax; // max dist to move any atom in one step
int linestyle; // 0 = backtrack, 1 = quadratic, 2 = forcezero int linestyle; // 0 = backtrack, 1 = quadratic, 2 = forcezero
// 3 = spin_cubic, 4 = spin_none // 3 = spin_cubic, 4 = spin_none
int normstyle; // TWO, MAX or INF flag for force norm evaluation int normstyle; // TWO, MAX or INF flag for force norm evaluation
int nelist_global,nelist_atom; // # of PE,virial computes to check int nelist_global,nelist_atom; // # of PE,virial computes to check
int nvlist_global,nvlist_atom; int nvlist_global,nvlist_atom;

View File

@ -100,7 +100,7 @@ int MinCG::iterate(int maxiter)
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
dot[0] += fatom[i]*fatom[i]; dot[0] += fatom[i]*fatom[i];
dot[1] += fatom[i]*gatom[i]; dot[1] += fatom[i]*gatom[i];
fmax = MAX(fmax,fatom[i]*fatom[i]); fmax = MAX(fmax,fatom[i]*fatom[i]);
} }
} }
MPI_Allreduce(dot,dotall,2,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(dot,dotall,2,MPI_DOUBLE,MPI_SUM,world);
@ -111,13 +111,13 @@ int MinCG::iterate(int maxiter)
} }
fmax = 0.0; fmax = 0.0;
if (normstyle == MAX) { // max force norm if (normstyle == MAX) { // max force norm
fmax = fnorm_max(); fmax = fnorm_max();
if (fmax < update->ftol*update->ftol) return FTOL; if (fmax < update->ftol*update->ftol) return FTOL;
} else if (normstyle == INF) { // infinite force norm } else if (normstyle == INF) { // infinite force norm
fmax = fnorm_inf(); fmax = fnorm_inf();
if (fmax < update->ftol*update->ftol) return FTOL; if (fmax < update->ftol*update->ftol) return FTOL;
} else if (normstyle == TWO) { // Euclidean force 2-norm } else if (normstyle == TWO) { // Euclidean force 2-norm
if (dotall[0] < update->ftol*update->ftol) return FTOL; if (dotall[0] < update->ftol*update->ftol) return FTOL;
} else error->all(FLERR,"Illegal min_modify command"); } else error->all(FLERR,"Illegal min_modify command");

View File

@ -251,9 +251,9 @@ int MinFire::iterate(int maxiter)
// sync across replicas if running multi-replica minimization // sync across replicas if running multi-replica minimization
if (update->ftol > 0.0) { if (update->ftol > 0.0) {
if (normstyle == MAX) fdotf = fnorm_max(); // max force norm if (normstyle == MAX) fdotf = fnorm_max(); // max force norm
else if (normstyle == INF) fdotf = fnorm_inf(); // inf force norm else if (normstyle == INF) fdotf = fnorm_inf(); // inf force norm
else if (normstyle == TWO) fdotf = fnorm_sqr(); // Euclidean force 2-norm else if (normstyle == TWO) fdotf = fnorm_sqr(); // Euclidean force 2-norm
else error->all(FLERR,"Illegal min_modify command"); else error->all(FLERR,"Illegal min_modify command");
if (update->multireplica == 0) { if (update->multireplica == 0) {
if (fdotf < update->ftol*update->ftol) return FTOL; if (fdotf < update->ftol*update->ftol) return FTOL;

View File

@ -78,9 +78,9 @@ int MinSD::iterate(int maxiter)
// force tolerance criterion // force tolerance criterion
if (normstyle == MAX) fdotf = fnorm_max(); // max force norm if (normstyle == MAX) fdotf = fnorm_max(); // max force norm
else if (normstyle == INF) fdotf = fnorm_inf(); // infinite force norm else if (normstyle == INF) fdotf = fnorm_inf(); // infinite force norm
else if (normstyle == TWO) fdotf = fnorm_sqr(); // Euclidean force 2-norm else if (normstyle == TWO) fdotf = fnorm_sqr(); // Euclidean force 2-norm
else error->all(FLERR,"Illegal min_modify command"); else error->all(FLERR,"Illegal min_modify command");
if (fdotf < update->ftol*update->ftol) return FTOL; if (fdotf < update->ftol*update->ftol) return FTOL;