diff -Naur lammps-6Sep09/doc/fix_ttm.html lammps-7Sep09/doc/fix_ttm.html --- lammps-6Sep09/doc/fix_ttm.html 2009-06-03 14:33:21.000000000 -0600 +++ lammps-7Sep09/doc/fix_ttm.html 2009-09-04 14:50:48.000000000 -0600 @@ -170,8 +170,20 @@
Restart, fix_modify, output, run start/stop, minimize info:
-No information about this fix is written to binary restart -files. None of the fix_modify options +
This fix writes the state of the electronic subsystem and the energy +exchange between the subsystems to binary restart +files. See the read_restart command +for info on how to re-specify a fix in an input script that reads a +restart file, so that the operation of the fix continues in an +uninterrupted fashion. +
+Because the state of the random number generator is not saved in the +restart files, this means you cannot do "exact" restarts with this +fix, where the simulation continues on the same as if no restart had +taken place. However, in a statistical sense, a restarted simulation +should produce the same behavior. +
+None of the fix_modify options
are relevant to this fix. No global scalar or vector or per-atom
quantities are stored by this fix for access by various output
commands. No parameter of this fix can be
diff -Naur lammps-6Sep09/doc/fix_ttm.txt lammps-7Sep09/doc/fix_ttm.txt
--- lammps-6Sep09/doc/fix_ttm.txt 2009-06-03 14:33:21.000000000 -0600
+++ lammps-7Sep09/doc/fix_ttm.txt 2009-09-04 14:50:48.000000000 -0600
@@ -167,8 +167,20 @@
[Restart, fix_modify, output, run start/stop, minimize info:]
-No information about this fix is written to "binary restart
-files"_restart.html. None of the "fix_modify"_fix_modify.html options
+This fix writes the state of the electronic subsystem and the energy
+exchange between the subsystems to "binary restart
+files"_restart.html. See the "read_restart"_read_restart.html command
+for info on how to re-specify a fix in an input script that reads a
+restart file, so that the operation of the fix continues in an
+uninterrupted fashion.
+
+Because the state of the random number generator is not saved in the
+restart files, this means you cannot do "exact" restarts with this
+fix, where the simulation continues on the same as if no restart had
+taken place. However, in a statistical sense, a restarted simulation
+should produce the same behavior.
+
+None of the "fix_modify"_fix_modify.html options
are relevant to this fix. No global scalar or vector or per-atom
quantities are stored by this fix for access by various "output
commands"_Section_howto.html#4_15. No parameter of this fix can be
diff -Naur lammps-6Sep09/src/MAKE/Makefile.spirit lammps-7Sep09/src/MAKE/Makefile.spirit
--- lammps-6Sep09/src/MAKE/Makefile.spirit 2009-08-12 08:38:28.000000000 -0600
+++ lammps-7Sep09/src/MAKE/Makefile.spirit 2009-09-04 14:49:04.000000000 -0600
@@ -6,7 +6,6 @@
# module load libraries/fftw-2.1.5_openmpi-1.2.2_mx_intel-9.1-f040-c045
# fi;
-
SHELL = /bin/sh
.IGNORE:
diff -Naur lammps-6Sep09/src/fix_ttm.cpp lammps-7Sep09/src/fix_ttm.cpp
--- lammps-6Sep09/src/fix_ttm.cpp 2009-07-23 12:57:26.000000000 -0600
+++ lammps-7Sep09/src/fix_ttm.cpp 2009-09-04 14:49:04.000000000 -0600
@@ -50,9 +50,11 @@
size_vector = 2;
scalar_vector_freq = 1;
extvector = 1;
- nevery = 1;
+ nevery = 1;
+ restart_peratom = 1;
+ restart_global = 1;
- int seed = atoi(arg[3]);
+ seed = atoi(arg[3]);
electronic_specific_heat = atof(arg[4]);
electronic_density = atof(arg[5]);
electronic_thermal_conductivity = atof(arg[6]);
@@ -144,7 +146,17 @@
flangevin = NULL;
grow_arrays(atom->nmax);
+
+ // zero out the flangevin array
+
+ for (int i = 0; i < atom->nmax; i++) {
+ flangevin[i][0] = 0;
+ flangevin[i][1] = 0;
+ flangevin[i][2] = 0;
+ }
+
atom->add_callback(0);
+ atom->add_callback(1);
// set initial electron temperatures from user input file
@@ -221,10 +233,10 @@
void FixTTM::setup(int vflag)
{
if (strcmp(update->integrate_style,"verlet") == 0)
- post_force(vflag);
+ post_force_setup(vflag);
else {
((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1);
- post_force_respa(vflag,nlevels_respa-1,0);
+ post_force_respa_setup(vflag,nlevels_respa-1,0);
((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1);
}
}
@@ -283,6 +295,25 @@
/* ---------------------------------------------------------------------- */
+void FixTTM::post_force_setup(int vflag)
+{
+ double **f = atom->f;
+ int *mask = atom->mask;
+ int nlocal = atom->nlocal;
+
+ // apply langevin forces that have been stored from previous run
+
+ for (int i = 0; i < nlocal; i++) {
+ if (mask[i] & groupbit) {
+ f[i][0] += flangevin[i][0];
+ f[i][1] += flangevin[i][1];
+ f[i][2] += flangevin[i][2];
+ }
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+
void FixTTM::post_force_respa(int vflag, int ilevel, int iloop)
{
if (ilevel == nlevels_respa-1) post_force(vflag);
@@ -290,6 +321,13 @@
/* ---------------------------------------------------------------------- */
+void FixTTM::post_force_respa_setup(int vflag, int ilevel, int iloop)
+{
+ if (ilevel == nlevels_respa-1) post_force_setup(vflag);
+}
+
+/* ---------------------------------------------------------------------- */
+
void FixTTM::reset_dt()
{
for (int i = 1; i <= atom->ntypes; i++)
@@ -560,3 +598,98 @@
if (n == 1) return transfer_energy;
return 0.0;
}
+
+/* ----------------------------------------------------------------------
+ pack entire state of Fix into one write
+------------------------------------------------------------------------- */
+
+void FixTTM::write_restart(FILE *fp)
+{
+
+ int n = 0;
+ double list[1 + nxnodes*nynodes*nznodes];
+
+ list[n++] = seed;
+
+ for (int ixnode = 0; ixnode < nxnodes; ixnode++)
+ for (int iynode = 0; iynode < nynodes; iynode++)
+ for (int iznode = 0; iznode < nznodes; iznode++)
+ list[n++] = T_electron[ixnode][iynode][iznode];
+
+ if (comm->me == 0) {
+ int size = n * sizeof(double);
+ fwrite(&size,sizeof(int),1,fp);
+ fwrite(&list,sizeof(double),n,fp);
+ }
+}
+
+/* ----------------------------------------------------------------------
+ use state info from restart file to restart the Fix
+------------------------------------------------------------------------- */
+
+void FixTTM::restart(char *buf)
+{
+ int n = 0;
+ double *list = (double *) buf;
+
+ // the seed must be changed from the initial seed
+ seed = static_cast