forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13130 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
ccac6df71d
commit
bb6d9e903b
|
@ -91,6 +91,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) :
|
|||
qf = NULL;
|
||||
q1 = NULL;
|
||||
q2 = NULL;
|
||||
streitz_flag = 0;
|
||||
|
||||
comm_forward = comm_reverse = 1;
|
||||
|
||||
|
@ -105,7 +106,11 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) :
|
|||
for (int j = 0; j < nprev; ++j )
|
||||
s_hist[i][j] = t_hist[i][j] = atom->q[i];
|
||||
|
||||
read_file(arg[7]);
|
||||
if (strcmp(arg[7],"coul/streitz") == 0) {
|
||||
streitz_flag = 1;
|
||||
} else {
|
||||
read_file(arg[7]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -124,11 +129,13 @@ FixQEq::~FixQEq()
|
|||
|
||||
memory->destroy(shld);
|
||||
|
||||
memory->destroy(chi);
|
||||
memory->destroy(eta);
|
||||
memory->destroy(gamma);
|
||||
memory->destroy(zeta);
|
||||
memory->destroy(zcore);
|
||||
if (!streitz_flag) {
|
||||
memory->destroy(chi);
|
||||
memory->destroy(eta);
|
||||
memory->destroy(gamma);
|
||||
memory->destroy(zeta);
|
||||
memory->destroy(zcore);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -587,7 +594,7 @@ double FixQEq::parallel_norm( double *v, int n )
|
|||
my_sum += v[i]*v[i];
|
||||
}
|
||||
|
||||
MPI_Allreduce(&my_sum, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
MPI_Allreduce( &my_sum, &norm_sqr, 1, MPI_DOUBLE, MPI_SUM, world );
|
||||
|
||||
return sqrt( norm_sqr );
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ class FixQEq : public Fix {
|
|||
double *chi,*eta,*gamma,*zeta,*zcore; // qeq parameters
|
||||
double *chizj;
|
||||
double **shld;
|
||||
int streitz_flag;
|
||||
|
||||
bigint ngroup;
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ FixQEqSlater::FixQEqSlater(LAMMPS *lmp, int narg, char **arg) :
|
|||
iarg += 2;
|
||||
} else error->all(FLERR,"Illegal fix qeq/slater command");
|
||||
}
|
||||
|
||||
if (streitz_flag) extract();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -86,6 +88,33 @@ void FixQEqSlater::init()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixQEqSlater::extract()
|
||||
{
|
||||
int ntypes = atom->ntypes;
|
||||
|
||||
memory->create(chi,ntypes+1,"qeq:chi");
|
||||
memory->create(eta,ntypes+1,"qeq:eta");
|
||||
memory->create(gamma,ntypes+1,"qeq:gamma");
|
||||
memory->create(zeta,ntypes+1,"qeq:zeta");
|
||||
memory->create(zcore,ntypes+1,"qeq:zcore");
|
||||
|
||||
Pair *pair = force->pair_match("coul/streitz",1);
|
||||
if (pair == NULL) error->all(FLERR,"No pair coul/streitz for fix qeq/slater");
|
||||
int tmp;
|
||||
chi = (double *) pair->extract("chi",tmp);
|
||||
eta = (double *) pair->extract("eta",tmp);
|
||||
gamma = (double *) pair->extract("gamma",tmp);
|
||||
zeta = (double *) pair->extract("zeta",tmp);
|
||||
zcore = (double *) pair->extract("zcore",tmp);
|
||||
if (chi == NULL || eta == NULL || gamma == NULL
|
||||
|| zeta == NULL || zcore == NULL)
|
||||
error->all(FLERR,
|
||||
"Fix qeq/slater could not extract params from pair coul/streitz");
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixQEqSlater::pre_force(int vflag)
|
||||
{
|
||||
if (update->ntimestep % nevery) return;
|
||||
|
|
|
@ -37,6 +37,9 @@ class FixQEqSlater : public FixQEq {
|
|||
void compute_H();
|
||||
double calculate_H(double, double, double, double, double &);
|
||||
double calculate_H_wolf(double, double, double, double, double &);
|
||||
void extract();
|
||||
|
||||
class PairCoulStreitz *streitz;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue