make removed DOF computation large system compatible
This commit is contained in:
@ -137,7 +137,7 @@ void FixLangevinEff::post_force_no_tally()
|
||||
dof = domain->dimension * particles;
|
||||
fix_dof = 0;
|
||||
for (int i = 0; i < modify->nfix; i++)
|
||||
fix_dof += modify->fix[i]->dof(igroup);
|
||||
fix_dof += (int)modify->fix[i]->dof(igroup);
|
||||
|
||||
// extra_dof = domain->dimension
|
||||
dof -= domain->dimension + fix_dof;
|
||||
@ -306,7 +306,7 @@ void FixLangevinEff::post_force_tally()
|
||||
dof = domain->dimension * particles;
|
||||
fix_dof = 0;
|
||||
for (int i = 0; i < modify->nfix; i++)
|
||||
fix_dof += modify->fix[i]->dof(igroup);
|
||||
fix_dof += (int)modify->fix[i]->dof(igroup);
|
||||
|
||||
// extra_dof = domain->dimension
|
||||
dof -= domain->dimension + fix_dof;
|
||||
|
||||
@ -525,7 +525,7 @@ void FixShakeKokkos<DeviceType>::operator()(TagFixShakePostForce<NEIGHFLAG,EVFLA
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
int FixShakeKokkos<DeviceType>::dof(int igroup)
|
||||
bigint FixShakeKokkos<DeviceType>::dof(int igroup)
|
||||
{
|
||||
d_mask = atomKK->k_mask.view<DeviceType>();
|
||||
d_tag = atomKK->k_tag.view<DeviceType>();
|
||||
@ -538,7 +538,7 @@ int FixShakeKokkos<DeviceType>::dof(int igroup)
|
||||
// count dof in a cluster if and only if
|
||||
// the central atom is in group and atom i is the central atom
|
||||
|
||||
int n = 0;
|
||||
bigint n = 0;
|
||||
{
|
||||
// local variables for lambda capture
|
||||
|
||||
@ -549,7 +549,7 @@ int FixShakeKokkos<DeviceType>::dof(int igroup)
|
||||
auto groupbit = group->bitmask[igroup];
|
||||
|
||||
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType>(0,nlocal),
|
||||
LAMMPS_LAMBDA(const int& i, int& n) {
|
||||
LAMMPS_LAMBDA(const int& i, bigint& n) {
|
||||
if (!(mask[i] & groupbit)) return;
|
||||
if (d_shake_flag[i] == 0) return;
|
||||
if (d_shake_atom(i,0) != tag[i]) return;
|
||||
@ -560,8 +560,8 @@ int FixShakeKokkos<DeviceType>::dof(int igroup)
|
||||
},n);
|
||||
}
|
||||
|
||||
int nall;
|
||||
MPI_Allreduce(&n,&nall,1,MPI_INT,MPI_SUM,world);
|
||||
bigint nall;
|
||||
MPI_Allreduce(&n,&nall,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
return nall;
|
||||
}
|
||||
|
||||
|
||||
@ -44,8 +44,6 @@ struct TagFixShakeUnpackExchange{};
|
||||
template<class DeviceType>
|
||||
class FixShakeKokkos : public FixShake, public KokkosBase {
|
||||
|
||||
//friend class FixEHEX;
|
||||
|
||||
public:
|
||||
typedef DeviceType device_type;
|
||||
typedef EV_FLOAT value_type;
|
||||
@ -77,7 +75,7 @@ class FixShakeKokkos : public FixShake, public KokkosBase {
|
||||
void shake_end_of_step(int vflag) override;
|
||||
void correct_coordinates(int vflag) override;
|
||||
|
||||
int dof(int) override;
|
||||
bigint dof(int) override;
|
||||
|
||||
void unconstrained_update() override;
|
||||
|
||||
|
||||
@ -4430,9 +4430,9 @@ void FixLbFluid::calc_MPT(double &totalmass, double totalmomentum[3], double &Ta
|
||||
------------------------------------------------------------------------- */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int FixLbFluid::adjust_dof_fix() /* Based on same private method in compute class */
|
||||
{ /* altered to return fix_dof */
|
||||
int fix_dof = 0;
|
||||
bigint FixLbFluid::adjust_dof_fix() /* Based on same private method in compute class */
|
||||
{ /* altered to return fix_dof */
|
||||
bigint fix_dof = 0;
|
||||
for (auto &ifix : modify->get_fix_list())
|
||||
if (ifix->dof_flag) fix_dof += ifix->dof(igroup);
|
||||
return fix_dof;
|
||||
|
||||
@ -182,7 +182,7 @@ class FixLbFluid : public Fix {
|
||||
void calc_fluidforceII(void);
|
||||
void calc_fluidforceweight(void);
|
||||
|
||||
int adjust_dof_fix();
|
||||
bigint adjust_dof_fix();
|
||||
double dof_compute();
|
||||
|
||||
/* nanopit parameters */
|
||||
|
||||
@ -287,21 +287,21 @@ void FixNVEManifoldRattle::update_var_params()
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------*/
|
||||
int FixNVEManifoldRattle::dof(int /*igroup*/)
|
||||
bigint FixNVEManifoldRattle::dof(int /*igroup*/)
|
||||
{
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
int natoms = 0;
|
||||
bigint natoms = 0;
|
||||
for (int i = 0; i < nlocal; ++i) {
|
||||
if (mask[i] & groupbit) ++natoms;
|
||||
}
|
||||
|
||||
int dofs;
|
||||
MPI_Allreduce( &natoms, &dofs, 1, MPI_INT, MPI_SUM, world );
|
||||
bigint dofs;
|
||||
MPI_Allreduce( &natoms, &dofs, 1, MPI_LMP_BIGINT, MPI_SUM, world );
|
||||
|
||||
// Make sure that, if there is just no or one atom, no dofs are subtracted,
|
||||
// since for the first atom already 3 dofs are subtracted because of the
|
||||
// centre of mass corrections:
|
||||
// center of mass corrections:
|
||||
if (dofs <= 1) dofs = 0;
|
||||
stats.dofs_removed = dofs;
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class FixNVEManifoldRattle : public Fix {
|
||||
void init() override;
|
||||
void reset_dt() override;
|
||||
void end_of_step() override;
|
||||
int dof(int) override;
|
||||
bigint dof(int) override;
|
||||
void setup(int) override {} // Not needed for fixNVE but is for fixNVT
|
||||
double memory_usage() override;
|
||||
|
||||
|
||||
@ -855,7 +855,7 @@ void FixPOEMS::pre_neighbor() {}
|
||||
count # of degrees-of-freedom removed by fix_poems for atoms in igroup
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int FixPOEMS::dof(int igroup)
|
||||
bigint FixPOEMS::dof(int igroup)
|
||||
{
|
||||
int groupbit = group->bitmask[igroup];
|
||||
|
||||
@ -877,17 +877,17 @@ int FixPOEMS::dof(int igroup)
|
||||
|
||||
// remove 3N - 6 dof for each rigid body if at least 2 atoms are in igroup
|
||||
|
||||
int n = 0;
|
||||
bigint n = 0;
|
||||
for (int ibody = 0; ibody < nbody; ibody++)
|
||||
if (nall[ibody] > 2) n += 3 * nall[ibody] - 6;
|
||||
|
||||
// subtract 3 additional dof for each joint if atom is also in igroup
|
||||
|
||||
int m = 0;
|
||||
bigint m = 0;
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (natom2body[i] > 1 && (mask[i] & groupbit)) m += 3 * (natom2body[i] - 1);
|
||||
int mall;
|
||||
MPI_Allreduce(&m, &mall, 1, MPI_INT, MPI_SUM, world);
|
||||
bigint mall;
|
||||
MPI_Allreduce(&m, &mall, 1, MPI_LMP_BIGINT, MPI_SUM, world);
|
||||
n += mall;
|
||||
|
||||
// delete local memory
|
||||
|
||||
@ -47,7 +47,7 @@ class FixPOEMS : public Fix {
|
||||
double memory_usage() override;
|
||||
|
||||
void pre_neighbor() override;
|
||||
int dof(int) override;
|
||||
bigint dof(int) override;
|
||||
void deform(int) override;
|
||||
int modify_param(int, char **) override;
|
||||
void reset_dt() override;
|
||||
|
||||
@ -1247,7 +1247,7 @@ void FixRigid::enforce2d()
|
||||
return total count of DOF
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int FixRigid::dof(int tgroup)
|
||||
bigint FixRigid::dof(int tgroup)
|
||||
{
|
||||
// cannot count DOF correctly unless setup_bodies_static() has been called
|
||||
|
||||
@ -1306,7 +1306,7 @@ int FixRigid::dof(int tgroup)
|
||||
// 3d body with any finite-size M should have 6 dof, remove (3N+6M) - 6
|
||||
// 2d body with any finite-size M should have 3 dof, remove (2N+3M) - 3
|
||||
|
||||
int n = 0;
|
||||
bigint n = 0;
|
||||
nlinear = 0;
|
||||
if (domain->dimension == 3) {
|
||||
for (int ibody = 0; ibody < nbody; ibody++)
|
||||
|
||||
@ -48,7 +48,7 @@ class FixRigid : public Fix {
|
||||
|
||||
void setup_pre_neighbor() override;
|
||||
void pre_neighbor() override;
|
||||
int dof(int) override;
|
||||
bigint dof(int) override;
|
||||
void deform(int) override;
|
||||
void reset_dt() override;
|
||||
void zero_momentum() override;
|
||||
|
||||
@ -1123,7 +1123,7 @@ void FixRigidSmall::enforce2d()
|
||||
return total count of DOF
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int FixRigidSmall::dof(int tgroup)
|
||||
bigint FixRigidSmall::dof(int tgroup)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
@ -1195,7 +1195,7 @@ int FixRigidSmall::dof(int tgroup)
|
||||
|
||||
double *inertia;
|
||||
|
||||
int n = 0;
|
||||
bigint n = 0;
|
||||
nlinear = 0;
|
||||
if (domain->dimension == 3) {
|
||||
for (int ibody = 0; ibody < nlocal_body; ibody++) {
|
||||
@ -1216,8 +1216,8 @@ int FixRigidSmall::dof(int tgroup)
|
||||
|
||||
memory->destroy(counts);
|
||||
|
||||
int nall;
|
||||
MPI_Allreduce(&n,&nall,1,MPI_INT,MPI_SUM,world);
|
||||
bigint nall;
|
||||
MPI_Allreduce(&n,&nall,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
return nall;
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ class FixRigidSmall : public Fix {
|
||||
|
||||
void setup_pre_neighbor() override;
|
||||
void pre_neighbor() override;
|
||||
int dof(int) override;
|
||||
bigint dof(int) override;
|
||||
void deform(int) override;
|
||||
void reset_dt() override;
|
||||
void zero_momentum() override;
|
||||
|
||||
@ -755,7 +755,7 @@ void FixShake::min_post_force(int vflag)
|
||||
count # of degrees-of-freedom removed by SHAKE for atoms in igroup
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int FixShake::dof(int igroup)
|
||||
bigint FixShake::dof(int igroup)
|
||||
{
|
||||
int groupbit = group->bitmask[igroup];
|
||||
|
||||
@ -766,7 +766,7 @@ int FixShake::dof(int igroup)
|
||||
// count dof in a cluster if and only if
|
||||
// the central atom is in group and atom i is the central atom
|
||||
|
||||
int n = 0;
|
||||
bigint n = 0;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (!(mask[i] & groupbit)) continue;
|
||||
if (shake_flag[i] == 0) continue;
|
||||
@ -777,8 +777,8 @@ int FixShake::dof(int igroup)
|
||||
else if (shake_flag[i] == 4) n += 3;
|
||||
}
|
||||
|
||||
int nall;
|
||||
MPI_Allreduce(&n,&nall,1,MPI_INT,MPI_SUM,world);
|
||||
bigint nall;
|
||||
MPI_Allreduce(&n,&nall,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
return nall;
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ class FixShake : public Fix {
|
||||
virtual void correct_coordinates(int vflag);
|
||||
virtual void correct_velocities();
|
||||
|
||||
int dof(int) override;
|
||||
bigint dof(int) override;
|
||||
void reset_dt() override;
|
||||
void *extract(const char *, int &) override;
|
||||
double compute_scalar() override;
|
||||
|
||||
@ -83,7 +83,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
extra_dof = domain->dimension;
|
||||
dynamic_user = 0;
|
||||
fix_dof = 0;
|
||||
fix_dof = 0.0;
|
||||
|
||||
// setup list of timesteps
|
||||
|
||||
|
||||
@ -236,7 +236,7 @@ class Fix : protected Pointers {
|
||||
virtual double compute_vector(int) { return 0.0; }
|
||||
virtual double compute_array(int, int) { return 0.0; }
|
||||
|
||||
virtual int dof(int) { return 0; }
|
||||
virtual bigint dof(int) { return 0; }
|
||||
virtual void deform(int) {}
|
||||
virtual void reset_target(double) {}
|
||||
virtual void reset_dt() {}
|
||||
|
||||
Reference in New Issue
Block a user