whitespace cleanup and dead code removal

This commit is contained in:
Axel Kohlmeyer 2019-03-25 20:47:17 -04:00
parent 36b645d238
commit 7b3f952990
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
9 changed files with 150 additions and 155 deletions

View File

@ -84,7 +84,7 @@ void ComputeSpin::compute_vector()
invoked_vector = update->ntimestep;
countsp = countsptot = 0.0;
countsp = countsptot = 0.0;
mag[0] = mag[1] = mag[2] = mag[3] = 0.0;
magtot[0] = magtot[1] = magtot[2] = magtot[3] = 0.0;
magenergy = magenergytot = 0.0;
@ -96,7 +96,7 @@ void ComputeSpin::compute_vector()
double **sp = atom->sp;
double **fm = atom->fm;
double tx,ty,tz;
int nlocal = atom->nlocal;
// compute total magnetization and magnetic energy
@ -105,16 +105,16 @@ void ComputeSpin::compute_vector()
for (i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
if (atom->sp_flag) {
mag[0] += sp[i][0];
mag[1] += sp[i][1];
mag[2] += sp[i][2];
magenergy -= (sp[i][0]*fm[i][0] + sp[i][1]*fm[i][1] + sp[i][2]*fm[i][2]);
mag[0] += sp[i][0];
mag[1] += sp[i][1];
mag[2] += sp[i][2];
magenergy -= (sp[i][0]*fm[i][0] + sp[i][1]*fm[i][1] + sp[i][2]*fm[i][2]);
tx = sp[i][1]*fm[i][2]-sp[i][2]*fm[i][1];
ty = sp[i][2]*fm[i][0]-sp[i][0]*fm[i][2];
tz = sp[i][0]*fm[i][1]-sp[i][1]*fm[i][0];
tempnum += tx*tx+ty*ty+tz*tz;
tempdenom += sp[i][0]*fm[i][0]+fm[i][1]*sp[i][1]+sp[i][2]*fm[i][2];
countsp++;
tempdenom += sp[i][0]*fm[i][0]+fm[i][1]*sp[i][1]+sp[i][2]*fm[i][2];
countsp++;
}
}
else error->all(FLERR,"Compute compute/spin requires atom/spin style");

View File

@ -131,8 +131,8 @@ void FixLangevinSpin::init()
gil_factor = 1.0/(1.0+(alpha_t)*(alpha_t));
dts = update->dt;
double hbar = force->hplanck/MY_2PI; // eV/(rad.THz)
double kb = force->boltz; // eV/K
double hbar = force->hplanck/MY_2PI; // eV/(rad.THz)
double kb = force->boltz; // eV/K
D = (MY_2PI*alpha_t*gil_factor*kb*temp);
D /= (hbar*dts);
sigma = sqrt(2.0*D);
@ -158,7 +158,7 @@ void FixLangevinSpin::add_tdamping(double spi[3], double fmi[3])
double cpx = fmi[1]*spi[2] - fmi[2]*spi[1];
double cpy = fmi[2]*spi[0] - fmi[0]*spi[2];
double cpz = fmi[0]*spi[1] - fmi[1]*spi[0];
// adding the transverse damping
fmi[0] -= alpha_t*cpx;

View File

@ -183,7 +183,7 @@ void FixNVESpin::init()
npairs = pair->instance_total;
for (int i = 0; i<npairs; i++) {
if (force->pair_match("spin",0,i)) {
npairspin ++;
npairspin ++;
}
}
}
@ -203,8 +203,8 @@ void FixNVESpin::init()
} else if (npairspin > 1) {
for (int i = 0; i<npairs; i++) {
if (force->pair_match("spin",0,i)) {
spin_pairs[count] = (PairSpin *) force->pair_match("spin",0,i);
count++;
spin_pairs[count] = (PairSpin *) force->pair_match("spin",0,i);
count++;
}
}
}
@ -264,8 +264,8 @@ void FixNVESpin::init()
void FixNVESpin::initial_integrate(int /*vflag*/)
{
double dtfm;
double **x = atom->x;
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
double *rmass = atom->rmass;
@ -291,32 +291,32 @@ void FixNVESpin::initial_integrate(int /*vflag*/)
// update half s for all atoms
if (sector_flag) { // sectoring seq. update
for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal
if (sector_flag) { // sectoring seq. update
for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal
comm->forward_comm();
int i = stack_foot[j];
while (i >= 0) {
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
i = forward_stacks[i];
AdvanceSingleSpin(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
comm->forward_comm();
int i = stack_head[j];
while (i >= 0) {
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
i = backward_stacks[i];
AdvanceSingleSpin(i);
i = backward_stacks[i];
}
}
} else if (sector_flag == 0) { // serial seq. update
comm->forward_comm(); // comm. positions of ghost atoms
for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal
} else if (sector_flag == 0) { // serial seq. update
comm->forward_comm(); // comm. positions of ghost atoms
for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
}
for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal
for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
}
@ -336,32 +336,32 @@ void FixNVESpin::initial_integrate(int /*vflag*/)
// update half s for all particles
if (sector_flag) { // sectoring seq. update
for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal
if (sector_flag) { // sectoring seq. update
for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal
comm->forward_comm();
int i = stack_foot[j];
while (i >= 0) {
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
i = forward_stacks[i];
AdvanceSingleSpin(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
comm->forward_comm();
int i = stack_head[j];
while (i >= 0) {
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
i = backward_stacks[i];
AdvanceSingleSpin(i);
i = backward_stacks[i];
}
}
} else if (sector_flag == 0) { // serial seq. update
comm->forward_comm(); // comm. positions of ghost atoms
for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal-1
} else if (sector_flag == 0) { // serial seq. update
comm->forward_comm(); // comm. positions of ghost atoms
for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal-1
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
}
for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal-1
for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal-1
ComputeInteractionsSpin(i);
AdvanceSingleSpin(i);
}
@ -384,10 +384,10 @@ void FixNVESpin::setup_pre_neighbor()
void FixNVESpin::pre_neighbor()
{
double **x = atom->x;
double **x = atom->x;
int nlocal = atom->nlocal;
if (nlocal_max < nlocal) { // grow linked lists if necessary
if (nlocal_max < nlocal) { // grow linked lists if necessary
nlocal_max = nlocal;
backward_stacks = memory->grow(backward_stacks,nlocal_max,"NVE/spin:backward_stacks");
forward_stacks = memory->grow(forward_stacks,nlocal_max,"NVE/spin:forward_stacks");
@ -399,7 +399,7 @@ void FixNVESpin::pre_neighbor()
}
int nseci;
for (int j = 0; j < nsectors; j++) { // stacking backward order
for (int j = 0; j < nsectors; j++) { // stacking backward order
for (int i = 0; i < nlocal; i++) {
nseci = coords2sector(x[i]);
if (j != nseci) continue;
@ -407,7 +407,7 @@ void FixNVESpin::pre_neighbor()
stack_head[j] = i;
}
}
for (int j = nsectors-1; j >= 0; j--) { // stacking forward order
for (int j = nsectors-1; j >= 0; j--) { // stacking forward order
for (int i = nlocal-1; i >= 0; i--) {
nseci = coords2sector(x[i]);
if (j != nseci) continue;
@ -453,11 +453,11 @@ void FixNVESpin::ComputeInteractionsSpin(int i)
// update langevin damping and random force
if (maglangevin_flag) { // mag. langevin
if (tdamp_flag) { // transverse damping
if (maglangevin_flag) { // mag. langevin
if (tdamp_flag) { // transverse damping
locklangevinspin->add_tdamping(spi,fmi);
}
if (temp_flag) { // spin temperature
if (temp_flag) { // spin temperature
locklangevinspin->add_temperature(fmi);
}
}
@ -567,7 +567,7 @@ void FixNVESpin::AdvanceSingleSpin(int i)
g[0] = g[1] = g[2] = 0.0;
fm2 = (fm[i][0]*fm[i][0])+(fm[i][1]*fm[i][1])+(fm[i][2]*fm[i][2]);
energy = (sp[i][0]*fm[i][0])+(sp[i][1]*fm[i][1])+(sp[i][2]*fm[i][2]);
dts2 = dts*dts;
dts2 = dts*dts;
cp[0] = fm[i][1]*sp[i][2]-fm[i][2]*sp[i][1];
cp[1] = fm[i][2]*sp[i][0]-fm[i][0]*sp[i][2];
@ -576,18 +576,18 @@ void FixNVESpin::AdvanceSingleSpin(int i)
g[0] = sp[i][0]+cp[0]*dts;
g[1] = sp[i][1]+cp[1]*dts;
g[2] = sp[i][2]+cp[2]*dts;
g[0] += (fm[i][0]*energy-0.5*sp[i][0]*fm2)*0.5*dts2;
g[1] += (fm[i][1]*energy-0.5*sp[i][1]*fm2)*0.5*dts2;
g[2] += (fm[i][2]*energy-0.5*sp[i][2]*fm2)*0.5*dts2;
g[0] /= (1+0.25*fm2*dts2);
g[1] /= (1+0.25*fm2*dts2);
g[2] /= (1+0.25*fm2*dts2);
sp[i][0] = g[0];
sp[i][1] = g[1];
sp[i][2] = g[2];
sp[i][2] = g[2];
// renormalization (check if necessary)
@ -616,9 +616,9 @@ void FixNVESpin::AdvanceSingleSpin(int i)
/* ---------------------------------------------------------------------- */
void FixNVESpin::final_integrate()
{
{
double dtfm;
double **v = atom->v;
double **f = atom->f;
double *rmass = atom->rmass;

View File

@ -177,7 +177,7 @@ void FixPrecessionSpin::min_setup(int vflag)
/* ---------------------------------------------------------------------- */
void FixPrecessionSpin::post_force(int vflag)
void FixPrecessionSpin::post_force(int /* vflag */)
{
// update mag field with time (potential improvement)

View File

@ -19,6 +19,8 @@
#include <mpi.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "min_spin.h"
#include "universe.h"
#include "atom.h"
@ -27,8 +29,6 @@
#include "output.h"
#include "timer.h"
#include "error.h"
#include <cstdlib>
#include <cstring>
#include "modify.h"
#include "math_special.h"
#include "math_const.h"
@ -104,10 +104,10 @@ void MinSpin::reset_vectors()
// size sp is 4N vector
nvec = 4 * atom->nlocal;
if (nvec) spvec = atom->sp[0];
nvec = 3 * atom->nlocal;
if (nvec) fmvec = atom->fm[0];
if (nvec) xvec = atom->x[0];
if (nvec) fvec = atom->f[0];
}
@ -119,7 +119,7 @@ void MinSpin::reset_vectors()
int MinSpin::iterate(int maxiter)
{
bigint ntimestep;
double fmdotfm,fmdotfmall;
double fmdotfm;
int flag,flagall;
for (int iter = 0; iter < maxiter; iter++) {
@ -132,12 +132,12 @@ int MinSpin::iterate(int maxiter)
// optimize timestep accross processes / replicas
// need a force calculation for timestep optimization
energy_force(0);
dts = evaluate_dt();
// apply damped precessional dynamics to the spins
advance_spins(dts);
eprevious = ecurrent;
@ -200,11 +200,10 @@ double MinSpin::evaluate_dt()
double fmsq;
double fmaxsqone,fmaxsqloc,fmaxsqall;
int nlocal = atom->nlocal;
int *mask = atom->mask;
double **fm = atom->fm;
// finding max fm on this proc.
// finding max fm on this proc.
fmsq = fmaxsqone = fmaxsqloc = fmaxsqall = 0.0;
for (int i = 0; i < nlocal; i++) {
fmsq = fm[i][0]*fm[i][0]+fm[i][1]*fm[i][1]+fm[i][2]*fm[i][2];
@ -212,10 +211,10 @@ double MinSpin::evaluate_dt()
}
// finding max fm on this replica
fmaxsqloc = fmaxsqone;
MPI_Allreduce(&fmaxsqone,&fmaxsqloc,1,MPI_DOUBLE,MPI_MAX,world);
fmaxsqloc = fmaxsqone;
MPI_Allreduce(&fmaxsqone,&fmaxsqloc,1,MPI_DOUBLE,MPI_MAX,world);
// finding max fm over all replicas, if necessary
// this communicator would be invalid for multiprocess replicas
@ -228,7 +227,7 @@ double MinSpin::evaluate_dt()
if (fmaxsqall == 0.0)
error->all(FLERR,"Incorrect fmaxsqall calculation");
// define max timestep by dividing by the
// define max timestep by dividing by the
// inverse of max frequency by discrete_factor
dtmax = MY_2PI/(discrete_factor*sqrt(fmaxsqall));
@ -243,58 +242,57 @@ double MinSpin::evaluate_dt()
void MinSpin::advance_spins(double dts)
{
int nlocal = atom->nlocal;
int *mask = atom->mask;
double **sp = atom->sp;
double **fm = atom->fm;
double tdampx,tdampy,tdampz;
double msq,scale,fm2,energy,dts2;
double cp[3],g[3];
dts2 = dts*dts;
dts2 = dts*dts;
// loop on all spins on proc.
for (int i = 0; i < nlocal; i++) {
// calc. damping torque
tdampx = -alpha_damp*(fm[i][1]*sp[i][2] - fm[i][2]*sp[i][1]);
tdampy = -alpha_damp*(fm[i][2]*sp[i][0] - fm[i][0]*sp[i][2]);
tdampz = -alpha_damp*(fm[i][0]*sp[i][1] - fm[i][1]*sp[i][0]);
// apply advance algorithm (geometric, norm preserving)
fm2 = (tdampx*tdampx+tdampy*tdampy+tdampz*tdampz);
energy = (sp[i][0]*tdampx)+(sp[i][1]*tdampy)+(sp[i][2]*tdampz);
cp[0] = tdampy*sp[i][2]-tdampz*sp[i][1];
cp[1] = tdampz*sp[i][0]-tdampx*sp[i][2];
cp[2] = tdampx*sp[i][1]-tdampy*sp[i][0];
g[0] = sp[i][0]+cp[0]*dts;
g[1] = sp[i][1]+cp[1]*dts;
g[2] = sp[i][2]+cp[2]*dts;
g[0] += (tdampx*energy-0.5*sp[i][0]*fm2)*0.5*dts2;
g[1] += (tdampy*energy-0.5*sp[i][1]*fm2)*0.5*dts2;
g[2] += (tdampz*energy-0.5*sp[i][2]*fm2)*0.5*dts2;
g[0] /= (1+0.25*fm2*dts2);
g[1] /= (1+0.25*fm2*dts2);
g[2] /= (1+0.25*fm2*dts2);
sp[i][0] = g[0];
sp[i][1] = g[1];
sp[i][2] = g[2];
sp[i][2] = g[2];
// renormalization (check if necessary)
msq = g[0]*g[0] + g[1]*g[1] + g[2]*g[2];
scale = 1.0/sqrt(msq);
sp[i][0] *= scale;
sp[i][1] *= scale;
sp[i][2] *= scale;
// no comm. to atoms with same tag
// because no need for simplecticity
}
@ -306,16 +304,13 @@ void MinSpin::advance_spins(double dts)
double MinSpin::fmnorm_sqr()
{
int i,n;
double *fmatom;
int nlocal = atom->nlocal;
double tx,ty,tz;
double **sp = atom->sp;
double **fm = atom->fm;
// calc. magnetic torques
double local_norm2_sqr = 0.0;
for (int i = 0; i < nlocal; i++) {
tx = (fm[i][1]*sp[i][2] - fm[i][2]*sp[i][1]);
@ -324,11 +319,11 @@ double MinSpin::fmnorm_sqr()
local_norm2_sqr += tx*tx + ty*ty + tz*tz;
}
// no extra atom calc. for spins
// no extra atom calc. for spins
if (nextra_atom)
error->all(FLERR,"extra atom option not available yet");
error->all(FLERR,"extra atom option not available yet");
double norm2_sqr = 0.0;
MPI_Allreduce(&local_norm2_sqr,&norm2_sqr,1,MPI_DOUBLE,MPI_SUM,world);

View File

@ -238,7 +238,7 @@ void PairSpinDmi::compute(int eflag, int vflag)
double **x = atom->x;
double **f = atom->f;
double **fm = atom->fm;
double **sp = atom->sp;
double **sp = atom->sp;
int *type = atom->type;
int nlocal = atom->nlocal;
int newton_pair = force->newton_pair;
@ -295,32 +295,32 @@ void PairSpinDmi::compute(int eflag, int vflag)
// compute dmi interaction
if (rsq <= local_cut2) {
compute_dmi(i,j,eij,fmi,spj);
if (lattice_flag) {
compute_dmi_mech(i,j,rsq,eij,fi,spi,spj);
}
compute_dmi(i,j,eij,fmi,spj);
if (lattice_flag) {
compute_dmi_mech(i,j,rsq,eij,fi,spi,spj);
}
}
f[i][0] += fi[0];
f[i][1] += fi[1];
f[i][0] += fi[0];
f[i][1] += fi[1];
f[i][2] += fi[2];
fm[i][0] += fmi[0];
fm[i][1] += fmi[1];
fm[i][0] += fmi[0];
fm[i][1] += fmi[1];
fm[i][2] += fmi[2];
if (newton_pair || j < nlocal) {
f[j][0] -= fi[0];
f[j][1] -= fi[1];
f[j][0] -= fi[0];
f[j][1] -= fi[1];
f[j][2] -= fi[2];
}
if (eflag) {
evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]);
evdwl *= hbar;
evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]);
evdwl *= hbar;
} else evdwl = 0.0;
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz);
evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz);
}
}
@ -342,7 +342,7 @@ void PairSpinDmi::compute_single_pair(int ii, double fmi[3])
double delx,dely,delz;
double spj[3];
int i,j,jnum,itype,jtype,ntypes;
int j,jnum,itype,jtype,ntypes;
int k,locflag;
int *jlist,*numneigh,**firstneigh;
@ -350,7 +350,7 @@ void PairSpinDmi::compute_single_pair(int ii, double fmi[3])
numneigh = list->numneigh;
firstneigh = list->firstneigh;
// check if interaction applies to type of ii
itype = type[ii];
@ -360,20 +360,20 @@ void PairSpinDmi::compute_single_pair(int ii, double fmi[3])
while (k <= ntypes) {
if (k <= itype) {
if (setflag[k][itype] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else if (k > itype) {
if (setflag[itype][k] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else error->all(FLERR,"Wrong type number");
}
// if interaction applies to type ii,
// if interaction applies to type ii,
// locflag = 1 and compute pair interaction
//i = ilist[ii];
@ -422,7 +422,7 @@ void PairSpinDmi::compute_dmi(int i, int j, double eij[3], double fmi[3], double
{
int *type = atom->type;
int itype, jtype;
double dmix, dmiy, dmiz;
double dmix, dmiy, dmiz;
itype = type[i];
jtype = type[j];
@ -444,7 +444,7 @@ void PairSpinDmi::compute_dmi_mech(int i, int j, double rsq, double /*eij*/[3],
{
int *type = atom->type;
int itype, jtype;
double dmix,dmiy,dmiz;
double dmix,dmiy,dmiz;
itype = type[i];
jtype = type[j];
double csx,csy,csz,cdmx,cdmy,cdmz,irij;
@ -509,7 +509,7 @@ void PairSpinDmi::write_restart(FILE *fp)
for (j = i; j <= atom->ntypes; j++) {
fwrite(&setflag[i][j],sizeof(int),1,fp);
if (setflag[i][j]) {
fwrite(&DM[i][j],sizeof(double),1,fp);
fwrite(&DM[i][j],sizeof(double),1,fp);
fwrite(&v_dmx[i][j],sizeof(double),1,fp);
fwrite(&v_dmy[i][j],sizeof(double),1,fp);
fwrite(&v_dmz[i][j],sizeof(double),1,fp);

View File

@ -223,7 +223,7 @@ void PairSpinExchange::compute(int eflag, int vflag)
double **x = atom->x;
double **f = atom->f;
double **fm = atom->fm;
double **sp = atom->sp;
double **sp = atom->sp;
int *type = atom->type;
int nlocal = atom->nlocal;
int newton_pair = force->newton_pair;
@ -278,32 +278,32 @@ void PairSpinExchange::compute(int eflag, int vflag)
// compute exchange interaction
if (rsq <= local_cut2) {
compute_exchange(i,j,rsq,fmi,spj);
compute_exchange(i,j,rsq,fmi,spj);
if (lattice_flag) {
compute_exchange_mech(i,j,rsq,eij,fi,spi,spj);
}
compute_exchange_mech(i,j,rsq,eij,fi,spi,spj);
}
}
f[i][0] += fi[0];
f[i][1] += fi[1];
f[i][0] += fi[0];
f[i][1] += fi[1];
f[i][2] += fi[2];
fm[i][0] += fmi[0];
fm[i][1] += fmi[1];
fm[i][0] += fmi[0];
fm[i][1] += fmi[1];
fm[i][2] += fmi[2];
if (newton_pair || j < nlocal) {
f[j][0] -= fi[0];
f[j][1] -= fi[1];
f[j][0] -= fi[0];
f[j][1] -= fi[1];
f[j][2] -= fi[2];
}
if (eflag) {
evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]);
evdwl *= hbar;
evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]);
evdwl *= hbar;
} else evdwl = 0.0;
if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair,
evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz);
evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz);
}
}
@ -325,7 +325,7 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3])
double delx,dely,delz;
double spj[3];
int i,j,jnum,itype,jtype,ntypes;
int j,jnum,itype,jtype,ntypes;
int k,locflag;
int *jlist,*numneigh,**firstneigh;
@ -343,24 +343,24 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3])
while (k <= ntypes) {
if (k <= itype) {
if (setflag[k][itype] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else if (k > itype) {
if (setflag[itype][k] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else error->all(FLERR,"Wrong type number");
}
// if interaction applies to type ii,
// if interaction applies to type ii,
// locflag = 1 and compute pair interaction
if (locflag == 1) {
xi[0] = x[ii][0];
xi[1] = x[ii][1];
xi[2] = x[ii][2];
@ -388,7 +388,7 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3])
compute_exchange(ii,j,rsq,fmi,spj);
}
}
}
}
}
/* ----------------------------------------------------------------------

View File

@ -332,7 +332,7 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3])
double delx,dely,delz;
double spj[3];
int i,j,jnum,itype,jtype,ntypes;
int j,jnum,itype,jtype,ntypes;
int k,locflag;
int *jlist,*numneigh,**firstneigh;
@ -340,7 +340,7 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3])
numneigh = list->numneigh;
firstneigh = list->firstneigh;
// check if interaction applies to type of ii
itype = type[ii];
@ -350,42 +350,42 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3])
while (k <= ntypes) {
if (k <= itype) {
if (setflag[k][itype] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else if (k > itype) {
if (setflag[itype][k] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else error->all(FLERR,"Wrong type number");
}
// if interaction applies to type ii,
// if interaction applies to type ii,
// locflag = 1 and compute pair interaction
if (locflag == 1) {
xi[0] = x[ii][0];
xi[1] = x[ii][1];
xi[2] = x[ii][2];
jlist = firstneigh[ii];
jnum = numneigh[ii];
for (int jj = 0; jj < jnum; jj++) {
j = jlist[jj];
j &= NEIGHMASK;
jtype = type[j];
local_cut2 = cut_spin_magelec[itype][jtype]*cut_spin_magelec[itype][jtype];
spj[0] = sp[j][0];
spj[1] = sp[j][1];
spj[2] = sp[j][2];
delx = xi[0] - x[j][0];
dely = xi[1] - x[j][1];
delz = xi[2] - x[j][2];
@ -394,7 +394,7 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3])
eij[0] = -inorm*delx;
eij[1] = -inorm*dely;
eij[2] = -inorm*delz;
if (rsq <= local_cut2) {
compute_magelec(ii,j,eij,fmi,spj);
}

View File

@ -351,7 +351,7 @@ void PairSpinNeel::compute_single_pair(int ii, double fmi[3])
numneigh = list->numneigh;
firstneigh = list->firstneigh;
// check if interaction applies to type of ii
itype = type[ii];
@ -361,20 +361,20 @@ void PairSpinNeel::compute_single_pair(int ii, double fmi[3])
while (k <= ntypes) {
if (k <= itype) {
if (setflag[k][itype] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else if (k > itype) {
if (setflag[itype][k] == 1) {
locflag =1;
break;
locflag =1;
break;
}
k++;
} else error->all(FLERR,"Wrong type number");
}
// if interaction applies to type ii,
// if interaction applies to type ii,
// locflag = 1 and compute pair interaction
if (locflag == 1) {