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

This commit is contained in:
sjplimp 2008-03-10 17:49:50 +00:00
parent c012684a4f
commit 6ba8c45983
5 changed files with 48 additions and 38 deletions

View File

@ -109,6 +109,7 @@ void ComputePressure::init()
dimension = domain->dimension;
// set temperature used by pressure
// must be done in init() since user can change it via modify command
int icompute = modify->find_compute(id_pre);
if (icompute < 0) error->all("Could not find compute pressure temp ID");

View File

@ -58,7 +58,6 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
flagx = flagy = flagz = 1;
for (int i = 1; i <= atom->ntypes; i++) ratio[i] = 1.0;
iregion = -1;
scalefactor = 1.0;
int iarg = 7;
while (iarg < narg) {
@ -81,11 +80,6 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
iregion = domain->find_region(arg[iarg+1]);
if (iregion == -1) error->all("Fix langevin region ID does not exist");
iarg += 2;
} else if (strcmp(arg[iarg],"weight") == 0) {
if (iarg+2 > narg) error->all("Illegal fix langevin command");
scalefactor = atof(arg[iarg+1]);
if (scalefactor <= 0.0) error->all("Illegal fix langevin command");
iarg += 2;
} else error->all("Illegal fix langevin command");
}
}
@ -121,7 +115,7 @@ void FixLangevin::init()
for (int i = 1; i <= atom->ntypes; i++) {
gfactor1[i] = - atom->mass[i] / t_period / force->ftm2v;
gfactor2[i] = scalefactor * sqrt(atom->mass[i]) *
gfactor2[i] = sqrt(atom->mass[i]) *
sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / force->ftm2v;
gfactor1[i] *= 1.0/ratio[i];
gfactor2[i] *= 1.0/sqrt(ratio[i]);
@ -210,7 +204,7 @@ void FixLangevin::reset_target(double t_new)
void FixLangevin::reset_dt()
{
for (int i = 1; i <= atom->ntypes; i++) {
gfactor2[i] = scalefactor * sqrt(atom->mass[i]) *
gfactor2[i] = sqrt(atom->mass[i]) *
sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / force->ftm2v;
gfactor2[i] *= 1.0/sqrt(ratio[i]);
}

View File

@ -34,7 +34,6 @@ class FixLangevin : public Fix {
double t_start,t_stop,t_period;
int flagx,flagy,flagz,iregion;
double *gfactor1,*gfactor2,*ratio;
double scalefactor;
int nlevels_respa;
class RanMars *random;

View File

@ -121,7 +121,8 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
rotate_dipole = NULL;
rotate_gran = NULL;
index_temp = index_press = index_pe = index_drot = index_grot = -1;
index_temp = index_press_scalar = index_press_vector = index_pe = -1;
index_drot = index_grot = -1;
internal_drot = internal_grot = 0;
id_temp = (char *) "thermo_temp";
@ -263,7 +264,8 @@ void Thermo::init()
// set ptrs to keyword-specific Compute objects
if (index_temp >= 0) temperature = computes[index_temp];
if (index_press >= 0) pressure = computes[index_press];
if (index_press_scalar >= 0) pressure = computes[index_press_scalar];
if (index_press_vector >= 0) pressure = computes[index_press_vector];
if (index_pe >= 0) pe = computes[index_pe];
if (index_drot >= 0) rotate_dipole = computes[index_drot];
if (index_grot >= 0) rotate_gran = computes[index_grot];
@ -400,7 +402,7 @@ void Thermo::modify_params(int narg, char **arg)
id_compute[index_temp] = new char[n];
strcpy(id_compute[index_temp],arg[iarg+1]);
int icompute = modify->find_compute(id_compute[index_temp]);
int icompute = modify->find_compute(arg[iarg+1]);
if (icompute < 0) error->all("Could not find thermo_modify temp ID");
temperature = modify->compute[icompute];
@ -412,8 +414,11 @@ void Thermo::modify_params(int narg, char **arg)
// reset id_pre of pressure to new temp ID
// either pressure currently being used by thermo or "thermo_press"
if (index_press >= 0) {
icompute = modify->find_compute(id_compute[index_press]);
if (index_press_scalar >= 0) {
icompute = modify->find_compute(id_compute[index_press_scalar]);
if (icompute < 0) error->all("Press ID for thermo does not exist");
} else if (index_press_vector >= 0) {
icompute = modify->find_compute(id_compute[index_press_vector]);
if (icompute < 0) error->all("Press ID for thermo does not exist");
} else icompute = modify->find_compute((char *) "thermo_press");
@ -425,13 +430,23 @@ void Thermo::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"press") == 0) {
if (iarg+2 > narg) error->all("Illegal thermo_modify command");
if (index_press < 0) error->all("Thermo style does not use press");
delete [] id_compute[index_press];
int n = strlen(arg[iarg+1]) + 1;
id_compute[index_press] = new char[n];
strcpy(id_compute[index_press],arg[iarg+1]);
if (index_press_scalar < 0 && index_press_vector < 0)
error->all("Thermo style does not use press");
int icompute = modify->find_compute(id_compute[index_press]);
if (index_press_scalar >= 0) {
delete [] id_compute[index_press_scalar];
int n = strlen(arg[iarg+1]) + 1;
id_compute[index_press_scalar] = new char[n];
strcpy(id_compute[index_press_scalar],arg[iarg+1]);
}
if (index_press_vector >= 0) {
delete [] id_compute[index_press_vector];
int n = strlen(arg[iarg+1]) + 1;
id_compute[index_press_vector] = new char[n];
strcpy(id_compute[index_press_vector],arg[iarg+1]);
}
int icompute = modify->find_compute(arg[iarg+1]);
if (icompute < 0) error->all("Could not find thermo_modify press ID");
pressure = modify->compute[icompute];
@ -629,7 +644,7 @@ void Thermo::parse_fields(char *str)
index_temp = add_compute(id_temp,0);
} else if (strcmp(word,"press") == 0) {
addfield("Press",&Thermo::compute_press,FLOAT);
index_press = add_compute(id_press,0);
index_press_scalar = add_compute(id_press,0);
} else if (strcmp(word,"pe") == 0) {
addfield("PotEng",&Thermo::compute_pe,FLOAT);
index_pe = add_compute(id_pe,0);
@ -643,7 +658,7 @@ void Thermo::parse_fields(char *str)
} else if (strcmp(word,"enthalpy") == 0) {
addfield("Enthalpy",&Thermo::compute_enthalpy,FLOAT);
index_temp = add_compute(id_temp,0);
index_press = add_compute(id_press,0);
index_press_scalar = add_compute(id_press,0);
index_pe = add_compute(id_pe,0);
} else if (strcmp(word,"evdwl") == 0) {
@ -708,22 +723,22 @@ void Thermo::parse_fields(char *str)
} else if (strcmp(word,"pxx") == 0) {
addfield("Pxx",&Thermo::compute_pxx,FLOAT);
index_press = add_compute(id_press,1);
index_press_vector = add_compute(id_press,1);
} else if (strcmp(word,"pyy") == 0) {
addfield("Pyy",&Thermo::compute_pyy,FLOAT);
index_press = add_compute(id_press,1);
index_press_vector = add_compute(id_press,1);
} else if (strcmp(word,"pzz") == 0) {
addfield("Pzz",&Thermo::compute_pzz,FLOAT);
index_press = add_compute(id_press,1);
index_press_vector = add_compute(id_press,1);
} else if (strcmp(word,"pxy") == 0) {
addfield("Pxy",&Thermo::compute_pxy,FLOAT);
index_press = add_compute(id_press,1);
index_press_vector = add_compute(id_press,1);
} else if (strcmp(word,"pxz") == 0) {
addfield("Pxz",&Thermo::compute_pxz,FLOAT);
index_press = add_compute(id_press,1);
index_press_vector = add_compute(id_press,1);
} else if (strcmp(word,"pyz") == 0) {
addfield("Pyz",&Thermo::compute_pyz,FLOAT);
index_press = add_compute(id_press,1);
index_press_vector = add_compute(id_press,1);
} else if (strcmp(word,"drot") == 0) {
addfield("RotKEdip",&Thermo::compute_drot,FLOAT);

View File

@ -69,23 +69,24 @@ class Thermo : protected Pointers {
// internal = 1/0 if Thermo created them or not
// id = ID of Compute objects
// Compute * = ptrs to the Compute objects
int index_temp,index_press,index_pe,index_drot,index_grot;
int index_temp,index_press_scalar,index_press_vector,index_pe;
int index_drot,index_grot;
int internal_drot,internal_grot;
char *id_temp,*id_press,*id_pe,*id_drot,*id_grot;
class Compute *temperature,*pressure,*pe,*rotate_dipole,*rotate_gran;
int ncompute; // # of Compute objects called by thermo
char **id_compute; // their IDs
int *compute_which; // 0/1/2 if should call scalar() or vector() or both
int ncompute; // # of Compute objects called by thermo
char **id_compute; // their IDs
int *compute_which; // 0/1 if should call scalar() or vector()
class Compute **computes; // list of ptrs to the Compute objects
int nfix; // # of Fix objects called by thermo
char **id_fix; // their IDs
class Fix **fixes; // list of ptrs to the Fix objects
int nfix; // # of Fix objects called by thermo
char **id_fix; // their IDs
class Fix **fixes; // list of ptrs to the Fix objects
int nvariable; // # of variables evaulated by thermo
char **id_variable; // list of variable names
int *variables; // list of Variable indices
int nvariable; // # of variables evaulated by thermo
char **id_variable; // list of variable names
int *variables; // list of Variable indices
// private methods