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

This commit is contained in:
sjplimp 2007-10-10 22:22:16 +00:00
parent d914548318
commit 0f3f037edc
53 changed files with 233 additions and 69 deletions

View File

@ -39,14 +39,6 @@ FixNPTASphere::FixNPTASphere(LAMMPS *lmp, int narg, char **arg) :
"quat, angmom, torque");
}
/* ---------------------------------------------------------------------- */
void FixNPTASphere::init()
{
FixNPT::init();
dtq = 0.5 * update->dt;
}
/* ----------------------------------------------------------------------
1st half of Verlet update
------------------------------------------------------------------------- */

View File

@ -22,12 +22,10 @@ class FixNPTASphere : public FixNPT {
public:
FixNPTASphere(class LAMMPS *, int, char **);
~FixNPTASphere() {}
void init();
void initial_integrate();
void final_integrate();
private:
double dtq;
double ang_factor;
void richardson(double *, double *, double *);

View File

@ -34,9 +34,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
FixNVEASphere::FixNVEASphere(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
FixNVE(lmp, narg, arg)
{
if (narg < 3) error->all("Illegal fix nve/asphere command");
if (!atom->quat_flag || !atom->angmom_flag || !atom->torque_flag)
error->all("Fix nve/asphere requires atom attributes "
"quat, angmom, torque");
@ -53,22 +52,9 @@ FixNVEASphere::~FixNVEASphere()
/* ---------------------------------------------------------------------- */
int FixNVEASphere::setmask()
{
int mask = 0;
mask |= INITIAL_INTEGRATE;
mask |= FINAL_INTEGRATE;
return mask;
}
/* ---------------------------------------------------------------------- */
void FixNVEASphere::init()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
FixNVE::init();
calculate_inertia();
}

View File

@ -14,21 +14,19 @@
#ifndef FIX_NVE_ASPHERE_H
#define FIX_NVE_ASPHERE_H
#include "fix.h"
#include "fix_nve.h"
namespace LAMMPS_NS {
class FixNVEASphere : public Fix {
class FixNVEASphere : public FixNVE {
public:
FixNVEASphere(class LAMMPS *, int, char **);
~FixNVEASphere();
int setmask();
void init();
void initial_integrate();
void final_integrate();
private:
double dtv,dtf,dtq;
double **inertia;
void richardson(double *, double *, double *);

View File

@ -43,14 +43,6 @@ FixNVTASphere::FixNVTASphere(LAMMPS *lmp, int narg, char **arg) :
/* ---------------------------------------------------------------------- */
void FixNVTASphere::init()
{
FixNVT::init();
dtq = 0.5 * update->dt;
}
/* ---------------------------------------------------------------------- */
void FixNVTASphere::initial_integrate()
{
double dtfm;

View File

@ -22,13 +22,10 @@ class FixNVTASphere : public FixNVT {
public:
FixNVTASphere(class LAMMPS *, int, char **);
~FixNVTASphere() {}
void init();
void initial_integrate();
void final_integrate();
private:
double dtq;
void richardson(double *, double *, double *);
void omega_from_mq(double *, double *, double *, double *);
void calculate_inertia(double mass, double *shape, double *inertia);

View File

@ -187,3 +187,12 @@ void FixNVEDipole::final_integrate_respa(int ilevel)
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
final_integrate();
}
/* ---------------------------------------------------------------------- */
void FixNVEDipole::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
}

View File

@ -28,6 +28,7 @@ class FixNVEDipole : public Fix {
void final_integrate();
void initial_integrate_respa(int,int);
void final_integrate_respa(int);
void reset_dt();
private:
double dtv,dtf;

View File

@ -126,3 +126,14 @@ void FixNVEGran::final_integrate()
}
}
}
/* ---------------------------------------------------------------------- */
void FixNVEGran::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
if (domain->dimension == 3) dtfrotate = dtf / INERTIA3D;
else dtfrotate = dtf / INERTIA2D;
}

View File

@ -25,6 +25,7 @@ class FixNVEGran : public Fix {
void init();
void initial_integrate();
void final_integrate();
void reset_dt();
private:
double dtv,dtf,dtfrotate;

View File

@ -550,3 +550,10 @@ void FixPour::xyz_random(double h, double *coord)
coord[2] = 0.0;
}
}
/* ---------------------------------------------------------------------- */
void FixPour::reset_dt()
{
error->all("Cannot change timestep with fix pour");
}

View File

@ -29,6 +29,7 @@ class FixPour : public Fix {
int setmask();
void init();
void pre_exchange();
void reset_dt();
private:
int ninsert,ntype,seed;

View File

@ -748,3 +748,13 @@ int FixWallGran::size_restart(int nlocal)
{
return 4;
}
/* ---------------------------------------------------------------------- */
void FixWallGran::reset_dt()
{
dt = update->dt;
double gammas = 0.5*gamman;
gamman_dl = gamman/dt;
gammas_dl = gammas/dt;
}

View File

@ -36,6 +36,7 @@ class FixWallGran : public Fix {
void unpack_restart(int, int);
int size_restart(int);
int maxsize_restart();
void reset_dt();
private:
int wallstyle,pairstyle,wiggle,axis;

View File

@ -499,3 +499,14 @@ void *PairGranHistory::extract(char *str)
else if (strcmp(str,"dampflag") == 0) return (void *) &dampflag;
return NULL;
}
/* ---------------------------------------------------------------------- */
void PairGranHistory::reset_dt()
{
dt = update->dt;
double gammas = 0.5*gamman;
if (dampflag == 0) gammas = 0.0;
gamman_dl = gamman/dt;
gammas_dl = gammas/dt;
}

View File

@ -33,6 +33,7 @@ class PairGranHistory : public Pair {
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
void *extract(char *);
void reset_dt();
protected:
double xkk,xkkt,xmu;

View File

@ -1580,3 +1580,12 @@ int FixPOEMS::unpack_exchange(int nlocal, double *buf)
displace[nlocal][2] = buf[m++];
return m;
}
/* ---------------------------------------------------------------------- */
void FixPOEMS::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dthalf = 0.5 * update->dt;
}

View File

@ -41,6 +41,7 @@ class FixPOEMS : public Fix {
void pre_neighbor();
int dof(int);
void deform(int);
void reset_dt();
private:
int me;

View File

@ -39,6 +39,7 @@ class Fix : protected Pointers {
int vector_flag; // 0/1 if compute_vector() function exists
int size_vector; // N = size of global vector
int scalar_vector_freq; // frequency compute s/v data is available at
int extensive; // 0/1 if s/v are intensive/extensive values
int peratom_flag; // 0/1 if per-atom data is stored
int size_peratom; // 0 = scalar_atom, N = size of vector_atom
@ -103,6 +104,7 @@ class Fix : protected Pointers {
virtual int dof(int) {return 0;}
virtual void deform(int) {}
virtual void reset_dt() {}
virtual int modify_param(int, char **) {return 0;}

View File

@ -42,6 +42,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
extensive = 1;
k = atof(arg[3]);

View File

@ -49,6 +49,7 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) :
box_change = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
extensive = 1;
double p_period[3];
if (strcmp(arg[3],"xyz") == 0) {

View File

@ -48,6 +48,7 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) :
box_change = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
extensive = 1;
t_start = atof(arg[3]);
t_stop = atof(arg[4]);
@ -273,8 +274,8 @@ void FixNPT::init()
// set timesteps and frequencies
dtv = update->dt;
dtq = 0.5 * update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
dthalf = 0.5 * update->dt;
double freq = MAX(p_freq[0],p_freq[1]);
@ -825,3 +826,17 @@ double FixNPT::compute_scalar()
return energy;
}
/* ---------------------------------------------------------------------- */
void FixNPT::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
dthalf = 0.5 * update->dt;
double freq = MAX(p_freq[0],p_freq[1]);
freq = MAX(freq,p_freq[2]);
drag_factor = 1.0 - (update->dt * freq * drag);
}

View File

@ -23,7 +23,7 @@ class FixNPT : public Fix {
FixNPT(class LAMMPS *, int, char **);
virtual ~FixNPT();
int setmask();
virtual void init();
void init();
void setup();
virtual void initial_integrate();
virtual void final_integrate();
@ -33,10 +33,11 @@ class FixNPT : public Fix {
void write_restart(FILE *);
void restart(char *);
int modify_param(int, char **);
void reset_dt();
protected:
int dimension;
double dtv,dtq,dtf,dthalf;
double dtv,dtf,dtq,dthalf;
double boltz,nktv2p;
double vol0;

View File

@ -48,6 +48,7 @@ void FixNVE::init()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
if (strcmp(update->integrate_style,"respa") == 0)
step_respa = ((Respa *) update->integrate)->step;
@ -154,3 +155,12 @@ void FixNVE::final_integrate_respa(int ilevel)
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
final_integrate();
}
/* ---------------------------------------------------------------------- */
void FixNVE::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
}

View File

@ -22,14 +22,15 @@ class FixNVE : public Fix {
public:
FixNVE(class LAMMPS *, int, char **);
int setmask();
void init();
void initial_integrate();
void final_integrate();
virtual void init();
virtual void initial_integrate();
virtual void final_integrate();
void initial_integrate_respa(int, int);
void final_integrate_respa(int);
void reset_dt();
private:
double dtv,dtf;
protected:
double dtv,dtf,dtq;
double *step_respa;
int mass_require;
};

View File

@ -193,3 +193,12 @@ void FixNVELimit::final_integrate_respa(int ilevel)
dtf = 0.5 * step_respa[ilevel] * force->ftm2v;
final_integrate();
}
/* ---------------------------------------------------------------------- */
void FixNVELimit::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
vlimitsq = (xlimit/dtv) * (xlimit/dtv);
}

View File

@ -27,6 +27,7 @@ class FixNVELimit : public Fix {
void final_integrate();
void initial_integrate_respa(int, int);
void final_integrate_respa(int);
void reset_dt();
private:
double dtv,dtf;

View File

@ -77,3 +77,10 @@ void FixNVENoforce::initial_integrate_respa(int ilevel, int flag)
if (ilevel == 0) initial_integrate();
}
/* ---------------------------------------------------------------------- */
void FixNVENoforce::reset_dt()
{
dtv = update->dt;
}

View File

@ -25,6 +25,7 @@ class FixNVENoforce : public Fix {
void init();
void initial_integrate();
void initial_integrate_respa(int, int);
void reset_dt();
private:
double dtv;

View File

@ -41,6 +41,7 @@ FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) :
restart_global = 1;
scalar_flag = 1;
scalar_vector_freq = 1;
extensive = 1;
t_start = atof(arg[3]);
t_stop = atof(arg[4]);
@ -71,9 +72,12 @@ FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) :
char **newarg = new char*[3];
newarg[0] = id_temp;
newarg[1] = group->names[igroup];
if (strcmp(style,"nvt") == 0) newarg[2] = (char *) "temp";
else if (strcmp(style,"nvt/asphere") == 0) newarg[2] = (char *) "temp/asphere";
else if (strcmp(style,"nvt/sllod") == 0) newarg[2] = (char *) "temp/deform";
if (strcmp(style,"nvt") == 0)
newarg[2] = (char *) "temp";
else if (strcmp(style,"nvt/asphere") == 0)
newarg[2] = (char *) "temp/asphere";
else if (strcmp(style,"nvt/sllod") == 0)
newarg[2] = (char *) "temp/deform";
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
@ -117,6 +121,7 @@ void FixNVT::init()
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
dthalf = 0.5 * update->dt;
drag_factor = 1.0 - (update->dt * t_freq * drag);
@ -379,6 +384,18 @@ void FixNVT::reset_target(double t_new)
/* ---------------------------------------------------------------------- */
void FixNVT::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
dthalf = 0.5 * update->dt;
drag_factor = 1.0 - (update->dt * t_freq * drag);
}
/* ---------------------------------------------------------------------- */
double FixNVT::compute_scalar()
{
double ke = temperature->dof * force->boltz * t_target;

View File

@ -23,7 +23,7 @@ class FixNVT : public Fix {
FixNVT(class LAMMPS *, int, char **);
virtual ~FixNVT();
int setmask();
virtual void init();
void init();
void setup();
virtual void initial_integrate();
virtual void final_integrate();
@ -34,13 +34,14 @@ class FixNVT : public Fix {
void restart(char *);
int modify_param(int, char **);
void reset_target(double);
void reset_dt();
protected:
double t_start,t_stop;
double t_current,t_target;
double t_freq,drag,drag_factor;
double f_eta,eta_dot,eta,factor;
double dtv,dtf,dthalf;
double dtv,dtf,dtq,dthalf;
int nlevels_respa;
double *step_respa;

View File

@ -48,6 +48,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1;
scalar_vector_freq = 1;
extensive = 1;
nstats = atoi(arg[3]);
direction_of_motion = atoi(arg[4]);

View File

@ -1472,3 +1472,12 @@ int FixRigid::unpack_exchange(int nlocal, double *buf)
displace[nlocal][2] = buf[3];
return 4;
}
/* ---------------------------------------------------------------------- */
void FixRigid::reset_dt()
{
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
dtq = 0.5 * update->dt;
}

View File

@ -39,6 +39,7 @@ class FixRigid : public Fix {
void pre_neighbor();
int dof(int);
void deform(int);
void reset_dt();
private:
double dtv,dtf,dtq;

View File

@ -31,6 +31,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
extensive = 1;
flagx = flagy = flagz = 1;
if (strcmp(arg[3],"NULL") == 0) flagx = 0;

View File

@ -2306,3 +2306,17 @@ void FixShake::unpack_comm(int n, int first, double *buf)
xshake[i][2] = buf[m++];
}
}
/* ---------------------------------------------------------------------- */
void FixShake::reset_dt()
{
if (strcmp(update->integrate_style,"verlet") == 0) {
dtv = update->dt;
dtfsq = update->dt * update->dt * force->ftm2v;
} else {
dtv = step_respa[0];
dtf_innerhalf = 0.5 * step_respa[0] * force->ftm2v;
dtf_inner = step_respa[0] * force->ftm2v;
}
}

View File

@ -38,6 +38,7 @@ class FixShake : public Fix {
void unpack_comm(int, int, double *);
int dof(int);
void reset_dt();
private:
int me,nprocs;

View File

@ -42,6 +42,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
scalar_flag = 1;
scalar_vector_freq = nevery;
extensive = 1;
t_start = atof(arg[4]);
t_end = atof(arg[5]);

View File

@ -169,11 +169,8 @@ void FixTMD::init()
dtv = update->dt;
dtf = update->dt * force->ftm2v;
if (strcmp(update->integrate_style,"respa") == 0) {
double *step_respa = ((Respa *) update->integrate)->step;
dtv = step_respa[0];
dtf = step_respa[0] * force->ftm2v;
}
if (strcmp(update->integrate_style,"respa") == 0)
step_respa = ((Respa *) update->integrate)->step;
}
/* ---------------------------------------------------------------------- */
@ -184,7 +181,7 @@ void FixTMD::initial_integrate()
double dx,dy,dz,dxkt,dykt,dzkt;
double dxold,dyold,dzold,xback,yback,zback;
double gamma_forward,gamma_back,gamma_max,lambda;
double kt,fr,kttotal,frtotal;
double kt,fr,kttotal,frtotal,dtfm;
double xprd = domain->xprd;
double yprd = domain->yprd;
@ -322,6 +319,10 @@ void FixTMD::initial_integrate()
void FixTMD::initial_integrate_respa(int ilevel, int flag)
{
if (flag) return; // only used by NPT,NPH
dtv = step_respa[ilevel];
dtf = step_respa[ilevel] * force->ftm2v;
if (ilevel == 0) initial_integrate();
}
@ -538,3 +539,11 @@ void FixTMD::open(char *file)
error->one(str);
}
}
/* ---------------------------------------------------------------------- */
void FixTMD::reset_dt()
{
dtv = update->dt;
dtf = update->dt * force->ftm2v;
}

View File

@ -33,13 +33,15 @@ class FixTMD : public Fix {
void copy_arrays(int, int);
int pack_exchange(int, double *);
int unpack_exchange(int, double *);
void reset_dt();
private:
int me;
int nfileevery,previous_stat;
FILE *fp;
double rho_start,rho_stop,rho_old,masstotal;
double dtv,dtf,dtfm;
double dtv,dtf;
double *step_respa;
double work_lambda,work_analytical;
double **xf,**xold;

View File

@ -39,6 +39,7 @@ FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
extensive = 1;
if (strcmp(arg[3],"xlo") == 0) {
dim = 0;

View File

@ -35,6 +35,7 @@ FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
scalar_vector_freq = 1;
extensive = 1;
if (strcmp(arg[3],"xlo") == 0) {
dim = 0;
@ -192,5 +193,3 @@ double FixWallLJ93::compute_vector(int n)
}
return wall_all[n];
}

View File

@ -175,3 +175,11 @@ int FixWiggle::unpack_exchange(int nlocal, double *buf)
original[nlocal] = buf[0];
return 1;
}
/* ---------------------------------------------------------------------- */
void FixWiggle::reset_dt()
{
dt = update->dt;
}

View File

@ -32,6 +32,7 @@ class FixWiggle : public Fix {
void copy_arrays(int, int);
int pack_exchange(int, double *);
int unpack_exchange(int, double *);
void reset_dt();
private:
double dt;

View File

@ -27,6 +27,7 @@ class Integrate : protected Pointers {
virtual void iterate(int) = 0;
virtual void cleanup() {}
virtual double memory_usage() {return 0.0;}
virtual void reset_dt() {}
};
}

View File

@ -97,6 +97,7 @@ class Pair : protected Pointers {
virtual void *extract(char *) {return NULL;}
virtual void single_embed(int, int, double &) {}
virtual void swap_eam(double *, double **) {}
virtual void reset_dt() {}
protected:
int allocated; // 0/1 = whether arrays are allocated

View File

@ -617,3 +617,10 @@ void *PairHybrid::extract(char *str)
if (strcmp(str,"cut_coul") == 0) return cutptr;
return NULL;
}
/* ---------------------------------------------------------------------- */
void PairHybrid::reset_dt()
{
for (int m = 0; m < nstyles; m++) styles[m]->reset_dt();
}

View File

@ -43,6 +43,7 @@ class PairHybrid : public Pair {
void compute_middle();
void compute_outer(int, int);
void *extract(char *);
void reset_dt();
protected:
int **nmap; // # of sub-styles itype,jtype points to

View File

@ -443,6 +443,15 @@ void Respa::cleanup()
/* ---------------------------------------------------------------------- */
void Respa::reset_dt()
{
step[nlevels-1] = update->dt;
for (int ilevel = nlevels-2; ilevel >= 0; ilevel--)
step[ilevel] = step[ilevel+1]/loop[ilevel];
}
/* ---------------------------------------------------------------------- */
void Respa::recurse(int ilevel)
{
copy_flevel_f(ilevel);

View File

@ -39,6 +39,7 @@ class Respa : public Integrate {
void setup();
void iterate(int);
void cleanup();
void reset_dt();
void copy_f_flevel(int);
void copy_flevel_f(int);

View File

@ -144,9 +144,10 @@ DumpStyle(xyz,DumpXYZ)
#include "fix_ave_spatial.h"
#include "fix_ave_time.h"
#include "fix_com.h"
#include "fix_drag.h"
#include "fix_deform.h"
#include "fix_deposit.h"
#include "fix_drag.h"
#include "fix_dt_reset.h"
#include "fix_efield.h"
#include "fix_enforce2d.h"
#include "fix_gravity.h"
@ -194,9 +195,10 @@ FixStyle(aveforce,FixAveForce)
FixStyle(ave/spatial,FixAveSpatial)
FixStyle(ave/time,FixAveTime)
FixStyle(com,FixCOM)
FixStyle(drag,FixDrag)
FixStyle(deform,FixDeform)
FixStyle(deposit,FixDeposit)
FixStyle(drag,FixDrag)
FixStyle(dt/reset,FixDtReset)
FixStyle(efield,FixEfield)
FixStyle(enforce2d,FixEnforce2D)
FixStyle(gravity,FixGravity)

View File

@ -41,8 +41,10 @@ FixStyle(npt/asphere,FixNPTASphere)
#ifdef PairInclude
#include "pair_gayberne.h"
#include "pair_resquared.h"
#endif
#ifdef PairClass
PairStyle(gayberne,PairGayBerne)
PairStyle(resquared,PairRESquared)
#endif

View File

@ -1015,8 +1015,7 @@ int Thermo::evaluate_keyword(char *word, double *answer)
extraction of Compute, Fix, Variable results
ignore thermoflag, since these 3 routines only called by Thermo::compute(),
not by variable evaluation
compute value is normalized by atoms if returning extensive quantities
fix value is normalized (so should return extensive quantity)
compute/fix are normalized by atoms if returning extensive value(s)
variable value is not normalized (so formula should normalize if desired)
------------------------------------------------------------------------- */
@ -1027,7 +1026,7 @@ void Thermo::compute_compute()
int index = field2object[ifield];
if (arg_object[ifield] == 0) dvalue = computes[index]->scalar;
else dvalue = computes[index]->vector[arg_object[ifield]-1];
if (computes[index]->extensive && normflag) dvalue /= natoms;
if (normflag && computes[index]->extensive) dvalue /= natoms;
}
/* ---------------------------------------------------------------------- */
@ -1037,7 +1036,7 @@ void Thermo::compute_fix()
int index = field2object[ifield];
if (arg_object[ifield] == 0) dvalue = fixes[index]->compute_scalar();
else dvalue = fixes[index]->compute_vector(arg_object[ifield]-1);
if (normflag) dvalue /= natoms;
if (normflag && fixes[index]->extensive) dvalue /= natoms;
}
/* ---------------------------------------------------------------------- */