more changes to Kokkos Modify class
This commit is contained in:
@ -350,27 +350,62 @@ void ModifyKokkos::end_of_step()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
thermo energy call, only for relevant fixes
|
coupling energy call, only for relevant fixes
|
||||||
called by Thermo class
|
each thermostsat fix returns this via compute_scalar()
|
||||||
compute_scalar() is fix call to return energy
|
ecouple = cumulative energy added to reservoir by thermostatting
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double ModifyKokkos::thermo_energy()
|
double Modify::energy_couple()
|
||||||
{
|
{
|
||||||
double energy = 0.0;
|
double energy = 0.0;
|
||||||
for (int i = 0; i < n_thermo_energy; i++) {
|
for (int i = 0; i < n_energy_couple; i++) {
|
||||||
atomKK->sync(fix[list_thermo_energy[i]]->execution_space,
|
|
||||||
fix[list_thermo_energy[i]]->datamask_read);
|
|
||||||
int prev_auto_sync = lmp->kokkos->auto_sync;
|
int prev_auto_sync = lmp->kokkos->auto_sync;
|
||||||
if (!fix[list_thermo_energy[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
if (!fix[list_energy_couple[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||||
energy += fix[list_thermo_energy[i]]->compute_scalar();
|
energy += fix[list_energy_couple[i]]->compute_scalar();
|
||||||
lmp->kokkos->auto_sync = prev_auto_sync;
|
lmp->kokkos->auto_sync = prev_auto_sync;
|
||||||
atomKK->modified(fix[list_thermo_energy[i]]->execution_space,
|
atomKK->modified(fix[list_energy_couple[i]]->execution_space,
|
||||||
fix[list_thermo_energy[i]]->datamask_modify);
|
fix[list_energy_couple[i]]->datamask_modify);
|
||||||
}
|
}
|
||||||
return energy;
|
return energy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
global energy call, only for relevant fixes
|
||||||
|
they return energy via compute_scalar()
|
||||||
|
called by compute pe
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
double Modify::energy_global()
|
||||||
|
{
|
||||||
|
double energy = 0.0;
|
||||||
|
for (int i = 0; i < n_energy_global; i++) {
|
||||||
|
int prev_auto_sync = lmp->kokkos->auto_sync;
|
||||||
|
if (!fix[list_energy_global[i]]->kokkosable) lmp->kokkos->auto_sync = 1;
|
||||||
|
energy += fix[list_energy_global[i]]->compute_scalar();
|
||||||
|
lmp->kokkos->auto_sync = prev_auto_sync;
|
||||||
|
atomKK->modified(fix[list_energy_global[i]]->execution_space,
|
||||||
|
fix[list_energy_global[i]]->datamask_modify);
|
||||||
|
}
|
||||||
|
return energy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
peratom energy call, only for relevant fixes
|
||||||
|
called by compute pe/atom
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Modify::energy_atom(int nlocal, double *energy)
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
double *eatom;
|
||||||
|
|
||||||
|
//for (i = 0; i < n_energy_atom; i++) {
|
||||||
|
// eatom = fix[list_energy_atom[i]]->eatom;
|
||||||
|
// if (!eatom) continue;
|
||||||
|
// for (j = 0; j < nlocal; j++) energy[j] += eatom[j];
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
post_run call
|
post_run call
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -37,7 +37,9 @@ class ModifyKokkos : public Modify {
|
|||||||
void post_force(int);
|
void post_force(int);
|
||||||
void final_integrate();
|
void final_integrate();
|
||||||
void end_of_step();
|
void end_of_step();
|
||||||
double thermo_energy();
|
double energy_couple();
|
||||||
|
double energy_global();
|
||||||
|
void energy_atom();
|
||||||
void post_run();
|
void post_run();
|
||||||
|
|
||||||
void setup_pre_force_respa(int, int);
|
void setup_pre_force_respa(int, int);
|
||||||
|
|||||||
Reference in New Issue
Block a user