Commit 31790144 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6835 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 1a4f998b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -83,6 +83,10 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
  eradius = ervel = erforce = NULL;
  cs = csforce = vforce = ervelforce = NULL;
  etag = NULL;
  rho = drho = NULL;
  e = de = NULL;
  cv = NULL;
  vest = NULL;

  maxspecial = 1;
  nspecial = NULL;
@@ -106,12 +110,13 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
  // customize by adding new flag

  sphere_flag = ellipsoid_flag = peri_flag = electron_flag = 0;
  wavepacket_flag = 0;
  wavepacket_flag = sph_flag = 0;

  molecule_flag = q_flag = mu_flag = 0;
  rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0;
  vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
  cs_flag = csforce_flag = vforce_flag = ervelforce_flag= etag_flag = 0;
  rho_flag = e_flag = cv_flag = vest_flag = 0;

  // ntype-length arrays

+6 −1
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ class Atom : protected Pointers {
  double *eradius,*ervel,*erforce,*ervelforce;
  double *cs,*csforce,*vforce;
  int *etag;
  double *rho, *drho;
  double *e, *de;
  double **vest;
  double *cv;

  int **nspecial;               // 0,1,2 = cummulative # of 1-2,1-3,1-4 neighs
  int **special;                // IDs of 1-2,1-3,1-4 neighs of each atom
@@ -81,12 +85,13 @@ class Atom : protected Pointers {
  // customize by adding new flag

  int sphere_flag,ellipsoid_flag,peri_flag,electron_flag;
  int wavepacket_flag;
  int wavepacket_flag,sph_flag;

  int molecule_flag,q_flag,mu_flag;
  int rmass_flag,radius_flag,omega_flag,torque_flag,angmom_flag;
  int vfrac_flag,spin_flag,eradius_flag,ervel_flag,erforce_flag;
  int cs_flag,csforce_flag,vforce_flag,ervelforce_flag,etag_flag;
  int rho_flag,e_flag,cv_flag,vest_flag;

  // extra peratom info in restart file destined for fix & diag 

+28 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
  if (narg < 5) error->all("Illegal fix gravity command");

  time_depend = 1;
  scalar_flag = 1;
  global_freq = 1;
  extscalar = 1;

  magnitude = atof(arg[3]);

@@ -90,6 +93,9 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) :
  }

  time_origin = update->ntimestep;

  eflag = 0;
  egrav = 0.0;
}

/* ---------------------------------------------------------------------- */
@@ -98,6 +104,7 @@ int FixGravity::setmask()
{
  int mask = 0;
  mask |= POST_FORCE;
  mask |= THERMO_ENERGY;
  mask |= POST_FORCE_RESPA;
  return mask;
}
@@ -155,6 +162,7 @@ void FixGravity::post_force(int vflag)
    zacc = magnitude*zgrav;
  }

  double **x = atom->x;
  double **f = atom->f;
  double *rmass = atom->rmass;
  double *mass = atom->mass;
@@ -163,6 +171,9 @@ void FixGravity::post_force(int vflag)
  int nlocal = atom->nlocal;
  double massone;

  eflag = 0;
  egrav = 0.0;

  if (rmass) {
    for (int i = 0; i < nlocal; i++)
      if (mask[i] & groupbit) {
@@ -170,6 +181,7 @@ void FixGravity::post_force(int vflag)
	f[i][0] += massone*xacc;
	f[i][1] += massone*yacc;
	f[i][2] += massone*zacc;
	egrav -= massone * (xacc*x[i][0] + yacc*x[i][1] + zacc*x[i][2]);
      }
  } else {
    for (int i = 0; i < nlocal; i++)
@@ -178,6 +190,7 @@ void FixGravity::post_force(int vflag)
	f[i][0] += massone*xacc;
	f[i][1] += massone*yacc;
	f[i][2] += massone*zacc;
	egrav -= massone * (xacc*x[i][0] + yacc*x[i][1] + zacc*x[i][2]);
      }
  }
}
@@ -188,3 +201,18 @@ void FixGravity::post_force_respa(int vflag, int ilevel, int iloop)
{
  if (ilevel == nlevels_respa-1) post_force(vflag);
}

/* ----------------------------------------------------------------------
   potential energy in gravity field
------------------------------------------------------------------------- */

double FixGravity::compute_scalar()
{
  // only sum across procs one time

  if (eflag == 0) {
    MPI_Allreduce(&egrav,&egrav_all,1,MPI_DOUBLE,MPI_SUM,world);
    eflag = 1;
  }
  return egrav_all;
}
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ class FixGravity : public Fix {
  void setup(int);
  void post_force(int);
  void post_force_respa(int, int, int);
  double compute_scalar();

 private:
  int style;
@@ -44,6 +45,8 @@ class FixGravity : public Fix {
  double degree2rad;
  int nlevels_respa;
  int time_origin;
  int eflag;
  double egrav,egrav_all;
};

}
+15 −1
Original line number Diff line number Diff line
@@ -137,12 +137,16 @@ void Min::init()
  ev_setup();

  // set flags for what arrays to clear in force_clear()
  // need to clear torques,erforce if arrays exists
  // need to clear additionals arrays if they exist

  torqueflag = 0;
  if (atom->torque_flag) torqueflag = 1;
  erforceflag = 0;
  if (atom->erforce_flag) erforceflag = 1;
  e_flag = 0;
  if (atom->e_flag) e_flag = 1;
  rho_flag = 0;
  if (atom->rho_flag) rho_flag = 1;

  // orthogonal vs triclinic simulation box

@@ -537,6 +541,16 @@ void Min::force_clear()
    double *erforce = atom->erforce;
    for (i = 0; i < nall; i++) erforce[i] = 0.0;
  }

  if (e_flag) {
    double *de = atom->de;
    for (i = 0; i < nall; i++) de[i] = 0.0;
  }
  
  if (rho_flag) {
    double *drho = atom->drho;
    for (i = 0; i < nall; i++) drho[i] = 0.0;
  }
}

/* ----------------------------------------------------------------------
Loading