mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2937 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
b58c43a5ec
commit
c318361d2f
|
@ -31,6 +31,8 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
@ -159,7 +161,10 @@ double ComputeTempAsphere::compute_scalar()
|
|||
invoked_scalar = update->ntimestep;
|
||||
|
||||
if (tempbias) {
|
||||
if (tbias->invoked_scalar != update->ntimestep) tbias->compute_scalar();
|
||||
if (!(tbias->invoked_flag & INVOKED_SCALAR)) {
|
||||
tbias->compute_scalar();
|
||||
tbias->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
tbias->remove_bias_all();
|
||||
}
|
||||
|
||||
|
@ -216,7 +221,10 @@ void ComputeTempAsphere::compute_vector()
|
|||
invoked_vector = update->ntimestep;
|
||||
|
||||
if (tempbias) {
|
||||
if (tbias->invoked_vector != update->ntimestep) tbias->compute_vector();
|
||||
if (!(tbias->invoked_flag & INVOKED_VECTOR)) {
|
||||
tbias->compute_vector();
|
||||
tbias->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
tbias->remove_bias_all();
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||
pressatomflag = peatomflag = 0;
|
||||
tempbias = 0;
|
||||
|
||||
id_pre = NULL;
|
||||
timeflag = 0;
|
||||
comm_forward = comm_reverse = 0;
|
||||
|
||||
|
@ -87,7 +86,6 @@ Compute::~Compute()
|
|||
{
|
||||
delete [] id;
|
||||
delete [] style;
|
||||
delete [] id_pre;
|
||||
|
||||
memory->sfree(tlist);
|
||||
}
|
||||
|
@ -129,6 +127,13 @@ void Compute::reset_extra_dof()
|
|||
extra_dof = domain->dimension;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Compute::reset_extra_compute(char *)
|
||||
{
|
||||
error->all("Compute does not allow an extra compute to be reset");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
add ntimestep to list of timesteps the compute will be called on
|
||||
do not add if already in list
|
||||
|
|
|
@ -47,14 +47,12 @@ class Compute : protected Pointers {
|
|||
|
||||
int tempbias; // 0/1 if Compute temp includes self/extra bias
|
||||
|
||||
char *id_pre; // ID of pre-compute the Compute may store
|
||||
|
||||
int timeflag; // 1 if Compute stores list of timesteps it's called on
|
||||
int ntime; // # of entries in time list
|
||||
int maxtime; // max # of entries time list can hold
|
||||
int *tlist; // time list of steps the Compute is called on
|
||||
|
||||
int invoked_flag; // 1 if invoked or accessed this step, 0 if not
|
||||
int invoked_flag; // non-zero if invoked or accessed this step, 0 if not
|
||||
int invoked_scalar; // last timestep on which compute_scalar() was invoked
|
||||
int invoked_vector; // ditto for compute_vector()
|
||||
int invoked_peratom; // ditto for compute_peratom()
|
||||
|
@ -86,6 +84,8 @@ class Compute : protected Pointers {
|
|||
virtual void restore_bias(int, double *) {}
|
||||
virtual void restore_bias_all() {}
|
||||
|
||||
virtual void reset_extra_compute(char *);
|
||||
|
||||
void addstep(int);
|
||||
int matchstep(int);
|
||||
void clearstep();
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
@ -50,10 +52,10 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
|
|||
// insure it is valid for temperature computation
|
||||
|
||||
int n = strlen(arg[3]) + 1;
|
||||
id_pre = new char[n];
|
||||
strcpy(id_pre,arg[3]);
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,arg[3]);
|
||||
|
||||
int icompute = modify->find_compute(id_pre);
|
||||
int icompute = modify->find_compute(id_temp);
|
||||
if (icompute < 0) error->all("Could not find compute pressure temp ID");
|
||||
if (modify->compute[icompute]->tempflag == 0)
|
||||
error->all("Compute pressure temp ID does not compute temperature");
|
||||
|
@ -98,6 +100,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) :
|
|||
|
||||
ComputePressure::~ComputePressure()
|
||||
{
|
||||
delete [] id_temp;
|
||||
delete [] vector;
|
||||
delete [] vptr;
|
||||
}
|
||||
|
@ -113,7 +116,7 @@ void ComputePressure::init()
|
|||
// set temperature compute, must be done in init()
|
||||
// fixes could have changed or compute_modify could have changed it
|
||||
|
||||
int icompute = modify->find_compute(id_pre);
|
||||
int icompute = modify->find_compute(id_temp);
|
||||
if (icompute < 0) error->all("Could not find compute pressure temp ID");
|
||||
temperature = modify->compute[icompute];
|
||||
|
||||
|
@ -169,9 +172,10 @@ double ComputePressure::compute_scalar()
|
|||
|
||||
double t;
|
||||
if (keflag) {
|
||||
if (temperature->invoked_scalar == update->ntimestep)
|
||||
t = temperature->scalar;
|
||||
else t = temperature->compute_scalar();
|
||||
if (!(temperature->invoked_flag & INVOKED_SCALAR)) {
|
||||
t = temperature->compute_scalar();
|
||||
temperature->invoked_flag |= INVOKED_SCALAR;
|
||||
} else t = temperature->scalar;
|
||||
}
|
||||
|
||||
if (dimension == 3) {
|
||||
|
@ -210,8 +214,10 @@ void ComputePressure::compute_vector()
|
|||
|
||||
double *ke_tensor;
|
||||
if (keflag) {
|
||||
if (temperature->invoked_vector != update->ntimestep)
|
||||
if (!(temperature->invoked_flag & INVOKED_VECTOR)) {
|
||||
temperature->compute_vector();
|
||||
temperature->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
ke_tensor = temperature->vector;
|
||||
}
|
||||
|
||||
|
@ -269,3 +275,13 @@ void ComputePressure::virial_compute(int n, int ndiag)
|
|||
if (force->pair && force->pair->tail_flag)
|
||||
for (i = 0; i < ndiag; i++) virial[i] += force->pair->ptail * inv_volume;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ComputePressure::reset_extra_compute(char *id_new)
|
||||
{
|
||||
delete [] id_temp;
|
||||
int n = strlen(id_new) + 1;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id_new);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ class ComputePressure : public Compute {
|
|||
void init();
|
||||
double compute_scalar();
|
||||
void compute_vector();
|
||||
void reset_extra_compute(char *);
|
||||
|
||||
private:
|
||||
double boltz,nktv2p,inv_volume;
|
||||
|
@ -32,6 +33,7 @@ class ComputePressure : public Compute {
|
|||
double **vptr;
|
||||
double *kspace_virial;
|
||||
Compute *temperature;
|
||||
char *id_temp;
|
||||
double virial[6];
|
||||
int keflag,pairflag,bondflag,angleflag,dihedralflag,improperflag;
|
||||
int fixflag,kspaceflag;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
#define INERTIA 0.4 // moment of inertia for sphere
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -240,7 +242,10 @@ double ComputeTempSphere::compute_scalar()
|
|||
invoked_scalar = update->ntimestep;
|
||||
|
||||
if (tempbias) {
|
||||
if (tbias->invoked_scalar != update->ntimestep) tbias->compute_scalar();
|
||||
if (!(tbias->invoked_flag & INVOKED_SCALAR)) {
|
||||
tbias->compute_scalar();
|
||||
tbias->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
tbias->remove_bias_all();
|
||||
}
|
||||
|
||||
|
@ -324,7 +329,10 @@ void ComputeTempSphere::compute_vector()
|
|||
invoked_vector = update->ntimestep;
|
||||
|
||||
if (tempbias) {
|
||||
if (tbias->invoked_vector != update->ntimestep) tbias->compute_vector();
|
||||
if (!(tbias->invoked_flag & INVOKED_VECTOR)) {
|
||||
tbias->compute_vector();
|
||||
tbias->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
tbias->remove_bias_all();
|
||||
}
|
||||
|
||||
|
|
|
@ -466,13 +466,11 @@ int FixBoxRelax::modify_param(int narg, char **arg)
|
|||
if (temperature->igroup != 0 && comm->me == 0)
|
||||
error->warning("Temperature for fix modify is not for group all");
|
||||
|
||||
// reset id_pre of pressure to new temp ID
|
||||
// reset id_temp of pressure to new temp ID
|
||||
|
||||
icompute = modify->find_compute(id_press);
|
||||
if (icompute < 0) error->all("Pressure ID for fix modify does not exist");
|
||||
delete [] modify->compute[icompute]->id_pre;
|
||||
modify->compute[icompute]->id_pre = new char[n];
|
||||
strcpy(modify->compute[icompute]->id_pre,id_temp);
|
||||
modify->compute[icompute]->reset_extra_compute(id_temp);
|
||||
|
||||
return 2;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NONE,SPHERE,CYLINDER,PLANE};
|
||||
enum{INSIDE,OUTSIDE};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
@ -48,14 +49,6 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
|
|||
|
||||
k = atof(arg[3]);
|
||||
|
||||
// set defaults
|
||||
|
||||
istyle = NONE;
|
||||
vx = vy = vz = 0.0;
|
||||
radflag = 0;
|
||||
r0_start = 0.0;
|
||||
scaleflag = 1;
|
||||
|
||||
// read options from end of input line
|
||||
|
||||
options(narg-4,&arg[4]);
|
||||
|
@ -198,9 +191,14 @@ void FixIndent::post_force(int vflag)
|
|||
dely = x[i][1] - y1;
|
||||
delz = x[i][2] - z1;
|
||||
r = sqrt(delx*delx + dely*dely + delz*delz);
|
||||
dr = r - r0;
|
||||
if (side == OUTSIDE) {
|
||||
dr = r - r0;
|
||||
fmag = k*dr*dr;
|
||||
} else {
|
||||
dr = r0 - r;
|
||||
fmag = -k*dr*dr;
|
||||
}
|
||||
if (dr >= 0.0) continue;
|
||||
fmag = k*dr*dr;
|
||||
fx = delx*fmag/r;
|
||||
fy = dely*fmag/r;
|
||||
fz = delz*fmag/r;
|
||||
|
@ -255,9 +253,14 @@ void FixIndent::post_force(int vflag)
|
|||
delz = 0;
|
||||
}
|
||||
r = sqrt(delx*delx + dely*dely + delz*delz);
|
||||
dr = r - r0;
|
||||
if (side == OUTSIDE) {
|
||||
dr = r - r0;
|
||||
fmag = k*dr*dr;
|
||||
} else {
|
||||
dr = r0 - r;
|
||||
fmag = -k*dr*dr;
|
||||
}
|
||||
if (dr >= 0.0) continue;
|
||||
fmag = k*dr*dr;
|
||||
fx = delx*fmag/r;
|
||||
fy = dely*fmag/r;
|
||||
fz = delz*fmag/r;
|
||||
|
@ -353,6 +356,13 @@ void FixIndent::options(int narg, char **arg)
|
|||
{
|
||||
if (narg < 0) error->all("Illegal fix indent command");
|
||||
|
||||
istyle = NONE;
|
||||
vx = vy = vz = 0.0;
|
||||
radflag = 0;
|
||||
r0_start = 0.0;
|
||||
scaleflag = 1;
|
||||
side = OUTSIDE;
|
||||
|
||||
int iarg = 0;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"sphere") == 0) {
|
||||
|
@ -403,6 +413,12 @@ void FixIndent::options(int narg, char **arg)
|
|||
else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1;
|
||||
else error->all("Illegal fix indent command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"side") == 0) {
|
||||
if (iarg+2 > narg) error->all("Illegal fix indent command");
|
||||
if (strcmp(arg[iarg+1],"in") == 0) side = INSIDE;
|
||||
else if (strcmp(arg[iarg+1],"out") == 0) side = OUTSIDE;
|
||||
else error->all("Illegal fix indent command");
|
||||
iarg += 2;
|
||||
} else error->all("Illegal fix indent command");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class FixIndent : public Fix {
|
|||
double compute_vector(int);
|
||||
|
||||
private:
|
||||
int istyle,scaleflag,radflag,thermo_flag,eflag_enable;
|
||||
int istyle,scaleflag,radflag,thermo_flag,eflag_enable,side;
|
||||
double k,k3;
|
||||
double x0,y0,z0,r0_stop,r0_start,planepos;
|
||||
int indenter_flag,planeside;
|
||||
|
|
|
@ -816,13 +816,11 @@ int FixNPH::modify_param(int narg, char **arg)
|
|||
if (temperature->igroup != 0 && comm->me == 0)
|
||||
error->warning("Temperature for NPH is not for group all");
|
||||
|
||||
// reset id_pre of pressure to new temp ID
|
||||
// reset id_temp of pressure to new temp ID
|
||||
|
||||
icompute = modify->find_compute(id_press);
|
||||
if (icompute < 0) error->all("Press ID for fix npt does not exist");
|
||||
delete [] modify->compute[icompute]->id_pre;
|
||||
modify->compute[icompute]->id_pre = new char[n];
|
||||
strcpy(modify->compute[icompute]->id_pre,id_temp);
|
||||
modify->compute[icompute]->reset_extra_compute(id_temp);
|
||||
|
||||
return 2;
|
||||
|
||||
|
|
|
@ -957,13 +957,11 @@ int FixNPT::modify_param(int narg, char **arg)
|
|||
if (temperature->igroup != 0 && comm->me == 0)
|
||||
error->warning("Temperature for fix modify is not for group all");
|
||||
|
||||
// reset id_pre of pressure to new temp ID
|
||||
// reset id_temp of pressure to new temp ID
|
||||
|
||||
icompute = modify->find_compute(id_press);
|
||||
if (icompute < 0) error->all("Pressure ID for fix modify does not exist");
|
||||
delete [] modify->compute[icompute]->id_pre;
|
||||
modify->compute[icompute]->id_pre = new char[n];
|
||||
strcpy(modify->compute[icompute]->id_pre,id_temp);
|
||||
modify->compute[icompute]->reset_extra_compute(id_temp);
|
||||
|
||||
return 2;
|
||||
|
||||
|
|
|
@ -438,13 +438,12 @@ int FixPressBerendsen::modify_param(int narg, char **arg)
|
|||
if (temperature->igroup != 0 && comm->me == 0)
|
||||
error->warning("Temperature for NPT is not for group all");
|
||||
|
||||
// reset id_pre of pressure to new temp ID
|
||||
// reset id_temp of pressure to new temp ID
|
||||
|
||||
icompute = modify->find_compute(id_press);
|
||||
if (icompute < 0) error->all("Press ID for fix press/berendsen does not exist");
|
||||
delete [] modify->compute[icompute]->id_pre;
|
||||
modify->compute[icompute]->id_pre = new char[n];
|
||||
strcpy(modify->compute[icompute]->id_pre,id_temp);
|
||||
if (icompute < 0)
|
||||
error->all("Press ID for fix press/berendsen does not exist");
|
||||
modify->compute[icompute]->reset_extra_compute(id_temp);
|
||||
|
||||
return 2;
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef ComputeInclude
|
||||
#include "compute_ackland_atom.h"
|
||||
#endif
|
||||
|
||||
#ifdef ComputeClass
|
||||
ComputeStyle(ackland/atom,ComputeAcklandAtom)
|
||||
#endif
|
|
@ -1,30 +0,0 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef KSpaceInclude
|
||||
#include "ewald_n.h"
|
||||
#endif
|
||||
|
||||
#ifdef KSpaceClass
|
||||
KSpaceStyle(ewald/n,EwaldN)
|
||||
#endif
|
||||
|
||||
#ifdef PairInclude
|
||||
#include "pair_buck_coul.h"
|
||||
#include "pair_lj_coul.h"
|
||||
#endif
|
||||
|
||||
#ifdef PairClass
|
||||
PairStyle(buck/coul,PairBuckCoul)
|
||||
PairStyle(lj/coul,PairLJCoul)
|
||||
#endif
|
|
@ -380,7 +380,7 @@ void Thermo::modify_params(int narg, char **arg)
|
|||
if (temperature->igroup != 0 && comm->me == 0)
|
||||
error->warning("Temperature for thermo pressure is not for group all");
|
||||
|
||||
// reset id_pre of pressure to new temp ID
|
||||
// reset id_temp of pressure to new temp ID
|
||||
// either pressure currently being used by thermo or "thermo_press"
|
||||
|
||||
if (index_press_scalar >= 0) {
|
||||
|
@ -391,9 +391,7 @@ void Thermo::modify_params(int narg, char **arg)
|
|||
if (icompute < 0) error->all("Press ID for thermo does not exist");
|
||||
} else icompute = modify->find_compute((char *) "thermo_press");
|
||||
|
||||
delete [] modify->compute[icompute]->id_pre;
|
||||
modify->compute[icompute]->id_pre = new char[n];
|
||||
strcpy(modify->compute[icompute]->id_pre,arg[iarg+1]);
|
||||
modify->compute[icompute]->reset_extra_compute(arg[iarg+1]);
|
||||
|
||||
iarg += 2;
|
||||
|
||||
|
|
Loading…
Reference in New Issue