Commit eab88b98 authored by Sievers's avatar Sievers
Browse files

Merge branch 'master' into fix_python_dynmat

parents f812b94e 5e118783
Loading
Loading
Loading
Loading
+31 −26
Original line number Diff line number Diff line
@@ -362,6 +362,7 @@ void MSM::setup()

  nmax_direct = 8*(nxhi_direct+1)*(nyhi_direct+1)*(nzhi_direct+1);

  deallocate();
  if (peratom_allocate_flag) deallocate_peratom();

  // compute direct sum interaction weights
@@ -612,8 +613,6 @@ void MSM::compute(int eflag, int vflag)

void MSM::allocate()
{
  deallocate();

  // interpolation coeffs

  order_allocated = order;
@@ -635,9 +634,9 @@ void MSM::allocate()
  // allocate memory for each grid level

  for (int n=0; n<levels; n++) {

    memory->create3d_offset(qgrid[n],nzlo_out[n],nzhi_out[n],
            nylo_out[n],nyhi_out[n],nxlo_out[n],nxhi_out[n],"msm:qgrid");

    memory->create3d_offset(egrid[n],nzlo_out[n],nzhi_out[n],
            nylo_out[n],nyhi_out[n],nxlo_out[n],nxhi_out[n],"msm:egrid");

@@ -660,25 +659,31 @@ void MSM::allocate()

void MSM::deallocate()
{
  delete cg_all;
  cg_all = nullptr;

  memory->destroy2d_offset(phi1d,-order_allocated);
  memory->destroy2d_offset(dphi1d,-order_allocated);

  if (cg_all) delete cg_all;
  cg_all = nullptr;

  for (int n=0; n<levels; n++) {
    if (qgrid[n])
      memory->destroy3d_offset(qgrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]);

    if (egrid[n])
      memory->destroy3d_offset(egrid[n],nzlo_out[n],nylo_out[n],nxlo_out[n]);

    if (world_levels)
      if (world_levels[n] != MPI_COMM_NULL)
          MPI_Comm_free(&world_levels[n]);
    world_levels[n] = MPI_COMM_NULL;
    active_flag[n] = 0;

    if (cg) {
      if (cg[n]) {
        delete cg[n];
        cg[n] = nullptr;
      }
    }
  }
}

/* ----------------------------------------------------------------------
   allocate per-atom virial memory that depends on # of grid points
@@ -765,7 +770,6 @@ void MSM::deallocate_peratom()

void MSM::allocate_levels()
{
  deallocate_levels();
  ngrid = new int[levels];

  cg = new GridComm*[levels];
@@ -815,21 +819,21 @@ void MSM::allocate_levels()
  v5grid = new double***[levels];

  for (int n=0; n<levels; n++) {
    cg[n] = nullptr;
    cg[n] = NULL;
    world_levels[n] = MPI_COMM_NULL;
    active_flag[n] = 0;
    cg_peratom[n] = nullptr;
    cg_peratom[n] = NULL;

    qgrid[n] = nullptr;
    egrid[n] = nullptr;
    qgrid[n] = NULL;
    egrid[n] = NULL;

    v0grid[n] = nullptr;
    v1grid[n] = nullptr;
    v2grid[n] = nullptr;
    v3grid[n] = nullptr;
    v4grid[n] = nullptr;
    v5grid[n] = nullptr;
    v0grid[n] = NULL;
    v1grid[n] = NULL;
    v2grid[n] = NULL;
    v3grid[n] = NULL;
    v4grid[n] = NULL;
    v5grid[n] = NULL;
  }

}

/* ----------------------------------------------------------------------
@@ -1105,6 +1109,7 @@ void MSM::set_grid_global()

  if (!domain->nonperiodic) levels -= 1;

  deallocate_levels();
  allocate_levels();

  // find number of grid levels in each direction
+43 −35
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ using namespace MathConst;
#define DELTA 16384
#define DELTA_BONUS 8192

int AtomVec::num_atom_vecs = 0;

/* ---------------------------------------------------------------------- */

AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)
@@ -54,6 +56,8 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)

  threads = NULL;

  ++num_atom_vecs;

  // peratom variables auto-included in corresponding child style fields string
  // these fields cannot be specified in the fields string

@@ -93,9 +97,12 @@ AtomVec::~AtomVec()
  int datatype,cols;
  void *pdata;

  --num_atom_vecs;

  for (int i = 0; i < nargcopy; i++) delete [] argcopy[i];
  delete [] argcopy;

  if (num_atom_vecs == 0) {
    memory->destroy(atom->tag);
    memory->destroy(atom->type);
    memory->destroy(atom->mask);
@@ -134,6 +141,7 @@ AtomVec::~AtomVec()
        }
      }
    }
  }

  destroy_method(&mgrow);
  destroy_method(&mcopy);
+4 −0
Original line number Diff line number Diff line
@@ -209,6 +209,10 @@ class AtomVec : protected Pointers {

  bool *threads;

  // counter for atom vec instances

  static int num_atom_vecs;

  // local methods

  void grow_nmax();