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

This commit is contained in:
sjplimp
2015-01-20 23:17:36 +00:00
parent 600f264675
commit 31731fd1ce
4 changed files with 27 additions and 7 deletions

View File

@ -76,10 +76,18 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
memory->create(coords,3*natoms,"dump:coords"); memory->create(coords,3*natoms,"dump:coords");
// sfactor = conversion of coords to XTC units // sfactor = conversion of coords to XTC units
// GROMACS standard is nanometers, not Angstroms // tfactor = conversion of simulation time to XTC units
// GROMACS standard is nanometers and picoseconds
sfactor = 0.1; sfactor = 0.1 / force->angstrom;
if (strcmp(update->unit_style,"lj") == 0) sfactor = 1.0; tfactor = 0.001 / force->femtosecond;
// in reduced units we do not scale anything
if (strcmp(update->unit_style,"lj") == 0) {
sfactor = tfactor = 1.0;
error->warning(FLERR,"No automatic unit conversion to XTC file "
"format conventions possible for 'units lj'");
}
openfile(); openfile();
nevery_save = 0; nevery_save = 0;
@ -160,7 +168,7 @@ void DumpXTC::write_header(bigint nbig)
xdr_int(&xd,&tmp); xdr_int(&xd,&tmp);
xdr_int(&xd,&n); xdr_int(&xd,&n);
xdr_int(&xd,&ntimestep); xdr_int(&xd,&ntimestep);
float time_value = ntimestep * update->dt; float time_value = ntimestep * tfactor * update->dt;
xdr_float(&xd,&time_value); xdr_float(&xd,&time_value);
// cell basis vectors // cell basis vectors
@ -280,6 +288,18 @@ int DumpXTC::modify_param(int narg, char **arg)
(fabs(precision-1000000.0) > EPS)) (fabs(precision-1000000.0) > EPS))
error->all(FLERR,"Illegal dump_modify command"); error->all(FLERR,"Illegal dump_modify command");
return 2; return 2;
} else if (strcmp(arg[0],"sfactor") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
sfactor = force->numeric(FLERR,arg[1]);
if (sfactor <= 0.0)
error->all(FLERR,"Illegal dump_modify sfactor value (must be >0.0)");
return 2;
} else if (strcmp(arg[0],"tfactor") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
tfactor = force->numeric(FLERR,arg[1]);
if (tfactor <= 0.0)
error->all(FLERR,"Illegal dump_modify tfactor value (must be >0.0)");
return 2;
} }
return 0; return 0;
} }

View File

@ -42,7 +42,7 @@ class DumpXTC : public Dump {
int unwrap_flag; // 1 if atom coords are unwrapped, 0 if no int unwrap_flag; // 1 if atom coords are unwrapped, 0 if no
float precision; // user-adjustable precision setting float precision; // user-adjustable precision setting
float *coords; float *coords;
double sfactor; double sfactor,tfactor; // scaling factors for positions and time unit
XDR xd; XDR xd;
void init_style(); void init_style();

View File

@ -101,7 +101,7 @@ void CreateBonds::command(int narg, char **arg)
if (force->special_lj[1] != 0.0 || force->special_coul[1] != 0.0) if (force->special_lj[1] != 0.0 || force->special_coul[1] != 0.0)
error->all(FLERR,"Create_bonds command requires " error->all(FLERR,"Create_bonds command requires "
"special_bonds 1-2 weights be 0.0"); "special_bonds 1-2 weights be 0.0");
if (force->kspace_style) if (force->kspace)
error->all(FLERR,"Create_bonds command requires " error->all(FLERR,"Create_bonds command requires "
"no kspace_style be defined"); "no kspace_style be defined");

View File

@ -235,7 +235,7 @@ void Update::set_units(const char *style)
force->hhmrr2e = 0.0; force->hhmrr2e = 0.0;
force->mvh2r = 0.0; force->mvh2r = 0.0;
force->angstrom = 1.88972612; force->angstrom = 1.88972612;
force->femtosecond = 0.0241888428; force->femtosecond = 41.34137413;
force->qelectron = 1.0; force->qelectron = 1.0;
dt = 0.001; dt = 0.001;