forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10479 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
641726ecd7
commit
d8b1c15247
|
@ -33,6 +33,10 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) :
|
||||||
{
|
{
|
||||||
if (narg < 4) error->all(FLERR,"Illegal fix external command");
|
if (narg < 4) error->all(FLERR,"Illegal fix external command");
|
||||||
|
|
||||||
|
scalar_flag = 1;
|
||||||
|
global_freq = 1;
|
||||||
|
extscalar = 1;
|
||||||
|
|
||||||
if (strcmp(arg[3],"pf/callback") == 0) {
|
if (strcmp(arg[3],"pf/callback") == 0) {
|
||||||
if (narg != 6) error->all(FLERR,"Illegal fix external command");
|
if (narg != 6) error->all(FLERR,"Illegal fix external command");
|
||||||
mode = PF_CALLBACK;
|
mode = PF_CALLBACK;
|
||||||
|
@ -55,6 +59,8 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) :
|
||||||
fexternal = NULL;
|
fexternal = NULL;
|
||||||
grow_arrays(atom->nmax);
|
grow_arrays(atom->nmax);
|
||||||
atom->add_callback(0);
|
atom->add_callback(0);
|
||||||
|
|
||||||
|
user_energy = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
@ -75,6 +81,7 @@ int FixExternal::setmask()
|
||||||
int mask = 0;
|
int mask = 0;
|
||||||
if (mode == PF_CALLBACK || mode == PF_ARRAY) {
|
if (mode == PF_CALLBACK || mode == PF_ARRAY) {
|
||||||
mask |= POST_FORCE;
|
mask |= POST_FORCE;
|
||||||
|
mask |= THERMO_ENERGY;
|
||||||
mask |= MIN_POST_FORCE;
|
mask |= MIN_POST_FORCE;
|
||||||
}
|
}
|
||||||
return mask;
|
return mask;
|
||||||
|
@ -138,6 +145,23 @@ void FixExternal::min_post_force(int vflag)
|
||||||
post_force(vflag);
|
post_force(vflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void FixExternal::set_energy(double eng)
|
||||||
|
{
|
||||||
|
user_energy = eng;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
potential energy of added force
|
||||||
|
up to user to set it via set_energy()
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double FixExternal::compute_scalar()
|
||||||
|
{
|
||||||
|
return user_energy;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
memory usage of local atom-based array
|
memory usage of local atom-based array
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace LAMMPS_NS {
|
||||||
|
|
||||||
class FixExternal : public Fix {
|
class FixExternal : public Fix {
|
||||||
public:
|
public:
|
||||||
|
double **fexternal;
|
||||||
|
|
||||||
FixExternal(class LAMMPS *, int, char **);
|
FixExternal(class LAMMPS *, int, char **);
|
||||||
~FixExternal();
|
~FixExternal();
|
||||||
int setmask();
|
int setmask();
|
||||||
|
@ -34,6 +36,9 @@ class FixExternal : public Fix {
|
||||||
void min_setup(int);
|
void min_setup(int);
|
||||||
void post_force(int);
|
void post_force(int);
|
||||||
void min_post_force(int);
|
void min_post_force(int);
|
||||||
|
double compute_scalar();
|
||||||
|
|
||||||
|
void set_energy(double eng);
|
||||||
|
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
void grow_arrays(int);
|
void grow_arrays(int);
|
||||||
|
@ -48,7 +53,7 @@ class FixExternal : public Fix {
|
||||||
int mode,ncall,napply;
|
int mode,ncall,napply;
|
||||||
FnPtr callback;
|
FnPtr callback;
|
||||||
void *ptr_caller;
|
void *ptr_caller;
|
||||||
double **fexternal;
|
double user_energy;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue