Commit 6c08503d authored by Aidan Thompson's avatar Aidan Thompson
Browse files

Created MLIAP class for data, passes all tests

parent 07e05300
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -312,9 +312,9 @@ void ComputeMLIAP::compute_array()
  for (int i = 0; i < atom->nlocal; i++) {
    int iglobal = atom->tag[i];
    int irow = 3*(iglobal-1)+1;
    mliaparray[irow][mliap->lastcol] = atom->f[i][0];
    mliaparray[irow+1][mliap->lastcol] = atom->f[i][1];
    mliaparray[irow+2][mliap->lastcol] = atom->f[i][2];
    mliaparray[irow][lastcol] = atom->f[i][0];
    mliaparray[irow+1][lastcol] = atom->f[i][1];
    mliaparray[irow+2][lastcol] = atom->f[i][2];
  }

  // accumulate bispectrum virial contributions to global array
@@ -337,19 +337,19 @@ void ComputeMLIAP::compute_array()

  int irow = 0;
  double reference_energy = c_pe->compute_scalar();
  mliaparrayall[irow++][mliap->lastcol] = reference_energy;
  mliaparrayall[irow++][lastcol] = reference_energy;

  // copy virial stress to last column
  // switch to Voigt notation

  c_virial->compute_vector();
  irow += 3*mliap->natoms;
  mliaparrayall[irow++][mliap->lastcol] = c_virial->vector[0];
  mliaparrayall[irow++][mliap->lastcol] = c_virial->vector[1];
  mliaparrayall[irow++][mliap->lastcol] = c_virial->vector[2];
  mliaparrayall[irow++][mliap->lastcol] = c_virial->vector[5];
  mliaparrayall[irow++][mliap->lastcol] = c_virial->vector[4];
  mliaparrayall[irow++][mliap->lastcol] = c_virial->vector[3];
  mliaparrayall[irow++][lastcol] = c_virial->vector[0];
  mliaparrayall[irow++][lastcol] = c_virial->vector[1];
  mliaparrayall[irow++][lastcol] = c_virial->vector[2];
  mliaparrayall[irow++][lastcol] = c_virial->vector[5];
  mliaparrayall[irow++][lastcol] = c_virial->vector[4];
  mliaparrayall[irow++][lastcol] = c_virial->vector[3];

}

+5 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@
using namespace LAMMPS_NS;

MLIAP::MLIAP(LAMMPS *lmp, int ndescriptors_in, int nparams_in, int nelements_in, 
             int gradgradflag_in, int *map_in, class MLIAPModel*, class MLIAPDescriptor*) :
             int gradgradflag_in, int *map_in, class MLIAPModel* model_in, class MLIAPDescriptor* descriptor_in) :
  Pointers(lmp),
  list(NULL), 
  gradforce(NULL), 
@@ -47,6 +47,8 @@ MLIAP::MLIAP(LAMMPS *lmp, int ndescriptors_in, int nparams_in, int nelements_in,
  nelements = nelements_in;
  gradgradflag = gradgradflag_in;
  map = map_in;
  model = model_in;
  descriptor = descriptor_in;

  gamma_nnz = model->get_gamma_nnz();
  ndims_force = 3;
@@ -54,7 +56,8 @@ MLIAP::MLIAP(LAMMPS *lmp, int ndescriptors_in, int nparams_in, int nelements_in,
  yoffset = nparams*nelements;
  zoffset = 2*yoffset;
  natoms = atom->natoms;

  size_array_rows = 1+ndims_force*natoms+ndims_virial;
  size_array_cols = nparams*nelements+1;
  size_gradforce = ndims_force*nparams*nelements;

  natomdesc_max = 0;
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class MLIAP : protected Pointers {

  // private:
  int size_array_rows, size_array_cols;
  int natoms, size_gradforce, lastcol;
  int natoms, size_gradforce;
  int yoffset, zoffset;
  int ndims_force, ndims_virial;
  class NeighList *list;