diff -Naur lammps-19Aug09/doc/fix_indent.html lammps-21Aug09/doc/fix_indent.html --- lammps-19Aug09/doc/fix_indent.html 2009-08-08 12:43:01.000000000 -0600 +++ lammps-21Aug09/doc/fix_indent.html 2009-08-19 11:24:02.000000000 -0600 @@ -95,12 +95,12 @@

If the vel keyword is specified, the center (or axis or position) of the spherical (or cylindrical or planar) indenter will move during the -simulation, based on its initial position (x,y,z) and the specified -(vx,vy,vz). Note that if you do multiple runs, the initial position -of the indenter (x,y,z) does not change, so it will continue to move -at the specified velocity. For periodic systems and spherical or -cylindrical indenters, the new position of the center or axis is -wrapped back into the periodic box as needed. +simulation, based on its initial position (x,y,z), the specified +(vx,vy,vz), and the time elapsed since the beginning of the +simulation. For periodic systems and spherical or cylindrical +indenters, the new position of the center or axis is wrapped back into +the periodic box as needed. See the note below about making the +indenter move continuously across multiple runs.

If the rstart keyword is specified, then the radius of the indenter is a time-dependent quantity. This only applies to spherical or @@ -108,6 +108,8 @@ run; R is the value at the end. At intermediate times, the radius is linearly interpolated between these two values. This option can be used, for example, to grow/shrink a void within the simulation box. +See the note below about making the radius change continuously across +multiple runs.

If the side keyword is specified as out, which is the default, then particles outside the indenter are pushded away from its outer @@ -148,7 +150,9 @@

This fix can adjust the indenter position and radius over multiple runs, using the start and stop keywords of the run command. See the run command for details of how to do -this. +this. If you do not do this, the indenter position and readius will +be reset to their specified initial values at the beginning of each +run.

The forces due to this fix are imposed during an energy minimization, invoked by the minimize command. The rstart keyword diff -Naur lammps-19Aug09/doc/fix_indent.txt lammps-21Aug09/doc/fix_indent.txt --- lammps-19Aug09/doc/fix_indent.txt 2009-08-08 12:43:01.000000000 -0600 +++ lammps-21Aug09/doc/fix_indent.txt 2009-08-19 11:24:02.000000000 -0600 @@ -86,12 +86,12 @@ If the {vel} keyword is specified, the center (or axis or position) of the spherical (or cylindrical or planar) indenter will move during the -simulation, based on its initial position (x,y,z) and the specified -(vx,vy,vz). Note that if you do multiple runs, the initial position -of the indenter (x,y,z) does not change, so it will continue to move -at the specified velocity. For periodic systems and spherical or -cylindrical indenters, the new position of the center or axis is -wrapped back into the periodic box as needed. +simulation, based on its initial position (x,y,z), the specified +(vx,vy,vz), and the time elapsed since the beginning of the +simulation. For periodic systems and spherical or cylindrical +indenters, the new position of the center or axis is wrapped back into +the periodic box as needed. See the note below about making the +indenter move continuously across multiple runs. If the {rstart} keyword is specified, then the radius of the indenter is a time-dependent quantity. This only applies to spherical or @@ -99,6 +99,8 @@ run; R is the value at the end. At intermediate times, the radius is linearly interpolated between these two values. This option can be used, for example, to grow/shrink a void within the simulation box. +See the note below about making the radius change continuously across +multiple runs. If the {side} keyword is specified as {out}, which is the default, then particles outside the indenter are pushded away from its outer @@ -139,7 +141,9 @@ This fix can adjust the indenter position and radius over multiple runs, using the {start} and {stop} keywords of the "run"_run.html command. See the "run"_run.html command for details of how to do -this. +this. If you do not do this, the indenter position and readius will +be reset to their specified initial values at the beginning of each +run. The forces due to this fix are imposed during an energy minimization, invoked by the "minimize"_minimize.html command. The {rstart} keyword diff -Naur lammps-19Aug09/doc/fix_wall_lj126.html lammps-21Aug09/doc/fix_wall_lj126.html --- lammps-19Aug09/doc/fix_wall_lj126.html 2008-10-06 08:33:34.000000000 -0600 +++ lammps-21Aug09/doc/fix_wall_lj126.html 2009-08-19 11:25:25.000000000 -0600 @@ -61,12 +61,12 @@ interaction is 0.0 at the cutoff distance.

If the vel keyword is specified, the position of wall will move -during the simulation, based on its initial position (coord) and the -specified velocity (vel). Xlo or xhi walls move in the x -direction with whatever sign you give the v argument. Ditto for y -and z walls. Note that if you do multiple runs, the initial -position of the wall does not change, so it will continue to move at -the specified velocity. +during the simulation, based on its initial position (coord), the +specified velocity (vel), and the time elapsed since the beginning of +the simulation. Xlo or xhi walls move in the x direction with +whatever sign you give the v argument. Ditto for y and z walls. +See the note below about making the wall move continuously across +multiple runs.

Restart, fix_modify, output, run start/stop, minimize info:

@@ -84,8 +84,10 @@ calculated by this fix are "extensive", meaning they scale with the number of atoms in the simulation.

-

No parameter of this fix can be used with the start/stop keywords of -the run command. +

This fix can change the position of the wall, due to the vel +keyword, continuously over multiple runs, using the start and stop +keywords of the run command. If you do not do this, the +wall position will be reset to coord at the beginning of each run.

The forces due to this fix are imposed during an energy minimization, invoked by the minimize command. diff -Naur lammps-19Aug09/doc/fix_wall_lj126.txt lammps-21Aug09/doc/fix_wall_lj126.txt --- lammps-19Aug09/doc/fix_wall_lj126.txt 2008-10-06 08:33:34.000000000 -0600 +++ lammps-21Aug09/doc/fix_wall_lj126.txt 2009-08-19 11:25:25.000000000 -0600 @@ -48,12 +48,12 @@ interaction is 0.0 at the cutoff distance. If the {vel} keyword is specified, the position of wall will move -during the simulation, based on its initial position (coord) and the -specified velocity (vel). {Xlo} or {xhi} walls move in the x -direction with whatever sign you give the {v} argument. Ditto for {y} -and {z} walls. Note that if you do multiple runs, the initial -position of the wall does not change, so it will continue to move at -the specified velocity. +during the simulation, based on its initial position (coord), the +specified velocity (vel), and the time elapsed since the beginning of +the simulation. {Xlo} or {xhi} walls move in the x direction with +whatever sign you give the {v} argument. Ditto for {y} and {z} walls. +See the note below about making the wall move continuously across +multiple runs. [Restart, fix_modify, output, run start/stop, minimize info:] @@ -71,8 +71,10 @@ calculated by this fix are "extensive", meaning they scale with the number of atoms in the simulation. -No parameter of this fix can be used with the {start/stop} keywords of -the "run"_run.html command. +This fix can change the position of the wall, due to the {vel} +keyword, continuously over multiple runs, using the {start} and {stop} +keywords of the "run"_run.html command. If you do not do this, the +wall position will be reset to {coord} at the beginning of each run. The forces due to this fix are imposed during an energy minimization, invoked by the "minimize"_minimize.html command. diff -Naur lammps-19Aug09/doc/fix_wall_lj93.html lammps-21Aug09/doc/fix_wall_lj93.html --- lammps-19Aug09/doc/fix_wall_lj93.html 2008-10-06 08:33:34.000000000 -0600 +++ lammps-21Aug09/doc/fix_wall_lj93.html 2009-08-19 11:24:02.000000000 -0600 @@ -62,12 +62,12 @@ interaction is 0.0 at the cutoff distance.

If the vel keyword is specified, the position of wall will move -during the simulation, based on its initial position (coord) and the -specified velocity (vel). Xlo or xhi walls move in the x -direction with whatever sign you give the v argument. Ditto for y -and z walls. Note that if you do multiple runs, the initial -position of the wall does not change, so it will continue to move at -the specified velocity. +during the simulation, based on its initial position (coord), the +specified velocity (vel), and the time elapsed since the beginning of +the simulation. Xlo or xhi walls move in the x direction with +whatever sign you give the v argument. Ditto for y and z walls. +See the note below about making the wall move continuously across +multiple runs.

Restart, fix_modify, output, run start/stop, minimize info:

@@ -85,8 +85,10 @@ calculated by this fix are "extensive", meaning they scale with the number of atoms in the simulation.

-

No parameter of this fix can be used with the start/stop keywords of -the run command. +

This fix can change the position of the wall, due to the vel +keyword, continuously over multiple runs, using the start and stop +keywords of the run command. If you do not do this, the +wall position will be reset to coord at the beginning of each run.

The forces due to this fix are imposed during an energy minimization, invoked by the minimize command. diff -Naur lammps-19Aug09/doc/fix_wall_lj93.txt lammps-21Aug09/doc/fix_wall_lj93.txt --- lammps-19Aug09/doc/fix_wall_lj93.txt 2008-10-06 08:33:34.000000000 -0600 +++ lammps-21Aug09/doc/fix_wall_lj93.txt 2009-08-19 11:24:02.000000000 -0600 @@ -49,12 +49,12 @@ interaction is 0.0 at the cutoff distance. If the {vel} keyword is specified, the position of wall will move -during the simulation, based on its initial position (coord) and the -specified velocity (vel). {Xlo} or {xhi} walls move in the x -direction with whatever sign you give the {v} argument. Ditto for {y} -and {z} walls. Note that if you do multiple runs, the initial -position of the wall does not change, so it will continue to move at -the specified velocity. +during the simulation, based on its initial position (coord), the +specified velocity (vel), and the time elapsed since the beginning of +the simulation. {Xlo} or {xhi} walls move in the x direction with +whatever sign you give the {v} argument. Ditto for {y} and {z} walls. +See the note below about making the wall move continuously across +multiple runs. [Restart, fix_modify, output, run start/stop, minimize info:] @@ -72,8 +72,10 @@ calculated by this fix are "extensive", meaning they scale with the number of atoms in the simulation. -No parameter of this fix can be used with the {start/stop} keywords of -the "run"_run.html command. +This fix can change the position of the wall, due to the {vel} +keyword, continuously over multiple runs, using the {start} and {stop} +keywords of the "run"_run.html command. If you do not do this, the +wall position will be reset to {coord} at the beginning of each run. The forces due to this fix are imposed during an energy minimization, invoked by the "minimize"_minimize.html command. diff -Naur lammps-19Aug09/doc/reset_timestep.html lammps-21Aug09/doc/reset_timestep.html --- lammps-19Aug09/doc/reset_timestep.html 2009-01-05 15:26:31.000000000 -0700 +++ lammps-21Aug09/doc/reset_timestep.html 2009-08-18 12:16:59.000000000 -0600 @@ -45,14 +45,19 @@ if necessary. New specifications for dump and restart files can be given after the reset_timestep command is used.

-

This command cannot be used when any fixes are defined that keep track -of time or the timestep in order to perform time-dependent operations. -Examples include the "ave" or "wall" fixes such as fix -ave/spatial or fix -wall/lj126, and also fix -indent. The wall and indeter fixes allow for a -velocity or other time-dependent parameter to be specified, which -would be messed up by resetting the timestep. +

This command cannot be used when any fixes are defined that keeps +track of elapsed time to perform time-dependent operations. Examples +include the "ave" fixes such as fix +ave/spatial. Also fix +dt/reset and fix deposit. +

+

There are other fixes which use the current timestep which may produce +unexpected behavior, but LAMMPS allows them to be in place when +resetting the timestep. For example, commands which thermostat the +system, e.g. fix nvt, allow you to specify a target +temperature which ramps from Tstart to Tstop which may persist over +several runs. If you change the timestep, you may change the target +temperature.

Restting the timestep will clear the flags for computes that may have calculated some quantity from a previous run. This diff -Naur lammps-19Aug09/doc/reset_timestep.txt lammps-21Aug09/doc/reset_timestep.txt --- lammps-19Aug09/doc/reset_timestep.txt 2009-01-05 15:26:31.000000000 -0700 +++ lammps-21Aug09/doc/reset_timestep.txt 2009-08-18 12:16:59.000000000 -0600 @@ -42,14 +42,19 @@ if necessary. New specifications for dump and restart files can be given after the reset_timestep command is used. -This command cannot be used when any fixes are defined that keep track -of time or the timestep in order to perform time-dependent operations. -Examples include the "ave" or "wall" fixes such as "fix -ave/spatial"_fix_ave_spatial.html or "fix -wall/lj126"_fix_wall_lj126.html, and also "fix -indent"_fix_indent.html. The wall and indeter fixes allow for a -velocity or other time-dependent parameter to be specified, which -would be messed up by resetting the timestep. +This command cannot be used when any fixes are defined that keeps +track of elapsed time to perform time-dependent operations. Examples +include the "ave" fixes such as "fix +ave/spatial"_fix_ave_spatial.html. Also "fix +dt/reset"_fix_dt_reset.html and "fix deposit"_fix_deposity.html. + +There are other fixes which use the current timestep which may produce +unexpected behavior, but LAMMPS allows them to be in place when +resetting the timestep. For example, commands which thermostat the +system, e.g. "fix nvt"_fix_nvt.html, allow you to specify a target +temperature which ramps from Tstart to Tstop which may persist over +several runs. If you change the timestep, you may change the target +temperature. Restting the timestep will clear the flags for "computes"_compute.html that may have calculated some quantity from a previous run. This diff -Naur lammps-19Aug09/src/KSPACE/pair_lj_charmm_coul_long.cpp lammps-21Aug09/src/KSPACE/pair_lj_charmm_coul_long.cpp --- lammps-19Aug09/src/KSPACE/pair_lj_charmm_coul_long.cpp 2009-08-08 14:06:53.000000000 -0600 +++ lammps-21Aug09/src/KSPACE/pair_lj_charmm_coul_long.cpp 2009-08-18 12:02:10.000000000 -0600 @@ -729,7 +729,7 @@ int irequest; - if (update->whichflag == 0 && strcmp(update->integrate_style,"respa") == 0) { + if (update->whichflag == 1 && strcmp(update->integrate_style,"respa") == 0) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff -Naur lammps-19Aug09/src/KSPACE/pair_lj_cut_coul_long.cpp lammps-21Aug09/src/KSPACE/pair_lj_cut_coul_long.cpp --- lammps-19Aug09/src/KSPACE/pair_lj_cut_coul_long.cpp 2009-08-08 14:06:53.000000000 -0600 +++ lammps-21Aug09/src/KSPACE/pair_lj_cut_coul_long.cpp 2009-08-18 12:02:10.000000000 -0600 @@ -673,7 +673,7 @@ int irequest; - if (update->whichflag == 0 && strcmp(update->integrate_style,"respa") == 0) { + if (update->whichflag == 1 && strcmp(update->integrate_style,"respa") == 0) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff -Naur lammps-19Aug09/src/compute.cpp lammps-21Aug09/src/compute.cpp --- lammps-19Aug09/src/compute.cpp 2009-07-01 14:28:37.000000000 -0600 +++ lammps-21Aug09/src/compute.cpp 2009-08-18 12:00:14.000000000 -0600 @@ -129,9 +129,9 @@ /* ---------------------------------------------------------------------- */ -void Compute::reset_extra_compute(char *) +void Compute::reset_extra_compute_fix(char *) { - error->all("Compute does not allow an extra compute to be reset"); + error->all("Compute does not allow an extra compute or fix to be reset"); } /* ---------------------------------------------------------------------- diff -Naur lammps-19Aug09/src/compute.h lammps-21Aug09/src/compute.h --- lammps-19Aug09/src/compute.h 2009-08-06 16:21:38.000000000 -0600 +++ lammps-21Aug09/src/compute.h 2009-08-18 11:54:56.000000000 -0600 @@ -84,7 +84,7 @@ virtual void restore_bias(int, double *) {} virtual void restore_bias_all() {} - virtual void reset_extra_compute(char *); + virtual void reset_extra_compute_fix(char *); void addstep(int); int matchstep(int); diff -Naur lammps-19Aug09/src/compute_pressure.cpp lammps-21Aug09/src/compute_pressure.cpp --- lammps-19Aug09/src/compute_pressure.cpp 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/compute_pressure.cpp 2009-08-18 11:59:01.000000000 -0600 @@ -279,7 +279,7 @@ /* ---------------------------------------------------------------------- */ -void ComputePressure::reset_extra_compute(char *id_new) +void ComputePressure::reset_extra_compute_fix(char *id_new) { delete [] id_temp; int n = strlen(id_new) + 1; diff -Naur lammps-19Aug09/src/compute_pressure.h lammps-21Aug09/src/compute_pressure.h --- lammps-19Aug09/src/compute_pressure.h 2009-07-01 14:28:37.000000000 -0600 +++ lammps-21Aug09/src/compute_pressure.h 2009-08-18 11:59:14.000000000 -0600 @@ -25,7 +25,7 @@ void init(); double compute_scalar(); void compute_vector(); - void reset_extra_compute(char *); + void reset_extra_compute_fix(char *); private: double boltz,nktv2p,inv_volume; diff -Naur lammps-19Aug09/src/finish.cpp lammps-21Aug09/src/finish.cpp --- lammps-19Aug09/src/finish.cpp 2008-08-13 08:39:45.000000000 -0600 +++ lammps-21Aug09/src/finish.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -38,53 +38,76 @@ void Finish::end(int flag) { - int i,m; + int i,m,nneigh; int histo[10]; - double time,tmp,ave,max,min; - + int loopflag,minflag,prdflag,timeflag,fftflag,histoflag,neighflag; + double time,tmp,ave,max,min,natoms; + double time_loop,time_other; + int me,nprocs; MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - // deduce time_other + // choose flavors of statistical output + // flag determines caller + // flag = 0 = just loop summary + // flag = 1 = dynamics or minimization + // flag = 2 = PRD + + loopflag = 1; + minflag = prdflag = timeflag = fftflag = histoflag = neighflag = 0; + + if (flag == 1) { + if (update->whichflag == 2) minflag = 1; + timeflag = histoflag = neighflag = 1; + if (strstr(force->kspace_style,"pppm")) fftflag = 1; + } + if (flag == 2) { + prdflag = histoflag = neighflag = 1; + + } + + // loop stats + + if (loopflag) { + time_other = timer->array[TIME_LOOP] - + (timer->array[TIME_PAIR] + timer->array[TIME_BOND] + + timer->array[TIME_KSPACE] + timer->array[TIME_NEIGHBOR] + + timer->array[TIME_COMM] + timer->array[TIME_OUTPUT]); + + time_loop = timer->array[TIME_LOOP]; + MPI_Allreduce(&time_loop,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time_loop = tmp/nprocs; + + // overall loop time + // use actual natoms, in case atoms were lost + + natoms; + double rlocal = atom->nlocal; + MPI_Allreduce(&rlocal,&natoms,1,MPI_DOUBLE,MPI_SUM,world); + + if (me == 0) { + if (screen) + fprintf(screen, + "Loop time of %g on %d procs for %d steps with %.15g atoms\n", + time_loop,nprocs,update->nsteps,natoms); + if (logfile) + fprintf(logfile, + "Loop time of %g on %d procs for %d steps with %.15g atoms\n", + time_loop,nprocs,update->nsteps,natoms); + } - double time_other = timer->array[TIME_LOOP] - - (timer->array[TIME_PAIR] + timer->array[TIME_BOND] + - timer->array[TIME_KSPACE] + timer->array[TIME_NEIGHBOR] + - timer->array[TIME_COMM] + timer->array[TIME_OUTPUT]); - - double time_loop = timer->array[TIME_LOOP]; - MPI_Allreduce(&time_loop,&tmp,1,MPI_DOUBLE,MPI_SUM,world); - time_loop = tmp/nprocs; - - // overall loop time - // use actual natoms, in case atoms were lost - - double natoms; - double rlocal = atom->nlocal; - MPI_Allreduce(&rlocal,&natoms,1,MPI_DOUBLE,MPI_SUM,world); - - if (me == 0) { - if (screen) - fprintf(screen, - "Loop time of %g on %d procs for %d steps with %.15g atoms\n", - time_loop,nprocs,update->nsteps,natoms); - if (logfile) - fprintf(logfile, - "Loop time of %g on %d procs for %d steps with %.15g atoms\n", - time_loop,nprocs,update->nsteps,natoms); - } - - if (flag == 0) return; - - if (me == 0) { - if (screen) fprintf(screen,"\n"); - if (logfile) fprintf(logfile,"\n"); + if (time_loop == 0.0) time_loop = 1.0; } // minimization stats - if (update->whichflag == 1) { + if (minflag) { + if (me == 0) { + if (screen) fprintf(screen,"\n"); + if (logfile) fprintf(logfile,"\n"); + } + if (me == 0) { if (screen) { fprintf(screen,"Minimization stats:\n"); @@ -127,98 +150,170 @@ update->minimize->niter,update->minimize->neval); } } + } + + + // PRD stats using PAIR,BOND,KSPACE for dephase,dynamics,quench + + if (prdflag) { if (me == 0) { if (screen) fprintf(screen,"\n"); if (logfile) fprintf(logfile,"\n"); } - } - - // timing breakdowns - if (time_loop == 0.0) time_loop = 1.0; + if (screen) fprintf(screen,"PRD stats:\n"); + if (logfile) fprintf(logfile,"PRD stats:\n"); - time = timer->array[TIME_PAIR]; - MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); - time = tmp/nprocs; - if (me == 0) { - if (screen) - fprintf(screen,"Pair time (%%) = %g (%g)\n",time,time/time_loop*100.0); - if (logfile) - fprintf(logfile,"Pair time (%%) = %g (%g)\n",time,time/time_loop*100.0); - } + time = timer->array[TIME_PAIR]; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen," Dephase time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile," Dephase time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } - if (atom->molecular) { time = timer->array[TIME_BOND]; MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); time = tmp/nprocs; if (me == 0) { if (screen) - fprintf(screen,"Bond time (%%) = %g (%g)\n", + fprintf(screen," Dynamics time (%%) = %g (%g)\n", time,time/time_loop*100.0); - if (logfile) - fprintf(logfile,"Bond time (%%) = %g (%g)\n", + if (logfile) + fprintf(logfile," Dynamics time (%%) = %g (%g)\n", time,time/time_loop*100.0); } - } - if (force->kspace) { time = timer->array[TIME_KSPACE]; MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); time = tmp/nprocs; if (me == 0) { if (screen) - fprintf(screen,"Kspce time (%%) = %g (%g)\n", + fprintf(screen," Quench time (%%) = %g (%g)\n", time,time/time_loop*100.0); - if (logfile) - fprintf(logfile,"Kspce time (%%) = %g (%g)\n", + if (logfile) + fprintf(logfile," Quench time (%%) = %g (%g)\n", time,time/time_loop*100.0); } - } - time = timer->array[TIME_NEIGHBOR]; - MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); - time = tmp/nprocs; - if (me == 0) { - if (screen) - fprintf(screen,"Neigh time (%%) = %g (%g)\n",time,time/time_loop*100.0); - if (logfile) - fprintf(logfile,"Neigh time (%%) = %g (%g)\n",time,time/time_loop*100.0); - } - - time = timer->array[TIME_COMM]; - MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); - time = tmp/nprocs; - if (me == 0) { - if (screen) - fprintf(screen,"Comm time (%%) = %g (%g)\n",time,time/time_loop*100.0); - if (logfile) - fprintf(logfile,"Comm time (%%) = %g (%g)\n",time,time/time_loop*100.0); - } - - time = timer->array[TIME_OUTPUT]; - MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); - time = tmp/nprocs; - if (me == 0) { - if (screen) - fprintf(screen,"Outpt time (%%) = %g (%g)\n",time,time/time_loop*100.0); - if (logfile) - fprintf(logfile,"Outpt time (%%) = %g (%g)\n",time,time/time_loop*100.0); - } - - time = time_other; - MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); - time = tmp/nprocs; - if (me == 0) { - if (screen) - fprintf(screen,"Other time (%%) = %g (%g)\n",time,time/time_loop*100.0); - if (logfile) - fprintf(logfile,"Other time (%%) = %g (%g)\n",time,time/time_loop*100.0); + time = time_other; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen," Other time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile," Other time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } } + // timing breakdowns + + if (timeflag) { + if (me == 0) { + if (screen) fprintf(screen,"\n"); + if (logfile) fprintf(logfile,"\n"); + } + + time = timer->array[TIME_PAIR]; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen,"Pair time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile,"Pair time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } + + if (atom->molecular) { + time = timer->array[TIME_BOND]; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen,"Bond time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile,"Bond time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } + } + + if (force->kspace) { + time = timer->array[TIME_KSPACE]; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen,"Kspce time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile,"Kspce time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } + } + + time = timer->array[TIME_NEIGHBOR]; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen,"Neigh time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile,"Neigh time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } + + time = timer->array[TIME_COMM]; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen,"Comm time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile,"Comm time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } + + time = timer->array[TIME_OUTPUT]; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen,"Outpt time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile,"Outpt time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } + + time = time_other; + MPI_Allreduce(&time,&tmp,1,MPI_DOUBLE,MPI_SUM,world); + time = tmp/nprocs; + if (me == 0) { + if (screen) + fprintf(screen,"Other time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + if (logfile) + fprintf(logfile,"Other time (%%) = %g (%g)\n", + time,time/time_loop*100.0); + } + } + // FFT timing statistics // time3d,time1d = total time during run for 3d and 1d FFTs - if (strstr(force->kspace_style,"pppm")) { + if (fftflag) { if (me == 0) { if (screen) fprintf(screen,"\n"); if (logfile) fprintf(logfile,"\n"); @@ -265,151 +360,157 @@ } } - if (me == 0) { - if (screen) fprintf(screen,"\n"); - if (logfile) fprintf(logfile,"\n"); - } - - tmp = atom->nlocal; - stats(1,&tmp,&ave,&max,&min,10,histo); - if (me == 0) { - if (screen) { - fprintf(screen,"Nlocal: %g ave %g max %g min\n",ave,max,min); - fprintf(screen,"Histogram:"); - for (i = 0; i < 10; i++) fprintf(screen," %d",histo[i]); - fprintf(screen,"\n"); - } - if (logfile) { - fprintf(logfile,"Nlocal: %g ave %g max %g min\n",ave,max,min); - fprintf(logfile,"Histogram:"); - for (i = 0; i < 10; i++) fprintf(logfile," %d",histo[i]); - fprintf(logfile,"\n"); - } - } - - tmp = atom->nghost; - stats(1,&tmp,&ave,&max,&min,10,histo); - if (me == 0) { - if (screen) { - fprintf(screen,"Nghost: %g ave %g max %g min\n",ave,max,min); - fprintf(screen,"Histogram:"); - for (i = 0; i < 10; i++) fprintf(screen," %d",histo[i]); - fprintf(screen,"\n"); - } - if (logfile) { - fprintf(logfile,"Nghost: %g ave %g max %g min\n",ave,max,min); - fprintf(logfile,"Histogram:"); - for (i = 0; i < 10; i++) fprintf(logfile," %d",histo[i]); - fprintf(logfile,"\n"); - } - } - - // find a non-skip neighbor list containing half the pairwise interactions - // count neighbors in that list for stats purposes - - for (m = 0; m < neighbor->old_nrequest; m++) - if ((neighbor->old_requests[m]->half || neighbor->old_requests[m]->gran || - neighbor->old_requests[m]->respaouter || - neighbor->old_requests[m]->half_from_full) && - neighbor->old_requests[m]->skip == 0) break; - - int nneigh = 0; - if (m < neighbor->old_nrequest) { - int inum = neighbor->lists[m]->inum; - int *ilist = neighbor->lists[m]->ilist; - int *numneigh = neighbor->lists[m]->numneigh; - for (int ii = 0; ii < inum; ii++) - nneigh += numneigh[ilist[ii]]; - } - - tmp = nneigh; - stats(1,&tmp,&ave,&max,&min,10,histo); - if (me == 0) { - if (screen) { - fprintf(screen,"Neighs: %g ave %g max %g min\n",ave,max,min); - fprintf(screen,"Histogram:"); - for (i = 0; i < 10; i++) fprintf(screen," %d",histo[i]); - fprintf(screen,"\n"); - } - if (logfile) { - fprintf(logfile,"Neighs: %g ave %g max %g min\n",ave,max,min); - fprintf(logfile,"Histogram:"); - for (i = 0; i < 10; i++) fprintf(logfile," %d",histo[i]); - fprintf(logfile,"\n"); - } - } - - // find a non-skip neighbor list containing full pairwise interactions - - for (m = 0; m < neighbor->old_nrequest; m++) - if (neighbor->old_requests[m]->full && - neighbor->old_requests[m]->skip == 0) break; - - if (m < neighbor->old_nrequest) { + if (histoflag) { + if (me == 0) { + if (screen) fprintf(screen,"\n"); + if (logfile) fprintf(logfile,"\n"); + } + tmp = atom->nlocal; + stats(1,&tmp,&ave,&max,&min,10,histo); + if (me == 0) { + if (screen) { + fprintf(screen,"Nlocal: %g ave %g max %g min\n",ave,max,min); + fprintf(screen,"Histogram:"); + for (i = 0; i < 10; i++) fprintf(screen," %d",histo[i]); + fprintf(screen,"\n"); + } + if (logfile) { + fprintf(logfile,"Nlocal: %g ave %g max %g min\n",ave,max,min); + fprintf(logfile,"Histogram:"); + for (i = 0; i < 10; i++) fprintf(logfile," %d",histo[i]); + fprintf(logfile,"\n"); + } + } + + tmp = atom->nghost; + stats(1,&tmp,&ave,&max,&min,10,histo); + if (me == 0) { + if (screen) { + fprintf(screen,"Nghost: %g ave %g max %g min\n",ave,max,min); + fprintf(screen,"Histogram:"); + for (i = 0; i < 10; i++) fprintf(screen," %d",histo[i]); + fprintf(screen,"\n"); + } + if (logfile) { + fprintf(logfile,"Nghost: %g ave %g max %g min\n",ave,max,min); + fprintf(logfile,"Histogram:"); + for (i = 0; i < 10; i++) fprintf(logfile," %d",histo[i]); + fprintf(logfile,"\n"); + } + } + + // find a non-skip neighbor list containing half the pairwise interactions + // count neighbors in that list for stats purposes + + for (m = 0; m < neighbor->old_nrequest; m++) + if ((neighbor->old_requests[m]->half || + neighbor->old_requests[m]->gran || + neighbor->old_requests[m]->respaouter || + neighbor->old_requests[m]->half_from_full) && + neighbor->old_requests[m]->skip == 0) break; + nneigh = 0; - for (i = 0; i < atom->nlocal; i++) - nneigh += neighbor->lists[m]->numneigh[i]; - + if (m < neighbor->old_nrequest) { + int inum = neighbor->lists[m]->inum; + int *ilist = neighbor->lists[m]->ilist; + int *numneigh = neighbor->lists[m]->numneigh; + for (int ii = 0; ii < inum; ii++) + nneigh += numneigh[ilist[ii]]; + } + tmp = nneigh; stats(1,&tmp,&ave,&max,&min,10,histo); if (me == 0) { if (screen) { - fprintf(screen,"FullNghs: %g ave %g max %g min\n",ave,max,min); + fprintf(screen,"Neighs: %g ave %g max %g min\n",ave,max,min); fprintf(screen,"Histogram:"); for (i = 0; i < 10; i++) fprintf(screen," %d",histo[i]); fprintf(screen,"\n"); } if (logfile) { - fprintf(logfile,"FullNghs: %g ave %g max %g min\n",ave,max,min); + fprintf(logfile,"Neighs: %g ave %g max %g min\n",ave,max,min); fprintf(logfile,"Histogram:"); for (i = 0; i < 10; i++) fprintf(logfile," %d",histo[i]); fprintf(logfile,"\n"); } } + + // find a non-skip neighbor list containing full pairwise interactions + + for (m = 0; m < neighbor->old_nrequest; m++) + if (neighbor->old_requests[m]->full && + neighbor->old_requests[m]->skip == 0) break; + + if (m < neighbor->old_nrequest) { + nneigh = 0; + for (i = 0; i < atom->nlocal; i++) + nneigh += neighbor->lists[m]->numneigh[i]; + + tmp = nneigh; + stats(1,&tmp,&ave,&max,&min,10,histo); + if (me == 0) { + if (screen) { + fprintf(screen,"FullNghs: %g ave %g max %g min\n",ave,max,min); + fprintf(screen,"Histogram:"); + for (i = 0; i < 10; i++) fprintf(screen," %d",histo[i]); + fprintf(screen,"\n"); + } + if (logfile) { + fprintf(logfile,"FullNghs: %g ave %g max %g min\n",ave,max,min); + fprintf(logfile,"Histogram:"); + for (i = 0; i < 10; i++) fprintf(logfile," %d",histo[i]); + fprintf(logfile,"\n"); + } + } + } } - if (me == 0) { - if (screen) fprintf(screen,"\n"); - if (logfile) fprintf(logfile,"\n"); - } - - tmp = nneigh; - double nall; - MPI_Allreduce(&tmp,&nall,1,MPI_DOUBLE,MPI_SUM,world); - - int nspec; - double nspec_all; - if (atom->molecular) { - nspec = 0; - for (i = 0; i < atom->nlocal; i++) nspec += atom->nspecial[i][2]; - tmp = nspec; - MPI_Allreduce(&tmp,&nspec_all,1,MPI_DOUBLE,MPI_SUM,world); - } - - if (me == 0) { - if (screen) { - if (nall < 2.0e9) - fprintf(screen,"Total # of neighbors = %d\n",static_cast (nall)); - else fprintf(screen,"Total # of neighbors = %g\n",nall); - if (natoms > 0) fprintf(screen,"Ave neighs/atom = %g\n",nall/natoms); - if (atom->molecular && natoms > 0) - fprintf(screen,"Ave special neighs/atom = %g\n",nspec_all/natoms); - fprintf(screen,"Neighbor list builds = %d\n",neighbor->ncalls); - fprintf(screen,"Dangerous builds = %d\n",neighbor->ndanger); - } - if (logfile) { - if (nall < 2.0e9) - fprintf(logfile,"Total # of neighbors = %d\n",static_cast (nall)); - else fprintf(logfile,"Total # of neighbors = %g\n",nall); - if (natoms > 0) fprintf(logfile,"Ave neighs/atom = %g\n",nall/natoms); - if (atom->molecular && natoms > 0) - fprintf(logfile,"Ave special neighs/atom = %g\n",nspec_all/natoms); - fprintf(logfile,"Neighbor list builds = %d\n",neighbor->ncalls); - fprintf(logfile,"Dangerous builds = %d\n",neighbor->ndanger); + if (neighflag) { + if (me == 0) { + if (screen) fprintf(screen,"\n"); + if (logfile) fprintf(logfile,"\n"); + } + + tmp = nneigh; + double nall; + MPI_Allreduce(&tmp,&nall,1,MPI_DOUBLE,MPI_SUM,world); + + int nspec; + double nspec_all; + if (atom->molecular) { + nspec = 0; + for (i = 0; i < atom->nlocal; i++) nspec += atom->nspecial[i][2]; + tmp = nspec; + MPI_Allreduce(&tmp,&nspec_all,1,MPI_DOUBLE,MPI_SUM,world); + } + + if (me == 0) { + if (screen) { + if (nall < 2.0e9) + fprintf(screen, + "Total # of neighbors = %d\n",static_cast (nall)); + else fprintf(screen,"Total # of neighbors = %g\n",nall); + if (natoms > 0) fprintf(screen,"Ave neighs/atom = %g\n",nall/natoms); + if (atom->molecular && natoms > 0) + fprintf(screen,"Ave special neighs/atom = %g\n",nspec_all/natoms); + fprintf(screen,"Neighbor list builds = %d\n",neighbor->ncalls); + fprintf(screen,"Dangerous builds = %d\n",neighbor->ndanger); + } + if (logfile) { + if (nall < 2.0e9) + fprintf(logfile, + "Total # of neighbors = %d\n",static_cast (nall)); + else fprintf(logfile,"Total # of neighbors = %g\n",nall); + if (natoms > 0) fprintf(logfile,"Ave neighs/atom = %g\n",nall/natoms); + if (atom->molecular && natoms > 0) + fprintf(logfile,"Ave special neighs/atom = %g\n",nspec_all/natoms); + fprintf(logfile,"Neighbor list builds = %d\n",neighbor->ncalls); + fprintf(logfile,"Dangerous builds = %d\n",neighbor->ndanger); + } } } - + if (logfile) fflush(logfile); } diff -Naur lammps-19Aug09/src/fix_box_relax.cpp lammps-21Aug09/src/fix_box_relax.cpp --- lammps-19Aug09/src/fix_box_relax.cpp 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/fix_box_relax.cpp 2009-08-18 11:56:26.000000000 -0600 @@ -471,7 +471,7 @@ icompute = modify->find_compute(id_press); if (icompute < 0) error->all("Pressure ID for fix modify does not exist"); - modify->compute[icompute]->reset_extra_compute(id_temp); + modify->compute[icompute]->reset_extra_compute_fix(id_temp); return 2; diff -Naur lammps-19Aug09/src/fix_deform.cpp lammps-21Aug09/src/fix_deform.cpp --- lammps-19Aug09/src/fix_deform.cpp 2009-05-19 08:59:04.000000000 -0600 +++ lammps-21Aug09/src/fix_deform.cpp 2009-08-18 12:11:26.000000000 -0600 @@ -46,7 +46,6 @@ box_change = 1; no_change_box = 1; - time_depend = 1; nevery = atoi(arg[3]); if (nevery <= 0) error->all("Illegal fix deform command"); diff -Naur lammps-19Aug09/src/fix_indent.cpp lammps-21Aug09/src/fix_indent.cpp --- lammps-19Aug09/src/fix_indent.cpp 2009-08-08 12:45:22.000000000 -0600 +++ lammps-21Aug09/src/fix_indent.cpp 2009-08-18 12:11:33.000000000 -0600 @@ -39,7 +39,6 @@ { if (narg < 4) error->all("Illegal fix indent command"); - time_depend = 1; scalar_flag = 1; vector_flag = 1; size_vector = 3; @@ -155,7 +154,7 @@ // for minimization, always set to r0_stop double r0; - if (!radflag || update->whichflag) r0 = r0_stop; + if (!radflag || update->whichflag == 2) r0 = r0_stop; else { double delta = update->ntimestep - update->beginstep; delta /= update->endstep - update->beginstep; diff -Naur lammps-19Aug09/src/fix_langevin.cpp lammps-21Aug09/src/fix_langevin.cpp --- lammps-19Aug09/src/fix_langevin.cpp 2009-08-08 16:58:52.000000000 -0600 +++ lammps-21Aug09/src/fix_langevin.cpp 2009-08-18 12:11:26.000000000 -0600 @@ -44,7 +44,6 @@ { if (narg < 7) error->all("Illegal fix langevin command"); - time_depend = 1; scalar_flag = 1; scalar_vector_freq = 1; extscalar = 1; diff -Naur lammps-19Aug09/src/fix_minimize.cpp lammps-21Aug09/src/fix_minimize.cpp --- lammps-19Aug09/src/fix_minimize.cpp 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/fix_minimize.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -181,8 +181,9 @@ void FixMinimize::grow_arrays(int nmax) { for (int m = 0; m < nvector; m++) - vectors[m] = (double *) memory->srealloc(vectors[m],peratom[m]*nmax, - "minimize:vector"); + vectors[m] = (double *) + memory->srealloc(vectors[m],peratom[m]*nmax*sizeof(double), + "minimize:vector"); } /* ---------------------------------------------------------------------- diff -Naur lammps-19Aug09/src/fix_nph.cpp lammps-21Aug09/src/fix_nph.cpp --- lammps-19Aug09/src/fix_nph.cpp 2009-07-21 09:15:31.000000000 -0600 +++ lammps-21Aug09/src/fix_nph.cpp 2009-08-18 11:56:26.000000000 -0600 @@ -822,7 +822,7 @@ icompute = modify->find_compute(id_press); if (icompute < 0) error->all("Pressure ID for fix npt does not exist"); - modify->compute[icompute]->reset_extra_compute(id_temp); + modify->compute[icompute]->reset_extra_compute_fix(id_temp); return 2; diff -Naur lammps-19Aug09/src/fix_npt.cpp lammps-21Aug09/src/fix_npt.cpp --- lammps-19Aug09/src/fix_npt.cpp 2009-07-02 12:01:55.000000000 -0600 +++ lammps-21Aug09/src/fix_npt.cpp 2009-08-18 11:56:26.000000000 -0600 @@ -961,7 +961,7 @@ icompute = modify->find_compute(id_press); if (icompute < 0) error->all("Pressure ID for fix modify does not exist"); - modify->compute[icompute]->reset_extra_compute(id_temp); + modify->compute[icompute]->reset_extra_compute_fix(id_temp); return 2; diff -Naur lammps-19Aug09/src/fix_press_berendsen.cpp lammps-21Aug09/src/fix_press_berendsen.cpp --- lammps-19Aug09/src/fix_press_berendsen.cpp 2009-07-02 12:01:55.000000000 -0600 +++ lammps-21Aug09/src/fix_press_berendsen.cpp 2009-08-18 11:56:41.000000000 -0600 @@ -443,7 +443,7 @@ icompute = modify->find_compute(id_press); if (icompute < 0) error->all("Pressure ID for fix press/berendsen does not exist"); - modify->compute[icompute]->reset_extra_compute(id_temp); + modify->compute[icompute]->reset_extra_compute_fix(id_temp); return 2; diff -Naur lammps-19Aug09/src/fix_shake.cpp lammps-21Aug09/src/fix_shake.cpp --- lammps-19Aug09/src/fix_shake.cpp 2009-07-21 09:00:56.000000000 -0600 +++ lammps-21Aug09/src/fix_shake.cpp 2009-08-18 11:56:56.000000000 -0600 @@ -283,7 +283,7 @@ // cannot use with minimization since SHAKE turns off bonds // that should contribute to potential energy - if (update->whichflag == 1) + if (update->whichflag == 2) error->all("Fix shake cannot be used with minimization"); // error if npt,nph fix comes before shake fix diff -Naur lammps-19Aug09/src/fix_wall_lj126.cpp lammps-21Aug09/src/fix_wall_lj126.cpp --- lammps-19Aug09/src/fix_wall_lj126.cpp 2009-01-05 15:26:08.000000000 -0700 +++ lammps-21Aug09/src/fix_wall_lj126.cpp 2009-08-18 12:11:26.000000000 -0600 @@ -35,7 +35,6 @@ { if (narg < 8) error->all("Illegal fix wall/lj126 command"); - time_depend = 1; scalar_flag = 1; vector_flag = 1; size_vector = 3; diff -Naur lammps-19Aug09/src/fix_wall_lj93.cpp lammps-21Aug09/src/fix_wall_lj93.cpp --- lammps-19Aug09/src/fix_wall_lj93.cpp 2009-01-05 15:26:08.000000000 -0700 +++ lammps-21Aug09/src/fix_wall_lj93.cpp 2009-08-18 12:11:26.000000000 -0600 @@ -31,7 +31,6 @@ { if (narg < 8) error->all("Illegal fix wall/lj93 command"); - time_depend = 1; scalar_flag = 1; vector_flag = 1; size_vector = 3; diff -Naur lammps-19Aug09/src/integrate.cpp lammps-21Aug09/src/integrate.cpp --- lammps-19Aug09/src/integrate.cpp 2009-01-14 14:27:33.000000000 -0700 +++ lammps-21Aug09/src/integrate.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -79,7 +79,8 @@ } /* ---------------------------------------------------------------------- - set eflag,vflag for current iteration with ntimestep + set eflag,vflag for current iteration + based on computes that need info on this ntimestep eflag = 0 = no energy computation eflag = 1 = global energy only eflag = 2 = per-atom energy only diff -Naur lammps-19Aug09/src/integrate.h lammps-21Aug09/src/integrate.h --- lammps-19Aug09/src/integrate.h 2008-07-08 14:56:48.000000000 -0600 +++ lammps-21Aug09/src/integrate.h 2009-08-21 13:05:42.000000000 -0600 @@ -24,7 +24,8 @@ virtual ~Integrate(); virtual void init() = 0; virtual void setup() = 0; - virtual void iterate(int) = 0; + virtual void setup_minimal(int) = 0; + virtual void run(int) = 0; virtual void cleanup() {} virtual void reset_dt() {} virtual double memory_usage() {return 0.0;} diff -Naur lammps-19Aug09/src/lammps.cpp lammps-21Aug09/src/lammps.cpp --- lammps-19Aug09/src/lammps.cpp 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/lammps.cpp 2009-08-18 12:43:28.000000000 -0600 @@ -58,6 +58,7 @@ while (iarg < narg) { if (strcmp(arg[iarg],"-partition") == 0) { + universe->existflag = 1; if (iarg+2 > narg) error->universe_all("Invalid command-line argument"); iarg++; @@ -91,18 +92,18 @@ } else error->universe_all("Invalid command-line argument"); } - // if procs was not a command-line switch, universe is one world w/ all procs + // if no partition command-line switch, universe is one world w/ all procs - if (universe->nworlds == 0) universe->add_world(NULL); + if (universe->existflag == 0) universe->add_world(NULL); // sum of procs in all worlds must equal total # of procs if (!universe->consistent()) error->universe_all("Processor partitions are inconsistent"); - // multiple-world universe must define input file + // universe cannot use stdin for input file - if (universe->nworlds > 1 && inflag == 0) + if (universe->existflag && inflag == 0) error->universe_all("Must use -in switch with multiple partitions"); // set universe screen and logfile @@ -136,12 +137,12 @@ universe->ulogfile = NULL; } - // universe is single world + // universe does not exist on its own, only a single world // inherit settings from universe // set world screen, logfile, communicator, infile // open input script if from file - if (universe->nworlds == 1) { + if (universe->existflag == 0) { screen = universe->uscreen; logfile = universe->ulogfile; world = universe->uworld; @@ -162,7 +163,7 @@ if (logfile) fprintf(logfile,"LAMMPS (%s)\n",universe->version); } - // universe is multiple worlds + // universe is one or more worlds // split into separate communicators // set world screen, logfile, communicator, infile // open input script diff -Naur lammps-19Aug09/src/min.cpp lammps-21Aug09/src/min.cpp --- lammps-19Aug09/src/min.cpp 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/min.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -149,8 +149,6 @@ neigh_delay = neighbor->delay; neigh_dist_check = neighbor->dist_check; - // reset reneighboring criteria if necessary - if (neigh_every != 1 || neigh_delay != 0 || neigh_dist_check != 1) { if (comm->me == 0) error->warning("Resetting reneighboring criteria during minimization"); @@ -179,6 +177,12 @@ nextra_global = modify->min_dof(); if (nextra_global) fextra = new double[nextra_global]; + // compute for potential energy + + int id = modify->find_compute("thermo_pe"); + if (id < 0) error->all("Minimization could not find thermo_pe compute"); + pe_compute = modify->compute[id]; + // style-specific setup does two tasks // setup extra global dof vectors // setup extra per-atom dof vectors due to requests from Pair classes @@ -198,7 +202,6 @@ // setup domain, communication and neighboring // acquire ghosts // build neighbor lists - // reset gradient vector ptrs if (triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); @@ -241,10 +244,63 @@ } /* ---------------------------------------------------------------------- - perform minimization, with setup first + setup without output or one-time post-init setup + flag = 0 = just force calculation + flag = 1 = reneighbor and force calculation ------------------------------------------------------------------------- */ -void Min::run() +void Min::setup_minimal(int flag) +{ + // setup domain, communication and neighboring + // acquire ghosts + // build neighbor lists + + if (flag) { + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + domain->reset_box(); + comm->setup(); + if (neighbor->style) neighbor->setup_bins(); + comm->exchange(); + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + neighbor->build(); + neighbor->ncalls = 0; + } + + // compute all forces + + ev_set(update->ntimestep); + force_clear(); + + if (force->pair) force->pair->compute(eflag,vflag); + + if (atom->molecular) { + if (force->bond) force->bond->compute(eflag,vflag); + if (force->angle) force->angle->compute(eflag,vflag); + if (force->dihedral) force->dihedral->compute(eflag,vflag); + if (force->improper) force->improper->compute(eflag,vflag); + } + + if (force->kspace) { + force->kspace->setup(); + force->kspace->compute(eflag,vflag); + } + + if (force->newton) comm->reverse_communicate(); + + modify->setup(vflag); + + // atoms may have migrated in comm->exchange() + + reset_vectors(); +} + +/* ---------------------------------------------------------------------- + perform minimization, calling iterate() for nsteps +------------------------------------------------------------------------- */ + +void Min::run(int nsteps) { // possible stop conditions @@ -254,12 +310,6 @@ "linesearch alpha is zero", "forces are zero","quadratic factors are zero"}; - // compute for potential energy - - int id = modify->find_compute("thermo_pe"); - if (id < 0) error->all("Minimization could not find thermo_pe compute"); - pe_compute = modify->compute[id]; - // stats for Finish to print ecurrent = pe_compute->compute_scalar(); @@ -272,8 +322,7 @@ // minimizer iterations - timer->barrier_start(TIME_LOOP); - int stop_condition = iterate(update->nsteps); + int stop_condition = iterate(nsteps); stopstr = stopstrings[stop_condition]; // account for early exit from iterate loop due to convergence @@ -284,14 +333,17 @@ // add ntimestep to all computes that store invocation times // since are hardwireing call to thermo/dumps and computes may not be ready - if (niter < update->nsteps) { + if (niter < nsteps) { niter++; update->nsteps = niter; - for (int idump = 0; idump < output->ndump; idump++) - output->next_dump[idump] = update->ntimestep; - output->next_dump_any = update->ntimestep; - if (output->restart_every) output->next_restart = update->ntimestep; + if (update->restrict_output == 0) { + for (int idump = 0; idump < output->ndump; idump++) + output->next_dump[idump] = update->ntimestep; + output->next_dump_any = update->ntimestep; + if (output->restart_every == 0) + output->next_restart = update->ntimestep; + } output->next_thermo = update->ntimestep; modify->addstep_compute_all(update->ntimestep); @@ -299,23 +351,26 @@ output->write(update->ntimestep); } - timer->barrier_stop(TIME_LOOP); - - // delete fix_minimize at end of run + // stats for Finish to print + + efinal = ecurrent; + fnorm2_final = sqrt(fnorm_sqr()); + fnorminf_final = fnorm_inf(); +} - modify->delete_fix("MINIMIZE"); +/* ---------------------------------------------------------------------- */ +void Min::cleanup() +{ // reset reneighboring criteria neighbor->every = neigh_every; neighbor->delay = neigh_delay; neighbor->dist_check = neigh_dist_check; - // stats for Finish to print - - efinal = ecurrent; - fnorm2_final = sqrt(fnorm_sqr()); - fnorminf_final = fnorm_inf(); + // delete fix at end of run, so its atom arrays won't persist + + modify->delete_fix("MINIMIZE"); } /* ---------------------------------------------------------------------- @@ -522,7 +577,8 @@ } /* ---------------------------------------------------------------------- - set eflag,vflag for current iteration with ntimestep + set eflag,vflag for current iteration + based on computes that need info on this ntimestep always set eflag_global = 1, since need energy every iteration eflag = 0 = no energy computation eflag = 1 = global energy only diff -Naur lammps-19Aug09/src/min.h lammps-21Aug09/src/min.h --- lammps-19Aug09/src/min.h 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/min.h 2009-08-21 13:05:42.000000000 -0600 @@ -30,17 +30,18 @@ virtual ~Min(); void init(); void setup(); - void run(); + void setup_minimal(int); + void run(int); + void cleanup(); + void request(class Pair *, int, double); + double memory_usage() {return 0.0;} + void modify_params(int, char **); virtual void init_style() {} virtual void setup_style() = 0; virtual void reset_vectors() = 0; virtual int iterate(int) = 0; - void request(class Pair *, int, double); - double memory_usage() {return 0.0;} - void modify_params(int, char **); - protected: int eflag,vflag; // flags for energy/virial computation int virial_style; // compute virial explicitly or implicitly diff -Naur lammps-19Aug09/src/minimize.cpp lammps-21Aug09/src/minimize.cpp --- lammps-19Aug09/src/minimize.cpp 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/minimize.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -17,6 +17,7 @@ #include "update.h" #include "min.h" #include "finish.h" +#include "timer.h" #include "error.h" using namespace LAMMPS_NS; @@ -42,19 +43,23 @@ if (update->etol < 0.0 || update->ftol < 0.0) error->all("Illegal minimize command"); + update->whichflag = 2; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + update->nsteps; - update->whichflag = 1; - lmp->init(); update->minimize->setup(); - update->minimize->run(); + + timer->barrier_start(TIME_LOOP); + update->minimize->run(update->nsteps); + timer->barrier_stop(TIME_LOOP); + + update->minimize->cleanup(); Finish finish(lmp); finish.end(1); - update->whichflag = -1; + update->whichflag = 0; update->firststep = update->laststep = 0; update->beginstep = update->endstep = 0; } diff -Naur lammps-19Aug09/src/modify.cpp lammps-21Aug09/src/modify.cpp --- lammps-19Aug09/src/modify.cpp 2009-08-14 14:54:10.000000000 -0600 +++ lammps-21Aug09/src/modify.cpp 2009-08-18 11:54:37.000000000 -0600 @@ -235,9 +235,9 @@ void Modify::setup(int vflag) { - if (update->whichflag == 0) + if (update->whichflag == 1) for (int i = 0; i < nfix; i++) fix[i]->setup(vflag); - else + else if (update->whichflag == 2) for (int i = 0; i < nfix; i++) fix[i]->min_setup(vflag); } diff -Naur lammps-19Aug09/src/neighbor.cpp lammps-21Aug09/src/neighbor.cpp --- lammps-19Aug09/src/neighbor.cpp 2009-02-19 10:03:24.000000000 -0700 +++ lammps-21Aug09/src/neighbor.cpp 2009-08-18 12:00:30.000000000 -0600 @@ -286,7 +286,7 @@ // rRESPA cutoffs int respa = 0; - if (update->whichflag == 0 && strcmp(update->integrate_style,"respa") == 0) { + if (update->whichflag == 1 && strcmp(update->integrate_style,"respa") == 0) { if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; } diff -Naur lammps-19Aug09/src/output.cpp lammps-21Aug09/src/output.cpp --- lammps-19Aug09/src/output.cpp 2009-06-30 08:43:45.000000000 -0600 +++ lammps-21Aug09/src/output.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -135,7 +135,7 @@ // if no dumps, set next_dump_any to last+1 so will not influence next // dump custom may invoke computes so wrap with clear/add - if (ndump) { + if (ndump && update->restrict_output == 0) { for (int idump = 0; idump < ndump; idump++) { if (strcmp(dump[idump]->style,"custom") == 0) modify->clearstep_compute(); @@ -158,7 +158,7 @@ // will not write on last step of run unless multiple of every // if every = 0, set next_restart to last+1 so will not influence next - if (restart_every) + if (restart_every && update->restrict_output == 0) next_restart = (ntimestep/restart_every)*restart_every + restart_every; else next_restart = update->laststep + 1; @@ -259,6 +259,43 @@ } /* ---------------------------------------------------------------------- + force a snapshot to be written for all dumps +------------------------------------------------------------------------- */ + +void Output::write_dump(int ntimestep) +{ + for (int idump = 0; idump < ndump; idump++) { + dump[idump]->write(); + last_dump[idump] = ntimestep; + } +} + +/* ---------------------------------------------------------------------- + force a restart file to be written +------------------------------------------------------------------------- */ + +void Output::write_restart(int ntimestep) +{ + if (restart_toggle == 0) { + char *file = new char[strlen(restart1) + 16]; + char *ptr = strchr(restart1,'*'); + *ptr = '\0'; + sprintf(file,"%s%d%s",restart1,ntimestep,ptr+1); + *ptr = '*'; + restart->write(file); + delete [] file; + } else if (restart_toggle == 1) { + restart->write(restart1); + restart_toggle = 2; + } else if (restart_toggle == 2) { + restart->write(restart2); + restart_toggle = 1; + } + + last_restart = ntimestep; +} + +/* ---------------------------------------------------------------------- add a Dump to list of Dumps ------------------------------------------------------------------------- */ diff -Naur lammps-19Aug09/src/output.h lammps-21Aug09/src/output.h --- lammps-19Aug09/src/output.h 2007-01-29 17:22:05.000000000 -0700 +++ lammps-21Aug09/src/output.h 2009-08-21 13:05:42.000000000 -0600 @@ -48,6 +48,8 @@ void init(); void setup(int); // initial output before run/min void write(int); // output for current timestep + void write_dump(int); // force output of dump snapshots + void write_restart(int); // force output of a restart file void add_dump(int, char **); // add a Dump to Dump list void modify_dump(int, char **); // modify a Dump diff -Naur lammps-19Aug09/src/pair_lj96_cut.cpp lammps-21Aug09/src/pair_lj96_cut.cpp --- lammps-19Aug09/src/pair_lj96_cut.cpp 2009-08-10 14:16:47.000000000 -0600 +++ lammps-21Aug09/src/pair_lj96_cut.cpp 2009-08-18 11:55:33.000000000 -0600 @@ -511,7 +511,7 @@ int irequest; - if (update->whichflag == 0 && strcmp(update->integrate_style,"respa") == 0) { + if (update->whichflag == 1 && strcmp(update->integrate_style,"respa") == 0) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff -Naur lammps-19Aug09/src/pair_lj_cut.cpp lammps-21Aug09/src/pair_lj_cut.cpp --- lammps-19Aug09/src/pair_lj_cut.cpp 2009-08-08 14:06:53.000000000 -0600 +++ lammps-21Aug09/src/pair_lj_cut.cpp 2009-08-18 11:55:39.000000000 -0600 @@ -504,7 +504,7 @@ int irequest; - if (update->whichflag == 0 && strcmp(update->integrate_style,"respa") == 0) { + if (update->whichflag == 1 && strcmp(update->integrate_style,"respa") == 0) { int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; diff -Naur lammps-19Aug09/src/pair_soft.cpp lammps-21Aug09/src/pair_soft.cpp --- lammps-19Aug09/src/pair_soft.cpp 2009-08-08 14:06:53.000000000 -0600 +++ lammps-21Aug09/src/pair_soft.cpp 2009-08-18 11:55:43.000000000 -0600 @@ -69,7 +69,7 @@ // for 0-step dynamics, set to prestart double delta = update->ntimestep - update->beginstep; - if (update->whichflag == 1) delta = 1.0; + if (update->whichflag == 2) delta = 1.0; else if (update->nsteps) delta /= update->endstep - update->beginstep; else delta = 0.0; int ntypes = atom->ntypes; diff -Naur lammps-19Aug09/src/respa.cpp lammps-21Aug09/src/respa.cpp --- lammps-19Aug09/src/respa.cpp 2009-01-05 15:26:08.000000000 -0700 +++ lammps-21Aug09/src/respa.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -363,10 +363,69 @@ } /* ---------------------------------------------------------------------- - iterate for n steps + setup without output + flag = 0 = just force calculation + flag = 1 = reneighbor and force calculation ------------------------------------------------------------------------- */ -void Respa::iterate(int n) +void Respa::setup_minimal(int flag) +{ + // setup domain, communication and neighboring + // acquire ghosts + // build neighbor lists + + if (flag) { + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + domain->reset_box(); + comm->setup(); + if (neighbor->style) neighbor->setup_bins(); + comm->exchange(); + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + neighbor->build(); + neighbor->ncalls = 0; + } + + // compute all forces + + ev_set(update->ntimestep); + + for (int ilevel = 0; ilevel < nlevels; ilevel++) { + force_clear(newton[ilevel]); + if (level_bond == ilevel && force->bond) + force->bond->compute(eflag,vflag); + if (level_angle == ilevel && force->angle) + force->angle->compute(eflag,vflag); + if (level_dihedral == ilevel && force->dihedral) + force->dihedral->compute(eflag,vflag); + if (level_improper == ilevel && force->improper) + force->improper->compute(eflag,vflag); + if (level_pair == ilevel && force->pair) + force->pair->compute(eflag,vflag); + if (level_inner == ilevel && force->pair) + force->pair->compute_inner(); + if (level_middle == ilevel && force->pair) + force->pair->compute_middle(); + if (level_outer == ilevel && force->pair) + force->pair->compute_outer(eflag,vflag); + if (level_kspace == ilevel && force->kspace) { + force->kspace->setup(); + force->kspace->compute(eflag,vflag); + } + if (newton[ilevel]) comm->reverse_communicate(); + copy_f_flevel(ilevel); + } + + modify->setup(vflag); + sum_flevel_f(); +} + +/* ---------------------------------------------------------------------- + run for N steps +------------------------------------------------------------------------- */ + +void Respa::run(int n) { int ntimestep; diff -Naur lammps-19Aug09/src/respa.h lammps-21Aug09/src/respa.h --- lammps-19Aug09/src/respa.h 2007-11-02 14:25:11.000000000 -0600 +++ lammps-21Aug09/src/respa.h 2009-08-21 13:05:42.000000000 -0600 @@ -37,7 +37,8 @@ ~Respa(); void init(); void setup(); - void iterate(int); + void setup_minimal(int); + void run(int); void cleanup(); void reset_dt(); diff -Naur lammps-19Aug09/src/run.cpp lammps-21Aug09/src/run.cpp --- lammps-19Aug09/src/run.cpp 2009-03-20 09:01:17.000000000 -0600 +++ lammps-21Aug09/src/run.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -127,7 +127,7 @@ // else just init timer and setup output // if post, do full Finish, else just print time - update->whichflag = 0; + update->whichflag = 1; if (nevery == 0) { update->nsteps = nsteps; @@ -148,7 +148,7 @@ } timer->barrier_start(TIME_LOOP); - update->integrate->iterate(nsteps); + update->integrate->run(nsteps); timer->barrier_stop(TIME_LOOP); update->integrate->cleanup(); @@ -186,7 +186,7 @@ } timer->barrier_start(TIME_LOOP); - update->integrate->iterate(nsteps); + update->integrate->run(nsteps); timer->barrier_stop(TIME_LOOP); update->integrate->cleanup(); @@ -209,7 +209,7 @@ } } - update->whichflag = -1; + update->whichflag = 0; update->firststep = update->laststep = 0; update->beginstep = update->endstep = 0; delete [] commandstr; diff -Naur lammps-19Aug09/src/temper.cpp lammps-21Aug09/src/temper.cpp --- lammps-19Aug09/src/temper.cpp 2009-06-23 14:11:54.000000000 -0600 +++ lammps-21Aug09/src/temper.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -101,7 +101,7 @@ // setup for long tempering run - update->whichflag = 0; + update->whichflag = 1; update->nsteps = nsteps; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + nsteps; @@ -196,7 +196,7 @@ // run for nevery timesteps - update->integrate->iterate(nevery); + update->integrate->run(nevery); // compute PE // notify compute it will be called at next swap @@ -302,7 +302,7 @@ Finish finish(lmp); finish.end(1); - update->whichflag = -1; + update->whichflag = 0; update->firststep = update->laststep = 0; update->beginstep = update->endstep = 0; } diff -Naur lammps-19Aug09/src/thermo.cpp lammps-21Aug09/src/thermo.cpp --- lammps-19Aug09/src/thermo.cpp 2009-08-13 11:33:39.000000000 -0600 +++ lammps-21Aug09/src/thermo.cpp 2009-08-18 11:54:17.000000000 -0600 @@ -393,7 +393,7 @@ if (icompute < 0) error->all("Pressure ID for thermo does not exist"); } else icompute = modify->find_compute((char *) "thermo_press"); - modify->compute[icompute]->reset_extra_compute(arg[iarg+1]); + modify->compute[icompute]->reset_extra_compute_fix(arg[iarg+1]); iarg += 2; @@ -832,14 +832,14 @@ dvalue = ivalue; } else if (strcmp(word,"cpu") == 0) { - if (update->whichflag < 0) firststep = 0; + if (update->whichflag == 0) firststep = 0; compute_cpu(); } else if (strcmp(word,"temp") == 0) { if (!temperature) error->all("Thermo keyword in variable requires " "thermo to use/init temp"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (temperature->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -853,7 +853,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -866,7 +866,7 @@ } else if (strcmp(word,"pe") == 0) { if (!pe) error->all("Thermo keyword in variable requires thermo to use/init pe"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pe->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -880,7 +880,7 @@ if (!temperature) error->all("Thermo keyword in variable requires " "thermo to use/init temp"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (temperature->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -893,7 +893,7 @@ } else if (strcmp(word,"etotal") == 0) { if (!pe) error->all("Thermo keyword in variable requires thermo to use/init pe"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pe->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -904,7 +904,7 @@ if (!temperature) error->all("Thermo keyword in variable requires " "thermo to use/init temp"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (temperature->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -917,7 +917,7 @@ } else if (strcmp(word,"enthalpy") == 0) { if (!pe) error->all("Thermo keyword in variable requires thermo to use/init pe"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pe->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -928,7 +928,7 @@ if (!temperature) error->all("Thermo keyword in variable requires " "thermo to use/init temp"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (temperature->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -939,7 +939,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_scalar != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -1049,7 +1049,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_vector != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -1063,7 +1063,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_vector != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -1077,7 +1077,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_vector != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -1091,7 +1091,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_vector != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -1105,7 +1105,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_vector != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); @@ -1119,7 +1119,7 @@ if (!pressure) error->all("Thermo keyword in variable requires " "thermo to use/init press"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (pressure->invoked_vector != update->ntimestep) error->all("Compute used in variable thermo keyword between runs " "is not current"); diff -Naur lammps-19Aug09/src/universe.cpp lammps-21Aug09/src/universe.cpp --- lammps-19Aug09/src/universe.cpp 2009-07-02 12:03:11.000000000 -0600 +++ lammps-21Aug09/src/universe.cpp 2009-08-18 12:43:28.000000000 -0600 @@ -35,6 +35,7 @@ uscreen = stdout; ulogfile = NULL; + existflag = 0; nworlds = 0; procs_per_world = NULL; root_proc = NULL; diff -Naur lammps-19Aug09/src/universe.h lammps-21Aug09/src/universe.h --- lammps-19Aug09/src/universe.h 2007-01-29 17:22:05.000000000 -0700 +++ lammps-21Aug09/src/universe.h 2009-08-18 12:43:28.000000000 -0600 @@ -30,6 +30,7 @@ FILE *uscreen; // universe screen output FILE *ulogfile; // universe logfile + int existflag; // 1 if universe exists due to -partition flag int nworlds; // # of worlds in universe int iworld; // which world I am in int *procs_per_world; // # of procs in each world diff -Naur lammps-19Aug09/src/update.cpp lammps-21Aug09/src/update.cpp --- lammps-19Aug09/src/update.cpp 2009-04-16 08:32:03.000000000 -0600 +++ lammps-21Aug09/src/update.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -41,10 +41,12 @@ ntimestep = 0; first_update = 0; - whichflag = -1; + whichflag = 0; firststep = laststep = 0; beginstep = endstep = 0; + restrict_output = 0; + eflag_global = vflag_global = -1; unit_style = NULL; @@ -80,12 +82,12 @@ void Update::init() { - // init the appropriate integrate or minimize class + // init the appropriate integrate and/or minimize class // if neither (e.g. from write_restart) then just return - if (whichflag == -1) return; - else if (whichflag == 0) integrate->init(); - else if (whichflag == 1) minimize->init(); + if (whichflag == 0) return; + if (whichflag == 1) integrate->init(); + else if (whichflag == 2) minimize->init(); // only set first_update if a run or minimize is being performed @@ -222,7 +224,7 @@ do not allow any timestep-dependent fixes to be defined reset eflag/vflag global so nothing will think eng/virial are current reset invoked flags of computes, so nothing will think they are current - clear timestep list of computes that store one + clear timestep list of computes that store future invocation times ------------------------------------------------------------------------- */ void Update::reset_timestep(int narg, char **arg) @@ -261,7 +263,7 @@ double Update::memory_usage() { double bytes = 0.0; - if (whichflag == 0) bytes += integrate->memory_usage(); - else if (whichflag == 1) bytes += minimize->memory_usage(); + if (whichflag == 1) bytes += integrate->memory_usage(); + else if (whichflag == 2) bytes += minimize->memory_usage(); return bytes; } diff -Naur lammps-19Aug09/src/update.h lammps-21Aug09/src/update.h --- lammps-19Aug09/src/update.h 2009-01-05 15:26:08.000000000 -0700 +++ lammps-21Aug09/src/update.h 2009-08-21 13:05:42.000000000 -0600 @@ -22,15 +22,16 @@ public: double dt; // timestep double etol,ftol; // minimizer tolerances on energy/force - int ntimestep; // current step (dynamics or min iter) + int ntimestep; // current step (dynamics or min iterations) int nsteps; // # of steps to run (dynamics or min iter) - int whichflag; // 0 for time integration, 1 for minimization + int whichflag; // 0 for unset, 1 for dynamics, 2 for min int firststep,laststep; // 1st & last step of this run int beginstep,endstep; // 1st and last step of multiple runs int first_update; // 0 before initial update, 1 after int max_eval; // max force evaluations for minimizer + int restrict_output; // 1 if output should not write dump/restart - int eflag_global,eflag_atom; // timestep global/peratom eng is tallied + int eflag_global,eflag_atom; // timestep global/peratom eng is tallied on int vflag_global,vflag_atom; // ditto for virial char *unit_style; diff -Naur lammps-19Aug09/src/variable.cpp lammps-21Aug09/src/variable.cpp --- lammps-19Aug09/src/variable.cpp 2009-06-29 09:29:26.000000000 -0600 +++ lammps-21Aug09/src/variable.cpp 2009-08-18 11:57:16.000000000 -0600 @@ -670,7 +670,7 @@ if (nbracket == 0 && compute->scalar_flag) { - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (compute->invoked_scalar != update->ntimestep) error->all("Compute used in variable between runs " "is not current"); @@ -694,7 +694,7 @@ if (index1 > compute->size_vector) error->all("Compute vector in variable formula is too small"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (compute->invoked_vector != update->ntimestep) error->all("Compute used in variable between runs " "is not current"); @@ -719,7 +719,7 @@ if (tree == NULL) error->all("Per-atom compute in equal-style variable formula"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) error->all("Compute used in variable between runs " "is not current"); @@ -740,7 +740,7 @@ } else if (nbracket == 1 && index1 > 0 && compute->peratom_flag && compute->size_peratom == 0) { - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) error->all("Compute used in variable between runs " "is not current"); @@ -761,7 +761,7 @@ error->all("Per-atom compute in equal-style variable formula"); if (index2 > compute->size_peratom) error->all("Compute vector in variable formula is too small"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) error->all("Compute used in variable between runs " "is not current"); @@ -784,7 +784,7 @@ if (index2 > compute->size_peratom) error->all("Compute vector in variable formula is too small"); - if (update->whichflag < 0) { + if (update->whichflag == 0) { if (compute->invoked_peratom != update->ntimestep) error->all("Compute used in variable between runs " "is not current"); @@ -838,7 +838,7 @@ if (nbracket == 0 && fix->scalar_flag) { - if (update->whichflag >= 0 && + if (update->whichflag > 0 && update->ntimestep % fix->scalar_vector_freq) error->all("Fix in variable not computed at compatible time"); value1 = fix->compute_scalar(); @@ -856,7 +856,7 @@ if (index1 > fix->size_vector) error->all("Fix vector in variable formula is too small"); - if (update->whichflag >= 0 && + if (update->whichflag > 0 && update->ntimestep % fix->scalar_vector_freq) error->all("Fix in variable not computed at compatible time"); value1 = fix->compute_vector(index1-1); @@ -875,7 +875,7 @@ if (tree == NULL) error->all("Per-atom fix in equal-style variable formula"); - if (update->whichflag >= 0 && + if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) error->all("Fix in variable not computed at compatible time"); Tree *newtree = new Tree(); @@ -890,7 +890,7 @@ } else if (nbracket == 1 && index1 > 0 && fix->peratom_flag && fix->size_peratom == 0) { - if (update->whichflag >= 0 && + if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) error->all("Fix in variable not computed at compatible time"); peratom2global(1,NULL,fix->scalar_atom,1,index1, @@ -905,7 +905,7 @@ error->all("Per-atom fix in equal-style variable formula"); if (index2 > fix->size_peratom) error->all("Fix vector in variable formula is too small"); - if (update->whichflag >= 0 && + if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) error->all("Fix in variable not computed at compatible time"); Tree *newtree = new Tree(); @@ -922,7 +922,7 @@ if (index2 > fix->size_peratom) error->all("Fix vector in variable formula is too small"); - if (update->whichflag >= 0 && + if (update->whichflag > 0 && update->ntimestep % fix->peratom_freq) error->all("Fix in variable not computed at compatible time"); peratom2global(1,NULL,&fix->vector_atom[0][index2-1], diff -Naur lammps-19Aug09/src/verlet.cpp lammps-21Aug09/src/verlet.cpp --- lammps-19Aug09/src/verlet.cpp 2009-01-09 11:18:56.000000000 -0700 +++ lammps-21Aug09/src/verlet.cpp 2009-08-21 13:05:42.000000000 -0600 @@ -122,10 +122,59 @@ } /* ---------------------------------------------------------------------- - iterate for n steps + setup without output + flag = 0 = just force calculation + flag = 1 = reneighbor and force calculation ------------------------------------------------------------------------- */ -void Verlet::iterate(int n) +void Verlet::setup_minimal(int flag) +{ + // setup domain, communication and neighboring + // acquire ghosts + // build neighbor lists + + if (flag) { + if (triclinic) domain->x2lamda(atom->nlocal); + domain->pbc(); + domain->reset_box(); + comm->setup(); + if (neighbor->style) neighbor->setup_bins(); + comm->exchange(); + comm->borders(); + if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + neighbor->build(); + neighbor->ncalls = 0; + } + + // compute all forces + + ev_set(update->ntimestep); + force_clear(); + + if (force->pair) force->pair->compute(eflag,vflag); + + if (atom->molecular) { + if (force->bond) force->bond->compute(eflag,vflag); + if (force->angle) force->angle->compute(eflag,vflag); + if (force->dihedral) force->dihedral->compute(eflag,vflag); + if (force->improper) force->improper->compute(eflag,vflag); + } + + if (force->kspace) { + force->kspace->setup(); + force->kspace->compute(eflag,vflag); + } + + if (force->newton) comm->reverse_communicate(); + + modify->setup(vflag); +} + +/* ---------------------------------------------------------------------- + run for N steps +------------------------------------------------------------------------- */ + +void Verlet::run(int n) { int nflag,ntimestep; diff -Naur lammps-19Aug09/src/verlet.h lammps-21Aug09/src/verlet.h --- lammps-19Aug09/src/verlet.h 2007-11-30 14:54:30.000000000 -0700 +++ lammps-21Aug09/src/verlet.h 2009-08-21 13:05:42.000000000 -0600 @@ -24,7 +24,8 @@ ~Verlet() {} void init(); void setup(); - void iterate(int); + void setup_minimal(int); + void run(int); private: int triclinic; // 0 if domain is orthog, 1 if triclinic