forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2896 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
83135c03c3
commit
39b2a7831c
|
@ -176,7 +176,7 @@ void Temper::command(int narg, char **arg)
|
||||||
// setup tempering runs
|
// setup tempering runs
|
||||||
|
|
||||||
int i,which,partner,swap,partner_set_temp,partner_world;
|
int i,which,partner,swap,partner_set_temp,partner_world;
|
||||||
double pe,pe_partner,boltz_factor,new_temp;
|
double pe,pe_partner,ke,boltz_factor,new_temp;
|
||||||
MPI_Status status;
|
MPI_Status status;
|
||||||
|
|
||||||
if (me_universe == 0 && universe->uscreen)
|
if (me_universe == 0 && universe->uscreen)
|
||||||
|
@ -193,16 +193,15 @@ void Temper::command(int narg, char **arg)
|
||||||
timer->barrier_start(TIME_LOOP);
|
timer->barrier_start(TIME_LOOP);
|
||||||
|
|
||||||
for (int iswap = 0; iswap < nswaps; iswap++) {
|
for (int iswap = 0; iswap < nswaps; iswap++) {
|
||||||
|
|
||||||
// run for nevery timesteps
|
// run for nevery timesteps
|
||||||
|
|
||||||
update->integrate->iterate(nevery);
|
update->integrate->iterate(nevery);
|
||||||
|
|
||||||
// compute PE, normalize if thermo PE does
|
// compute PE
|
||||||
// notify compute it will be called at next swap
|
// notify compute it will be called at next swap
|
||||||
|
|
||||||
pe = pe_compute->compute_scalar();
|
pe = pe_compute->compute_scalar();
|
||||||
if (output->thermo->normflag) pe /= atom->natoms;
|
|
||||||
pe_compute->addstep(update->ntimestep + nevery);
|
pe_compute->addstep(update->ntimestep + nevery);
|
||||||
|
|
||||||
// which = which of 2 kinds of swaps to do (0,1)
|
// which = which of 2 kinds of swaps to do (0,1)
|
||||||
|
@ -268,6 +267,10 @@ void Temper::command(int narg, char **arg)
|
||||||
|
|
||||||
MPI_Bcast(&swap,1,MPI_INT,0,world);
|
MPI_Bcast(&swap,1,MPI_INT,0,world);
|
||||||
|
|
||||||
|
// rescale kinetic energy via velocities if move is accepted
|
||||||
|
|
||||||
|
if (swap) scale_velocities(partner_set_temp,my_set_temp);
|
||||||
|
|
||||||
// if my world swapped, all procs in world reset temp target of Fix
|
// if my world swapped, all procs in world reset temp target of Fix
|
||||||
|
|
||||||
if (swap) {
|
if (swap) {
|
||||||
|
@ -304,6 +307,24 @@ void Temper::command(int narg, char **arg)
|
||||||
update->beginstep = update->endstep = 0;
|
update->beginstep = update->endstep = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
scale kinetic energy via velocities a la Sugita
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Temper::scale_velocities(int t_partner, int t_me)
|
||||||
|
{
|
||||||
|
double sfactor = sqrt(set_temp[t_partner]/set_temp[t_me]);
|
||||||
|
|
||||||
|
double **v = atom->v;
|
||||||
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
for (int i = 0; i < nlocal; i++) {
|
||||||
|
v[i][0] = v[i][0]*sfactor;
|
||||||
|
v[i][1] = v[i][1]*sfactor;
|
||||||
|
v[i][2] = v[i][2]*sfactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
proc 0 prints current tempering status
|
proc 0 prints current tempering status
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -43,6 +43,7 @@ class Temper : protected Pointers {
|
||||||
int *world2temp; // world2temp[i] = temp simulated by world i
|
int *world2temp; // world2temp[i] = temp simulated by world i
|
||||||
int *world2root; // world2root[i] = root proc of world i
|
int *world2root; // world2root[i] = root proc of world i
|
||||||
|
|
||||||
|
void scale_velocities(int, int);
|
||||||
void print_status();
|
void print_status();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue