git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@7039 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2011-10-06 17:55:48 +00:00
parent f70a2f8937
commit 15203cb792
81 changed files with 432 additions and 280 deletions

View File

@ -33,8 +33,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
enum{SPHERE_SPHERE,SPHERE_ELLIPSE,ELLIPSE_SPHERE,ELLIPSE_ELLIPSE};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairGayBerne::PairGayBerne(LAMMPS *lmp) : Pair(lmp) PairGayBerne::PairGayBerne(LAMMPS *lmp) : Pair(lmp)

View File

@ -39,6 +39,8 @@ class PairGayBerne : public Pair {
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
protected: protected:
enum{SPHERE_SPHERE,SPHERE_ELLIPSE,ELLIPSE_SPHERE,ELLIPSE_ELLIPSE};
double cut_global; double cut_global;
double **cut; double **cut;

View File

@ -33,8 +33,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
enum{SPHERE_SPHERE,SPHERE_ELLIPSE,ELLIPSE_SPHERE,ELLIPSE_ELLIPSE};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairRESquared::PairRESquared(LAMMPS *lmp) : Pair(lmp), PairRESquared::PairRESquared(LAMMPS *lmp) : Pair(lmp),

View File

@ -39,6 +39,8 @@ class PairRESquared : public Pair {
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
protected: protected:
enum{SPHERE_SPHERE,SPHERE_ELLIPSE,ELLIPSE_SPHERE,ELLIPSE_ELLIPSE};
double cut_global; double cut_global;
double **cut; double **cut;

View File

@ -28,13 +28,13 @@ namespace LAMMPS_NS {
class DihedralClass2 : public Dihedral { class DihedralClass2 : public Dihedral {
public: public:
DihedralClass2(class LAMMPS *); DihedralClass2(class LAMMPS *);
~DihedralClass2(); virtual ~DihedralClass2();
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void write_restart(FILE *); void write_restart(FILE *);
void read_restart(FILE *); void read_restart(FILE *);
private: protected:
double *k1,*k2,*k3; double *k1,*k2,*k3;
double *phi1,*phi2,*phi3; double *phi1,*phi2,*phi3;
double *mbt_f1,*mbt_f2,*mbt_f3,*mbt_r0; double *mbt_f1,*mbt_f2,*mbt_f3,*mbt_r0;

View File

@ -28,7 +28,7 @@ class PairLJClass2 : public Pair {
public: public:
PairLJClass2(class LAMMPS *); PairLJClass2(class LAMMPS *);
virtual ~PairLJClass2(); virtual ~PairLJClass2();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);

View File

@ -28,7 +28,7 @@ class PairLJClass2CoulCut : public Pair {
public: public:
PairLJClass2CoulCut(class LAMMPS *); PairLJClass2CoulCut(class LAMMPS *);
virtual ~PairLJClass2CoulCut(); virtual ~PairLJClass2CoulCut();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();

View File

@ -28,7 +28,7 @@ class PairLJClass2CoulLong : public Pair {
public: public:
PairLJClass2CoulLong(class LAMMPS *); PairLJClass2CoulLong(class LAMMPS *);
virtual ~PairLJClass2CoulLong(); virtual ~PairLJClass2CoulLong();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();

View File

@ -30,8 +30,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
enum{SMALL_SMALL,SMALL_LARGE,LARGE_LARGE};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairColloid::PairColloid(LAMMPS *lmp) : Pair(lmp) {} PairColloid::PairColloid(LAMMPS *lmp) : Pair(lmp) {}

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairColloid : public Pair { class PairColloid : public Pair {
public: public:
PairColloid(class LAMMPS *); PairColloid(class LAMMPS *);
~PairColloid(); virtual ~PairColloid();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
@ -38,7 +38,9 @@ class PairColloid : public Pair {
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
private: enum {SMALL_SMALL,SMALL_LARGE,LARGE_LARGE};
protected:
double cut_global; double cut_global;
double **cut; double **cut;
double **a12,**d1,**d2,**diameter,**a1,**a2,**offset; double **a12,**d1,**d2,**diameter,**a1,**a2,**offset;

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairLubricate : public Pair { class PairLubricate : public Pair {
public: public:
PairLubricate(class LAMMPS *); PairLubricate(class LAMMPS *);
~PairLubricate(); virtual ~PairLubricate();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairYukawaColloid : public PairYukawa { class PairYukawaColloid : public PairYukawa {
public: public:
PairYukawaColloid(class LAMMPS *); PairYukawaColloid(class LAMMPS *);
~PairYukawaColloid() {} virtual ~PairYukawaColloid() {}
void compute(int, int); virtual void compute(int, int);
void init_style(); void init_style();
double init_one(int, int); double init_one(int, int);
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairDipoleCut : public Pair { class PairDipoleCut : public Pair {
public: public:
PairDipoleCut(class LAMMPS *); PairDipoleCut(class LAMMPS *);
~PairDipoleCut(); virtual ~PairDipoleCut();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();
@ -38,7 +38,7 @@ class PairDipoleCut : public Pair {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
private: protected:
double cut_lj_global,cut_coul_global; double cut_lj_global,cut_coul_global;
double **cut_lj,**cut_ljsq; double **cut_lj,**cut_ljsq;
double **cut_coul,**cut_coulsq; double **cut_coul,**cut_coulsq;

View File

@ -26,8 +26,11 @@ namespace LAMMPS_NS {
class FixPour : public Fix { class FixPour : public Fix {
friend class PairGranHertzHistory; friend class PairGranHertzHistory;
friend class PairGranHertzHistoryOMP;
friend class PairGranHooke; friend class PairGranHooke;
friend class PairGranHookeOMP;
friend class PairGranHookeHistory; friend class PairGranHookeHistory;
friend class PairGranHookeHistoryOMP;
friend class PairGranHookeCuda; friend class PairGranHookeCuda;
public: public:

View File

@ -221,8 +221,12 @@ void FixWallGran::init()
pairstyle = HOOKE; pairstyle = HOOKE;
else if (force->pair_match("gran/hooke/history",1)) else if (force->pair_match("gran/hooke/history",1))
pairstyle = HOOKE_HISTORY; pairstyle = HOOKE_HISTORY;
else if (force->pair_match("gran/hooke/history/omp",1))
pairstyle = HOOKE_HISTORY;
else if (force->pair_match("gran/hertz/history",1)) else if (force->pair_match("gran/hertz/history",1))
pairstyle = HERTZ_HISTORY; pairstyle = HERTZ_HISTORY;
else if (force->pair_match("gran/hertz/history/omp",1))
pairstyle = HERTZ_HISTORY;
else error->all(FLERR,"Fix wall/gran is incompatible with Pair style"); else error->all(FLERR,"Fix wall/gran is incompatible with Pair style");
} }

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PairGranHertzHistory : public PairGranHookeHistory { class PairGranHertzHistory : public PairGranHookeHistory {
public: public:
PairGranHertzHistory(class LAMMPS *); PairGranHertzHistory(class LAMMPS *);
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
}; };

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PairGranHooke : public PairGranHookeHistory { class PairGranHooke : public PairGranHookeHistory {
public: public:
PairGranHooke(class LAMMPS *); PairGranHooke(class LAMMPS *);
void compute(int, int); virtual void compute(int, int);
}; };
} }

View File

@ -46,6 +46,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
no_virial_fdotr_compute = 1; no_virial_fdotr_compute = 1;
history = 1; history = 1;
fix_history = NULL; fix_history = NULL;
suffix = NULL;
laststep = -1; laststep = -1;
} }
@ -55,6 +56,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
PairGranHookeHistory::~PairGranHookeHistory() PairGranHookeHistory::~PairGranHookeHistory()
{ {
if (fix_history) modify->delete_fix("SHEAR_HISTORY"); if (fix_history) modify->delete_fix("SHEAR_HISTORY");
if (suffix) delete[] suffix;
if (allocated) { if (allocated) {
memory->destroy(setflag); memory->destroy(setflag);
@ -393,7 +395,7 @@ void PairGranHookeHistory::init_style()
fixarg[0] = (char *) "SHEAR_HISTORY"; fixarg[0] = (char *) "SHEAR_HISTORY";
fixarg[1] = (char *) "all"; fixarg[1] = (char *) "all";
fixarg[2] = (char *) "SHEAR_HISTORY"; fixarg[2] = (char *) "SHEAR_HISTORY";
modify->add_fix(3,fixarg); modify->add_fix(3,fixarg,suffix);
delete [] fixarg; delete [] fixarg;
fix_history = (FixShearHistory *) modify->fix[modify->nfix-1]; fix_history = (FixShearHistory *) modify->fix[modify->nfix-1];
fix_history->pair = this; fix_history->pair = this;

View File

@ -49,7 +49,8 @@ class PairGranHookeHistory : public Pair {
bigint laststep; bigint laststep;
class FixShearHistory *fix_history; class FixShearHistory *fix_history;
int shearupdate;
char *suffix;
double *onerad_dynamic,*onerad_frozen; double *onerad_dynamic,*onerad_frozen;
double *maxrad_dynamic,*maxrad_frozen; double *maxrad_dynamic,*maxrad_frozen;

View File

@ -28,7 +28,7 @@ class PairBornCoulLong : public Pair {
public: public:
PairBornCoulLong(class LAMMPS *); PairBornCoulLong(class LAMMPS *);
virtual ~PairBornCoulLong(); virtual ~PairBornCoulLong();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();

View File

@ -27,8 +27,9 @@ namespace LAMMPS_NS {
class PairLJCharmmCoulLong : public Pair { class PairLJCharmmCoulLong : public Pair {
public: public:
PairLJCharmmCoulLong(class LAMMPS *); PairLJCharmmCoulLong(class LAMMPS *);
~PairLJCharmmCoulLong(); virtual ~PairLJCharmmCoulLong();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();

View File

@ -28,15 +28,15 @@ namespace LAMMPS_NS {
class FixQEQComb : public Fix { class FixQEQComb : public Fix {
public: public:
FixQEQComb(class LAMMPS *, int, char **); FixQEQComb(class LAMMPS *, int, char **);
~FixQEQComb(); virtual ~FixQEQComb();
int setmask(); int setmask();
void init(); virtual void init();
void setup(int); void setup(int);
void post_force(int); virtual void post_force(int);
void post_force_respa(int,int,int); void post_force_respa(int,int,int);
double memory_usage(); double memory_usage();
private: protected:
int me,firstflag; int me,firstflag;
double precision; double precision;
int nlevels_respa; int nlevels_respa;

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairADP : public Pair { class PairADP : public Pair {
public: public:
PairADP(class LAMMPS *); PairADP(class LAMMPS *);
~PairADP(); virtual ~PairADP();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();
@ -40,7 +40,7 @@ class PairADP : public Pair {
void unpack_reverse_comm(int, int *, double *); void unpack_reverse_comm(int, int *, double *);
double memory_usage(); double memory_usage();
private: protected:
int nmax; // allocated size of per-atom arrays int nmax; // allocated size of per-atom arrays
double cutforcesq,cutmax; double cutforcesq,cutmax;

View File

@ -46,7 +46,7 @@ class PairEAM : public Pair {
PairEAM(class LAMMPS *); PairEAM(class LAMMPS *);
virtual ~PairEAM(); virtual ~PairEAM();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
virtual void coeff(int, char **); virtual void coeff(int, char **);
void init_style(); void init_style();

View File

@ -28,8 +28,8 @@ namespace LAMMPS_NS {
class PairEIM : public Pair { class PairEIM : public Pair {
public: public:
PairEIM(class LAMMPS *); PairEIM(class LAMMPS *);
~PairEIM(); virtual ~PairEIM();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();
@ -41,7 +41,7 @@ class PairEIM : public Pair {
void unpack_reverse_comm(int, int *, double *); void unpack_reverse_comm(int, int *, double *);
double memory_usage(); double memory_usage();
private: protected:
double **cutforcesq,cutmax; double **cutforcesq,cutmax;
int nmax; int nmax;
double *rho,*fp; double *rho,*fp;

View File

@ -27,14 +27,14 @@ namespace LAMMPS_NS {
class PairSW : public Pair { class PairSW : public Pair {
public: public:
PairSW(class LAMMPS *); PairSW(class LAMMPS *);
~PairSW(); virtual ~PairSW();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
void init_style(); void init_style();
private: protected:
struct Param { struct Param {
double epsilon,sigma; double epsilon,sigma;
double littlea,lambda,gamma,costheta; double littlea,lambda,gamma,costheta;

View File

@ -207,8 +207,10 @@ void AngleHybrid::settings(int narg, char **arg)
// one exception is 1st arg of style "table", which is non-numeric // one exception is 1st arg of style "table", which is non-numeric
// need a better way to skip these exceptions // need a better way to skip these exceptions
int dummy;
nstyles = 0; nstyles = 0;
i = 0; i = 0;
while (i < narg) { while (i < narg) {
for (m = 0; m < nstyles; m++) for (m = 0; m < nstyles; m++)
if (strcmp(arg[i],keywords[m]) == 0) if (strcmp(arg[i],keywords[m]) == 0)
@ -217,7 +219,7 @@ void AngleHybrid::settings(int narg, char **arg)
error->all(FLERR,"Angle style hybrid cannot have hybrid as an argument"); error->all(FLERR,"Angle style hybrid cannot have hybrid as an argument");
if (strcmp(arg[i],"none") == 0) if (strcmp(arg[i],"none") == 0)
error->all(FLERR,"Angle style hybrid cannot have none as an argument"); error->all(FLERR,"Angle style hybrid cannot have none as an argument");
styles[nstyles] = force->new_angle(arg[i]); styles[nstyles] = force->new_angle(arg[i],lmp->suffix,dummy);
keywords[nstyles] = new char[strlen(arg[i])+1]; keywords[nstyles] = new char[strlen(arg[i])+1];
strcpy(keywords[nstyles],arg[i]); strcpy(keywords[nstyles],arg[i]);
istyle = i; istyle = i;
@ -321,14 +323,14 @@ void AngleHybrid::read_restart(FILE *fp)
allocate(); allocate();
int n; int n,dummy;
for (int m = 0; m < nstyles; m++) { for (int m = 0; m < nstyles; m++) {
if (me == 0) fread(&n,sizeof(int),1,fp); if (me == 0) fread(&n,sizeof(int),1,fp);
MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(&n,1,MPI_INT,0,world);
keywords[m] = new char[n]; keywords[m] = new char[n];
if (me == 0) fread(keywords[m],sizeof(char),n,fp); if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_angle(keywords[m]); styles[m] = force->new_angle(keywords[m],lmp->suffix,dummy);
} }
} }

View File

@ -28,14 +28,14 @@ namespace LAMMPS_NS {
class DihedralCharmm : public Dihedral { class DihedralCharmm : public Dihedral {
public: public:
DihedralCharmm(class LAMMPS *); DihedralCharmm(class LAMMPS *);
~DihedralCharmm(); virtual ~DihedralCharmm();
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();
void write_restart(FILE *); void write_restart(FILE *);
void read_restart(FILE *); void read_restart(FILE *);
private: protected:
double *k,*weight,*cos_shift,*sin_shift; double *k,*weight,*cos_shift,*sin_shift;
int *multiplicity,*shift; int *multiplicity,*shift;
double **lj14_1,**lj14_2,**lj14_3,**lj14_4; double **lj14_1,**lj14_2,**lj14_3,**lj14_4;

View File

@ -28,13 +28,13 @@ namespace LAMMPS_NS {
class DihedralHarmonic : public Dihedral { class DihedralHarmonic : public Dihedral {
public: public:
DihedralHarmonic(class LAMMPS *); DihedralHarmonic(class LAMMPS *);
~DihedralHarmonic(); virtual ~DihedralHarmonic();
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void write_restart(FILE *); void write_restart(FILE *);
void read_restart(FILE *); void read_restart(FILE *);
private: protected:
double *k,*cos_shift,*sin_shift; double *k,*cos_shift,*sin_shift;
int *sign,*multiplicity; int *sign,*multiplicity;

View File

@ -28,13 +28,13 @@ namespace LAMMPS_NS {
class DihedralHelix : public Dihedral { class DihedralHelix : public Dihedral {
public: public:
DihedralHelix(class LAMMPS *); DihedralHelix(class LAMMPS *);
~DihedralHelix(); virtual ~DihedralHelix();
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void write_restart(FILE *); void write_restart(FILE *);
void read_restart(FILE *); void read_restart(FILE *);
private: protected:
double *aphi,*bphi,*cphi; double *aphi,*bphi,*cphi;
void allocate(); void allocate();

View File

@ -165,16 +165,19 @@ void DihedralHybrid::settings(int narg, char **arg)
styles = new Dihedral*[nstyles]; styles = new Dihedral*[nstyles];
keywords = new char*[nstyles]; keywords = new char*[nstyles];
int dummy;
for (int m = 0; m < nstyles; m++) { for (int m = 0; m < nstyles; m++) {
for (int i = 0; i < m; i++) for (int i = 0; i < m; i++)
if (strcmp(arg[m],arg[i]) == 0) if (strcmp(arg[m],arg[i]) == 0)
error->all(FLERR,"Dihedral style hybrid cannot use " error->all(FLERR,"Dihedral style hybrid cannot use "
"same dihedral style twice"); "same dihedral style twice");
if (strcmp(arg[m],"hybrid") == 0) if (strcmp(arg[m],"hybrid") == 0)
error->all(FLERR,"Dihedral style hybrid cannot have hybrid as an argument"); error->all(FLERR,
"Dihedral style hybrid cannot have hybrid as an argument");
if (strcmp(arg[m],"none") == 0) if (strcmp(arg[m],"none") == 0)
error->all(FLERR,"Dihedral style hybrid cannot have none as an argument"); error->all(FLERR,"Dihedral style hybrid cannot have none as an argument");
styles[m] = force->new_dihedral(arg[m]); styles[m] = force->new_dihedral(arg[m],lmp->suffix,dummy);
keywords[m] = new char[strlen(arg[m])+1]; keywords[m] = new char[strlen(arg[m])+1];
strcpy(keywords[m],arg[m]); strcpy(keywords[m],arg[m]);
} }
@ -269,14 +272,14 @@ void DihedralHybrid::read_restart(FILE *fp)
allocate(); allocate();
int n; int n,dummy;
for (int m = 0; m < nstyles; m++) { for (int m = 0; m < nstyles; m++) {
if (me == 0) fread(&n,sizeof(int),1,fp); if (me == 0) fread(&n,sizeof(int),1,fp);
MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(&n,1,MPI_INT,0,world);
keywords[m] = new char[n]; keywords[m] = new char[n];
if (me == 0) fread(keywords[m],sizeof(char),n,fp); if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_dihedral(keywords[m]); styles[m] = force->new_dihedral(keywords[m],lmp->suffix,dummy);
} }
} }

View File

@ -28,13 +28,13 @@ namespace LAMMPS_NS {
class DihedralMultiHarmonic : public Dihedral { class DihedralMultiHarmonic : public Dihedral {
public: public:
DihedralMultiHarmonic(class LAMMPS *); DihedralMultiHarmonic(class LAMMPS *);
~DihedralMultiHarmonic(); virtual ~DihedralMultiHarmonic();
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void write_restart(FILE *); void write_restart(FILE *);
void read_restart(FILE *); void read_restart(FILE *);
private: protected:
double *a1,*a2,*a3,*a4,*a5; double *a1,*a2,*a3,*a4,*a5;
void allocate(); void allocate();

View File

@ -28,13 +28,13 @@ namespace LAMMPS_NS {
class DihedralOPLS : public Dihedral { class DihedralOPLS : public Dihedral {
public: public:
DihedralOPLS(class LAMMPS *); DihedralOPLS(class LAMMPS *);
~DihedralOPLS(); virtual ~DihedralOPLS();
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void write_restart(FILE *); void write_restart(FILE *);
void read_restart(FILE *); void read_restart(FILE *);
private: protected:
double *k1,*k2,*k3,*k4; double *k1,*k2,*k3,*k4;
void allocate(); void allocate();

View File

@ -165,15 +165,19 @@ void ImproperHybrid::settings(int narg, char **arg)
styles = new Improper*[nstyles]; styles = new Improper*[nstyles];
keywords = new char*[nstyles]; keywords = new char*[nstyles];
int dummy;
for (int m = 0; m < nstyles; m++) { for (int m = 0; m < nstyles; m++) {
for (int i = 0; i < m; i++) for (int i = 0; i < m; i++)
if (strcmp(arg[m],arg[i]) == 0) if (strcmp(arg[m],arg[i]) == 0)
error->all(FLERR,"Improper style hybrid cannot use same improper style twice"); error->all(FLERR,
"Improper style hybrid cannot use same improper style twice");
if (strcmp(arg[m],"hybrid") == 0) if (strcmp(arg[m],"hybrid") == 0)
error->all(FLERR,"Improper style hybrid cannot have hybrid as an argument"); error->all(FLERR,
"Improper style hybrid cannot have hybrid as an argument");
if (strcmp(arg[m],"none") == 0) if (strcmp(arg[m],"none") == 0)
error->all(FLERR,"Improper style hybrid cannot have none as an argument"); error->all(FLERR,"Improper style hybrid cannot have none as an argument");
styles[m] = force->new_improper(arg[m]); styles[m] = force->new_improper(arg[m],lmp->suffix,dummy);
keywords[m] = new char[strlen(arg[m])+1]; keywords[m] = new char[strlen(arg[m])+1];
strcpy(keywords[m],arg[m]); strcpy(keywords[m],arg[m]);
} }
@ -256,14 +260,14 @@ void ImproperHybrid::read_restart(FILE *fp)
allocate(); allocate();
int n; int n,dummy;
for (int m = 0; m < nstyles; m++) { for (int m = 0; m < nstyles; m++) {
if (me == 0) fread(&n,sizeof(int),1,fp); if (me == 0) fread(&n,sizeof(int),1,fp);
MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(&n,1,MPI_INT,0,world);
keywords[m] = new char[n]; keywords[m] = new char[n];
if (me == 0) fread(keywords[m],sizeof(char),n,fp); if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_improper(keywords[m]); styles[m] = force->new_improper(keywords[m],lmp->suffix,dummy);
} }
} }

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairHbondDreidingMorse : public PairHbondDreidingLJ { class PairHbondDreidingMorse : public PairHbondDreidingLJ {
public: public:
PairHbondDreidingMorse(class LAMMPS *); PairHbondDreidingMorse(class LAMMPS *);
~PairHbondDreidingMorse() {} virtual ~PairHbondDreidingMorse() {};
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);

View File

@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class PairLJCharmmCoulCharmmImplicit : public PairLJCharmmCoulCharmm { class PairLJCharmmCoulCharmmImplicit : public PairLJCharmmCoulCharmm {
public: public:
PairLJCharmmCoulCharmmImplicit(class LAMMPS *); PairLJCharmmCoulCharmmImplicit(class LAMMPS *);
void compute(int, int); virtual void compute(int, int);
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
}; };

View File

@ -260,8 +260,8 @@ void FixPeriNeigh::setup(int vflag)
double **x0 = atom->x0; double **x0 = atom->x0;
double half_lc = 0.5*(domain->lattice->xlattice); double half_lc = 0.5*(domain->lattice->xlattice);
double vfrac_scale; double vfrac_scale;
PairPeriLPS *pairlps = dynamic_cast<PairPeriLPS*>(anypair); PairPeriLPS *pairlps = static_cast<PairPeriLPS*>(anypair);
PairPeriPMB *pairpmb = dynamic_cast<PairPeriPMB*>(anypair); PairPeriPMB *pairpmb = static_cast<PairPeriPMB*>(anypair);
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
double xtmp0 = x0[i][0]; double xtmp0 = x0[i][0];
double ytmp0 = x0[i][1]; double ytmp0 = x0[i][1];

View File

@ -26,7 +26,9 @@ namespace LAMMPS_NS {
class FixPeriNeigh : public Fix { class FixPeriNeigh : public Fix {
friend class PairPeriPMB; friend class PairPeriPMB;
friend class PairPeriPMBOMP;
friend class PairPeriLPS; friend class PairPeriLPS;
friend class PairPeriLPSOMP;
friend class ComputeDamageAtom; friend class ComputeDamageAtom;
public: public:

View File

@ -174,7 +174,7 @@ void PairPeriLPS::compute(int eflag, int vflag)
double kshort = (15.0 * 18.0 * bulkmodulus[itype][itype]) / double kshort = (15.0 * 18.0 * bulkmodulus[itype][itype]) /
(3.141592653589793 * cutsq[itype][jtype] * cutsq[itype][jtype]); (3.141592653589793 * cutsq[itype][jtype] * cutsq[itype][jtype]);
rk = (kshort * vfrac[j]) * (dr / sqrt(cutsq[itype][jtype])); rk = (kshort * vfrac[j]) * (dr / cut[itype][jtype]);
if (r > 0.0) fpair = -(rk/r); if (r > 0.0) fpair = -(rk/r);
else fpair = 0.0; else fpair = 0.0;
@ -214,9 +214,9 @@ void PairPeriLPS::compute(int eflag, int vflag)
comm->forward_comm_fix(modify->fix[ifix_peri]); comm->forward_comm_fix(modify->fix[ifix_peri]);
// Volume-dependent part of the energy // Volume-dependent part of the energy
if (eflag) {
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
itype = type[i]; itype = type[i];
if (eflag) {
if (eflag_global) if (eflag_global)
eng_vdwl += 0.5 * bulkmodulus[itype][itype] * (theta[i] * theta[i]); eng_vdwl += 0.5 * bulkmodulus[itype][itype] * (theta[i] * theta[i]);
if (eflag_atom) if (eflag_atom)
@ -266,7 +266,7 @@ void PairPeriLPS::compute(int eflag, int vflag)
delz0 = ztmp0 - x0[j][2]; delz0 = ztmp0 - x0[j][2];
if (periodic) domain->minimum_image(delx0,dely0,delz0); if (periodic) domain->minimum_image(delx0,dely0,delz0);
jtype = type[j]; jtype = type[j];
delta = sqrt(cutsq[itype][jtype]); delta = cut[itype][jtype];
r = sqrt(rsq); r = sqrt(rsq);
dr = r - r0[i][jj]; dr = r - r0[i][jj];
@ -316,8 +316,7 @@ void PairPeriLPS::compute(int eflag, int vflag)
if (first) if (first)
s0_new[i] = s00[itype][jtype] - (alpha[itype][jtype] * stretch); s0_new[i] = s00[itype][jtype] - (alpha[itype][jtype] * stretch);
else else
s0_new[i] = MAX(s0_new[i], s0_new[i] = MAX(s0_new[i],s00[itype][jtype] - (alpha[itype][jtype] * stretch));
s00[itype][jtype] - (alpha[itype][jtype] * stretch));
first = false; first = false;
} }
@ -406,6 +405,7 @@ double PairPeriLPS::init_one(int i, int j)
shearmodulus[j][i] = shearmodulus[i][j]; shearmodulus[j][i] = shearmodulus[i][j];
s00[j][i] = s00[i][j]; s00[j][i] = s00[i][j];
alpha[j][i] = alpha[i][j]; alpha[j][i] = alpha[i][j];
cut[j][i] = cut[i][j];
return cut[i][j]; return cut[i][j];
} }
@ -689,7 +689,7 @@ void PairPeriLPS::compute_dilatation()
if (fabs(dr) < 2.2204e-016) dr = 0.0; if (fabs(dr) < 2.2204e-016) dr = 0.0;
jtype = type[j]; jtype = type[j];
delta = sqrt(cutsq[itype][jtype]); delta = cut[itype][jtype];
// scale vfrac[j] if particle j near the horizon // scale vfrac[j] if particle j near the horizon

View File

@ -27,11 +27,11 @@ namespace LAMMPS_NS {
class PairPeriLPS : public Pair { class PairPeriLPS : public Pair {
public: public:
PairPeriLPS(class LAMMPS *); PairPeriLPS(class LAMMPS *);
~PairPeriLPS(); virtual ~PairPeriLPS();
int pack_comm(int, int *, double *, int, int *); int pack_comm(int, int *, double *, int, int *);
void unpack_comm(int, int, double *); void unpack_comm(int, int, double *);
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);

View File

@ -161,7 +161,7 @@ void PairPeriPMB::compute(int eflag, int vflag)
dr = r - d_ij; dr = r - d_ij;
rk = (15.0 * kspring[itype][jtype] * vfrac[j]) * rk = (15.0 * kspring[itype][jtype] * vfrac[j]) *
(dr / sqrt(cutsq[itype][jtype])); (dr / cut[itype][jtype]);
if (r > 0.0) fpair = -(rk/r); if (r > 0.0) fpair = -(rk/r);
else fpair = 0.0; else fpair = 0.0;
@ -182,7 +182,7 @@ void PairPeriPMB::compute(int eflag, int vflag)
// grow bond forces array if necessary // grow bond forces array if necessary
if (nlocal > nmax) { if (atom->nmax > nmax) {
memory->destroy(s0_new); memory->destroy(s0_new);
nmax = atom->nmax; nmax = atom->nmax;
memory->create(s0_new,nmax,"pair:s0_new"); memory->create(s0_new,nmax,"pair:s0_new");
@ -223,7 +223,7 @@ void PairPeriPMB::compute(int eflag, int vflag)
if (periodic) domain->minimum_image(delx,dely,delz); if (periodic) domain->minimum_image(delx,dely,delz);
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j]; jtype = type[j];
delta = sqrt(cutsq[itype][jtype]); delta = cut[itype][jtype];
r = sqrt(rsq); r = sqrt(rsq);
dr = r - r0[i][jj]; dr = r - r0[i][jj];
@ -345,6 +345,7 @@ double PairPeriPMB::init_one(int i, int j)
kspring[j][i] = kspring[i][j]; kspring[j][i] = kspring[i][j];
alpha[j][i] = alpha[i][j]; alpha[j][i] = alpha[i][j];
s00[j][i] = s00[i][j]; s00[j][i] = s00[i][j];
cut[j][i] = cut[i][j];
return cut[i][j]; return cut[i][j];
} }

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairPeriPMB : public Pair { class PairPeriPMB : public Pair {
public: public:
PairPeriPMB(class LAMMPS *); PairPeriPMB(class LAMMPS *);
~PairPeriPMB(); virtual ~PairPeriPMB();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
@ -38,7 +38,7 @@ class PairPeriPMB : public Pair {
void write_restart_settings(FILE *) {} void write_restart_settings(FILE *) {}
void read_restart_settings(FILE *) {} void read_restart_settings(FILE *) {}
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
double memory_usage(); virtual double memory_usage();
protected: protected:
int ifix_peri; int ifix_peri;

View File

@ -84,7 +84,7 @@ void AtomVecWavepacket::grow(int n)
spin = memory->grow(atom->spin,nmax,"atom:spin"); spin = memory->grow(atom->spin,nmax,"atom:spin");
eradius = memory->grow(atom->eradius,nmax,"atom:eradius"); eradius = memory->grow(atom->eradius,nmax,"atom:eradius");
ervel = memory->grow(atom->ervel,nmax,"atom:ervel"); ervel = memory->grow(atom->ervel,nmax,"atom:ervel");
erforce = memory->grow(atom->erforce,nmax,"atom:erforce"); erforce = memory->grow(atom->erforce,nmax*comm->nthreads,"atom:erforce");
cs = memory->grow(atom->cs,2*nmax,"atom:cs"); cs = memory->grow(atom->cs,2*nmax,"atom:cs");
csforce = memory->grow(atom->csforce,2*nmax,"atom:csforce"); csforce = memory->grow(atom->csforce,2*nmax,"atom:csforce");
@ -997,7 +997,7 @@ bigint AtomVecWavepacket::memory_usage()
if (atom->memcheck("spin")) bytes += memory->usage(spin,nmax); if (atom->memcheck("spin")) bytes += memory->usage(spin,nmax);
if (atom->memcheck("eradius")) bytes += memory->usage(eradius,nmax); if (atom->memcheck("eradius")) bytes += memory->usage(eradius,nmax);
if (atom->memcheck("ervel")) bytes += memory->usage(ervel,nmax); if (atom->memcheck("ervel")) bytes += memory->usage(ervel,nmax);
if (atom->memcheck("erforce")) bytes += memory->usage(erforce,nmax); if (atom->memcheck("erforce")) bytes += memory->usage(erforce,nmax*comm->nthreads);
if (atom->memcheck("ervelforce")) bytes += memory->usage(ervelforce,nmax); if (atom->memcheck("ervelforce")) bytes += memory->usage(ervelforce,nmax);
if (atom->memcheck("cs")) bytes += memory->usage(cs,2*nmax); if (atom->memcheck("cs")) bytes += memory->usage(cs,2*nmax);

View File

@ -78,7 +78,7 @@ void AtomVecElectron::grow(int n)
spin = memory->grow(atom->spin,nmax,"atom:spin"); spin = memory->grow(atom->spin,nmax,"atom:spin");
eradius = memory->grow(atom->eradius,nmax,"atom:eradius"); eradius = memory->grow(atom->eradius,nmax,"atom:eradius");
ervel = memory->grow(atom->ervel,nmax,"atom:ervel"); ervel = memory->grow(atom->ervel,nmax,"atom:ervel");
erforce = memory->grow(atom->erforce,nmax,"atom:erforce"); erforce = memory->grow(atom->erforce,nmax*comm->nthreads,"atom:erforce");
if (atom->nextra_grow) if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++) for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
@ -845,7 +845,7 @@ bigint AtomVecElectron::memory_usage()
if (atom->memcheck("spin")) bytes += memory->usage(spin,nmax); if (atom->memcheck("spin")) bytes += memory->usage(spin,nmax);
if (atom->memcheck("eradius")) bytes += memory->usage(eradius,nmax); if (atom->memcheck("eradius")) bytes += memory->usage(eradius,nmax);
if (atom->memcheck("ervel")) bytes += memory->usage(ervel,nmax); if (atom->memcheck("ervel")) bytes += memory->usage(ervel,nmax);
if (atom->memcheck("erforce")) bytes += memory->usage(erforce,nmax); if (atom->memcheck("erforce")) bytes += memory->usage(erforce,nmax*comm->nthreads);
return bytes; return bytes;
} }

View File

@ -28,13 +28,13 @@ namespace LAMMPS_NS {
class DihedralCosineShiftExp : public Dihedral { class DihedralCosineShiftExp : public Dihedral {
public: public:
DihedralCosineShiftExp(class LAMMPS *); DihedralCosineShiftExp(class LAMMPS *);
~DihedralCosineShiftExp(); virtual ~DihedralCosineShiftExp();
void compute(int, int); virtual void compute(int, int);
void coeff(int, char **); void coeff(int, char **);
void write_restart(FILE *); void write_restart(FILE *);
void read_restart(FILE *); void read_restart(FILE *);
private: protected:
bool *doExpansion; bool *doExpansion;
double *umin,*a,*opt1; double *umin,*a,*opt1;
double *sint; double *sint;

View File

@ -35,7 +35,7 @@ public:
virtual ~PairCDEAM(); virtual ~PairCDEAM();
/// Calculates the energies and forces for all atoms in the system. /// Calculates the energies and forces for all atoms in the system.
void compute(int, int); virtual void compute(int, int);
/// Parses the pair_coeff command parameters for this pair style. /// Parses the pair_coeff command parameters for this pair style.
void coeff(int, char **); void coeff(int, char **);
@ -62,7 +62,7 @@ public:
v = (v + hcoeff[i]) * x; v = (v + hcoeff[i]) * x;
} }
return v + hcoeff[0]; return v + hcoeff[0];
} };
// Calculates the derivative of the h(x) polynomial. // Calculates the derivative of the h(x) polynomial.
inline double evalHprime(double x) const { inline double evalHprime(double x) const {
@ -71,7 +71,7 @@ public:
v = (v + (double)i * hcoeff[i]) * x; v = (v + (double)i * hcoeff[i]) * x;
} }
return v + hcoeff[1]; return v + hcoeff[1];
} };
// We have two versions of the CD-EAM potential. The user can choose which one he wants to use: // We have two versions of the CD-EAM potential. The user can choose which one he wants to use:
// //
@ -124,7 +124,7 @@ public:
index.p -= index.m; index.p -= index.m;
index.p = index.p <= 1.0 ? index.p : 1.0; index.p = index.p <= 1.0 ? index.p : 1.0;
return index; return index;
} };
// Converts a density value to an index value to be used in a spline table lookup. // Converts a density value to an index value to be used in a spline table lookup.
inline EAMTableIndex rhoToTableIndex(double rho) const { inline EAMTableIndex rhoToTableIndex(double rho) const {
@ -135,43 +135,43 @@ public:
index.p -= index.m; index.p -= index.m;
index.p = index.p <= 1.0 ? index.p : 1.0; index.p = index.p <= 1.0 ? index.p : 1.0;
return index; return index;
} };
// Computes the derivative of rho(r) // Computes the derivative of rho(r)
inline double RhoPrimeOfR(const EAMTableIndex& index, int itype, int jtype) const { inline double RhoPrimeOfR(const EAMTableIndex& index, int itype, int jtype) const {
const double* coeff = rhor_spline[type2rhor[itype][jtype]][index.m]; const double* coeff = rhor_spline[type2rhor[itype][jtype]][index.m];
return (coeff[0]*index.p + coeff[1])*index.p + coeff[2]; return (coeff[0]*index.p + coeff[1])*index.p + coeff[2];
} };
// Computes rho(r) // Computes rho(r)
inline double RhoOfR(const EAMTableIndex& index, int itype, int jtype) const { inline double RhoOfR(const EAMTableIndex& index, int itype, int jtype) const {
const double* coeff = rhor_spline[type2rhor[itype][jtype]][index.m]; const double* coeff = rhor_spline[type2rhor[itype][jtype]][index.m];
return ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6]; return ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6];
} };
// Computes the derivative of F(rho) // Computes the derivative of F(rho)
inline double FPrimeOfRho(const EAMTableIndex& index, int itype) const { inline double FPrimeOfRho(const EAMTableIndex& index, int itype) const {
const double* coeff = frho_spline[type2frho[itype]][index.m]; const double* coeff = frho_spline[type2frho[itype]][index.m];
return (coeff[0]*index.p + coeff[1])*index.p + coeff[2]; return (coeff[0]*index.p + coeff[1])*index.p + coeff[2];
} };
// Computes F(rho) // Computes F(rho)
inline double FofRho(const EAMTableIndex& index, int itype) const { inline double FofRho(const EAMTableIndex& index, int itype) const {
const double* coeff = frho_spline[type2frho[itype]][index.m]; const double* coeff = frho_spline[type2frho[itype]][index.m];
return ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6]; return ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6];
} };
// Computes the derivative of z2(r) // Computes the derivative of z2(r)
inline double Z2PrimeOfR(const EAMTableIndex& index, int itype, int jtype) const { inline double Z2PrimeOfR(const EAMTableIndex& index, int itype, int jtype) const {
const double* coeff = z2r_spline[type2z2r[itype][jtype]][index.m]; const double* coeff = z2r_spline[type2z2r[itype][jtype]][index.m];
return (coeff[0]*index.p + coeff[1])*index.p + coeff[2]; return (coeff[0]*index.p + coeff[1])*index.p + coeff[2];
} };
// Computes z2(r) // Computes z2(r)
inline double Z2OfR(const EAMTableIndex& index, int itype, int jtype) const { inline double Z2OfR(const EAMTableIndex& index, int itype, int jtype) const {
const double* coeff = z2r_spline[type2z2r[itype][jtype]][index.m]; const double* coeff = z2r_spline[type2z2r[itype][jtype]][index.m];
return ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6]; return ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6];
} };
// Computes pair potential V_ij(r). // Computes pair potential V_ij(r).
inline double PhiOfR(const EAMTableIndex& index, int itype, int jtype, const double oneOverR) const { inline double PhiOfR(const EAMTableIndex& index, int itype, int jtype, const double oneOverR) const {
@ -180,7 +180,7 @@ public:
const double* coeff = z2r_spline[type2z2r[itype][jtype]][index.m]; const double* coeff = z2r_spline[type2z2r[itype][jtype]][index.m];
const double z2 = ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6]; const double z2 = ((coeff[3]*index.p + coeff[4])*index.p + coeff[5])*index.p + coeff[6];
return z2 * oneOverR; return z2 * oneOverR;
} };
// Computes pair potential V_ij(r) and its derivative. // Computes pair potential V_ij(r) and its derivative.
inline double PhiOfR(const EAMTableIndex& index, int itype, int jtype, const double oneOverR, double& phid) const { inline double PhiOfR(const EAMTableIndex& index, int itype, int jtype, const double oneOverR, double& phid) const {
@ -194,7 +194,7 @@ public:
const double phi = z2 * oneOverR; const double phi = z2 * oneOverR;
phid = z2p * oneOverR - phi * oneOverR; phid = z2p * oneOverR - phi * oneOverR;
return phi; return phi;
} };
// Parameters // Parameters
@ -224,7 +224,7 @@ public:
PairCDEAM_TwoSite(class LAMMPS* lmp) : PairEAM(lmp), PairCDEAM(lmp, 2) {} PairCDEAM_TwoSite(class LAMMPS* lmp) : PairEAM(lmp), PairCDEAM(lmp, 2) {}
}; };
}; }
#endif #endif
#endif #endif

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairDipoleSF : public Pair { class PairDipoleSF : public Pair {
public: public:
PairDipoleSF(class LAMMPS *); PairDipoleSF(class LAMMPS *);
~PairDipoleSF(); virtual ~PairDipoleSF();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();
@ -38,7 +38,7 @@ class PairDipoleSF : public Pair {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
private: protected:
double cut_lj_global,cut_coul_global; double cut_lj_global,cut_coul_global;
double **cut_lj,**cut_ljsq; double **cut_lj,**cut_ljsq;
double **cut_coul,**cut_coulsq; double **cut_coul,**cut_coulsq;

View File

@ -554,15 +554,17 @@ void PairEDIP::allocateGrids(void)
void PairEDIP::allocatePreLoops(void) void PairEDIP::allocatePreLoops(void)
{ {
memory->create(preInvR_ij,leadDimInteractionList,"edip:preInvR_ij"); int nthreads = comm->nthreads;
memory->create(preExp3B_ij,leadDimInteractionList,"edip:preExp3B_ij");
memory->create(preExp3BDerived_ij,leadDimInteractionList, memory->create(preInvR_ij,nthreads*leadDimInteractionList,"edip:preInvR_ij");
memory->create(preExp3B_ij,nthreads*leadDimInteractionList,"edip:preExp3B_ij");
memory->create(preExp3BDerived_ij,nthreads*leadDimInteractionList,
"edip:preExp3BDerived_ij"); "edip:preExp3BDerived_ij");
memory->create(preExp2B_ij,leadDimInteractionList,"edip:preExp2B_ij"); memory->create(preExp2B_ij,nthreads*leadDimInteractionList,"edip:preExp2B_ij");
memory->create(preExp2BDerived_ij,leadDimInteractionList, memory->create(preExp2BDerived_ij,nthreads*leadDimInteractionList,
"edip:preExp2BDerived_ij"); "edip:preExp2BDerived_ij");
memory->create(prePow2B_ij,leadDimInteractionList,"edip:prePow2B_ij"); memory->create(prePow2B_ij,nthreads*leadDimInteractionList,"edip:prePow2B_ij");
memory->create(preForceCoord,5*leadDimInteractionList,"edip:preForceCoord"); memory->create(preForceCoord,5*nthreads*leadDimInteractionList,"edip:preForceCoord");
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -27,14 +27,14 @@ namespace LAMMPS_NS {
class PairEDIP : public Pair { class PairEDIP : public Pair {
public: public:
PairEDIP(class LAMMPS *); PairEDIP(class LAMMPS *);
~PairEDIP(); virtual ~PairEDIP();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
void init_style(); void init_style();
private: protected:
struct Param { struct Param {
double A, B; double A, B;
double cutoffA, cutoffC, cutsq; double cutoffA, cutoffC, cutsq;

View File

@ -92,12 +92,8 @@ void PairLJShiftedForce::compute(int eflag, int vflag)
for (jj = 0; jj < jnum; jj++) { for (jj = 0; jj < jnum; jj++) {
j = jlist[jj]; j = jlist[jj];
factor_lj = special_lj[sbmask(j)];
if (j < nall) factor_lj = 1.0; j &= NEIGHMASK;
else {
factor_lj = special_lj[j/nall];
j %= nall;
}
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];

View File

@ -14,6 +14,7 @@
#include "stdlib.h" #include "stdlib.h"
#include "atom_vec_meso.h" #include "atom_vec_meso.h"
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "domain.h" #include "domain.h"
#include "modify.h" #include "modify.h"
#include "fix.h" #include "fix.h"
@ -68,12 +69,12 @@ void AtomVecMeso::grow(int n) {
image = memory->grow(atom->image, nmax, "atom:image"); image = memory->grow(atom->image, nmax, "atom:image");
x = memory->grow(atom->x, nmax, 3, "atom:x"); x = memory->grow(atom->x, nmax, 3, "atom:x");
v = memory->grow(atom->v, nmax, 3, "atom:v"); v = memory->grow(atom->v, nmax, 3, "atom:v");
f = memory->grow(atom->f, nmax, 3, "atom:f"); f = memory->grow(atom->f, nmax*comm->nthreads, 3, "atom:f");
rho = memory->grow(atom->rho, nmax, "atom:rho"); rho = memory->grow(atom->rho, nmax, "atom:rho");
drho = memory->grow(atom->drho, nmax, "atom:drho"); drho = memory->grow(atom->drho, nmax*comm->nthreads, "atom:drho");
e = memory->grow(atom->e, nmax, "atom:e"); e = memory->grow(atom->e, nmax, "atom:e");
de = memory->grow(atom->de, nmax, "atom:de"); de = memory->grow(atom->de, nmax*comm->nthreads, "atom:de");
vest = memory->grow(atom->vest, nmax, 3, "atom:vest"); vest = memory->grow(atom->vest, nmax, 3, "atom:vest");
cv = memory->grow(atom->cv, nmax, "atom:cv"); cv = memory->grow(atom->cv, nmax, "atom:cv");
@ -846,19 +847,19 @@ bigint AtomVecMeso::memory_usage() {
if (atom->memcheck("image")) if (atom->memcheck("image"))
bytes += memory->usage(image, nmax); bytes += memory->usage(image, nmax);
if (atom->memcheck("x")) if (atom->memcheck("x"))
bytes += memory->usage(x, nmax); bytes += memory->usage(x, nmax, 3);
if (atom->memcheck("v")) if (atom->memcheck("v"))
bytes += memory->usage(v, nmax); bytes += memory->usage(v, nmax, 3);
if (atom->memcheck("f")) if (atom->memcheck("f"))
bytes += memory->usage(f, nmax); bytes += memory->usage(f, nmax*comm->nthreads, 3);
if (atom->memcheck("rho")) if (atom->memcheck("rho"))
bytes += memory->usage(rho, nmax); bytes += memory->usage(rho, nmax);
if (atom->memcheck("drho")) if (atom->memcheck("drho"))
bytes += memory->usage(drho, nmax); bytes += memory->usage(drho, nmax*comm->nthreads);
if (atom->memcheck("e")) if (atom->memcheck("e"))
bytes += memory->usage(e, nmax); bytes += memory->usage(e, nmax);
if (atom->memcheck("de")) if (atom->memcheck("de"))
bytes += memory->usage(de, nmax); bytes += memory->usage(de, nmax*comm->nthreads);
if (atom->memcheck("cv")) if (atom->memcheck("cv"))
bytes += memory->usage(cv, nmax); bytes += memory->usage(cv, nmax);
if (atom->memcheck("vest")) if (atom->memcheck("vest"))

View File

@ -90,7 +90,7 @@ void AtomVecEllipsoid::grow(int n)
rmass = memory->grow(atom->rmass,nmax,"atom:rmass"); rmass = memory->grow(atom->rmass,nmax,"atom:rmass");
angmom = memory->grow(atom->angmom,nmax,3,"atom:angmom"); angmom = memory->grow(atom->angmom,nmax,3,"atom:angmom");
torque = memory->grow(atom->torque,nmax,3,"atom:torque"); torque = memory->grow(atom->torque,nmax*comm->nthreads,3,"atom:torque");
ellipsoid = memory->grow(atom->ellipsoid,nmax,"atom:ellipsoid"); ellipsoid = memory->grow(atom->ellipsoid,nmax,"atom:ellipsoid");
if (atom->nextra_grow) if (atom->nextra_grow)
@ -1250,7 +1250,7 @@ bigint AtomVecEllipsoid::memory_usage()
if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax);
if (atom->memcheck("angmom")) bytes += memory->usage(angmom,nmax,3); if (atom->memcheck("angmom")) bytes += memory->usage(angmom,nmax,3);
if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax,3); if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3);
if (atom->memcheck("ellipsoid")) bytes += memory->usage(ellipsoid,nmax); if (atom->memcheck("ellipsoid")) bytes += memory->usage(ellipsoid,nmax);
bytes += nmax_bonus*sizeof(Bonus); bytes += nmax_bonus*sizeof(Bonus);

View File

@ -102,7 +102,7 @@ void AtomVecSphere::grow(int n)
radius = memory->grow(atom->radius,nmax,"atom:radius"); radius = memory->grow(atom->radius,nmax,"atom:radius");
rmass = memory->grow(atom->rmass,nmax,"atom:rmass"); rmass = memory->grow(atom->rmass,nmax,"atom:rmass");
omega = memory->grow(atom->omega,nmax,3,"atom:omega"); omega = memory->grow(atom->omega,nmax,3,"atom:omega");
torque = memory->grow(atom->torque,nmax,3,"atom:torque"); torque = memory->grow(atom->torque,nmax*comm->nthreads,3,"atom:torque");
if (atom->nextra_grow) if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++) for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
@ -1053,7 +1053,7 @@ bigint AtomVecSphere::memory_usage()
if (atom->memcheck("radius")) bytes += memory->usage(radius,nmax); if (atom->memcheck("radius")) bytes += memory->usage(radius,nmax);
if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax);
if (atom->memcheck("omega")) bytes += memory->usage(omega,nmax,3); if (atom->memcheck("omega")) bytes += memory->usage(omega,nmax,3);
if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax,3); if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3);
return bytes; return bytes;
} }

View File

@ -206,8 +206,10 @@ void BondHybrid::settings(int narg, char **arg)
// one exception is 1st arg of style "table", which is non-numeric // one exception is 1st arg of style "table", which is non-numeric
// need a better way to skip these exceptions // need a better way to skip these exceptions
int dummy;
nstyles = 0; nstyles = 0;
i = 0; i = 0;
while (i < narg) { while (i < narg) {
for (m = 0; m < nstyles; m++) for (m = 0; m < nstyles; m++)
if (strcmp(arg[i],keywords[m]) == 0) if (strcmp(arg[i],keywords[m]) == 0)
@ -216,7 +218,7 @@ void BondHybrid::settings(int narg, char **arg)
error->all(FLERR,"Bond style hybrid cannot have hybrid as an argument"); error->all(FLERR,"Bond style hybrid cannot have hybrid as an argument");
if (strcmp(arg[i],"none") == 0) if (strcmp(arg[i],"none") == 0)
error->all(FLERR,"Bond style hybrid cannot have none as an argument"); error->all(FLERR,"Bond style hybrid cannot have none as an argument");
styles[nstyles] = force->new_bond(arg[i]); styles[nstyles] = force->new_bond(arg[i],lmp->suffix,dummy);
keywords[nstyles] = new char[strlen(arg[i])+1]; keywords[nstyles] = new char[strlen(arg[i])+1];
strcpy(keywords[nstyles],arg[i]); strcpy(keywords[nstyles],arg[i]);
istyle = i; istyle = i;
@ -319,14 +321,14 @@ void BondHybrid::read_restart(FILE *fp)
allocate(); allocate();
int n; int n,dummy;
for (int m = 0; m < nstyles; m++) { for (int m = 0; m < nstyles; m++) {
if (me == 0) fread(&n,sizeof(int),1,fp); if (me == 0) fread(&n,sizeof(int),1,fp);
MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(&n,1,MPI_INT,0,world);
keywords[m] = new char[n]; keywords[m] = new char[n];
if (me == 0) fread(keywords[m],sizeof(char),n,fp); if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_bond(keywords[m]); styles[m] = force->new_bond(keywords[m],lmp->suffix,dummy);
} }
} }

View File

@ -37,6 +37,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
timeflag = 1; timeflag = 1;
int n = strlen(arg[3]) + 1; int n = strlen(arg[3]) + 1;
if (lmp->suffix) n += strlen(lmp->suffix) + 1;
pstyle = new char[n]; pstyle = new char[n];
strcpy(pstyle,arg[3]); strcpy(pstyle,arg[3]);
@ -46,8 +47,17 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[4],"ecoul") == 0) evalue = ECOUL; if (strcmp(arg[4],"ecoul") == 0) evalue = ECOUL;
} else evalue = EPAIR; } else evalue = EPAIR;
// check if pair style with and without suffix exists
pair = force->pair_match(pstyle,1); pair = force->pair_match(pstyle,1);
if (!pair) error->all(FLERR,"Unrecognized pair style in compute pair command"); if (!pair && lmp->suffix) {
strcat(pstyle,"/");
strcat(pstyle,lmp->suffix);
pair = force->pair_match(pstyle,1);
}
if (!pair)
error->all(FLERR,"Unrecognized pair style in compute pair command");
npair = pair->nextra; npair = pair->nextra;
if (npair) { if (npair) {
@ -75,7 +85,8 @@ void ComputePair::init()
// recheck for pair style in case it has been deleted // recheck for pair style in case it has been deleted
pair = force->pair_match(pstyle,1); pair = force->pair_match(pstyle,1);
if (!pair) error->all(FLERR,"Unrecognized pair style in compute pair command"); if (!pair)
error->all(FLERR,"Unrecognized pair style in compute pair command");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -901,7 +901,7 @@ void FixBoxRelax::compute_press_target()
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
compute PV and strain energy for access to the user compute PV and strain energy for access to the user
/* ---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
double FixBoxRelax::compute_scalar() double FixBoxRelax::compute_scalar()
{ {

View File

@ -32,11 +32,11 @@ class FixGravity : public Fix {
int setmask(); int setmask();
void init(); void init();
void setup(int); void setup(int);
void post_force(int); virtual void post_force(int);
void post_force_respa(int, int, int); virtual void post_force_respa(int, int, int);
double compute_scalar(); double compute_scalar();
private: protected:
int style; int style;
double magnitude,dt; double magnitude,dt;
double phi,theta,phigrad,thetagrad; double phi,theta,phigrad,thetagrad;

View File

@ -27,13 +27,13 @@ namespace LAMMPS_NS {
class FixNVESphere : public FixNVE { class FixNVESphere : public FixNVE {
public: public:
FixNVESphere(class LAMMPS *, int, char **); FixNVESphere(class LAMMPS *, int, char **);
~FixNVESphere() {} virtual ~FixNVESphere() {}
int setmask(); int setmask();
void init(); void init();
void initial_integrate(int); virtual void initial_integrate(int);
void final_integrate(); virtual void final_integrate();
private: protected:
int extra; int extra;
}; };

View File

@ -35,7 +35,7 @@ class FixShearHistory : public Fix {
int setmask(); int setmask();
void init(); void init();
void setup_pre_exchange(); void setup_pre_exchange();
void pre_exchange(); virtual void pre_exchange();
double memory_usage(); double memory_usage();
void grow_arrays(int); void grow_arrays(int);
@ -48,7 +48,7 @@ class FixShearHistory : public Fix {
int size_restart(int); int size_restart(int);
int maxsize_restart(); int maxsize_restart();
private: protected:
int *npartner; // # of touching partners of each atom int *npartner; // # of touching partners of each atom
int **partner; // tags for the partners int **partner; // tags for the partners
double ***shearpartner; // 3 shear values with the partner double ***shearpartner; // 3 shear values with the partner

View File

@ -112,7 +112,7 @@ void Force::init()
create a pair style, called from input script or restart file create a pair style, called from input script or restart file
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Force::create_pair(const char *style, char *suffix) void Force::create_pair(const char *style, const char *suffix)
{ {
delete [] pair_style; delete [] pair_style;
if (pair) delete pair; if (pair) delete pair;
@ -137,7 +137,7 @@ void Force::create_pair(const char *style, char *suffix)
generate a pair class, first with suffix appended generate a pair class, first with suffix appended
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
Pair *Force::new_pair(const char *style, char *suffix, int &sflag) Pair *Force::new_pair(const char *style, const char *suffix, int &sflag)
{ {
if (suffix && lmp->suffix_enable) { if (suffix && lmp->suffix_enable) {
sflag = 1; sflag = 1;
@ -185,20 +185,7 @@ Pair *Force::pair_match(const char *word, int exact)
if (exact && strcmp(pair_style,word) == 0) return pair; if (exact && strcmp(pair_style,word) == 0) return pair;
else if (!exact && strstr(pair_style,word)) return pair; else if (!exact && strstr(pair_style,word)) return pair;
else if (strcmp(pair_style,"hybrid") == 0) { else if (strstr(pair_style,"hybrid/overlay")) {
PairHybrid *hybrid = (PairHybrid *) pair;
count = 0;
for (int i = 0; i < hybrid->nstyles; i++) {
if (exact && strcmp(hybrid->keywords[i],word) == 0)
return hybrid->styles[i];
if (!exact && strstr(hybrid->keywords[i],word)) {
iwhich = i;
count++;
}
}
if (!exact && count == 1) return hybrid->styles[iwhich];
} else if (strcmp(pair_style,"hybrid/overlay") == 0) {
PairHybridOverlay *hybrid = (PairHybridOverlay *) pair; PairHybridOverlay *hybrid = (PairHybridOverlay *) pair;
count = 0; count = 0;
for (int i = 0; i < hybrid->nstyles; i++) { for (int i = 0; i < hybrid->nstyles; i++) {
@ -210,6 +197,19 @@ Pair *Force::pair_match(const char *word, int exact)
} }
} }
if (!exact && count == 1) return hybrid->styles[iwhich]; if (!exact && count == 1) return hybrid->styles[iwhich];
} else if (strstr(pair_style,"hybrid")) {
PairHybrid *hybrid = (PairHybrid *) pair;
count = 0;
for (int i = 0; i < hybrid->nstyles; i++) {
if (exact && strcmp(hybrid->keywords[i],word) == 0)
return hybrid->styles[i];
if (!exact && strstr(hybrid->keywords[i],word)) {
iwhich = i;
count++;
}
}
if (!exact && count == 1) return hybrid->styles[iwhich];
} }
return NULL; return NULL;
@ -219,23 +219,50 @@ Pair *Force::pair_match(const char *word, int exact)
create a bond style, called from input script or restart file create a bond style, called from input script or restart file
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Force::create_bond(const char *style) void Force::create_bond(const char *style, const char *suffix)
{ {
delete [] bond_style; delete [] bond_style;
if (bond) delete bond; if (bond) delete bond;
bond = new_bond(style); int sflag;
bond = new_bond(style,suffix,sflag);
if (sflag) {
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
int n = strlen(estyle) + 1;
bond_style = new char[n];
strcpy(bond_style,estyle);
} else {
int n = strlen(style) + 1; int n = strlen(style) + 1;
bond_style = new char[n]; bond_style = new char[n];
strcpy(bond_style,style); strcpy(bond_style,style);
} }
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generate a bond class generate a bond class, fist with suffix appended
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
Bond *Force::new_bond(const char *style) Bond *Force::new_bond(const char *style, const char *suffix, int &sflag)
{ {
if (suffix && lmp->suffix_enable) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
if (0) return NULL;
#define BOND_CLASS
#define BondStyle(key,Class) \
else if (strcmp(estyle,#key) == 0) return new Class(lmp);
#include "style_bond.h"
#undef BondStyle
#undef BOND_CLASS
}
sflag = 0;
if (strcmp(style,"none") == 0) return NULL; if (strcmp(style,"none") == 0) return NULL;
#define BOND_CLASS #define BOND_CLASS
@ -267,23 +294,51 @@ Bond *Force::bond_match(const char *style)
create an angle style, called from input script or restart file create an angle style, called from input script or restart file
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Force::create_angle(const char *style) void Force::create_angle(const char *style, const char *suffix)
{ {
delete [] angle_style; delete [] angle_style;
if (angle) delete angle; if (angle) delete angle;
angle = new_angle(style); int sflag;
angle = new_angle(style,suffix,sflag);
if (sflag) {
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
int n = strlen(estyle) + 1;
angle_style = new char[n];
strcpy(angle_style,estyle);
} else {
int n = strlen(style) + 1; int n = strlen(style) + 1;
angle_style = new char[n]; angle_style = new char[n];
strcpy(angle_style,style); strcpy(angle_style,style);
} }
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generate an angle class generate an angle class
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
Angle *Force::new_angle(const char *style) Angle *Force::new_angle(const char *style, const char *suffix, int &sflag)
{ {
if (suffix && lmp->suffix_enable) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
if (0) return NULL;
#define ANGLE_CLASS
#define AngleStyle(key,Class) \
else if (strcmp(estyle,#key) == 0) return new Class(lmp);
#include "style_angle.h"
#undef AngleStyle
#undef ANGLE_CLASS
}
sflag = 0;
if (strcmp(style,"none") == 0) return NULL; if (strcmp(style,"none") == 0) return NULL;
#define ANGLE_CLASS #define ANGLE_CLASS
@ -300,29 +355,58 @@ Angle *Force::new_angle(const char *style)
create a dihedral style, called from input script or restart file create a dihedral style, called from input script or restart file
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Force::create_dihedral(const char *style) void Force::create_dihedral(const char *style, const char *suffix)
{ {
delete [] dihedral_style; delete [] dihedral_style;
if (dihedral) delete dihedral; if (dihedral) delete dihedral;
dihedral = new_dihedral(style); int sflag;
dihedral = new_dihedral(style,suffix,sflag);
if (sflag) {
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
int n = strlen(estyle) + 1;
dihedral_style = new char[n];
strcpy(dihedral_style,estyle);
} else {
int n = strlen(style) + 1; int n = strlen(style) + 1;
dihedral_style = new char[n]; dihedral_style = new char[n];
strcpy(dihedral_style,style); strcpy(dihedral_style,style);
} }
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generate a dihedral class generate a dihedral class
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
Dihedral *Force::new_dihedral(const char *style) Dihedral *Force::new_dihedral(const char *style, const char *suffix, int &sflag)
{ {
if (suffix && lmp->suffix_enable) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
if (0) return NULL;
#define DIHEDRAL_CLASS
#define DihedralStyle(key,Class) \
else if (strcmp(estyle,#key) == 0) return new Class(lmp);
#include "style_dihedral.h"
#undef DihedralStyle
#undef DIHEDRAL_CLASS
}
sflag = 0;
if (strcmp(style,"none") == 0) return NULL; if (strcmp(style,"none") == 0) return NULL;
#define DIHEDRAL_CLASS #define DIHEDRAL_CLASS
#define DihedralStyle(key,Class) \ #define DihedralStyle(key,Class) \
else if (strcmp(style,#key) == 0) return new Class(lmp); else if (strcmp(style,#key) == 0) return new Class(lmp);
#include "style_dihedral.h" #include "style_dihedral.h"
#undef DihedralStyle
#undef DIHEDRAL_CLASS #undef DIHEDRAL_CLASS
else error->all(FLERR,"Invalid dihedral style"); else error->all(FLERR,"Invalid dihedral style");
@ -333,23 +417,51 @@ Dihedral *Force::new_dihedral(const char *style)
create an improper style, called from input script or restart file create an improper style, called from input script or restart file
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Force::create_improper(const char *style) void Force::create_improper(const char *style, const char *suffix)
{ {
delete [] improper_style; delete [] improper_style;
if (improper) delete improper; if (improper) delete improper;
improper = new_improper(style); int sflag;
improper = new_improper(style,suffix,sflag);
if (sflag) {
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
int n = strlen(estyle) + 1;
improper_style = new char[n];
strcpy(improper_style,estyle);
} else {
int n = strlen(style) + 1; int n = strlen(style) + 1;
improper_style = new char[n]; improper_style = new char[n];
strcpy(improper_style,style); strcpy(improper_style,style);
} }
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generate a improper class generate a improper class
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
Improper *Force::new_improper(const char *style) Improper *Force::new_improper(const char *style, const char *suffix, int &sflag)
{ {
if (suffix && lmp->suffix_enable) {
sflag = 1;
char estyle[256];
sprintf(estyle,"%s/%s",style,suffix);
if (0) return NULL;
#define IMPROPER_CLASS
#define ImproperStyle(key,Class) \
else if (strcmp(estyle,#key) == 0) return new Class(lmp);
#include "style_improper.h"
#undef ImproperStyle
#undef IMPROPER_CLASS
}
sflag = 0;
if (strcmp(style,"none") == 0) return NULL; if (strcmp(style,"none") == 0) return NULL;
#define IMPROPER_CLASS #define IMPROPER_CLASS

View File

@ -69,22 +69,22 @@ class Force : protected Pointers {
~Force(); ~Force();
void init(); void init();
void create_pair(const char *, char *suffix = NULL); void create_pair(const char *, const char *suffix = NULL);
class Pair *new_pair(const char *, char *, int &); class Pair *new_pair(const char *, const char *, int &);
class Pair *pair_match(const char *, int); class Pair *pair_match(const char *, int);
void create_bond(const char *); void create_bond(const char *, const char *suffix = NULL);
class Bond *new_bond(const char *); class Bond *new_bond(const char *, const char *, int &);
class Bond *bond_match(const char *); class Bond *bond_match(const char *);
void create_angle(const char *); void create_angle(const char *, const char *suffix = NULL);
class Angle *new_angle(const char *); class Angle *new_angle(const char *, const char *, int &);
void create_dihedral(const char *); void create_dihedral(const char *, const char *suffix = NULL);
class Dihedral *new_dihedral(const char *); class Dihedral *new_dihedral(const char *, const char *, int &);
void create_improper(const char *); void create_improper(const char *, const char *suffix = NULL);
class Improper *new_improper(const char *); class Improper *new_improper(const char *, const char *, int &);
void create_kspace(int, char **); void create_kspace(int, char **);

View File

@ -834,7 +834,7 @@ void Input::angle_style()
if (narg < 1) error->all(FLERR,"Illegal angle_style command"); if (narg < 1) error->all(FLERR,"Illegal angle_style command");
if (atom->avec->angles_allow == 0) if (atom->avec->angles_allow == 0)
error->all(FLERR,"Angle_style command when no angles allowed"); error->all(FLERR,"Angle_style command when no angles allowed");
force->create_angle(arg[0]); force->create_angle(arg[0],lmp->suffix);
if (force->angle) force->angle->settings(narg-1,&arg[1]); if (force->angle) force->angle->settings(narg-1,&arg[1]);
} }
@ -875,7 +875,7 @@ void Input::bond_style()
if (narg < 1) error->all(FLERR,"Illegal bond_style command"); if (narg < 1) error->all(FLERR,"Illegal bond_style command");
if (atom->avec->bonds_allow == 0) if (atom->avec->bonds_allow == 0)
error->all(FLERR,"Bond_style command when no bonds allowed"); error->all(FLERR,"Bond_style command when no bonds allowed");
force->create_bond(arg[0]); force->create_bond(arg[0],lmp->suffix);
if (force->bond) force->bond->settings(narg-1,&arg[1]); if (force->bond) force->bond->settings(narg-1,&arg[1]);
} }
@ -937,7 +937,7 @@ void Input::dihedral_style()
if (narg < 1) error->all(FLERR,"Illegal dihedral_style command"); if (narg < 1) error->all(FLERR,"Illegal dihedral_style command");
if (atom->avec->dihedrals_allow == 0) if (atom->avec->dihedrals_allow == 0)
error->all(FLERR,"Dihedral_style command when no dihedrals allowed"); error->all(FLERR,"Dihedral_style command when no dihedrals allowed");
force->create_dihedral(arg[0]); force->create_dihedral(arg[0],lmp->suffix);
if (force->dihedral) force->dihedral->settings(narg-1,&arg[1]); if (force->dihedral) force->dihedral->settings(narg-1,&arg[1]);
} }
@ -1014,7 +1014,7 @@ void Input::improper_style()
if (narg < 1) error->all(FLERR,"Illegal improper_style command"); if (narg < 1) error->all(FLERR,"Illegal improper_style command");
if (atom->avec->impropers_allow == 0) if (atom->avec->impropers_allow == 0)
error->all(FLERR,"Improper_style command when no impropers allowed"); error->all(FLERR,"Improper_style command when no impropers allowed");
force->create_improper(arg[0]); force->create_improper(arg[0],lmp->suffix);
if (force->improper) force->improper->settings(narg-1,&arg[1]); if (force->improper) force->improper->settings(narg-1,&arg[1]);
} }

View File

@ -21,6 +21,7 @@ namespace LAMMPS_NS {
class Pair : protected Pointers { class Pair : protected Pointers {
friend class BondQuartic; friend class BondQuartic;
friend class DihedralCharmm; friend class DihedralCharmm;
friend class DihedralCharmmOMP;
friend class FixGPU; friend class FixGPU;
friend class ThrOMP; friend class ThrOMP;

View File

@ -27,8 +27,9 @@ namespace LAMMPS_NS {
class PairBorn : public Pair { class PairBorn : public Pair {
public: public:
PairBorn(class LAMMPS *); PairBorn(class LAMMPS *);
~PairBorn(); virtual ~PairBorn();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
@ -39,7 +40,7 @@ class PairBorn : public Pair {
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
void *extract(char *, int &); void *extract(char *, int &);
private: protected:
double cut_global; double cut_global;
double **cut; double **cut;
double **a,**rho,**sigma,**c, **d; double **a,**rho,**sigma,**c, **d;

View File

@ -28,7 +28,7 @@ class PairBuck : public Pair {
public: public:
PairBuck(class LAMMPS *); PairBuck(class LAMMPS *);
virtual ~PairBuck(); virtual ~PairBuck();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);

View File

@ -27,13 +27,13 @@ namespace LAMMPS_NS {
class PairCoulDebye : public PairCoulCut { class PairCoulDebye : public PairCoulCut {
public: public:
PairCoulDebye(class LAMMPS *); PairCoulDebye(class LAMMPS *);
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
private: protected:
double kappa; double kappa;
}; };

View File

@ -34,7 +34,7 @@ class PairDPDTstat : public PairDPD {
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
private: protected:
double t_start,t_stop; double t_start,t_stop;
}; };

View File

@ -27,8 +27,8 @@ namespace LAMMPS_NS {
class PairGauss : public Pair { class PairGauss : public Pair {
public: public:
PairGauss(class LAMMPS *); PairGauss(class LAMMPS *);
~PairGauss(); virtual ~PairGauss();
void compute(int,int); virtual void compute(int,int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
@ -39,7 +39,7 @@ class PairGauss : public Pair {
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
void *extract(char *, int &); void *extract(char *, int &);
private: protected:
double cut_global; double cut_global;
double **cut; double **cut;
double **a,**b; double **a,**b;

View File

@ -227,9 +227,9 @@ void PairHybrid::settings(int narg, char **arg)
// need a better way to skip these exceptions // need a better way to skip these exceptions
int dummy; int dummy;
nstyles = 0; nstyles = 0;
i = 0; i = 0;
while (i < narg) { while (i < narg) {
for (m = 0; m < nstyles; m++) for (m = 0; m < nstyles; m++)
if (strcmp(arg[i],keywords[m]) == 0) if (strcmp(arg[i],keywords[m]) == 0)
@ -238,7 +238,7 @@ void PairHybrid::settings(int narg, char **arg)
error->all(FLERR,"Pair style hybrid cannot have hybrid as an argument"); error->all(FLERR,"Pair style hybrid cannot have hybrid as an argument");
if (strcmp(arg[i],"none") == 0) if (strcmp(arg[i],"none") == 0)
error->all(FLERR,"Pair style hybrid cannot have none as an argument"); error->all(FLERR,"Pair style hybrid cannot have none as an argument");
styles[nstyles] = force->new_pair(arg[i],NULL,dummy); styles[nstyles] = force->new_pair(arg[i],lmp->suffix,dummy);
keywords[nstyles] = new char[strlen(arg[i])+1]; keywords[nstyles] = new char[strlen(arg[i])+1];
strcpy(keywords[nstyles],arg[i]); strcpy(keywords[nstyles],arg[i]);
istyle = i; istyle = i;
@ -582,7 +582,7 @@ void PairHybrid::read_restart(FILE *fp)
keywords[m] = new char[n]; keywords[m] = new char[n];
if (me == 0) fread(keywords[m],sizeof(char),n,fp); if (me == 0) fread(keywords[m],sizeof(char),n,fp);
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
styles[m] = force->new_pair(keywords[m],NULL,dummy); styles[m] = force->new_pair(keywords[m],lmp->suffix,dummy);
styles[m]->read_restart_settings(fp); styles[m]->read_restart_settings(fp);
} }
} }

View File

@ -27,8 +27,9 @@ namespace LAMMPS_NS {
class PairLJ96Cut : public Pair { class PairLJ96Cut : public Pair {
public: public:
PairLJ96Cut(class LAMMPS *); PairLJ96Cut(class LAMMPS *);
~PairLJ96Cut(); virtual ~PairLJ96Cut();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
void init_style(); void init_style();

View File

@ -27,8 +27,9 @@ namespace LAMMPS_NS {
class PairLJCubic : public Pair { class PairLJCubic : public Pair {
public: public:
PairLJCubic(class LAMMPS *); PairLJCubic(class LAMMPS *);
~PairLJCubic(); virtual ~PairLJCubic();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
@ -38,7 +39,7 @@ class PairLJCubic : public Pair {
void read_restart_settings(FILE *); void read_restart_settings(FILE *);
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
private: protected:
double **cut,**cut_inner,**cut_inner_sq; double **cut,**cut_inner,**cut_inner_sq;
double **epsilon,**sigma; double **epsilon,**sigma;
double **lj1,**lj2,**lj3,**lj4; double **lj1,**lj2,**lj3,**lj4;

View File

@ -28,7 +28,7 @@ class PairLJCutCoulDebye : public PairLJCutCoulCut {
public: public:
PairLJCutCoulDebye(class LAMMPS *); PairLJCutCoulDebye(class LAMMPS *);
virtual ~PairLJCutCoulDebye() {} virtual ~PairLJCutCoulDebye() {}
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void write_restart_settings(FILE *); void write_restart_settings(FILE *);
void read_restart_settings(FILE *); void read_restart_settings(FILE *);

View File

@ -27,8 +27,9 @@ namespace LAMMPS_NS {
class PairLJExpand : public Pair { class PairLJExpand : public Pair {
public: public:
PairLJExpand(class LAMMPS *); PairLJExpand(class LAMMPS *);
~PairLJExpand(); virtual ~PairLJExpand();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);

View File

@ -28,7 +28,7 @@ class PairLJSmooth : public Pair {
public: public:
PairLJSmooth(class LAMMPS *); PairLJSmooth(class LAMMPS *);
virtual ~PairLJSmooth(); virtual ~PairLJSmooth();
void compute(int, int); virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);

View File

@ -27,8 +27,9 @@ namespace LAMMPS_NS {
class PairMorse : public Pair { class PairMorse : public Pair {
public: public:
PairMorse(class LAMMPS *); PairMorse(class LAMMPS *);
~PairMorse(); virtual ~PairMorse();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);

View File

@ -29,8 +29,9 @@ class PairSoft : public Pair {
public: public:
PairSoft(class LAMMPS *); PairSoft(class LAMMPS *);
~PairSoft(); virtual ~PairSoft();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
@ -41,7 +42,7 @@ class PairSoft : public Pair {
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
void *extract(char *, int &); void *extract(char *, int &);
private: protected:
double PI; double PI;
double cut_global; double cut_global;
double **prefactor; double **prefactor;

View File

@ -27,8 +27,9 @@ namespace LAMMPS_NS {
class PairTable : public Pair { class PairTable : public Pair {
public: public:
PairTable(class LAMMPS *); PairTable(class LAMMPS *);
~PairTable(); virtual ~PairTable();
void compute(int, int);
virtual void compute(int, int);
void settings(int, char **); void settings(int, char **);
void coeff(int, char **); void coeff(int, char **);
double init_one(int, int); double init_one(int, int);
@ -39,8 +40,9 @@ class PairTable : public Pair {
double single(int, int, int, int, double, double, double, double &); double single(int, int, int, int, double, double, double, double &);
void *extract(char *, int &); void *extract(char *, int &);
private: protected:
int tabstyle,tablength; int tabstyle,tablength;
enum {LOOKUP=0, LINEAR=1, SPLINE=2, BITMAP=3};
struct Table { struct Table {
int ninput,rflag,fpflag,match,ntablebits; int ninput,rflag,fpflag,match,ntablebits;
int nshiftbits,nmask; int nshiftbits,nmask;

View File

@ -30,7 +30,10 @@
#include "math_extra.h" #include "math_extra.h"
#include "error.h" #include "error.h"
#include "math_const.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst;
enum{ATOM_SELECT,MOL_SELECT,TYPE_SELECT,GROUP_SELECT,REGION_SELECT}; enum{ATOM_SELECT,MOL_SELECT,TYPE_SELECT,GROUP_SELECT,REGION_SELECT};
enum{TYPE,TYPE_FRACTION,MOLECULE,X,Y,Z,CHARGE,MASS,SHAPE, enum{TYPE,TYPE_FRACTION,MOLECULE,X,Y,Z,CHARGE,MASS,SHAPE,
@ -42,13 +45,6 @@ enum{TYPE,TYPE_FRACTION,MOLECULE,X,Y,Z,CHARGE,MASS,SHAPE,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
Set::Set(LAMMPS *lmp) : Pointers(lmp)
{
PI = 4.0*atan(1.0);
}
/* ---------------------------------------------------------------------- */
void Set::command(int narg, char **arg) void Set::command(int narg, char **arg)
{ {
if (domain->box_exist == 0) if (domain->box_exist == 0)
@ -415,11 +411,11 @@ void Set::set(int keyword)
else if (keyword == DENSITY) { else if (keyword == DENSITY) {
if (atom->radius_flag && atom->radius[i] > 0.0) if (atom->radius_flag && atom->radius[i] > 0.0)
atom->rmass[i] = 4.0*PI/3.0 * atom->rmass[i] = 4.0*MY_PI*THIRD *
atom->radius[i]*atom->radius[i]*atom->radius[i] * dvalue; atom->radius[i]*atom->radius[i]*atom->radius[i] * dvalue;
else if (atom->ellipsoid_flag && atom->ellipsoid[i] >= 0) { else if (atom->ellipsoid_flag && atom->ellipsoid[i] >= 0) {
double *shape = avec_ellipsoid->bonus[atom->ellipsoid[i]].shape; double *shape = avec_ellipsoid->bonus[atom->ellipsoid[i]].shape;
atom->rmass[i] = 4.0*PI/3.0 * shape[0]*shape[1]*shape[2] * dvalue; atom->rmass[i] = 4.0*MY_PI*THIRD * shape[0]*shape[1]*shape[2] * dvalue;
} else atom->rmass[i] = dvalue; } else atom->rmass[i] = dvalue;
// reset any or all of 3 image flags // reset any or all of 3 image flags
@ -450,7 +446,7 @@ void Set::set(int keyword)
if (atom->ellipsoid[i] < 0) if (atom->ellipsoid[i] < 0)
error->one(FLERR,"Cannot set quaternion for atom that is not an ellipsoid"); error->one(FLERR,"Cannot set quaternion for atom that is not an ellipsoid");
double *quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; double *quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat;
double theta2 = 0.5 * PI * wvalue/180.0; double theta2 = MY_PI2 * wvalue/180.0;
double sintheta2 = sin(theta2); double sintheta2 = sin(theta2);
quat[0] = cos(theta2); quat[0] = cos(theta2);
quat[1] = xvalue * sintheta2; quat[1] = xvalue * sintheta2;
@ -554,8 +550,8 @@ void Set::setrandom(int keyword)
s = random->uniform(); s = random->uniform();
t1 = sqrt(1.0-s); t1 = sqrt(1.0-s);
t2 = sqrt(s); t2 = sqrt(s);
theta1 = 2.0*PI*random->uniform(); theta1 = 2.0*MY_PI*random->uniform();
theta2 = 2.0*PI*random->uniform(); theta2 = 2.0*MY_PI*random->uniform();
quat[0] = cos(theta2)*t2; quat[0] = cos(theta2)*t2;
quat[1] = sin(theta1)*t1; quat[1] = sin(theta1)*t1;
quat[2] = cos(theta1)*t1; quat[2] = cos(theta1)*t1;
@ -572,7 +568,7 @@ void Set::setrandom(int keyword)
"that is not an ellipsoid"); "that is not an ellipsoid");
quat = bonus[ellipsoid[i]].quat; quat = bonus[ellipsoid[i]].quat;
random->reset(seed,x[i]); random->reset(seed,x[i]);
theta2 = PI*random->uniform(); theta2 = MY_PI*random->uniform();
quat[0] = cos(theta2); quat[0] = cos(theta2);
quat[1] = 0.0; quat[1] = 0.0;
quat[2] = 0.0; quat[2] = 0.0;

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class Set : protected Pointers { class Set : protected Pointers {
public: public:
Set(class LAMMPS *); Set(class LAMMPS *lmp) : Pointers(lmp) {};
void command(int, char **); void command(int, char **);
private: private:

View File

@ -32,7 +32,10 @@
#include "memory.h" #include "memory.h"
#include "error.h" #include "error.h"
#include "math_const.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst;
#define VARDELTA 4 #define VARDELTA 4
#define MAXLEVEL 4 #define MAXLEVEL 4
@ -88,8 +91,6 @@ Variable::Variable(LAMMPS *lmp) : Pointers(lmp)
precedence[MULTIPLY] = precedence[DIVIDE] = 6; precedence[MULTIPLY] = precedence[DIVIDE] = 6;
precedence[CARAT] = 7; precedence[CARAT] = 7;
precedence[UNARY] = precedence[NOT] = 8; precedence[UNARY] = precedence[NOT] = 8;
PI = 4.0*atan(1.0);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -1767,7 +1768,7 @@ double Variable::collapse_tree(Tree *tree)
tree->type = VALUE; tree->type = VALUE;
if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula"); if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula");
double delta = update->ntimestep - update->beginstep; double delta = update->ntimestep - update->beginstep;
double omega = 2.0*PI/arg3; double omega = 2.0*MY_PI/arg3;
tree->value = arg1 + arg2*sin(omega*delta*update->dt); tree->value = arg1 + arg2*sin(omega*delta*update->dt);
return tree->value; return tree->value;
} }
@ -1781,7 +1782,7 @@ double Variable::collapse_tree(Tree *tree)
tree->type = VALUE; tree->type = VALUE;
if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula"); if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula");
double delta = update->ntimestep - update->beginstep; double delta = update->ntimestep - update->beginstep;
double omega = 2.0*PI/arg3; double omega = 2.0*MY_PI/arg3;
tree->value = arg1 + arg2*(1.0-cos(omega*delta*update->dt)); tree->value = arg1 + arg2*(1.0-cos(omega*delta*update->dt));
return tree->value; return tree->value;
} }
@ -1997,7 +1998,7 @@ double Variable::eval_tree(Tree *tree, int i)
arg3 = eval_tree(tree->right,i); arg3 = eval_tree(tree->right,i);
if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula"); if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula");
double delta = update->ntimestep - update->beginstep; double delta = update->ntimestep - update->beginstep;
double omega = 2.0*PI/arg3; double omega = 2.0*MY_PI/arg3;
arg = arg1 + arg2*sin(omega*delta*update->dt); arg = arg1 + arg2*sin(omega*delta*update->dt);
return arg; return arg;
} }
@ -2008,7 +2009,7 @@ double Variable::eval_tree(Tree *tree, int i)
arg3 = eval_tree(tree->right,i); arg3 = eval_tree(tree->right,i);
if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula"); if (arg3 == 0.0) error->one(FLERR,"Invalid math function in variable formula");
double delta = update->ntimestep - update->beginstep; double delta = update->ntimestep - update->beginstep;
double omega = 2.0*PI/arg3; double omega = 2.0*MY_PI/arg3;
arg = arg1 + arg2*(1.0-cos(omega*delta*update->dt)); arg = arg1 + arg2*(1.0-cos(omega*delta*update->dt));
return arg; return arg;
} }
@ -2385,7 +2386,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (value3 == 0.0) if (value3 == 0.0)
error->all(FLERR,"Invalid math function in variable formula"); error->all(FLERR,"Invalid math function in variable formula");
double delta = update->ntimestep - update->beginstep; double delta = update->ntimestep - update->beginstep;
double omega = 2.0*PI/value3; double omega = 2.0*MY_PI/value3;
double value = value1 + value2*sin(omega*delta*update->dt); double value = value1 + value2*sin(omega*delta*update->dt);
argstack[nargstack++] = value; argstack[nargstack++] = value;
} }
@ -2399,7 +2400,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (value3 == 0.0) if (value3 == 0.0)
error->all(FLERR,"Invalid math function in variable formula"); error->all(FLERR,"Invalid math function in variable formula");
double delta = update->ntimestep - update->beginstep; double delta = update->ntimestep - update->beginstep;
double omega = 2.0*PI/value3; double omega = 2.0*MY_PI/value3;
double value = value1 + value2*(1.0-cos(omega*delta*update->dt)); double value = value1 + value2*(1.0-cos(omega*delta*update->dt));
argstack[nargstack++] = value; argstack[nargstack++] = value;
} }
@ -3058,7 +3059,7 @@ int Variable::is_constant(char *word)
double Variable::constant(char *word) double Variable::constant(char *word)
{ {
if (strcmp(word,"PI") == 0) return PI; if (strcmp(word,"PI") == 0) return MY_PI;
return 0.0; return 0.0;
} }

View File

@ -35,7 +35,6 @@ class Variable : protected Pointers {
double evaluate_boolean(char *); double evaluate_boolean(char *);
private: private:
int me;
int nvar; // # of defined variables int nvar; // # of defined variables
int maxvar; // max # of variables arrays can hold int maxvar; // max # of variables arrays can hold
char **names; // name of each variable char **names; // name of each variable
@ -44,13 +43,13 @@ class Variable : protected Pointers {
int *which; // next available value for each variable int *which; // next available value for each variable
int *pad; // 1 = pad loop/uloop variables with 0s, 0 = no pad int *pad; // 1 = pad loop/uloop variables with 0s, 0 = no pad
char ***data; // str value of each variable's values char ***data; // str value of each variable's values
double PI;
class RanMars *randomequal; // random number generator for equal-style vars class RanMars *randomequal; // random number generator for equal-style vars
class RanMars *randomatom; // random number generator for atom-style vars class RanMars *randomatom; // random number generator for atom-style vars
int precedence[16]; // precedence level of math operators int precedence[16]; // precedence level of math operators
// set length to include OR in enum // set length to include OR in enum
int me;
struct Tree { // parse tree for atom-style variables struct Tree { // parse tree for atom-style variables
double value; double value;