update/correct extract function

This commit is contained in:
Axel Kohlmeyer
2021-08-21 20:31:02 -04:00
parent 1c7bf82930
commit 384330aff2
7 changed files with 25 additions and 14 deletions

View File

@ -485,3 +485,14 @@ void PairLJCutDipoleCut::read_restart_settings(FILE *fp)
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
}
/* ---------------------------------------------------------------------- */
void *PairLJCutDipoleCut::extract(const char *str, int &dim)
{
dim = 2;
if (strcmp(str,"cut_coul") == 0) return (void *) cut_coul;
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
if (strcmp(str,"sigma") == 0) return (void *) sigma;
return nullptr;
}

View File

@ -37,6 +37,7 @@ class PairLJCutDipoleCut : public Pair {
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
void *extract(const char *, int &);
protected:
double cut_lj_global, cut_coul_global;

View File

@ -540,18 +540,18 @@ void PairLJCutDipoleLong::read_restart_settings(FILE *fp)
void *PairLJCutDipoleLong::extract(const char *str, int &dim)
{
if (strcmp(str,"cut_coul") == 0) {
dim = 0;
return (void *) &cut_coul;
} else if (strcmp(str,"ewald_order") == 0) {
dim = 0;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
else if (strcmp(str,"ewald_order") == 0) {
ewald_order = 0;
ewald_order |= 1<<1;
ewald_order |= 1<<3;
dim = 0;
return (void *) &ewald_order;
} else if (strcmp(str,"ewald_mix") == 0) {
dim = 0;
return (void *) &mix_flag;
}
} else if (strcmp(str,"ewald_mix") == 0) return (void *) &mix_flag;
dim = 2;
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
else if (strcmp(str,"sigma") == 0) return (void *) sigma;
return nullptr;
}

View File

@ -40,6 +40,7 @@ class PairLJCutDipoleLong : public Pair {
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
void *extract(const char *, int &);
protected:
double cut_lj_global;
@ -49,7 +50,6 @@ class PairLJCutDipoleLong : public Pair {
double **lj1, **lj2, **lj3, **lj4, **offset;
double g_ewald;
int ewald_order;
virtual void *extract(const char *, int &);
void allocate();
};

View File

@ -489,7 +489,7 @@ double PairNMCutCoulCut::single(int i, int j, int itype, int jtype,
void *PairNMCutCoulCut::extract(const char *str, int &dim)
{
dim = 2;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
if (strcmp(str,"cut_coul") == 0) return (void *) cut_coul;
if (strcmp(str,"e0") == 0) return (void *) e0;
if (strcmp(str,"r0") == 0) return (void *) r0;
if (strcmp(str,"nn") == 0) return (void *) nn;

View File

@ -77,8 +77,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
setflag = nullptr;
cutsq = nullptr;
ewaldflag = pppmflag = msmflag = dispersionflag =
tip4pflag = dipoleflag = spinflag = 0;
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0;
reinitflag = 1;
centroidstressflag = CENTROID_SAME;

View File

@ -465,7 +465,7 @@ double PairLJCutCoulCut::single(int i, int j, int itype, int jtype,
void *PairLJCutCoulCut::extract(const char *str, int &dim)
{
dim = 2;
if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
if (strcmp(str,"cut_coul") == 0) return (void *) cut_coul;
if (strcmp(str,"epsilon") == 0) return (void *) epsilon;
if (strcmp(str,"sigma") == 0) return (void *) sigma;
return nullptr;