From 3dd9ad488fab68110bf982ca6cf7b86c276e7cff Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Tue, 31 Mar 2020 21:58:43 -0600 Subject: [PATCH 01/54] Turned on MLIAPModelSNAP --- src/MLIAP/mliap_descriptor_snap.cpp | 751 ++++++++++++++++++++++++++++ src/MLIAP/mliap_descriptor_snap.h | 67 +++ src/MLIAP/mliap_model_snap.cpp | 426 ++++++++++++++++ src/MLIAP/mliap_model_snap.h | 59 +++ src/MLIAP/pair_mliap_snap.cpp | 702 ++++++++++++++++++++++++++ src/MLIAP/pair_mliap_snap.h | 134 +++++ 6 files changed, 2139 insertions(+) create mode 100644 src/MLIAP/mliap_descriptor_snap.cpp create mode 100644 src/MLIAP/mliap_descriptor_snap.h create mode 100644 src/MLIAP/mliap_model_snap.cpp create mode 100644 src/MLIAP/mliap_model_snap.h create mode 100644 src/MLIAP/pair_mliap_snap.cpp create mode 100644 src/MLIAP/pair_mliap_snap.h diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp new file mode 100644 index 0000000000..3a0664dddf --- /dev/null +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -0,0 +1,751 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "mliap_descriptor_snap.h" +#include +#include +#include +#include +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "sna.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define MAXWORD 3 + +/* ---------------------------------------------------------------------- */ + +//MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp): Pointers(lmp) +MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp): Pair(lmp) +{ + single_enable = 0; + restartinfo = 0; + one_coeff = 1; + manybody_flag = 1; + + nelements = 0; + elements = NULL; + radelem = NULL; + wjelem = NULL; + coeffelem = NULL; + + beta_max = 0; + beta = NULL; + bispectrum = NULL; + snaptr = NULL; +} + +/* ---------------------------------------------------------------------- */ + +MLIAPDescriptorSNAP::~MLIAPDescriptorSNAP() +{ + if (copymode) return; + + if (nelements) { + for (int i = 0; i < nelements; i++) + delete[] elements[i]; + delete[] elements; + memory->destroy(radelem); + memory->destroy(wjelem); + memory->destroy(coeffelem); + } + + memory->destroy(beta); + memory->destroy(bispectrum); + + delete snaptr; + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(map); + } + +} + +/* ---------------------------------------------------------------------- + This version is a straightforward implementation + ---------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::compute(int eflag, int vflag) +{ + int i,j,jnum,ninside; + double delx,dely,delz,evdwl,rsq; + double fij[3]; + int *jlist,*numneigh,**firstneigh; + + ev_init(eflag,vflag); + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + + if (beta_max < list->inum) { + memory->grow(beta,list->inum,ncoeff,"MLIAPDescriptorSNAP:beta"); + memory->grow(bispectrum,list->inum,ncoeff,"MLIAPDescriptorSNAP:bispectrum"); + beta_max = list->inum; + } + + // compute dE_i/dB_i = beta_i for all i in list + + if (quadraticflag || eflag) + compute_bispectrum(); + compute_beta(); + + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + + const double xtmp = x[i][0]; + const double ytmp = x[i][1]; + const double ztmp = x[i][2]; + const int itype = type[i]; + const int ielem = map[itype]; + const double radi = radelem[ielem]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + + // insure rij, inside, wj, and rcutij are of size jnum + + snaptr->grow_rij(jnum); + + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // wj = weights for neighbors of I within cutoff + // rcutij = cutoffs for neighbors of I within cutoff + // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi + + ninside = 0; + for (int jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + int jelem = map[jtype]; + + if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { + snaptr->rij[ninside][0] = delx; + snaptr->rij[ninside][1] = dely; + snaptr->rij[ninside][2] = delz; + snaptr->inside[ninside] = j; + snaptr->wj[ninside] = wjelem[jelem]; + snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; + snaptr->element[ninside] = jelem; // element index for alloy snap + ninside++; + } + } + + // compute Ui, Yi for atom I + + snaptr->compute_ui(ninside, ielem); + + // for neighbors of I within cutoff: + // compute Fij = dEi/dRj = -dEi/dRi + // add to Fi, subtract from Fj + + snaptr->compute_yi(beta[ii]); + //for (int q=0; qidxu_max*2; q++){ + // fprintf(screen, "%i %f\n",q, snaptr->ylist_r[q]); + //} + + for (int jj = 0; jj < ninside; jj++) { + int j = snaptr->inside[jj]; + snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], + snaptr->rcutij[jj],jj, snaptr->element[jj]); + + snaptr->compute_deidrj(fij); + + f[i][0] += fij[0]; + f[i][1] += fij[1]; + f[i][2] += fij[2]; + f[j][0] -= fij[0]; + f[j][1] -= fij[1]; + f[j][2] -= fij[2]; + + // tally per-atom virial contribution + + if (vflag) + ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0, + fij[0],fij[1],fij[2], + -snaptr->rij[jj][0],-snaptr->rij[jj][1], + -snaptr->rij[jj][2]); + } + //fprintf(screen, "%f %f %f\n",f[i][0],f[i][1],f[i][2]); + + // tally energy contribution + + if (eflag) { + + // evdwl = energy of atom I, sum over coeffs_k * Bi_k + + double* coeffi = coeffelem[ielem]; + evdwl = coeffi[0]; + // snaptr->copy_bi2bvec(); + + // E = beta.B + 0.5*B^t.alpha.B + + // linear contributions + + for (int icoeff = 0; icoeff < ncoeff; icoeff++) + evdwl += coeffi[icoeff+1]*bispectrum[ii][icoeff]; + + // quadratic contributions + + if (quadraticflag) { + int k = ncoeff+1; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = bispectrum[ii][icoeff]; + evdwl += 0.5*coeffi[k++]*bveci*bveci; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { + double bvecj = bispectrum[ii][jcoeff]; + evdwl += coeffi[k++]*bveci*bvecj; + } + } + } + ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0); + } + + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + compute beta +------------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::compute_beta() +{ + int i; + int *type = atom->type; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + const int itype = type[i]; + const int ielem = map[itype]; + double* coeffi = coeffelem[ielem]; + + for (int icoeff = 0; icoeff < ncoeff; icoeff++) + beta[ii][icoeff] = coeffi[icoeff+1]; + + if (quadraticflag) { + int k = ncoeff+1; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = bispectrum[ii][icoeff]; + beta[ii][icoeff] += coeffi[k]*bveci; + k++; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { + double bvecj = bispectrum[ii][jcoeff]; + beta[ii][icoeff] += coeffi[k]*bvecj; + beta[ii][jcoeff] += coeffi[k]*bveci; + k++; + } + } + } + } +} + +/* ---------------------------------------------------------------------- + compute bispectrum +------------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::compute_bispectrum() +{ + int i,j,jnum,ninside; + double delx,dely,delz,rsq; + int *jlist; + + double **x = atom->x; + int *type = atom->type; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + + const double xtmp = x[i][0]; + const double ytmp = x[i][1]; + const double ztmp = x[i][2]; + const int itype = type[i]; + const int ielem = map[itype]; + const double radi = radelem[ielem]; + + jlist = list->firstneigh[i]; + jnum = list->numneigh[i]; + + // insure rij, inside, wj, and rcutij are of size jnum + + snaptr->grow_rij(jnum); + + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // wj = weights for neighbors of I within cutoff + // rcutij = cutoffs for neighbors of I within cutoff + // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi + + ninside = 0; + for (int jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + int jelem = map[jtype]; + + if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { + snaptr->rij[ninside][0] = delx; + snaptr->rij[ninside][1] = dely; + snaptr->rij[ninside][2] = delz; + snaptr->inside[ninside] = j; + snaptr->wj[ninside] = wjelem[jelem]; + snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; + snaptr->element[ninside] = jelem; // element index for alloy snap + ninside++; + } + } + + snaptr->compute_ui(ninside, ielem); + snaptr->compute_zi(); + snaptr->compute_bi(ielem); + + for (int icoeff = 0; icoeff < ncoeff; icoeff++){ + bispectrum[ii][icoeff] = snaptr->blist[icoeff]; + } + } + +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"mliap_descriptor_snap:setflag"); + memory->create(cutsq,n+1,n+1,"mliap_descriptor_snap:cutsq"); + memory->create(map,n+1,"mliap_descriptor_snap:map"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::settings(int narg, char ** /* arg */) +{ + if (narg > 0) + error->all(FLERR,"Illegal pair_style command"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::coeff(int narg, char **arg) +{ + if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + if (nelements) { + for (int i = 0; i < nelements; i++) + delete[] elements[i]; + delete[] elements; + memory->destroy(radelem); + memory->destroy(wjelem); + memory->destroy(coeffelem); + } + + char* type1 = arg[0]; + char* type2 = arg[1]; + char* coefffilename = arg[2]; + char* paramfilename = arg[3]; + char** elemtypes = &arg[4]; + + // insure I,J args are * * + + if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) + error->all(FLERR,"Incorrect args for pair coefficients"); + + // read snapcoeff and snapparam files + + read_files(coefffilename,paramfilename); + + if (!quadraticflag) + ncoeff = ncoeffall - 1; + else { + + // ncoeffall should be (ncoeff+2)*(ncoeff+1)/2 + // so, ncoeff = floor(sqrt(2*ncoeffall))-1 + + ncoeff = sqrt(2*ncoeffall)-1; + ncoeffq = (ncoeff*(ncoeff+1))/2; + int ntmp = 1+ncoeff+ncoeffq; + if (ntmp != ncoeffall) { + printf("ncoeffall = %d ntmp = %d ncoeff = %d \n",ncoeffall,ntmp,ncoeff); + error->all(FLERR,"Incorrect SNAP coeff file"); + } + } + + // read args that map atom types to SNAP elements + // map[i] = which element the Ith atom type is, -1 if not mapped + // map[0] is not used + + for (int i = 1; i <= atom->ntypes; i++) { + char* elemname = elemtypes[i-1]; + int jelem; + for (jelem = 0; jelem < nelements; jelem++) + if (strcmp(elemname,elements[jelem]) == 0) + break; + + if (jelem < nelements) + map[i] = jelem; + else if (strcmp(elemname,"NULL") == 0) map[i] = -1; + else error->all(FLERR,"Incorrect args for pair coefficients"); + } + + // clear setflag since coeff() called once with I,J = * * + + int n = atom->ntypes; + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + // set setflag i,j for type pairs where both are mapped to elements + + int count = 0; + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + if (map[i] >= 0 && map[j] >= 0) { + setflag[i][j] = 1; + count++; + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + + snaptr = new SNA(lmp, rfac0, twojmax, + rmin0, switchflag, bzeroflag, + alloyflag, wselfallflag, nelements); + + if (ncoeff != snaptr->ncoeff) { + if (comm->me == 0) + printf("ncoeff = %d snancoeff = %d \n",ncoeff,snaptr->ncoeff); + error->all(FLERR,"Incorrect SNAP parameter file"); + } + + // Calculate maximum cutoff for all elements + + rcutmax = 0.0; + for (int ielem = 0; ielem < nelements; ielem++) + rcutmax = MAX(2.0*radelem[ielem]*rcutfac,rcutmax); + +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::init_style() +{ + if (force->newton_pair == 0) + error->all(FLERR,"Pair style SNAP requires newton pair on"); + + // need a full neighbor list + + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; + + snaptr->init(); + +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double MLIAPDescriptorSNAP::init_one(int i, int j) +{ + if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + return (radelem[map[i]] + + radelem[map[j]])*rcutfac; +} + +/* ---------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) +{ + + // open SNAP coefficient file on proc 0 + + FILE *fpcoeff; + if (comm->me == 0) { + fpcoeff = force->open_potential(coefffilename); + if (fpcoeff == NULL) { + char str[128]; + snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); + error->one(FLERR,str); + } + } + + char line[MAXLINE],*ptr; + int eof = 0; + + int n; + int nwords = 0; + while (nwords == 0) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if ((ptr = strchr(line,'#'))) *ptr = '\0'; + nwords = atom->count_words(line); + } + if (nwords != 2) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + char* words[MAXWORD]; + int iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + iword = 1; + words[iword] = strtok(NULL,"' \t\n\r\f"); + + nelements = atoi(words[0]); + ncoeffall = atoi(words[1]); + + // set up element lists + + elements = new char*[nelements]; + memory->create(radelem,nelements,"mliap_snap_descriptor:radelem"); + memory->create(wjelem,nelements,"mliap_snap_descriptor:wjelem"); + memory->create(coeffelem,nelements,ncoeffall,"mliap_snap_descriptor:coeffelem"); + + // Loop over nelements blocks in the SNAP coefficient file + + for (int ielem = 0; ielem < nelements; ielem++) { + + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + nwords = atom->count_words(line); + if (nwords != 3) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + iword = 1; + words[iword] = strtok(NULL,"' \t\n\r\f"); + iword = 2; + words[iword] = strtok(NULL,"' \t\n\r\f"); + + char* elemtmp = words[0]; + int n = strlen(elemtmp) + 1; + elements[ielem] = new char[n]; + strcpy(elements[ielem],elemtmp); + + radelem[ielem] = atof(words[1]); + wjelem[ielem] = atof(words[2]); + + + if (comm->me == 0) { + if (screen) fprintf(screen,"SNAP Element = %s, Radius %g, Weight %g \n", + elements[ielem], radelem[ielem], wjelem[ielem]); + if (logfile) fprintf(logfile,"SNAP Element = %s, Radius %g, Weight %g \n", + elements[ielem], radelem[ielem], wjelem[ielem]); + } + + for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + nwords = atom->count_words(line); + if (nwords != 1) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + + coeffelem[ielem][icoeff] = atof(words[0]); + + } + } + + if (comm->me == 0) fclose(fpcoeff); + + // set flags for required keywords + + rcutfacflag = 0; + twojmaxflag = 0; + + // Set defaults for optional keywords + + rfac0 = 0.99363; + rmin0 = 0.0; + switchflag = 1; + bzeroflag = 1; + bnormflag = 0; + quadraticflag = 0; + alloyflag = 0; + wselfallflag = 0; + chunksize = 2000; + + // open SNAP parameter file on proc 0 + + FILE *fpparam; + if (comm->me == 0) { + fpparam = force->open_potential(paramfilename); + if (fpparam == NULL) { + char str[128]; + snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); + error->one(FLERR,str); + } + } + + eof = 0; + while (1) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpparam); + if (ptr == NULL) { + eof = 1; + fclose(fpparam); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if ((ptr = strchr(line,'#'))) *ptr = '\0'; + nwords = atom->count_words(line); + if (nwords == 0) continue; + + if (nwords != 2) + error->all(FLERR,"Incorrect format in SNAP parameter file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + char* keywd = strtok(line,"' \t\n\r\f"); + char* keyval = strtok(NULL,"' \t\n\r\f"); + + if (comm->me == 0) { + if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); + if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval); + } + + if (strcmp(keywd,"rcutfac") == 0) { + rcutfac = atof(keyval); + rcutfacflag = 1; + } else if (strcmp(keywd,"twojmax") == 0) { + twojmax = atoi(keyval); + twojmaxflag = 1; + } else if (strcmp(keywd,"rfac0") == 0) + rfac0 = atof(keyval); + else if (strcmp(keywd,"rmin0") == 0) + rmin0 = atof(keyval); + else if (strcmp(keywd,"switchflag") == 0) + switchflag = atoi(keyval); + else if (strcmp(keywd,"bzeroflag") == 0) + bzeroflag = atoi(keyval); + else if (strcmp(keywd,"quadraticflag") == 0) + quadraticflag = atoi(keyval); + else if (strcmp(keywd,"alloyflag") == 0) + alloyflag = atoi(keyval); + else if (strcmp(keywd,"wselfallflag") == 0) + wselfallflag = atoi(keyval); + else if (strcmp(keywd,"chunksize") == 0) + chunksize = atoi(keyval); + else + error->all(FLERR,"Incorrect SNAP parameter file"); + } + + bnormflag = alloyflag; + + if (rcutfacflag == 0 || twojmaxflag == 0) + error->all(FLERR,"Incorrect SNAP parameter file"); + +} + +/* ---------------------------------------------------------------------- + memory usage +------------------------------------------------------------------------- */ + +double MLIAPDescriptorSNAP::memory_usage() +{ + double bytes = 0; + + int n = atom->ntypes+1; + bytes += n*n*sizeof(int); // setflag + bytes += n*n*sizeof(double); // cutsq + bytes += n*sizeof(int); // map + bytes += beta_max*ncoeff*sizeof(double); // bispectrum + bytes += beta_max*ncoeff*sizeof(double); // beta + + bytes += snaptr->memory_usage(); // SNA object + + return bytes; +} + diff --git a/src/MLIAP/mliap_descriptor_snap.h b/src/MLIAP/mliap_descriptor_snap.h new file mode 100644 index 0000000000..f4a37c1024 --- /dev/null +++ b/src/MLIAP/mliap_descriptor_snap.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef MLIAP_DESCRIPTOR_SNAP_H +#define MLIAP_DESCRIPTOR_SNAP_H + +#include "pair.h" + +namespace LAMMPS_NS { + + //class MLIAPDescriptorSNAP : protected Pointers { +class MLIAPDescriptorSNAP : public Pair { +public: + MLIAPDescriptorSNAP(class LAMMPS *); + ~MLIAPDescriptorSNAP(); + virtual void compute(int, int); + void settings(int, char **); + virtual void coeff(int, char **); + virtual void init_style(); + virtual double init_one(int, int); + virtual double memory_usage(); + + double rcutfac, quadraticflag; // declared public to workaround gcc 4.9 + int ncoeff; // compiler bug, manifest in KOKKOS package + +protected: + int ncoeffq, ncoeffall; + class SNA* snaptr; + virtual void allocate(); + void read_files(char *, char *); + inline int equal(double* x,double* y); + inline double dist2(double* x,double* y); + + void compute_beta(); + void compute_bispectrum(); + + double rcutmax; // max cutoff for all elements + int nelements; // # of unique elements + char **elements; // names of unique elements + double *radelem; // element radii + double *wjelem; // elements weights + double **coeffelem; // element bispectrum coefficients + double** beta; // betas for all atoms in list + double** bispectrum; // bispectrum components for all atoms in list + int *map; // mapping from atom types to elements + int twojmax, switchflag, bzeroflag, bnormflag; + int alloyflag, wselfallflag; + int chunksize; + double rfac0, rmin0, wj1, wj2; + int rcutfacflag, twojmaxflag; // flags for required parameters + int beta_max; // length of beta +}; + +} + +#endif + diff --git a/src/MLIAP/mliap_model_snap.cpp b/src/MLIAP/mliap_model_snap.cpp new file mode 100644 index 0000000000..3624b17b78 --- /dev/null +++ b/src/MLIAP/mliap_model_snap.cpp @@ -0,0 +1,426 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "mliap_model_snap.h" +#include +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neigh_list.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define MAXWORD 3 + +/* ---------------------------------------------------------------------- */ + +MLIAPModelSNAP::MLIAPModelSNAP(LAMMPS* lmp) : Pointers(lmp) +{ + nelements = 0; + elements = NULL; + coeffelem = NULL; + + beta_max = 0; + beta = NULL; + bispectrum = NULL; + + allocated = 0; +} + +/* ---------------------------------------------------------------------- */ + +MLIAPModelSNAP::~MLIAPModelSNAP() +{ + if (nelements) { + for (int i = 0; i < nelements; i++) + delete[] elements[i]; + delete[] elements; + memory->destroy(coeffelem); + } + + memory->destroy(beta); + memory->destroy(bispectrum); + + if (allocated) + memory->destroy(map); + +} + +/* ---------------------------------------------------------------------- + Calculate model gradients for each atom i.e. dE(B_i)/dB_i + ---------------------------------------------------------------------- */ + +void MLIAPModelSNAP::gradient(NeighList* list, double **bispectrum, double *atomenergy, double **beta, int eflag) +{ + int i; + int *type = atom->type; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + const int itype = type[i]; + const int ielem = map[itype]; + double* coeffi = coeffelem[ielem]; + + for (int icoeff = 0; icoeff < ncoeff; icoeff++) + beta[ii][icoeff] = coeffi[icoeff+1]; + + if (quadraticflag) { + int k = ncoeff+1; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = bispectrum[ii][icoeff]; + beta[ii][icoeff] += coeffi[k]*bveci; + k++; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { + double bvecj = bispectrum[ii][jcoeff]; + beta[ii][icoeff] += coeffi[k]*bvecj; + beta[ii][jcoeff] += coeffi[k]*bveci; + k++; + } + } + } + + if (eflag) { + + // energy of atom I, sum over coeffs_k * Bi_k + + double* coeffi = coeffelem[ielem]; + double etmp = coeffi[0]; + + // E = beta.B + 0.5*B^t.alpha.B + + // linear contributions + + for (int icoeff = 0; icoeff < ncoeff; icoeff++) + etmp += coeffi[icoeff+1]*bispectrum[ii][icoeff]; + + // quadratic contributions + + if (quadraticflag) { + int k = ncoeff+1; + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = bispectrum[ii][icoeff]; + etmp += 0.5*coeffi[k++]*bveci*bveci; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { + double bvecj = bispectrum[ii][jcoeff]; + etmp += coeffi[k++]*bveci*bvecj; + } + } + } + atomenergy[ii] = etmp; + } + + + } +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void MLIAPModelSNAP::allocate() +{ + allocated = 1; + int n = atom->ntypes; + memory->create(map,n+1,"mliap_model_snap:map"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void MLIAPModelSNAP::init(int narg, char **arg) +{ + if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + if (nelements) { + for (int i = 0; i < nelements; i++) + delete[] elements[i]; + delete[] elements; + memory->destroy(coeffelem); + } + + char* type1 = arg[0]; + char* type2 = arg[1]; + char* coefffilename = arg[2]; + char* paramfilename = arg[3]; + char** elemtypes = &arg[4]; + + // insure I,J args are * * + + if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) + error->all(FLERR,"Incorrect args for pair coefficients"); + + // read snapcoeff and snapparam files + + read_files(coefffilename,paramfilename); + + if (!quadraticflag) + ncoeff = ncoeffall - 1; + else { + + // ncoeffall should be (ncoeff+2)*(ncoeff+1)/2 + // so, ncoeff = floor(sqrt(2*ncoeffall))-1 + + ncoeff = sqrt(2*ncoeffall)-1; + ncoeffq = (ncoeff*(ncoeff+1))/2; + int ntmp = 1+ncoeff+ncoeffq; + if (ntmp != ncoeffall) { + printf("ncoeffall = %d ntmp = %d ncoeff = %d \n",ncoeffall,ntmp,ncoeff); + error->all(FLERR,"Incorrect SNAP coeff file"); + } + } + + // read args that map atom types to SNAP elements + // map[i] = which element the Ith atom type is, -1 if not mapped + // map[0] is not used + + for (int i = 1; i <= atom->ntypes; i++) { + char* elemname = elemtypes[i-1]; + int jelem; + for (jelem = 0; jelem < nelements; jelem++) + if (strcmp(elemname,elements[jelem]) == 0) + break; + + if (jelem < nelements) + map[i] = jelem; + else if (strcmp(elemname,"NULL") == 0) map[i] = -1; + else error->all(FLERR,"Incorrect args for pair coefficients"); + } + +} + +/* ---------------------------------------------------------------------- */ + +void MLIAPModelSNAP::read_files(char *coefffilename, char *paramfilename) +{ + + // open SNAP coefficient file on proc 0 + + FILE *fpcoeff; + if (comm->me == 0) { + fpcoeff = force->open_potential(coefffilename); + if (fpcoeff == NULL) { + char str[128]; + snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); + error->one(FLERR,str); + } + } + + char line[MAXLINE],*ptr; + int eof = 0; + + int n; + int nwords = 0; + while (nwords == 0) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if ((ptr = strchr(line,'#'))) *ptr = '\0'; + nwords = atom->count_words(line); + } + if (nwords != 2) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + char* words[MAXWORD]; + int iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + iword = 1; + words[iword] = strtok(NULL,"' \t\n\r\f"); + + nelements = atoi(words[0]); + ncoeffall = atoi(words[1]); + + // set up element lists + + elements = new char*[nelements]; + memory->create(coeffelem,nelements,ncoeffall,"mliap_snap_model:coeffelem"); + + // Loop over nelements blocks in the SNAP coefficient file + + for (int ielem = 0; ielem < nelements; ielem++) { + + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + nwords = atom->count_words(line); + if (nwords != 3) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + iword = 1; + words[iword] = strtok(NULL,"' \t\n\r\f"); + iword = 2; + words[iword] = strtok(NULL,"' \t\n\r\f"); + + char* elemtmp = words[0]; + int n = strlen(elemtmp) + 1; + elements[ielem] = new char[n]; + strcpy(elements[ielem],elemtmp); + + for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + nwords = atom->count_words(line); + if (nwords != 1) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + + coeffelem[ielem][icoeff] = atof(words[0]); + + } + } + + if (comm->me == 0) fclose(fpcoeff); + + // set flags for required keywords + + twojmaxflag = 0; + + // Set defaults for optional keywords + + quadraticflag = 0; + alloyflag = 0; + wselfallflag = 0; + chunksize = 2000; + + // open SNAP parameter file on proc 0 + + FILE *fpparam; + if (comm->me == 0) { + fpparam = force->open_potential(paramfilename); + if (fpparam == NULL) { + char str[128]; + snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); + error->one(FLERR,str); + } + } + + eof = 0; + while (1) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpparam); + if (ptr == NULL) { + eof = 1; + fclose(fpparam); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if ((ptr = strchr(line,'#'))) *ptr = '\0'; + nwords = atom->count_words(line); + if (nwords == 0) continue; + + if (nwords != 2) + error->all(FLERR,"Incorrect format in SNAP parameter file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + char* keywd = strtok(line,"' \t\n\r\f"); + char* keyval = strtok(NULL,"' \t\n\r\f"); + + if (comm->me == 0) { + if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); + if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval); + } + + if (strcmp(keywd,"twojmax") == 0) { + twojmax = atoi(keyval); + twojmaxflag = 1; + } else if (strcmp(keywd,"quadraticflag") == 0) + quadraticflag = atoi(keyval); + else if (strcmp(keywd,"alloyflag") == 0) + alloyflag = atoi(keyval); + else if (strcmp(keywd,"chunksize") == 0) + chunksize = atoi(keyval); + else if (strcmp(keywd,"chunksize") == 0) + chunksize = atoi(keyval); + else if (strcmp(keywd,"rcutfac") == 0 || + strcmp(keywd,"rfac0") == 0 || + strcmp(keywd,"rmin0") == 0 || + strcmp(keywd,"switchflag") == 0 || + strcmp(keywd,"bzeroflag") == 0) + continue; + else + error->all(FLERR,"Incorrect SNAP parameter file"); + } + + if (twojmaxflag == 0) + error->all(FLERR,"Incorrect SNAP parameter file"); + +} + +/* ---------------------------------------------------------------------- + memory usage +------------------------------------------------------------------------- */ + +double MLIAPModelSNAP::memory_usage() +{ + double bytes = 0; + + int n = atom->ntypes+1; + bytes += n*sizeof(int); // map + bytes += beta_max*ncoeff*sizeof(double); // bispectrum + bytes += beta_max*ncoeff*sizeof(double); // beta + + return bytes; +} + diff --git a/src/MLIAP/mliap_model_snap.h b/src/MLIAP/mliap_model_snap.h new file mode 100644 index 0000000000..553803e2d2 --- /dev/null +++ b/src/MLIAP/mliap_model_snap.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_MLIAP_DESCRIPTOR_SNAP_H +#define LMP_MLIAP_DESCRIPTOR_SNAP_H + +#include "pointers.h" + +namespace LAMMPS_NS { + +class MLIAPModelSNAP : protected Pointers { +public: + MLIAPModelSNAP(LAMMPS*); + ~MLIAPModelSNAP(); + virtual void gradient(class NeighList*, double**, double*, double**, int); + void settings(int, char **); + virtual void init(int, char **); + virtual double memory_usage(); + + double quadraticflag; // declared public to workaround gcc 4.9 + int ncoeff; // compiler bug, manifest in KOKKOS package + +protected: + int allocated; + int ncoeffq, ncoeffall; + virtual void allocate(); + void read_files(char *, char *); + inline int equal(double* x,double* y); + inline double dist2(double* x,double* y); + + void compute_beta(NeighList*); + + int nelements; // # of unique elements + char **elements; // names of unique elements + double **coeffelem; // element bispectrum coefficients + double** beta; // betas for all atoms in list + double** bispectrum; // bispectrum components for all atoms in list + int *map; // mapping from atom types to elements + int twojmax; + int alloyflag, wselfallflag; + int twojmaxflag; // flags for required parameters + int beta_max; // length of beta + int chunksize; +}; + +} + +#endif + diff --git a/src/MLIAP/pair_mliap_snap.cpp b/src/MLIAP/pair_mliap_snap.cpp new file mode 100644 index 0000000000..e9a1553497 --- /dev/null +++ b/src/MLIAP/pair_mliap_snap.cpp @@ -0,0 +1,702 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "mliap_model_snap.h" +#include "mliap_descriptor_snap.h" +#include "pair_mliap_snap.h" +#include +#include +#include +#include +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "sna.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define MAXWORD 3 + +/* ---------------------------------------------------------------------- */ + +PairMLIAPSNAP::PairMLIAPSNAP(LAMMPS *lmp) : Pair(lmp) +{ + single_enable = 0; + restartinfo = 0; + one_coeff = 1; + manybody_flag = 1; + + nelements = 0; + elements = NULL; + radelem = NULL; + wjelem = NULL; + + beta_max = 0; + atomenergy = NULL; + beta = NULL; + bispectrum = NULL; + snaptr = NULL; + model = NULL; + descriptor = NULL; +} + +/* ---------------------------------------------------------------------- */ + +PairMLIAPSNAP::~PairMLIAPSNAP() +{ + if (copymode) return; + + if (nelements) { + for (int i = 0; i < nelements; i++) + delete[] elements[i]; + delete[] elements; + memory->destroy(radelem); + memory->destroy(wjelem); + } + + memory->destroy(beta); + memory->destroy(bispectrum); + + delete snaptr; + delete model; + delete descriptor; + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(map); + } + +} + +/* ---------------------------------------------------------------------- + This version is a straightforward implementation + ---------------------------------------------------------------------- */ + +void PairMLIAPSNAP::compute(int eflag, int vflag) +{ + int i,j,jnum,ninside; + double delx,dely,delz,evdwl,rsq; + double fij[3]; + int *jlist,*numneigh,**firstneigh; + + ev_init(eflag,vflag); + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + + if (beta_max < list->inum) { + memory->grow(atomenergy,list->inum,"PairMLIAPSNAP:atomenergy"); + memory->grow(beta,list->inum,ncoeff,"PairMLIAPSNAP:beta"); + memory->grow(bispectrum,list->inum,ncoeff,"PairMLIAPSNAP:bispectrum"); + beta_max = list->inum; + } + + // compute E_i and beta_i = dE_i/dB_i for all i in list + + if (quadraticflag || eflag) + compute_bispectrum(); + model->gradient(list, bispectrum, atomenergy, beta, eflag); + + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + + const double xtmp = x[i][0]; + const double ytmp = x[i][1]; + const double ztmp = x[i][2]; + const int itype = type[i]; + const int ielem = map[itype]; + const double radi = radelem[ielem]; + + jlist = firstneigh[i]; + jnum = numneigh[i]; + + // insure rij, inside, wj, and rcutij are of size jnum + + snaptr->grow_rij(jnum); + + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // wj = weights for neighbors of I within cutoff + // rcutij = cutoffs for neighbors of I within cutoff + // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi + + ninside = 0; + for (int jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + int jelem = map[jtype]; + + if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { + snaptr->rij[ninside][0] = delx; + snaptr->rij[ninside][1] = dely; + snaptr->rij[ninside][2] = delz; + snaptr->inside[ninside] = j; + snaptr->wj[ninside] = wjelem[jelem]; + snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; + snaptr->element[ninside] = jelem; // element index for alloy snap + ninside++; + } + } + + // compute Ui, Yi for atom I + + snaptr->compute_ui(ninside, ielem); + + // for neighbors of I within cutoff: + // compute Fij = dEi/dRj = -dEi/dRi + // add to Fi, subtract from Fj + + snaptr->compute_yi(beta[ii]); + //for (int q=0; qidxu_max*2; q++){ + // fprintf(screen, "%i %f\n",q, snaptr->ylist_r[q]); + //} + + for (int jj = 0; jj < ninside; jj++) { + int j = snaptr->inside[jj]; + snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], + snaptr->rcutij[jj],jj, snaptr->element[jj]); + + snaptr->compute_deidrj(fij); + + f[i][0] += fij[0]; + f[i][1] += fij[1]; + f[i][2] += fij[2]; + f[j][0] -= fij[0]; + f[j][1] -= fij[1]; + f[j][2] -= fij[2]; + + // tally per-atom virial contribution + + if (vflag) + ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0, + fij[0],fij[1],fij[2], + -snaptr->rij[jj][0],-snaptr->rij[jj][1], + -snaptr->rij[jj][2]); + } + //fprintf(screen, "%f %f %f\n",f[i][0],f[i][1],f[i][2]); + + // tally energy contribution + + if (eflag) { + evdwl = atomenergy[ii]; + ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0); + } + + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + compute bispectrum +------------------------------------------------------------------------- */ + +void PairMLIAPSNAP::compute_bispectrum() +{ + int i,j,jnum,ninside; + double delx,dely,delz,rsq; + int *jlist; + + double **x = atom->x; + int *type = atom->type; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + + const double xtmp = x[i][0]; + const double ytmp = x[i][1]; + const double ztmp = x[i][2]; + const int itype = type[i]; + const int ielem = map[itype]; + const double radi = radelem[ielem]; + + jlist = list->firstneigh[i]; + jnum = list->numneigh[i]; + + // insure rij, inside, wj, and rcutij are of size jnum + + snaptr->grow_rij(jnum); + + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // wj = weights for neighbors of I within cutoff + // rcutij = cutoffs for neighbors of I within cutoff + // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi + + ninside = 0; + for (int jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + int jelem = map[jtype]; + + if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { + snaptr->rij[ninside][0] = delx; + snaptr->rij[ninside][1] = dely; + snaptr->rij[ninside][2] = delz; + snaptr->inside[ninside] = j; + snaptr->wj[ninside] = wjelem[jelem]; + snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; + snaptr->element[ninside] = jelem; // element index for alloy snap + ninside++; + } + } + + snaptr->compute_ui(ninside, ielem); + snaptr->compute_zi(); + snaptr->compute_bi(ielem); + + for (int icoeff = 0; icoeff < ncoeff; icoeff++){ + bispectrum[ii][icoeff] = snaptr->blist[icoeff]; + } + } + +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairMLIAPSNAP::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + memory->create(map,n+1,"pair:map"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairMLIAPSNAP::settings(int narg, char ** /* arg */) +{ + if (narg > 0) + error->all(FLERR,"Illegal pair_style command"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairMLIAPSNAP::coeff(int narg, char **arg) +{ + if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + if (nelements) { + for (int i = 0; i < nelements; i++) + delete[] elements[i]; + delete[] elements; + memory->destroy(radelem); + memory->destroy(wjelem); + } + + char* type1 = arg[0]; + char* type2 = arg[1]; + char* coefffilename = arg[2]; + char* paramfilename = arg[3]; + char** elemtypes = &arg[4]; + + // insure I,J args are * * + + if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) + error->all(FLERR,"Incorrect args for pair coefficients"); + + // read snapcoeff and snapparam files + + read_files(coefffilename,paramfilename); + + if (!quadraticflag) + ncoeff = ncoeffall - 1; + else { + + // ncoeffall should be (ncoeff+2)*(ncoeff+1)/2 + // so, ncoeff = floor(sqrt(2*ncoeffall))-1 + + ncoeff = sqrt(2*ncoeffall)-1; + ncoeffq = (ncoeff*(ncoeff+1))/2; + int ntmp = 1+ncoeff+ncoeffq; + if (ntmp != ncoeffall) { + printf("ncoeffall = %d ntmp = %d ncoeff = %d \n",ncoeffall,ntmp,ncoeff); + error->all(FLERR,"Incorrect SNAP coeff file"); + } + } + + // read args that map atom types to SNAP elements + // map[i] = which element the Ith atom type is, -1 if not mapped + // map[0] is not used + + for (int i = 1; i <= atom->ntypes; i++) { + char* elemname = elemtypes[i-1]; + int jelem; + for (jelem = 0; jelem < nelements; jelem++) + if (strcmp(elemname,elements[jelem]) == 0) + break; + + if (jelem < nelements) + map[i] = jelem; + else if (strcmp(elemname,"NULL") == 0) map[i] = -1; + else error->all(FLERR,"Incorrect args for pair coefficients"); + } + + // clear setflag since coeff() called once with I,J = * * + + int n = atom->ntypes; + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + // set setflag i,j for type pairs where both are mapped to elements + + int count = 0; + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + if (map[i] >= 0 && map[j] >= 0) { + setflag[i][j] = 1; + count++; + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + + snaptr = new SNA(lmp, rfac0, twojmax, + rmin0, switchflag, bzeroflag, + alloyflag, wselfallflag, nelements); + + if (ncoeff != snaptr->ncoeff) { + if (comm->me == 0) + printf("ncoeff = %d snancoeff = %d \n",ncoeff,snaptr->ncoeff); + error->all(FLERR,"Incorrect SNAP parameter file"); + } + + // Calculate maximum cutoff for all elements + + rcutmax = 0.0; + for (int ielem = 0; ielem < nelements; ielem++) + rcutmax = MAX(2.0*radelem[ielem]*rcutfac,rcutmax); + + model = new MLIAPModelSNAP(lmp); + descriptor = new MLIAPDescriptorSNAP(lmp); + + model->init(narg, arg); + +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairMLIAPSNAP::init_style() +{ + if (force->newton_pair == 0) + error->all(FLERR,"Pair style SNAP requires newton pair on"); + + // need a full neighbor list + + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; + + snaptr->init(); + +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairMLIAPSNAP::init_one(int i, int j) +{ + if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + return (radelem[map[i]] + + radelem[map[j]])*rcutfac; +} + +/* ---------------------------------------------------------------------- */ + +void PairMLIAPSNAP::read_files(char *coefffilename, char *paramfilename) +{ + + // open SNAP coefficient file on proc 0 + + FILE *fpcoeff; + if (comm->me == 0) { + fpcoeff = force->open_potential(coefffilename); + if (fpcoeff == NULL) { + char str[128]; + snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); + error->one(FLERR,str); + } + } + + char line[MAXLINE],*ptr; + int eof = 0; + + int n; + int nwords = 0; + while (nwords == 0) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if ((ptr = strchr(line,'#'))) *ptr = '\0'; + nwords = atom->count_words(line); + } + if (nwords != 2) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + char* words[MAXWORD]; + int iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + iword = 1; + words[iword] = strtok(NULL,"' \t\n\r\f"); + + nelements = atoi(words[0]); + ncoeffall = atoi(words[1]); + + // set up element lists + + elements = new char*[nelements]; + memory->create(radelem,nelements,"pair:radelem"); + memory->create(wjelem,nelements,"pair:wjelem"); + memory->create(coeffelem,nelements,ncoeffall,"pair:coeffelem"); + + // Loop over nelements blocks in the SNAP coefficient file + + for (int ielem = 0; ielem < nelements; ielem++) { + + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + nwords = atom->count_words(line); + if (nwords != 3) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + iword = 1; + words[iword] = strtok(NULL,"' \t\n\r\f"); + iword = 2; + words[iword] = strtok(NULL,"' \t\n\r\f"); + + char* elemtmp = words[0]; + int n = strlen(elemtmp) + 1; + elements[ielem] = new char[n]; + strcpy(elements[ielem],elemtmp); + + radelem[ielem] = atof(words[1]); + wjelem[ielem] = atof(words[2]); + + + if (comm->me == 0) { + if (screen) fprintf(screen,"SNAP Element = %s, Radius %g, Weight %g \n", + elements[ielem], radelem[ielem], wjelem[ielem]); + if (logfile) fprintf(logfile,"SNAP Element = %s, Radius %g, Weight %g \n", + elements[ielem], radelem[ielem], wjelem[ielem]); + } + + for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) + error->all(FLERR,"Incorrect format in SNAP coefficient file"); + + // No need to store actual coefficients + +// MPI_Bcast(&n,1,MPI_INT,0,world); +// MPI_Bcast(line,n,MPI_CHAR,0,world); + +// nwords = atom->count_words(line); +// if (nwords != 1) +// error->all(FLERR,"Incorrect format in SNAP coefficient file"); + +// iword = 0; +// words[iword] = strtok(line,"' \t\n\r\f"); + +// coeffelem[ielem][icoeff] = atof(words[0]); + + } + } + + if (comm->me == 0) fclose(fpcoeff); + + // set flags for required keywords + + rcutfacflag = 0; + twojmaxflag = 0; + + // Set defaults for optional keywords + + rfac0 = 0.99363; + rmin0 = 0.0; + switchflag = 1; + bzeroflag = 1; + bnormflag = 0; + quadraticflag = 0; + alloyflag = 0; + wselfallflag = 0; + chunksize = 2000; + + // open SNAP parameter file on proc 0 + + FILE *fpparam; + if (comm->me == 0) { + fpparam = force->open_potential(paramfilename); + if (fpparam == NULL) { + char str[128]; + snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); + error->one(FLERR,str); + } + } + + eof = 0; + while (1) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpparam); + if (ptr == NULL) { + eof = 1; + fclose(fpparam); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if ((ptr = strchr(line,'#'))) *ptr = '\0'; + nwords = atom->count_words(line); + if (nwords == 0) continue; + + if (nwords != 2) + error->all(FLERR,"Incorrect format in SNAP parameter file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + char* keywd = strtok(line,"' \t\n\r\f"); + char* keyval = strtok(NULL,"' \t\n\r\f"); + + if (comm->me == 0) { + if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); + if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval); + } + + if (strcmp(keywd,"rcutfac") == 0) { + rcutfac = atof(keyval); + rcutfacflag = 1; + } else if (strcmp(keywd,"twojmax") == 0) { + twojmax = atoi(keyval); + twojmaxflag = 1; + } else if (strcmp(keywd,"rfac0") == 0) + rfac0 = atof(keyval); + else if (strcmp(keywd,"rmin0") == 0) + rmin0 = atof(keyval); + else if (strcmp(keywd,"switchflag") == 0) + switchflag = atoi(keyval); + else if (strcmp(keywd,"bzeroflag") == 0) + bzeroflag = atoi(keyval); + else if (strcmp(keywd,"quadraticflag") == 0) + quadraticflag = atoi(keyval); + else if (strcmp(keywd,"alloyflag") == 0) + alloyflag = atoi(keyval); + else if (strcmp(keywd,"wselfallflag") == 0) + wselfallflag = atoi(keyval); + else if (strcmp(keywd,"chunksize") == 0) + chunksize = atoi(keyval); + else + error->all(FLERR,"Incorrect SNAP parameter file"); + } + + bnormflag = alloyflag; + + if (rcutfacflag == 0 || twojmaxflag == 0) + error->all(FLERR,"Incorrect SNAP parameter file"); + +} + +/* ---------------------------------------------------------------------- + memory usage +------------------------------------------------------------------------- */ + +double PairMLIAPSNAP::memory_usage() +{ + double bytes = Pair::memory_usage(); + + int n = atom->ntypes+1; + bytes += n*n*sizeof(int); // setflag + bytes += n*n*sizeof(double); // cutsq + bytes += n*sizeof(int); // map + bytes += beta_max*ncoeff*sizeof(double); // bispectrum + bytes += beta_max*ncoeff*sizeof(double); // beta + + bytes += snaptr->memory_usage(); // SNA object + + return bytes; +} + diff --git a/src/MLIAP/pair_mliap_snap.h b/src/MLIAP/pair_mliap_snap.h new file mode 100644 index 0000000000..64ce706e06 --- /dev/null +++ b/src/MLIAP/pair_mliap_snap.h @@ -0,0 +1,134 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(mliap/snap,PairMLIAPSNAP) + +#else + +#ifndef LMP_PAIR_MLIAP_SNAP_H +#define LMP_PAIR_MLIAP_SNAP_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairMLIAPSNAP : public Pair { +public: + PairMLIAPSNAP(class LAMMPS *); + ~PairMLIAPSNAP(); + virtual void compute(int, int); + void settings(int, char **); + virtual void coeff(int, char **); + virtual void init_style(); + virtual double init_one(int, int); + virtual double memory_usage(); + + double rcutfac, quadraticflag; // declared public to workaround gcc 4.9 + int ncoeff; // compiler bug, manifest in KOKKOS package + +protected: + int ncoeffq, ncoeffall; + class SNA* snaptr; + virtual void allocate(); + void read_files(char *, char *); + inline int equal(double* x,double* y); + inline double dist2(double* x,double* y); + + void compute_bispectrum(); + + double rcutmax; // max cutoff for all elements + int nelements; // # of unique elements + char **elements; // names of unique elements + double *radelem; // element radii + double *wjelem; // elements weights + double **coeffelem; // element bispectrum coefficients + double* atomenergy; // energies for all atoms in list + double** beta; // betas for all atoms in list + double** bispectrum; // bispectrum components for all atoms in list + int *map; // mapping from atom types to elements + int twojmax, switchflag, bzeroflag, bnormflag; + int alloyflag, wselfallflag; + int chunksize; + double rfac0, rmin0, wj1, wj2; + int rcutfacflag, twojmaxflag; // flags for required parameters + int beta_max; // length of beta + class MLIAPModelSNAP* model; + class MLIAPDescriptorSNAP* descriptor; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Communication cutoff too small for SNAP micro load balancing + +This can happen if you change the neighbor skin after your pair_style +command or if your box dimensions grow during a run. You can set the +cutoff explicitly via the comm_modify cutoff command. + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +E: Incorrect SNAP coeff file + +UNDOCUMENTED + +E: Incorrect SNAP parameter file + +The file cannot be parsed correctly, check its internal syntax. + +E: Pair style SNAP requires newton pair on + +See the newton command. This is a restriction to use the SNAP +potential. + +E: All pair coeffs are not set + +All pair coefficients must be set in the data file or by the +pair_coeff command before running a simulation. + +E: Cannot open SNAP coefficient file %s + +The specified SNAP coefficient file cannot be opened. Check that the +path and name are correct. + +E: Incorrect format in SNAP coefficient file + +Incorrect number of words per line in the coefficient file. + +E: Cannot open SNAP parameter file %s + +The specified SNAP parameter file cannot be opened. Check that the +path and name are correct. + +E: Incorrect format in SNAP parameter file + +Incorrect number of words per line in the parameter file. + +E: Did not find all elements in SNAP coefficient file. + +One or more elements listed in the pair_coeff command were not found in the coefficient file. + +*/ From 3329caa7f1bdbaa438d52a503cc50fde50cfba79 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Wed, 1 Apr 2020 18:07:33 -0600 Subject: [PATCH 02/54] First pass at general ML pair style --- examples/mliap/Ta06A.snap | 17 + examples/mliap/Ta06A.snapcoeff | 37 ++ examples/mliap/Ta06A.snapparam | 14 + examples/mliap/W.quadratic.snapcoeff | 500 +++++++++++++++++++++ examples/mliap/W.quadratic.snapparam | 10 + examples/mliap/W.snap.quadratic | 15 + examples/mliap/dump.quadratic.0 | 11 + examples/mliap/dump.quadratic.100 | 11 + examples/mliap/in.mliap.snap.Ta06A | 57 +++ examples/mliap/in.mliap.snap.quadratic | 60 +++ examples/mliap/in.snap.Ta06A | 45 ++ examples/mliap/in.snap.compute.quadratic | 100 +++++ examples/mliap/in.snap.quadratic | 49 ++ examples/mliap/log.snap.Ta06A.ref | 148 ++++++ examples/mliap/log.snap.quadratic.ref | 146 ++++++ src/MLIAP/mliap_descriptor_snap.cpp | 377 ++++------------ src/MLIAP/mliap_descriptor_snap.h | 31 +- src/MLIAP/mliap_model_snap.cpp | 13 +- src/MLIAP/mliap_model_snap.h | 4 +- src/MLIAP/pair_mliap_snap.cpp | 548 ++--------------------- src/MLIAP/pair_mliap_snap.h | 75 +--- 21 files changed, 1366 insertions(+), 902 deletions(-) create mode 100644 examples/mliap/Ta06A.snap create mode 100644 examples/mliap/Ta06A.snapcoeff create mode 100644 examples/mliap/Ta06A.snapparam create mode 100644 examples/mliap/W.quadratic.snapcoeff create mode 100644 examples/mliap/W.quadratic.snapparam create mode 100644 examples/mliap/W.snap.quadratic create mode 100644 examples/mliap/dump.quadratic.0 create mode 100644 examples/mliap/dump.quadratic.100 create mode 100644 examples/mliap/in.mliap.snap.Ta06A create mode 100644 examples/mliap/in.mliap.snap.quadratic create mode 100644 examples/mliap/in.snap.Ta06A create mode 100644 examples/mliap/in.snap.compute.quadratic create mode 100644 examples/mliap/in.snap.quadratic create mode 100644 examples/mliap/log.snap.Ta06A.ref create mode 100644 examples/mliap/log.snap.quadratic.ref diff --git a/examples/mliap/Ta06A.snap b/examples/mliap/Ta06A.snap new file mode 100644 index 0000000000..d9feae0b46 --- /dev/null +++ b/examples/mliap/Ta06A.snap @@ -0,0 +1,17 @@ +# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# Definition of SNAP potential Ta_Cand06A +# Assumes 1 LAMMPS atom type + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 + +# Specify hybrid with SNAP, ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +snap +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff * * snap Ta06A.snapcoeff Ta06A.snapparam Ta + diff --git a/examples/mliap/Ta06A.snapcoeff b/examples/mliap/Ta06A.snapcoeff new file mode 100644 index 0000000000..ad2dfa4bc5 --- /dev/null +++ b/examples/mliap/Ta06A.snapcoeff @@ -0,0 +1,37 @@ +# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# LAMMPS SNAP coefficients for Ta_Cand06A + +1 31 +Ta 0.5 1 +-2.92477 +-0.01137 +-0.00775 +-0.04907 +-0.15047 +0.09157 +0.05590 +0.05785 +-0.11615 +-0.17122 +-0.10583 +0.03941 +-0.11284 +0.03939 +-0.07331 +-0.06582 +-0.09341 +-0.10587 +-0.15497 +0.04820 +0.00205 +0.00060 +-0.04898 +-0.05084 +-0.03371 +-0.01441 +-0.01501 +-0.00599 +-0.06373 +0.03965 +0.01072 diff --git a/examples/mliap/Ta06A.snapparam b/examples/mliap/Ta06A.snapparam new file mode 100644 index 0000000000..629d96d708 --- /dev/null +++ b/examples/mliap/Ta06A.snapparam @@ -0,0 +1,14 @@ +# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# LAMMPS SNAP parameters for Ta_Cand06A + +# required +rcutfac 4.67637 +twojmax 6 + +# optional + +rfac0 0.99363 +rmin0 0 +bzeroflag 0 +quadraticflag 0 diff --git a/examples/mliap/W.quadratic.snapcoeff b/examples/mliap/W.quadratic.snapcoeff new file mode 100644 index 0000000000..6cc4fc5c19 --- /dev/null +++ b/examples/mliap/W.quadratic.snapcoeff @@ -0,0 +1,500 @@ +# LAMMPS SNAP coefficients for Quadratic W + +1 496 +W 0.5 1 + 0.000000000000 + -0.000019342340 + 0.000039964908 + -0.000450771142 + -0.000233498664 + -0.000519872659 + -0.000089734174 + -0.000106353291 + -0.000035475344 + -0.000254116041 + -0.000520021242 + 0.000065038801 + -0.000304498225 + -0.000032230341 + -0.000007420702 + -0.000159369530 + -0.000144907916 + 0.000078858361 + -0.000238070583 + -0.000050556167 + -0.000008662153 + 0.000017439967 + -0.000028764863 + 0.000022504717 + 0.000001821340 + -0.000089967846 + -0.000106392838 + 0.000013771852 + 0.000070228097 + -0.000024152909 + -0.000006036274 +-4.2551325e-05 +0.0001982986695 +5.4994526e-05 +0.0001760061375 +0.0005287969295 +-0.00045677476 +-0.007136016296 +0.0003868434375 +-0.0006071085215 +-0.000554512177 +-0.0006596292555 +-0.0007585367005 +7.62333015e-05 +0.0002137614635 +0.000379897335 +0.0005441952125 +0.000128413515 +5.74706545e-05 +0.0002303380555 +-0.0005759952885 +-0.0001530888095 +-0.0001614394285 +-3.80386335e-05 +-0.0006390699265 +-2.44191e-05 +-0.000627990564 +-0.000199645294 +-3.63524105e-05 +-0.0004350939225 +-0.000230192872 +-0.000456462716 +-0.00096561205 +-0.0016793622125 +0.008264605054 +0.005768043843 +0.0259523273965 +0.002379667484 +0.001798185681 +0.001411261095 +0.0046629902735 +-0.001249069583 +-0.003518728846 +-0.00152218625 +-0.0005803019955 +-0.002443813614 +0.003302653151 +-0.0035163183225 +0.005378221661 +-0.0005157550285 +0.0005802384085 +-8.4625189e-05 +-0.0003100449505 +0.0016035457395 +-0.006841896086 +0.00327970803 +0.000517873278 +0.000462624598 +0.001556398782 +0.000629663951 +0.004036847861 +0.000410623118 +0.0033671740175 +0.0060744662315 +0.0460285453095 +0.0106979441315 +0.006457375952 +-0.0043000712405 +-0.0196789547465 +-0.009589713549 +-0.0152983426785 +0.003041488452 +-0.0032366707575 +-0.0119067345335 +0.0049313311815 +-0.0030034838505 +8.7700383e-05 +0.0007061505055 +0.0097234329625 +0.007217090323 +0.000235882459 +-0.0033595857445 +-0.0168665065145 +0.017786509719 +0.001877013067 +0.0006351836775 +0.004600906728 +0.012509628713 +-0.003427408333 +-0.0014640751665 +-0.003888408385 +-0.0062058291515 +-0.001642104699 +-0.00105774282 +-0.0059780195505 +-0.001753939287 +0.000479345105 +-0.0019904699045 +4.98541965e-05 +-0.0041212491675 +-0.0042906641465 +-0.002351418317 +-0.0106697325275 +-0.000648222198 +-0.002286882867 +-0.000626754824 +-0.00073748291 +0.0016922435575 +0.0037496719655 +0.004656851048 +-0.0002176673305 +-0.0006739876965 +-0.0006208869175 +7.61738615e-05 +0.0019258401385 +0.005690172208 +0.007318906809 +-0.035200169396 +0.009167226287 +-0.000404285392 +-0.00348855982 +-0.0024229238155 +0.0022336200925 +-0.012584737991 +0.0016262069595 +0.0048016592015 +0.0004657340115 +0.0025051890895 +-0.0104101829395 +0.016176490711 +-0.0094539511845 +-0.002289487018 +-0.0002052188655 +-0.007085549731 +0.02162608233 +-0.002238154953 +0.0190676087705 +0.0002139442795 +0.0010403767345 +0.003360683249 +0.003153376576 +-0.001249764819 +-0.068537163077 +0.0023354667295 +0.001767860664 +-0.0033006265215 +0.0146223252485 +-0.003180595809 +0.0069092040305 +0.0010583439885 +-0.003447267898 +-0.001106713702 +0.00523272471 +-0.010758599437 +-0.001822397317 +0.018487732527 +-0.0024400507145 +-0.007514714512 +-0.003947742615 +0.012413627732 +0.003092235017 +0.018069399047 +-0.0035369320715 +0.0011168541665 +-0.0014980962775 +-1.2944254e-05 +-0.041955689351 +0.0023033776335 +-0.040725631204 +-0.0693632023935 +0.020674975135 +-0.0341006922645 +-0.006059344895 +0.002385437006 +-0.004177512167 +-0.0146544701995 +-0.0008310261785 +-0.010934674355 +0.006492824537 +-0.014812643723 +0.004033748718 +-0.004155996547 +-0.013113411806 +-0.0088014221285 +0.0037541341 +-0.000805304258 +0.006318190602 +0.012552958042 +0.004200553135 +-0.00681355806 +-0.001852228976 +0.0017381476065 +-0.002643779529 +0.0049358851655 +0.001522146164 +0.002260955858 +-0.000839707664 +0.0008487292955 +0.002671028789 +-0.000193952538 +0.003111368392 +0.0007482047125 +0.0020401970905 +0.000530116057 +-0.0022777656015 +-0.0045238154695 +0.0018290760485 +-0.0003309336725 +0.00293571563 +0.000172269209 +0.001414752092 +0.0005614625055 +0.000441310903 +-0.002473120026 +-0.015420836338 +-0.0058494470115 +-0.013440044608 +-0.009774364656 +-0.0019064948385 +-1.70476245e-05 +0.0049669399345 +-0.0050880033155 +0.001600486319 +-0.0018417989075 +-0.0111031210975 +0.0007780738275 +-0.004930202896 +-0.002537539117 +-0.0090246084865 +-0.002694202287 +-0.0062002945005 +0.0031924710865 +0.0021120090085 +-0.003067483203 +-0.0002847253785 +-0.016407568729 +-0.0012875748665 +-0.0136223073595 +-0.00152438356 +0.0012803681485 +-0.002216406572 +-0.001518786423 +-0.004453055438 +-0.0078894618465 +0.001421143537 +-0.0050288776725 +0.001199592632 +-0.002661588749 +-0.004357715347 +0.009525078378 +0.0026286979515 +0.0043289788665 +0.0004994005155 +0.003791227565 +0.0004056536255 +0.0033347889035 +-0.000464347336 +-0.0069517390965 +-0.0079588750315 +-0.004154738239 +0.006620101338 +0.008608842617 +0.0056131740625 +0.0011860229985 +0.007580086232 +0.003260306951 +0.000979553031 +-0.0044626742655 +-0.005235925737 +-0.0161268610495 +-0.0069229581565 +0.003724916317 +0.0023613845 +0.0013633397005 +0.001433661889 +-0.0009859245845 +-0.019516619562 +-0.0051345232355 +-0.0003792145305 +-0.009160883563 +-0.0052408213305 +-0.000837343292 +-0.010077898583 +-0.000297970588 +-0.000858261403 +-0.0001092992995 +-0.002443805024 +-0.0025107490965 +-0.0062944996435 +0.0026546548665 +0.0006955853785 +0.000103592795 +0.000708964143 +0.0019193670325 +-0.0001578612265 +-0.005585721575 +-0.000421551186 +0.0022745774245 +-0.004927140737 +0.0004199419505 +-0.0037407737345 +0.002130170551 +-0.0030979189135 +-0.0019395201255 +0.0067944948975 +-0.000359694345 +-0.0002144026575 +0.0025529098515 +0.0001917158465 +-0.000540725939 +0.001239653721 +0.00159659403 +-5.5652017e-05 +4.5092483e-05 +0.002495602056 +-0.0035351180395 +0.0009665743545 +-0.0023236857675 +-0.0014564171785 +-0.0008165505935 +-0.000118027852 +0.002536872662 +0.0009829535115 +0.0019442113705 +0.000664158062 +0.000326715061 +0.00019900621 +0.0004767582395 +0.000900303081 +-2.91049685e-05 +-0.004411179905 +-0.004064521081 +0.00692497271 +-0.005195674108 +-0.006544598492 +0.0029896960935 +0.000425073164 +-8.0017505e-05 +0.000846844414 +0.003287511416 +-0.009662064447 +0.0014047560985 +-0.0008689313915 +0.0009517570465 +0.000152017235 +1.6514158e-05 +0.00066355894 +0.0067775973265 +0.0021844858475 +0.0056757292145 +0.0054950676515 +0.0002498690125 +-0.006315915302 +-0.0059966827865 +-0.0034483171305 +0.0073702392255 +0.007591193081 +0.0004062066825 +0.000913827769 +0.000622164767 +0.0002438011115 +0.01119218957 +0.010457943327 +-0.002352405766 +-0.000761350789 +0.000146360756 +-0.00052151391 +-0.001421163661 +-0.0098259784665 +-0.001387664408 +-0.0010876399735 +0.000794093996 +0.003036965154 +-0.0017118732635 +-0.0015837318195 +-0.006679253783 +0.000882488727 +0.0093074758655 +0.0013319314085 +-0.011547004122 +-0.003864301947 +-0.007112747006 +-0.00330951085 +-0.0007122545915 +-0.001201815256 +0.0041789351005 +-0.0001805522685 +-0.0007465084205 +0.008838667361 +0.0048153576585 +-9.8403371e-05 +-0.010102205467 +-0.0090783851625 +-0.0014465915755 +0.0056402904815 +0.004713889865 +-0.000958685828 +0.002844420936 +0.000886932857 +0.0002483938575 +0.000144967791 +-0.0012477036845 +0.004783753466 +-0.0076604636325 +0.00091901227 +0.0010552043375 +0.0013117699705 +-0.000302204736 +0.002096120671 +-0.0002417090715 +0.0008896279815 +8.3058685e-05 +0.002360101467 +0.003364314747 +0.0008746445705 +-0.0011215585125 +-0.0003387424825 +0.0005632970265 +-0.0006617281215 +0.0003733063965 +0.0002623090815 +0.004593469114 +0.0040372304995 +-0.001688451935 +-0.003686908717 +-0.004326202128 +-0.000870929915 +-0.0001854711995 +0.0002189774835 +0.00071865135 +0.007416398218 +0.0020460979 +-0.008020256566 +-0.016722806328 +0.001376213073 +0.000347513599 +0.0016684763755 +-0.000874786219 +0.001891181919 +-0.000534904311 +0.000846430852 +-0.000641433051 +0.0007377551475 +0.001358126396 +-0.000866748663 +0.011124487718 +0.005228666165 +-0.001490438881 +-0.0008813532175 +-0.0001303988565 +0.0007163794045 +0.004674505138 +-0.000722641184 +-0.002023585289 +0.001547283689 +0.000753938405 +0.000470918236 +-0.0003316097225 +-0.0002293860925 +6.90841455e-05 +-0.001301344263 +-0.0004029179255 +6.69084325e-05 +-0.000142497889 +0.0002207077485 +-0.000201523756 diff --git a/examples/mliap/W.quadratic.snapparam b/examples/mliap/W.quadratic.snapparam new file mode 100644 index 0000000000..63728b6bd0 --- /dev/null +++ b/examples/mliap/W.quadratic.snapparam @@ -0,0 +1,10 @@ +# required +rcutfac 4.73442 +twojmax 6 + +# optional + +rfac0 0.99363 +rmin0 0 +bzeroflag 1 +quadraticflag 1 diff --git a/examples/mliap/W.snap.quadratic b/examples/mliap/W.snap.quadratic new file mode 100644 index 0000000000..75892ad1a0 --- /dev/null +++ b/examples/mliap/W.snap.quadratic @@ -0,0 +1,15 @@ +# +# +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 74 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +snap +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff * * snap W.quadratic.snapcoeff W.quadratic.snapparam W + diff --git a/examples/mliap/dump.quadratic.0 b/examples/mliap/dump.quadratic.0 new file mode 100644 index 0000000000..761b1e4451 --- /dev/null +++ b/examples/mliap/dump.quadratic.0 @@ -0,0 +1,11 @@ +ITEM: TIMESTEP +0 +ITEM: NUMBER OF ATOMS +2 +ITEM: BOX BOUNDS pp pp pp +0.0000000000000000e+00 3.1802999999999999e+00 +0.0000000000000000e+00 3.1802999999999999e+00 +0.0000000000000000e+00 3.1802999999999999e+00 +ITEM: ATOMS id type fx fy fz c_eatom +1 1 -0.00995108 -0.61461 0.688381 -1.15754 +2 1 0.00995108 0.61461 -0.688381 -1.15754 diff --git a/examples/mliap/dump.quadratic.100 b/examples/mliap/dump.quadratic.100 new file mode 100644 index 0000000000..321c1b17df --- /dev/null +++ b/examples/mliap/dump.quadratic.100 @@ -0,0 +1,11 @@ +ITEM: TIMESTEP +100 +ITEM: NUMBER OF ATOMS +2 +ITEM: BOX BOUNDS pp pp pp +0.0000000000000000e+00 3.1802999999999999e+00 +0.0000000000000000e+00 3.1802999999999999e+00 +0.0000000000000000e+00 3.1802999999999999e+00 +ITEM: ATOMS id type fx fy fz c_eatom +1 1 -0.373431 0.0494017 -1.17879 -1.14648 +2 1 0.373431 -0.0494017 1.17879 -1.14648 diff --git a/examples/mliap/in.mliap.snap.Ta06A b/examples/mliap/in.mliap.snap.Ta06A new file mode 100644 index 0000000000..dcf5272591 --- /dev/null +++ b/examples/mliap/in.mliap.snap.Ta06A @@ -0,0 +1,57 @@ +# Demonstrate SNAP Ta potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.316 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box + +mass 1 180.88 + +# choose potential + +# Assumes 1 LAMMPS atom type + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 + +# Specify hybrid with SNAP, ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +mliap/snap +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff * * mliap/snap Ta06A.snapcoeff Ta06A.snapparam Ta + +# Setup output + +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 +fix 1 all nve +run ${nsteps} + diff --git a/examples/mliap/in.mliap.snap.quadratic b/examples/mliap/in.mliap.snap.quadratic new file mode 100644 index 0000000000..028a2d3ad7 --- /dev/null +++ b/examples/mliap/in.mliap.snap.quadratic @@ -0,0 +1,60 @@ +# Demonstrate SNAP Ta potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 1 +variable a equal 3.1803 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box +displace_atoms all random 0.01 0.01 0.01 12345 + +mass 1 183.84 + +# choose potential + +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 74 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +mliap/snap +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff * * mliap/snap W.quadratic.snapcoeff W.quadratic.snapparam W + +# Setup output + +thermo 10 +thermo_modify norm yes +compute eatom all pe/atom + +dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check no + +# Run MD + +velocity all create 300.0 4928459 +fix 1 all nve +run ${nsteps} + diff --git a/examples/mliap/in.snap.Ta06A b/examples/mliap/in.snap.Ta06A new file mode 100644 index 0000000000..0ca5275e97 --- /dev/null +++ b/examples/mliap/in.snap.Ta06A @@ -0,0 +1,45 @@ +# Demonstrate SNAP Ta potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.316 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box + +mass 1 180.88 + +# choose potential + +include Ta06A.snap + +# Setup output + +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 +fix 1 all nve +run ${nsteps} + diff --git a/examples/mliap/in.snap.compute.quadratic b/examples/mliap/in.snap.compute.quadratic new file mode 100644 index 0000000000..00e46bd3a8 --- /dev/null +++ b/examples/mliap/in.snap.compute.quadratic @@ -0,0 +1,100 @@ +# Demonstrate bispectrum computes + +# initialize simulation + +variable nsteps index 0 +variable nrep equal 1 +variable a equal 2.0 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +atom_modify map hash +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 2 box +create_atoms 2 box + +mass * 180.88 + +displace_atoms all random 0.1 0.1 0.1 123456 + +# choose SNA parameters + +variable twojmax equal 2 +variable rcutfac equal 1.0 +variable rfac0 equal 0.99363 +variable rmin0 equal 0 +variable radelem1 equal 2.3 +variable radelem2 equal 2.0 +variable wj1 equal 1.0 +variable wj2 equal 0.96 +variable quadratic equal 1 +variable bzero equal 0 +variable switch equal 0 +variable snap_options string & +"${rcutfac} ${rfac0} ${twojmax} ${radelem1} ${radelem2} ${wj1} ${wj2} rmin0 ${rmin0} quadraticflag ${quadratic} bzeroflag ${bzero} switchflag ${switch}" + +# set up dummy potential to satisfy cutoff + +pair_style zero ${rcutfac} +pair_coeff * * + +# set up reference potential + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 +pair_style zbl ${zblcutinner} ${zblcutouter} +pair_coeff * * ${zblz} ${zblz} + +# set up per-atom computes + +compute b all sna/atom ${snap_options} +compute vb all snav/atom ${snap_options} +compute db all snad/atom ${snap_options} + +# perform sums over atoms + +group snapgroup1 type 1 +group snapgroup2 type 2 +compute bsum1 snapgroup1 reduce sum c_b[*] +compute bsum2 snapgroup2 reduce sum c_b[*] +# fix bsum1 all ave/time 1 1 1 c_bsum1 file bsum1.dat mode vector +# fix bsum2 all ave/time 1 1 1 c_bsum2 file bsum2.dat mode vector +compute vbsum all reduce sum c_vb[*] +# fix vbsum all ave/time 1 1 1 c_vbsum file vbsum.dat mode vector +variable db_2_120 equal c_db[2][120] + +# set up compute snap generating global array + +compute snap all snap ${snap_options} +fix snap all ave/time 1 1 1 c_snap[*] file compute.snap.dat mode vector + +thermo 100 + +# test output: 1: total potential energy +# 2: xy component of stress tensor +# 3: Sum(0.5*(B_{222}^i)^2, all i of type 2) +# 4: xy component of Sum(Sum(r_j*(0.5*(dB_{222}^i)^2/dR[j]), all i of type 2), all j) +# 5: z component of -Sum(d(0.5*(B_{222}^i)^2/dR[2]), all i of type 2) +# +# followed by 5 counterparts from compute snap + +thermo_style custom & + pe pxy c_bsum2[20] c_vbsum[240] v_db_2_120 & + c_snap[1][41] c_snap[13][41] c_snap[1][40] c_snap[13][40] c_snap[7][40] +thermo_modify norm no + +# dump mydump_db all custom 1000 dump_db id c_db[*] +# dump_modify mydump_db sort id + +# Run MD + +run ${nsteps} diff --git a/examples/mliap/in.snap.quadratic b/examples/mliap/in.snap.quadratic new file mode 100644 index 0000000000..dd50e90bfb --- /dev/null +++ b/examples/mliap/in.snap.quadratic @@ -0,0 +1,49 @@ +# Demonstrate SNAP Ta potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 1 +variable a equal 3.1803 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box +displace_atoms all random 0.01 0.01 0.01 12345 + +mass 1 183.84 + +# choose potential + +include W.snap.quadratic + +# Setup output + +thermo 10 +thermo_modify norm yes +compute eatom all pe/atom + +dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check no + +# Run MD + +velocity all create 300.0 4928459 +fix 1 all nve +run ${nsteps} + diff --git a/examples/mliap/log.snap.Ta06A.ref b/examples/mliap/log.snap.Ta06A.ref new file mode 100644 index 0000000000..76cdc8641a --- /dev/null +++ b/examples/mliap/log.snap.Ta06A.ref @@ -0,0 +1,148 @@ +LAMMPS (27 Nov 2018) + using 1 OpenMP thread(s) per MPI task +# Demonstrate SNAP Ta potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.316 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.316 +Lattice spacing in x,y,z = 3.316 3.316 3.316 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0 0 0) to (13.264 13.264 13.264) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 128 atoms + Time spent = 0.000350714 secs + +mass 1 180.88 + +# choose potential + +include Ta06A.snap +# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# Definition of SNAP potential Ta_Cand06A +# Assumes 1 LAMMPS atom type + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 + +# Specify hybrid with SNAP, ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap +pair_style hybrid/overlay zbl 4 ${zblcutouter} snap +pair_style hybrid/overlay zbl 4 4.8 snap +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff 1 1 zbl 73 ${zblz} +pair_coeff 1 1 zbl 73 73 +pair_coeff * * snap Ta06A.snapcoeff Ta Ta06A.snapparam Ta +Reading potential file Ta06A.snapcoeff with DATE: 2014-09-05 +SNAP Element = Ta, Radius 0.5, Weight 1 +Reading potential file Ta06A.snapparam with DATE: 2014-09-05 +SNAP keyword rcutfac 4.67637 +SNAP keyword twojmax 6 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword diagonalstyle 3 +SNAP keyword bzeroflag 0 +SNAP keyword quadraticflag 0 + + +# Setup output + +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8 + ghost atom cutoff = 5.8 + binsize = 2.9, bins = 5 5 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair snap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.138 | 4.138 | 4.138 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 300 -11.85157 0 -11.813095 2717.1661 + 10 295.96579 -11.851053 0 -11.813095 2696.1559 + 20 284.32535 -11.84956 0 -11.813095 2301.3713 + 30 266.04602 -11.847215 0 -11.813095 1832.1745 + 40 242.2862 -11.844168 0 -11.813095 1492.6765 + 50 214.48968 -11.840603 0 -11.813094 1312.8908 + 60 184.32523 -11.836734 0 -11.813094 1284.582 + 70 153.58055 -11.832791 0 -11.813094 1374.4457 + 80 124.04276 -11.829003 0 -11.813094 1537.703 + 90 97.37622 -11.825582 0 -11.813094 1734.9662 + 100 75.007873 -11.822714 0 -11.813094 1930.8005 +Loop time of 5.03244 on 1 procs for 100 steps with 128 atoms + +Performance: 0.858 ns/day, 27.958 hours/ns, 19.871 timesteps/s +98.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 5.0308 | 5.0308 | 5.0308 | 0.0 | 99.97 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.00070858 | 0.00070858 | 0.00070858 | 0.0 | 0.01 +Output | 0.00024676 | 0.00024676 | 0.00024676 | 0.0 | 0.00 +Modify | 0.0002749 | 0.0002749 | 0.0002749 | 0.0 | 0.01 +Other | | 0.0004299 | | | 0.01 + +Nlocal: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 727 ave 727 max 727 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3712 ave 3712 max 3712 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 7424 ave 7424 max 7424 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7424 +Ave neighs/atom = 58 +Neighbor list builds = 0 +Dangerous builds = 0 + +Total wall time: 0:00:05 diff --git a/examples/mliap/log.snap.quadratic.ref b/examples/mliap/log.snap.quadratic.ref new file mode 100644 index 0000000000..24bceba9ec --- /dev/null +++ b/examples/mliap/log.snap.quadratic.ref @@ -0,0 +1,146 @@ +LAMMPS (19 Mar 2020) +# Demonstrate SNAP Ta potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 1 +variable a equal 3.1803 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 1 +variable ny equal ${nrep} +variable ny equal 1 +variable nz equal ${nrep} +variable nz equal 1 + +boundary p p p + +lattice bcc $a +lattice bcc 3.1803 +Lattice spacing in x,y,z = 3.1803 3.1803 3.1803 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 1 0 ${ny} 0 ${nz} +region box block 0 1 0 1 0 ${nz} +region box block 0 1 0 1 0 1 +create_box 1 box +Created orthogonal box = (0 0 0) to (3.1803 3.1803 3.1803) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 2 atoms + create_atoms CPU = 0.000348 secs +displace_atoms all random 0.01 0.01 0.01 12345 + +mass 1 183.84 + +# choose potential + +include W.snap.quadratic +# +# +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 74 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap +pair_style hybrid/overlay zbl 4 ${zblcutouter} snap +pair_style hybrid/overlay zbl 4 4.8 snap +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff 1 1 zbl 74 ${zblz} +pair_coeff 1 1 zbl 74 74 +pair_coeff * * snap W.quadratic.snapcoeff W.quadratic.snapparam W +SNAP Element = W, Radius 0.5, Weight 1 +SNAP keyword rcutfac 4.73442 +SNAP keyword twojmax 6 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 1 +SNAP keyword quadraticflag 1 + + +# Setup output + +thermo 10 +thermo_modify norm yes +compute eatom all pe/atom + +dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check no + +# Run MD + +velocity all create 300.0 4928459 +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8 + ghost atom cutoff = 5.8 + binsize = 2.9, bins = 2 2 2 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair snap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.04 | 5.04 | 5.04 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 300 -1.1575362 0 -1.1381472 600966 + 10 349.32287 -1.1607243 0 -1.1381475 599985.48 + 20 384.27065 -1.1629832 0 -1.1381478 599287.89 + 30 399.34846 -1.1639578 0 -1.1381478 598986.42 + 40 392.19413 -1.1634953 0 -1.1381478 599130.05 + 50 363.93932 -1.161669 0 -1.1381476 599694.93 + 60 319.03014 -1.1587663 0 -1.1381473 600588.89 + 70 264.53512 -1.1552439 0 -1.138147 601667.76 + 80 209.04294 -1.1516571 0 -1.1381466 602760.01 + 90 161.3157 -1.1485722 0 -1.1381463 603694.49 + 100 128.9054 -1.1464773 0 -1.1381461 604326.7 +Loop time of 0.032082 on 1 procs for 100 steps with 2 atoms + +Performance: 134.655 ns/day, 0.178 hours/ns, 3117.013 timesteps/s +98.3% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.030667 | 0.030667 | 0.030667 | 0.0 | 95.59 +Neigh | 0.000584 | 0.000584 | 0.000584 | 0.0 | 1.82 +Comm | 0.000307 | 0.000307 | 0.000307 | 0.0 | 0.96 +Output | 0.000447 | 0.000447 | 0.000447 | 0.0 | 1.39 +Modify | 2.8e-05 | 2.8e-05 | 2.8e-05 | 0.0 | 0.09 +Other | | 4.9e-05 | | | 0.15 + +Nlocal: 2 ave 2 max 2 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 187 ave 187 max 187 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 58 ave 58 max 58 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 116 ave 116 max 116 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 116 +Ave neighs/atom = 58 +Neighbor list builds = 100 +Dangerous builds not checked + +Total wall time: 0:00:00 diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 3a0664dddf..43649fe021 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -33,23 +33,16 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -//MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp): Pointers(lmp) -MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp): Pair(lmp) +MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp): Pointers(lmp) { - single_enable = 0; - restartinfo = 0; - one_coeff = 1; - manybody_flag = 1; - nelements = 0; elements = NULL; radelem = NULL; wjelem = NULL; - coeffelem = NULL; - beta_max = 0; - beta = NULL; - bispectrum = NULL; + cutsq = NULL; + map = NULL; + snaptr = NULL; } @@ -57,7 +50,6 @@ MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp): Pair(lmp) MLIAPDescriptorSNAP::~MLIAPDescriptorSNAP() { - if (copymode) return; if (nelements) { for (int i = 0; i < nelements; i++) @@ -65,16 +57,11 @@ MLIAPDescriptorSNAP::~MLIAPDescriptorSNAP() delete[] elements; memory->destroy(radelem); memory->destroy(wjelem); - memory->destroy(coeffelem); } - memory->destroy(beta); - memory->destroy(bispectrum); - delete snaptr; if (allocated) { - memory->destroy(setflag); memory->destroy(cutsq); memory->destroy(map); } @@ -82,36 +69,96 @@ MLIAPDescriptorSNAP::~MLIAPDescriptorSNAP() } /* ---------------------------------------------------------------------- - This version is a straightforward implementation + compute bispectrum components ---------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::compute(int eflag, int vflag) +void MLIAPDescriptorSNAP::forward(NeighList* list, double **bispectrum) +{ + int i,j,jnum,ninside; + double delx,dely,delz,rsq; + int *jlist; + + double **x = atom->x; + int *type = atom->type; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + + const double xtmp = x[i][0]; + const double ytmp = x[i][1]; + const double ztmp = x[i][2]; + const int itype = type[i]; + const int ielem = map[itype]; + const double radi = radelem[ielem]; + + jlist = list->firstneigh[i]; + jnum = list->numneigh[i]; + + // insure rij, inside, wj, and rcutij are of size jnum + + snaptr->grow_rij(jnum); + + // rij[][3] = displacements between atom I and those neighbors + // inside = indices of neighbors of I within cutoff + // wj = weights for neighbors of I within cutoff + // rcutij = cutoffs for neighbors of I within cutoff + // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi + + ninside = 0; + for (int jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + delx = x[j][0] - xtmp; + dely = x[j][1] - ytmp; + delz = x[j][2] - ztmp; + rsq = delx*delx + dely*dely + delz*delz; + int jtype = type[j]; + int jelem = map[jtype]; + + // printf("i = %d j = %d itype = %d jtype = %d cutsq[i][j] = %g rsq = %g\n",i,j,itype,jtype,cutsq[itype][jtype],rsq); + + if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { + snaptr->rij[ninside][0] = delx; + snaptr->rij[ninside][1] = dely; + snaptr->rij[ninside][2] = delz; + snaptr->inside[ninside] = j; + snaptr->wj[ninside] = wjelem[jelem]; + snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; + snaptr->element[ninside] = jelem; // element index for alloy snap + ninside++; + } + } + + snaptr->compute_ui(ninside, ielem); + snaptr->compute_zi(); + snaptr->compute_bi(ielem); + + // printf("ninside = %d jnum = %d radi = %g cutsq[i][1] = %g rsq = %g\n",ninside,jnum,radi,cutsq[itype][1]); + for (int icoeff = 0; icoeff < ncoeff; icoeff++){ + bispectrum[ii][icoeff] = snaptr->blist[icoeff]; + // printf("icoeff = %d B = %g\n",icoeff,bispectrum[ii][icoeff]); + } + } + +} + +/* ---------------------------------------------------------------------- + compute bispectrum components + ---------------------------------------------------------------------- */ + +void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta) { int i,j,jnum,ninside; double delx,dely,delz,evdwl,rsq; double fij[3]; int *jlist,*numneigh,**firstneigh; - ev_init(eflag,vflag); - double **x = atom->x; double **f = atom->f; int *type = atom->type; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; - if (beta_max < list->inum) { - memory->grow(beta,list->inum,ncoeff,"MLIAPDescriptorSNAP:beta"); - memory->grow(bispectrum,list->inum,ncoeff,"MLIAPDescriptorSNAP:bispectrum"); - beta_max = list->inum; - } - - // compute dE_i/dB_i = beta_i for all i in list - - if (quadraticflag || eflag) - compute_bispectrum(); - compute_beta(); - numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -188,154 +235,6 @@ void MLIAPDescriptorSNAP::compute(int eflag, int vflag) f[j][1] -= fij[1]; f[j][2] -= fij[2]; - // tally per-atom virial contribution - - if (vflag) - ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0, - fij[0],fij[1],fij[2], - -snaptr->rij[jj][0],-snaptr->rij[jj][1], - -snaptr->rij[jj][2]); - } - //fprintf(screen, "%f %f %f\n",f[i][0],f[i][1],f[i][2]); - - // tally energy contribution - - if (eflag) { - - // evdwl = energy of atom I, sum over coeffs_k * Bi_k - - double* coeffi = coeffelem[ielem]; - evdwl = coeffi[0]; - // snaptr->copy_bi2bvec(); - - // E = beta.B + 0.5*B^t.alpha.B - - // linear contributions - - for (int icoeff = 0; icoeff < ncoeff; icoeff++) - evdwl += coeffi[icoeff+1]*bispectrum[ii][icoeff]; - - // quadratic contributions - - if (quadraticflag) { - int k = ncoeff+1; - for (int icoeff = 0; icoeff < ncoeff; icoeff++) { - double bveci = bispectrum[ii][icoeff]; - evdwl += 0.5*coeffi[k++]*bveci*bveci; - for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { - double bvecj = bispectrum[ii][jcoeff]; - evdwl += coeffi[k++]*bveci*bvecj; - } - } - } - ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0); - } - - } - - if (vflag_fdotr) virial_fdotr_compute(); -} - -/* ---------------------------------------------------------------------- - compute beta -------------------------------------------------------------------------- */ - -void MLIAPDescriptorSNAP::compute_beta() -{ - int i; - int *type = atom->type; - - for (int ii = 0; ii < list->inum; ii++) { - i = list->ilist[ii]; - const int itype = type[i]; - const int ielem = map[itype]; - double* coeffi = coeffelem[ielem]; - - for (int icoeff = 0; icoeff < ncoeff; icoeff++) - beta[ii][icoeff] = coeffi[icoeff+1]; - - if (quadraticflag) { - int k = ncoeff+1; - for (int icoeff = 0; icoeff < ncoeff; icoeff++) { - double bveci = bispectrum[ii][icoeff]; - beta[ii][icoeff] += coeffi[k]*bveci; - k++; - for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { - double bvecj = bispectrum[ii][jcoeff]; - beta[ii][icoeff] += coeffi[k]*bvecj; - beta[ii][jcoeff] += coeffi[k]*bveci; - k++; - } - } - } - } -} - -/* ---------------------------------------------------------------------- - compute bispectrum -------------------------------------------------------------------------- */ - -void MLIAPDescriptorSNAP::compute_bispectrum() -{ - int i,j,jnum,ninside; - double delx,dely,delz,rsq; - int *jlist; - - double **x = atom->x; - int *type = atom->type; - - for (int ii = 0; ii < list->inum; ii++) { - i = list->ilist[ii]; - - const double xtmp = x[i][0]; - const double ytmp = x[i][1]; - const double ztmp = x[i][2]; - const int itype = type[i]; - const int ielem = map[itype]; - const double radi = radelem[ielem]; - - jlist = list->firstneigh[i]; - jnum = list->numneigh[i]; - - // insure rij, inside, wj, and rcutij are of size jnum - - snaptr->grow_rij(jnum); - - // rij[][3] = displacements between atom I and those neighbors - // inside = indices of neighbors of I within cutoff - // wj = weights for neighbors of I within cutoff - // rcutij = cutoffs for neighbors of I within cutoff - // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi - - ninside = 0; - for (int jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; - rsq = delx*delx + dely*dely + delz*delz; - int jtype = type[j]; - int jelem = map[jtype]; - - if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { - snaptr->rij[ninside][0] = delx; - snaptr->rij[ninside][1] = dely; - snaptr->rij[ninside][2] = delz; - snaptr->inside[ninside] = j; - snaptr->wj[ninside] = wjelem[jelem]; - snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; - snaptr->element[ninside] = jelem; // element index for alloy snap - ninside++; - } - } - - snaptr->compute_ui(ninside, ielem); - snaptr->compute_zi(); - snaptr->compute_bi(ielem); - - for (int icoeff = 0; icoeff < ncoeff; icoeff++){ - bispectrum[ii][icoeff] = snaptr->blist[icoeff]; } } @@ -350,26 +249,15 @@ void MLIAPDescriptorSNAP::allocate() allocated = 1; int n = atom->ntypes; - memory->create(setflag,n+1,n+1,"mliap_descriptor_snap:setflag"); memory->create(cutsq,n+1,n+1,"mliap_descriptor_snap:cutsq"); memory->create(map,n+1,"mliap_descriptor_snap:map"); } -/* ---------------------------------------------------------------------- - global settings -------------------------------------------------------------------------- */ - -void MLIAPDescriptorSNAP::settings(int narg, char ** /* arg */) -{ - if (narg > 0) - error->all(FLERR,"Illegal pair_style command"); -} - /* ---------------------------------------------------------------------- set coeffs for one or more type pairs ------------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::coeff(int narg, char **arg) +void MLIAPDescriptorSNAP::init(int narg, char **arg) { if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -380,7 +268,6 @@ void MLIAPDescriptorSNAP::coeff(int narg, char **arg) delete[] elements; memory->destroy(radelem); memory->destroy(wjelem); - memory->destroy(coeffelem); } char* type1 = arg[0]; @@ -398,22 +285,6 @@ void MLIAPDescriptorSNAP::coeff(int narg, char **arg) read_files(coefffilename,paramfilename); - if (!quadraticflag) - ncoeff = ncoeffall - 1; - else { - - // ncoeffall should be (ncoeff+2)*(ncoeff+1)/2 - // so, ncoeff = floor(sqrt(2*ncoeffall))-1 - - ncoeff = sqrt(2*ncoeffall)-1; - ncoeffq = (ncoeff*(ncoeff+1))/2; - int ntmp = 1+ncoeff+ncoeffq; - if (ntmp != ncoeffall) { - printf("ncoeffall = %d ntmp = %d ncoeff = %d \n",ncoeffall,ntmp,ncoeff); - error->all(FLERR,"Incorrect SNAP coeff file"); - } - } - // read args that map atom types to SNAP elements // map[i] = which element the Ith atom type is, -1 if not mapped // map[0] is not used @@ -431,34 +302,13 @@ void MLIAPDescriptorSNAP::coeff(int narg, char **arg) else error->all(FLERR,"Incorrect args for pair coefficients"); } - // clear setflag since coeff() called once with I,J = * * - - int n = atom->ntypes; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - setflag[i][j] = 0; - - // set setflag i,j for type pairs where both are mapped to elements - - int count = 0; - for (int i = 1; i <= n; i++) - for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { - setflag[i][j] = 1; - count++; - } - - if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); - snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, alloyflag, wselfallflag, nelements); - if (ncoeff != snaptr->ncoeff) { - if (comm->me == 0) - printf("ncoeff = %d snancoeff = %d \n",ncoeff,snaptr->ncoeff); - error->all(FLERR,"Incorrect SNAP parameter file"); - } + snaptr->init(); + + ncoeff = snaptr->ncoeff; // Calculate maximum cutoff for all elements @@ -466,36 +316,13 @@ void MLIAPDescriptorSNAP::coeff(int narg, char **arg) for (int ielem = 0; ielem < nelements; ielem++) rcutmax = MAX(2.0*radelem[ielem]*rcutfac,rcutmax); -} + // set cutoff distances -/* ---------------------------------------------------------------------- - init specific to this pair style -------------------------------------------------------------------------- */ - -void MLIAPDescriptorSNAP::init_style() -{ - if (force->newton_pair == 0) - error->all(FLERR,"Pair style SNAP requires newton pair on"); - - // need a full neighbor list - - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->half = 0; - neighbor->requests[irequest]->full = 1; - - snaptr->init(); - -} - -/* ---------------------------------------------------------------------- - init for one type pair i,j and corresponding j,i -------------------------------------------------------------------------- */ - -double MLIAPDescriptorSNAP::init_one(int i, int j) -{ - if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); - return (radelem[map[i]] + - radelem[map[j]])*rcutfac; + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) { + double rtmp = (radelem[map[i]] + radelem[map[j]])*rcutfac; + cutsq[i][j] = rtmp*rtmp; + } } /* ---------------------------------------------------------------------- */ @@ -551,14 +378,13 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) words[iword] = strtok(NULL,"' \t\n\r\f"); nelements = atoi(words[0]); - ncoeffall = atoi(words[1]); + int ncoeffall = atoi(words[1]); // set up element lists elements = new char*[nelements]; memory->create(radelem,nelements,"mliap_snap_descriptor:radelem"); memory->create(wjelem,nelements,"mliap_snap_descriptor:wjelem"); - memory->create(coeffelem,nelements,ncoeffall,"mliap_snap_descriptor:coeffelem"); // Loop over nelements blocks in the SNAP coefficient file @@ -596,7 +422,6 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) radelem[ielem] = atof(words[1]); wjelem[ielem] = atof(words[2]); - if (comm->me == 0) { if (screen) fprintf(screen,"SNAP Element = %s, Radius %g, Weight %g \n", elements[ielem], radelem[ielem], wjelem[ielem]); @@ -616,18 +441,6 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) MPI_Bcast(&eof,1,MPI_INT,0,world); if (eof) error->all(FLERR,"Incorrect format in SNAP coefficient file"); - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - nwords = atom->count_words(line); - if (nwords != 1) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - - coeffelem[ielem][icoeff] = atof(words[0]); - } } @@ -645,7 +458,6 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) switchflag = 1; bzeroflag = 1; bnormflag = 0; - quadraticflag = 0; alloyflag = 0; wselfallflag = 0; chunksize = 2000; @@ -710,14 +522,14 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) switchflag = atoi(keyval); else if (strcmp(keywd,"bzeroflag") == 0) bzeroflag = atoi(keyval); - else if (strcmp(keywd,"quadraticflag") == 0) - quadraticflag = atoi(keyval); else if (strcmp(keywd,"alloyflag") == 0) alloyflag = atoi(keyval); else if (strcmp(keywd,"wselfallflag") == 0) wselfallflag = atoi(keyval); else if (strcmp(keywd,"chunksize") == 0) chunksize = atoi(keyval); + else if (strcmp(keywd,"quadraticflag") == 0) + continue; else error->all(FLERR,"Incorrect SNAP parameter file"); } @@ -738,11 +550,8 @@ double MLIAPDescriptorSNAP::memory_usage() double bytes = 0; int n = atom->ntypes+1; - bytes += n*n*sizeof(int); // setflag bytes += n*n*sizeof(double); // cutsq bytes += n*sizeof(int); // map - bytes += beta_max*ncoeff*sizeof(double); // bispectrum - bytes += beta_max*ncoeff*sizeof(double); // beta bytes += snaptr->memory_usage(); // SNA object diff --git a/src/MLIAP/mliap_descriptor_snap.h b/src/MLIAP/mliap_descriptor_snap.h index f4a37c1024..d1656e0899 100644 --- a/src/MLIAP/mliap_descriptor_snap.h +++ b/src/MLIAP/mliap_descriptor_snap.h @@ -11,37 +11,35 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef MLIAP_DESCRIPTOR_SNAP_H -#define MLIAP_DESCRIPTOR_SNAP_H +#ifndef LMP_MLIAP_DESCRIPTOR_SNAP_H +#define LMP_MLIAP_DESCRIPTOR_SNAP_H -#include "pair.h" +#include "pointers.h" namespace LAMMPS_NS { - //class MLIAPDescriptorSNAP : protected Pointers { -class MLIAPDescriptorSNAP : public Pair { +class MLIAPDescriptorSNAP : protected Pointers { public: - MLIAPDescriptorSNAP(class LAMMPS *); + MLIAPDescriptorSNAP(LAMMPS *); ~MLIAPDescriptorSNAP(); - virtual void compute(int, int); - void settings(int, char **); - virtual void coeff(int, char **); - virtual void init_style(); - virtual double init_one(int, int); + virtual void forward(class NeighList*, double**); + virtual void backward(class NeighList*, double**); + virtual void init(int, char **); virtual double memory_usage(); - double rcutfac, quadraticflag; // declared public to workaround gcc 4.9 + double rcutfac; // declared public to workaround gcc 4.9 int ncoeff; // compiler bug, manifest in KOKKOS package + int *map; // mapping from atom types to elements + double **cutsq; // cutoff sq for each atom pair protected: - int ncoeffq, ncoeffall; + int allocated; class SNA* snaptr; virtual void allocate(); void read_files(char *, char *); inline int equal(double* x,double* y); inline double dist2(double* x,double* y); - void compute_beta(); void compute_bispectrum(); double rcutmax; // max cutoff for all elements @@ -49,16 +47,11 @@ protected: char **elements; // names of unique elements double *radelem; // element radii double *wjelem; // elements weights - double **coeffelem; // element bispectrum coefficients - double** beta; // betas for all atoms in list - double** bispectrum; // bispectrum components for all atoms in list - int *map; // mapping from atom types to elements int twojmax, switchflag, bzeroflag, bnormflag; int alloyflag, wselfallflag; int chunksize; double rfac0, rmin0, wj1, wj2; int rcutfacflag, twojmaxflag; // flags for required parameters - int beta_max; // length of beta }; } diff --git a/src/MLIAP/mliap_model_snap.cpp b/src/MLIAP/mliap_model_snap.cpp index 3624b17b78..22028b0787 100644 --- a/src/MLIAP/mliap_model_snap.cpp +++ b/src/MLIAP/mliap_model_snap.cpp @@ -32,11 +32,9 @@ MLIAPModelSNAP::MLIAPModelSNAP(LAMMPS* lmp) : Pointers(lmp) nelements = 0; elements = NULL; coeffelem = NULL; + map = NULL; beta_max = 0; - beta = NULL; - bispectrum = NULL; - allocated = 0; } @@ -51,9 +49,6 @@ MLIAPModelSNAP::~MLIAPModelSNAP() memory->destroy(coeffelem); } - memory->destroy(beta); - memory->destroy(bispectrum); - if (allocated) memory->destroy(map); @@ -389,8 +384,8 @@ void MLIAPModelSNAP::read_files(char *coefffilename, char *paramfilename) quadraticflag = atoi(keyval); else if (strcmp(keywd,"alloyflag") == 0) alloyflag = atoi(keyval); - else if (strcmp(keywd,"chunksize") == 0) - chunksize = atoi(keyval); + else if (strcmp(keywd,"wselfallflag") == 0) + wselfallflag = atoi(keyval); else if (strcmp(keywd,"chunksize") == 0) chunksize = atoi(keyval); else if (strcmp(keywd,"rcutfac") == 0 || @@ -418,8 +413,6 @@ double MLIAPModelSNAP::memory_usage() int n = atom->ntypes+1; bytes += n*sizeof(int); // map - bytes += beta_max*ncoeff*sizeof(double); // bispectrum - bytes += beta_max*ncoeff*sizeof(double); // beta return bytes; } diff --git a/src/MLIAP/mliap_model_snap.h b/src/MLIAP/mliap_model_snap.h index 553803e2d2..4a7ccb10f8 100644 --- a/src/MLIAP/mliap_model_snap.h +++ b/src/MLIAP/mliap_model_snap.h @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#ifndef LMP_MLIAP_DESCRIPTOR_SNAP_H -#define LMP_MLIAP_DESCRIPTOR_SNAP_H +#ifndef LMP_MLIAP_MODEL_SNAP_H +#define LMP_MLIAP_MODEL_SNAP_H #include "pointers.h" diff --git a/src/MLIAP/pair_mliap_snap.cpp b/src/MLIAP/pair_mliap_snap.cpp index e9a1553497..2e4761d513 100644 --- a/src/MLIAP/pair_mliap_snap.cpp +++ b/src/MLIAP/pair_mliap_snap.cpp @@ -11,28 +11,23 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mliap_model_snap.h" -#include "mliap_descriptor_snap.h" -#include "pair_mliap_snap.h" #include #include #include #include +#include "mliap_model_snap.h" +#include "mliap_descriptor_snap.h" +#include "pair_mliap_snap.h" #include "atom.h" #include "force.h" -#include "comm.h" #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "sna.h" #include "memory.h" #include "error.h" using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define MAXWORD 3 - /* ---------------------------------------------------------------------- */ PairMLIAPSNAP::PairMLIAPSNAP(LAMMPS *lmp) : Pair(lmp) @@ -42,16 +37,11 @@ PairMLIAPSNAP::PairMLIAPSNAP(LAMMPS *lmp) : Pair(lmp) one_coeff = 1; manybody_flag = 1; - nelements = 0; - elements = NULL; - radelem = NULL; - wjelem = NULL; - beta_max = 0; - atomenergy = NULL; beta = NULL; bispectrum = NULL; - snaptr = NULL; + atomenergy = NULL; + model = NULL; descriptor = NULL; } @@ -62,25 +52,16 @@ PairMLIAPSNAP::~PairMLIAPSNAP() { if (copymode) return; - if (nelements) { - for (int i = 0; i < nelements; i++) - delete[] elements[i]; - delete[] elements; - memory->destroy(radelem); - memory->destroy(wjelem); - } - memory->destroy(beta); memory->destroy(bispectrum); + memory->destroy(atomenergy); - delete snaptr; delete model; delete descriptor; if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); - memory->destroy(map); } } @@ -91,200 +72,46 @@ PairMLIAPSNAP::~PairMLIAPSNAP() void PairMLIAPSNAP::compute(int eflag, int vflag) { - int i,j,jnum,ninside; - double delx,dely,delz,evdwl,rsq; - double fij[3]; - int *jlist,*numneigh,**firstneigh; - ev_init(eflag,vflag); - double **x = atom->x; - double **f = atom->f; - int *type = atom->type; - int nlocal = atom->nlocal; - int newton_pair = force->newton_pair; + // resize lists if (beta_max < list->inum) { - memory->grow(atomenergy,list->inum,"PairMLIAPSNAP:atomenergy"); memory->grow(beta,list->inum,ncoeff,"PairMLIAPSNAP:beta"); memory->grow(bispectrum,list->inum,ncoeff,"PairMLIAPSNAP:bispectrum"); + memory->grow(atomenergy,list->inum,"PairMLIAPSNAP:atomenergy"); beta_max = list->inum; } + // compute descriptors + + if (model->quadraticflag || eflag) + descriptor->forward(list, bispectrum); + // compute E_i and beta_i = dE_i/dB_i for all i in list - if (quadraticflag || eflag) - compute_bispectrum(); model->gradient(list, bispectrum, atomenergy, beta, eflag); - numneigh = list->numneigh; - firstneigh = list->firstneigh; + // calculate force contributions beta_i*dB_i/dR_j + + descriptor->backward(list, beta); - for (int ii = 0; ii < list->inum; ii++) { - i = list->ilist[ii]; + // tally energy contributions - const double xtmp = x[i][0]; - const double ytmp = x[i][1]; - const double ztmp = x[i][2]; - const int itype = type[i]; - const int ielem = map[itype]; - const double radi = radelem[ielem]; - - jlist = firstneigh[i]; - jnum = numneigh[i]; - - // insure rij, inside, wj, and rcutij are of size jnum - - snaptr->grow_rij(jnum); - - // rij[][3] = displacements between atom I and those neighbors - // inside = indices of neighbors of I within cutoff - // wj = weights for neighbors of I within cutoff - // rcutij = cutoffs for neighbors of I within cutoff - // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi - - ninside = 0; - for (int jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; - rsq = delx*delx + dely*dely + delz*delz; - int jtype = type[j]; - int jelem = map[jtype]; - - if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { - snaptr->rij[ninside][0] = delx; - snaptr->rij[ninside][1] = dely; - snaptr->rij[ninside][2] = delz; - snaptr->inside[ninside] = j; - snaptr->wj[ninside] = wjelem[jelem]; - snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; - snaptr->element[ninside] = jelem; // element index for alloy snap - ninside++; - } - } - - // compute Ui, Yi for atom I - - snaptr->compute_ui(ninside, ielem); - - // for neighbors of I within cutoff: - // compute Fij = dEi/dRj = -dEi/dRi - // add to Fi, subtract from Fj - - snaptr->compute_yi(beta[ii]); - //for (int q=0; qidxu_max*2; q++){ - // fprintf(screen, "%i %f\n",q, snaptr->ylist_r[q]); - //} - - for (int jj = 0; jj < ninside; jj++) { - int j = snaptr->inside[jj]; - snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], - snaptr->rcutij[jj],jj, snaptr->element[jj]); - - snaptr->compute_deidrj(fij); - - f[i][0] += fij[0]; - f[i][1] += fij[1]; - f[i][2] += fij[2]; - f[j][0] -= fij[0]; - f[j][1] -= fij[1]; - f[j][2] -= fij[2]; - - // tally per-atom virial contribution - - if (vflag) - ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0, - fij[0],fij[1],fij[2], - -snaptr->rij[jj][0],-snaptr->rij[jj][1], - -snaptr->rij[jj][2]); - } - //fprintf(screen, "%f %f %f\n",f[i][0],f[i][1],f[i][2]); - - // tally energy contribution - - if (eflag) { - evdwl = atomenergy[ii]; + if (eflag) { + for (int ii = 0; ii < list->inum; ii++) { + int i = list->ilist[ii]; + double evdwl = atomenergy[ii]; ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0); } } + // calculate stress + if (vflag_fdotr) virial_fdotr_compute(); } -/* ---------------------------------------------------------------------- - compute bispectrum -------------------------------------------------------------------------- */ - -void PairMLIAPSNAP::compute_bispectrum() -{ - int i,j,jnum,ninside; - double delx,dely,delz,rsq; - int *jlist; - - double **x = atom->x; - int *type = atom->type; - - for (int ii = 0; ii < list->inum; ii++) { - i = list->ilist[ii]; - - const double xtmp = x[i][0]; - const double ytmp = x[i][1]; - const double ztmp = x[i][2]; - const int itype = type[i]; - const int ielem = map[itype]; - const double radi = radelem[ielem]; - - jlist = list->firstneigh[i]; - jnum = list->numneigh[i]; - - // insure rij, inside, wj, and rcutij are of size jnum - - snaptr->grow_rij(jnum); - - // rij[][3] = displacements between atom I and those neighbors - // inside = indices of neighbors of I within cutoff - // wj = weights for neighbors of I within cutoff - // rcutij = cutoffs for neighbors of I within cutoff - // note Rij sign convention => dU/dRij = dU/dRj = -dU/dRi - - ninside = 0; - for (int jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - j &= NEIGHMASK; - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; - rsq = delx*delx + dely*dely + delz*delz; - int jtype = type[j]; - int jelem = map[jtype]; - - if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { - snaptr->rij[ninside][0] = delx; - snaptr->rij[ninside][1] = dely; - snaptr->rij[ninside][2] = delz; - snaptr->inside[ninside] = j; - snaptr->wj[ninside] = wjelem[jelem]; - snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; - snaptr->element[ninside] = jelem; // element index for alloy snap - ninside++; - } - } - - snaptr->compute_ui(ninside, ielem); - snaptr->compute_zi(); - snaptr->compute_bi(ielem); - - for (int icoeff = 0; icoeff < ncoeff; icoeff++){ - bispectrum[ii][icoeff] = snaptr->blist[icoeff]; - } - } - -} - /* ---------------------------------------------------------------------- allocate all arrays ------------------------------------------------------------------------- */ @@ -296,7 +123,6 @@ void PairMLIAPSNAP::allocate() memory->create(setflag,n+1,n+1,"pair:setflag"); memory->create(cutsq,n+1,n+1,"pair:cutsq"); - memory->create(map,n+1,"pair:map"); } /* ---------------------------------------------------------------------- @@ -318,62 +144,16 @@ void PairMLIAPSNAP::coeff(int narg, char **arg) if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); - if (nelements) { - for (int i = 0; i < nelements; i++) - delete[] elements[i]; - delete[] elements; - memory->destroy(radelem); - memory->destroy(wjelem); - } + model = new MLIAPModelSNAP(lmp); + descriptor = new MLIAPDescriptorSNAP(lmp); - char* type1 = arg[0]; - char* type2 = arg[1]; - char* coefffilename = arg[2]; - char* paramfilename = arg[3]; - char** elemtypes = &arg[4]; + model->init(narg, arg); + descriptor->init(narg, arg); - // insure I,J args are * * - - if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) + ncoeff = model->ncoeff; + if (ncoeff != descriptor->ncoeff) error->all(FLERR,"Incorrect args for pair coefficients"); - // read snapcoeff and snapparam files - - read_files(coefffilename,paramfilename); - - if (!quadraticflag) - ncoeff = ncoeffall - 1; - else { - - // ncoeffall should be (ncoeff+2)*(ncoeff+1)/2 - // so, ncoeff = floor(sqrt(2*ncoeffall))-1 - - ncoeff = sqrt(2*ncoeffall)-1; - ncoeffq = (ncoeff*(ncoeff+1))/2; - int ntmp = 1+ncoeff+ncoeffq; - if (ntmp != ncoeffall) { - printf("ncoeffall = %d ntmp = %d ncoeff = %d \n",ncoeffall,ntmp,ncoeff); - error->all(FLERR,"Incorrect SNAP coeff file"); - } - } - - // read args that map atom types to SNAP elements - // map[i] = which element the Ith atom type is, -1 if not mapped - // map[0] is not used - - for (int i = 1; i <= atom->ntypes; i++) { - char* elemname = elemtypes[i-1]; - int jelem; - for (jelem = 0; jelem < nelements; jelem++) - if (strcmp(elemname,elements[jelem]) == 0) - break; - - if (jelem < nelements) - map[i] = jelem; - else if (strcmp(elemname,"NULL") == 0) map[i] = -1; - else error->all(FLERR,"Incorrect args for pair coefficients"); - } - // clear setflag since coeff() called once with I,J = * * int n = atom->ntypes; @@ -386,34 +166,12 @@ void PairMLIAPSNAP::coeff(int narg, char **arg) int count = 0; for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) - if (map[i] >= 0 && map[j] >= 0) { + if (descriptor->map[i] >= 0 && descriptor->map[j] >= 0) { setflag[i][j] = 1; count++; } if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); - - snaptr = new SNA(lmp, rfac0, twojmax, - rmin0, switchflag, bzeroflag, - alloyflag, wselfallflag, nelements); - - if (ncoeff != snaptr->ncoeff) { - if (comm->me == 0) - printf("ncoeff = %d snancoeff = %d \n",ncoeff,snaptr->ncoeff); - error->all(FLERR,"Incorrect SNAP parameter file"); - } - - // Calculate maximum cutoff for all elements - - rcutmax = 0.0; - for (int ielem = 0; ielem < nelements; ielem++) - rcutmax = MAX(2.0*radelem[ielem]*rcutfac,rcutmax); - - model = new MLIAPModelSNAP(lmp); - descriptor = new MLIAPDescriptorSNAP(lmp); - - model->init(narg, arg); - } /* ---------------------------------------------------------------------- @@ -430,11 +188,9 @@ void PairMLIAPSNAP::init_style() int irequest = neighbor->request(this,instance_me); neighbor->requests[irequest]->half = 0; neighbor->requests[irequest]->full = 1; - - snaptr->init(); - } + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ @@ -442,242 +198,7 @@ void PairMLIAPSNAP::init_style() double PairMLIAPSNAP::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); - return (radelem[map[i]] + - radelem[map[j]])*rcutfac; -} - -/* ---------------------------------------------------------------------- */ - -void PairMLIAPSNAP::read_files(char *coefffilename, char *paramfilename) -{ - - // open SNAP coefficient file on proc 0 - - FILE *fpcoeff; - if (comm->me == 0) { - fpcoeff = force->open_potential(coefffilename); - if (fpcoeff == NULL) { - char str[128]; - snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); - error->one(FLERR,str); - } - } - - char line[MAXLINE],*ptr; - int eof = 0; - - int n; - int nwords = 0; - while (nwords == 0) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - // strip comment, skip line if blank - - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = atom->count_words(line); - } - if (nwords != 2) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - // words = ptrs to all words in line - // strip single and double quotes from words - - char* words[MAXWORD]; - int iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); - - nelements = atoi(words[0]); - ncoeffall = atoi(words[1]); - - // set up element lists - - elements = new char*[nelements]; - memory->create(radelem,nelements,"pair:radelem"); - memory->create(wjelem,nelements,"pair:wjelem"); - memory->create(coeffelem,nelements,ncoeffall,"pair:coeffelem"); - - // Loop over nelements blocks in the SNAP coefficient file - - for (int ielem = 0; ielem < nelements; ielem++) { - - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - nwords = atom->count_words(line); - if (nwords != 3) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); - iword = 2; - words[iword] = strtok(NULL,"' \t\n\r\f"); - - char* elemtmp = words[0]; - int n = strlen(elemtmp) + 1; - elements[ielem] = new char[n]; - strcpy(elements[ielem],elemtmp); - - radelem[ielem] = atof(words[1]); - wjelem[ielem] = atof(words[2]); - - - if (comm->me == 0) { - if (screen) fprintf(screen,"SNAP Element = %s, Radius %g, Weight %g \n", - elements[ielem], radelem[ielem], wjelem[ielem]); - if (logfile) fprintf(logfile,"SNAP Element = %s, Radius %g, Weight %g \n", - elements[ielem], radelem[ielem], wjelem[ielem]); - } - - for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - // No need to store actual coefficients - -// MPI_Bcast(&n,1,MPI_INT,0,world); -// MPI_Bcast(line,n,MPI_CHAR,0,world); - -// nwords = atom->count_words(line); -// if (nwords != 1) -// error->all(FLERR,"Incorrect format in SNAP coefficient file"); - -// iword = 0; -// words[iword] = strtok(line,"' \t\n\r\f"); - -// coeffelem[ielem][icoeff] = atof(words[0]); - - } - } - - if (comm->me == 0) fclose(fpcoeff); - - // set flags for required keywords - - rcutfacflag = 0; - twojmaxflag = 0; - - // Set defaults for optional keywords - - rfac0 = 0.99363; - rmin0 = 0.0; - switchflag = 1; - bzeroflag = 1; - bnormflag = 0; - quadraticflag = 0; - alloyflag = 0; - wselfallflag = 0; - chunksize = 2000; - - // open SNAP parameter file on proc 0 - - FILE *fpparam; - if (comm->me == 0) { - fpparam = force->open_potential(paramfilename); - if (fpparam == NULL) { - char str[128]; - snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); - error->one(FLERR,str); - } - } - - eof = 0; - while (1) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { - eof = 1; - fclose(fpparam); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - // strip comment, skip line if blank - - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = atom->count_words(line); - if (nwords == 0) continue; - - if (nwords != 2) - error->all(FLERR,"Incorrect format in SNAP parameter file"); - - // words = ptrs to all words in line - // strip single and double quotes from words - - char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); - - if (comm->me == 0) { - if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); - if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval); - } - - if (strcmp(keywd,"rcutfac") == 0) { - rcutfac = atof(keyval); - rcutfacflag = 1; - } else if (strcmp(keywd,"twojmax") == 0) { - twojmax = atoi(keyval); - twojmaxflag = 1; - } else if (strcmp(keywd,"rfac0") == 0) - rfac0 = atof(keyval); - else if (strcmp(keywd,"rmin0") == 0) - rmin0 = atof(keyval); - else if (strcmp(keywd,"switchflag") == 0) - switchflag = atoi(keyval); - else if (strcmp(keywd,"bzeroflag") == 0) - bzeroflag = atoi(keyval); - else if (strcmp(keywd,"quadraticflag") == 0) - quadraticflag = atoi(keyval); - else if (strcmp(keywd,"alloyflag") == 0) - alloyflag = atoi(keyval); - else if (strcmp(keywd,"wselfallflag") == 0) - wselfallflag = atoi(keyval); - else if (strcmp(keywd,"chunksize") == 0) - chunksize = atoi(keyval); - else - error->all(FLERR,"Incorrect SNAP parameter file"); - } - - bnormflag = alloyflag; - - if (rcutfacflag == 0 || twojmaxflag == 0) - error->all(FLERR,"Incorrect SNAP parameter file"); - + return sqrt(descriptor->cutsq[i][j]); } /* ---------------------------------------------------------------------- @@ -691,11 +212,12 @@ double PairMLIAPSNAP::memory_usage() int n = atom->ntypes+1; bytes += n*n*sizeof(int); // setflag bytes += n*n*sizeof(double); // cutsq - bytes += n*sizeof(int); // map bytes += beta_max*ncoeff*sizeof(double); // bispectrum bytes += beta_max*ncoeff*sizeof(double); // beta + bytes += beta_max*ncoeff*sizeof(double); // energyatom - bytes += snaptr->memory_usage(); // SNA object + bytes += descriptor->memory_usage(); // Descriptor object + bytes += model->memory_usage(); // Model object return bytes; } diff --git a/src/MLIAP/pair_mliap_snap.h b/src/MLIAP/pair_mliap_snap.h index 64ce706e06..3bf4ed0582 100644 --- a/src/MLIAP/pair_mliap_snap.h +++ b/src/MLIAP/pair_mliap_snap.h @@ -39,8 +39,6 @@ public: int ncoeff; // compiler bug, manifest in KOKKOS package protected: - int ncoeffq, ncoeffall; - class SNA* snaptr; virtual void allocate(); void read_files(char *, char *); inline int equal(double* x,double* y); @@ -48,21 +46,9 @@ protected: void compute_bispectrum(); - double rcutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements - double *radelem; // element radii - double *wjelem; // elements weights - double **coeffelem; // element bispectrum coefficients - double* atomenergy; // energies for all atoms in list + double* atomenergy; // energies for all atoms in list double** beta; // betas for all atoms in list double** bispectrum; // bispectrum components for all atoms in list - int *map; // mapping from atom types to elements - int twojmax, switchflag, bzeroflag, bnormflag; - int alloyflag, wselfallflag; - int chunksize; - double rfac0, rmin0, wj1, wj2; - int rcutfacflag, twojmaxflag; // flags for required parameters int beta_max; // length of beta class MLIAPModelSNAP* model; class MLIAPDescriptorSNAP* descriptor; @@ -73,62 +59,3 @@ protected: #endif #endif -/* ERROR/WARNING messages: - -E: Communication cutoff too small for SNAP micro load balancing - -This can happen if you change the neighbor skin after your pair_style -command or if your box dimensions grow during a run. You can set the -cutoff explicitly via the comm_modify cutoff command. - -E: Illegal ... command - -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect SNAP coeff file - -UNDOCUMENTED - -E: Incorrect SNAP parameter file - -The file cannot be parsed correctly, check its internal syntax. - -E: Pair style SNAP requires newton pair on - -See the newton command. This is a restriction to use the SNAP -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open SNAP coefficient file %s - -The specified SNAP coefficient file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in SNAP coefficient file - -Incorrect number of words per line in the coefficient file. - -E: Cannot open SNAP parameter file %s - -The specified SNAP parameter file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in SNAP parameter file - -Incorrect number of words per line in the parameter file. - -E: Did not find all elements in SNAP coefficient file. - -One or more elements listed in the pair_coeff command were not found in the coefficient file. - -*/ From 909e6048c490adb9ecda18f53a2ebc5fe24a17af Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Wed, 1 Apr 2020 18:09:18 -0600 Subject: [PATCH 03/54] Added mliap package --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index bce5089500..af2eacb508 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,7 +55,7 @@ endif PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \ granular kim kokkos kspace latte manybody mc message misc \ - molecule mpiio mscg opt peri poems \ + mliap molecule mpiio mscg opt peri poems \ python qeq replica rigid shock snap spin srd voronoi PACKUSER = user-adios user-atc user-awpmd user-bocs user-cgdna user-cgsdk user-colvars \ From b5dfdc4fa4884691fe16480d53636ff8c4afe0d8 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Sun, 5 Apr 2020 00:17:31 -0600 Subject: [PATCH 04/54] Separated out class hierarchy --- src/MLIAP/mliap_descriptor.cpp | 43 ++ src/MLIAP/mliap_descriptor.h | 43 ++ src/MLIAP/mliap_descriptor_snap.cpp | 390 ++++++---------- src/MLIAP/mliap_descriptor_snap.h | 29 +- src/MLIAP/mliap_model.cpp | 162 +++++++ src/MLIAP/mliap_model.h | 42 ++ src/MLIAP/mliap_model_linear.cpp | 76 ++++ src/MLIAP/mliap_model_linear.h | 33 ++ src/MLIAP/mliap_model_quadratic.cpp | 100 +++++ src/MLIAP/mliap_model_quadratic.h | 33 ++ src/MLIAP/mliap_model_snap.cpp | 419 ------------------ src/MLIAP/mliap_model_snap.h | 59 --- .../{pair_mliap_snap.cpp => pair_mliap.cpp} | 137 ++++-- src/MLIAP/{pair_mliap_snap.h => pair_mliap.h} | 32 +- 14 files changed, 779 insertions(+), 819 deletions(-) create mode 100644 src/MLIAP/mliap_descriptor.cpp create mode 100644 src/MLIAP/mliap_descriptor.h create mode 100644 src/MLIAP/mliap_model.cpp create mode 100644 src/MLIAP/mliap_model.h create mode 100644 src/MLIAP/mliap_model_linear.cpp create mode 100644 src/MLIAP/mliap_model_linear.h create mode 100644 src/MLIAP/mliap_model_quadratic.cpp create mode 100644 src/MLIAP/mliap_model_quadratic.h delete mode 100644 src/MLIAP/mliap_model_snap.cpp delete mode 100644 src/MLIAP/mliap_model_snap.h rename src/MLIAP/{pair_mliap_snap.cpp => pair_mliap.cpp} (56%) rename src/MLIAP/{pair_mliap_snap.h => pair_mliap.h} (57%) diff --git a/src/MLIAP/mliap_descriptor.cpp b/src/MLIAP/mliap_descriptor.cpp new file mode 100644 index 0000000000..43c5cf40bc --- /dev/null +++ b/src/MLIAP/mliap_descriptor.cpp @@ -0,0 +1,43 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "mliap_descriptor.h" +#include "pair_mliap.h" +#include +#include +#include +#include +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "sna.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define MAXWORD 3 + +/* ---------------------------------------------------------------------- */ + +MLIAPDescriptor::MLIAPDescriptor(LAMMPS *lmp, + PairMLIAP* pairmliap_in) : Pointers(lmp) {} + +/* ---------------------------------------------------------------------- */ + +MLIAPDescriptor::~MLIAPDescriptor(){} + diff --git a/src/MLIAP/mliap_descriptor.h b/src/MLIAP/mliap_descriptor.h new file mode 100644 index 0000000000..c6ff4201da --- /dev/null +++ b/src/MLIAP/mliap_descriptor.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_MLIAP_DESCRIPTOR_H +#define LMP_MLIAP_DESCRIPTOR_H + +#include "pointers.h" + +namespace LAMMPS_NS { + +class MLIAPDescriptor : protected Pointers { +public: + MLIAPDescriptor(LAMMPS*, class PairMLIAP*); + ~MLIAPDescriptor(); + virtual void forward(class NeighList*, double**)=0; + virtual void backward(class NeighList*, double**, int)=0; + virtual void init()=0; + virtual double get_cutoff(int, int)=0; + virtual double memory_usage()=0; + + int ndescriptors; // number of descriptors + int nelements; // # of unique elements + char **elements; // names of unique elements + +protected: + class PairMLIAP* pairmliap; + +}; + +} + +#endif + diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 43649fe021..448e334ddd 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -12,6 +12,7 @@ ------------------------------------------------------------------------- */ #include "mliap_descriptor_snap.h" +#include "pair_mliap.h" #include #include #include @@ -33,17 +34,17 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp): Pointers(lmp) +MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename, + PairMLIAP* pairmliap_in): + MLIAPDescriptor(lmp, pairmliap_in) { nelements = 0; elements = NULL; radelem = NULL; wjelem = NULL; - - cutsq = NULL; - map = NULL; - snaptr = NULL; + read_paramfile(paramfilename); + pairmliap = pairmliap_in; } /* ---------------------------------------------------------------------- */ @@ -61,18 +62,13 @@ MLIAPDescriptorSNAP::~MLIAPDescriptorSNAP() delete snaptr; - if (allocated) { - memory->destroy(cutsq); - memory->destroy(map); - } - } /* ---------------------------------------------------------------------- - compute bispectrum components + compute descriptors for each atom ---------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::forward(NeighList* list, double **bispectrum) +void MLIAPDescriptorSNAP::forward(NeighList* list, double **descriptors) { int i,j,jnum,ninside; double delx,dely,delz,rsq; @@ -88,7 +84,7 @@ void MLIAPDescriptorSNAP::forward(NeighList* list, double **bispectrum) const double ytmp = x[i][1]; const double ztmp = x[i][2]; const int itype = type[i]; - const int ielem = map[itype]; + const int ielem = pairmliap->map[itype]; const double radi = radelem[ielem]; jlist = list->firstneigh[i]; @@ -113,11 +109,11 @@ void MLIAPDescriptorSNAP::forward(NeighList* list, double **bispectrum) delz = x[j][2] - ztmp; rsq = delx*delx + dely*dely + delz*delz; int jtype = type[j]; - int jelem = map[jtype]; + int jelem = pairmliap->map[jtype]; // printf("i = %d j = %d itype = %d jtype = %d cutsq[i][j] = %g rsq = %g\n",i,j,itype,jtype,cutsq[itype][jtype],rsq); - if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { + if (rsq < pairmliap->cutsq[itype][jtype]&&rsq>1e-20) { snaptr->rij[ninside][0] = delx; snaptr->rij[ninside][1] = dely; snaptr->rij[ninside][2] = delz; @@ -129,24 +125,27 @@ void MLIAPDescriptorSNAP::forward(NeighList* list, double **bispectrum) } } - snaptr->compute_ui(ninside, ielem); + if (alloyflag) + snaptr->compute_ui(ninside, ielem); + else + snaptr->compute_ui(ninside, 0); snaptr->compute_zi(); - snaptr->compute_bi(ielem); + if (alloyflag) + snaptr->compute_bi(ielem); + else + snaptr->compute_bi(0); - // printf("ninside = %d jnum = %d radi = %g cutsq[i][1] = %g rsq = %g\n",ninside,jnum,radi,cutsq[itype][1]); - for (int icoeff = 0; icoeff < ncoeff; icoeff++){ - bispectrum[ii][icoeff] = snaptr->blist[icoeff]; - // printf("icoeff = %d B = %g\n",icoeff,bispectrum[ii][icoeff]); - } + for (int icoeff = 0; icoeff < ndescriptors; icoeff++) + descriptors[ii][icoeff] = snaptr->blist[icoeff]; } } /* ---------------------------------------------------------------------- - compute bispectrum components + compute forces for each atom ---------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta) +void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta, int vflag) { int i,j,jnum,ninside; double delx,dely,delz,evdwl,rsq; @@ -169,7 +168,7 @@ void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta) const double ytmp = x[i][1]; const double ztmp = x[i][2]; const int itype = type[i]; - const int ielem = map[itype]; + const int ielem = pairmliap->map[itype]; const double radi = radelem[ielem]; jlist = firstneigh[i]; @@ -194,9 +193,9 @@ void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta) delz = x[j][2] - ztmp; rsq = delx*delx + dely*dely + delz*delz; int jtype = type[j]; - int jelem = map[jtype]; + int jelem = pairmliap->map[jtype]; - if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { + if (rsq < pairmliap->cutsq[itype][jtype]&&rsq>1e-20) { snaptr->rij[ninside][0] = delx; snaptr->rij[ninside][1] = dely; snaptr->rij[ninside][2] = delz; @@ -210,7 +209,10 @@ void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta) // compute Ui, Yi for atom I - snaptr->compute_ui(ninside, ielem); + if (alloyflag) + snaptr->compute_ui(ninside, ielem); + else + snaptr->compute_ui(ninside, 0); // for neighbors of I within cutoff: // compute Fij = dEi/dRj = -dEi/dRi @@ -223,8 +225,12 @@ void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta) for (int jj = 0; jj < ninside; jj++) { int j = snaptr->inside[jj]; - snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], - snaptr->rcutij[jj],jj, snaptr->element[jj]); + if(alloyflag) + snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], + snaptr->rcutij[jj],jj, snaptr->element[jj]); + else + snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], + snaptr->rcutij[jj],jj, 0); snaptr->compute_deidrj(fij); @@ -235,72 +241,25 @@ void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta) f[j][1] -= fij[1]; f[j][2] -= fij[2]; + // tally per-atom virial contribution + + if (vflag) + pairmliap->ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0, + fij[0],fij[1],fij[2], + -snaptr->rij[jj][0],-snaptr->rij[jj][1], + -snaptr->rij[jj][2]); + } } } -/* ---------------------------------------------------------------------- - allocate all arrays -------------------------------------------------------------------------- */ - -void MLIAPDescriptorSNAP::allocate() -{ - allocated = 1; - int n = atom->ntypes; - - memory->create(cutsq,n+1,n+1,"mliap_descriptor_snap:cutsq"); - memory->create(map,n+1,"mliap_descriptor_snap:map"); -} - /* ---------------------------------------------------------------------- set coeffs for one or more type pairs ------------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::init(int narg, char **arg) +void MLIAPDescriptorSNAP::init() { - if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); - if (!allocated) allocate(); - - if (nelements) { - for (int i = 0; i < nelements; i++) - delete[] elements[i]; - delete[] elements; - memory->destroy(radelem); - memory->destroy(wjelem); - } - - char* type1 = arg[0]; - char* type2 = arg[1]; - char* coefffilename = arg[2]; - char* paramfilename = arg[3]; - char** elemtypes = &arg[4]; - - // insure I,J args are * * - - if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read snapcoeff and snapparam files - - read_files(coefffilename,paramfilename); - - // read args that map atom types to SNAP elements - // map[i] = which element the Ith atom type is, -1 if not mapped - // map[0] is not used - - for (int i = 1; i <= atom->ntypes; i++) { - char* elemname = elemtypes[i-1]; - int jelem; - for (jelem = 0; jelem < nelements; jelem++) - if (strcmp(elemname,elements[jelem]) == 0) - break; - - if (jelem < nelements) - map[i] = jelem; - else if (strcmp(elemname,"NULL") == 0) map[i] = -1; - else error->all(FLERR,"Incorrect args for pair coefficients"); - } snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, @@ -308,148 +267,23 @@ void MLIAPDescriptorSNAP::init(int narg, char **arg) snaptr->init(); - ncoeff = snaptr->ncoeff; + ndescriptors = snaptr->ncoeff; - // Calculate maximum cutoff for all elements - - rcutmax = 0.0; - for (int ielem = 0; ielem < nelements; ielem++) - rcutmax = MAX(2.0*radelem[ielem]*rcutfac,rcutmax); - - // set cutoff distances - - for (int i = 1; i <= atom->ntypes; i++) - for (int j = i; j <= atom->ntypes; j++) { - double rtmp = (radelem[map[i]] + radelem[map[j]])*rcutfac; - cutsq[i][j] = rtmp*rtmp; - } } /* ---------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) +void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) { - // open SNAP coefficient file on proc 0 - - FILE *fpcoeff; - if (comm->me == 0) { - fpcoeff = force->open_potential(coefffilename); - if (fpcoeff == NULL) { - char str[128]; - snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); - error->one(FLERR,str); - } - } - - char line[MAXLINE],*ptr; - int eof = 0; - - int n; - int nwords = 0; - while (nwords == 0) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - // strip comment, skip line if blank - - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = atom->count_words(line); - } - if (nwords != 2) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - // words = ptrs to all words in line - // strip single and double quotes from words - - char* words[MAXWORD]; - int iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); - - nelements = atoi(words[0]); - int ncoeffall = atoi(words[1]); - - // set up element lists - - elements = new char*[nelements]; - memory->create(radelem,nelements,"mliap_snap_descriptor:radelem"); - memory->create(wjelem,nelements,"mliap_snap_descriptor:wjelem"); - - // Loop over nelements blocks in the SNAP coefficient file - - for (int ielem = 0; ielem < nelements; ielem++) { - - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - nwords = atom->count_words(line); - if (nwords != 3) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); - iword = 2; - words[iword] = strtok(NULL,"' \t\n\r\f"); - - char* elemtmp = words[0]; - int n = strlen(elemtmp) + 1; - elements[ielem] = new char[n]; - strcpy(elements[ielem],elemtmp); - - radelem[ielem] = atof(words[1]); - wjelem[ielem] = atof(words[2]); - - if (comm->me == 0) { - if (screen) fprintf(screen,"SNAP Element = %s, Radius %g, Weight %g \n", - elements[ielem], radelem[ielem], wjelem[ielem]); - if (logfile) fprintf(logfile,"SNAP Element = %s, Radius %g, Weight %g \n", - elements[ielem], radelem[ielem], wjelem[ielem]); - } - - for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - } - } - - if (comm->me == 0) fclose(fpcoeff); - // set flags for required keywords - rcutfacflag = 0; - twojmaxflag = 0; + int rcutfacflag = 0; + int twojmaxflag = 0; + int nelementsflag = 0; + int elementsflag = 0; + int radelemflag = 0; + int wjelemflag = 0; // Set defaults for optional keywords @@ -460,7 +294,6 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) bnormflag = 0; alloyflag = 0; wselfallflag = 0; - chunksize = 2000; // open SNAP parameter file on proc 0 @@ -474,7 +307,10 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) } } - eof = 0; + char line[MAXLINE],*ptr; + int eof = 0; + int n,nwords; + while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); @@ -494,9 +330,6 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) nwords = atom->count_words(line); if (nwords == 0) continue; - if (nwords != 2) - error->all(FLERR,"Incorrect format in SNAP parameter file"); - // words = ptrs to all words in line // strip single and double quotes from words @@ -508,39 +341,92 @@ void MLIAPDescriptorSNAP::read_files(char *coefffilename, char *paramfilename) if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval); } - if (strcmp(keywd,"rcutfac") == 0) { - rcutfac = atof(keyval); - rcutfacflag = 1; - } else if (strcmp(keywd,"twojmax") == 0) { - twojmax = atoi(keyval); - twojmaxflag = 1; - } else if (strcmp(keywd,"rfac0") == 0) - rfac0 = atof(keyval); - else if (strcmp(keywd,"rmin0") == 0) - rmin0 = atof(keyval); - else if (strcmp(keywd,"switchflag") == 0) - switchflag = atoi(keyval); - else if (strcmp(keywd,"bzeroflag") == 0) - bzeroflag = atoi(keyval); - else if (strcmp(keywd,"alloyflag") == 0) - alloyflag = atoi(keyval); - else if (strcmp(keywd,"wselfallflag") == 0) - wselfallflag = atoi(keyval); - else if (strcmp(keywd,"chunksize") == 0) - chunksize = atoi(keyval); - else if (strcmp(keywd,"quadraticflag") == 0) - continue; - else - error->all(FLERR,"Incorrect SNAP parameter file"); - } + // check for keywords with one value per element + + if (strcmp(keywd,"elems") == 0 || + strcmp(keywd,"radelems") == 0 || + strcmp(keywd,"welems") == 0) { + if (nelementsflag == 0 || nwords != nelements+1) + error->all(FLERR,"Incorrect SNAP parameter file"); + + if (strcmp(keywd,"elems") == 0) { + for (int ielem = 0; ielem < nelements; ielem++) { + char* elemtmp = keyval; + int n = strlen(elemtmp) + 1; + elements[ielem] = new char[n]; + strcpy(elements[ielem],elemtmp); + keyval = strtok(NULL,"' \t\n\r\f"); + } + elementsflag = 1; + } else if (strcmp(keywd,"radelems") == 0) { + for (int ielem = 0; ielem < nelements; ielem++) { + radelem[ielem] = atof(keyval); + keyval = strtok(NULL,"' \t\n\r\f"); + } + radelemflag = 1; + } else if (strcmp(keywd,"welems") == 0) { + for (int ielem = 0; ielem < nelements; ielem++) { + wjelem[ielem] = atof(keyval); + keyval = strtok(NULL,"' \t\n\r\f"); + } + wjelemflag = 1; + } + + } else { + + // all other keywords take one value + + if (nwords != 2) + error->all(FLERR,"Incorrect SNAP parameter file"); + + if (strcmp(keywd,"nelems") == 0) { + nelements = atoi(keyval); + elements = new char*[nelements]; + memory->create(radelem,nelements,"mliap_snap_descriptor:radelem"); + memory->create(wjelem,nelements,"mliap_snap_descriptor:wjelem"); + nelementsflag = 1; + } else if (strcmp(keywd,"rcutfac") == 0) { + rcutfac = atof(keyval); + rcutfacflag = 1; + } else if (strcmp(keywd,"twojmax") == 0) { + twojmax = atoi(keyval); + twojmaxflag = 1; + } else if (strcmp(keywd,"rfac0") == 0) + rfac0 = atof(keyval); + else if (strcmp(keywd,"rmin0") == 0) + rmin0 = atof(keyval); + else if (strcmp(keywd,"switchflag") == 0) + switchflag = atoi(keyval); + else if (strcmp(keywd,"bzeroflag") == 0) + bzeroflag = atoi(keyval); + else if (strcmp(keywd,"alloyflag") == 0) + alloyflag = atoi(keyval); + else if (strcmp(keywd,"wselfallflag") == 0) + wselfallflag = atoi(keyval); + else + error->all(FLERR,"Incorrect SNAP parameter file"); + + } + } + bnormflag = alloyflag; - if (rcutfacflag == 0 || twojmaxflag == 0) + if (!rcutfacflag || !twojmaxflag || !nelementsflag || + !elementsflag || !radelemflag || !wjelemflag) error->all(FLERR,"Incorrect SNAP parameter file"); } +/* ---------------------------------------------------------------------- + provide cutoff distance for two elements +------------------------------------------------------------------------- */ + +double MLIAPDescriptorSNAP::get_cutoff(int ielem, int jelem) +{ + return (radelem[ielem] + radelem[jelem])*rcutfac; +} + /* ---------------------------------------------------------------------- memory usage ------------------------------------------------------------------------- */ @@ -549,10 +435,6 @@ double MLIAPDescriptorSNAP::memory_usage() { double bytes = 0; - int n = atom->ntypes+1; - bytes += n*n*sizeof(double); // cutsq - bytes += n*sizeof(int); // map - bytes += snaptr->memory_usage(); // SNA object return bytes; diff --git a/src/MLIAP/mliap_descriptor_snap.h b/src/MLIAP/mliap_descriptor_snap.h index d1656e0899..87334e80f0 100644 --- a/src/MLIAP/mliap_descriptor_snap.h +++ b/src/MLIAP/mliap_descriptor_snap.h @@ -14,44 +14,33 @@ #ifndef LMP_MLIAP_DESCRIPTOR_SNAP_H #define LMP_MLIAP_DESCRIPTOR_SNAP_H -#include "pointers.h" +#include "mliap_descriptor.h" namespace LAMMPS_NS { -class MLIAPDescriptorSNAP : protected Pointers { +class MLIAPDescriptorSNAP : public MLIAPDescriptor { public: - MLIAPDescriptorSNAP(LAMMPS *); + MLIAPDescriptorSNAP(LAMMPS*, char*, class PairMLIAP*); ~MLIAPDescriptorSNAP(); virtual void forward(class NeighList*, double**); - virtual void backward(class NeighList*, double**); - virtual void init(int, char **); + virtual void backward(class NeighList*, double**, int); + virtual void init(); + virtual double get_cutoff(int, int); virtual double memory_usage(); double rcutfac; // declared public to workaround gcc 4.9 - int ncoeff; // compiler bug, manifest in KOKKOS package - int *map; // mapping from atom types to elements - double **cutsq; // cutoff sq for each atom pair - + // compiler bug, manifest in KOKKOS package protected: - int allocated; class SNA* snaptr; - virtual void allocate(); - void read_files(char *, char *); + void read_paramfile(char *); inline int equal(double* x,double* y); inline double dist2(double* x,double* y); - void compute_bispectrum(); - - double rcutmax; // max cutoff for all elements - int nelements; // # of unique elements - char **elements; // names of unique elements double *radelem; // element radii double *wjelem; // elements weights int twojmax, switchflag, bzeroflag, bnormflag; int alloyflag, wselfallflag; - int chunksize; - double rfac0, rmin0, wj1, wj2; - int rcutfacflag, twojmaxflag; // flags for required parameters + double rfac0, rmin0; }; } diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp new file mode 100644 index 0000000000..df36dca6f7 --- /dev/null +++ b/src/MLIAP/mliap_model.cpp @@ -0,0 +1,162 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "mliap_model.h" +#include "pair_mliap.h" +#include +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neigh_list.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define MAXWORD 3 + +/* ---------------------------------------------------------------------- */ + +MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename, + PairMLIAP* pairmliap_in) : Pointers(lmp) +{ + nelements = 0; + coeffelem = NULL; + read_coeffs(coefffilename); + pairmliap = pairmliap_in; + nonlinearflag = 0; +} + +/* ---------------------------------------------------------------------- */ + +MLIAPModel::~MLIAPModel() +{ + memory->destroy(coeffelem); +} + +/* ---------------------------------------------------------------------- + placeholder +------------------------------------------------------------------------- */ + +void MLIAPModel::init() +{ +} + +/* ---------------------------------------------------------------------- */ + +void MLIAPModel::read_coeffs(char *coefffilename) +{ + + // open coefficient file on proc 0 + + FILE *fpcoeff; + if (comm->me == 0) { + fpcoeff = force->open_potential(coefffilename); + if (fpcoeff == NULL) { + char str[128]; + snprintf(str,128,"Cannot open MLIAPModel coefficient file %s",coefffilename); + error->one(FLERR,str); + } + } + + char line[MAXLINE],*ptr; + int eof = 0; + + int n; + int nwords = 0; + while (nwords == 0) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) break; + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + // strip comment, skip line if blank + + if ((ptr = strchr(line,'#'))) *ptr = '\0'; + nwords = atom->count_words(line); + } + if (nwords != 2) + error->all(FLERR,"Incorrect format in MLIAPModel coefficient file"); + + // words = ptrs to all words in line + // strip single and double quotes from words + + char* words[MAXWORD]; + int iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + iword = 1; + words[iword] = strtok(NULL,"' \t\n\r\f"); + + nelements = atoi(words[0]); + ncoeffall = atoi(words[1]); + + // set up coeff lists + + memory->create(coeffelem,nelements,ncoeffall,"mliap_snap_model:coeffelem"); + + // Loop over nelements blocks in the coefficient file + + for (int ielem = 0; ielem < nelements; ielem++) { + for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { + if (comm->me == 0) { + ptr = fgets(line,MAXLINE,fpcoeff); + if (ptr == NULL) { + eof = 1; + fclose(fpcoeff); + } else n = strlen(line) + 1; + } + + MPI_Bcast(&eof,1,MPI_INT,0,world); + if (eof) + error->all(FLERR,"Incorrect format in coefficient file"); + MPI_Bcast(&n,1,MPI_INT,0,world); + MPI_Bcast(line,n,MPI_CHAR,0,world); + + nwords = atom->count_words(line); + if (nwords != 1) + error->all(FLERR,"Incorrect format in coefficient file"); + + iword = 0; + words[iword] = strtok(line,"' \t\n\r\f"); + + coeffelem[ielem][icoeff] = atof(words[0]); + + } + } + + if (comm->me == 0) fclose(fpcoeff); + +} + +/* ---------------------------------------------------------------------- + memory usage +------------------------------------------------------------------------- */ + +double MLIAPModel::memory_usage() +{ + double bytes = 0; + + int n = atom->ntypes+1; + bytes += nelements*ncoeffall*sizeof(double); // coeffelem + + return bytes; +} + diff --git a/src/MLIAP/mliap_model.h b/src/MLIAP/mliap_model.h new file mode 100644 index 0000000000..7dfa67a2be --- /dev/null +++ b/src/MLIAP/mliap_model.h @@ -0,0 +1,42 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_MLIAP_MODEL_H +#define LMP_MLIAP_MODEL_H + +#include "pointers.h" + +namespace LAMMPS_NS { + +class MLIAPModel : protected Pointers { +public: + MLIAPModel(LAMMPS*, char*, class PairMLIAP*); + ~MLIAPModel(); + virtual void gradient(class NeighList*, double**, double**, int)=0; + virtual void init(); + virtual double memory_usage(); + int nelements; // # of unique elements + int nonlinearflag; // 1 if gradient() requires escriptors + int ndescriptors; // number of descriptors + +protected: + class PairMLIAP* pairmliap; + void read_coeffs(char *); + double **coeffelem; // element coefficients + int ncoeffall; // number of coefficients per element +}; + +} + +#endif + diff --git a/src/MLIAP/mliap_model_linear.cpp b/src/MLIAP/mliap_model_linear.cpp new file mode 100644 index 0000000000..fa58ba4199 --- /dev/null +++ b/src/MLIAP/mliap_model_linear.cpp @@ -0,0 +1,76 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "mliap_model_linear.h" +#include "pair_mliap.h" +#include +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neigh_list.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define MAXWORD 3 + +/* ---------------------------------------------------------------------- */ + +MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename, PairMLIAP* pairmliap_in) : + MLIAPModel(lmp, coefffilename, pairmliap_in) +{ + nonlinearflag = 0; + ndescriptors = ncoeffall - 1; +} + +/* ---------------------------------------------------------------------- */ + +MLIAPModelLinear::~MLIAPModelLinear(){} + +/* ---------------------------------------------------------------------- + Calculate model gradients w.r.t descriptors for each atom dE(B_i)/dB_i + ---------------------------------------------------------------------- */ + +void MLIAPModelLinear::gradient(NeighList* list, double **descriptors, double **beta, int eflag) +{ + int i; + int *type = atom->type; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + const int itype = type[i]; + const int ielem = pairmliap->map[itype]; + double* coeffi = coeffelem[ielem]; + + for (int icoeff = 0; icoeff < ndescriptors; icoeff++) + beta[ii][icoeff] = coeffi[icoeff+1]; + + if (eflag) { + + // energy of atom I + + double* coeffi = coeffelem[ielem]; + double etmp = coeffi[0]; + + // E_i = beta.B_i + + for (int icoeff = 0; icoeff < ndescriptors; icoeff++) + etmp += coeffi[icoeff+1]*descriptors[ii][icoeff]; + + pairmliap->ev_tally_full(i,2.0*etmp,0.0,0.0,0.0,0.0,0.0); + } + } +} + diff --git a/src/MLIAP/mliap_model_linear.h b/src/MLIAP/mliap_model_linear.h new file mode 100644 index 0000000000..98965370d6 --- /dev/null +++ b/src/MLIAP/mliap_model_linear.h @@ -0,0 +1,33 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_MLIAP_MODEL_LINEAR_H +#define LMP_MLIAP_MODEL_LINEAR_H + +#include "mliap_model.h" + +namespace LAMMPS_NS { + +class MLIAPModelLinear : public MLIAPModel { +public: + MLIAPModelLinear(LAMMPS*, char*, class PairMLIAP*); + ~MLIAPModelLinear(); + virtual void gradient(class NeighList*, double**, double**, int); + +protected: +}; + +} + +#endif + diff --git a/src/MLIAP/mliap_model_quadratic.cpp b/src/MLIAP/mliap_model_quadratic.cpp new file mode 100644 index 0000000000..2795c82bc7 --- /dev/null +++ b/src/MLIAP/mliap_model_quadratic.cpp @@ -0,0 +1,100 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "mliap_model_quadratic.h" +#include "pair_mliap.h" +#include +#include "atom.h" +#include "force.h" +#include "comm.h" +#include "neigh_list.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define MAXWORD 3 + +/* ---------------------------------------------------------------------- */ + +MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename, PairMLIAP* pairmliap_in) : + MLIAPModel(lmp, coefffilename, pairmliap_in) +{ + nonlinearflag = 1; + ndescriptors = sqrt(2*ncoeffall)-1; +} + +/* ---------------------------------------------------------------------- */ + +MLIAPModelQuadratic::~MLIAPModelQuadratic(){} + +/* ---------------------------------------------------------------------- + Calculate model gradients w.r.t descriptors for each atom dE(B_i)/dB_i + ---------------------------------------------------------------------- */ + +void MLIAPModelQuadratic::gradient(NeighList* list, double **descriptors, double **beta, int eflag) +{ + int i; + int *type = atom->type; + + for (int ii = 0; ii < list->inum; ii++) { + i = list->ilist[ii]; + const int itype = type[i]; + const int ielem = pairmliap->map[itype]; + double* coeffi = coeffelem[ielem]; + + for (int icoeff = 0; icoeff < ndescriptors; icoeff++) + beta[ii][icoeff] = coeffi[icoeff+1]; + + int k = ndescriptors+1; + for (int icoeff = 0; icoeff < ndescriptors; icoeff++) { + double bveci = descriptors[ii][icoeff]; + beta[ii][icoeff] += coeffi[k]*bveci; + k++; + for (int jcoeff = icoeff+1; jcoeff < ndescriptors; jcoeff++) { + double bvecj = descriptors[ii][jcoeff]; + beta[ii][icoeff] += coeffi[k]*bvecj; + beta[ii][jcoeff] += coeffi[k]*bveci; + k++; + } + } + + if (eflag) { + + // energy of atom I + + double* coeffi = coeffelem[ielem]; + double etmp = coeffi[0]; + + // E_i = beta.B_i + 0.5*B_i^t.alpha.B_i + + for (int icoeff = 0; icoeff < ndescriptors; icoeff++) + etmp += coeffi[icoeff+1]*descriptors[ii][icoeff]; + + // quadratic contributions + + int k = ndescriptors+1; + for (int icoeff = 0; icoeff < ndescriptors; icoeff++) { + double bveci = descriptors[ii][icoeff]; + etmp += 0.5*coeffi[k++]*bveci*bveci; + for (int jcoeff = icoeff+1; jcoeff < ndescriptors; jcoeff++) { + double bvecj = descriptors[ii][jcoeff]; + etmp += coeffi[k++]*bveci*bvecj; + } + } + pairmliap->ev_tally_full(i,2.0*etmp,0.0,0.0,0.0,0.0,0.0); + } + } +} + diff --git a/src/MLIAP/mliap_model_quadratic.h b/src/MLIAP/mliap_model_quadratic.h new file mode 100644 index 0000000000..e11f7d351e --- /dev/null +++ b/src/MLIAP/mliap_model_quadratic.h @@ -0,0 +1,33 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_MLIAP_MODEL_QUADRATIC_H +#define LMP_MLIAP_MODEL_QUADRATIC_H + +#include "mliap_model.h" + +namespace LAMMPS_NS { + +class MLIAPModelQuadratic : public MLIAPModel { +public: + MLIAPModelQuadratic(LAMMPS*, char*, class PairMLIAP*); + ~MLIAPModelQuadratic(); + virtual void gradient(class NeighList*, double**, double**, int); + +protected: +}; + +} + +#endif + diff --git a/src/MLIAP/mliap_model_snap.cpp b/src/MLIAP/mliap_model_snap.cpp deleted file mode 100644 index 22028b0787..0000000000 --- a/src/MLIAP/mliap_model_snap.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "mliap_model_snap.h" -#include -#include "atom.h" -#include "force.h" -#include "comm.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" - -using namespace LAMMPS_NS; - -#define MAXLINE 1024 -#define MAXWORD 3 - -/* ---------------------------------------------------------------------- */ - -MLIAPModelSNAP::MLIAPModelSNAP(LAMMPS* lmp) : Pointers(lmp) -{ - nelements = 0; - elements = NULL; - coeffelem = NULL; - map = NULL; - - beta_max = 0; - allocated = 0; -} - -/* ---------------------------------------------------------------------- */ - -MLIAPModelSNAP::~MLIAPModelSNAP() -{ - if (nelements) { - for (int i = 0; i < nelements; i++) - delete[] elements[i]; - delete[] elements; - memory->destroy(coeffelem); - } - - if (allocated) - memory->destroy(map); - -} - -/* ---------------------------------------------------------------------- - Calculate model gradients for each atom i.e. dE(B_i)/dB_i - ---------------------------------------------------------------------- */ - -void MLIAPModelSNAP::gradient(NeighList* list, double **bispectrum, double *atomenergy, double **beta, int eflag) -{ - int i; - int *type = atom->type; - - for (int ii = 0; ii < list->inum; ii++) { - i = list->ilist[ii]; - const int itype = type[i]; - const int ielem = map[itype]; - double* coeffi = coeffelem[ielem]; - - for (int icoeff = 0; icoeff < ncoeff; icoeff++) - beta[ii][icoeff] = coeffi[icoeff+1]; - - if (quadraticflag) { - int k = ncoeff+1; - for (int icoeff = 0; icoeff < ncoeff; icoeff++) { - double bveci = bispectrum[ii][icoeff]; - beta[ii][icoeff] += coeffi[k]*bveci; - k++; - for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { - double bvecj = bispectrum[ii][jcoeff]; - beta[ii][icoeff] += coeffi[k]*bvecj; - beta[ii][jcoeff] += coeffi[k]*bveci; - k++; - } - } - } - - if (eflag) { - - // energy of atom I, sum over coeffs_k * Bi_k - - double* coeffi = coeffelem[ielem]; - double etmp = coeffi[0]; - - // E = beta.B + 0.5*B^t.alpha.B - - // linear contributions - - for (int icoeff = 0; icoeff < ncoeff; icoeff++) - etmp += coeffi[icoeff+1]*bispectrum[ii][icoeff]; - - // quadratic contributions - - if (quadraticflag) { - int k = ncoeff+1; - for (int icoeff = 0; icoeff < ncoeff; icoeff++) { - double bveci = bispectrum[ii][icoeff]; - etmp += 0.5*coeffi[k++]*bveci*bveci; - for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { - double bvecj = bispectrum[ii][jcoeff]; - etmp += coeffi[k++]*bveci*bvecj; - } - } - } - atomenergy[ii] = etmp; - } - - - } -} - -/* ---------------------------------------------------------------------- - allocate all arrays -------------------------------------------------------------------------- */ - -void MLIAPModelSNAP::allocate() -{ - allocated = 1; - int n = atom->ntypes; - memory->create(map,n+1,"mliap_model_snap:map"); -} - -/* ---------------------------------------------------------------------- - set coeffs for one or more type pairs -------------------------------------------------------------------------- */ - -void MLIAPModelSNAP::init(int narg, char **arg) -{ - if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); - if (!allocated) allocate(); - - if (nelements) { - for (int i = 0; i < nelements; i++) - delete[] elements[i]; - delete[] elements; - memory->destroy(coeffelem); - } - - char* type1 = arg[0]; - char* type2 = arg[1]; - char* coefffilename = arg[2]; - char* paramfilename = arg[3]; - char** elemtypes = &arg[4]; - - // insure I,J args are * * - - if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) - error->all(FLERR,"Incorrect args for pair coefficients"); - - // read snapcoeff and snapparam files - - read_files(coefffilename,paramfilename); - - if (!quadraticflag) - ncoeff = ncoeffall - 1; - else { - - // ncoeffall should be (ncoeff+2)*(ncoeff+1)/2 - // so, ncoeff = floor(sqrt(2*ncoeffall))-1 - - ncoeff = sqrt(2*ncoeffall)-1; - ncoeffq = (ncoeff*(ncoeff+1))/2; - int ntmp = 1+ncoeff+ncoeffq; - if (ntmp != ncoeffall) { - printf("ncoeffall = %d ntmp = %d ncoeff = %d \n",ncoeffall,ntmp,ncoeff); - error->all(FLERR,"Incorrect SNAP coeff file"); - } - } - - // read args that map atom types to SNAP elements - // map[i] = which element the Ith atom type is, -1 if not mapped - // map[0] is not used - - for (int i = 1; i <= atom->ntypes; i++) { - char* elemname = elemtypes[i-1]; - int jelem; - for (jelem = 0; jelem < nelements; jelem++) - if (strcmp(elemname,elements[jelem]) == 0) - break; - - if (jelem < nelements) - map[i] = jelem; - else if (strcmp(elemname,"NULL") == 0) map[i] = -1; - else error->all(FLERR,"Incorrect args for pair coefficients"); - } - -} - -/* ---------------------------------------------------------------------- */ - -void MLIAPModelSNAP::read_files(char *coefffilename, char *paramfilename) -{ - - // open SNAP coefficient file on proc 0 - - FILE *fpcoeff; - if (comm->me == 0) { - fpcoeff = force->open_potential(coefffilename); - if (fpcoeff == NULL) { - char str[128]; - snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); - error->one(FLERR,str); - } - } - - char line[MAXLINE],*ptr; - int eof = 0; - - int n; - int nwords = 0; - while (nwords == 0) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - // strip comment, skip line if blank - - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = atom->count_words(line); - } - if (nwords != 2) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - // words = ptrs to all words in line - // strip single and double quotes from words - - char* words[MAXWORD]; - int iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); - - nelements = atoi(words[0]); - ncoeffall = atoi(words[1]); - - // set up element lists - - elements = new char*[nelements]; - memory->create(coeffelem,nelements,ncoeffall,"mliap_snap_model:coeffelem"); - - // Loop over nelements blocks in the SNAP coefficient file - - for (int ielem = 0; ielem < nelements; ielem++) { - - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - nwords = atom->count_words(line); - if (nwords != 3) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); - iword = 2; - words[iword] = strtok(NULL,"' \t\n\r\f"); - - char* elemtmp = words[0]; - int n = strlen(elemtmp) + 1; - elements[ielem] = new char[n]; - strcpy(elements[ielem],elemtmp); - - for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { - eof = 1; - fclose(fpcoeff); - } else n = strlen(line) + 1; - } - - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - nwords = atom->count_words(line); - if (nwords != 1) - error->all(FLERR,"Incorrect format in SNAP coefficient file"); - - iword = 0; - words[iword] = strtok(line,"' \t\n\r\f"); - - coeffelem[ielem][icoeff] = atof(words[0]); - - } - } - - if (comm->me == 0) fclose(fpcoeff); - - // set flags for required keywords - - twojmaxflag = 0; - - // Set defaults for optional keywords - - quadraticflag = 0; - alloyflag = 0; - wselfallflag = 0; - chunksize = 2000; - - // open SNAP parameter file on proc 0 - - FILE *fpparam; - if (comm->me == 0) { - fpparam = force->open_potential(paramfilename); - if (fpparam == NULL) { - char str[128]; - snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); - error->one(FLERR,str); - } - } - - eof = 0; - while (1) { - if (comm->me == 0) { - ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { - eof = 1; - fclose(fpparam); - } else n = strlen(line) + 1; - } - MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) break; - MPI_Bcast(&n,1,MPI_INT,0,world); - MPI_Bcast(line,n,MPI_CHAR,0,world); - - // strip comment, skip line if blank - - if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = atom->count_words(line); - if (nwords == 0) continue; - - if (nwords != 2) - error->all(FLERR,"Incorrect format in SNAP parameter file"); - - // words = ptrs to all words in line - // strip single and double quotes from words - - char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); - - if (comm->me == 0) { - if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); - if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval); - } - - if (strcmp(keywd,"twojmax") == 0) { - twojmax = atoi(keyval); - twojmaxflag = 1; - } else if (strcmp(keywd,"quadraticflag") == 0) - quadraticflag = atoi(keyval); - else if (strcmp(keywd,"alloyflag") == 0) - alloyflag = atoi(keyval); - else if (strcmp(keywd,"wselfallflag") == 0) - wselfallflag = atoi(keyval); - else if (strcmp(keywd,"chunksize") == 0) - chunksize = atoi(keyval); - else if (strcmp(keywd,"rcutfac") == 0 || - strcmp(keywd,"rfac0") == 0 || - strcmp(keywd,"rmin0") == 0 || - strcmp(keywd,"switchflag") == 0 || - strcmp(keywd,"bzeroflag") == 0) - continue; - else - error->all(FLERR,"Incorrect SNAP parameter file"); - } - - if (twojmaxflag == 0) - error->all(FLERR,"Incorrect SNAP parameter file"); - -} - -/* ---------------------------------------------------------------------- - memory usage -------------------------------------------------------------------------- */ - -double MLIAPModelSNAP::memory_usage() -{ - double bytes = 0; - - int n = atom->ntypes+1; - bytes += n*sizeof(int); // map - - return bytes; -} - diff --git a/src/MLIAP/mliap_model_snap.h b/src/MLIAP/mliap_model_snap.h deleted file mode 100644 index 4a7ccb10f8..0000000000 --- a/src/MLIAP/mliap_model_snap.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifndef LMP_MLIAP_MODEL_SNAP_H -#define LMP_MLIAP_MODEL_SNAP_H - -#include "pointers.h" - -namespace LAMMPS_NS { - -class MLIAPModelSNAP : protected Pointers { -public: - MLIAPModelSNAP(LAMMPS*); - ~MLIAPModelSNAP(); - virtual void gradient(class NeighList*, double**, double*, double**, int); - void settings(int, char **); - virtual void init(int, char **); - virtual double memory_usage(); - - double quadraticflag; // declared public to workaround gcc 4.9 - int ncoeff; // compiler bug, manifest in KOKKOS package - -protected: - int allocated; - int ncoeffq, ncoeffall; - virtual void allocate(); - void read_files(char *, char *); - inline int equal(double* x,double* y); - inline double dist2(double* x,double* y); - - void compute_beta(NeighList*); - - int nelements; // # of unique elements - char **elements; // names of unique elements - double **coeffelem; // element bispectrum coefficients - double** beta; // betas for all atoms in list - double** bispectrum; // bispectrum components for all atoms in list - int *map; // mapping from atom types to elements - int twojmax; - int alloyflag, wselfallflag; - int twojmaxflag; // flags for required parameters - int beta_max; // length of beta - int chunksize; -}; - -} - -#endif - diff --git a/src/MLIAP/pair_mliap_snap.cpp b/src/MLIAP/pair_mliap.cpp similarity index 56% rename from src/MLIAP/pair_mliap_snap.cpp rename to src/MLIAP/pair_mliap.cpp index 2e4761d513..be18e933ed 100644 --- a/src/MLIAP/pair_mliap_snap.cpp +++ b/src/MLIAP/pair_mliap.cpp @@ -15,9 +15,10 @@ #include #include #include -#include "mliap_model_snap.h" +#include "mliap_model_linear.h" +#include "mliap_model_quadratic.h" #include "mliap_descriptor_snap.h" -#include "pair_mliap_snap.h" +#include "pair_mliap.h" #include "atom.h" #include "force.h" #include "neighbor.h" @@ -30,7 +31,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -PairMLIAPSNAP::PairMLIAPSNAP(LAMMPS *lmp) : Pair(lmp) +PairMLIAP::PairMLIAP(LAMMPS *lmp) : Pair(lmp) { single_enable = 0; restartinfo = 0; @@ -39,8 +40,7 @@ PairMLIAPSNAP::PairMLIAPSNAP(LAMMPS *lmp) : Pair(lmp) beta_max = 0; beta = NULL; - bispectrum = NULL; - atomenergy = NULL; + descriptors = NULL; model = NULL; descriptor = NULL; @@ -48,13 +48,12 @@ PairMLIAPSNAP::PairMLIAPSNAP(LAMMPS *lmp) : Pair(lmp) /* ---------------------------------------------------------------------- */ -PairMLIAPSNAP::~PairMLIAPSNAP() +PairMLIAP::~PairMLIAP() { if (copymode) return; memory->destroy(beta); - memory->destroy(bispectrum); - memory->destroy(atomenergy); + memory->destroy(descriptors); delete model; delete descriptor; @@ -62,6 +61,7 @@ PairMLIAPSNAP::~PairMLIAPSNAP() if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); + memory->destroy(map); } } @@ -70,42 +70,30 @@ PairMLIAPSNAP::~PairMLIAPSNAP() This version is a straightforward implementation ---------------------------------------------------------------------- */ -void PairMLIAPSNAP::compute(int eflag, int vflag) +void PairMLIAP::compute(int eflag, int vflag) { ev_init(eflag,vflag); // resize lists if (beta_max < list->inum) { - memory->grow(beta,list->inum,ncoeff,"PairMLIAPSNAP:beta"); - memory->grow(bispectrum,list->inum,ncoeff,"PairMLIAPSNAP:bispectrum"); - memory->grow(atomenergy,list->inum,"PairMLIAPSNAP:atomenergy"); + memory->grow(beta,list->inum,ndescriptors,"PairMLIAP:beta"); + memory->grow(descriptors,list->inum,ndescriptors,"PairMLIAP:descriptors"); beta_max = list->inum; } - // compute descriptors + // compute descriptors, if needed - if (model->quadraticflag || eflag) - descriptor->forward(list, bispectrum); + if (model->nonlinearflag || eflag) + descriptor->forward(list, descriptors); // compute E_i and beta_i = dE_i/dB_i for all i in list - model->gradient(list, bispectrum, atomenergy, beta, eflag); + model->gradient(list, descriptors, beta, eflag); // calculate force contributions beta_i*dB_i/dR_j - descriptor->backward(list, beta); - - // tally energy contributions - - if (eflag) { - for (int ii = 0; ii < list->inum; ii++) { - int i = list->ilist[ii]; - double evdwl = atomenergy[ii]; - ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0); - } - - } + descriptor->backward(list, beta, vflag); // calculate stress @@ -116,44 +104,87 @@ void PairMLIAPSNAP::compute(int eflag, int vflag) allocate all arrays ------------------------------------------------------------------------- */ -void PairMLIAPSNAP::allocate() +void PairMLIAP::allocate() { allocated = 1; int n = atom->ntypes; memory->create(setflag,n+1,n+1,"pair:setflag"); memory->create(cutsq,n+1,n+1,"pair:cutsq"); + memory->create(map,n+1,"pair:map"); } /* ---------------------------------------------------------------------- global settings ------------------------------------------------------------------------- */ -void PairMLIAPSNAP::settings(int narg, char ** /* arg */) +void PairMLIAP::settings(int narg, char ** arg) { - if (narg > 0) + if (narg < 4) error->all(FLERR,"Illegal pair_style command"); + + // process keywords + + int iarg = 0; + + while (iarg < narg) { + if (strcmp(arg[iarg],"model") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style mliap command"); + if (strcmp(arg[iarg+1],"linear") == 0) { + if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); + model = new MLIAPModelLinear(lmp,arg[iarg+2],this); + iarg += 3; + } else if (strcmp(arg[iarg+1],"quadratic") == 0) { + if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); + model = new MLIAPModelQuadratic(lmp,arg[iarg+2],this); + iarg += 3; + } else error->all(FLERR,"Illegal pair_style mliap command"); + } else if (strcmp(arg[iarg],"descriptor") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style mliap command"); + if (strcmp(arg[iarg+1],"sna") == 0) { + if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); + descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2],this); + iarg += 3; + } else error->all(FLERR,"Illegal pair_style mliap command"); + } + } } /* ---------------------------------------------------------------------- set coeffs for one or more type pairs ------------------------------------------------------------------------- */ -void PairMLIAPSNAP::coeff(int narg, char **arg) +void PairMLIAP::coeff(int narg, char **arg) { - if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients"); + if (narg < 3) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); - model = new MLIAPModelSNAP(lmp); - descriptor = new MLIAPDescriptorSNAP(lmp); + char* type1 = arg[0]; + char* type2 = arg[1]; + char** elemtypes = &arg[2]; - model->init(narg, arg); - descriptor->init(narg, arg); + // insure I,J args are * * - ncoeff = model->ncoeff; - if (ncoeff != descriptor->ncoeff) + if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); + // read args that map atom types to elements + // map[i] = which element the Ith atom type is, -1 if not mapped + // map[0] is not used + + for (int i = 1; i <= atom->ntypes; i++) { + char* elemname = elemtypes[i-1]; + int jelem; + for (jelem = 0; jelem < descriptor->nelements; jelem++) + if (strcmp(elemname,descriptor->elements[jelem]) == 0) + break; + + if (jelem < descriptor->nelements) + map[i] = jelem; + else if (strcmp(elemname,"NULL") == 0) map[i] = -1; + else error->all(FLERR,"Incorrect args for pair coefficients"); + } + // clear setflag since coeff() called once with I,J = * * int n = atom->ntypes; @@ -166,22 +197,33 @@ void PairMLIAPSNAP::coeff(int narg, char **arg) int count = 0; for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) - if (descriptor->map[i] >= 0 && descriptor->map[j] >= 0) { + if (map[i] >= 0 && map[j] >= 0) { setflag[i][j] = 1; count++; } if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); + + model->init(); + descriptor->init(); + + // consistency checks + + ndescriptors = descriptor->ndescriptors; + if (ndescriptors != model->ndescriptors) + error->all(FLERR,"Incompatible model and descriptor definitions"); + if (descriptor->nelements != model->nelements) + error->all(FLERR,"Incompatible model and descriptor definitions"); } /* ---------------------------------------------------------------------- init specific to this pair style ------------------------------------------------------------------------- */ -void PairMLIAPSNAP::init_style() +void PairMLIAP::init_style() { if (force->newton_pair == 0) - error->all(FLERR,"Pair style SNAP requires newton pair on"); + error->all(FLERR,"Pair style MLIAP requires newton pair on"); // need a full neighbor list @@ -195,26 +237,25 @@ void PairMLIAPSNAP::init_style() init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ -double PairMLIAPSNAP::init_one(int i, int j) +double PairMLIAP::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); - return sqrt(descriptor->cutsq[i][j]); + return descriptor->get_cutoff(map[i],map[j]); } /* ---------------------------------------------------------------------- memory usage ------------------------------------------------------------------------- */ -double PairMLIAPSNAP::memory_usage() +double PairMLIAP::memory_usage() { double bytes = Pair::memory_usage(); int n = atom->ntypes+1; bytes += n*n*sizeof(int); // setflag bytes += n*n*sizeof(double); // cutsq - bytes += beta_max*ncoeff*sizeof(double); // bispectrum - bytes += beta_max*ncoeff*sizeof(double); // beta - bytes += beta_max*ncoeff*sizeof(double); // energyatom + bytes += beta_max*ndescriptors*sizeof(double); // descriptors + bytes += beta_max*ndescriptors*sizeof(double); // beta bytes += descriptor->memory_usage(); // Descriptor object bytes += model->memory_usage(); // Model object diff --git a/src/MLIAP/pair_mliap_snap.h b/src/MLIAP/pair_mliap.h similarity index 57% rename from src/MLIAP/pair_mliap_snap.h rename to src/MLIAP/pair_mliap.h index 3bf4ed0582..bcd7c2fb73 100644 --- a/src/MLIAP/pair_mliap_snap.h +++ b/src/MLIAP/pair_mliap.h @@ -13,45 +13,39 @@ #ifdef PAIR_CLASS -PairStyle(mliap/snap,PairMLIAPSNAP) +PairStyle(mliap,PairMLIAP) #else -#ifndef LMP_PAIR_MLIAP_SNAP_H -#define LMP_PAIR_MLIAP_SNAP_H +#ifndef LMP_PAIR_MLIAP_H +#define LMP_PAIR_MLIAP_H #include "pair.h" namespace LAMMPS_NS { -class PairMLIAPSNAP : public Pair { +class PairMLIAP : public Pair { public: - PairMLIAPSNAP(class LAMMPS *); - ~PairMLIAPSNAP(); + PairMLIAP(class LAMMPS *); + ~PairMLIAP(); virtual void compute(int, int); void settings(int, char **); virtual void coeff(int, char **); virtual void init_style(); virtual double init_one(int, int); virtual double memory_usage(); - - double rcutfac, quadraticflag; // declared public to workaround gcc 4.9 - int ncoeff; // compiler bug, manifest in KOKKOS package + int *map; // mapping from atom types to elements protected: virtual void allocate(); - void read_files(char *, char *); - inline int equal(double* x,double* y); - inline double dist2(double* x,double* y); - void compute_bispectrum(); - - double* atomenergy; // energies for all atoms in list double** beta; // betas for all atoms in list - double** bispectrum; // bispectrum components for all atoms in list - int beta_max; // length of beta - class MLIAPModelSNAP* model; - class MLIAPDescriptorSNAP* descriptor; + double** descriptors; // descriptors for all atoms in list + int ndescriptors; // number of descriptors + int beta_max; // number of atoms allocated for beta, descriptors + + class MLIAPModel* model; + class MLIAPDescriptor* descriptor; }; } From 47709c4cad355d1753385e6a9776badcfebe5d8e Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Sun, 5 Apr 2020 00:21:31 -0600 Subject: [PATCH 05/54] Now using mix and match syntax --- examples/mliap/{Ta06A.snap => Ta06A.mliap} | 6 +- ...Ta06A.snapparam => Ta06A.mliap.descriptor} | 9 +- .../{Ta06A.snapcoeff => Ta06A.mliap.model} | 2 +- .../{W.snap.quadratic => W.quadratic.mliap} | 6 +- ...snapparam => W.quadratic.mliap.descriptor} | 10 +- ...atic.snapcoeff => W.quadratic.mliap.model} | 2 +- examples/mliap/WBe_Wood_PRB2019.mliap | 16 ++ .../mliap/WBe_Wood_PRB2019.mliap.descriptor | 18 ++ examples/mliap/WBe_Wood_PRB2019.mliap.model | 116 +++++++++++++ examples/mliap/dump.quadratic.0 | 11 -- examples/mliap/dump.quadratic.100 | 11 -- .../mliap/{in.snap.Ta06A => in.mliap.Ta06A} | 10 +- ....mliap.snap.Ta06A => in.mliap.WBe.PRB2019} | 35 ++-- .../{in.snap.quadratic => in.mliap.quadratic} | 13 +- examples/mliap/in.mliap.snap.quadratic | 60 ------- examples/mliap/in.snap.compute.quadratic | 100 ----------- examples/mliap/log.snap.Ta06A.ref | 78 +++++---- examples/mliap/log.snap.WBe.ref | 163 ++++++++++++++++++ examples/mliap/log.snap.quadratic.ref | 55 +++--- 19 files changed, 445 insertions(+), 276 deletions(-) rename examples/mliap/{Ta06A.snap => Ta06A.mliap} (69%) rename examples/mliap/{Ta06A.snapparam => Ta06A.mliap.descriptor} (83%) rename examples/mliap/{Ta06A.snapcoeff => Ta06A.mliap.model} (96%) rename examples/mliap/{W.snap.quadratic => W.quadratic.mliap} (69%) rename examples/mliap/{W.quadratic.snapparam => W.quadratic.mliap.descriptor} (60%) rename examples/mliap/{W.quadratic.snapcoeff => W.quadratic.mliap.model} (99%) create mode 100644 examples/mliap/WBe_Wood_PRB2019.mliap create mode 100644 examples/mliap/WBe_Wood_PRB2019.mliap.descriptor create mode 100644 examples/mliap/WBe_Wood_PRB2019.mliap.model delete mode 100644 examples/mliap/dump.quadratic.0 delete mode 100644 examples/mliap/dump.quadratic.100 rename examples/mliap/{in.snap.Ta06A => in.mliap.Ta06A} (69%) rename examples/mliap/{in.mliap.snap.Ta06A => in.mliap.WBe.PRB2019} (52%) rename examples/mliap/{in.snap.quadratic => in.mliap.quadratic} (69%) delete mode 100644 examples/mliap/in.mliap.snap.quadratic delete mode 100644 examples/mliap/in.snap.compute.quadratic create mode 100644 examples/mliap/log.snap.WBe.ref diff --git a/examples/mliap/Ta06A.snap b/examples/mliap/Ta06A.mliap similarity index 69% rename from examples/mliap/Ta06A.snap rename to examples/mliap/Ta06A.mliap index d9feae0b46..5c1776d01e 100644 --- a/examples/mliap/Ta06A.snap +++ b/examples/mliap/Ta06A.mliap @@ -1,4 +1,4 @@ -# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) +# DATE: 2020-04-04 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) # Definition of SNAP potential Ta_Cand06A # Assumes 1 LAMMPS atom type @@ -11,7 +11,7 @@ variable zblz equal 73 pair_style hybrid/overlay & zbl ${zblcutinner} ${zblcutouter} & -snap +mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor pair_coeff 1 1 zbl ${zblz} ${zblz} -pair_coeff * * snap Ta06A.snapcoeff Ta06A.snapparam Ta +pair_coeff * * mliap Ta diff --git a/examples/mliap/Ta06A.snapparam b/examples/mliap/Ta06A.mliap.descriptor similarity index 83% rename from examples/mliap/Ta06A.snapparam rename to examples/mliap/Ta06A.mliap.descriptor index 629d96d708..6e7a10f9d1 100644 --- a/examples/mliap/Ta06A.snapparam +++ b/examples/mliap/Ta06A.mliap.descriptor @@ -6,9 +6,16 @@ rcutfac 4.67637 twojmax 6 +# elements + +nelems 1 +elems Ta +radelems 0.5 +welems 1 + # optional rfac0 0.99363 rmin0 0 bzeroflag 0 -quadraticflag 0 + diff --git a/examples/mliap/Ta06A.snapcoeff b/examples/mliap/Ta06A.mliap.model similarity index 96% rename from examples/mliap/Ta06A.snapcoeff rename to examples/mliap/Ta06A.mliap.model index ad2dfa4bc5..12761d94c8 100644 --- a/examples/mliap/Ta06A.snapcoeff +++ b/examples/mliap/Ta06A.mliap.model @@ -2,8 +2,8 @@ # LAMMPS SNAP coefficients for Ta_Cand06A +# nelements ncoeff 1 31 -Ta 0.5 1 -2.92477 -0.01137 -0.00775 diff --git a/examples/mliap/W.snap.quadratic b/examples/mliap/W.quadratic.mliap similarity index 69% rename from examples/mliap/W.snap.quadratic rename to examples/mliap/W.quadratic.mliap index 75892ad1a0..a2fc84c50f 100644 --- a/examples/mliap/W.snap.quadratic +++ b/examples/mliap/W.quadratic.mliap @@ -1,5 +1,3 @@ -# -# # Definition of SNAP+ZBL potential. variable zblcutinner equal 4 variable zblcutouter equal 4.8 @@ -9,7 +7,7 @@ variable zblz equal 74 pair_style hybrid/overlay & zbl ${zblcutinner} ${zblcutouter} & -snap +mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor pair_coeff 1 1 zbl ${zblz} ${zblz} -pair_coeff * * snap W.quadratic.snapcoeff W.quadratic.snapparam W +pair_coeff * * mliap W diff --git a/examples/mliap/W.quadratic.snapparam b/examples/mliap/W.quadratic.mliap.descriptor similarity index 60% rename from examples/mliap/W.quadratic.snapparam rename to examples/mliap/W.quadratic.mliap.descriptor index 63728b6bd0..cc47dafd39 100644 --- a/examples/mliap/W.quadratic.snapparam +++ b/examples/mliap/W.quadratic.mliap.descriptor @@ -1,10 +1,18 @@ # required + rcutfac 4.73442 twojmax 6 +# elements + +nelems 1 +elems W +radelems 0.5 +welems 1 + # optional rfac0 0.99363 rmin0 0 bzeroflag 1 -quadraticflag 1 + diff --git a/examples/mliap/W.quadratic.snapcoeff b/examples/mliap/W.quadratic.mliap.model similarity index 99% rename from examples/mliap/W.quadratic.snapcoeff rename to examples/mliap/W.quadratic.mliap.model index 6cc4fc5c19..713e07eb61 100644 --- a/examples/mliap/W.quadratic.snapcoeff +++ b/examples/mliap/W.quadratic.mliap.model @@ -1,7 +1,7 @@ # LAMMPS SNAP coefficients for Quadratic W +# nelements ncoeff 1 496 -W 0.5 1 0.000000000000 -0.000019342340 0.000039964908 diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap b/examples/mliap/WBe_Wood_PRB2019.mliap new file mode 100644 index 0000000000..0ad35747dc --- /dev/null +++ b/examples/mliap/WBe_Wood_PRB2019.mliap @@ -0,0 +1,16 @@ +# DATE: 2020-04-04 CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz1 equal 74 +variable zblz2 equal 4 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} & +mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff * * mliap W Be + diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor b/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor new file mode 100644 index 0000000000..855e5ec97a --- /dev/null +++ b/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor @@ -0,0 +1,18 @@ +# required + +rcutfac 4.8123 +twojmax 8 + +# elements + +nelems 2 +elems W Be +radelems 0.5 0.417932 +welems 1 0.959049 + +# optional + +rfac0 0.99363 +rmin0 0 +bzeroflag 1 + diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.model b/examples/mliap/WBe_Wood_PRB2019.mliap.model new file mode 100644 index 0000000000..6b96561ed0 --- /dev/null +++ b/examples/mliap/WBe_Wood_PRB2019.mliap.model @@ -0,0 +1,116 @@ +# LAMMPS SNAP coefficients for WBe + +# nelements ncoeff +2 56 + -0.000000000000 # B[0] + -0.001487061994 # B[1, 0, 0, 0] + 0.075808306870 # B[2, 1, 0, 1] + 0.538735683870 # B[3, 1, 1, 2] + -0.074148039366 # B[4, 2, 0, 2] + 0.602629813770 # B[5, 2, 1, 3] + -0.147022424344 # B[6, 2, 2, 2] + 0.117756828488 # B[7, 2, 2, 4] + -0.026490439049 # B[8, 3, 0, 3] + -0.035162708767 # B[9, 3, 1, 4] + 0.064315385091 # B[10, 3, 2, 3] + -0.131936948089 # B[11, 3, 2, 5] + -0.021272860272 # B[12, 3, 3, 4] + -0.091171134054 # B[13, 3, 3, 6] + -0.024396224398 # B[14, 4, 0, 4] + -0.059813132803 # B[15, 4, 1, 5] + 0.069585393203 # B[16, 4, 2, 4] + -0.085344044181 # B[17, 4, 2, 6] + -0.155425254597 # B[18, 4, 3, 5] + -0.117031758367 # B[19, 4, 3, 7] + -0.040956258020 # B[20, 4, 4, 4] + -0.084465000389 # B[21, 4, 4, 6] + -0.020367513630 # B[22, 4, 4, 8] + -0.010730484318 # B[23, 5, 0, 5] + -0.054777575658 # B[24, 5, 1, 6] + 0.050742893747 # B[25, 5, 2, 5] + -0.004686334611 # B[26, 5, 2, 7] + -0.116372907121 # B[27, 5, 3, 6] + 0.005542497708 # B[28, 5, 3, 8] + -0.126526795635 # B[29, 5, 4, 5] + -0.080163926221 # B[30, 5, 4, 7] + -0.082426250179 # B[31, 5, 5, 6] + -0.010558777281 # B[32, 5, 5, 8] + -0.001939058038 # B[33, 6, 0, 6] + -0.027907949962 # B[34, 6, 1, 7] + 0.049483908476 # B[35, 6, 2, 6] + 0.005103754385 # B[36, 6, 2, 8] + -0.054751505141 # B[37, 6, 3, 7] + -0.055556071011 # B[38, 6, 4, 6] + -0.006026917619 # B[39, 6, 4, 8] + -0.060889030109 # B[40, 6, 5, 7] + -0.029977673973 # B[41, 6, 6, 6] + -0.014987527280 # B[42, 6, 6, 8] + -0.006697686658 # B[43, 7, 0, 7] + 0.017369624409 # B[44, 7, 1, 8] + 0.047864358817 # B[45, 7, 2, 7] + -0.001989812679 # B[46, 7, 3, 8] + 0.000153530925 # B[47, 7, 4, 7] + -0.003862356345 # B[48, 7, 5, 8] + -0.009754314198 # B[49, 7, 6, 7] + 0.000777958970 # B[50, 7, 7, 8] + -0.003031424287 # B[51, 8, 0, 8] + 0.015612715209 # B[52, 8, 2, 8] + 0.003210129646 # B[53, 8, 4, 8] + -0.013088799947 # B[54, 8, 6, 8] + 0.001465970755 # B[55, 8, 8, 8] + 0.000000000000 # B[0] + -0.000112143918 # B[1, 0, 0, 0] + 0.002449805180 # B[2, 1, 0, 1] + 0.189705916830 # B[3, 1, 1, 2] + -0.019967429692 # B[4, 2, 0, 2] + 0.286015704682 # B[5, 2, 1, 3] + 0.072864063124 # B[6, 2, 2, 2] + 0.108748154196 # B[7, 2, 2, 4] + -0.005203284351 # B[8, 3, 0, 3] + 0.043948598532 # B[9, 3, 1, 4] + 0.105425889093 # B[10, 3, 2, 3] + 0.060460134045 # B[11, 3, 2, 5] + -0.003406205141 # B[12, 3, 3, 4] + 0.002306765306 # B[13, 3, 3, 6] + -0.003845115174 # B[14, 4, 0, 4] + 0.029471162073 # B[15, 4, 1, 5] + 0.054901130330 # B[16, 4, 2, 4] + 0.010910192753 # B[17, 4, 2, 6] + 0.033885210622 # B[18, 4, 3, 5] + 0.008053439551 # B[19, 4, 3, 7] + -0.001432298168 # B[20, 4, 4, 4] + 0.017478027729 # B[21, 4, 4, 6] + -0.003402034990 # B[22, 4, 4, 8] + -0.002655339820 # B[23, 5, 0, 5] + 0.012668749892 # B[24, 5, 1, 6] + 0.037521561888 # B[25, 5, 2, 5] + -0.000682693314 # B[26, 5, 2, 7] + 0.008525913627 # B[27, 5, 3, 6] + 0.008977936348 # B[28, 5, 3, 8] + 0.006922732235 # B[29, 5, 4, 5] + 0.003031883044 # B[30, 5, 4, 7] + -0.000345577975 # B[31, 5, 5, 6] + -0.001041600679 # B[32, 5, 5, 8] + -0.001407625493 # B[33, 6, 0, 6] + 0.004211558640 # B[34, 6, 1, 7] + 0.014450875461 # B[35, 6, 2, 6] + -0.007033326252 # B[36, 6, 2, 8] + 0.004998742185 # B[37, 6, 3, 7] + -0.002824617682 # B[38, 6, 4, 6] + 0.003831871934 # B[39, 6, 4, 8] + -0.005700892700 # B[40, 6, 5, 7] + 0.000184422409 # B[41, 6, 6, 6] + 0.001592696824 # B[42, 6, 6, 8] + -0.000804927645 # B[43, 7, 0, 7] + 0.008465358642 # B[44, 7, 1, 8] + 0.005460531160 # B[45, 7, 2, 7] + -0.000639605094 # B[46, 7, 3, 8] + -0.002403948393 # B[47, 7, 4, 7] + -0.001267042453 # B[48, 7, 5, 8] + 0.003836940623 # B[49, 7, 6, 7] + 0.002333141437 # B[50, 7, 7, 8] + -0.000665360637 # B[51, 8, 0, 8] + -0.003460637865 # B[52, 8, 2, 8] + -0.001598726043 # B[53, 8, 4, 8] + 0.001478744304 # B[54, 8, 6, 8] + 0.000806643203 # B[55, 8, 8, 8] diff --git a/examples/mliap/dump.quadratic.0 b/examples/mliap/dump.quadratic.0 deleted file mode 100644 index 761b1e4451..0000000000 --- a/examples/mliap/dump.quadratic.0 +++ /dev/null @@ -1,11 +0,0 @@ -ITEM: TIMESTEP -0 -ITEM: NUMBER OF ATOMS -2 -ITEM: BOX BOUNDS pp pp pp -0.0000000000000000e+00 3.1802999999999999e+00 -0.0000000000000000e+00 3.1802999999999999e+00 -0.0000000000000000e+00 3.1802999999999999e+00 -ITEM: ATOMS id type fx fy fz c_eatom -1 1 -0.00995108 -0.61461 0.688381 -1.15754 -2 1 0.00995108 0.61461 -0.688381 -1.15754 diff --git a/examples/mliap/dump.quadratic.100 b/examples/mliap/dump.quadratic.100 deleted file mode 100644 index 321c1b17df..0000000000 --- a/examples/mliap/dump.quadratic.100 +++ /dev/null @@ -1,11 +0,0 @@ -ITEM: TIMESTEP -100 -ITEM: NUMBER OF ATOMS -2 -ITEM: BOX BOUNDS pp pp pp -0.0000000000000000e+00 3.1802999999999999e+00 -0.0000000000000000e+00 3.1802999999999999e+00 -0.0000000000000000e+00 3.1802999999999999e+00 -ITEM: ATOMS id type fx fy fz c_eatom -1 1 -0.373431 0.0494017 -1.17879 -1.14648 -2 1 0.373431 -0.0494017 1.17879 -1.14648 diff --git a/examples/mliap/in.snap.Ta06A b/examples/mliap/in.mliap.Ta06A similarity index 69% rename from examples/mliap/in.snap.Ta06A rename to examples/mliap/in.mliap.Ta06A index 0ca5275e97..2c8c7932df 100644 --- a/examples/mliap/in.snap.Ta06A +++ b/examples/mliap/in.mliap.Ta06A @@ -24,10 +24,18 @@ mass 1 180.88 # choose potential -include Ta06A.snap +include Ta06A.mliap # Setup output +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press thermo 10 thermo_modify norm yes diff --git a/examples/mliap/in.mliap.snap.Ta06A b/examples/mliap/in.mliap.WBe.PRB2019 similarity index 52% rename from examples/mliap/in.mliap.snap.Ta06A rename to examples/mliap/in.mliap.WBe.PRB2019 index dcf5272591..24a212b2c6 100644 --- a/examples/mliap/in.mliap.snap.Ta06A +++ b/examples/mliap/in.mliap.WBe.PRB2019 @@ -1,10 +1,10 @@ -# Demonstrate SNAP Ta potential +# Demonstrate SNAP W-Be potential # Initialize simulation variable nsteps index 100 variable nrep equal 4 -variable a equal 3.316 +variable a equal 3.1803 units metal # generate the box and atom positions using a BCC lattice @@ -17,29 +17,28 @@ boundary p p p lattice bcc $a region box block 0 ${nx} 0 ${ny} 0 ${nz} -create_box 1 box +create_box 2 box create_atoms 1 box +mass 1 183.84 +mass 2 9.012182 -mass 1 180.88 - +set group all type/fraction 2 0.05 3590153 # Change 5% of W to He +group tungsten type 1 +group beryllium type 2 # choose potential -# Assumes 1 LAMMPS atom type - -variable zblcutinner equal 4 -variable zblcutouter equal 4.8 -variable zblz equal 73 - -# Specify hybrid with SNAP, ZBL - -pair_style hybrid/overlay & -zbl ${zblcutinner} ${zblcutouter} & -mliap/snap -pair_coeff 1 1 zbl ${zblz} ${zblz} -pair_coeff * * mliap/snap Ta06A.snapcoeff Ta06A.snapparam Ta +include WBe_Wood_PRB2019.mliap # Setup output +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press thermo 10 thermo_modify norm yes diff --git a/examples/mliap/in.snap.quadratic b/examples/mliap/in.mliap.quadratic similarity index 69% rename from examples/mliap/in.snap.quadratic rename to examples/mliap/in.mliap.quadratic index dd50e90bfb..636d0de3e6 100644 --- a/examples/mliap/in.snap.quadratic +++ b/examples/mliap/in.mliap.quadratic @@ -25,15 +25,20 @@ mass 1 183.84 # choose potential -include W.snap.quadratic +include W.quadratic.mliap # Setup output +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press thermo 10 thermo_modify norm yes -compute eatom all pe/atom - -dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom # Set up NVE run diff --git a/examples/mliap/in.mliap.snap.quadratic b/examples/mliap/in.mliap.snap.quadratic deleted file mode 100644 index 028a2d3ad7..0000000000 --- a/examples/mliap/in.mliap.snap.quadratic +++ /dev/null @@ -1,60 +0,0 @@ -# Demonstrate SNAP Ta potential - -# Initialize simulation - -variable nsteps index 100 -variable nrep equal 1 -variable a equal 3.1803 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable ny equal ${nrep} -variable nz equal ${nrep} - -boundary p p p - -lattice bcc $a -region box block 0 ${nx} 0 ${ny} 0 ${nz} -create_box 1 box -create_atoms 1 box -displace_atoms all random 0.01 0.01 0.01 12345 - -mass 1 183.84 - -# choose potential - -# Definition of SNAP+ZBL potential. -variable zblcutinner equal 4 -variable zblcutouter equal 4.8 -variable zblz equal 74 - -# Specify hybrid with SNAP and ZBL - -pair_style hybrid/overlay & -zbl ${zblcutinner} ${zblcutouter} & -mliap/snap -pair_coeff 1 1 zbl ${zblz} ${zblz} -pair_coeff * * mliap/snap W.quadratic.snapcoeff W.quadratic.snapparam W - -# Setup output - -thermo 10 -thermo_modify norm yes -compute eatom all pe/atom - -dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom - -# Set up NVE run - -timestep 0.5e-3 -neighbor 1.0 bin -neigh_modify once no every 1 delay 0 check no - -# Run MD - -velocity all create 300.0 4928459 -fix 1 all nve -run ${nsteps} - diff --git a/examples/mliap/in.snap.compute.quadratic b/examples/mliap/in.snap.compute.quadratic deleted file mode 100644 index 00e46bd3a8..0000000000 --- a/examples/mliap/in.snap.compute.quadratic +++ /dev/null @@ -1,100 +0,0 @@ -# Demonstrate bispectrum computes - -# initialize simulation - -variable nsteps index 0 -variable nrep equal 1 -variable a equal 2.0 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable ny equal ${nrep} -variable nz equal ${nrep} - -boundary p p p - -atom_modify map hash -lattice bcc $a -region box block 0 ${nx} 0 ${ny} 0 ${nz} -create_box 2 box -create_atoms 2 box - -mass * 180.88 - -displace_atoms all random 0.1 0.1 0.1 123456 - -# choose SNA parameters - -variable twojmax equal 2 -variable rcutfac equal 1.0 -variable rfac0 equal 0.99363 -variable rmin0 equal 0 -variable radelem1 equal 2.3 -variable radelem2 equal 2.0 -variable wj1 equal 1.0 -variable wj2 equal 0.96 -variable quadratic equal 1 -variable bzero equal 0 -variable switch equal 0 -variable snap_options string & -"${rcutfac} ${rfac0} ${twojmax} ${radelem1} ${radelem2} ${wj1} ${wj2} rmin0 ${rmin0} quadraticflag ${quadratic} bzeroflag ${bzero} switchflag ${switch}" - -# set up dummy potential to satisfy cutoff - -pair_style zero ${rcutfac} -pair_coeff * * - -# set up reference potential - -variable zblcutinner equal 4 -variable zblcutouter equal 4.8 -variable zblz equal 73 -pair_style zbl ${zblcutinner} ${zblcutouter} -pair_coeff * * ${zblz} ${zblz} - -# set up per-atom computes - -compute b all sna/atom ${snap_options} -compute vb all snav/atom ${snap_options} -compute db all snad/atom ${snap_options} - -# perform sums over atoms - -group snapgroup1 type 1 -group snapgroup2 type 2 -compute bsum1 snapgroup1 reduce sum c_b[*] -compute bsum2 snapgroup2 reduce sum c_b[*] -# fix bsum1 all ave/time 1 1 1 c_bsum1 file bsum1.dat mode vector -# fix bsum2 all ave/time 1 1 1 c_bsum2 file bsum2.dat mode vector -compute vbsum all reduce sum c_vb[*] -# fix vbsum all ave/time 1 1 1 c_vbsum file vbsum.dat mode vector -variable db_2_120 equal c_db[2][120] - -# set up compute snap generating global array - -compute snap all snap ${snap_options} -fix snap all ave/time 1 1 1 c_snap[*] file compute.snap.dat mode vector - -thermo 100 - -# test output: 1: total potential energy -# 2: xy component of stress tensor -# 3: Sum(0.5*(B_{222}^i)^2, all i of type 2) -# 4: xy component of Sum(Sum(r_j*(0.5*(dB_{222}^i)^2/dR[j]), all i of type 2), all j) -# 5: z component of -Sum(d(0.5*(B_{222}^i)^2/dR[2]), all i of type 2) -# -# followed by 5 counterparts from compute snap - -thermo_style custom & - pe pxy c_bsum2[20] c_vbsum[240] v_db_2_120 & - c_snap[1][41] c_snap[13][41] c_snap[1][40] c_snap[13][40] c_snap[7][40] -thermo_modify norm no - -# dump mydump_db all custom 1000 dump_db id c_db[*] -# dump_modify mydump_db sort id - -# Run MD - -run ${nsteps} diff --git a/examples/mliap/log.snap.Ta06A.ref b/examples/mliap/log.snap.Ta06A.ref index 76cdc8641a..8c89ac1957 100644 --- a/examples/mliap/log.snap.Ta06A.ref +++ b/examples/mliap/log.snap.Ta06A.ref @@ -1,5 +1,4 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task +LAMMPS (19 Mar 2020) # Demonstrate SNAP Ta potential # Initialize simulation @@ -7,7 +6,7 @@ LAMMPS (27 Nov 2018) variable nsteps index 100 variable nrep equal 4 variable a equal 3.316 -units metal +units metal # generate the box and atom positions using a BCC lattice @@ -18,21 +17,21 @@ variable ny equal 4 variable nz equal ${nrep} variable nz equal 4 -boundary p p p +boundary p p p lattice bcc $a lattice bcc 3.316 Lattice spacing in x,y,z = 3.316 3.316 3.316 -region box block 0 ${nx} 0 ${ny} 0 ${nz} -region box block 0 4 0 ${ny} 0 ${nz} -region box block 0 4 0 4 0 ${nz} -region box block 0 4 0 4 0 4 -create_box 1 box +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box Created orthogonal box = (0 0 0) to (13.264 13.264 13.264) 1 by 1 by 1 MPI processor grid -create_atoms 1 box +create_atoms 1 box Created 128 atoms - Time spent = 0.000350714 secs + create_atoms CPU = 0.000254 secs mass 1 180.88 @@ -56,7 +55,7 @@ pair_style hybrid/overlay zbl 4 4.8 snap pair_coeff 1 1 zbl ${zblz} ${zblz} pair_coeff 1 1 zbl 73 ${zblz} pair_coeff 1 1 zbl 73 73 -pair_coeff * * snap Ta06A.snapcoeff Ta Ta06A.snapparam Ta +pair_coeff * * snap Ta06A.snapcoeff Ta06A.snapparam Ta Reading potential file Ta06A.snapcoeff with DATE: 2014-09-05 SNAP Element = Ta, Radius 0.5, Weight 1 Reading potential file Ta06A.snapparam with DATE: 2014-09-05 @@ -64,14 +63,21 @@ SNAP keyword rcutfac 4.67637 SNAP keyword twojmax 6 SNAP keyword rfac0 0.99363 SNAP keyword rmin0 0 -SNAP keyword diagonalstyle 3 SNAP keyword bzeroflag 0 SNAP keyword quadraticflag 0 # Setup output -thermo 10 +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 thermo_modify norm yes # Set up NVE run @@ -103,33 +109,33 @@ Neighbor list info ... pair build: full/bin/atomonly stencil: full/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.138 | 4.138 | 4.138 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 300 -11.85157 0 -11.813095 2717.1661 - 10 295.96579 -11.851053 0 -11.813095 2696.1559 - 20 284.32535 -11.84956 0 -11.813095 2301.3713 - 30 266.04602 -11.847215 0 -11.813095 1832.1745 - 40 242.2862 -11.844168 0 -11.813095 1492.6765 - 50 214.48968 -11.840603 0 -11.813094 1312.8908 - 60 184.32523 -11.836734 0 -11.813094 1284.582 - 70 153.58055 -11.832791 0 -11.813094 1374.4457 - 80 124.04276 -11.829003 0 -11.813094 1537.703 - 90 97.37622 -11.825582 0 -11.813094 1734.9662 - 100 75.007873 -11.822714 0 -11.813094 1930.8005 -Loop time of 5.03244 on 1 procs for 100 steps with 128 atoms +Per MPI rank memory allocation (min/avg/max) = 6.591 | 6.591 | 6.591 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -11.85157 -11.85157 -11.813095 2717.1661 -2717.1661 + 10 295.96579 -11.851053 -11.851053 -11.813095 2696.1559 -2696.1559 + 20 284.32535 -11.84956 -11.84956 -11.813095 2301.3713 -2301.3713 + 30 266.04602 -11.847215 -11.847215 -11.813095 1832.1745 -1832.1745 + 40 242.2862 -11.844168 -11.844168 -11.813095 1492.6765 -1492.6765 + 50 214.48968 -11.840603 -11.840603 -11.813094 1312.8908 -1312.8908 + 60 184.32523 -11.836734 -11.836734 -11.813094 1284.582 -1284.582 + 70 153.58055 -11.832791 -11.832791 -11.813094 1374.4457 -1374.4457 + 80 124.04276 -11.829003 -11.829003 -11.813094 1537.703 -1537.703 + 90 97.37622 -11.825582 -11.825582 -11.813094 1734.9662 -1734.9662 + 100 75.007873 -11.822714 -11.822714 -11.813094 1930.8005 -1930.8005 +Loop time of 0.995328 on 1 procs for 100 steps with 128 atoms -Performance: 0.858 ns/day, 27.958 hours/ns, 19.871 timesteps/s -98.9% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 4.340 ns/day, 5.530 hours/ns, 100.469 timesteps/s +99.5% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 5.0308 | 5.0308 | 5.0308 | 0.0 | 99.97 +Pair | 0.99426 | 0.99426 | 0.99426 | 0.0 | 99.89 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00070858 | 0.00070858 | 0.00070858 | 0.0 | 0.01 -Output | 0.00024676 | 0.00024676 | 0.00024676 | 0.0 | 0.00 -Modify | 0.0002749 | 0.0002749 | 0.0002749 | 0.0 | 0.01 -Other | | 0.0004299 | | | 0.01 +Comm | 0.000305 | 0.000305 | 0.000305 | 0.0 | 0.03 +Output | 0.000413 | 0.000413 | 0.000413 | 0.0 | 0.04 +Modify | 0.000159 | 0.000159 | 0.000159 | 0.0 | 0.02 +Other | | 0.000191 | | | 0.02 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -145,4 +151,4 @@ Ave neighs/atom = 58 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:00:05 +Total wall time: 0:00:01 diff --git a/examples/mliap/log.snap.WBe.ref b/examples/mliap/log.snap.WBe.ref new file mode 100644 index 0000000000..f689c7e6b1 --- /dev/null +++ b/examples/mliap/log.snap.WBe.ref @@ -0,0 +1,163 @@ +LAMMPS (19 Mar 2020) +# Demonstrate SNAP W-Be potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.1803 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.1803 +Lattice spacing in x,y,z = 3.1803 3.1803 3.1803 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 2 box +Created orthogonal box = (0 0 0) to (12.7212 12.7212 12.7212) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 128 atoms + create_atoms CPU = 0.000231 secs +mass 1 183.84 +mass 2 9.012182 + +set group all type/fraction 2 0.05 3590153 # Change 5% of W to He + 5 settings made for type/fraction +group tungsten type 1 +123 atoms in group tungsten +group beryllium type 2 +5 atoms in group beryllium +# choose potential + +include WBe_Wood_PRB2019.snap +# DATE: 2019-09-18 CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz1 equal 74 +variable zblz2 equal 4 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap +pair_style hybrid/overlay zbl 4 ${zblcutouter} snap +pair_style hybrid/overlay zbl 4 4.8 snap +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 1 zbl 74 ${zblz1} +pair_coeff 1 1 zbl 74 74 +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 1 2 zbl 74 ${zblz2} +pair_coeff 1 2 zbl 74 4 +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff 2 2 zbl 4 ${zblz2} +pair_coeff 2 2 zbl 4 4 +pair_coeff * * snap WBe_Wood_PRB2019.snapcoeff WBe_Wood_PRB2019.snapparam W Be +SNAP Element = W, Radius 0.5, Weight 1 +SNAP Element = Be, Radius 0.417932, Weight 0.959049 +SNAP keyword rcutfac 4.8123 +SNAP keyword twojmax 8 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 1 +SNAP keyword quadraticflag 0 + + +# Setup output + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8123 + ghost atom cutoff = 5.8123 + binsize = 2.90615, bins = 5 5 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair snap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.893 | 6.893 | 6.893 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -8.5980876 -8.5980876 -8.5596125 -35284.855 35284.855 + 10 299.29029 -8.5979965 -8.5979965 -8.5596125 -35299.259 35299.259 + 20 288.99334 -8.5966759 -8.5966759 -8.5596124 -35004.093 35004.093 + 30 269.91027 -8.5942284 -8.5942284 -8.5596123 -34447.077 34447.077 + 40 243.57361 -8.5908505 -8.5908505 -8.5596121 -33687.105 33687.105 + 50 212.21385 -8.5868284 -8.5868284 -8.5596119 -32821.864 32821.864 + 60 178.77144 -8.5825391 -8.5825391 -8.5596116 -31971.17 31971.17 + 70 146.71854 -8.578428 -8.578428 -8.5596113 -31245.51 31245.51 + 80 119.50956 -8.5749383 -8.5749383 -8.5596111 -30724.137 30724.137 + 90 99.872785 -8.5724197 -8.5724197 -8.559611 -30440.244 30440.244 + 100 89.604584 -8.5711027 -8.5711027 -8.5596109 -30392.805 30392.805 +Loop time of 3.17984 on 1 procs for 100 steps with 128 atoms + +Performance: 1.359 ns/day, 17.666 hours/ns, 31.448 timesteps/s +99.6% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 3.1748 | 3.1748 | 3.1748 | 0.0 | 99.84 +Neigh | 0.000314 | 0.000314 | 0.000314 | 0.0 | 0.01 +Comm | 0.000371 | 0.000371 | 0.000371 | 0.0 | 0.01 +Output | 0.00386 | 0.00386 | 0.00386 | 0.0 | 0.12 +Modify | 0.000236 | 0.000236 | 0.000236 | 0.0 | 0.01 +Other | | 0.000289 | | | 0.01 + +Nlocal: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 727 ave 727 max 727 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3710 ave 3710 max 3710 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 7420 ave 7420 max 7420 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7420 +Ave neighs/atom = 57.9688 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:03 diff --git a/examples/mliap/log.snap.quadratic.ref b/examples/mliap/log.snap.quadratic.ref index 24bceba9ec..472080f7a4 100644 --- a/examples/mliap/log.snap.quadratic.ref +++ b/examples/mliap/log.snap.quadratic.ref @@ -31,7 +31,7 @@ Created orthogonal box = (0 0 0) to (3.1803 3.1803 3.1803) 1 by 1 by 1 MPI processor grid create_atoms 1 box Created 2 atoms - create_atoms CPU = 0.000348 secs + create_atoms CPU = 0.000215 secs displace_atoms all random 0.01 0.01 0.01 12345 mass 1 183.84 @@ -66,9 +66,16 @@ SNAP keyword quadraticflag 1 # Setup output +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press thermo 10 thermo_modify norm yes -compute eatom all pe/atom dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom @@ -101,33 +108,33 @@ Neighbor list info ... pair build: full/bin/atomonly stencil: full/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.04 | 5.04 | 5.04 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 300 -1.1575362 0 -1.1381472 600966 - 10 349.32287 -1.1607243 0 -1.1381475 599985.48 - 20 384.27065 -1.1629832 0 -1.1381478 599287.89 - 30 399.34846 -1.1639578 0 -1.1381478 598986.42 - 40 392.19413 -1.1634953 0 -1.1381478 599130.05 - 50 363.93932 -1.161669 0 -1.1381476 599694.93 - 60 319.03014 -1.1587663 0 -1.1381473 600588.89 - 70 264.53512 -1.1552439 0 -1.138147 601667.76 - 80 209.04294 -1.1516571 0 -1.1381466 602760.01 - 90 161.3157 -1.1485722 0 -1.1381463 603694.49 - 100 128.9054 -1.1464773 0 -1.1381461 604326.7 -Loop time of 0.032082 on 1 procs for 100 steps with 2 atoms +Per MPI rank memory allocation (min/avg/max) = 7.284 | 7.284 | 7.284 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -1.1575362 -1.1575362 -1.1381472 600966 -600966 + 10 349.32287 -1.1607243 -1.1607243 -1.1381475 599985.48 -599985.48 + 20 384.27065 -1.1629832 -1.1629832 -1.1381478 599287.89 -599287.89 + 30 399.34846 -1.1639578 -1.1639578 -1.1381478 598986.42 -598986.42 + 40 392.19413 -1.1634953 -1.1634953 -1.1381478 599130.05 -599130.05 + 50 363.93932 -1.161669 -1.161669 -1.1381476 599694.93 -599694.93 + 60 319.03014 -1.1587663 -1.1587663 -1.1381473 600588.89 -600588.89 + 70 264.53512 -1.1552439 -1.1552439 -1.138147 601667.76 -601667.76 + 80 209.04294 -1.1516571 -1.1516571 -1.1381466 602760.01 -602760.01 + 90 161.3157 -1.1485722 -1.1485722 -1.1381463 603694.49 -603694.49 + 100 128.9054 -1.1464773 -1.1464773 -1.1381461 604326.7 -604326.7 +Loop time of 0.030198 on 1 procs for 100 steps with 2 atoms -Performance: 134.655 ns/day, 0.178 hours/ns, 3117.013 timesteps/s -98.3% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 143.056 ns/day, 0.168 hours/ns, 3311.478 timesteps/s +98.4% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.030667 | 0.030667 | 0.030667 | 0.0 | 95.59 -Neigh | 0.000584 | 0.000584 | 0.000584 | 0.0 | 1.82 -Comm | 0.000307 | 0.000307 | 0.000307 | 0.0 | 0.96 -Output | 0.000447 | 0.000447 | 0.000447 | 0.0 | 1.39 -Modify | 2.8e-05 | 2.8e-05 | 2.8e-05 | 0.0 | 0.09 -Other | | 4.9e-05 | | | 0.15 +Pair | 0.028723 | 0.028723 | 0.028723 | 0.0 | 95.12 +Neigh | 0.000515 | 0.000515 | 0.000515 | 0.0 | 1.71 +Comm | 0.000263 | 0.000263 | 0.000263 | 0.0 | 0.87 +Output | 0.000618 | 0.000618 | 0.000618 | 0.0 | 2.05 +Modify | 2.7e-05 | 2.7e-05 | 2.7e-05 | 0.0 | 0.09 +Other | | 5.2e-05 | | | 0.17 Nlocal: 2 ave 2 max 2 min Histogram: 1 0 0 0 0 0 0 0 0 0 From 3cb825c308bed2eb9b17c34e0b7247063bef5f97 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Sun, 5 Apr 2020 00:28:47 -0600 Subject: [PATCH 06/54] Made ev_tally_full() public --- src/pair.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pair.h b/src/pair.h index d578908b20..df05077f42 100644 --- a/src/pair.h +++ b/src/pair.h @@ -129,7 +129,7 @@ class Pair : protected Pointers { virtual void modify_params(int, char **); void compute_dummy(int, int); - // need to be public, so can be called by pair_style reaxc + // need to be public, so can be called by pair_style reaxc, mliap void v_tally(int, double *, double *); void ev_tally(int, int, int, int, double, double, double, @@ -141,6 +141,7 @@ class Pair : protected Pointers { double *, double *, double *); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double, double); + void ev_tally_full(int, double, double, double, double, double, double); // general child-class methods @@ -247,7 +248,6 @@ class Pair : protected Pointers { } virtual void ev_setup(int, int, int alloc = 1); void ev_unset(); - void ev_tally_full(int, double, double, double, double, double, double); void ev_tally_xyz_full(int, double, double, double, double, double, double, double, double); void ev_tally4(int, int, int, int, double, From 46ee159f14dd7514ce1bfe25655bea90be3c6e84 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Mon, 6 Apr 2020 17:05:43 -0600 Subject: [PATCH 07/54] Added custom tally functions --- src/MLIAP/mliap_descriptor_snap.cpp | 5 ++- src/MLIAP/mliap_model_linear.cpp | 5 ++- src/MLIAP/mliap_model_quadratic.cpp | 5 ++- src/MLIAP/pair_mliap.cpp | 57 +++++++++++++++++++++++++++++ src/MLIAP/pair_mliap.h | 4 ++ src/pair.h | 4 +- 6 files changed, 74 insertions(+), 6 deletions(-) diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 448e334ddd..c6ab484d22 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -241,10 +241,11 @@ void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta, int vflag) f[j][1] -= fij[1]; f[j][2] -= fij[2]; - // tally per-atom virial contribution + // add in gloabl and per-atom virial contributions + // this is optional and has no effect on force calculation if (vflag) - pairmliap->ev_tally_xyz(i,j,nlocal,newton_pair,0.0,0.0, + pairmliap->v_tally(i,j, fij[0],fij[1],fij[2], -snaptr->rij[jj][0],-snaptr->rij[jj][1], -snaptr->rij[jj][2]); diff --git a/src/MLIAP/mliap_model_linear.cpp b/src/MLIAP/mliap_model_linear.cpp index fa58ba4199..e413b7c634 100644 --- a/src/MLIAP/mliap_model_linear.cpp +++ b/src/MLIAP/mliap_model_linear.cpp @@ -57,6 +57,9 @@ void MLIAPModelLinear::gradient(NeighList* list, double **descriptors, double ** for (int icoeff = 0; icoeff < ndescriptors; icoeff++) beta[ii][icoeff] = coeffi[icoeff+1]; + // add in contributions to global and per-atom energy + // this is optional and has no effect on force calculation + if (eflag) { // energy of atom I @@ -69,7 +72,7 @@ void MLIAPModelLinear::gradient(NeighList* list, double **descriptors, double ** for (int icoeff = 0; icoeff < ndescriptors; icoeff++) etmp += coeffi[icoeff+1]*descriptors[ii][icoeff]; - pairmliap->ev_tally_full(i,2.0*etmp,0.0,0.0,0.0,0.0,0.0); + pairmliap->e_tally(i,etmp); } } } diff --git a/src/MLIAP/mliap_model_quadratic.cpp b/src/MLIAP/mliap_model_quadratic.cpp index 2795c82bc7..0096a6117d 100644 --- a/src/MLIAP/mliap_model_quadratic.cpp +++ b/src/MLIAP/mliap_model_quadratic.cpp @@ -70,6 +70,9 @@ void MLIAPModelQuadratic::gradient(NeighList* list, double **descriptors, double } } + // add in contributions to global and per-atom energy + // this is optional and has no effect on force calculation + if (eflag) { // energy of atom I @@ -93,7 +96,7 @@ void MLIAPModelQuadratic::gradient(NeighList* list, double **descriptors, double etmp += coeffi[k++]*bveci*bvecj; } } - pairmliap->ev_tally_full(i,2.0*etmp,0.0,0.0,0.0,0.0,0.0); + pairmliap->e_tally(i,etmp); } } } diff --git a/src/MLIAP/pair_mliap.cpp b/src/MLIAP/pair_mliap.cpp index be18e933ed..cd8689fbcf 100644 --- a/src/MLIAP/pair_mliap.cpp +++ b/src/MLIAP/pair_mliap.cpp @@ -216,6 +216,63 @@ void PairMLIAP::coeff(int narg, char **arg) error->all(FLERR,"Incompatible model and descriptor definitions"); } +/* ---------------------------------------------------------------------- + add energy of atom i to global and per-atom energy + this is called by MLIAPModel::gradient() +------------------------------------------------------------------------- */ + +void PairMLIAP::e_tally(int i, double evdwl) +{ + if (eflag_global) eng_vdwl += evdwl; + if (eflag_atom) eatom[i] += evdwl; +} + +/* ---------------------------------------------------------------------- + add virial contribution into global and per-atom accumulators + this is called by MLIAPDescriptor::backward() +------------------------------------------------------------------------- */ + +void PairMLIAP::v_tally(int i, int j, + double fx, double fy, double fz, + double delx, double dely, double delz) +{ + double v[6]; + + if (vflag_either) { + v[0] = delx*fx; + v[1] = dely*fy; + v[2] = delz*fz; + v[3] = delx*fy; + v[4] = delx*fz; + v[5] = dely*fz; + + if (vflag_global) { + virial[0] += v[0]; + virial[1] += v[1]; + virial[2] += v[2]; + virial[3] += v[3]; + virial[4] += v[4]; + virial[5] += v[5]; + } + + if (vflag_atom) { + vatom[i][0] += 0.5*v[0]; + vatom[i][1] += 0.5*v[1]; + vatom[i][2] += 0.5*v[2]; + vatom[i][3] += 0.5*v[3]; + vatom[i][4] += 0.5*v[4]; + vatom[i][5] += 0.5*v[5]; + + vatom[j][0] += 0.5*v[0]; + vatom[j][1] += 0.5*v[1]; + vatom[j][2] += 0.5*v[2]; + vatom[j][3] += 0.5*v[3]; + vatom[j][4] += 0.5*v[4]; + vatom[j][5] += 0.5*v[5]; + } + } +} + /* ---------------------------------------------------------------------- init specific to this pair style ------------------------------------------------------------------------- */ diff --git a/src/MLIAP/pair_mliap.h b/src/MLIAP/pair_mliap.h index bcd7c2fb73..66bafab97a 100644 --- a/src/MLIAP/pair_mliap.h +++ b/src/MLIAP/pair_mliap.h @@ -31,6 +31,10 @@ public: virtual void compute(int, int); void settings(int, char **); virtual void coeff(int, char **); + void e_tally(int, double); + void v_tally(int, int, + double, double, double, + double, double, double); virtual void init_style(); virtual double init_one(int, int); virtual double memory_usage(); diff --git a/src/pair.h b/src/pair.h index df05077f42..d578908b20 100644 --- a/src/pair.h +++ b/src/pair.h @@ -129,7 +129,7 @@ class Pair : protected Pointers { virtual void modify_params(int, char **); void compute_dummy(int, int); - // need to be public, so can be called by pair_style reaxc, mliap + // need to be public, so can be called by pair_style reaxc void v_tally(int, double *, double *); void ev_tally(int, int, int, int, double, double, double, @@ -141,7 +141,6 @@ class Pair : protected Pointers { double *, double *, double *); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double, double); - void ev_tally_full(int, double, double, double, double, double, double); // general child-class methods @@ -248,6 +247,7 @@ class Pair : protected Pointers { } virtual void ev_setup(int, int, int alloc = 1); void ev_unset(); + void ev_tally_full(int, double, double, double, double, double, double); void ev_tally_xyz_full(int, double, double, double, double, double, double, double, double); void ev_tally4(int, int, int, int, double, From 0443ac2dd41575df258e1b873ff8cd1da119353f Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Tue, 7 Apr 2020 20:51:39 -0600 Subject: [PATCH 08/54] Created class ComputeSNAP, not completely finished, but compiles --- src/MLIAP/compute_mliap.cpp | 349 ++++++++++++++++++++++++++++ src/MLIAP/compute_mliap.h | 87 +++++++ src/MLIAP/mliap_descriptor.cpp | 14 +- src/MLIAP/mliap_descriptor.h | 8 +- src/MLIAP/mliap_descriptor_snap.cpp | 32 ++- src/MLIAP/mliap_descriptor_snap.h | 7 +- src/MLIAP/mliap_model.cpp | 12 +- src/MLIAP/mliap_model.h | 7 +- src/MLIAP/mliap_model_linear.cpp | 8 +- src/MLIAP/mliap_model_linear.h | 4 +- src/MLIAP/mliap_model_quadratic.cpp | 8 +- src/MLIAP/mliap_model_quadratic.h | 4 +- src/MLIAP/pair_mliap.cpp | 13 +- 13 files changed, 495 insertions(+), 58 deletions(-) create mode 100644 src/MLIAP/compute_mliap.cpp create mode 100644 src/MLIAP/compute_mliap.h diff --git a/src/MLIAP/compute_mliap.cpp b/src/MLIAP/compute_mliap.cpp new file mode 100644 index 0000000000..f8f1f8f0a1 --- /dev/null +++ b/src/MLIAP/compute_mliap.cpp @@ -0,0 +1,349 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include +#include +#include "mliap_model_linear.h" +#include "mliap_model_quadratic.h" +#include "mliap_descriptor_snap.h" +#include "compute_mliap.h" +#include "atom.h" +#include "update.h" +#include "modify.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "force.h" +#include "pair.h" +#include "comm.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; + +enum{SCALAR,VECTOR,ARRAY}; + +ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), cutsq(NULL), list(NULL), mliap(NULL), + mliap_peratom(NULL), mliapall(NULL) +{ + + array_flag = 1; + extarray = 0; + + int ntypes = atom->ntypes; + + if (narg < 4) + error->all(FLERR,"Illegal compute mliap command"); + + // process keywords + + int iarg = 0; + + while (iarg < narg) { + if (strcmp(arg[iarg],"model") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal compute mliap command"); + if (strcmp(arg[iarg+1],"linear") == 0) { + if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command"); + model = new MLIAPModelLinear(lmp,arg[iarg+2]); + iarg += 3; + } else if (strcmp(arg[iarg+1],"quadratic") == 0) { + if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command"); + model = new MLIAPModelQuadratic(lmp,arg[iarg+2]); + iarg += 3; + } else error->all(FLERR,"Illegal compute mliap command"); + } else if (strcmp(arg[iarg],"descriptor") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal compute mliap command"); + if (strcmp(arg[iarg+1],"sna") == 0) { + if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command"); + descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2]); + iarg += 3; + } else error->all(FLERR,"Illegal compute mliap command"); + } + } + + nparams = model->nparams; + nperdim = nparams; + ndims_force = 3; + ndims_virial = 6; + yoffset = nperdim; + zoffset = 2*nperdim; + natoms = atom->natoms; + size_array_rows = 1+ndims_force*natoms+ndims_virial; + size_array_cols = nperdim*atom->ntypes+1; + lastcol = size_array_cols-1; + + ndims_peratom = ndims_force; + size_peratom = ndims_peratom*nperdim*atom->ntypes; + + nmax = 0; +} + +/* ---------------------------------------------------------------------- */ + +ComputeMLIAP::~ComputeMLIAP() +{ + memory->destroy(mliap); + memory->destroy(mliapall); + memory->destroy(mliap_peratom); + memory->destroy(cutsq); + + memory->destroy(map); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeMLIAP::init() +{ + if (force->pair == NULL) + error->all(FLERR,"Compute mliap requires a pair style be defined"); + + if (descriptor->get_cutmax() > force->pair->cutforce) + error->all(FLERR,"Compute mliap cutoff is longer than pairwise cutoff"); + + // need an occasional full neighbor list + + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->pair = 0; + neighbor->requests[irequest]->compute = 1; + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; + neighbor->requests[irequest]->occasional = 1; + + int count = 0; + for (int i = 0; i < modify->ncompute; i++) + if (strcmp(modify->compute[i]->style,"mliap") == 0) count++; + if (count > 1 && comm->me == 0) + error->warning(FLERR,"More than one compute mliap"); + + // allocate memory for global array + + memory->create(mliap,size_array_rows,size_array_cols, + "mliap:mliap"); + memory->create(mliapall,size_array_rows,size_array_cols, + "mliap:mliapall"); + array = mliapall; + + // find compute for reference energy + + char *id_pe = (char *) "thermo_pe"; + int ipe = modify->find_compute(id_pe); + if (ipe == -1) + error->all(FLERR,"compute thermo_pe does not exist."); + c_pe = modify->compute[ipe]; + + // add compute for reference virial tensor + + char *id_virial = (char *) "mliap_press"; + char **newarg = new char*[5]; + newarg[0] = id_virial; + newarg[1] = (char *) "all"; + newarg[2] = (char *) "pressure"; + newarg[3] = (char *) "NULL"; + newarg[4] = (char *) "virial"; + modify->add_compute(5,newarg); + delete [] newarg; + + int ivirial = modify->find_compute(id_virial); + if (ivirial == -1) + error->all(FLERR,"compute mliap_press does not exist."); + c_virial = modify->compute[ivirial]; + +} + + +/* ---------------------------------------------------------------------- */ + +void ComputeMLIAP::init_list(int /*id*/, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeMLIAP::compute_array() +{ + int ntotal = atom->nlocal + atom->nghost; + + invoked_array = update->ntimestep; + + // grow mliap_peratom array if necessary + + if (atom->nmax > nmax) { + memory->destroy(mliap_peratom); + nmax = atom->nmax; + memory->create(mliap_peratom,nmax,size_peratom, + "mliap:mliap_peratom"); + } + + if (gamma_max < list->inum) { + memory->grow(descriptors,list->inum,ndescriptors,"PairMLIAP:descriptors"); + memory->grow(gamma,nparams,list->inum,ndescriptors,"PairMLIAP:gamma"); + gamma_max = list->inum; + } + + // clear global array + + for (int irow = 0; irow < size_array_rows; irow++) + for (int icoeff = 0; icoeff < size_array_cols; icoeff++) + mliap[irow][icoeff] = 0.0; + + // clear local peratom array + + for (int i = 0; i < ntotal; i++) + for (int icoeff = 0; icoeff < size_peratom; icoeff++) { + mliap_peratom[i][icoeff] = 0.0; + } + + // invoke full neighbor list (will copy or build if necessary) + + neighbor->build_one(list); + + // compute descriptors, if needed + + if (model->nonlinearflag) + descriptor->forward(map, list, descriptors); + + // calculate descriptor contributions to parameter gradients + // and gamma = double gradient w.r.t. parameters and descriptors + + // i.e. gamma = d2E/d\sigma.dB_i + // sigma is a parameter and B_i is a descriptor of atom i + // for SNAP, this is a sparse nparams*natoms*ndescriptors matrix, + // but in general it could be fully dense. + + // *******Not implemented yet***************** + // This should populate the energy row and gamma + // For the linear model energy row will look just like the Bi accumulation + // in ComputeSNAP i.e. accumulating the intput descriptors vector, + // while gamma will be just 1's and 0's + // For the quadratic model, the energy row will be similar, + // while gamma will be 1's, 0's and Bi's + + // model->param_gradient(list, descriptors, mliap[0], gamma); + + // calculate descriptor gradient contributions to parameter gradients + + // *******Not implemented yet***************** + // This will just take gamma and multiply it with + // descriptor gradient contributions i.e. dblist + // this will resemble snadi accumualation in ComputeSNAP + // descriptor->param_backward(list, gamma, snadi); + + // accumulate descriptor gradient contributions to global array + + for (int itype = 0; itype < atom->ntypes; itype++) { + const int typeoffset_local = ndims_peratom*nperdim*itype; + const int typeoffset_global = nperdim*itype; + for (int icoeff = 0; icoeff < nperdim; icoeff++) { + int irow = 1; + for (int i = 0; i < ntotal; i++) { + double *snadi = mliap_peratom[i]+typeoffset_local; + int iglobal = atom->tag[i]; + int irow = 3*(iglobal-1)+1; + mliap[irow][icoeff+typeoffset_global] += snadi[icoeff]; + mliap[irow+1][icoeff+typeoffset_global] += snadi[icoeff+yoffset]; + mliap[irow+2][icoeff+typeoffset_global] += snadi[icoeff+zoffset]; + } + } + } + + // accumulate forces to global array + + for (int i = 0; i < atom->nlocal; i++) { + int iglobal = atom->tag[i]; + int irow = 3*(iglobal-1)+1; + mliap[irow][lastcol] = atom->f[i][0]; + mliap[irow+1][lastcol] = atom->f[i][1]; + mliap[irow+2][lastcol] = atom->f[i][2]; + } + + // accumulate bispectrum virial contributions to global array + + dbdotr_compute(); + + // sum up over all processes + + MPI_Allreduce(&mliap[0][0],&mliapall[0][0],size_array_rows*size_array_cols,MPI_DOUBLE,MPI_SUM,world); + + // assign energy to last column + + int irow = 0; + double reference_energy = c_pe->compute_scalar(); + mliapall[irow++][lastcol] = reference_energy; + + // assign virial stress to last column + // switch to Voigt notation + + c_virial->compute_vector(); + irow += 3*natoms; + mliapall[irow++][lastcol] = c_virial->vector[0]; + mliapall[irow++][lastcol] = c_virial->vector[1]; + mliapall[irow++][lastcol] = c_virial->vector[2]; + mliapall[irow++][lastcol] = c_virial->vector[5]; + mliapall[irow++][lastcol] = c_virial->vector[4]; + mliapall[irow++][lastcol] = c_virial->vector[3]; + +} + +/* ---------------------------------------------------------------------- + compute global virial contributions via summing r_i.dB^j/dr_i over + own & ghost atoms +------------------------------------------------------------------------- */ + +void ComputeMLIAP::dbdotr_compute() +{ + double **x = atom->x; + int irow0 = 1+ndims_force*natoms; + + // sum over bispectrum contributions to forces + // on all particles including ghosts + + int nall = atom->nlocal + atom->nghost; + for (int i = 0; i < nall; i++) + for (int itype = 0; itype < atom->ntypes; itype++) { + const int typeoffset_local = ndims_peratom*nperdim*itype; + const int typeoffset_global = nperdim*itype; + double *snadi = mliap_peratom[i]+typeoffset_local; + for (int icoeff = 0; icoeff < nperdim; icoeff++) { + double dbdx = snadi[icoeff]; + double dbdy = snadi[icoeff+yoffset]; + double dbdz = snadi[icoeff+zoffset]; + int irow = irow0; + mliap[irow++][icoeff+typeoffset_global] += dbdx*x[i][0]; + mliap[irow++][icoeff+typeoffset_global] += dbdy*x[i][1]; + mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][2]; + mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][1]; + mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][0]; + mliap[irow++][icoeff+typeoffset_global] += dbdy*x[i][0]; + } + } +} + +/* ---------------------------------------------------------------------- + memory usage +------------------------------------------------------------------------- */ + +double ComputeMLIAP::memory_usage() +{ + + double bytes = size_array_rows*size_array_cols * + sizeof(double); // mliap + bytes += size_array_rows*size_array_cols * + sizeof(double); // mliapall + bytes += nmax*size_peratom * sizeof(double); // mliap_peratom + int n = atom->ntypes+1; + bytes += n*sizeof(int); // map + + return bytes; +} diff --git a/src/MLIAP/compute_mliap.h b/src/MLIAP/compute_mliap.h new file mode 100644 index 0000000000..bc84880b5e --- /dev/null +++ b/src/MLIAP/compute_mliap.h @@ -0,0 +1,87 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef COMPUTE_CLASS + +ComputeStyle(mliap,ComputeMLIAP) + +#else + +#ifndef LMP_COMPUTE_MLIAP_H +#define LMP_COMPUTE_MLIAP_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeMLIAP : public Compute { + public: + ComputeMLIAP(class LAMMPS *, int, char **); + ~ComputeMLIAP(); + void init(); + void init_list(int, class NeighList *); + void compute_array(); + double memory_usage(); + + private: + int natoms, nmax, size_peratom, lastcol; + int nperdim, yoffset, zoffset; + int ndims_peratom, ndims_force, ndims_virial; + double **cutsq; + class NeighList *list; + double **mliap, **mliapall; + double **mliap_peratom; + int *map; // map types to [0,nelements) + int nelements; + + double*** gamma; // gammas for all atoms in list + double** descriptors; // descriptors for all atoms in list + int ndescriptors; // number of descriptors + int gamma_max; // number of atoms allocated for beta, descriptors + int nparams; // number of model paramters per element + + class MLIAPModel* model; + class MLIAPDescriptor* descriptor; + + Compute *c_pe; + Compute *c_virial; + + void dbdotr_compute(); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Compute snap requires a pair style be defined + +Self-explanatory. + +E: Compute snap cutoff is longer than pairwise cutoff + +UNDOCUMENTED + +W: More than one compute snad/atom + +Self-explanatory. + +*/ diff --git a/src/MLIAP/mliap_descriptor.cpp b/src/MLIAP/mliap_descriptor.cpp index 43c5cf40bc..d654b33008 100644 --- a/src/MLIAP/mliap_descriptor.cpp +++ b/src/MLIAP/mliap_descriptor.cpp @@ -12,18 +12,7 @@ ------------------------------------------------------------------------- */ #include "mliap_descriptor.h" -#include "pair_mliap.h" -#include -#include -#include -#include #include "atom.h" -#include "force.h" -#include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "sna.h" #include "memory.h" #include "error.h" @@ -34,8 +23,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPDescriptor::MLIAPDescriptor(LAMMPS *lmp, - PairMLIAP* pairmliap_in) : Pointers(lmp) {} +MLIAPDescriptor::MLIAPDescriptor(LAMMPS *lmp) : Pointers(lmp) {} /* ---------------------------------------------------------------------- */ diff --git a/src/MLIAP/mliap_descriptor.h b/src/MLIAP/mliap_descriptor.h index c6ff4201da..cd42cb3be6 100644 --- a/src/MLIAP/mliap_descriptor.h +++ b/src/MLIAP/mliap_descriptor.h @@ -20,12 +20,13 @@ namespace LAMMPS_NS { class MLIAPDescriptor : protected Pointers { public: - MLIAPDescriptor(LAMMPS*, class PairMLIAP*); + MLIAPDescriptor(LAMMPS*); ~MLIAPDescriptor(); - virtual void forward(class NeighList*, double**)=0; - virtual void backward(class NeighList*, double**, int)=0; + virtual void forward(int*, class NeighList*, double**)=0; + virtual void backward(class PairMLIAP*, class NeighList*, double**, int)=0; virtual void init()=0; virtual double get_cutoff(int, int)=0; + virtual double get_cutmax()=0; virtual double memory_usage()=0; int ndescriptors; // number of descriptors @@ -33,7 +34,6 @@ public: char **elements; // names of unique elements protected: - class PairMLIAP* pairmliap; }; diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index c6ab484d22..832efec48a 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -34,9 +34,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename, - PairMLIAP* pairmliap_in): - MLIAPDescriptor(lmp, pairmliap_in) +MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename): + MLIAPDescriptor(lmp) { nelements = 0; elements = NULL; @@ -44,7 +43,6 @@ MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename, wjelem = NULL; snaptr = NULL; read_paramfile(paramfilename); - pairmliap = pairmliap_in; } /* ---------------------------------------------------------------------- */ @@ -68,7 +66,7 @@ MLIAPDescriptorSNAP::~MLIAPDescriptorSNAP() compute descriptors for each atom ---------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::forward(NeighList* list, double **descriptors) +void MLIAPDescriptorSNAP::forward(int* map, NeighList* list, double **descriptors) { int i,j,jnum,ninside; double delx,dely,delz,rsq; @@ -84,7 +82,7 @@ void MLIAPDescriptorSNAP::forward(NeighList* list, double **descriptors) const double ytmp = x[i][1]; const double ztmp = x[i][2]; const int itype = type[i]; - const int ielem = pairmliap->map[itype]; + const int ielem = map[itype]; const double radi = radelem[ielem]; jlist = list->firstneigh[i]; @@ -109,11 +107,12 @@ void MLIAPDescriptorSNAP::forward(NeighList* list, double **descriptors) delz = x[j][2] - ztmp; rsq = delx*delx + dely*dely + delz*delz; int jtype = type[j]; - int jelem = pairmliap->map[jtype]; + int jelem = map[jtype]; // printf("i = %d j = %d itype = %d jtype = %d cutsq[i][j] = %g rsq = %g\n",i,j,itype,jtype,cutsq[itype][jtype],rsq); - if (rsq < pairmliap->cutsq[itype][jtype]&&rsq>1e-20) { + double rcutsqtmp = get_cutoff(ielem, jelem); + if (rsq < rcutsqtmp*rcutsqtmp) { snaptr->rij[ninside][0] = delx; snaptr->rij[ninside][1] = dely; snaptr->rij[ninside][2] = delz; @@ -145,7 +144,7 @@ void MLIAPDescriptorSNAP::forward(NeighList* list, double **descriptors) compute forces for each atom ---------------------------------------------------------------------- */ -void MLIAPDescriptorSNAP::backward(NeighList* list, double **beta, int vflag) +void MLIAPDescriptorSNAP::backward(PairMLIAP* pairmliap, NeighList* list, double **beta, int vflag) { int i,j,jnum,ninside; double delx,dely,delz,evdwl,rsq; @@ -428,6 +427,21 @@ double MLIAPDescriptorSNAP::get_cutoff(int ielem, int jelem) return (radelem[ielem] + radelem[jelem])*rcutfac; } +/* ---------------------------------------------------------------------- + calculate maximum cutoff distance +------------------------------------------------------------------------- */ + +double MLIAPDescriptorSNAP::get_cutmax() +{ + double cut; + double cutmax = 0.0; + for(int ielem = 0; ielem <= nelements; ielem++) { + cut = 2.0*radelem[ielem]*rcutfac; + if (cut > cutmax) cutmax = cut; + return cutmax; + } +} + /* ---------------------------------------------------------------------- memory usage ------------------------------------------------------------------------- */ diff --git a/src/MLIAP/mliap_descriptor_snap.h b/src/MLIAP/mliap_descriptor_snap.h index 87334e80f0..da2018b94f 100644 --- a/src/MLIAP/mliap_descriptor_snap.h +++ b/src/MLIAP/mliap_descriptor_snap.h @@ -20,12 +20,13 @@ namespace LAMMPS_NS { class MLIAPDescriptorSNAP : public MLIAPDescriptor { public: - MLIAPDescriptorSNAP(LAMMPS*, char*, class PairMLIAP*); + MLIAPDescriptorSNAP(LAMMPS*, char*); ~MLIAPDescriptorSNAP(); - virtual void forward(class NeighList*, double**); - virtual void backward(class NeighList*, double**, int); + virtual void forward(int*, class NeighList*, double**); + virtual void backward(class PairMLIAP*, class NeighList*, double**, int); virtual void init(); virtual double get_cutoff(int, int); + virtual double get_cutmax(); virtual double memory_usage(); double rcutfac; // declared public to workaround gcc 4.9 diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp index df36dca6f7..db5d2b7c04 100644 --- a/src/MLIAP/mliap_model.cpp +++ b/src/MLIAP/mliap_model.cpp @@ -28,13 +28,11 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename, - PairMLIAP* pairmliap_in) : Pointers(lmp) +MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename) : Pointers(lmp) { nelements = 0; coeffelem = NULL; read_coeffs(coefffilename); - pairmliap = pairmliap_in; nonlinearflag = 0; } @@ -106,16 +104,16 @@ void MLIAPModel::read_coeffs(char *coefffilename) words[iword] = strtok(NULL,"' \t\n\r\f"); nelements = atoi(words[0]); - ncoeffall = atoi(words[1]); + nparams = atoi(words[1]); // set up coeff lists - memory->create(coeffelem,nelements,ncoeffall,"mliap_snap_model:coeffelem"); + memory->create(coeffelem,nelements,nparams,"mliap_snap_model:coeffelem"); // Loop over nelements blocks in the coefficient file for (int ielem = 0; ielem < nelements; ielem++) { - for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { + for (int icoeff = 0; icoeff < nparams; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); if (ptr == NULL) { @@ -155,7 +153,7 @@ double MLIAPModel::memory_usage() double bytes = 0; int n = atom->ntypes+1; - bytes += nelements*ncoeffall*sizeof(double); // coeffelem + bytes += nelements*nparams*sizeof(double); // coeffelem return bytes; } diff --git a/src/MLIAP/mliap_model.h b/src/MLIAP/mliap_model.h index 7dfa67a2be..aeb16cb299 100644 --- a/src/MLIAP/mliap_model.h +++ b/src/MLIAP/mliap_model.h @@ -20,20 +20,19 @@ namespace LAMMPS_NS { class MLIAPModel : protected Pointers { public: - MLIAPModel(LAMMPS*, char*, class PairMLIAP*); + MLIAPModel(LAMMPS*, char*); ~MLIAPModel(); - virtual void gradient(class NeighList*, double**, double**, int)=0; + virtual void gradient(class PairMLIAP*, class NeighList*, double**, double**, int)=0; virtual void init(); virtual double memory_usage(); int nelements; // # of unique elements int nonlinearflag; // 1 if gradient() requires escriptors int ndescriptors; // number of descriptors + int nparams; // number of parameters per element protected: - class PairMLIAP* pairmliap; void read_coeffs(char *); double **coeffelem; // element coefficients - int ncoeffall; // number of coefficients per element }; } diff --git a/src/MLIAP/mliap_model_linear.cpp b/src/MLIAP/mliap_model_linear.cpp index e413b7c634..fe3665938f 100644 --- a/src/MLIAP/mliap_model_linear.cpp +++ b/src/MLIAP/mliap_model_linear.cpp @@ -28,11 +28,11 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename, PairMLIAP* pairmliap_in) : - MLIAPModel(lmp, coefffilename, pairmliap_in) +MLIAPModelLinear::MLIAPModelLinear(LAMMPS* lmp, char* coefffilename) : + MLIAPModel(lmp, coefffilename) { nonlinearflag = 0; - ndescriptors = ncoeffall - 1; + ndescriptors = nparams - 1; } /* ---------------------------------------------------------------------- */ @@ -43,7 +43,7 @@ MLIAPModelLinear::~MLIAPModelLinear(){} Calculate model gradients w.r.t descriptors for each atom dE(B_i)/dB_i ---------------------------------------------------------------------- */ -void MLIAPModelLinear::gradient(NeighList* list, double **descriptors, double **beta, int eflag) +void MLIAPModelLinear::gradient(PairMLIAP* pairmliap, NeighList* list, double **descriptors, double **beta, int eflag) { int i; int *type = atom->type; diff --git a/src/MLIAP/mliap_model_linear.h b/src/MLIAP/mliap_model_linear.h index 98965370d6..53c7c36cef 100644 --- a/src/MLIAP/mliap_model_linear.h +++ b/src/MLIAP/mliap_model_linear.h @@ -20,9 +20,9 @@ namespace LAMMPS_NS { class MLIAPModelLinear : public MLIAPModel { public: - MLIAPModelLinear(LAMMPS*, char*, class PairMLIAP*); + MLIAPModelLinear(LAMMPS*, char*); ~MLIAPModelLinear(); - virtual void gradient(class NeighList*, double**, double**, int); + virtual void gradient(class PairMLIAP*, class NeighList*, double**, double**, int); protected: }; diff --git a/src/MLIAP/mliap_model_quadratic.cpp b/src/MLIAP/mliap_model_quadratic.cpp index 0096a6117d..94d8972416 100644 --- a/src/MLIAP/mliap_model_quadratic.cpp +++ b/src/MLIAP/mliap_model_quadratic.cpp @@ -28,11 +28,11 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename, PairMLIAP* pairmliap_in) : - MLIAPModel(lmp, coefffilename, pairmliap_in) +MLIAPModelQuadratic::MLIAPModelQuadratic(LAMMPS* lmp, char* coefffilename) : + MLIAPModel(lmp, coefffilename) { nonlinearflag = 1; - ndescriptors = sqrt(2*ncoeffall)-1; + ndescriptors = sqrt(2*nparams)-1; } /* ---------------------------------------------------------------------- */ @@ -43,7 +43,7 @@ MLIAPModelQuadratic::~MLIAPModelQuadratic(){} Calculate model gradients w.r.t descriptors for each atom dE(B_i)/dB_i ---------------------------------------------------------------------- */ -void MLIAPModelQuadratic::gradient(NeighList* list, double **descriptors, double **beta, int eflag) +void MLIAPModelQuadratic::gradient(PairMLIAP* pairmliap, NeighList* list, double **descriptors, double **beta, int eflag) { int i; int *type = atom->type; diff --git a/src/MLIAP/mliap_model_quadratic.h b/src/MLIAP/mliap_model_quadratic.h index e11f7d351e..6ca0697919 100644 --- a/src/MLIAP/mliap_model_quadratic.h +++ b/src/MLIAP/mliap_model_quadratic.h @@ -20,9 +20,9 @@ namespace LAMMPS_NS { class MLIAPModelQuadratic : public MLIAPModel { public: - MLIAPModelQuadratic(LAMMPS*, char*, class PairMLIAP*); + MLIAPModelQuadratic(LAMMPS*, char*); ~MLIAPModelQuadratic(); - virtual void gradient(class NeighList*, double**, double**, int); + virtual void gradient(class PairMLIAP*, class NeighList*, double**, double**, int); protected: }; diff --git a/src/MLIAP/pair_mliap.cpp b/src/MLIAP/pair_mliap.cpp index cd8689fbcf..aabdb90cef 100644 --- a/src/MLIAP/pair_mliap.cpp +++ b/src/MLIAP/pair_mliap.cpp @@ -44,6 +44,7 @@ PairMLIAP::PairMLIAP(LAMMPS *lmp) : Pair(lmp) model = NULL; descriptor = NULL; + map = NULL; } /* ---------------------------------------------------------------------- */ @@ -85,15 +86,15 @@ void PairMLIAP::compute(int eflag, int vflag) // compute descriptors, if needed if (model->nonlinearflag || eflag) - descriptor->forward(list, descriptors); + descriptor->forward(map, list, descriptors); // compute E_i and beta_i = dE_i/dB_i for all i in list - model->gradient(list, descriptors, beta, eflag); + model->gradient(this, list, descriptors, beta, eflag); // calculate force contributions beta_i*dB_i/dR_j - descriptor->backward(list, beta, vflag); + descriptor->backward(this, list, beta, vflag); // calculate stress @@ -132,18 +133,18 @@ void PairMLIAP::settings(int narg, char ** arg) if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style mliap command"); if (strcmp(arg[iarg+1],"linear") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); - model = new MLIAPModelLinear(lmp,arg[iarg+2],this); + model = new MLIAPModelLinear(lmp,arg[iarg+2]); iarg += 3; } else if (strcmp(arg[iarg+1],"quadratic") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); - model = new MLIAPModelQuadratic(lmp,arg[iarg+2],this); + model = new MLIAPModelQuadratic(lmp,arg[iarg+2]); iarg += 3; } else error->all(FLERR,"Illegal pair_style mliap command"); } else if (strcmp(arg[iarg],"descriptor") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style mliap command"); if (strcmp(arg[iarg+1],"sna") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command"); - descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2],this); + descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2]); iarg += 3; } else error->all(FLERR,"Illegal pair_style mliap command"); } From 19f1d0445d724e305e4ae9a56350b0971f9495b5 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Wed, 8 Apr 2020 10:32:27 -0600 Subject: [PATCH 09/54] Added THIS IS NOT RIGHT note --- src/MLIAP/compute_mliap.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/MLIAP/compute_mliap.cpp b/src/MLIAP/compute_mliap.cpp index f8f1f8f0a1..80cfbca058 100644 --- a/src/MLIAP/compute_mliap.cpp +++ b/src/MLIAP/compute_mliap.cpp @@ -214,6 +214,13 @@ void ComputeMLIAP::compute_array() if (model->nonlinearflag) descriptor->forward(map, list, descriptors); + // ***********THIS IS NOT RIGHT********************** + // This whole idea is flawed. The gamma matrix is too big to + // store. Instead, we should generate the A matrix, + // just as ComputeSNAP does, and then pass it to + // the model, which can evaluate gradients of E, F, sigma, + // w.r.t. model parameters. + // calculate descriptor contributions to parameter gradients // and gamma = double gradient w.r.t. parameters and descriptors From a98d03ee0e6e7d380dcaecda75823686481d9d77 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Jun 2020 16:55:55 -0400 Subject: [PATCH 10/54] add missing linefeed --- src/set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/set.cpp b/src/set.cpp index d201d507f8..8527f93df7 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -604,10 +604,10 @@ void Set::command(int narg, char **arg) if (comm->me == 0) { if (strcmp(arg[origarg],"cc") == 0) - utils::logmesg(lmp,fmt::format(" {} settings made for {} index {}", + utils::logmesg(lmp,fmt::format(" {} settings made for {} index {}\n", allcount,arg[origarg],arg[origarg+1])); else - utils::logmesg(lmp,fmt::format(" {} settings made for {}", + utils::logmesg(lmp,fmt::format(" {} settings made for {}\n", allcount,arg[origarg])); } } From ab42123005a53de0af1b102e2fe178c8ff051445 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 21 Jun 2020 16:56:04 -0400 Subject: [PATCH 11/54] add test for atom style sphere --- unittest/formats/test_atom_styles.cpp | 343 ++++++++++++++++++++++++++ 1 file changed, 343 insertions(+) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index 614a72e678..fa47256e7b 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -704,6 +704,7 @@ TEST_F(AtomStyleTest, charge) lmp->input->one("delete_atoms group two compress no"); lmp->input->one("write_restart test_atom_styles.restart"); lmp->input->one("clear"); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); lmp->input->one("read_restart test_atom_styles.restart"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("charge")); @@ -742,6 +743,348 @@ TEST_F(AtomStyleTest, charge) ASSERT_EQ(lmp->atom->mass_setflag[2], 1); } +TEST_F(AtomStyleTest, sphere) +{ + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("atom_style sphere"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 0); + ASSERT_EQ(lmp->atom->nlocal, 0); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_EQ(lmp->atom->nmax, 1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, 0); + ASSERT_EQ(lmp->atom->nellipsoids, 0); + ASSERT_EQ(lmp->atom->nlines, 0); + ASSERT_EQ(lmp->atom->ntris, 0); + ASSERT_EQ(lmp->atom->nbodies, 0); + ASSERT_EQ(lmp->atom->nbonds, 0); + ASSERT_EQ(lmp->atom->nangles, 0); + ASSERT_EQ(lmp->atom->ndihedrals, 0); + ASSERT_EQ(lmp->atom->nimpropers, 0); + ASSERT_EQ(lmp->atom->ntypes, 0); + ASSERT_EQ(lmp->atom->nbondtypes, 0); + ASSERT_EQ(lmp->atom->nangletypes, 0); + ASSERT_EQ(lmp->atom->ndihedraltypes, 0); + ASSERT_EQ(lmp->atom->nimpropertypes, 0); + ASSERT_EQ(lmp->atom->bond_per_atom, 0); + ASSERT_EQ(lmp->atom->angle_per_atom, 0); + ASSERT_EQ(lmp->atom->dihedral_per_atom, 0); + ASSERT_EQ(lmp->atom->improper_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_bond_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_angle_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_dihedral_per_atom, 0); + ASSERT_EQ(lmp->atom->extra_improper_per_atom, 0); + + ASSERT_EQ(lmp->atom->sphere_flag, 1); + ASSERT_EQ(lmp->atom->ellipsoid_flag, 0); + ASSERT_EQ(lmp->atom->line_flag, 0); + ASSERT_EQ(lmp->atom->tri_flag, 0); + ASSERT_EQ(lmp->atom->body_flag, 0); + ASSERT_EQ(lmp->atom->peri_flag, 0); + ASSERT_EQ(lmp->atom->electron_flag, 0); + ASSERT_EQ(lmp->atom->wavepacket_flag, 0); + ASSERT_EQ(lmp->atom->sph_flag, 0); + ASSERT_EQ(lmp->atom->molecule_flag, 0); + ASSERT_EQ(lmp->atom->molindex_flag, 0); + ASSERT_EQ(lmp->atom->molatom_flag, 0); + ASSERT_EQ(lmp->atom->q_flag, 0); + ASSERT_EQ(lmp->atom->mu_flag, 0); + ASSERT_EQ(lmp->atom->rmass_flag, 1); + ASSERT_EQ(lmp->atom->radius_flag, 1); + ASSERT_EQ(lmp->atom->omega_flag, 1); + ASSERT_EQ(lmp->atom->torque_flag, 1); + ASSERT_EQ(lmp->atom->angmom_flag, 0); + ASSERT_EQ(lmp->atom->vfrac_flag, 0); + ASSERT_EQ(lmp->atom->spin_flag, 0); + ASSERT_EQ(lmp->atom->eradius_flag, 0); + ASSERT_EQ(lmp->atom->ervel_flag, 0); + ASSERT_EQ(lmp->atom->erforce_flag, 0); + ASSERT_EQ(lmp->atom->cs_flag, 0); + ASSERT_EQ(lmp->atom->csforce_flag, 0); + ASSERT_EQ(lmp->atom->vforce_flag, 0); + ASSERT_EQ(lmp->atom->ervelforce_flag, 0); + ASSERT_EQ(lmp->atom->etag_flag, 0); + ASSERT_EQ(lmp->atom->rho_flag, 0); + ASSERT_EQ(lmp->atom->esph_flag, 0); + ASSERT_EQ(lmp->atom->cv_flag, 0); + ASSERT_EQ(lmp->atom->vest_flag, 0); + ASSERT_EQ(lmp->atom->dpd_flag, 0); + ASSERT_EQ(lmp->atom->edpd_flag, 0); + ASSERT_EQ(lmp->atom->tdpd_flag, 0); + ASSERT_EQ(lmp->atom->mesont_flag, 0); + ASSERT_EQ(lmp->atom->sp_flag, 0); + ASSERT_EQ(lmp->atom->x0_flag, 0); + ASSERT_EQ(lmp->atom->smd_flag, 0); + ASSERT_EQ(lmp->atom->damage_flag, 0); + ASSERT_EQ(lmp->atom->contact_radius_flag, 0); + ASSERT_EQ(lmp->atom->smd_data_9_flag, 0); + ASSERT_EQ(lmp->atom->smd_stress_flag, 0); + ASSERT_EQ(lmp->atom->eff_plastic_strain_flag, 0); + ASSERT_EQ(lmp->atom->eff_plastic_strain_rate_flag, 0); + ASSERT_EQ(lmp->atom->pdscale, 1.0); + + ASSERT_NE(lmp->atom->tag, nullptr); + ASSERT_NE(lmp->atom->type, nullptr); + ASSERT_NE(lmp->atom->mask, nullptr); + ASSERT_NE(lmp->atom->image, nullptr); + ASSERT_NE(lmp->atom->x, nullptr); + ASSERT_NE(lmp->atom->v, nullptr); + ASSERT_NE(lmp->atom->f, nullptr); + ASSERT_EQ(lmp->atom->q, nullptr); + ASSERT_EQ(lmp->atom->mu, nullptr); + ASSERT_NE(lmp->atom->omega, nullptr); + ASSERT_EQ(lmp->atom->angmom, nullptr); + ASSERT_NE(lmp->atom->torque, nullptr); + ASSERT_NE(lmp->atom->radius, nullptr); + ASSERT_NE(lmp->atom->rmass, nullptr); + ASSERT_EQ(lmp->atom->ellipsoid, nullptr); + ASSERT_EQ(lmp->atom->line, nullptr); + ASSERT_EQ(lmp->atom->tri, nullptr); + ASSERT_EQ(lmp->atom->body, nullptr); + ASSERT_EQ(lmp->atom->molecule, nullptr); + ASSERT_EQ(lmp->atom->molindex, nullptr); + ASSERT_EQ(lmp->atom->molatom, nullptr); + ASSERT_EQ(lmp->atom->num_bond, nullptr); + ASSERT_EQ(lmp->atom->bond_type, nullptr); + ASSERT_EQ(lmp->atom->bond_atom, nullptr); + ASSERT_EQ(lmp->atom->num_angle, nullptr); + ASSERT_EQ(lmp->atom->angle_type, nullptr); + ASSERT_EQ(lmp->atom->angle_atom1, nullptr); + ASSERT_EQ(lmp->atom->angle_atom2, nullptr); + ASSERT_EQ(lmp->atom->angle_atom3, nullptr); + ASSERT_EQ(lmp->atom->num_dihedral, nullptr); + ASSERT_EQ(lmp->atom->dihedral_type, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom1, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom2, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom3, nullptr); + ASSERT_EQ(lmp->atom->dihedral_atom4, nullptr); + ASSERT_EQ(lmp->atom->num_improper, nullptr); + ASSERT_EQ(lmp->atom->improper_type, nullptr); + ASSERT_EQ(lmp->atom->improper_atom1, nullptr); + ASSERT_EQ(lmp->atom->improper_atom2, nullptr); + ASSERT_EQ(lmp->atom->improper_atom3, nullptr); + ASSERT_EQ(lmp->atom->improper_atom4, nullptr); + ASSERT_EQ(lmp->atom->maxspecial, 1); + ASSERT_EQ(lmp->atom->nspecial, nullptr); + ASSERT_EQ(lmp->atom->special, nullptr); + ASSERT_EQ(lmp->atom->vfrac, nullptr); + ASSERT_EQ(lmp->atom->s0, nullptr); + ASSERT_EQ(lmp->atom->x0, nullptr); + ASSERT_EQ(lmp->atom->sp, nullptr); + ASSERT_EQ(lmp->atom->fm, nullptr); + ASSERT_EQ(lmp->atom->fm_long, nullptr); + ASSERT_EQ(lmp->atom->spin, nullptr); + ASSERT_EQ(lmp->atom->eradius, nullptr); + ASSERT_EQ(lmp->atom->ervel, nullptr); + ASSERT_EQ(lmp->atom->erforce, nullptr); + ASSERT_EQ(lmp->atom->ervelforce, nullptr); + ASSERT_EQ(lmp->atom->cs, nullptr); + ASSERT_EQ(lmp->atom->csforce, nullptr); + ASSERT_EQ(lmp->atom->vforce, nullptr); + ASSERT_EQ(lmp->atom->etag, nullptr); + ASSERT_EQ(lmp->atom->uCond, nullptr); + ASSERT_EQ(lmp->atom->uMech, nullptr); + ASSERT_EQ(lmp->atom->uChem, nullptr); + ASSERT_EQ(lmp->atom->uCG, nullptr); + ASSERT_EQ(lmp->atom->uCGnew, nullptr); + ASSERT_EQ(lmp->atom->duChem, nullptr); + ASSERT_EQ(lmp->atom->dpdTheta, nullptr); + ASSERT_EQ(lmp->atom->cc, nullptr); + ASSERT_EQ(lmp->atom->cc_flux, nullptr); + ASSERT_EQ(lmp->atom->edpd_temp, nullptr); + ASSERT_EQ(lmp->atom->edpd_flux, nullptr); + ASSERT_EQ(lmp->atom->edpd_cv, nullptr); + ASSERT_EQ(lmp->atom->length, nullptr); + ASSERT_EQ(lmp->atom->buckling, nullptr); + ASSERT_EQ(lmp->atom->bond_nt, nullptr); + ASSERT_EQ(lmp->atom->contact_radius, nullptr); + ASSERT_EQ(lmp->atom->smd_data_9, nullptr); + ASSERT_EQ(lmp->atom->smd_stress, nullptr); + ASSERT_EQ(lmp->atom->eff_plastic_strain, nullptr); + ASSERT_EQ(lmp->atom->eff_plastic_strain_rate, nullptr); + ASSERT_EQ(lmp->atom->damage, nullptr); + ASSERT_EQ(lmp->atom->rho, nullptr); + ASSERT_EQ(lmp->atom->drho, nullptr); + ASSERT_EQ(lmp->atom->esph, nullptr); + ASSERT_EQ(lmp->atom->desph, nullptr); + ASSERT_EQ(lmp->atom->cv, nullptr); + ASSERT_EQ(lmp->atom->vest, nullptr); + ASSERT_EQ(lmp->atom->nmolecule, 0); + ASSERT_EQ(lmp->atom->molecules, nullptr); + ASSERT_EQ(lmp->atom->nivector, 0); + ASSERT_EQ(lmp->atom->ndvector, 0); + ASSERT_EQ(lmp->atom->iname, nullptr); + ASSERT_EQ(lmp->atom->dname, nullptr); + ASSERT_EQ(lmp->atom->mass, nullptr); + ASSERT_EQ(lmp->atom->mass_setflag, nullptr); + ASSERT_EQ(lmp->atom->nextra_grow, 0); + ASSERT_EQ(lmp->atom->nextra_restart, 0); + ASSERT_EQ(lmp->atom->nextra_border, 0); + ASSERT_EQ(lmp->atom->nextra_grow_max, 0); + ASSERT_EQ(lmp->atom->nextra_restart_max, 0); + ASSERT_EQ(lmp->atom->nextra_border_max, 0); + ASSERT_EQ(lmp->atom->nextra_store, 0); + ASSERT_EQ(lmp->atom->extra_grow, nullptr); + ASSERT_EQ(lmp->atom->extra_restart, nullptr); + ASSERT_EQ(lmp->atom->extra_border, nullptr); + ASSERT_EQ(lmp->atom->extra, nullptr); + ASSERT_EQ(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->map_style, 0); + ASSERT_EQ(lmp->atom->map_user, 0); + ASSERT_EQ(lmp->atom->map_tag_max, -1); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("create_box 2 box"); + lmp->input->one("create_atoms 1 single -2.0 2.0 0.1"); + lmp->input->one("create_atoms 1 single -2.0 -2.0 -0.1"); + lmp->input->one("create_atoms 2 single 2.0 2.0 -0.1"); + lmp->input->one("create_atoms 2 single 2.0 -2.0 0.1"); + lmp->input->one("set atom 1 mass 4.0"); + lmp->input->one("set atom 2 mass 4.0"); + lmp->input->one("set atom 3 mass 2.4"); + lmp->input->one("set atom 4 mass 2.4"); + lmp->input->one("set atom 1 omega -0.5 0.1 0.1"); + lmp->input->one("set atom 2 omega 0.5 -0.1 -0.1"); + lmp->input->one("set atom 3 omega -1.0 0.0 0.0"); + lmp->input->one("set atom 4 omega 0.0 1.0 0.0"); + lmp->input->one("pair_coeff * *"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 4); + ASSERT_EQ(lmp->atom->nlocal, 4); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, 0); + ASSERT_EQ(lmp->atom->ntypes, 2); + + ASSERT_EQ(lmp->atom->mass, nullptr); + ASSERT_EQ(lmp->atom->mass_setflag, nullptr); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("pair_coeff * *"); + lmp->input->one("write_data test_atom_styles.data nocoeff"); + lmp->input->one("clear"); + lmp->input->one("atom_style sphere"); + lmp->input->one("pair_style zero 4.0"); + lmp->input->one("units real"); + lmp->input->one("atom_modify map array"); + lmp->input->one("read_data test_atom_styles.data"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 4); + ASSERT_EQ(lmp->atom->nlocal, 4); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, 0); + ASSERT_EQ(lmp->atom->ntypes, 2); + ASSERT_EQ(lmp->atom->radius_flag, 1); + ASSERT_EQ(lmp->atom->omega_flag, 1); + ASSERT_EQ(lmp->atom->rmass_flag, 1); + ASSERT_NE(lmp->atom->sametag, nullptr); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_style, 1); + ASSERT_EQ(lmp->atom->map_user, 1); + ASSERT_EQ(lmp->atom->map_tag_max, 4); + + double **x = lmp->atom->x; + double **v = lmp->atom->v; + double *rmass = lmp->atom->rmass; + double **omega = lmp->atom->omega; + ASSERT_DOUBLE_EQ(x[0][0], -2.0); + ASSERT_DOUBLE_EQ(x[0][1], 2.0); + ASSERT_DOUBLE_EQ(x[0][2], 0.1); + ASSERT_DOUBLE_EQ(x[1][0], -2.0); + ASSERT_DOUBLE_EQ(x[1][1], -2.0); + ASSERT_DOUBLE_EQ(x[1][2], -0.1); + ASSERT_DOUBLE_EQ(x[2][0], 2.0); + ASSERT_DOUBLE_EQ(x[2][1], 2.0); + ASSERT_DOUBLE_EQ(x[2][2], -0.1); + ASSERT_DOUBLE_EQ(x[3][0], 2.0); + ASSERT_DOUBLE_EQ(x[3][1], -2.0); + ASSERT_DOUBLE_EQ(x[3][2], 0.1); + ASSERT_DOUBLE_EQ(v[0][0], 0.0); + ASSERT_DOUBLE_EQ(v[0][1], 0.0); + ASSERT_DOUBLE_EQ(v[0][2], 0.0); + ASSERT_DOUBLE_EQ(v[1][0], 0.0); + ASSERT_DOUBLE_EQ(v[1][1], 0.0); + ASSERT_DOUBLE_EQ(v[1][2], 0.0); + ASSERT_DOUBLE_EQ(v[2][0], 0.0); + ASSERT_DOUBLE_EQ(v[2][1], 0.0); + ASSERT_DOUBLE_EQ(v[2][2], 0.0); + ASSERT_DOUBLE_EQ(v[3][0], 0.0); + ASSERT_DOUBLE_EQ(v[3][1], 0.0); + ASSERT_DOUBLE_EQ(v[3][2], 0.0); + ASSERT_DOUBLE_EQ(rmass[0], 4.0); + ASSERT_DOUBLE_EQ(rmass[1], 4.0); + ASSERT_DOUBLE_EQ(rmass[2], 2.4); + ASSERT_DOUBLE_EQ(rmass[3], 2.4); + ASSERT_DOUBLE_EQ(omega[0][0], -0.5); + ASSERT_DOUBLE_EQ(omega[0][1], 0.1); + ASSERT_DOUBLE_EQ(omega[0][2], 0.1); + ASSERT_DOUBLE_EQ(omega[1][0], 0.5); + ASSERT_DOUBLE_EQ(omega[1][1], -0.1); + ASSERT_DOUBLE_EQ(omega[1][2], -0.1); + ASSERT_DOUBLE_EQ(omega[2][0], -1.0); + ASSERT_DOUBLE_EQ(omega[2][1], 0.0); + ASSERT_DOUBLE_EQ(omega[2][2], 0.0); + ASSERT_DOUBLE_EQ(omega[3][0], 0.0); + ASSERT_DOUBLE_EQ(omega[3][1], 1.0); + ASSERT_DOUBLE_EQ(omega[3][2], 0.0); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("pair_coeff * *"); + lmp->input->one("group two id 2:4:2"); + lmp->input->one("delete_atoms group two compress no"); + lmp->input->one("write_restart test_atom_styles.restart"); + lmp->input->one("clear"); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); + lmp->input->one("read_restart test_atom_styles.restart"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); + ASSERT_NE(lmp->atom->avec, nullptr); + ASSERT_EQ(lmp->atom->natoms, 2); + ASSERT_EQ(lmp->atom->nlocal, 2); + ASSERT_EQ(lmp->atom->nghost, 0); + ASSERT_NE(lmp->atom->nmax, -1); + ASSERT_EQ(lmp->atom->tag_enable, 1); + ASSERT_EQ(lmp->atom->molecular, 0); + ASSERT_EQ(lmp->atom->ntypes, 2); + ASSERT_EQ(lmp->atom->tag_consecutive(), 0); + ASSERT_EQ(lmp->atom->map_tag_max, 3); + + x = lmp->atom->x; + v = lmp->atom->v; + rmass = lmp->atom->rmass; + omega = lmp->atom->omega; + ASSERT_DOUBLE_EQ(x[0][0], -2.0); + ASSERT_DOUBLE_EQ(x[0][1], 2.0); + ASSERT_DOUBLE_EQ(x[0][2], 0.1); + ASSERT_DOUBLE_EQ(x[1][0], 2.0); + ASSERT_DOUBLE_EQ(x[1][1], 2.0); + ASSERT_DOUBLE_EQ(x[1][2], -0.1); + ASSERT_DOUBLE_EQ(v[0][0], 0.0); + ASSERT_DOUBLE_EQ(v[0][1], 0.0); + ASSERT_DOUBLE_EQ(v[0][2], 0.0); + ASSERT_DOUBLE_EQ(v[1][0], 0.0); + ASSERT_DOUBLE_EQ(v[1][1], 0.0); + ASSERT_DOUBLE_EQ(v[1][2], 0.0); + ASSERT_DOUBLE_EQ(rmass[0], 4.0); + ASSERT_DOUBLE_EQ(rmass[1], 2.4); + ASSERT_DOUBLE_EQ(omega[0][0], -0.5); + ASSERT_DOUBLE_EQ(omega[0][1], 0.1); + ASSERT_DOUBLE_EQ(omega[0][2], 0.1); + ASSERT_DOUBLE_EQ(omega[1][0], -1.0); + ASSERT_DOUBLE_EQ(omega[1][1], 0.0); + ASSERT_DOUBLE_EQ(omega[1][2], 0.0); +} + } // namespace LAMMPS_NS int main(int argc, char **argv) From 549c6343f3491edaaf24cbea7745808f8c5e3269 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Sun, 21 Jun 2020 18:05:34 -0600 Subject: [PATCH 12/54] Merged MLIAP package into latest LAMMPS created SNAP, quadratic SNAP, and ChemSNAP examples --- examples/mliap/InP_JCPA2020.mliap | 19 + examples/mliap/InP_JCPA2020.mliap.descriptor | 20 + examples/mliap/InP_JCPA2020.mliap.model | 485 ++++++++++++++++++ examples/mliap/Ta06A.mliap | 2 +- examples/mliap/Ta06A.mliap.descriptor | 2 +- examples/mliap/Ta06A.mliap.model | 2 +- examples/mliap/W.quadratic.mliap | 2 + examples/mliap/W.quadratic.mliap.descriptor | 2 + examples/mliap/W.quadratic.mliap.model | 2 + examples/mliap/WBe_Wood_PRB2019.mliap | 2 +- .../mliap/WBe_Wood_PRB2019.mliap.descriptor | 2 + examples/mliap/WBe_Wood_PRB2019.mliap.model | 1 + .../{in.mliap.Ta06A => in.mliap.snap.Ta06A} | 4 +- ....WBe.PRB2019 => in.mliap.snap.WBe.PRB2019} | 4 +- examples/mliap/in.mliap.snap.chem | 46 ++ ...liap.quadratic => in.mliap.snap.quadratic} | 7 +- .../mliap/log.21Jun20.mliap.snap.Ta06A.g++.1 | 156 ++++++ .../mliap/log.21Jun20.mliap.snap.Ta06A.g++.4 | 156 ++++++ ...> log.21Jun20.mliap.snap.WBe.PRB201.g++.1} | 94 ++-- .../log.21Jun20.mliap.snap.WBe.PRB201.g++.4 | 165 ++++++ .../mliap/log.21Jun20.mliap.snap.chem.g++.1 | 158 ++++++ .../mliap/log.21Jun20.mliap.snap.chem.g++.4 | 158 ++++++ .../log.21Jun20.mliap.snap.quadratic.g++.1 | 151 ++++++ .../log.21Jun20.mliap.snap.quadratic.g++.4 | 151 ++++++ examples/mliap/log.snap.quadratic.ref | 153 ------ potentials/InP_JCPA2020.snap | 2 +- potentials/InP_JCPA2020.snapparam | 22 +- potentials/WBe_Wood_PRB2019.snapcoeff | 1 + potentials/WBe_Wood_PRB2019.snapparam | 2 + src/MLIAP/mliap_descriptor_snap.cpp | 27 +- src/MLIAP/mliap_descriptor_snap.h | 4 +- src/MLIAP/mliap_model.cpp | 5 +- 32 files changed, 1768 insertions(+), 239 deletions(-) create mode 100644 examples/mliap/InP_JCPA2020.mliap create mode 100644 examples/mliap/InP_JCPA2020.mliap.descriptor create mode 100644 examples/mliap/InP_JCPA2020.mliap.model rename examples/mliap/{in.mliap.Ta06A => in.mliap.snap.Ta06A} (90%) rename examples/mliap/{in.mliap.WBe.PRB2019 => in.mliap.snap.WBe.PRB2019} (92%) create mode 100644 examples/mliap/in.mliap.snap.chem rename examples/mliap/{in.mliap.quadratic => in.mliap.snap.quadratic} (88%) create mode 100644 examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.1 create mode 100644 examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.4 rename examples/mliap/{log.snap.WBe.ref => log.21Jun20.mliap.snap.WBe.PRB201.g++.1} (52%) create mode 100644 examples/mliap/log.21Jun20.mliap.snap.WBe.PRB201.g++.4 create mode 100644 examples/mliap/log.21Jun20.mliap.snap.chem.g++.1 create mode 100644 examples/mliap/log.21Jun20.mliap.snap.chem.g++.4 create mode 100644 examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.1 create mode 100644 examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.4 delete mode 100644 examples/mliap/log.snap.quadratic.ref diff --git a/examples/mliap/InP_JCPA2020.mliap b/examples/mliap/InP_JCPA2020.mliap new file mode 100644 index 0000000000..19d044df97 --- /dev/null +++ b/examples/mliap/InP_JCPA2020.mliap @@ -0,0 +1,19 @@ +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +# Definition of SNAP+ZBL potential. + +variable zblcutinner index 4 +variable zblcutouter index 4.2 +variable zblz1 index 49 +variable zblz2 index 15 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff * * mliap In P + diff --git a/examples/mliap/InP_JCPA2020.mliap.descriptor b/examples/mliap/InP_JCPA2020.mliap.descriptor new file mode 100644 index 0000000000..287eac59c4 --- /dev/null +++ b/examples/mliap/InP_JCPA2020.mliap.descriptor @@ -0,0 +1,20 @@ +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +# required +rcutfac 1.0 +twojmax 6 + +# elements + +nelems 2 +elems In P +radelems 3.81205 3.82945 +welems 1 0.929316 + +# optional +rfac0 0.99363 +rmin0 0.0 +bzeroflag 1 +wselfallflag 1 +chemflag 1 +bnormflag 1 diff --git a/examples/mliap/InP_JCPA2020.mliap.model b/examples/mliap/InP_JCPA2020.mliap.model new file mode 100644 index 0000000000..7ef9039ba2 --- /dev/null +++ b/examples/mliap/InP_JCPA2020.mliap.model @@ -0,0 +1,485 @@ +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +2 241 + 0.000000000000 # B[0] Block = 1 Type = In + -0.000666721868 # B[1, 0, 0, 0] Block = 1 Type = In + 0.032408881964 # B[2, 1, 0, 1] Block = 1 Type = In + 0.182277739455 # B[3, 1, 1, 2] Block = 1 Type = In + 0.001455902168 # B[4, 2, 0, 2] Block = 1 Type = In + 0.086259367737 # B[5, 2, 1, 3] Block = 1 Type = In + -0.044840628371 # B[6, 2, 2, 2] Block = 1 Type = In + -0.175973261191 # B[7, 2, 2, 4] Block = 1 Type = In + -0.052429169415 # B[8, 3, 0, 3] Block = 1 Type = In + 0.195529228497 # B[9, 3, 1, 4] Block = 1 Type = In + 0.078718744520 # B[10, 3, 2, 3] Block = 1 Type = In + -0.688127658121 # B[11, 3, 2, 5] Block = 1 Type = In + 0.059084058400 # B[12, 3, 3, 4] Block = 1 Type = In + 0.006795099274 # B[13, 3, 3, 6] Block = 1 Type = In + -0.043061553886 # B[14, 4, 0, 4] Block = 1 Type = In + -0.046619800530 # B[15, 4, 1, 5] Block = 1 Type = In + -0.117451659827 # B[16, 4, 2, 4] Block = 1 Type = In + -0.233615100720 # B[17, 4, 2, 6] Block = 1 Type = In + 0.015358771114 # B[18, 4, 3, 5] Block = 1 Type = In + 0.022474133984 # B[19, 4, 4, 4] Block = 1 Type = In + 0.002165850235 # B[20, 4, 4, 6] Block = 1 Type = In + 0.003458938546 # B[21, 5, 0, 5] Block = 1 Type = In + -0.053507775670 # B[22, 5, 1, 6] Block = 1 Type = In + 0.120989101467 # B[23, 5, 2, 5] Block = 1 Type = In + 0.092637875162 # B[24, 5, 3, 6] Block = 1 Type = In + 0.071459233521 # B[25, 5, 4, 5] Block = 1 Type = In + 0.086291858607 # B[26, 5, 5, 6] Block = 1 Type = In + 0.006749966752 # B[27, 6, 0, 6] Block = 1 Type = In + 0.144917284093 # B[28, 6, 2, 6] Block = 1 Type = In + 0.055178211309 # B[29, 6, 4, 6] Block = 1 Type = In + -0.005619133266 # B[30, 6, 6, 6] Block = 1 Type = In + 0.005430513632 # B[1, 0, 0, 0] Block = 2 Type = In + 0.057269488101 # B[2, 1, 0, 1] Block = 2 Type = In + 0.320412300575 # B[3, 1, 1, 2] Block = 2 Type = In + 0.035481869944 # B[4, 2, 0, 2] Block = 2 Type = In + 0.111076763087 # B[5, 2, 1, 3] Block = 2 Type = In + 0.039770598731 # B[6, 2, 2, 2] Block = 2 Type = In + 0.141315510383 # B[7, 2, 2, 4] Block = 2 Type = In + 0.067792661762 # B[8, 3, 0, 3] Block = 2 Type = In + -0.080858457946 # B[9, 3, 1, 4] Block = 2 Type = In + 0.258942062632 # B[10, 3, 2, 3] Block = 2 Type = In + 0.061756985062 # B[11, 3, 2, 5] Block = 2 Type = In + -0.112424676196 # B[12, 3, 3, 4] Block = 2 Type = In + 0.168376857205 # B[13, 3, 3, 6] Block = 2 Type = In + -0.029743698629 # B[14, 4, 0, 4] Block = 2 Type = In + -0.093967263289 # B[15, 4, 1, 5] Block = 2 Type = In + 0.137229827290 # B[16, 4, 2, 4] Block = 2 Type = In + 0.056897919200 # B[17, 4, 2, 6] Block = 2 Type = In + 0.095137344320 # B[18, 4, 3, 5] Block = 2 Type = In + -0.008598816416 # B[19, 4, 4, 4] Block = 2 Type = In + 0.038890602482 # B[20, 4, 4, 6] Block = 2 Type = In + -0.034624751006 # B[21, 5, 0, 5] Block = 2 Type = In + -0.282625695473 # B[22, 5, 1, 6] Block = 2 Type = In + 0.103089891872 # B[23, 5, 2, 5] Block = 2 Type = In + -0.024380802146 # B[24, 5, 3, 6] Block = 2 Type = In + -0.063847809434 # B[25, 5, 4, 5] Block = 2 Type = In + -0.024896682749 # B[26, 5, 5, 6] Block = 2 Type = In + 0.000464369553 # B[27, 6, 0, 6] Block = 2 Type = In + 0.082229290277 # B[28, 6, 2, 6] Block = 2 Type = In + -0.008875503360 # B[29, 6, 4, 6] Block = 2 Type = In + -0.009039017094 # B[30, 6, 6, 6] Block = 2 Type = In + 0.005430513686 # B[1, 0, 0, 0] Block = 3 Type = In + -0.004352445887 # B[2, 1, 0, 1] Block = 3 Type = In + 0.149882860704 # B[3, 1, 1, 2] Block = 3 Type = In + -0.015528472583 # B[4, 2, 0, 2] Block = 3 Type = In + 0.558662861756 # B[5, 2, 1, 3] Block = 3 Type = In + 0.039770598731 # B[6, 2, 2, 2] Block = 3 Type = In + 0.179060667136 # B[7, 2, 2, 4] Block = 3 Type = In + 0.034759981675 # B[8, 3, 0, 3] Block = 3 Type = In + 0.603083480153 # B[9, 3, 1, 4] Block = 3 Type = In + 0.176946655350 # B[10, 3, 2, 3] Block = 3 Type = In + 0.165639632803 # B[11, 3, 2, 5] Block = 3 Type = In + 0.055627509305 # B[12, 3, 3, 4] Block = 3 Type = In + 0.049782791218 # B[13, 3, 3, 6] Block = 3 Type = In + 0.036078617029 # B[14, 4, 0, 4] Block = 3 Type = In + 0.064493563641 # B[15, 4, 1, 5] Block = 3 Type = In + 0.149250535822 # B[16, 4, 2, 4] Block = 3 Type = In + -0.060208330201 # B[17, 4, 2, 6] Block = 3 Type = In + 0.105119833648 # B[18, 4, 3, 5] Block = 3 Type = In + -0.008598816416 # B[19, 4, 4, 4] Block = 3 Type = In + 0.041210118888 # B[20, 4, 4, 6] Block = 3 Type = In + -0.002705345469 # B[21, 5, 0, 5] Block = 3 Type = In + 0.170191392493 # B[22, 5, 1, 6] Block = 3 Type = In + 0.226897293272 # B[23, 5, 2, 5] Block = 3 Type = In + 0.013009034793 # B[24, 5, 3, 6] Block = 3 Type = In + -0.020734586320 # B[25, 5, 4, 5] Block = 3 Type = In + -0.018139074523 # B[26, 5, 5, 6] Block = 3 Type = In + -0.016001848874 # B[27, 6, 0, 6] Block = 3 Type = In + 0.016663324316 # B[28, 6, 2, 6] Block = 3 Type = In + -0.024245533697 # B[29, 6, 4, 6] Block = 3 Type = In + -0.009039017094 # B[30, 6, 6, 6] Block = 3 Type = In + -0.005654800687 # B[1, 0, 0, 0] Block = 4 Type = In + -0.071064263981 # B[2, 1, 0, 1] Block = 4 Type = In + -0.009868049046 # B[3, 1, 1, 2] Block = 4 Type = In + -0.061297753855 # B[4, 2, 0, 2] Block = 4 Type = In + -0.239682636759 # B[5, 2, 1, 3] Block = 4 Type = In + 0.015954956116 # B[6, 2, 2, 2] Block = 4 Type = In + 0.176005610703 # B[7, 2, 2, 4] Block = 4 Type = In + -0.081125948095 # B[8, 3, 0, 3] Block = 4 Type = In + -0.170847987084 # B[9, 3, 1, 4] Block = 4 Type = In + 0.242239715395 # B[10, 3, 2, 3] Block = 4 Type = In + 0.082507688294 # B[11, 3, 2, 5] Block = 4 Type = In + 0.247785108978 # B[12, 3, 3, 4] Block = 4 Type = In + -0.008194303016 # B[13, 3, 3, 6] Block = 4 Type = In + 0.014786217107 # B[14, 4, 0, 4] Block = 4 Type = In + -0.096877379511 # B[15, 4, 1, 5] Block = 4 Type = In + 0.164908528605 # B[16, 4, 2, 4] Block = 4 Type = In + 0.151575252604 # B[17, 4, 2, 6] Block = 4 Type = In + 0.099757230122 # B[18, 4, 3, 5] Block = 4 Type = In + 0.035047662350 # B[19, 4, 4, 4] Block = 4 Type = In + 0.007150552805 # B[20, 4, 4, 6] Block = 4 Type = In + 0.019198319779 # B[21, 5, 0, 5] Block = 4 Type = In + -0.127113932870 # B[22, 5, 1, 6] Block = 4 Type = In + 0.114478010571 # B[23, 5, 2, 5] Block = 4 Type = In + 0.050915227324 # B[24, 5, 3, 6] Block = 4 Type = In + 0.096853268510 # B[25, 5, 4, 5] Block = 4 Type = In + 0.067894750884 # B[26, 5, 5, 6] Block = 4 Type = In + -0.002405537661 # B[27, 6, 0, 6] Block = 4 Type = In + 0.058549926350 # B[28, 6, 2, 6] Block = 4 Type = In + 0.009481237049 # B[29, 6, 4, 6] Block = 4 Type = In + -0.008649958571 # B[30, 6, 6, 6] Block = 4 Type = In + 0.005430513686 # B[1, 0, 0, 0] Block = 5 Type = In + 0.057269488102 # B[2, 1, 0, 1] Block = 5 Type = In + 0.149882860704 # B[3, 1, 1, 2] Block = 5 Type = In + 0.035481869944 # B[4, 2, 0, 2] Block = 5 Type = In + 0.378916788823 # B[5, 2, 1, 3] Block = 5 Type = In + 0.039770598731 # B[6, 2, 2, 2] Block = 5 Type = In + 0.179060667136 # B[7, 2, 2, 4] Block = 5 Type = In + 0.067792661762 # B[8, 3, 0, 3] Block = 5 Type = In + 0.272613304171 # B[9, 3, 1, 4] Block = 5 Type = In + 0.258942062632 # B[10, 3, 2, 3] Block = 5 Type = In + 0.100130474069 # B[11, 3, 2, 5] Block = 5 Type = In + 0.055627509305 # B[12, 3, 3, 4] Block = 5 Type = In + 0.049782791218 # B[13, 3, 3, 6] Block = 5 Type = In + -0.029743698629 # B[14, 4, 0, 4] Block = 5 Type = In + -0.013420300314 # B[15, 4, 1, 5] Block = 5 Type = In + 0.137229827290 # B[16, 4, 2, 4] Block = 5 Type = In + -0.034447269506 # B[17, 4, 2, 6] Block = 5 Type = In + -0.033847124314 # B[18, 4, 3, 5] Block = 5 Type = In + -0.008598816416 # B[19, 4, 4, 4] Block = 5 Type = In + 0.041210118888 # B[20, 4, 4, 6] Block = 5 Type = In + -0.034624751006 # B[21, 5, 0, 5] Block = 5 Type = In + 0.041662678638 # B[22, 5, 1, 6] Block = 5 Type = In + 0.103089891872 # B[23, 5, 2, 5] Block = 5 Type = In + -0.044572198386 # B[24, 5, 3, 6] Block = 5 Type = In + -0.063847809434 # B[25, 5, 4, 5] Block = 5 Type = In + -0.018139074523 # B[26, 5, 5, 6] Block = 5 Type = In + 0.000464369553 # B[27, 6, 0, 6] Block = 5 Type = In + 0.082229290277 # B[28, 6, 2, 6] Block = 5 Type = In + -0.008875503360 # B[29, 6, 4, 6] Block = 5 Type = In + -0.009039017094 # B[30, 6, 6, 6] Block = 5 Type = In + -0.005654800687 # B[1, 0, 0, 0] Block = 6 Type = In + -0.001217874195 # B[2, 1, 0, 1] Block = 6 Type = In + -0.009868049046 # B[3, 1, 1, 2] Block = 6 Type = In + -0.092827766060 # B[4, 2, 0, 2] Block = 6 Type = In + 0.439274283244 # B[5, 2, 1, 3] Block = 6 Type = In + 0.015954956116 # B[6, 2, 2, 2] Block = 6 Type = In + 0.176005610703 # B[7, 2, 2, 4] Block = 6 Type = In + 0.102468480364 # B[8, 3, 0, 3] Block = 6 Type = In + 0.674122225402 # B[9, 3, 1, 4] Block = 6 Type = In + 0.072529538087 # B[10, 3, 2, 3] Block = 6 Type = In + 0.330711171466 # B[11, 3, 2, 5] Block = 6 Type = In + 0.247785108978 # B[12, 3, 3, 4] Block = 6 Type = In + -0.008194303016 # B[13, 3, 3, 6] Block = 6 Type = In + 0.052250780232 # B[14, 4, 0, 4] Block = 6 Type = In + 0.374231060518 # B[15, 4, 1, 5] Block = 6 Type = In + 0.326667869620 # B[16, 4, 2, 4] Block = 6 Type = In + 0.079031873518 # B[17, 4, 2, 6] Block = 6 Type = In + 0.224004472527 # B[18, 4, 3, 5] Block = 6 Type = In + 0.035047662350 # B[19, 4, 4, 4] Block = 6 Type = In + 0.007150552805 # B[20, 4, 4, 6] Block = 6 Type = In + 0.040682917098 # B[21, 5, 0, 5] Block = 6 Type = In + 0.046855927526 # B[22, 5, 1, 6] Block = 6 Type = In + 0.219695071346 # B[23, 5, 2, 5] Block = 6 Type = In + -0.001426581661 # B[24, 5, 3, 6] Block = 6 Type = In + 0.028514699601 # B[25, 5, 4, 5] Block = 6 Type = In + 0.067894750884 # B[26, 5, 5, 6] Block = 6 Type = In + -0.049888149225 # B[27, 6, 0, 6] Block = 6 Type = In + 0.009259151039 # B[28, 6, 2, 6] Block = 6 Type = In + 0.003868002128 # B[29, 6, 4, 6] Block = 6 Type = In + -0.008649958571 # B[30, 6, 6, 6] Block = 6 Type = In + -0.005654800692 # B[1, 0, 0, 0] Block = 7 Type = In + -0.071064263981 # B[2, 1, 0, 1] Block = 7 Type = In + -0.085085203640 # B[3, 1, 1, 2] Block = 7 Type = In + -0.061297753855 # B[4, 2, 0, 2] Block = 7 Type = In + 0.223668616358 # B[5, 2, 1, 3] Block = 7 Type = In + 0.015954956116 # B[6, 2, 2, 2] Block = 7 Type = In + 0.033706085249 # B[7, 2, 2, 4] Block = 7 Type = In + -0.081125948095 # B[8, 3, 0, 3] Block = 7 Type = In + -0.005054494008 # B[9, 3, 1, 4] Block = 7 Type = In + 0.242239715395 # B[10, 3, 2, 3] Block = 7 Type = In + -0.000886414104 # B[11, 3, 2, 5] Block = 7 Type = In + 0.059178212190 # B[12, 3, 3, 4] Block = 7 Type = In + 0.008498646326 # B[13, 3, 3, 6] Block = 7 Type = In + 0.014786217107 # B[14, 4, 0, 4] Block = 7 Type = In + -0.178665293356 # B[15, 4, 1, 5] Block = 7 Type = In + 0.164908528605 # B[16, 4, 2, 4] Block = 7 Type = In + -0.117717485069 # B[17, 4, 2, 6] Block = 7 Type = In + 0.146739677531 # B[18, 4, 3, 5] Block = 7 Type = In + 0.035047662350 # B[19, 4, 4, 4] Block = 7 Type = In + 0.088770688382 # B[20, 4, 4, 6] Block = 7 Type = In + 0.019198319779 # B[21, 5, 0, 5] Block = 7 Type = In + -0.148162265312 # B[22, 5, 1, 6] Block = 7 Type = In + 0.114478010571 # B[23, 5, 2, 5] Block = 7 Type = In + 0.114731400461 # B[24, 5, 3, 6] Block = 7 Type = In + 0.096853268510 # B[25, 5, 4, 5] Block = 7 Type = In + 0.031183854107 # B[26, 5, 5, 6] Block = 7 Type = In + -0.002405537661 # B[27, 6, 0, 6] Block = 7 Type = In + 0.058549926350 # B[28, 6, 2, 6] Block = 7 Type = In + 0.009481237049 # B[29, 6, 4, 6] Block = 7 Type = In + -0.008649958571 # B[30, 6, 6, 6] Block = 7 Type = In + 0.017733403092 # B[1, 0, 0, 0] Block = 8 Type = In + 0.015168905151 # B[2, 1, 0, 1] Block = 8 Type = In + -0.212358294308 # B[3, 1, 1, 2] Block = 8 Type = In + 0.115608035432 # B[4, 2, 0, 2] Block = 8 Type = In + 0.128621845177 # B[5, 2, 1, 3] Block = 8 Type = In + -0.055682216710 # B[6, 2, 2, 2] Block = 8 Type = In + 0.168986321733 # B[7, 2, 2, 4] Block = 8 Type = In + -0.087186888529 # B[8, 3, 0, 3] Block = 8 Type = In + 0.378810692322 # B[9, 3, 1, 4] Block = 8 Type = In + 0.036128510376 # B[10, 3, 2, 3] Block = 8 Type = In + 0.179888488204 # B[11, 3, 2, 5] Block = 8 Type = In + -0.001405954437 # B[12, 3, 3, 4] Block = 8 Type = In + 0.010551104009 # B[13, 3, 3, 6] Block = 8 Type = In + -0.059381370200 # B[14, 4, 0, 4] Block = 8 Type = In + 0.475432753620 # B[15, 4, 1, 5] Block = 8 Type = In + 0.095868282640 # B[16, 4, 2, 4] Block = 8 Type = In + 0.106524975238 # B[17, 4, 2, 6] Block = 8 Type = In + 0.058941182257 # B[18, 4, 3, 5] Block = 8 Type = In + 0.012512778321 # B[19, 4, 4, 4] Block = 8 Type = In + 0.080549204239 # B[20, 4, 4, 6] Block = 8 Type = In + -0.068536821891 # B[21, 5, 0, 5] Block = 8 Type = In + 0.089459777664 # B[22, 5, 1, 6] Block = 8 Type = In + 0.163187761880 # B[23, 5, 2, 5] Block = 8 Type = In + 0.139719330200 # B[24, 5, 3, 6] Block = 8 Type = In + 0.145095171389 # B[25, 5, 4, 5] Block = 8 Type = In + 0.074157391376 # B[26, 5, 5, 6] Block = 8 Type = In + 0.018646775951 # B[27, 6, 0, 6] Block = 8 Type = In + 0.035882498943 # B[28, 6, 2, 6] Block = 8 Type = In + 0.050420424420 # B[29, 6, 4, 6] Block = 8 Type = In + 0.009994821144 # B[30, 6, 6, 6] Block = 8 Type = In + 0.000000000000 # B[0] Block = 1 Type = P + -0.002987589706 # B[1, 0, 0, 0] Block = 1 Type = P + -0.072158389412 # B[2, 1, 0, 1] Block = 1 Type = P + -0.025322250603 # B[3, 1, 1, 2] Block = 1 Type = P + -0.030241379192 # B[4, 2, 0, 2] Block = 1 Type = P + -0.676287334962 # B[5, 2, 1, 3] Block = 1 Type = P + -0.172216278028 # B[6, 2, 2, 2] Block = 1 Type = P + -0.246535097343 # B[7, 2, 2, 4] Block = 1 Type = P + -0.035782528462 # B[8, 3, 0, 3] Block = 1 Type = P + -0.560641780823 # B[9, 3, 1, 4] Block = 1 Type = P + -0.549579515296 # B[10, 3, 2, 3] Block = 1 Type = P + -0.016920837991 # B[11, 3, 2, 5] Block = 1 Type = P + -0.288447245376 # B[12, 3, 3, 4] Block = 1 Type = P + 0.069076859372 # B[13, 3, 3, 6] Block = 1 Type = P + -0.052298717507 # B[14, 4, 0, 4] Block = 1 Type = P + -0.434250953671 # B[15, 4, 1, 5] Block = 1 Type = P + -0.322043860507 # B[16, 4, 2, 4] Block = 1 Type = P + -0.096837010372 # B[17, 4, 2, 6] Block = 1 Type = P + -0.213169352789 # B[18, 4, 3, 5] Block = 1 Type = P + -0.019566740546 # B[19, 4, 4, 4] Block = 1 Type = P + -0.029415128740 # B[20, 4, 4, 6] Block = 1 Type = P + -0.036591077655 # B[21, 5, 0, 5] Block = 1 Type = P + -0.300384511072 # B[22, 5, 1, 6] Block = 1 Type = P + -0.111126537447 # B[23, 5, 2, 5] Block = 1 Type = P + -0.000209831053 # B[24, 5, 3, 6] Block = 1 Type = P + -0.000023632674 # B[25, 5, 4, 5] Block = 1 Type = P + 0.009497323905 # B[26, 5, 5, 6] Block = 1 Type = P + -0.042287705828 # B[27, 6, 0, 6] Block = 1 Type = P + -0.113311457350 # B[28, 6, 2, 6] Block = 1 Type = P + 0.029574563913 # B[29, 6, 4, 6] Block = 1 Type = P + -0.027748295426 # B[30, 6, 6, 6] Block = 1 Type = P + -0.001747658243 # B[1, 0, 0, 0] Block = 2 Type = P + -0.026182047943 # B[2, 1, 0, 1] Block = 2 Type = P + 0.089481157533 # B[3, 1, 1, 2] Block = 2 Type = P + -0.076525139004 # B[4, 2, 0, 2] Block = 2 Type = P + -0.107925591359 # B[5, 2, 1, 3] Block = 2 Type = P + -0.059117110271 # B[6, 2, 2, 2] Block = 2 Type = P + -0.256324252168 # B[7, 2, 2, 4] Block = 2 Type = P + -0.020755324452 # B[8, 3, 0, 3] Block = 2 Type = P + -0.337284108142 # B[9, 3, 1, 4] Block = 2 Type = P + -0.073956723908 # B[10, 3, 2, 3] Block = 2 Type = P + -0.149119927857 # B[11, 3, 2, 5] Block = 2 Type = P + 0.047627781519 # B[12, 3, 3, 4] Block = 2 Type = P + 0.061394929126 # B[13, 3, 3, 6] Block = 2 Type = P + -0.082660360252 # B[14, 4, 0, 4] Block = 2 Type = P + -0.183225932285 # B[15, 4, 1, 5] Block = 2 Type = P + -0.046981555049 # B[16, 4, 2, 4] Block = 2 Type = P + -0.046846685850 # B[17, 4, 2, 6] Block = 2 Type = P + -0.014388943769 # B[18, 4, 3, 5] Block = 2 Type = P + 0.012133725790 # B[19, 4, 4, 4] Block = 2 Type = P + 0.085321452425 # B[20, 4, 4, 6] Block = 2 Type = P + -0.034945525448 # B[21, 5, 0, 5] Block = 2 Type = P + -0.028326642109 # B[22, 5, 1, 6] Block = 2 Type = P + -0.085701075837 # B[23, 5, 2, 5] Block = 2 Type = P + 0.108257997015 # B[24, 5, 3, 6] Block = 2 Type = P + 0.045837409910 # B[25, 5, 4, 5] Block = 2 Type = P + -0.014180512722 # B[26, 5, 5, 6] Block = 2 Type = P + 0.010756044042 # B[27, 6, 0, 6] Block = 2 Type = P + 0.023429477590 # B[28, 6, 2, 6] Block = 2 Type = P + -0.007794133717 # B[29, 6, 4, 6] Block = 2 Type = P + 0.002019828318 # B[30, 6, 6, 6] Block = 2 Type = P + -0.001747658242 # B[1, 0, 0, 0] Block = 3 Type = P + 0.047070626642 # B[2, 1, 0, 1] Block = 3 Type = P + -0.126595340298 # B[3, 1, 1, 2] Block = 3 Type = P + 0.022286899829 # B[4, 2, 0, 2] Block = 3 Type = P + -0.483695340547 # B[5, 2, 1, 3] Block = 3 Type = P + -0.059117110271 # B[6, 2, 2, 2] Block = 3 Type = P + -0.067694089340 # B[7, 2, 2, 4] Block = 3 Type = P + 0.034974727122 # B[8, 3, 0, 3] Block = 3 Type = P + -0.226290583408 # B[9, 3, 1, 4] Block = 3 Type = P + -0.184699579267 # B[10, 3, 2, 3] Block = 3 Type = P + 0.063122270285 # B[11, 3, 2, 5] Block = 3 Type = P + 0.041271206739 # B[12, 3, 3, 4] Block = 3 Type = P + -0.004229157928 # B[13, 3, 3, 6] Block = 3 Type = P + 0.050689134214 # B[14, 4, 0, 4] Block = 3 Type = P + -0.138276744014 # B[15, 4, 1, 5] Block = 3 Type = P + 0.097985494164 # B[16, 4, 2, 4] Block = 3 Type = P + -0.083537235645 # B[17, 4, 2, 6] Block = 3 Type = P + 0.098390585361 # B[18, 4, 3, 5] Block = 3 Type = P + 0.012133725790 # B[19, 4, 4, 4] Block = 3 Type = P + -0.038067814334 # B[20, 4, 4, 6] Block = 3 Type = P + 0.029636266108 # B[21, 5, 0, 5] Block = 3 Type = P + -0.157117938354 # B[22, 5, 1, 6] Block = 3 Type = P + -0.027712542047 # B[23, 5, 2, 5] Block = 3 Type = P + 0.084730212710 # B[24, 5, 3, 6] Block = 3 Type = P + 0.023437407693 # B[25, 5, 4, 5] Block = 3 Type = P + 0.017747856995 # B[26, 5, 5, 6] Block = 3 Type = P + 0.050161344183 # B[27, 6, 0, 6] Block = 3 Type = P + -0.098577816149 # B[28, 6, 2, 6] Block = 3 Type = P + -0.046997533090 # B[29, 6, 4, 6] Block = 3 Type = P + 0.002019828318 # B[30, 6, 6, 6] Block = 3 Type = P + -0.003152987881 # B[1, 0, 0, 0] Block = 4 Type = P + 0.014621850469 # B[2, 1, 0, 1] Block = 4 Type = P + 0.098860641022 # B[3, 1, 1, 2] Block = 4 Type = P + 0.069546644549 # B[4, 2, 0, 2] Block = 4 Type = P + 0.180804700658 # B[5, 2, 1, 3] Block = 4 Type = P + 0.034244852922 # B[6, 2, 2, 2] Block = 4 Type = P + 0.044579888557 # B[7, 2, 2, 4] Block = 4 Type = P + 0.001526239292 # B[8, 3, 0, 3] Block = 4 Type = P + 0.203861850923 # B[9, 3, 1, 4] Block = 4 Type = P + 0.021679218740 # B[10, 3, 2, 3] Block = 4 Type = P + 0.185899872703 # B[11, 3, 2, 5] Block = 4 Type = P + -0.063472862380 # B[12, 3, 3, 4] Block = 4 Type = P + -0.015662648111 # B[13, 3, 3, 6] Block = 4 Type = P + 0.076209869795 # B[14, 4, 0, 4] Block = 4 Type = P + -0.050213789331 # B[15, 4, 1, 5] Block = 4 Type = P + 0.038175316256 # B[16, 4, 2, 4] Block = 4 Type = P + 0.041946424186 # B[17, 4, 2, 6] Block = 4 Type = P + -0.023902281235 # B[18, 4, 3, 5] Block = 4 Type = P + 0.008537822812 # B[19, 4, 4, 4] Block = 4 Type = P + 0.039989757491 # B[20, 4, 4, 6] Block = 4 Type = P + 0.022210126714 # B[21, 5, 0, 5] Block = 4 Type = P + 0.010855258243 # B[22, 5, 1, 6] Block = 4 Type = P + 0.021570527219 # B[23, 5, 2, 5] Block = 4 Type = P + -0.119983534986 # B[24, 5, 3, 6] Block = 4 Type = P + -0.019726935513 # B[25, 5, 4, 5] Block = 4 Type = P + -0.015720476443 # B[26, 5, 5, 6] Block = 4 Type = P + -0.024522109113 # B[27, 6, 0, 6] Block = 4 Type = P + -0.051478859538 # B[28, 6, 2, 6] Block = 4 Type = P + 0.017216285614 # B[29, 6, 4, 6] Block = 4 Type = P + -0.003565797401 # B[30, 6, 6, 6] Block = 4 Type = P + -0.001747658242 # B[1, 0, 0, 0] Block = 5 Type = P + -0.026182047943 # B[2, 1, 0, 1] Block = 5 Type = P + -0.126595340298 # B[3, 1, 1, 2] Block = 5 Type = P + -0.076525139004 # B[4, 2, 0, 2] Block = 5 Type = P + -0.157814129312 # B[5, 2, 1, 3] Block = 5 Type = P + -0.059117110271 # B[6, 2, 2, 2] Block = 5 Type = P + -0.067694089340 # B[7, 2, 2, 4] Block = 5 Type = P + -0.020755324452 # B[8, 3, 0, 3] Block = 5 Type = P + -0.216746420586 # B[9, 3, 1, 4] Block = 5 Type = P + -0.073956723908 # B[10, 3, 2, 3] Block = 5 Type = P + -0.263593571569 # B[11, 3, 2, 5] Block = 5 Type = P + 0.041271206739 # B[12, 3, 3, 4] Block = 5 Type = P + -0.004229157928 # B[13, 3, 3, 6] Block = 5 Type = P + -0.082660360252 # B[14, 4, 0, 4] Block = 5 Type = P + -0.305032662779 # B[15, 4, 1, 5] Block = 5 Type = P + -0.046981555049 # B[16, 4, 2, 4] Block = 5 Type = P + -0.187955078269 # B[17, 4, 2, 6] Block = 5 Type = P + -0.121808447372 # B[18, 4, 3, 5] Block = 5 Type = P + 0.012133725790 # B[19, 4, 4, 4] Block = 5 Type = P + -0.038067814334 # B[20, 4, 4, 6] Block = 5 Type = P + -0.034945525448 # B[21, 5, 0, 5] Block = 5 Type = P + -0.226555787648 # B[22, 5, 1, 6] Block = 5 Type = P + -0.085701075837 # B[23, 5, 2, 5] Block = 5 Type = P + -0.121081797087 # B[24, 5, 3, 6] Block = 5 Type = P + 0.045837409910 # B[25, 5, 4, 5] Block = 5 Type = P + 0.017747856995 # B[26, 5, 5, 6] Block = 5 Type = P + 0.010756044042 # B[27, 6, 0, 6] Block = 5 Type = P + 0.023429477590 # B[28, 6, 2, 6] Block = 5 Type = P + -0.007794133717 # B[29, 6, 4, 6] Block = 5 Type = P + 0.002019828318 # B[30, 6, 6, 6] Block = 5 Type = P + -0.003152987881 # B[1, 0, 0, 0] Block = 6 Type = P + -0.003431824919 # B[2, 1, 0, 1] Block = 6 Type = P + 0.098860641022 # B[3, 1, 1, 2] Block = 6 Type = P + -0.049867192647 # B[4, 2, 0, 2] Block = 6 Type = P + 0.130247785083 # B[5, 2, 1, 3] Block = 6 Type = P + 0.034244852922 # B[6, 2, 2, 2] Block = 6 Type = P + 0.044579888557 # B[7, 2, 2, 4] Block = 6 Type = P + 0.051064338359 # B[8, 3, 0, 3] Block = 6 Type = P + -0.034769100897 # B[9, 3, 1, 4] Block = 6 Type = P + -0.055923569507 # B[10, 3, 2, 3] Block = 6 Type = P + 0.101065442824 # B[11, 3, 2, 5] Block = 6 Type = P + -0.063472862380 # B[12, 3, 3, 4] Block = 6 Type = P + -0.015662648111 # B[13, 3, 3, 6] Block = 6 Type = P + -0.020942037301 # B[14, 4, 0, 4] Block = 6 Type = P + 0.057686438719 # B[15, 4, 1, 5] Block = 6 Type = P + 0.061281723131 # B[16, 4, 2, 4] Block = 6 Type = P + 0.041003214284 # B[17, 4, 2, 6] Block = 6 Type = P + 0.104968889582 # B[18, 4, 3, 5] Block = 6 Type = P + 0.008537822812 # B[19, 4, 4, 4] Block = 6 Type = P + 0.039989757491 # B[20, 4, 4, 6] Block = 6 Type = P + 0.058310887739 # B[21, 5, 0, 5] Block = 6 Type = P + 0.043642228702 # B[22, 5, 1, 6] Block = 6 Type = P + 0.119827018636 # B[23, 5, 2, 5] Block = 6 Type = P + -0.017878741482 # B[24, 5, 3, 6] Block = 6 Type = P + 0.013615249763 # B[25, 5, 4, 5] Block = 6 Type = P + -0.015720476443 # B[26, 5, 5, 6] Block = 6 Type = P + 0.028210503571 # B[27, 6, 0, 6] Block = 6 Type = P + 0.138982983531 # B[28, 6, 2, 6] Block = 6 Type = P + 0.020848948259 # B[29, 6, 4, 6] Block = 6 Type = P + -0.003565797401 # B[30, 6, 6, 6] Block = 6 Type = P + -0.003152987876 # B[1, 0, 0, 0] Block = 7 Type = P + 0.014621850469 # B[2, 1, 0, 1] Block = 7 Type = P + 0.136917412546 # B[3, 1, 1, 2] Block = 7 Type = P + 0.069546644549 # B[4, 2, 0, 2] Block = 7 Type = P + 0.134471034367 # B[5, 2, 1, 3] Block = 7 Type = P + 0.034244852922 # B[6, 2, 2, 2] Block = 7 Type = P + 0.073714102880 # B[7, 2, 2, 4] Block = 7 Type = P + 0.001526239292 # B[8, 3, 0, 3] Block = 7 Type = P + 0.029314077312 # B[9, 3, 1, 4] Block = 7 Type = P + 0.021679218740 # B[10, 3, 2, 3] Block = 7 Type = P + 0.005384023182 # B[11, 3, 2, 5] Block = 7 Type = P + 0.029912954139 # B[12, 3, 3, 4] Block = 7 Type = P + 0.036308629380 # B[13, 3, 3, 6] Block = 7 Type = P + 0.076209869795 # B[14, 4, 0, 4] Block = 7 Type = P + -0.095659211777 # B[15, 4, 1, 5] Block = 7 Type = P + 0.038175316256 # B[16, 4, 2, 4] Block = 7 Type = P + -0.054559433157 # B[17, 4, 2, 6] Block = 7 Type = P + -0.079205893849 # B[18, 4, 3, 5] Block = 7 Type = P + 0.008537822812 # B[19, 4, 4, 4] Block = 7 Type = P + 0.072688459278 # B[20, 4, 4, 6] Block = 7 Type = P + 0.022210126714 # B[21, 5, 0, 5] Block = 7 Type = P + 0.032318678024 # B[22, 5, 1, 6] Block = 7 Type = P + 0.021570527219 # B[23, 5, 2, 5] Block = 7 Type = P + 0.038881258714 # B[24, 5, 3, 6] Block = 7 Type = P + -0.019726935513 # B[25, 5, 4, 5] Block = 7 Type = P + 0.030961312127 # B[26, 5, 5, 6] Block = 7 Type = P + -0.024522109113 # B[27, 6, 0, 6] Block = 7 Type = P + -0.051478859538 # B[28, 6, 2, 6] Block = 7 Type = P + 0.017216285614 # B[29, 6, 4, 6] Block = 7 Type = P + -0.003565797401 # B[30, 6, 6, 6] Block = 7 Type = P + 0.000279543258 # B[1, 0, 0, 0] Block = 8 Type = P + 0.031561006068 # B[2, 1, 0, 1] Block = 8 Type = P + 0.164297477481 # B[3, 1, 1, 2] Block = 8 Type = P + 0.020394103829 # B[4, 2, 0, 2] Block = 8 Type = P + -0.136924810031 # B[5, 2, 1, 3] Block = 8 Type = P + 0.011488762740 # B[6, 2, 2, 2] Block = 8 Type = P + -0.174577132596 # B[7, 2, 2, 4] Block = 8 Type = P + -0.104272988787 # B[8, 3, 0, 3] Block = 8 Type = P + -0.126737159959 # B[9, 3, 1, 4] Block = 8 Type = P + 0.006355291540 # B[10, 3, 2, 3] Block = 8 Type = P + -0.116847920709 # B[11, 3, 2, 5] Block = 8 Type = P + 0.093716628094 # B[12, 3, 3, 4] Block = 8 Type = P + -0.015327516258 # B[13, 3, 3, 6] Block = 8 Type = P + -0.015071645969 # B[14, 4, 0, 4] Block = 8 Type = P + 0.054380965184 # B[15, 4, 1, 5] Block = 8 Type = P + 0.113826098444 # B[16, 4, 2, 4] Block = 8 Type = P + 0.012970945123 # B[17, 4, 2, 6] Block = 8 Type = P + -0.047881183904 # B[18, 4, 3, 5] Block = 8 Type = P + -0.010520024430 # B[19, 4, 4, 4] Block = 8 Type = P + -0.077321883428 # B[20, 4, 4, 6] Block = 8 Type = P + -0.087378280220 # B[21, 5, 0, 5] Block = 8 Type = P + -0.221370705680 # B[22, 5, 1, 6] Block = 8 Type = P + 0.004554405520 # B[23, 5, 2, 5] Block = 8 Type = P + -0.164836672985 # B[24, 5, 3, 6] Block = 8 Type = P + -0.015080843808 # B[25, 5, 4, 5] Block = 8 Type = P + -0.010907038616 # B[26, 5, 5, 6] Block = 8 Type = P + -0.022228801431 # B[27, 6, 0, 6] Block = 8 Type = P + -0.055154587470 # B[28, 6, 2, 6] Block = 8 Type = P + 0.007347917376 # B[29, 6, 4, 6] Block = 8 Type = P + -0.009369956559 # B[30, 6, 6, 6] Block = 8 Type = P diff --git a/examples/mliap/Ta06A.mliap b/examples/mliap/Ta06A.mliap index 5c1776d01e..21d3bab6e3 100644 --- a/examples/mliap/Ta06A.mliap +++ b/examples/mliap/Ta06A.mliap @@ -1,4 +1,4 @@ -# DATE: 2020-04-04 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) # Definition of SNAP potential Ta_Cand06A # Assumes 1 LAMMPS atom type diff --git a/examples/mliap/Ta06A.mliap.descriptor b/examples/mliap/Ta06A.mliap.descriptor index 6e7a10f9d1..481ebf7e44 100644 --- a/examples/mliap/Ta06A.mliap.descriptor +++ b/examples/mliap/Ta06A.mliap.descriptor @@ -1,4 +1,4 @@ -# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) # LAMMPS SNAP parameters for Ta_Cand06A diff --git a/examples/mliap/Ta06A.mliap.model b/examples/mliap/Ta06A.mliap.model index 12761d94c8..a7e36f1648 100644 --- a/examples/mliap/Ta06A.mliap.model +++ b/examples/mliap/Ta06A.mliap.model @@ -1,4 +1,4 @@ -# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) # LAMMPS SNAP coefficients for Ta_Cand06A diff --git a/examples/mliap/W.quadratic.mliap b/examples/mliap/W.quadratic.mliap index a2fc84c50f..36cb352f84 100644 --- a/examples/mliap/W.quadratic.mliap +++ b/examples/mliap/W.quadratic.mliap @@ -1,3 +1,5 @@ +# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none + # Definition of SNAP+ZBL potential. variable zblcutinner equal 4 variable zblcutouter equal 4.8 diff --git a/examples/mliap/W.quadratic.mliap.descriptor b/examples/mliap/W.quadratic.mliap.descriptor index cc47dafd39..7db38ba7f5 100644 --- a/examples/mliap/W.quadratic.mliap.descriptor +++ b/examples/mliap/W.quadratic.mliap.descriptor @@ -1,3 +1,5 @@ +# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none + # required rcutfac 4.73442 diff --git a/examples/mliap/W.quadratic.mliap.model b/examples/mliap/W.quadratic.mliap.model index 713e07eb61..d16b535fb9 100644 --- a/examples/mliap/W.quadratic.mliap.model +++ b/examples/mliap/W.quadratic.mliap.model @@ -1,3 +1,5 @@ +# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none + # LAMMPS SNAP coefficients for Quadratic W # nelements ncoeff diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap b/examples/mliap/WBe_Wood_PRB2019.mliap index 0ad35747dc..9298bf8fdf 100644 --- a/examples/mliap/WBe_Wood_PRB2019.mliap +++ b/examples/mliap/WBe_Wood_PRB2019.mliap @@ -1,4 +1,4 @@ -# DATE: 2020-04-04 CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) # Definition of SNAP+ZBL potential. variable zblcutinner equal 4 variable zblcutouter equal 4.8 diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor b/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor index 855e5ec97a..0ba762fcfa 100644 --- a/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor +++ b/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor @@ -1,3 +1,5 @@ +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) + # required rcutfac 4.8123 diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.model b/examples/mliap/WBe_Wood_PRB2019.mliap.model index 6b96561ed0..b25398e91a 100644 --- a/examples/mliap/WBe_Wood_PRB2019.mliap.model +++ b/examples/mliap/WBe_Wood_PRB2019.mliap.model @@ -1,3 +1,4 @@ +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) # LAMMPS SNAP coefficients for WBe # nelements ncoeff diff --git a/examples/mliap/in.mliap.Ta06A b/examples/mliap/in.mliap.snap.Ta06A similarity index 90% rename from examples/mliap/in.mliap.Ta06A rename to examples/mliap/in.mliap.snap.Ta06A index 2c8c7932df..3d94d5c9fc 100644 --- a/examples/mliap/in.mliap.Ta06A +++ b/examples/mliap/in.mliap.snap.Ta06A @@ -1,4 +1,4 @@ -# Demonstrate SNAP Ta potential +# Demonstrate MLIAP interface to kinear SNAP potential # Initialize simulation @@ -47,7 +47,7 @@ neigh_modify once no every 1 delay 0 check yes # Run MD -velocity all create 300.0 4928459 +velocity all create 300.0 4928459 loop geom fix 1 all nve run ${nsteps} diff --git a/examples/mliap/in.mliap.WBe.PRB2019 b/examples/mliap/in.mliap.snap.WBe.PRB2019 similarity index 92% rename from examples/mliap/in.mliap.WBe.PRB2019 rename to examples/mliap/in.mliap.snap.WBe.PRB2019 index 24a212b2c6..84d40d321f 100644 --- a/examples/mliap/in.mliap.WBe.PRB2019 +++ b/examples/mliap/in.mliap.snap.WBe.PRB2019 @@ -1,4 +1,4 @@ -# Demonstrate SNAP W-Be potential +# Demonstrate MLIAP interface to SNAP W-Be potential # Initialize simulation @@ -50,7 +50,7 @@ neigh_modify once no every 1 delay 0 check yes # Run MD -velocity all create 300.0 4928459 +velocity all create 300.0 4928459 loop geom fix 1 all nve run ${nsteps} diff --git a/examples/mliap/in.mliap.snap.chem b/examples/mliap/in.mliap.snap.chem new file mode 100644 index 0000000000..499601059e --- /dev/null +++ b/examples/mliap/in.mliap.snap.chem @@ -0,0 +1,46 @@ +# Demonstrate MLIAP interface to ChemSNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 5.83 +units metal + +# generate the box and atom positions using a FCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice diamond $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 2 box +create_atoms 1 box basis 5 2 basis 6 2 basis 7 2 basis 8 2 + +mass 1 114.76 +mass 2 30.98 + +# choose potential + +include InP_JCPA2020.mliap + +# Setup output + +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} + diff --git a/examples/mliap/in.mliap.quadratic b/examples/mliap/in.mliap.snap.quadratic similarity index 88% rename from examples/mliap/in.mliap.quadratic rename to examples/mliap/in.mliap.snap.quadratic index 636d0de3e6..9f7d4d702d 100644 --- a/examples/mliap/in.mliap.quadratic +++ b/examples/mliap/in.mliap.snap.quadratic @@ -1,9 +1,10 @@ -# Demonstrate SNAP Ta potential + +# Demonstrate MLIAP interface to quadratic SNAP potential # Initialize simulation variable nsteps index 100 -variable nrep equal 1 +variable nrep equal 4 variable a equal 3.1803 units metal @@ -48,7 +49,7 @@ neigh_modify once no every 1 delay 0 check no # Run MD -velocity all create 300.0 4928459 +velocity all create 300.0 4928459 loop geom fix 1 all nve run ${nsteps} diff --git a/examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.1 b/examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.1 new file mode 100644 index 0000000000..2a6d16a187 --- /dev/null +++ b/examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.1 @@ -0,0 +1,156 @@ +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to kinear SNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.316 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.316 +Lattice spacing in x,y,z = 3.316 3.316 3.316 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0 0.0 0.0) to (13.264 13.264 13.264) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 128 atoms + create_atoms CPU = 0.000 seconds + +mass 1 180.88 + +# choose potential + +include Ta06A.mliap +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# Definition of SNAP potential Ta_Cand06A +# Assumes 1 LAMMPS atom type + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 + +# Specify hybrid with SNAP, ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.8 mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +Reading potential file Ta06A.mliap.model with DATE: 2014-09-05 +Reading potential file Ta06A.mliap.descriptor with DATE: 2014-09-05 +SNAP keyword rcutfac 4.67637 +SNAP keyword twojmax 6 +SNAP keyword nelems 1 +SNAP keyword elems Ta +SNAP keyword radelems 0.5 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 0 +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff 1 1 zbl 73 ${zblz} +pair_coeff 1 1 zbl 73 73 +pair_coeff * * mliap Ta + + +# Setup output + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8 + ghost atom cutoff = 5.8 + binsize = 2.9, bins = 5 5 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair mliap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.592 | 6.592 | 6.592 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -11.85157 -11.85157 -11.813095 2717.1661 -2717.1661 + 10 296.01467 -11.851059 -11.851059 -11.813095 2697.4796 -2697.4796 + 20 284.53666 -11.849587 -11.849587 -11.813095 2289.1527 -2289.1527 + 30 266.51577 -11.847275 -11.847275 -11.813095 1851.7131 -1851.7131 + 40 243.05007 -11.844266 -11.844266 -11.813095 1570.684 -1570.684 + 50 215.51032 -11.840734 -11.840734 -11.813094 1468.1899 -1468.1899 + 60 185.48331 -11.836883 -11.836883 -11.813094 1524.8757 -1524.8757 + 70 154.6736 -11.832931 -11.832931 -11.813094 1698.3351 -1698.3351 + 80 124.79303 -11.829099 -11.829099 -11.813094 1947.0715 -1947.0715 + 90 97.448054 -11.825592 -11.825592 -11.813094 2231.9563 -2231.9563 + 100 74.035418 -11.822589 -11.822589 -11.813094 2515.8526 -2515.8526 +Loop time of 0.931876 on 1 procs for 100 steps with 128 atoms + +Performance: 4.636 ns/day, 5.177 hours/ns, 107.310 timesteps/s +99.6% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.93067 | 0.93067 | 0.93067 | 0.0 | 99.87 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.000377 | 0.000377 | 0.000377 | 0.0 | 0.04 +Output | 0.000467 | 0.000467 | 0.000467 | 0.0 | 0.05 +Modify | 0.000162 | 0.000162 | 0.000162 | 0.0 | 0.02 +Other | | 0.000196 | | | 0.02 + +Nlocal: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 727 ave 727 max 727 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3712 ave 3712 max 3712 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 7424 ave 7424 max 7424 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7424 +Ave neighs/atom = 58 +Neighbor list builds = 0 +Dangerous builds = 0 + +Total wall time: 0:00:00 diff --git a/examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.4 b/examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.4 new file mode 100644 index 0000000000..e2778b21ec --- /dev/null +++ b/examples/mliap/log.21Jun20.mliap.snap.Ta06A.g++.4 @@ -0,0 +1,156 @@ +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to kinear SNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.316 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.316 +Lattice spacing in x,y,z = 3.316 3.316 3.316 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0 0.0 0.0) to (13.264 13.264 13.264) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 128 atoms + create_atoms CPU = 0.000 seconds + +mass 1 180.88 + +# choose potential + +include Ta06A.mliap +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# Definition of SNAP potential Ta_Cand06A +# Assumes 1 LAMMPS atom type + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 + +# Specify hybrid with SNAP, ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.8 mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +Reading potential file Ta06A.mliap.model with DATE: 2014-09-05 +Reading potential file Ta06A.mliap.descriptor with DATE: 2014-09-05 +SNAP keyword rcutfac 4.67637 +SNAP keyword twojmax 6 +SNAP keyword nelems 1 +SNAP keyword elems Ta +SNAP keyword radelems 0.5 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 0 +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff 1 1 zbl 73 ${zblz} +pair_coeff 1 1 zbl 73 73 +pair_coeff * * mliap Ta + + +# Setup output + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8 + ghost atom cutoff = 5.8 + binsize = 2.9, bins = 5 5 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair mliap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.528 | 6.528 | 6.528 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -11.85157 -11.85157 -11.813095 2717.1661 -2717.1661 + 10 296.01467 -11.851059 -11.851059 -11.813095 2697.4796 -2697.4796 + 20 284.53666 -11.849587 -11.849587 -11.813095 2289.1527 -2289.1527 + 30 266.51577 -11.847275 -11.847275 -11.813095 1851.7131 -1851.7131 + 40 243.05007 -11.844266 -11.844266 -11.813095 1570.684 -1570.684 + 50 215.51032 -11.840734 -11.840734 -11.813094 1468.1899 -1468.1899 + 60 185.48331 -11.836883 -11.836883 -11.813094 1524.8757 -1524.8757 + 70 154.6736 -11.832931 -11.832931 -11.813094 1698.3351 -1698.3351 + 80 124.79303 -11.829099 -11.829099 -11.813094 1947.0715 -1947.0715 + 90 97.448054 -11.825592 -11.825592 -11.813094 2231.9563 -2231.9563 + 100 74.035418 -11.822589 -11.822589 -11.813094 2515.8526 -2515.8526 +Loop time of 0.256886 on 4 procs for 100 steps with 128 atoms + +Performance: 16.817 ns/day, 1.427 hours/ns, 389.278 timesteps/s +99.6% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.24436 | 0.24636 | 0.25027 | 0.5 | 95.90 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.005652 | 0.0095395 | 0.01154 | 2.4 | 3.71 +Output | 0.000472 | 0.0005085 | 0.000617 | 0.0 | 0.20 +Modify | 6.2e-05 | 6.75e-05 | 7.3e-05 | 0.0 | 0.03 +Other | | 0.0004105 | | | 0.16 + +Nlocal: 32 ave 32 max 32 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 431 ave 431 max 431 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 928 ave 928 max 928 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 1856 ave 1856 max 1856 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7424 +Ave neighs/atom = 58 +Neighbor list builds = 0 +Dangerous builds = 0 + +Total wall time: 0:00:00 diff --git a/examples/mliap/log.snap.WBe.ref b/examples/mliap/log.21Jun20.mliap.snap.WBe.PRB201.g++.1 similarity index 52% rename from examples/mliap/log.snap.WBe.ref rename to examples/mliap/log.21Jun20.mliap.snap.WBe.PRB201.g++.1 index f689c7e6b1..b83422657c 100644 --- a/examples/mliap/log.snap.WBe.ref +++ b/examples/mliap/log.21Jun20.mliap.snap.WBe.PRB201.g++.1 @@ -1,5 +1,5 @@ -LAMMPS (19 Mar 2020) -# Demonstrate SNAP W-Be potential +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to SNAP W-Be potential # Initialize simulation @@ -27,24 +27,23 @@ region box block 0 4 0 ${ny} 0 ${nz} region box block 0 4 0 4 0 ${nz} region box block 0 4 0 4 0 4 create_box 2 box -Created orthogonal box = (0 0 0) to (12.7212 12.7212 12.7212) +Created orthogonal box = (0.0 0.0 0.0) to (12.7212 12.7212 12.7212) 1 by 1 by 1 MPI processor grid create_atoms 1 box Created 128 atoms - create_atoms CPU = 0.000231 secs + create_atoms CPU = 0.000 seconds mass 1 183.84 mass 2 9.012182 set group all type/fraction 2 0.05 3590153 # Change 5% of W to He - 5 settings made for type/fraction -group tungsten type 1 + 5 settings made for type/fractiongroup tungsten type 1 123 atoms in group tungsten group beryllium type 2 5 atoms in group beryllium # choose potential -include WBe_Wood_PRB2019.snap -# DATE: 2019-09-18 CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) +include WBe_Wood_PRB2019.mliap +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) # Definition of SNAP+ZBL potential. variable zblcutinner equal 4 variable zblcutouter equal 4.8 @@ -53,9 +52,20 @@ variable zblz2 equal 4 # Specify hybrid with SNAP and ZBL -pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap -pair_style hybrid/overlay zbl 4 ${zblcutouter} snap -pair_style hybrid/overlay zbl 4 4.8 snap +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.8 mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +Reading potential file WBe_Wood_PRB2019.mliap.model with DATE: 2019-09-18 +Reading potential file WBe_Wood_PRB2019.mliap.descriptor with DATE: 2019-09-18 +SNAP keyword rcutfac 4.8123 +SNAP keyword twojmax 8 +SNAP keyword nelems 2 +SNAP keyword elems W +SNAP keyword radelems 0.5 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 1 pair_coeff 1 1 zbl ${zblz1} ${zblz1} pair_coeff 1 1 zbl 74 ${zblz1} pair_coeff 1 1 zbl 74 74 @@ -65,15 +75,7 @@ pair_coeff 1 2 zbl 74 4 pair_coeff 2 2 zbl ${zblz2} ${zblz2} pair_coeff 2 2 zbl 4 ${zblz2} pair_coeff 2 2 zbl 4 4 -pair_coeff * * snap WBe_Wood_PRB2019.snapcoeff WBe_Wood_PRB2019.snapparam W Be -SNAP Element = W, Radius 0.5, Weight 1 -SNAP Element = Be, Radius 0.417932, Weight 0.959049 -SNAP keyword rcutfac 4.8123 -SNAP keyword twojmax 8 -SNAP keyword rfac0 0.99363 -SNAP keyword rmin0 0 -SNAP keyword bzeroflag 1 -SNAP keyword quadraticflag 0 +pair_coeff * * mliap W Be # Setup output @@ -97,7 +99,7 @@ neigh_modify once no every 1 delay 0 check yes # Run MD -velocity all create 300.0 4928459 +velocity all create 300.0 4928459 loop geom fix 1 all nve run ${nsteps} run 100 @@ -113,7 +115,7 @@ Neighbor list info ... pair build: halffull/newton stencil: none bin: none - (2) pair snap, perpetual + (2) pair mliap, perpetual attributes: full, newton on pair build: full/bin/atomonly stencil: full/bin/3d @@ -121,43 +123,43 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 6.893 | 6.893 | 6.893 Mbytes Step Temp E_pair c_energy TotEng Press v_press 0 300 -8.5980876 -8.5980876 -8.5596125 -35284.855 35284.855 - 10 299.29029 -8.5979965 -8.5979965 -8.5596125 -35299.259 35299.259 - 20 288.99334 -8.5966759 -8.5966759 -8.5596124 -35004.093 35004.093 - 30 269.91027 -8.5942284 -8.5942284 -8.5596123 -34447.077 34447.077 - 40 243.57361 -8.5908505 -8.5908505 -8.5596121 -33687.105 33687.105 - 50 212.21385 -8.5868284 -8.5868284 -8.5596119 -32821.864 32821.864 - 60 178.77144 -8.5825391 -8.5825391 -8.5596116 -31971.17 31971.17 - 70 146.71854 -8.578428 -8.578428 -8.5596113 -31245.51 31245.51 - 80 119.50956 -8.5749383 -8.5749383 -8.5596111 -30724.137 30724.137 - 90 99.872785 -8.5724197 -8.5724197 -8.559611 -30440.244 30440.244 - 100 89.604584 -8.5711027 -8.5711027 -8.5596109 -30392.805 30392.805 -Loop time of 3.17984 on 1 procs for 100 steps with 128 atoms + 10 296.32664 -8.5976164 -8.5976164 -8.5596124 -35188.339 35188.339 + 20 282.41417 -8.595832 -8.595832 -8.5596123 -34782.293 34782.293 + 30 259.69014 -8.5929175 -8.5929175 -8.5596121 -34113.316 34113.316 + 40 230.50415 -8.5891741 -8.5891741 -8.5596119 -33260.777 33260.777 + 50 197.88816 -8.5849908 -8.5849908 -8.5596116 -32309.975 32309.975 + 60 165.27259 -8.5808076 -8.5808076 -8.5596113 -31365.766 31365.766 + 70 136.15697 -8.5770733 -8.5770733 -8.5596111 -30542.657 30542.657 + 80 113.58947 -8.5741788 -8.5741788 -8.5596109 -29939.23 29939.23 + 90 99.477916 -8.572369 -8.572369 -8.5596109 -29619.939 29619.939 + 100 94.121939 -8.5716822 -8.5716822 -8.559611 -29598.002 29598.002 +Loop time of 2.95019 on 1 procs for 100 steps with 128 atoms -Performance: 1.359 ns/day, 17.666 hours/ns, 31.448 timesteps/s -99.6% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 1.464 ns/day, 16.390 hours/ns, 33.896 timesteps/s +99.8% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 3.1748 | 3.1748 | 3.1748 | 0.0 | 99.84 -Neigh | 0.000314 | 0.000314 | 0.000314 | 0.0 | 0.01 -Comm | 0.000371 | 0.000371 | 0.000371 | 0.0 | 0.01 -Output | 0.00386 | 0.00386 | 0.00386 | 0.0 | 0.12 -Modify | 0.000236 | 0.000236 | 0.000236 | 0.0 | 0.01 -Other | | 0.000289 | | | 0.01 +Pair | 2.9486 | 2.9486 | 2.9486 | 0.0 | 99.95 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.000379 | 0.000379 | 0.000379 | 0.0 | 0.01 +Output | 0.000633 | 0.000633 | 0.000633 | 0.0 | 0.02 +Modify | 0.000207 | 0.000207 | 0.000207 | 0.0 | 0.01 +Other | | 0.000341 | | | 0.01 Nlocal: 128 ave 128 max 128 min Histogram: 1 0 0 0 0 0 0 0 0 0 Nghost: 727 ave 727 max 727 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 3710 ave 3710 max 3710 min +Neighs: 3712 ave 3712 max 3712 min Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 7420 ave 7420 max 7420 min +FullNghs: 7424 ave 7424 max 7424 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Total # of neighbors = 7420 -Ave neighs/atom = 57.9688 -Neighbor list builds = 1 +Total # of neighbors = 7424 +Ave neighs/atom = 58 +Neighbor list builds = 0 Dangerous builds = 0 Total wall time: 0:00:03 diff --git a/examples/mliap/log.21Jun20.mliap.snap.WBe.PRB201.g++.4 b/examples/mliap/log.21Jun20.mliap.snap.WBe.PRB201.g++.4 new file mode 100644 index 0000000000..53f9fc2a15 --- /dev/null +++ b/examples/mliap/log.21Jun20.mliap.snap.WBe.PRB201.g++.4 @@ -0,0 +1,165 @@ +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to SNAP W-Be potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.1803 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.1803 +Lattice spacing in x,y,z = 3.1803 3.1803 3.1803 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 2 box +Created orthogonal box = (0.0 0.0 0.0) to (12.7212 12.7212 12.7212) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 128 atoms + create_atoms CPU = 0.000 seconds +mass 1 183.84 +mass 2 9.012182 + +set group all type/fraction 2 0.05 3590153 # Change 5% of W to He + 5 settings made for type/fractiongroup tungsten type 1 +123 atoms in group tungsten +group beryllium type 2 +5 atoms in group beryllium +# choose potential + +include WBe_Wood_PRB2019.mliap +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz1 equal 74 +variable zblz2 equal 4 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.8 mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +Reading potential file WBe_Wood_PRB2019.mliap.model with DATE: 2019-09-18 +Reading potential file WBe_Wood_PRB2019.mliap.descriptor with DATE: 2019-09-18 +SNAP keyword rcutfac 4.8123 +SNAP keyword twojmax 8 +SNAP keyword nelems 2 +SNAP keyword elems W +SNAP keyword radelems 0.5 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 1 +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 1 zbl 74 ${zblz1} +pair_coeff 1 1 zbl 74 74 +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 1 2 zbl 74 ${zblz2} +pair_coeff 1 2 zbl 74 4 +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff 2 2 zbl 4 ${zblz2} +pair_coeff 2 2 zbl 4 4 +pair_coeff * * mliap W Be + + +# Setup output + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8123 + ghost atom cutoff = 5.8123 + binsize = 2.90615, bins = 5 5 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair mliap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.793 | 6.793 | 6.793 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -8.5980876 -8.5980876 -8.5596125 -35284.855 35284.855 + 10 296.32664 -8.5976164 -8.5976164 -8.5596124 -35188.339 35188.339 + 20 282.41417 -8.595832 -8.595832 -8.5596123 -34782.293 34782.293 + 30 259.69014 -8.5929175 -8.5929175 -8.5596121 -34113.316 34113.316 + 40 230.50415 -8.5891741 -8.5891741 -8.5596119 -33260.777 33260.777 + 50 197.88816 -8.5849908 -8.5849908 -8.5596116 -32309.975 32309.975 + 60 165.27259 -8.5808076 -8.5808076 -8.5596113 -31365.766 31365.766 + 70 136.15697 -8.5770733 -8.5770733 -8.5596111 -30542.657 30542.657 + 80 113.58947 -8.5741788 -8.5741788 -8.5596109 -29939.23 29939.23 + 90 99.477916 -8.572369 -8.572369 -8.5596109 -29619.939 29619.939 + 100 94.121939 -8.5716822 -8.5716822 -8.559611 -29598.002 29598.002 +Loop time of 0.897476 on 4 procs for 100 steps with 128 atoms + +Performance: 4.813 ns/day, 4.986 hours/ns, 111.424 timesteps/s +99.7% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.84854 | 0.85737 | 0.87512 | 1.1 | 95.53 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.021045 | 0.038782 | 0.047601 | 5.3 | 4.32 +Output | 0.00061 | 0.0006525 | 0.000774 | 0.0 | 0.07 +Modify | 0.00011 | 0.00011375 | 0.000117 | 0.0 | 0.01 +Other | | 0.0005625 | | | 0.06 + +Nlocal: 32 ave 32 max 32 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 431 ave 431 max 431 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 928 ave 928 max 928 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 1856 ave 1856 max 1856 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7424 +Ave neighs/atom = 58 +Neighbor list builds = 0 +Dangerous builds = 0 + +Total wall time: 0:00:00 diff --git a/examples/mliap/log.21Jun20.mliap.snap.chem.g++.1 b/examples/mliap/log.21Jun20.mliap.snap.chem.g++.1 new file mode 100644 index 0000000000..ab9af08d8a --- /dev/null +++ b/examples/mliap/log.21Jun20.mliap.snap.chem.g++.1 @@ -0,0 +1,158 @@ +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to ChemSNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 5.83 +units metal + +# generate the box and atom positions using a FCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice diamond $a +lattice diamond 5.83 +Lattice spacing in x,y,z = 5.83 5.83 5.83 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 2 box +Created orthogonal box = (0.0 0.0 0.0) to (23.32 23.32 23.32) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box basis 5 2 basis 6 2 basis 7 2 basis 8 2 +Created 512 atoms + create_atoms CPU = 0.000 seconds + +mass 1 114.76 +mass 2 30.98 + +# choose potential + +include InP_JCPA2020.mliap +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +# Definition of SNAP+ZBL potential. + +variable zblcutinner index 4 +variable zblcutouter index 4.2 +variable zblz1 index 49 +variable zblz2 index 15 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.2 mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +Reading potential file InP_JCPA2020.mliap.model with DATE: 2020-06-01 +Reading potential file InP_JCPA2020.mliap.descriptor with DATE: 2020-06-01 +SNAP keyword rcutfac 1.0 +SNAP keyword twojmax 6 +SNAP keyword nelems 2 +SNAP keyword elems In +SNAP keyword radelems 3.81205 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0.0 +SNAP keyword bzeroflag 1 +SNAP keyword wselfallflag 1 +SNAP keyword chemflag 1 +SNAP keyword bnormflag 1 +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 1 zbl 49 ${zblz1} +pair_coeff 1 1 zbl 49 49 +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 1 2 zbl 49 ${zblz2} +pair_coeff 1 2 zbl 49 15 +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff 2 2 zbl 15 ${zblz2} +pair_coeff 2 2 zbl 15 15 +pair_coeff * * mliap In P + + +# Setup output + +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6589 + ghost atom cutoff = 8.6589 + binsize = 4.32945, bins = 6 6 6 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair mliap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.03 | 6.03 | 6.03 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 300 -3.4805794 0 -3.4418771 1353.5968 + 10 285.84677 -3.4787531 0 -3.4418766 1611.7131 + 20 248.14649 -3.4738884 0 -3.4418756 2312.0308 + 30 198.94136 -3.4675394 0 -3.4418744 3168.1543 + 40 152.74831 -3.4615791 0 -3.4418734 3903.5749 + 50 121.9796 -3.4576091 0 -3.4418728 4387.1254 + 60 113.27555 -3.4564863 0 -3.4418729 4556.3003 + 70 125.68089 -3.4580873 0 -3.4418735 4431.2083 + 80 151.47475 -3.4614159 0 -3.4418745 4107.2369 + 90 179.18708 -3.4649919 0 -3.4418754 3739.5881 + 100 197.50662 -3.4673559 0 -3.441876 3492.7778 +Loop time of 16.748 on 1 procs for 100 steps with 512 atoms + +Performance: 0.258 ns/day, 93.045 hours/ns, 5.971 timesteps/s +99.9% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 16.746 | 16.746 | 16.746 | 0.0 | 99.99 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.001033 | 0.001033 | 0.001033 | 0.0 | 0.01 +Output | 0.000235 | 0.000235 | 0.000235 | 0.0 | 0.00 +Modify | 0.000688 | 0.000688 | 0.000688 | 0.0 | 0.00 +Other | | 0.000497 | | | 0.00 + +Nlocal: 512 ave 512 max 512 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1959 ave 1959 max 1959 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 31232 ave 31232 max 31232 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 62464 ave 62464 max 62464 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 62464 +Ave neighs/atom = 122 +Neighbor list builds = 0 +Dangerous builds = 0 + +Total wall time: 0:00:17 diff --git a/examples/mliap/log.21Jun20.mliap.snap.chem.g++.4 b/examples/mliap/log.21Jun20.mliap.snap.chem.g++.4 new file mode 100644 index 0000000000..34f7dadb6a --- /dev/null +++ b/examples/mliap/log.21Jun20.mliap.snap.chem.g++.4 @@ -0,0 +1,158 @@ +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to ChemSNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 5.83 +units metal + +# generate the box and atom positions using a FCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice diamond $a +lattice diamond 5.83 +Lattice spacing in x,y,z = 5.83 5.83 5.83 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 2 box +Created orthogonal box = (0.0 0.0 0.0) to (23.32 23.32 23.32) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box basis 5 2 basis 6 2 basis 7 2 basis 8 2 +Created 512 atoms + create_atoms CPU = 0.000 seconds + +mass 1 114.76 +mass 2 30.98 + +# choose potential + +include InP_JCPA2020.mliap +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +# Definition of SNAP+ZBL potential. + +variable zblcutinner index 4 +variable zblcutouter index 4.2 +variable zblz1 index 49 +variable zblz2 index 15 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.2 mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +Reading potential file InP_JCPA2020.mliap.model with DATE: 2020-06-01 +Reading potential file InP_JCPA2020.mliap.descriptor with DATE: 2020-06-01 +SNAP keyword rcutfac 1.0 +SNAP keyword twojmax 6 +SNAP keyword nelems 2 +SNAP keyword elems In +SNAP keyword radelems 3.81205 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0.0 +SNAP keyword bzeroflag 1 +SNAP keyword wselfallflag 1 +SNAP keyword chemflag 1 +SNAP keyword bnormflag 1 +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 1 zbl 49 ${zblz1} +pair_coeff 1 1 zbl 49 49 +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 1 2 zbl 49 ${zblz2} +pair_coeff 1 2 zbl 49 15 +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff 2 2 zbl 15 ${zblz2} +pair_coeff 2 2 zbl 15 15 +pair_coeff * * mliap In P + + +# Setup output + +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6589 + ghost atom cutoff = 8.6589 + binsize = 4.32945, bins = 6 6 6 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair mliap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.591 | 4.591 | 4.591 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 300 -3.4805794 0 -3.4418771 1353.5968 + 10 285.84677 -3.4787531 0 -3.4418766 1611.7131 + 20 248.14649 -3.4738884 0 -3.4418756 2312.0308 + 30 198.94136 -3.4675394 0 -3.4418744 3168.1543 + 40 152.74831 -3.4615791 0 -3.4418734 3903.5749 + 50 121.9796 -3.4576091 0 -3.4418728 4387.1254 + 60 113.27555 -3.4564863 0 -3.4418729 4556.3003 + 70 125.68089 -3.4580873 0 -3.4418735 4431.2083 + 80 151.47475 -3.4614159 0 -3.4418745 4107.2369 + 90 179.18708 -3.4649919 0 -3.4418754 3739.5881 + 100 197.50662 -3.4673559 0 -3.441876 3492.7778 +Loop time of 5.01913 on 4 procs for 100 steps with 512 atoms + +Performance: 0.861 ns/day, 27.884 hours/ns, 19.924 timesteps/s +99.7% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 4.9328 | 4.9409 | 4.952 | 0.3 | 98.44 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.065669 | 0.076754 | 0.084728 | 2.5 | 1.53 +Output | 0.000173 | 0.00028775 | 0.000617 | 0.0 | 0.01 +Modify | 0.000256 | 0.00026675 | 0.000281 | 0.0 | 0.01 +Other | | 0.0009633 | | | 0.02 + +Nlocal: 128 ave 128 max 128 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 1099 ave 1099 max 1099 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 7808 ave 7808 max 7808 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 15616 ave 15616 max 15616 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 62464 +Ave neighs/atom = 122 +Neighbor list builds = 0 +Dangerous builds = 0 + +Total wall time: 0:00:05 diff --git a/examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.1 b/examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.1 new file mode 100644 index 0000000000..e412df5404 --- /dev/null +++ b/examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.1 @@ -0,0 +1,151 @@ +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to quadratic SNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.1803 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.1803 +Lattice spacing in x,y,z = 3.1803 3.1803 3.1803 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0 0.0 0.0) to (12.7212 12.7212 12.7212) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 128 atoms + create_atoms CPU = 0.000 seconds +displace_atoms all random 0.01 0.01 0.01 12345 + +mass 1 183.84 + +# choose potential + +include W.quadratic.mliap +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 74 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.8 mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor +SNAP keyword rcutfac 4.73442 +SNAP keyword twojmax 6 +SNAP keyword nelems 1 +SNAP keyword elems W +SNAP keyword radelems 0.5 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 1 +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff 1 1 zbl 74 ${zblz} +pair_coeff 1 1 zbl 74 74 +pair_coeff * * mliap W + + +# Setup output + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check no + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8 + ghost atom cutoff = 5.8 + binsize = 2.9, bins = 5 5 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair mliap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.093 | 6.093 | 6.093 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -1.1602728 -1.1602728 -1.1217977 600047.3 -600047.3 + 10 288.46387 -1.1587932 -1.1587932 -1.1217976 600359.75 -600359.75 + 20 268.69718 -1.1562579 -1.1562579 -1.1217974 600870.22 -600870.22 + 30 243.19855 -1.1529874 -1.1529874 -1.1217971 601511.5 -601511.5 + 40 215.13122 -1.1493875 -1.1493875 -1.1217969 602202.36 -602202.36 + 50 187.82673 -1.1458855 -1.1458855 -1.1217966 602860.26 -602860.26 + 60 164.26822 -1.1428639 -1.1428639 -1.1217965 603413.25 -603413.25 + 70 146.65179 -1.1406045 -1.1406045 -1.1217964 603809.35 -603809.35 + 80 136.10769 -1.1392522 -1.1392522 -1.1217964 604022.32 -604022.32 + 90 132.62756 -1.138806 -1.138806 -1.1217964 604053.33 -604053.33 + 100 135.19841 -1.1391358 -1.1391358 -1.1217966 603928.48 -603928.48 +Loop time of 1.69996 on 1 procs for 100 steps with 128 atoms + +Performance: 2.541 ns/day, 9.444 hours/ns, 58.825 timesteps/s +99.6% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.6676 | 1.6676 | 1.6676 | 0.0 | 98.09 +Neigh | 0.03029 | 0.03029 | 0.03029 | 0.0 | 1.78 +Comm | 0.001238 | 0.001238 | 0.001238 | 0.0 | 0.07 +Output | 0.000452 | 0.000452 | 0.000452 | 0.0 | 0.03 +Modify | 0.000175 | 0.000175 | 0.000175 | 0.0 | 0.01 +Other | | 0.000241 | | | 0.01 + +Nlocal: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 727 ave 727 max 727 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3712 ave 3712 max 3712 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 7424 ave 7424 max 7424 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7424 +Ave neighs/atom = 58 +Neighbor list builds = 100 +Dangerous builds not checked + +Total wall time: 0:00:01 diff --git a/examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.4 b/examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.4 new file mode 100644 index 0000000000..f8ebb89fc6 --- /dev/null +++ b/examples/mliap/log.21Jun20.mliap.snap.quadratic.g++.4 @@ -0,0 +1,151 @@ +LAMMPS (15 Jun 2020) +# Demonstrate MLIAP interface to quadratic SNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.1803 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable nx equal 4 +variable ny equal ${nrep} +variable ny equal 4 +variable nz equal ${nrep} +variable nz equal 4 + +boundary p p p + +lattice bcc $a +lattice bcc 3.1803 +Lattice spacing in x,y,z = 3.1803 3.1803 3.1803 +region box block 0 ${nx} 0 ${ny} 0 ${nz} +region box block 0 4 0 ${ny} 0 ${nz} +region box block 0 4 0 4 0 ${nz} +region box block 0 4 0 4 0 4 +create_box 1 box +Created orthogonal box = (0.0 0.0 0.0) to (12.7212 12.7212 12.7212) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 128 atoms + create_atoms CPU = 0.000 seconds +displace_atoms all random 0.01 0.01 0.01 12345 + +mass 1 183.84 + +# choose potential + +include W.quadratic.mliap +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 74 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor +pair_style hybrid/overlay zbl 4 ${zblcutouter} mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor +pair_style hybrid/overlay zbl 4 4.8 mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor +SNAP keyword rcutfac 4.73442 +SNAP keyword twojmax 6 +SNAP keyword nelems 1 +SNAP keyword elems W +SNAP keyword radelems 0.5 +SNAP keyword welems 1 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0 +SNAP keyword bzeroflag 1 +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff 1 1 zbl 74 ${zblz} +pair_coeff 1 1 zbl 74 74 +pair_coeff * * mliap W + + +# Setup output + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check no + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} +run 100 +Neighbor list info ... + update every 1 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.8 + ghost atom cutoff = 5.8 + binsize = 2.9, bins = 5 5 5 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full from (2) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none + (2) pair mliap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.031 | 6.032 | 6.033 Mbytes +Step Temp E_pair c_energy TotEng Press v_press + 0 300 -1.1602728 -1.1602728 -1.1217977 600047.3 -600047.3 + 10 288.46387 -1.1587932 -1.1587932 -1.1217976 600359.75 -600359.75 + 20 268.69718 -1.1562579 -1.1562579 -1.1217974 600870.22 -600870.22 + 30 243.19855 -1.1529874 -1.1529874 -1.1217971 601511.5 -601511.5 + 40 215.13122 -1.1493875 -1.1493875 -1.1217969 602202.36 -602202.36 + 50 187.82673 -1.1458855 -1.1458855 -1.1217966 602860.26 -602860.26 + 60 164.26822 -1.1428639 -1.1428639 -1.1217965 603413.25 -603413.25 + 70 146.65179 -1.1406045 -1.1406045 -1.1217964 603809.35 -603809.35 + 80 136.10769 -1.1392522 -1.1392522 -1.1217964 604022.32 -604022.32 + 90 132.62756 -1.138806 -1.138806 -1.1217964 604053.33 -604053.33 + 100 135.19841 -1.1391358 -1.1391358 -1.1217966 603928.48 -603928.48 +Loop time of 0.520935 on 4 procs for 100 steps with 128 atoms + +Performance: 8.293 ns/day, 2.894 hours/ns, 191.963 timesteps/s +99.7% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.4001 | 0.44784 | 0.49877 | 6.8 | 85.97 +Neigh | 0.00728 | 0.0080255 | 0.008793 | 0.8 | 1.54 +Comm | 0.012664 | 0.064342 | 0.11287 | 18.2 | 12.35 +Output | 0.000511 | 0.00053725 | 0.000613 | 0.0 | 0.10 +Modify | 7.3e-05 | 7.925e-05 | 8.3e-05 | 0.0 | 0.02 +Other | | 0.0001087 | | | 0.02 + +Nlocal: 32 ave 35 max 29 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 431 ave 434 max 428 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Neighs: 928 ave 1019 max 837 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +FullNghs: 1856 ave 2030 max 1682 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 7424 +Ave neighs/atom = 58 +Neighbor list builds = 100 +Dangerous builds not checked + +Total wall time: 0:00:00 diff --git a/examples/mliap/log.snap.quadratic.ref b/examples/mliap/log.snap.quadratic.ref deleted file mode 100644 index 472080f7a4..0000000000 --- a/examples/mliap/log.snap.quadratic.ref +++ /dev/null @@ -1,153 +0,0 @@ -LAMMPS (19 Mar 2020) -# Demonstrate SNAP Ta potential - -# Initialize simulation - -variable nsteps index 100 -variable nrep equal 1 -variable a equal 3.1803 -units metal - -# generate the box and atom positions using a BCC lattice - -variable nx equal ${nrep} -variable nx equal 1 -variable ny equal ${nrep} -variable ny equal 1 -variable nz equal ${nrep} -variable nz equal 1 - -boundary p p p - -lattice bcc $a -lattice bcc 3.1803 -Lattice spacing in x,y,z = 3.1803 3.1803 3.1803 -region box block 0 ${nx} 0 ${ny} 0 ${nz} -region box block 0 1 0 ${ny} 0 ${nz} -region box block 0 1 0 1 0 ${nz} -region box block 0 1 0 1 0 1 -create_box 1 box -Created orthogonal box = (0 0 0) to (3.1803 3.1803 3.1803) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 2 atoms - create_atoms CPU = 0.000215 secs -displace_atoms all random 0.01 0.01 0.01 12345 - -mass 1 183.84 - -# choose potential - -include W.snap.quadratic -# -# -# Definition of SNAP+ZBL potential. -variable zblcutinner equal 4 -variable zblcutouter equal 4.8 -variable zblz equal 74 - -# Specify hybrid with SNAP and ZBL - -pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap -pair_style hybrid/overlay zbl 4 ${zblcutouter} snap -pair_style hybrid/overlay zbl 4 4.8 snap -pair_coeff 1 1 zbl ${zblz} ${zblz} -pair_coeff 1 1 zbl 74 ${zblz} -pair_coeff 1 1 zbl 74 74 -pair_coeff * * snap W.quadratic.snapcoeff W.quadratic.snapparam W -SNAP Element = W, Radius 0.5, Weight 1 -SNAP keyword rcutfac 4.73442 -SNAP keyword twojmax 6 -SNAP keyword rfac0 0.99363 -SNAP keyword rmin0 0 -SNAP keyword bzeroflag 1 -SNAP keyword quadraticflag 1 - - -# Setup output - -compute eatom all pe/atom -compute energy all reduce sum c_eatom - -compute satom all stress/atom NULL -compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] -variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) - -thermo_style custom step temp epair c_energy etotal press v_press -thermo 10 -thermo_modify norm yes - -dump 1 all custom 100 dump.quadratic.* id type fx fy fz c_eatom - -# Set up NVE run - -timestep 0.5e-3 -neighbor 1.0 bin -neigh_modify once no every 1 delay 0 check no - -# Run MD - -velocity all create 300.0 4928459 -fix 1 all nve -run ${nsteps} -run 100 -Neighbor list info ... - update every 1 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 5.8 - ghost atom cutoff = 5.8 - binsize = 2.9, bins = 2 2 2 - 2 neighbor lists, perpetual/occasional/extra = 2 0 0 - (1) pair zbl, perpetual, half/full from (2) - attributes: half, newton on - pair build: halffull/newton - stencil: none - bin: none - (2) pair snap, perpetual - attributes: full, newton on - pair build: full/bin/atomonly - stencil: full/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 7.284 | 7.284 | 7.284 Mbytes -Step Temp E_pair c_energy TotEng Press v_press - 0 300 -1.1575362 -1.1575362 -1.1381472 600966 -600966 - 10 349.32287 -1.1607243 -1.1607243 -1.1381475 599985.48 -599985.48 - 20 384.27065 -1.1629832 -1.1629832 -1.1381478 599287.89 -599287.89 - 30 399.34846 -1.1639578 -1.1639578 -1.1381478 598986.42 -598986.42 - 40 392.19413 -1.1634953 -1.1634953 -1.1381478 599130.05 -599130.05 - 50 363.93932 -1.161669 -1.161669 -1.1381476 599694.93 -599694.93 - 60 319.03014 -1.1587663 -1.1587663 -1.1381473 600588.89 -600588.89 - 70 264.53512 -1.1552439 -1.1552439 -1.138147 601667.76 -601667.76 - 80 209.04294 -1.1516571 -1.1516571 -1.1381466 602760.01 -602760.01 - 90 161.3157 -1.1485722 -1.1485722 -1.1381463 603694.49 -603694.49 - 100 128.9054 -1.1464773 -1.1464773 -1.1381461 604326.7 -604326.7 -Loop time of 0.030198 on 1 procs for 100 steps with 2 atoms - -Performance: 143.056 ns/day, 0.168 hours/ns, 3311.478 timesteps/s -98.4% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.028723 | 0.028723 | 0.028723 | 0.0 | 95.12 -Neigh | 0.000515 | 0.000515 | 0.000515 | 0.0 | 1.71 -Comm | 0.000263 | 0.000263 | 0.000263 | 0.0 | 0.87 -Output | 0.000618 | 0.000618 | 0.000618 | 0.0 | 2.05 -Modify | 2.7e-05 | 2.7e-05 | 2.7e-05 | 0.0 | 0.09 -Other | | 5.2e-05 | | | 0.17 - -Nlocal: 2 ave 2 max 2 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 187 ave 187 max 187 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 58 ave 58 max 58 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 116 ave 116 max 116 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 116 -Ave neighs/atom = 58 -Neighbor list builds = 100 -Dangerous builds not checked - -Total wall time: 0:00:00 diff --git a/potentials/InP_JCPA2020.snap b/potentials/InP_JCPA2020.snap index a1ba9e7a94..1af0008b6f 100644 --- a/potentials/InP_JCPA2020.snap +++ b/potentials/InP_JCPA2020.snap @@ -1,4 +1,4 @@ -# DATE: 2020-06-01 CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) # Definition of SNAP+ZBL potential. diff --git a/potentials/InP_JCPA2020.snapparam b/potentials/InP_JCPA2020.snapparam index 880ba6671c..0e764ac7ca 100644 --- a/potentials/InP_JCPA2020.snapparam +++ b/potentials/InP_JCPA2020.snapparam @@ -1,14 +1,14 @@ # DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) - # required - rcutfac 1.0 - twojmax 6 +# required +rcutfac 1.0 +twojmax 6 - # optional - rfac0 0.99363 - rmin0 0.0 - bzeroflag 1 - quadraticflag 0 - wselfallflag 1 - chemflag 1 - bnormflag 1 +# optional +rfac0 0.99363 +rmin0 0.0 +bzeroflag 1 +quadraticflag 0 +wselfallflag 1 +chemflag 1 +bnormflag 1 diff --git a/potentials/WBe_Wood_PRB2019.snapcoeff b/potentials/WBe_Wood_PRB2019.snapcoeff index c72baabd74..965059f8b5 100644 --- a/potentials/WBe_Wood_PRB2019.snapcoeff +++ b/potentials/WBe_Wood_PRB2019.snapcoeff @@ -1,3 +1,4 @@ +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) # LAMMPS SNAP coefficients for WBe 2 56 diff --git a/potentials/WBe_Wood_PRB2019.snapparam b/potentials/WBe_Wood_PRB2019.snapparam index e4fc4b4459..e96458651c 100644 --- a/potentials/WBe_Wood_PRB2019.snapparam +++ b/potentials/WBe_Wood_PRB2019.snapparam @@ -1,3 +1,5 @@ +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) + # required rcutfac 4.8123 twojmax 8 diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 832efec48a..db677881d5 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "force.h" #include "comm.h" +#include "utils.h" #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" @@ -119,17 +120,17 @@ void MLIAPDescriptorSNAP::forward(int* map, NeighList* list, double **descriptor snaptr->inside[ninside] = j; snaptr->wj[ninside] = wjelem[jelem]; snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; - snaptr->element[ninside] = jelem; // element index for alloy snap + snaptr->element[ninside] = jelem; // element index for chem snap ninside++; } } - if (alloyflag) + if (chemflag) snaptr->compute_ui(ninside, ielem); else snaptr->compute_ui(ninside, 0); snaptr->compute_zi(); - if (alloyflag) + if (chemflag) snaptr->compute_bi(ielem); else snaptr->compute_bi(0); @@ -201,14 +202,14 @@ void MLIAPDescriptorSNAP::backward(PairMLIAP* pairmliap, NeighList* list, double snaptr->inside[ninside] = j; snaptr->wj[ninside] = wjelem[jelem]; snaptr->rcutij[ninside] = (radi + radelem[jelem])*rcutfac; - snaptr->element[ninside] = jelem; // element index for alloy snap + snaptr->element[ninside] = jelem; // element index for chem snap ninside++; } } // compute Ui, Yi for atom I - if (alloyflag) + if (chemflag) snaptr->compute_ui(ninside, ielem); else snaptr->compute_ui(ninside, 0); @@ -224,7 +225,7 @@ void MLIAPDescriptorSNAP::backward(PairMLIAP* pairmliap, NeighList* list, double for (int jj = 0; jj < ninside; jj++) { int j = snaptr->inside[jj]; - if(alloyflag) + if(chemflag) snaptr->compute_duidrj(snaptr->rij[jj], snaptr->wj[jj], snaptr->rcutij[jj],jj, snaptr->element[jj]); else @@ -263,7 +264,7 @@ void MLIAPDescriptorSNAP::init() snaptr = new SNA(lmp, rfac0, twojmax, rmin0, switchflag, bzeroflag, - alloyflag, wselfallflag, nelements); + chemflag, bnormflag, wselfallflag, nelements); snaptr->init(); @@ -291,8 +292,8 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) rmin0 = 0.0; switchflag = 1; bzeroflag = 1; + chemflag = 0; bnormflag = 0; - alloyflag = 0; wselfallflag = 0; // open SNAP parameter file on proc 0 @@ -327,7 +328,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) // strip comment, skip line if blank if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = atom->count_words(line); + nwords = utils::count_words(line); if (nwords == 0) continue; // words = ptrs to all words in line @@ -400,8 +401,10 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) switchflag = atoi(keyval); else if (strcmp(keywd,"bzeroflag") == 0) bzeroflag = atoi(keyval); - else if (strcmp(keywd,"alloyflag") == 0) - alloyflag = atoi(keyval); + else if (strcmp(keywd,"chemflag") == 0) + chemflag = atoi(keyval); + else if (strcmp(keywd,"bnormflag") == 0) + bnormflag = atoi(keyval); else if (strcmp(keywd,"wselfallflag") == 0) wselfallflag = atoi(keyval); else @@ -410,8 +413,6 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) } } - bnormflag = alloyflag; - if (!rcutfacflag || !twojmaxflag || !nelementsflag || !elementsflag || !radelemflag || !wjelemflag) error->all(FLERR,"Incorrect SNAP parameter file"); diff --git a/src/MLIAP/mliap_descriptor_snap.h b/src/MLIAP/mliap_descriptor_snap.h index da2018b94f..15691fabfe 100644 --- a/src/MLIAP/mliap_descriptor_snap.h +++ b/src/MLIAP/mliap_descriptor_snap.h @@ -39,8 +39,8 @@ protected: double *radelem; // element radii double *wjelem; // elements weights - int twojmax, switchflag, bzeroflag, bnormflag; - int alloyflag, wselfallflag; + int twojmax, switchflag, bzeroflag; + int chemflag, bnormflag, wselfallflag; double rfac0, rmin0; }; diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp index db5d2b7c04..5c689c8369 100644 --- a/src/MLIAP/mliap_model.cpp +++ b/src/MLIAP/mliap_model.cpp @@ -17,6 +17,7 @@ #include "atom.h" #include "force.h" #include "comm.h" +#include "utils.h" #include "neigh_list.h" #include "memory.h" #include "error.h" @@ -89,7 +90,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) // strip comment, skip line if blank if ((ptr = strchr(line,'#'))) *ptr = '\0'; - nwords = atom->count_words(line); + nwords = utils::count_words(line); } if (nwords != 2) error->all(FLERR,"Incorrect format in MLIAPModel coefficient file"); @@ -128,7 +129,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(line,n,MPI_CHAR,0,world); - nwords = atom->count_words(line); + nwords = utils::trim_and_count_words(line); if (nwords != 1) error->all(FLERR,"Incorrect format in coefficient file"); From 9238c2a624ab1d628cba594e6ba963773d668bba Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Sun, 21 Jun 2020 19:57:08 -0600 Subject: [PATCH 13/54] Finished first version of MLIAP package --- doc/src/pair_mliap.rst | 139 +++++++++++++++++++++++++++++++++++++++ src/MLIAP/pair_mliap.cpp | 14 +++- 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 doc/src/pair_mliap.rst diff --git a/doc/src/pair_mliap.rst b/doc/src/pair_mliap.rst new file mode 100644 index 0000000000..6b100dbaee --- /dev/null +++ b/doc/src/pair_mliap.rst @@ -0,0 +1,139 @@ +.. index:: pair_style mliap + +pair_style mliap command +======================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style mliap + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style mliap model linear InP.mliap.model descriptor sna InP.mliap.descriptor + pair_style mliap model quadratic W.mliap.model descriptor sna W.mliap.descriptor + pair_coeff * * In P + +Description +""""""""""" + +Pair style *mliap* provides a general interface to families of +machine-learning interatomic potentials. It provides separate +definitions of the interatomic potential functional form (*model*) +and the geometric quantities that characterize the atomic positions +(*descriptor*). By defining *model* and *descriptor* separately, +it is possible to use many different models with a given descriptor, +or many different descriptors with a given model. Currently, the pair_style +supports just two models, *linear* and *quadratic*, +and one descriptor, *sna*, the SNAP descriptor used by :doc:`pair_style snap `, including the linear, quadratic, +and chem variants. Work is currently underway to extend +the interface to handle neural network energy models, +and it is also straightforward to add new descriptor styles. + +The pair_style *mliap* command must be followed by two keywords +*model* and *descriptor* in either order. A single +*pair_coeff* command is also required. The first 2 arguments +must be \* \* so as to span all LAMMPS atom types. +This is followed by a list of N arguments +that specify the mapping of MLIAP +element names to LAMMPS atom types, +where N is the number of LAMMPS atom types. + +The *model* keyword is followed by a model style, currently limited to +either *linear* or *quadratic*. In both cases, +this is followed by a single argument specifying the model filename containing the +linear or quadratic coefficients for a set of elements. +The model filename usually ends in the *.mliap.model* extension. +It may contain coefficients for many elements. The only requirement is that it +contain at least those element names appearing in the +*pair_coeff* command. + +The top of the model file can contain any number of blank and comment lines (start with #), +but follows a strict format after that. The first non-blank non-comment +line must contain two integers: + +* nelems = Number of elements +* ncoeff = Number of coefficients + +This is followed by one block for each of the *nelem* elements. +Each block consists of *ncoeff* coefficients, one per line. +Note that this format is similar, but not identical to that used +for the :doc:`pair_style snap ` coefficient file. +Specifically, the line containing the element weight and radius is ommitted, +since these are handled by the *descriptor*. + +The *descriptor* keyword is followed by a descriptor style, and additional arguments. +Currently the only descriptor style is *sna*, indicating the bispectrum component +descriptors used by the Spectral Neighbor Analysis Potential (SNAP) potentials of +:doc:`pair_style snap `. +The \'p\' in SNAP is dropped, because keywords that match pair_styles are silently stripped +out by the LAMMPS command parser. A single additional argument specifies the descriptor filename +containing the parameters and setting used by the SNAP descriptor. +The descriptor filename usually ends in the *.mliap.descriptor* extension. + +The SNAP descriptor file closely follows the format of the +:doc:`pair_style snap ` parameter file. +The file can contain blank and comment lines (start +with #) anywhere. Each non-blank non-comment line must contain one +keyword/value pair. The required keywords are *rcutfac* and +*twojmax*\ . There are many optional keywords that are described +on the :doc:`pair_style snap ` doc page. +In addition, the SNAP descriptor file must contain +the *nelems*, *elems*, *radelems*, and *welems* keywords. +The *nelems* keyword specifies the number of elements +provided in the other three keywords. +The *elems* keyword is followed by a list of *nelems* +element names that must include the element +names appearing in the *pair_coeff* command, +but can contain other names too. +Similarly, the *radelems* and *welems* keywords are +followed by lists of *nelems* numbers giving the element radius +and element weight of each element. Obviously, the order +in which the elements are listed must be consistent for all +three keywords. + +See the :doc:`pair_coeff ` doc page for alternate ways +to specify the path for these *model* and *descriptor* files. + +**Mixing, shift, table, tail correction, restart, rRESPA info**\ : + +For atom type pairs I,J and I != J, where types I and J correspond to +two different element types, mixing is performed by LAMMPS with +user-specifiable parameters as described above. You never need to +specify a pair_coeff command with I != J arguments for this style. + +This pair style does not support the :doc:`pair_modify ` +shift, table, and tail options. + +This pair style does not write its information to :doc:`binary restart files `, since it is stored in potential files. Thus, you +need to re-specify the pair_style and pair_coeff commands in an input +script that reads a restart file. + +This pair style can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. It does not support the +*inner*\ , *middle*\ , *outer* keywords. + +---------- + +Restrictions +"""""""""""" + +This style is part of the MLIAP package. It is only enabled if LAMMPS +was built with that package. In addition, building LAMMPS with the MLIAP package +requires bulding LAMMPS with the SNAP package. +See the :doc:`Build package ` doc page for more info. + +Related commands +"""""""""""""""" + +:doc:`pair_style snap `, + +**Default:** none + +---------- + diff --git a/src/MLIAP/pair_mliap.cpp b/src/MLIAP/pair_mliap.cpp index aabdb90cef..b97dd51d67 100644 --- a/src/MLIAP/pair_mliap.cpp +++ b/src/MLIAP/pair_mliap.cpp @@ -124,6 +124,11 @@ void PairMLIAP::settings(int narg, char ** arg) if (narg < 4) error->all(FLERR,"Illegal pair_style command"); + // set flags for required keywords + + int modelflag = 0; + int descriptorflag = 0; + // process keywords int iarg = 0; @@ -140,6 +145,7 @@ void PairMLIAP::settings(int narg, char ** arg) model = new MLIAPModelQuadratic(lmp,arg[iarg+2]); iarg += 3; } else error->all(FLERR,"Illegal pair_style mliap command"); + modelflag = 1; } else if (strcmp(arg[iarg],"descriptor") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style mliap command"); if (strcmp(arg[iarg+1],"sna") == 0) { @@ -147,8 +153,14 @@ void PairMLIAP::settings(int narg, char ** arg) descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2]); iarg += 3; } else error->all(FLERR,"Illegal pair_style mliap command"); - } + descriptorflag = 1; + } else + error->all(FLERR,"Illegal pair_style mliap command"); } + + if (modelflag == 0 || descriptorflag == 0) + error->all(FLERR,"Illegal pair_style command"); + } /* ---------------------------------------------------------------------- From 10ace11c0bb6bd9bec86b88f7d22539bf807f942 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Sun, 21 Jun 2020 21:10:03 -0600 Subject: [PATCH 14/54] Fixed spelling and false positives --- doc/src/pair_mliap.rst | 4 ++-- doc/utils/sphinx-config/false_positives.txt | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/pair_mliap.rst b/doc/src/pair_mliap.rst index 6b100dbaee..bbd8d6fe5f 100644 --- a/doc/src/pair_mliap.rst +++ b/doc/src/pair_mliap.rst @@ -64,7 +64,7 @@ This is followed by one block for each of the *nelem* elements. Each block consists of *ncoeff* coefficients, one per line. Note that this format is similar, but not identical to that used for the :doc:`pair_style snap ` coefficient file. -Specifically, the line containing the element weight and radius is ommitted, +Specifically, the line containing the element weight and radius is omitted, since these are handled by the *descriptor*. The *descriptor* keyword is followed by a descriptor style, and additional arguments. @@ -125,7 +125,7 @@ Restrictions This style is part of the MLIAP package. It is only enabled if LAMMPS was built with that package. In addition, building LAMMPS with the MLIAP package -requires bulding LAMMPS with the SNAP package. +requires building LAMMPS with the SNAP package. See the :doc:`Build package ` doc page for more info. Related commands diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 7852d18961..2bc3c2a0f6 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1826,6 +1826,7 @@ Mj mK mkdir mkv +mliap mlparks Mniszewski mnt @@ -1995,6 +1996,7 @@ Neel Neelov Negre nelem +nelems Nelement Nelements nemd From bbd9af0d6fac8317833fba2974f474db4d3d166a Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Mon, 22 Jun 2020 09:11:38 -0600 Subject: [PATCH 15/54] Fixed a few minor problems --- doc/src/pair_mliap.rst | 5 +---- src/MLIAP/mliap_model.cpp | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/src/pair_mliap.rst b/doc/src/pair_mliap.rst index bbd8d6fe5f..b569a26910 100644 --- a/doc/src/pair_mliap.rst +++ b/doc/src/pair_mliap.rst @@ -1,7 +1,7 @@ .. index:: pair_style mliap pair_style mliap command -======================= +======================== Syntax """""" @@ -134,6 +134,3 @@ Related commands :doc:`pair_style snap `, **Default:** none - ----------- - diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp index 5c689c8369..94aafc93a8 100644 --- a/src/MLIAP/mliap_model.cpp +++ b/src/MLIAP/mliap_model.cpp @@ -13,6 +13,7 @@ #include "mliap_model.h" #include "pair_mliap.h" +#include #include #include "atom.h" #include "force.h" From 75114afc0e02077ab6dc82ade8f527912da1192c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 11:24:44 -0400 Subject: [PATCH 16/54] integrate MLIAP package into CMake procedure --- cmake/CMakeLists.txt | 4 ++-- cmake/presets/most.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b34e3a4d1f..0890ab2e1b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -122,8 +122,8 @@ install(TARGETS lmp EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR}) option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF) set(STANDARD_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE - GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MOLECULE PERI POEMS QEQ - REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI + GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MLIAP MOLECULE PERI POEMS + QEQ REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESODPD USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MESONT USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index aa5b60d146..bddefc077b 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -2,8 +2,8 @@ # external libraries. Compared to all_on.cmake some more unusual packages # are removed. The resulting binary should be able to run most inputs. -set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL - DIPOLE GRANULAR KSPACE MANYBODY MC MISC MOLECULE OPT PERI +set(ALL_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE + GRANULAR KSPACE MANYBODY MC MISC MLIAP MOLECULE OPT PERI POEMS PYTHON QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-MEAMC USER-MESODPD From 743a14aea067eeaa864da0b5848f6ff6b362d3f6 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Mon, 22 Jun 2020 09:35:16 -0600 Subject: [PATCH 17/54] Fixed incomplete documentation entries for mliap --- doc/src/Commands_pair.rst | 1 + doc/src/Packages_details.rst | 20 ++++++++++++++++++++ doc/src/Packages_standard.rst | 2 ++ doc/src/compute_sna_atom.rst | 1 - doc/src/pair_style.rst | 1 + 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 759c0bfbb3..c67ceb6d08 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -183,6 +183,7 @@ OPT. * :doc:`mesont/tpm ` * :doc:`mgpt ` * :doc:`mie/cut (g) ` + * :doc:`mliap ` * :doc:`mm3/switch3/coulgauss/long ` * :doc:`momb ` * :doc:`morse (gkot) ` diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index cb5a014ede..9c01f1a419 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -44,6 +44,7 @@ page gives those details. * :ref:`MC ` * :ref:`MESSAGE ` * :ref:`MISC ` + * :ref:`MLIAP ` * :ref:`MOLECULE ` * :ref:`MPIIO ` * :ref:`MSCG ` @@ -652,6 +653,25 @@ listing, "ls src/MISC", to see the list of commands. ---------- +.. _PKG-MLIAP: + +MLIAP package +------------ + +**Contents:** + +A general interface for machine-learning interatomic potentials. + +**Author:** Aidan Thompson (Sandia). + +**Supporting info:** + +* src/MLIAP: filenames -> commands +* :doc:`pair_style mliap ` +* examples/mliap + +---------- + .. _PKG-MOLECULE: MOLECULE package diff --git a/doc/src/Packages_standard.rst b/doc/src/Packages_standard.rst index 74a567e0b9..ca22515590 100644 --- a/doc/src/Packages_standard.rst +++ b/doc/src/Packages_standard.rst @@ -59,6 +59,8 @@ package: +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`MISC ` | miscellaneous single-file commands | n/a | no | no | +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ +| :ref:`MLIAP ` | multiple machine learning potentials | :doc:`pair_style mliap ` | mliap | no | ++----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`MOLECULE ` | molecular system force fields | :doc:`Howto bioFF ` | peptide | no | +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`MPIIO ` | MPI parallel I/O dump and restart | :doc:`dump ` | n/a | no | diff --git a/doc/src/compute_sna_atom.rst b/doc/src/compute_sna_atom.rst index f051278842..4e42c4523b 100644 --- a/doc/src/compute_sna_atom.rst +++ b/doc/src/compute_sna_atom.rst @@ -431,7 +431,6 @@ available at `arXiv:1409.3880 `_ **(Varshalovich)** Varshalovich, Moskalev, Khersonskii, Quantum Theory of Angular Momentum, World Scientific, Singapore (1987). -.. _Varshalovich1987: .. _Mason2009: diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 19983a19d9..443573743d 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -291,6 +291,7 @@ accelerated styles exist. * :doc:`smd/tri_surface ` - * :doc:`smd/ulsph ` - * :doc:`smtbq ` - +* :doc:`mliap ` - Multiple styles of machine-learning potential * :doc:`snap ` - SNAP quantum-accurate potential * :doc:`soft ` - Soft (cosine) potential * :doc:`sph/heatconduction ` - From 18597a63897bf1ef1ba13670ea7f26db9ff0ded6 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Mon, 22 Jun 2020 10:00:19 -0600 Subject: [PATCH 18/54] Removed computes --- src/MLIAP/compute_mliap.cpp | 356 ------------------------------------ src/MLIAP/compute_mliap.h | 87 --------- 2 files changed, 443 deletions(-) delete mode 100644 src/MLIAP/compute_mliap.cpp delete mode 100644 src/MLIAP/compute_mliap.h diff --git a/src/MLIAP/compute_mliap.cpp b/src/MLIAP/compute_mliap.cpp deleted file mode 100644 index 80cfbca058..0000000000 --- a/src/MLIAP/compute_mliap.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include -#include -#include "mliap_model_linear.h" -#include "mliap_model_quadratic.h" -#include "mliap_descriptor_snap.h" -#include "compute_mliap.h" -#include "atom.h" -#include "update.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "force.h" -#include "pair.h" -#include "comm.h" -#include "memory.h" -#include "error.h" - -using namespace LAMMPS_NS; - -enum{SCALAR,VECTOR,ARRAY}; - -ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), mliap(NULL), - mliap_peratom(NULL), mliapall(NULL) -{ - - array_flag = 1; - extarray = 0; - - int ntypes = atom->ntypes; - - if (narg < 4) - error->all(FLERR,"Illegal compute mliap command"); - - // process keywords - - int iarg = 0; - - while (iarg < narg) { - if (strcmp(arg[iarg],"model") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute mliap command"); - if (strcmp(arg[iarg+1],"linear") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command"); - model = new MLIAPModelLinear(lmp,arg[iarg+2]); - iarg += 3; - } else if (strcmp(arg[iarg+1],"quadratic") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command"); - model = new MLIAPModelQuadratic(lmp,arg[iarg+2]); - iarg += 3; - } else error->all(FLERR,"Illegal compute mliap command"); - } else if (strcmp(arg[iarg],"descriptor") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute mliap command"); - if (strcmp(arg[iarg+1],"sna") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal compute mliap command"); - descriptor = new MLIAPDescriptorSNAP(lmp,arg[iarg+2]); - iarg += 3; - } else error->all(FLERR,"Illegal compute mliap command"); - } - } - - nparams = model->nparams; - nperdim = nparams; - ndims_force = 3; - ndims_virial = 6; - yoffset = nperdim; - zoffset = 2*nperdim; - natoms = atom->natoms; - size_array_rows = 1+ndims_force*natoms+ndims_virial; - size_array_cols = nperdim*atom->ntypes+1; - lastcol = size_array_cols-1; - - ndims_peratom = ndims_force; - size_peratom = ndims_peratom*nperdim*atom->ntypes; - - nmax = 0; -} - -/* ---------------------------------------------------------------------- */ - -ComputeMLIAP::~ComputeMLIAP() -{ - memory->destroy(mliap); - memory->destroy(mliapall); - memory->destroy(mliap_peratom); - memory->destroy(cutsq); - - memory->destroy(map); -} - -/* ---------------------------------------------------------------------- */ - -void ComputeMLIAP::init() -{ - if (force->pair == NULL) - error->all(FLERR,"Compute mliap requires a pair style be defined"); - - if (descriptor->get_cutmax() > force->pair->cutforce) - error->all(FLERR,"Compute mliap cutoff is longer than pairwise cutoff"); - - // need an occasional full neighbor list - - int irequest = neighbor->request(this,instance_me); - neighbor->requests[irequest]->pair = 0; - neighbor->requests[irequest]->compute = 1; - neighbor->requests[irequest]->half = 0; - neighbor->requests[irequest]->full = 1; - neighbor->requests[irequest]->occasional = 1; - - int count = 0; - for (int i = 0; i < modify->ncompute; i++) - if (strcmp(modify->compute[i]->style,"mliap") == 0) count++; - if (count > 1 && comm->me == 0) - error->warning(FLERR,"More than one compute mliap"); - - // allocate memory for global array - - memory->create(mliap,size_array_rows,size_array_cols, - "mliap:mliap"); - memory->create(mliapall,size_array_rows,size_array_cols, - "mliap:mliapall"); - array = mliapall; - - // find compute for reference energy - - char *id_pe = (char *) "thermo_pe"; - int ipe = modify->find_compute(id_pe); - if (ipe == -1) - error->all(FLERR,"compute thermo_pe does not exist."); - c_pe = modify->compute[ipe]; - - // add compute for reference virial tensor - - char *id_virial = (char *) "mliap_press"; - char **newarg = new char*[5]; - newarg[0] = id_virial; - newarg[1] = (char *) "all"; - newarg[2] = (char *) "pressure"; - newarg[3] = (char *) "NULL"; - newarg[4] = (char *) "virial"; - modify->add_compute(5,newarg); - delete [] newarg; - - int ivirial = modify->find_compute(id_virial); - if (ivirial == -1) - error->all(FLERR,"compute mliap_press does not exist."); - c_virial = modify->compute[ivirial]; - -} - - -/* ---------------------------------------------------------------------- */ - -void ComputeMLIAP::init_list(int /*id*/, NeighList *ptr) -{ - list = ptr; -} - -/* ---------------------------------------------------------------------- */ - -void ComputeMLIAP::compute_array() -{ - int ntotal = atom->nlocal + atom->nghost; - - invoked_array = update->ntimestep; - - // grow mliap_peratom array if necessary - - if (atom->nmax > nmax) { - memory->destroy(mliap_peratom); - nmax = atom->nmax; - memory->create(mliap_peratom,nmax,size_peratom, - "mliap:mliap_peratom"); - } - - if (gamma_max < list->inum) { - memory->grow(descriptors,list->inum,ndescriptors,"PairMLIAP:descriptors"); - memory->grow(gamma,nparams,list->inum,ndescriptors,"PairMLIAP:gamma"); - gamma_max = list->inum; - } - - // clear global array - - for (int irow = 0; irow < size_array_rows; irow++) - for (int icoeff = 0; icoeff < size_array_cols; icoeff++) - mliap[irow][icoeff] = 0.0; - - // clear local peratom array - - for (int i = 0; i < ntotal; i++) - for (int icoeff = 0; icoeff < size_peratom; icoeff++) { - mliap_peratom[i][icoeff] = 0.0; - } - - // invoke full neighbor list (will copy or build if necessary) - - neighbor->build_one(list); - - // compute descriptors, if needed - - if (model->nonlinearflag) - descriptor->forward(map, list, descriptors); - - // ***********THIS IS NOT RIGHT********************** - // This whole idea is flawed. The gamma matrix is too big to - // store. Instead, we should generate the A matrix, - // just as ComputeSNAP does, and then pass it to - // the model, which can evaluate gradients of E, F, sigma, - // w.r.t. model parameters. - - // calculate descriptor contributions to parameter gradients - // and gamma = double gradient w.r.t. parameters and descriptors - - // i.e. gamma = d2E/d\sigma.dB_i - // sigma is a parameter and B_i is a descriptor of atom i - // for SNAP, this is a sparse nparams*natoms*ndescriptors matrix, - // but in general it could be fully dense. - - // *******Not implemented yet***************** - // This should populate the energy row and gamma - // For the linear model energy row will look just like the Bi accumulation - // in ComputeSNAP i.e. accumulating the intput descriptors vector, - // while gamma will be just 1's and 0's - // For the quadratic model, the energy row will be similar, - // while gamma will be 1's, 0's and Bi's - - // model->param_gradient(list, descriptors, mliap[0], gamma); - - // calculate descriptor gradient contributions to parameter gradients - - // *******Not implemented yet***************** - // This will just take gamma and multiply it with - // descriptor gradient contributions i.e. dblist - // this will resemble snadi accumualation in ComputeSNAP - // descriptor->param_backward(list, gamma, snadi); - - // accumulate descriptor gradient contributions to global array - - for (int itype = 0; itype < atom->ntypes; itype++) { - const int typeoffset_local = ndims_peratom*nperdim*itype; - const int typeoffset_global = nperdim*itype; - for (int icoeff = 0; icoeff < nperdim; icoeff++) { - int irow = 1; - for (int i = 0; i < ntotal; i++) { - double *snadi = mliap_peratom[i]+typeoffset_local; - int iglobal = atom->tag[i]; - int irow = 3*(iglobal-1)+1; - mliap[irow][icoeff+typeoffset_global] += snadi[icoeff]; - mliap[irow+1][icoeff+typeoffset_global] += snadi[icoeff+yoffset]; - mliap[irow+2][icoeff+typeoffset_global] += snadi[icoeff+zoffset]; - } - } - } - - // accumulate forces to global array - - for (int i = 0; i < atom->nlocal; i++) { - int iglobal = atom->tag[i]; - int irow = 3*(iglobal-1)+1; - mliap[irow][lastcol] = atom->f[i][0]; - mliap[irow+1][lastcol] = atom->f[i][1]; - mliap[irow+2][lastcol] = atom->f[i][2]; - } - - // accumulate bispectrum virial contributions to global array - - dbdotr_compute(); - - // sum up over all processes - - MPI_Allreduce(&mliap[0][0],&mliapall[0][0],size_array_rows*size_array_cols,MPI_DOUBLE,MPI_SUM,world); - - // assign energy to last column - - int irow = 0; - double reference_energy = c_pe->compute_scalar(); - mliapall[irow++][lastcol] = reference_energy; - - // assign virial stress to last column - // switch to Voigt notation - - c_virial->compute_vector(); - irow += 3*natoms; - mliapall[irow++][lastcol] = c_virial->vector[0]; - mliapall[irow++][lastcol] = c_virial->vector[1]; - mliapall[irow++][lastcol] = c_virial->vector[2]; - mliapall[irow++][lastcol] = c_virial->vector[5]; - mliapall[irow++][lastcol] = c_virial->vector[4]; - mliapall[irow++][lastcol] = c_virial->vector[3]; - -} - -/* ---------------------------------------------------------------------- - compute global virial contributions via summing r_i.dB^j/dr_i over - own & ghost atoms -------------------------------------------------------------------------- */ - -void ComputeMLIAP::dbdotr_compute() -{ - double **x = atom->x; - int irow0 = 1+ndims_force*natoms; - - // sum over bispectrum contributions to forces - // on all particles including ghosts - - int nall = atom->nlocal + atom->nghost; - for (int i = 0; i < nall; i++) - for (int itype = 0; itype < atom->ntypes; itype++) { - const int typeoffset_local = ndims_peratom*nperdim*itype; - const int typeoffset_global = nperdim*itype; - double *snadi = mliap_peratom[i]+typeoffset_local; - for (int icoeff = 0; icoeff < nperdim; icoeff++) { - double dbdx = snadi[icoeff]; - double dbdy = snadi[icoeff+yoffset]; - double dbdz = snadi[icoeff+zoffset]; - int irow = irow0; - mliap[irow++][icoeff+typeoffset_global] += dbdx*x[i][0]; - mliap[irow++][icoeff+typeoffset_global] += dbdy*x[i][1]; - mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][2]; - mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][1]; - mliap[irow++][icoeff+typeoffset_global] += dbdz*x[i][0]; - mliap[irow++][icoeff+typeoffset_global] += dbdy*x[i][0]; - } - } -} - -/* ---------------------------------------------------------------------- - memory usage -------------------------------------------------------------------------- */ - -double ComputeMLIAP::memory_usage() -{ - - double bytes = size_array_rows*size_array_cols * - sizeof(double); // mliap - bytes += size_array_rows*size_array_cols * - sizeof(double); // mliapall - bytes += nmax*size_peratom * sizeof(double); // mliap_peratom - int n = atom->ntypes+1; - bytes += n*sizeof(int); // map - - return bytes; -} diff --git a/src/MLIAP/compute_mliap.h b/src/MLIAP/compute_mliap.h deleted file mode 100644 index bc84880b5e..0000000000 --- a/src/MLIAP/compute_mliap.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifdef COMPUTE_CLASS - -ComputeStyle(mliap,ComputeMLIAP) - -#else - -#ifndef LMP_COMPUTE_MLIAP_H -#define LMP_COMPUTE_MLIAP_H - -#include "compute.h" - -namespace LAMMPS_NS { - -class ComputeMLIAP : public Compute { - public: - ComputeMLIAP(class LAMMPS *, int, char **); - ~ComputeMLIAP(); - void init(); - void init_list(int, class NeighList *); - void compute_array(); - double memory_usage(); - - private: - int natoms, nmax, size_peratom, lastcol; - int nperdim, yoffset, zoffset; - int ndims_peratom, ndims_force, ndims_virial; - double **cutsq; - class NeighList *list; - double **mliap, **mliapall; - double **mliap_peratom; - int *map; // map types to [0,nelements) - int nelements; - - double*** gamma; // gammas for all atoms in list - double** descriptors; // descriptors for all atoms in list - int ndescriptors; // number of descriptors - int gamma_max; // number of atoms allocated for beta, descriptors - int nparams; // number of model paramters per element - - class MLIAPModel* model; - class MLIAPDescriptor* descriptor; - - Compute *c_pe; - Compute *c_virial; - - void dbdotr_compute(); -}; - -} - -#endif -#endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -Self-explanatory. Check the input script syntax and compare to the -documentation for the command. You can use -echo screen as a -command-line option when running LAMMPS to see the offending line. - -E: Compute snap requires a pair style be defined - -Self-explanatory. - -E: Compute snap cutoff is longer than pairwise cutoff - -UNDOCUMENTED - -W: More than one compute snad/atom - -Self-explanatory. - -*/ From ac48f2dd67723e7a25d6dd60c4a3ada970cd2320 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 13:30:43 -0400 Subject: [PATCH 19/54] add a hard dependency of MLIAP on SNAP --- cmake/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1fdac2ab6f..64a1a08f52 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -200,6 +200,7 @@ endif() # "hard" dependencies between packages resulting # in an error instead of skipping over files +pkg_depends(MLIAP SNAP) pkg_depends(MPIIO MPI) pkg_depends(USER-ATC MANYBODY) pkg_depends(USER-LB MPI) From 1f3c3bfb3c72afe22a60d6c7d81b7ece0d953cea Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 13:30:54 -0400 Subject: [PATCH 20/54] snap is listed twice --- doc/src/Commands_pair.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index c67ceb6d08..fc5a49bf8a 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -229,7 +229,6 @@ OPT. * :doc:`smd/ulsph ` * :doc:`smtbq ` * :doc:`snap (k) ` - * :doc:`snap (k) ` * :doc:`soft (go) ` * :doc:`sph/heatconduction ` * :doc:`sph/idealgas ` From 6e714fec425be518a9826dc3231ae9a98486ad1b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 13:40:30 -0400 Subject: [PATCH 21/54] fix underline --- doc/src/Packages_details.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 9c01f1a419..2e6773489f 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -656,7 +656,7 @@ listing, "ls src/MISC", to see the list of commands. .. _PKG-MLIAP: MLIAP package ------------- +------------- **Contents:** From 6fbcb848194f6607b44b0ffd24f02bc47e1ea434 Mon Sep 17 00:00:00 2001 From: Sievers Date: Mon, 22 Jun 2020 15:26:04 -0700 Subject: [PATCH 22/54] Update dynamical matrix examples --- .../Silicon/Si.opt.tersoff | 66 ---- .../Silicon/ff-silicon.lmp | 2 +- .../Silicon/results/dynmat.dat | 368 +++++++++--------- .../Silicon/results/out.silicon | 47 ++- .../dynamical_matrix_command/python/dynmat.py | 6 +- .../python/results/dynmat.dat | 192 +++++++++ .../python/results/out.dynamt | 71 ++++ 7 files changed, 478 insertions(+), 274 deletions(-) delete mode 100755 examples/USER/phonon/dynamical_matrix_command/Silicon/Si.opt.tersoff mode change 100755 => 100644 examples/USER/phonon/dynamical_matrix_command/Silicon/results/dynmat.dat mode change 100755 => 100644 examples/USER/phonon/dynamical_matrix_command/Silicon/results/out.silicon create mode 100644 examples/USER/phonon/dynamical_matrix_command/python/results/dynmat.dat create mode 100644 examples/USER/phonon/dynamical_matrix_command/python/results/out.dynamt diff --git a/examples/USER/phonon/dynamical_matrix_command/Silicon/Si.opt.tersoff b/examples/USER/phonon/dynamical_matrix_command/Silicon/Si.opt.tersoff deleted file mode 100755 index 3bc19f0581..0000000000 --- a/examples/USER/phonon/dynamical_matrix_command/Silicon/Si.opt.tersoff +++ /dev/null @@ -1,66 +0,0 @@ -# Tersoff parameters for various elements and mixtures -# multiple entries can be added to this file, LAMMPS reads the ones it needs -# these entries are in LAMMPS "metal" units: -# A,B = eV; lambda1,lambda2,lambda3 = 1/Angstroms; R,D = Angstroms -# other quantities are unitless - -# Aidan Thompson (athomps at sandia.gov) takes full blame for this -# file. It specifies various potentials published by J. Tersoff for -# silicon, carbon and germanium. Since Tersoff published several -# different silicon potentials, I refer to them using atom types -# Si(B), Si(C) and Si(D). The last two are almost almost identical but -# refer to two different publications. These names should be used in -# the LAMMPS command when the file is invoked. For example: -# pair_coeff * * SiCGe.tersoff Si(B). The Si(D), C and Ge potentials -# can be used pure silicon, pure carbon, pure germanium, binary SiC, -# and binary SiGe, but not binary GeC or ternary SiGeC. LAMMPS will -# generate an error if this file is used with any combination -# involving C and Ge, since there are no entries for the GeC -# interactions (Tersoff did not publish parameters for this -# cross-interaction.) - -# format of a single entry (one or more lines): -# element 1, element 2, element 3, -# m, gamma, lambda3, c, d, costheta0, n, beta, lambda2, B, R, D, lambda1, A - -# The original Tersoff potential for Silicon, Si(B) -# J. Tersoff, PRB, 37, 6991 (1988) - -Si(B) Si(B) Si(B) 3.0 1.0 1.3258 4.8381 2.0417 0.0000 22.956 - 0.33675 1.3258 95.373 3.0 0.2 3.2394 3264.7 - -# The later Tersoff potential for Silicon, Si(C) -# J. Tersoff, PRB, 38, 9902 (1988) - -Si(C) Si(C) Si(C) 3.0 1.0 1.7322 1.0039e5 16.218 -0.59826 0.78734 - 1.0999e-6 1.7322 471.18 2.85 0.15 2.4799 1830.8 - -# The later Tersoff potential for Carbon, Silicon, and Germanium -# J. Tersoff, PRB, 39, 5566 (1989) + errata (PRB 41, 3248) -# The Si and C parameters are very close to those in SiC.tersoff - -C C C 3.0 1.0 0.0 3.8049e4 4.3484 -0.57058 0.72751 1.5724e-7 2.2119 346.74 1.95 0.15 3.4879 1393.6 -Si(D) Si(D) Si(D) 3.0 1.0 0.0 1.0039e5 16.217 -0.59825 0.78734 1.1000e-6 1.7322 471.18 2.85 0.15 2.4799 1830.8 -Ge Ge Ge 3.0 1.0 0.0 1.0643e5 15.652 -0.43884 0.75627 9.0166e-7 1.7047 419.23 2.95 0.15 2.4451 1769.0 - -C Si(D) Si(D) 3.0 1.0 0.0 3.8049e4 4.3484 -0.57058 0.72751 1.5724e-7 1.97205 395.1451 2.3573 0.1527 2.9839 1597.3111 -C Si(D) C 3.0 1.0 0.0 3.8049e4 4.3484 -0.57058 0.72751 0.0 0.0 0.0 1.95 0.15 0.0 0.0 -C C Si(D) 3.0 1.0 0.0 3.8049e4 4.3484 -0.57058 0.72751 0.0 0.0 0.0 2.3573 0.1527 0.0 0.0 - -Si(D) C C 3.0 1.0 0.0 1.0039e5 16.217 -0.59825 0.78734 1.1000e-6 1.97205 395.1451 2.3573 0.1527 2.9839 1597.3111 -Si(D) Si(D) C 3.0 1.0 0.0 1.0039e5 16.217 -0.59825 0.78734 0.0 0.0 0.0 2.3573 0.1527 0.0 0.0 -Si(D) C Si(D) 3.0 1.0 0.0 1.0039e5 16.217 -0.59825 0.78734 0.0 0.0 0.0 2.85 0.15 0.0 0.0 - -Si(D) Ge Ge 3.0 1.0 0.0 1.0039e5 16.217 -0.59825 0.78734 1.1000e-6 1.71845 444.7177 2.8996 0.1500 2.4625 1799.6347 -Si(D) Si(D) Ge 3.0 1.0 0.0 1.0039e5 16.217 -0.59825 0.78734 0.0 0.0 0.0 2.8996 0.1500 0.0 0.0 -Si(D) Ge Si(D) 3.0 1.0 0.0 1.0039e5 16.217 -0.59825 0.78734 0.0 0.0 0.0 2.85 0.15 0.0 0.0 - -Ge Si(D) Si(D) 3.0 1.0 0.0 1.0643e5 15.652 -0.43884 0.75627 9.0166e-7 1.71845 444.7177 2.8996 0.1500 2.4625 1799.6347 -Ge Si(D) Ge 3.0 1.0 0.0 1.0643e5 15.652 -0.43884 0.75627 0.0 0.0 0.0 2.95 0.15 0.0 0.0 -Ge Ge Si(D) 3.0 1.0 0.0 1.0643e5 15.652 -0.43884 0.75627 0.0 0.0 0.0 2.8996 0.1500 0.0 0.0 - -# Optimized Tersoff for Carbon: Lindsay and Broido PRB 81, 205441 (2010) -# element 1, element 2, element 3, -# m, gamma, lambda3, c, d, costheta0, n, beta, lambda2, B, R, D, lambda1, A -C(O) C(O) C(O) 3.0 1.0 0.0 3.8049e4 4.3484 -0.930 0.72751 1.5724e-7 2.2119 430.0 1.95 0.15 3.4879 1393.6 - diff --git a/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp b/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp index f3b895f168..5768408b61 100755 --- a/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp +++ b/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp @@ -16,4 +16,4 @@ mass ${Si} 28.08550 ########################### pair_style tersoff -pair_coeff * * Si.opt.tersoff Si(D) +pair_coeff * * ../../../../../potentials/SiCGe.tersoff Si(D) diff --git a/examples/USER/phonon/dynamical_matrix_command/Silicon/results/dynmat.dat b/examples/USER/phonon/dynamical_matrix_command/Silicon/results/dynmat.dat old mode 100755 new mode 100644 index 676f897416..b6712ea4f9 --- a/examples/USER/phonon/dynamical_matrix_command/Silicon/results/dynmat.dat +++ b/examples/USER/phonon/dynamical_matrix_command/Silicon/results/dynmat.dat @@ -1,192 +1,192 @@ 5409.83472486 3.05075234 0.00000214 --1277.48270695 -863.24917964 -862.95613831 --193.14095266 0.11071645 0.00000015 --1277.48270619 -863.24917934 862.95613793 --193.17613831 0.34066975 -0.00000031 --1276.01088244 861.54715125 -861.62537402 -83.46959051 -0.09801326 0.00000000 --1276.01088167 861.54715064 861.62537387 -3.05073556 5409.83419867 0.00000137 --863.13224993 -1277.34160622 -862.92133430 -0.12865796 -193.14095472 -0.00000023 --863.13224825 -1277.34160485 862.92133392 --0.23661028 83.46934214 -0.00000046 -861.66402909 -1276.15172701 861.66024333 --0.00634065 -193.17585981 -0.00000015 -861.66402909 -1276.15172686 -861.66024394 -0.00000031 0.00000031 5410.11037330 --862.89766079 -862.97973912 -1277.71823542 -0.00000000 -0.00000008 83.84059083 -862.89766018 862.97973851 -1277.71823557 -0.00000015 0.00000015 -193.17558390 --861.60900269 861.52691291 -1276.08157137 --0.00000015 -0.00000031 -193.17573821 -861.60900330 -861.52691284 -1276.08157236 --1277.48271824 -863.13225435 -862.89768596 -5409.83567916 3.04882502 2.82007861 --1277.34161080 -863.24919475 862.97975804 --193.14089260 0.11950100 0.11994134 --1277.52243157 863.24943259 -863.11331046 --193.17597070 0.16713301 -0.02106496 --1274.64156872 859.96385388 860.17328202 -83.46945758 -0.16730525 -0.06100253 --863.24919444 -1277.34161103 -862.97975804 -3.04882666 5409.83567944 -2.82007731 --863.13225496 -1277.48271916 862.89768688 -0.11950094 -193.14089255 -0.11994043 -863.24943320 -1277.52243118 863.11331076 --0.16730522 83.46945778 0.06100314 -859.96385365 -1274.64156819 -860.17328225 -0.16713979 -193.17596607 0.02106008 --862.95611199 -862.92132598 -1277.71824411 -2.82004085 -2.82004013 5410.11000835 -862.92132743 862.95611344 -1277.71824587 --0.11994722 0.11994786 83.84083834 --862.88110757 862.88110699 -1277.34764097 -0.02099713 0.06108924 -193.17561785 -860.25587487 -860.25587502 -1274.81548840 --0.06108897 -0.02099687 -193.17561808 --193.14095465 0.12865765 0.00000015 --1277.34160508 -863.13224794 862.92133361 -5409.83419867 3.05073968 0.00000092 --1277.34160584 -863.13224924 -862.92133483 -83.46934214 -0.23660998 -0.00000076 --1276.15172724 861.66402917 861.66024325 --193.17585988 -0.00634042 -0.00000031 --1276.15172694 861.66402940 -861.66024325 -0.11071645 -193.14095243 0.00000046 --863.24917949 -1277.48270718 862.95613831 -3.05075524 5409.83472478 -0.00000046 --863.24918117 -1277.48270825 -862.95613923 -0.34066922 -193.17613823 0.00000046 -861.54715094 -1276.01088228 -861.62537295 --0.09801303 83.46959035 0.00000015 -861.54713538 -1276.01088145 861.62537387 --0.00000046 -0.00000023 83.84059068 -862.97973867 862.89766010 -1277.71823633 --0.00000214 -0.00000053 5410.11037574 --862.97973943 -862.89766079 -1277.71823633 -0.00000015 0.00000008 -193.17558374 -861.52691291 -861.60900269 -1276.08157198 --0.00000015 -0.00000015 -193.17573814 --861.52691368 861.60900261 -1276.08157243 +-1277.48271855 -863.13225405 -862.89768612 +-193.14095469 0.12865732 0.00000061 -1277.48271786 -863.13225450 862.89768520 --193.14089232 0.11950085 -0.11994115 --1277.34161255 -863.24919673 -862.97975957 -5409.83568051 3.04882517 -2.82007644 --1277.52243110 863.24943259 863.11330990 -83.46945732 -0.16730494 0.06100319 --1274.64156796 859.96385342 -860.17328103 --193.17597041 0.16713331 0.02106477 --863.24919482 -1277.34161057 862.97975774 -0.11950077 -193.14089270 0.11994160 --863.13225473 -1277.48271839 -862.89768673 -3.04882502 5409.83568081 2.82007903 -863.24943084 -1277.52242966 -863.11330868 -0.16713324 -193.17597064 -0.02106522 -859.96385510 -1274.64156926 860.17328255 --0.16730411 83.46945641 -0.06100350 -862.95611161 862.92132537 -1277.71824365 -0.11994725 -0.11994740 83.84083859 --862.92132606 -862.95611207 -1277.71824548 --2.82003936 2.82004013 5410.11000806 -862.88110509 -862.88110547 -1277.34764015 -0.06108893 0.02099703 -193.17561792 --860.25587388 860.25587441 -1274.81548916 --0.02099726 -0.06108878 -193.17561777 --193.17613465 -0.23660693 0.00000015 --1277.52241409 863.24943328 -862.88111478 -83.46934549 0.34066334 -0.00000015 --1277.52241425 863.24943335 862.88111508 -5404.58897235 -9.71806749 0.00000015 --1273.31333522 -858.38273960 -858.96245956 --193.21062369 -0.11938368 0.00000000 --1273.31333598 -858.38273967 858.96245926 -0.34066342 83.46934572 0.00000015 -863.24943335 -1277.52241402 862.88111478 --0.23660723 -193.17613480 -0.00000046 -863.24943320 -1277.52241425 -862.88111432 --9.71806582 5404.58897135 -0.00000183 --858.38273891 -1273.31333552 -858.96245926 --0.11938338 -193.21062369 0.00000000 --858.38273937 -1273.31333598 858.96245987 --0.00000031 -0.00000008 -193.17559595 --863.11328229 863.11328297 -1277.34763999 -0.00000000 -0.00000015 -193.17559595 -863.11328305 -863.11328282 -1277.34763984 -0.00000122 -0.00000259 5404.30470550 --858.80486827 -858.80486866 -1273.17865241 --0.00000031 0.00000000 83.09905870 -858.80486827 858.80486812 -1273.17865272 +-193.17613450 -0.23660702 0.00000031 -1276.01089136 861.66402482 -861.60900483 --193.17596134 -0.16730494 0.02099535 --1276.15175745 861.54714988 861.52691337 -83.46947097 0.16714109 0.06108436 --1273.31334651 -858.38273311 -858.80488185 -5404.58493608 -3.04507687 -2.81778617 --1276.19187193 -861.66399965 861.74280750 --193.21058304 -0.11920641 -0.12012575 -861.54714972 -1276.15175730 861.52691337 -0.16714140 83.46947120 0.06108451 -861.66402345 -1276.01089022 -861.60900330 --0.16730487 -193.17596164 0.02099489 --858.38273281 -1273.31334681 -858.80488063 --3.04507603 5404.58493554 -2.81778617 --861.66400079 -1276.19187270 861.74280887 --0.11920511 -193.21058281 -0.12012498 --861.62536929 861.66025668 -1276.08157121 --0.02106026 0.06099877 -193.17561197 -861.66025752 -861.62537051 -1276.08157274 -0.06099923 -0.02106049 -193.17561227 --858.96244980 -858.96244965 -1273.17866523 --2.81780608 -2.81780615 5404.30474272 -861.58531232 861.58531248 -1275.71087663 -0.12013467 0.12013460 83.09915619 -83.46958166 -0.00634218 -0.00000023 --1274.64157002 859.96383191 860.25587098 --193.17585332 -0.09802844 0.00000023 --1274.64157155 859.96383290 -860.25587243 --193.21062064 -0.11939070 -0.00000008 --1276.19189573 -861.66398638 861.58531118 -5404.58377546 3.62403097 0.00000015 --1276.19189558 -861.66398615 -861.58531103 --0.09802859 -193.17585355 -0.00000015 -859.96383206 -1274.64156979 -860.25587113 --0.00634187 83.46958204 -0.00000008 -859.96383282 -1274.64157132 860.25587212 --0.11939055 -193.21062041 0.00000000 --861.66398576 -1276.19189528 861.58531087 -3.62402982 5404.58377698 -0.00000076 --861.66398927 -1276.19189772 -861.58531331 -0.00000000 0.00000000 -193.17573654 -860.17327676 -860.17327637 -1274.81551212 -0.00000031 0.00000023 -193.17573676 --860.17327615 860.17327645 -1274.81551258 -0.00000000 0.00000015 83.09907327 -861.74281299 861.74281299 -1275.71086763 --0.00000046 -0.00000015 5404.30514861 --861.74281406 -861.74281421 -1275.71086938 +83.46958227 -0.00634221 -0.00000026 -1276.01088968 861.66402284 861.60900330 -83.46947136 0.16714109 -0.06108436 --1276.15175722 861.54714957 -861.52691391 --193.17596141 -0.16730510 -0.02099527 --1273.31334666 -858.38273281 858.80488124 --193.21058304 -0.11920641 0.12012636 --1276.19187285 -861.66400087 -861.74280773 -5404.58493638 -3.04507565 2.81778602 +3.05073556 5409.83419867 0.00000137 +-863.24919414 -1277.34161118 -862.97975804 +0.11071644 -193.14095221 0.00000015 +-863.24919482 -1277.34161057 862.97975774 +0.34066372 83.46934579 0.00000015 +861.54714972 -1276.15175730 861.52691337 +-0.09802844 -193.17585342 -0.00000005 861.54715133 -1276.15175913 -861.52691490 --0.16730502 -193.17596118 -0.02099497 -861.66402314 -1276.01088976 861.60900383 -0.16714125 83.46947151 -0.06108497 --858.38273296 -1273.31334681 858.80488139 --0.11920686 -193.21058311 0.12012605 --861.66400079 -1276.19187255 -861.74280811 --3.04506703 5404.58493432 2.81779319 +0.00000031 0.00000031 5410.11037330 +-862.95611222 -862.92132598 -1277.71824426 +-0.00000027 -0.00000023 83.84059068 +862.95611161 862.92132537 -1277.71824365 +-0.00000015 0.00000006 -193.17559671 +-861.62536929 861.66025668 -1276.08157121 +0.00000031 -0.00000000 -193.17573662 861.62536952 -861.66025637 -1276.08157175 +-1277.48270695 -863.24917964 -862.95613831 +5409.83567791 3.04882503 2.82007909 +-1277.34160500 -863.13224794 862.92133361 +-193.14089232 0.11950085 -0.11994115 +-1277.52241409 863.24943335 -862.88111478 +-193.17596134 -0.16730494 0.02099535 +-1274.64156987 859.96383191 860.25587098 +83.46947136 0.16714109 -0.06108436 +-863.13224993 -1277.34160622 -862.92133430 +3.04882664 5409.83567981 -2.82007772 +-863.24917934 -1277.48270718 862.95613862 +0.11950077 -193.14089270 0.11994160 +863.24943366 -1277.52241409 862.88111478 +0.16714140 83.46947120 0.06108451 +859.96383191 -1274.64156979 -860.25587113 +-0.16730502 -193.17596118 -0.02099497 +-862.89766079 -862.97973912 -1277.71823542 +2.82004053 -2.82003977 5410.11000766 +862.97973867 862.89766003 -1277.71823633 +0.11994725 -0.11994740 83.84083859 +-863.11328229 863.11328297 -1277.34763999 +-0.02106026 0.06099877 -193.17561197 +860.17327676 -860.17327637 -1274.81551212 -0.06099938 0.02106080 -193.17561235 --861.66025645 861.62536929 -1276.08157213 -0.02106049 -0.06099862 -193.17561189 -858.96245049 858.96245041 -1273.17866553 --0.12013444 -0.12013475 83.09915550 +-193.14095266 0.11071661 0.00000023 +-1277.34161164 -863.24919490 862.97975758 +5409.83419895 3.05073908 0.00000031 +-1277.34161248 -863.24919704 -862.97976018 +83.46934641 0.34066377 0.00000031 +-1276.15175798 861.54714988 861.52691307 +-193.17585317 -0.09802854 0.00000018 +-1276.15175745 861.54714957 -861.52691314 +0.12865765 -193.14095472 0.00000000 +-863.13225527 -1277.48271931 862.89768673 +3.05075511 5409.83472469 -0.00000046 +-863.13225489 -1277.48271839 -862.89768612 +-0.23660723 -193.17613471 0.00000061 +861.66402345 -1276.01089068 -861.60900391 +-0.00634202 83.46958197 0.00000012 +861.66402314 -1276.01088961 861.60900353 +-0.00000015 -0.00000015 83.84059098 +862.92132797 862.95611360 -1277.71824533 +-0.00000145 -0.00000137 5410.11037498 +-862.92132598 -862.95611222 -1277.71824426 +-0.00000031 -0.00000009 -193.17559671 +861.66025660 -861.62536929 -1276.08157182 +0.00000015 0.00000014 -193.17573668 +-861.66025615 861.62536929 -1276.08157190 +-1277.48270619 -863.24917934 862.95613793 +-193.14089264 0.11950070 0.11994149 +-1277.34160589 -863.13224892 -862.92133438 +5409.83568112 3.04882502 -2.82007598 +-1277.52241409 863.24943313 862.88111386 +83.46947128 0.16714155 0.06108420 +-1274.64157216 859.96383297 -860.25587243 +-193.17596164 -0.16730510 -0.02099535 +-863.13224825 -1277.34160470 862.92133392 +0.11950069 -193.14089248 -0.11994088 +-863.24918118 -1277.48270824 -862.95613907 +3.04882479 5409.83568081 2.82007857 +863.24943366 -1277.52241409 -862.88111386 +-0.16730494 -193.17596164 0.02099504 +859.96383191 -1274.64157155 860.25587228 +0.16714109 83.46947120 -0.06108481 +862.89766018 862.97973836 -1277.71823542 +-0.11994717 0.11994762 83.84083846 +-862.97973940 -862.89766100 -1277.71823603 +-2.82004089 2.82004165 5410.11001111 +863.11328534 -863.11328473 -1277.34764213 +0.06099900 -0.02106019 -193.17561197 +-860.17327706 860.17327752 -1274.81551319 +0.02106049 -0.06099877 -193.17561212 +-193.17613831 0.34066975 0.00000000 +-1277.52243217 863.24943252 -863.11331043 +83.46934255 -0.23660983 0.00000046 +-1277.52243126 863.24943229 863.11330975 +5404.58897296 -9.71806756 0.00000046 +-1273.31334689 -858.38273326 -858.80488185 +-193.21062125 -0.11939087 -0.00000018 +-1273.31334666 -858.38273265 858.80488124 +-0.23661028 83.46934221 -0.00000038 +863.24943259 -1277.52243133 863.11331043 +0.34066924 -193.17613846 -0.00000015 +863.24943168 -1277.52243072 -863.11330883 +-9.71806704 5404.58897205 -0.00000107 +-858.38273265 -1273.31334697 -858.80488063 +-0.11939101 -193.21062043 0.00000006 +-858.38273296 -1273.31334681 858.80488139 +0.00000015 0.00000000 -193.17558413 +-862.88110730 862.88110699 -1277.34764060 +-0.00000001 -0.00000001 -193.17558374 +862.88110539 -862.88110516 -1277.34764030 +0.00000122 -0.00000264 5404.30470473 +-858.96244965 -858.96244934 -1273.17866523 +-0.00000046 0.00000006 83.09907322 +858.96245026 858.96245041 -1273.17866553 +-1276.01088335 861.54715186 -861.62537494 +-193.17596632 0.16713991 -0.02106865 +-1276.15172701 861.66401376 861.66024356 +83.46945641 -0.16730418 0.06100182 +-1273.31333507 -858.38273911 -858.96245926 +5404.58493280 -3.04507046 -2.81778113 +-1276.19189558 -861.66398654 861.58531085 +-193.21058250 -0.11920503 0.12012704 +861.66401292 -1276.15172617 861.66024257 +-0.16730418 83.46945627 0.06100192 +861.54715110 -1276.01088167 -861.62537387 +0.16713972 -193.17596591 -0.02106965 +-858.38273891 -1273.31333542 -858.96245910 +-3.04506741 5404.58493142 -2.81778205 +-861.66398683 -1276.19189578 861.58531200 +-0.11920541 -193.21058250 0.12012674 +-861.60900269 861.52691291 -1276.08157152 +0.02099737 0.06108917 -193.17561785 +861.52691246 -861.60900299 -1276.08157243 +0.06108909 0.02099718 -193.17561746 +-858.80486827 -858.80486867 -1273.17865256 +-2.81780745 -2.81780722 5404.30474364 +861.74281375 861.74281365 -1275.71086885 +-0.12013460 -0.12013475 83.09915550 +83.46959035 -0.09801326 0.00000000 +-1274.64156874 859.96385402 860.17328225 +-193.17585994 -0.00634034 0.00000031 +-1274.64156789 859.96385357 -860.17328072 +-193.21062369 -0.11938345 0.00000015 +-1276.19187300 -861.66400056 861.74280857 +5404.58377637 3.62403189 -0.00000071 +-1276.19187285 -861.66400087 -861.74280780 +-0.00634065 -193.17585981 -0.00000015 +859.96385345 -1274.64156845 -860.17328227 +-0.09801307 83.46959066 0.00000092 +859.96385342 -1274.64156728 860.17328103 +-0.11938399 -193.21062370 0.00000031 +-861.66399988 -1276.19187163 861.74280780 +3.62403013 5404.58377402 0.00000142 +-861.66400079 -1276.19187255 -861.74280803 +-0.00000031 -0.00000038 -193.17573821 +860.25587448 -860.25587441 -1274.81548871 +0.00000000 -0.00000026 -193.17573875 +-860.25587388 860.25587456 -1274.81548916 +0.00000015 -0.00000009 83.09905855 +861.58531164 861.58531156 -1275.71087571 +0.00000046 0.00000089 5404.30514766 -861.58531232 -861.58531217 -1275.71087655 -2.81780737 2.81780753 5404.30474547 +-1276.01088198 861.54713523 861.62537356 +83.46945674 -0.16730402 -0.06100344 +-1276.15172688 861.66402939 -861.66024402 +-193.17596584 0.16713972 0.02106034 +-1273.31333552 -858.38273940 858.96245956 +-193.21058227 -0.11920503 -0.12012498 +-1276.19189573 -861.66398605 -861.58531085 +5404.58493188 -3.04506924 2.81779059 +861.66402925 -1276.15172686 -861.66024394 +0.16713982 -193.17596610 0.02106041 +861.54713537 -1276.01088130 861.62537448 +-0.16730426 83.46945625 -0.06100350 +-858.38273967 -1273.31333570 858.96245987 +-0.11920511 -193.21058281 -0.12012514 +-861.66398958 -1276.19189780 -861.58531314 +-3.04506687 5404.58493417 2.81779303 +861.60900299 -861.52691253 -1276.08157236 +-0.06108885 -0.02099714 -193.17561830 +-861.52691343 861.60900260 -1276.08157198 +-0.02099726 -0.06108848 -193.17561792 +858.80486782 858.80486829 -1273.17865256 +0.12013467 0.12013460 83.09915604 +-861.74281406 -861.74281426 -1275.71086942 +2.81780737 2.81780737 5404.30474524 diff --git a/examples/USER/phonon/dynamical_matrix_command/Silicon/results/out.silicon b/examples/USER/phonon/dynamical_matrix_command/Silicon/results/out.silicon old mode 100755 new mode 100644 index 9920ddac51..1f39f3b830 --- a/examples/USER/phonon/dynamical_matrix_command/Silicon/results/out.silicon +++ b/examples/USER/phonon/dynamical_matrix_command/Silicon/results/out.silicon @@ -1,7 +1,7 @@ -LAMMPS (16 Jul 2018) +LAMMPS (15 Jun 2020) Reading data file ... - orthogonal box = (0 0 0) to (5.431 5.431 5.431) - 1 by 2 by 2 MPI processor grid + orthogonal box = (0.0 0.0 0.0) to (5.431 5.431 5.431) + 1 by 1 by 1 MPI processor grid reading atoms ... 8 atoms Finding 1-2 1-3 1-4 neighbors ... @@ -11,6 +11,9 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-3 neighbors 0 = max # of 1-4 neighbors 1 = max # of special neighbors + special bonds CPU = 4.2e-05 secs + read_data CPU = 0.002 secs +Reading potential file ../../../../../potentials/SiCGe.tersoff with DATE: 2009-03-18 Neighbor list info ... update every 1 steps, delay 10 steps, check yes max neighbors/atom: 2000, page size: 100000 @@ -23,36 +26,40 @@ Neighbor list info ... pair build: full/bin stencil: full/bin/3d bin: standard -Calculating Dynamical Matrix... -Dynamical Matrix calculation took 0.001183 seconds +Calculating Dynamical Matrix ... + Total # of atoms = 8 + Atoms in group = 8 + Total dynamical matrix elements = 576 + 10% 20% 30% 50% 60% 70% 80% Finished Calculating Dynamical Matrix -Loop time of 1.22396e+06 on 4 procs for 0 steps with 8 atoms +Loop time of 0.000775099 on 1 procs for 48 steps with 8 atoms -0.0% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 5350.544 ns/day, 0.004 hours/ns, 61927.589 timesteps/s +91.3% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.00016781 | 0.00041345 | 0.00051464 | 0.0 | 0.00 -Bond | 1.9255e-06 | 2.1775e-06 | 2.4787e-06 | 0.0 | 0.00 +Pair | 0.00074148 | 0.00074148 | 0.00074148 | 0.0 | 95.66 +Bond | 3.8147e-06 | 3.8147e-06 | 3.8147e-06 | 0.0 | 0.49 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.00056143 | 0.00066602 | 0.00090865 | 0.0 | 0.00 +Comm | 7.8678e-06 | 7.8678e-06 | 7.8678e-06 | 0.0 | 1.02 Output | 0 | 0 | 0 | 0.0 | 0.00 -Modify | 0 | 0 | 0 | 0.0 | 0.00 -Other | | 1.224e+06 | | |100.00 +Modify | 9.5367e-07 | 9.5367e-07 | 9.5367e-07 | 0.0 | 0.12 +Other | | 2.098e-05 | | | 2.71 -Nlocal: 2 ave 3 max 1 min -Histogram: 1 0 0 0 0 2 0 0 0 1 -Nghost: 56 ave 57 max 55 min -Histogram: 1 0 0 0 0 2 0 0 0 1 +Nlocal: 8 ave 8 max 8 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 86 ave 86 max 86 min +Histogram: 1 0 0 0 0 0 0 0 0 0 Neighs: 0 ave 0 max 0 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -FullNghs: 32 ave 48 max 16 min -Histogram: 1 0 0 0 0 2 0 0 0 1 +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 128 Ave neighs/atom = 16 Ave special neighs/atom = 0 -Neighbor list builds = 0 +Neighbor list builds = 1 Dangerous builds = 0 Total wall time: 0:00:00 diff --git a/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py b/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py index 2a3a0b5a2f..33cc3419b3 100644 --- a/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py +++ b/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py @@ -9,8 +9,8 @@ import numpy as np """ LAMMPS VARIABLES """ # data files -infile = "silicon_input_file.lmp" -ff_file = "ff-silicon.lmp" +infile = "../Silicon/silicon_input_file.lmp" +ff_file = "../Silicon/ff-silicon.lmp" # full output useful for testing lmp = lammps() @@ -38,5 +38,5 @@ dynmat = dynmat.reshape((dynlen, dynlen)) eigvals, eigvecs = np.linalg.eig(dynmat) # frequencies in THz -omegas = np.sqrt(np.abs(eigvals)) +omegas = np.sqrt(np.abs(eigvals))/2/np.pi print(omegas) diff --git a/examples/USER/phonon/dynamical_matrix_command/python/results/dynmat.dat b/examples/USER/phonon/dynamical_matrix_command/python/results/dynmat.dat new file mode 100644 index 0000000000..b6712ea4f9 --- /dev/null +++ b/examples/USER/phonon/dynamical_matrix_command/python/results/dynmat.dat @@ -0,0 +1,192 @@ +5409.83472486 3.05075234 0.00000214 +-1277.48271855 -863.13225405 -862.89768612 +-193.14095469 0.12865732 0.00000061 +-1277.48271786 -863.13225450 862.89768520 +-193.17613450 -0.23660702 0.00000031 +-1276.01089136 861.66402482 -861.60900483 +83.46958227 -0.00634221 -0.00000026 +-1276.01088968 861.66402284 861.60900330 +3.05073556 5409.83419867 0.00000137 +-863.24919414 -1277.34161118 -862.97975804 +0.11071644 -193.14095221 0.00000015 +-863.24919482 -1277.34161057 862.97975774 +0.34066372 83.46934579 0.00000015 +861.54714972 -1276.15175730 861.52691337 +-0.09802844 -193.17585342 -0.00000005 +861.54715133 -1276.15175913 -861.52691490 +0.00000031 0.00000031 5410.11037330 +-862.95611222 -862.92132598 -1277.71824426 +-0.00000027 -0.00000023 83.84059068 +862.95611161 862.92132537 -1277.71824365 +-0.00000015 0.00000006 -193.17559671 +-861.62536929 861.66025668 -1276.08157121 +0.00000031 -0.00000000 -193.17573662 +861.62536952 -861.66025637 -1276.08157175 +-1277.48270695 -863.24917964 -862.95613831 +5409.83567791 3.04882503 2.82007909 +-1277.34160500 -863.13224794 862.92133361 +-193.14089232 0.11950085 -0.11994115 +-1277.52241409 863.24943335 -862.88111478 +-193.17596134 -0.16730494 0.02099535 +-1274.64156987 859.96383191 860.25587098 +83.46947136 0.16714109 -0.06108436 +-863.13224993 -1277.34160622 -862.92133430 +3.04882664 5409.83567981 -2.82007772 +-863.24917934 -1277.48270718 862.95613862 +0.11950077 -193.14089270 0.11994160 +863.24943366 -1277.52241409 862.88111478 +0.16714140 83.46947120 0.06108451 +859.96383191 -1274.64156979 -860.25587113 +-0.16730502 -193.17596118 -0.02099497 +-862.89766079 -862.97973912 -1277.71823542 +2.82004053 -2.82003977 5410.11000766 +862.97973867 862.89766003 -1277.71823633 +0.11994725 -0.11994740 83.84083859 +-863.11328229 863.11328297 -1277.34763999 +-0.02106026 0.06099877 -193.17561197 +860.17327676 -860.17327637 -1274.81551212 +-0.06099938 0.02106080 -193.17561235 +-193.14095266 0.11071661 0.00000023 +-1277.34161164 -863.24919490 862.97975758 +5409.83419895 3.05073908 0.00000031 +-1277.34161248 -863.24919704 -862.97976018 +83.46934641 0.34066377 0.00000031 +-1276.15175798 861.54714988 861.52691307 +-193.17585317 -0.09802854 0.00000018 +-1276.15175745 861.54714957 -861.52691314 +0.12865765 -193.14095472 0.00000000 +-863.13225527 -1277.48271931 862.89768673 +3.05075511 5409.83472469 -0.00000046 +-863.13225489 -1277.48271839 -862.89768612 +-0.23660723 -193.17613471 0.00000061 +861.66402345 -1276.01089068 -861.60900391 +-0.00634202 83.46958197 0.00000012 +861.66402314 -1276.01088961 861.60900353 +-0.00000015 -0.00000015 83.84059098 +862.92132797 862.95611360 -1277.71824533 +-0.00000145 -0.00000137 5410.11037498 +-862.92132598 -862.95611222 -1277.71824426 +-0.00000031 -0.00000009 -193.17559671 +861.66025660 -861.62536929 -1276.08157182 +0.00000015 0.00000014 -193.17573668 +-861.66025615 861.62536929 -1276.08157190 +-1277.48270619 -863.24917934 862.95613793 +-193.14089264 0.11950070 0.11994149 +-1277.34160589 -863.13224892 -862.92133438 +5409.83568112 3.04882502 -2.82007598 +-1277.52241409 863.24943313 862.88111386 +83.46947128 0.16714155 0.06108420 +-1274.64157216 859.96383297 -860.25587243 +-193.17596164 -0.16730510 -0.02099535 +-863.13224825 -1277.34160470 862.92133392 +0.11950069 -193.14089248 -0.11994088 +-863.24918118 -1277.48270824 -862.95613907 +3.04882479 5409.83568081 2.82007857 +863.24943366 -1277.52241409 -862.88111386 +-0.16730494 -193.17596164 0.02099504 +859.96383191 -1274.64157155 860.25587228 +0.16714109 83.46947120 -0.06108481 +862.89766018 862.97973836 -1277.71823542 +-0.11994717 0.11994762 83.84083846 +-862.97973940 -862.89766100 -1277.71823603 +-2.82004089 2.82004165 5410.11001111 +863.11328534 -863.11328473 -1277.34764213 +0.06099900 -0.02106019 -193.17561197 +-860.17327706 860.17327752 -1274.81551319 +0.02106049 -0.06099877 -193.17561212 +-193.17613831 0.34066975 0.00000000 +-1277.52243217 863.24943252 -863.11331043 +83.46934255 -0.23660983 0.00000046 +-1277.52243126 863.24943229 863.11330975 +5404.58897296 -9.71806756 0.00000046 +-1273.31334689 -858.38273326 -858.80488185 +-193.21062125 -0.11939087 -0.00000018 +-1273.31334666 -858.38273265 858.80488124 +-0.23661028 83.46934221 -0.00000038 +863.24943259 -1277.52243133 863.11331043 +0.34066924 -193.17613846 -0.00000015 +863.24943168 -1277.52243072 -863.11330883 +-9.71806704 5404.58897205 -0.00000107 +-858.38273265 -1273.31334697 -858.80488063 +-0.11939101 -193.21062043 0.00000006 +-858.38273296 -1273.31334681 858.80488139 +0.00000015 0.00000000 -193.17558413 +-862.88110730 862.88110699 -1277.34764060 +-0.00000001 -0.00000001 -193.17558374 +862.88110539 -862.88110516 -1277.34764030 +0.00000122 -0.00000264 5404.30470473 +-858.96244965 -858.96244934 -1273.17866523 +-0.00000046 0.00000006 83.09907322 +858.96245026 858.96245041 -1273.17866553 +-1276.01088335 861.54715186 -861.62537494 +-193.17596632 0.16713991 -0.02106865 +-1276.15172701 861.66401376 861.66024356 +83.46945641 -0.16730418 0.06100182 +-1273.31333507 -858.38273911 -858.96245926 +5404.58493280 -3.04507046 -2.81778113 +-1276.19189558 -861.66398654 861.58531085 +-193.21058250 -0.11920503 0.12012704 +861.66401292 -1276.15172617 861.66024257 +-0.16730418 83.46945627 0.06100192 +861.54715110 -1276.01088167 -861.62537387 +0.16713972 -193.17596591 -0.02106965 +-858.38273891 -1273.31333542 -858.96245910 +-3.04506741 5404.58493142 -2.81778205 +-861.66398683 -1276.19189578 861.58531200 +-0.11920541 -193.21058250 0.12012674 +-861.60900269 861.52691291 -1276.08157152 +0.02099737 0.06108917 -193.17561785 +861.52691246 -861.60900299 -1276.08157243 +0.06108909 0.02099718 -193.17561746 +-858.80486827 -858.80486867 -1273.17865256 +-2.81780745 -2.81780722 5404.30474364 +861.74281375 861.74281365 -1275.71086885 +-0.12013460 -0.12013475 83.09915550 +83.46959035 -0.09801326 0.00000000 +-1274.64156874 859.96385402 860.17328225 +-193.17585994 -0.00634034 0.00000031 +-1274.64156789 859.96385357 -860.17328072 +-193.21062369 -0.11938345 0.00000015 +-1276.19187300 -861.66400056 861.74280857 +5404.58377637 3.62403189 -0.00000071 +-1276.19187285 -861.66400087 -861.74280780 +-0.00634065 -193.17585981 -0.00000015 +859.96385345 -1274.64156845 -860.17328227 +-0.09801307 83.46959066 0.00000092 +859.96385342 -1274.64156728 860.17328103 +-0.11938399 -193.21062370 0.00000031 +-861.66399988 -1276.19187163 861.74280780 +3.62403013 5404.58377402 0.00000142 +-861.66400079 -1276.19187255 -861.74280803 +-0.00000031 -0.00000038 -193.17573821 +860.25587448 -860.25587441 -1274.81548871 +0.00000000 -0.00000026 -193.17573875 +-860.25587388 860.25587456 -1274.81548916 +0.00000015 -0.00000009 83.09905855 +861.58531164 861.58531156 -1275.71087571 +0.00000046 0.00000089 5404.30514766 +-861.58531232 -861.58531217 -1275.71087655 +-1276.01088198 861.54713523 861.62537356 +83.46945674 -0.16730402 -0.06100344 +-1276.15172688 861.66402939 -861.66024402 +-193.17596584 0.16713972 0.02106034 +-1273.31333552 -858.38273940 858.96245956 +-193.21058227 -0.11920503 -0.12012498 +-1276.19189573 -861.66398605 -861.58531085 +5404.58493188 -3.04506924 2.81779059 +861.66402925 -1276.15172686 -861.66024394 +0.16713982 -193.17596610 0.02106041 +861.54713537 -1276.01088130 861.62537448 +-0.16730426 83.46945625 -0.06100350 +-858.38273967 -1273.31333570 858.96245987 +-0.11920511 -193.21058281 -0.12012514 +-861.66398958 -1276.19189780 -861.58531314 +-3.04506687 5404.58493417 2.81779303 +861.60900299 -861.52691253 -1276.08157236 +-0.06108885 -0.02099714 -193.17561830 +-861.52691343 861.60900260 -1276.08157198 +-0.02099726 -0.06108848 -193.17561792 +858.80486782 858.80486829 -1273.17865256 +0.12013467 0.12013460 83.09915604 +-861.74281406 -861.74281426 -1275.71086942 +2.81780737 2.81780737 5404.30474524 diff --git a/examples/USER/phonon/dynamical_matrix_command/python/results/out.dynamt b/examples/USER/phonon/dynamical_matrix_command/python/results/out.dynamt new file mode 100644 index 0000000000..812af4b2a5 --- /dev/null +++ b/examples/USER/phonon/dynamical_matrix_command/python/results/out.dynamt @@ -0,0 +1,71 @@ +LAMMPS (15 Jun 2020) +Reading data file ... + orthogonal box = (0.0 0.0 0.0) to (5.431 5.431 5.431) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 8 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 4.2e-05 secs + read_data CPU = 0.001 secs +Reading potential file ../../../../../potentials/SiCGe.tersoff with DATE: 2009-03-18 +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 4 + ghost atom cutoff = 4 + binsize = 2, bins = 3 3 3 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair tersoff, perpetual + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard +Calculating Dynamical Matrix ... + Total # of atoms = 8 + Atoms in group = 8 + Total dynamical matrix elements = 576 + 10% 20% 30% 50% 60% 70% 80%[3.34264870e-05 6.09176101e-05 1.72068597e-04 1.60807822e+01 + 1.60807027e+01 1.60806903e+01 1.48964054e+01 1.49012648e+01 + 1.49129598e+01 1.49081641e+01 1.48999471e+01 1.49095175e+01 + 1.21983946e+01 1.21957091e+01 1.22010862e+01 1.22037817e+01 + 1.22037910e+01 1.22037868e+01 6.89648276e+00 6.89524412e+00 + 6.89619622e+00 6.89553366e+00 6.89615471e+00 6.89557491e+00] + +Finished Calculating Dynamical Matrix +Loop time of 0.000677109 on 1 procs for 48 steps with 8 atoms + +Performance: 6124.865 ns/day, 0.004 hours/ns, 70889.645 timesteps/s +91.3% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.00064349 | 0.00064349 | 0.00064349 | 0.0 | 95.04 +Bond | 9.5367e-07 | 9.5367e-07 | 9.5367e-07 | 0.0 | 0.14 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 1.1683e-05 | 1.1683e-05 | 1.1683e-05 | 0.0 | 1.73 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 9.5367e-07 | 9.5367e-07 | 9.5367e-07 | 0.0 | 0.14 +Other | | 2.003e-05 | | | 2.96 + +Nlocal: 8 ave 8 max 8 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 86 ave 86 max 86 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 128 ave 128 max 128 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 128 +Ave neighs/atom = 16 +Ave special neighs/atom = 0 +Neighbor list builds = 1 +Dangerous builds = 0 +Total wall time: 0:00:00 From 132afb32f4d9c51d9559321f0f91386efeb3c36a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 19:46:44 -0400 Subject: [PATCH 23/54] add note about dependency on SNAP in the MLIAP overview page --- doc/src/Packages_details.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 2e6773489f..1258f1a68f 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -662,6 +662,10 @@ MLIAP package A general interface for machine-learning interatomic potentials. +**Install:** + +To use this package, also the :ref:`SNAP package` needs to be installed. + **Author:** Aidan Thompson (Sandia). **Supporting info:** From ae0957bd61321412dadea26c25dd025e224497c9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 22:19:55 -0400 Subject: [PATCH 24/54] use atom id instead of local index to test per-atom data --- unittest/formats/test_atom_styles.cpp | 378 ++++++++++++++++---------- 1 file changed, 227 insertions(+), 151 deletions(-) diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index fa47256e7b..b7feedc728 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -36,6 +36,8 @@ #endif #endif +#define GETIDX(i) lmp->atom->map(i) + // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; @@ -332,32 +334,33 @@ TEST_F(AtomStyleTest, atomic) ASSERT_EQ(lmp->atom->molecular, 0); ASSERT_EQ(lmp->atom->ntypes, 2); - double **x = lmp->atom->x; - double **v = lmp->atom->v; - ASSERT_DOUBLE_EQ(x[0][0], -2.0); - ASSERT_DOUBLE_EQ(x[0][1], 2.0); - ASSERT_DOUBLE_EQ(x[0][2], 0.1); - ASSERT_DOUBLE_EQ(x[1][0], -2.0); - ASSERT_DOUBLE_EQ(x[1][1], -2.0); - ASSERT_DOUBLE_EQ(x[1][2], -0.1); - ASSERT_DOUBLE_EQ(x[2][0], 2.0); - ASSERT_DOUBLE_EQ(x[2][1], 2.0); - ASSERT_DOUBLE_EQ(x[2][2], -0.1); - ASSERT_DOUBLE_EQ(x[3][0], 2.0); - ASSERT_DOUBLE_EQ(x[3][1], -2.0); - ASSERT_DOUBLE_EQ(x[3][2], 0.1); - ASSERT_DOUBLE_EQ(v[0][0], 0.0); - ASSERT_DOUBLE_EQ(v[0][1], 0.0); - ASSERT_DOUBLE_EQ(v[0][2], 0.0); - ASSERT_DOUBLE_EQ(v[1][0], 0.0); - ASSERT_DOUBLE_EQ(v[1][1], 0.0); - ASSERT_DOUBLE_EQ(v[1][2], 0.0); - ASSERT_DOUBLE_EQ(v[2][0], 0.0); - ASSERT_DOUBLE_EQ(v[2][1], 0.0); - ASSERT_DOUBLE_EQ(v[2][2], 0.0); - ASSERT_DOUBLE_EQ(v[3][0], 0.0); - ASSERT_DOUBLE_EQ(v[3][1], 0.0); - ASSERT_DOUBLE_EQ(v[3][2], 0.0); + double **x = lmp->atom->x; + double **v = lmp->atom->v; + tagint *tag = lmp->atom->tag; + ASSERT_DOUBLE_EQ(x[GETIDX(1)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][1], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][1], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][2], 0.1); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][2], 0.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[1], 4.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[2], 2.4); @@ -389,18 +392,18 @@ TEST_F(AtomStyleTest, atomic) x = lmp->atom->x; v = lmp->atom->v; - ASSERT_DOUBLE_EQ(x[0][0], -2.0); - ASSERT_DOUBLE_EQ(x[0][1], 2.0); - ASSERT_DOUBLE_EQ(x[0][2], 0.1); - ASSERT_DOUBLE_EQ(x[1][0], 2.0); - ASSERT_DOUBLE_EQ(x[1][1], 2.0); - ASSERT_DOUBLE_EQ(x[1][2], -0.1); - ASSERT_DOUBLE_EQ(v[0][0], 0.0); - ASSERT_DOUBLE_EQ(v[0][1], 0.0); - ASSERT_DOUBLE_EQ(v[0][2], 0.0); - ASSERT_DOUBLE_EQ(v[1][0], 0.0); - ASSERT_DOUBLE_EQ(v[1][1], 0.0); - ASSERT_DOUBLE_EQ(v[1][2], 0.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][2], -0.1); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][2], 0.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[1], 4.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[2], 2.4); @@ -414,6 +417,60 @@ TEST_F(AtomStyleTest, atomic) if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_EQ(lmp->atom->map_tag_max, 2); ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("replicate 2 2 2"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_EQ(lmp->atom->map_tag_max, 16); + x = lmp->atom->x; + tag = lmp->atom->tag; + ASSERT_DOUBLE_EQ(x[GETIDX(1)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][0], 6.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][0], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(5)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(5)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(5)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(6)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(6)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(6)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(7)][0], 6.0); + ASSERT_DOUBLE_EQ(x[GETIDX(7)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(7)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(8)][0], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(8)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(8)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(9)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(9)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(9)][2], 8.1); + ASSERT_DOUBLE_EQ(x[GETIDX(10)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(10)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(10)][2], 7.9); + ASSERT_DOUBLE_EQ(x[GETIDX(11)][0], 6.0); + ASSERT_DOUBLE_EQ(x[GETIDX(11)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(11)][2], 8.1); + ASSERT_DOUBLE_EQ(x[GETIDX(12)][0], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(12)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(12)][2], 7.9); + ASSERT_DOUBLE_EQ(x[GETIDX(13)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(13)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(13)][2], 8.1); + ASSERT_DOUBLE_EQ(x[GETIDX(14)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(14)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(14)][2], 7.9); + ASSERT_DOUBLE_EQ(x[GETIDX(15)][0], 6.0); + ASSERT_DOUBLE_EQ(x[GETIDX(15)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(15)][2], 8.1); + ASSERT_DOUBLE_EQ(x[GETIDX(16)][0], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(16)][1], 10.0); + ASSERT_DOUBLE_EQ(x[GETIDX(16)][2], 7.9); } TEST_F(AtomStyleTest, charge) @@ -664,34 +721,34 @@ TEST_F(AtomStyleTest, charge) double **x = lmp->atom->x; double **v = lmp->atom->v; double *q = lmp->atom->q; - ASSERT_DOUBLE_EQ(x[0][0], -2.0); - ASSERT_DOUBLE_EQ(x[0][1], 2.0); - ASSERT_DOUBLE_EQ(x[0][2], 0.1); - ASSERT_DOUBLE_EQ(x[1][0], -2.0); - ASSERT_DOUBLE_EQ(x[1][1], -2.0); - ASSERT_DOUBLE_EQ(x[1][2], -0.1); - ASSERT_DOUBLE_EQ(x[2][0], 2.0); - ASSERT_DOUBLE_EQ(x[2][1], 2.0); - ASSERT_DOUBLE_EQ(x[2][2], -0.1); - ASSERT_DOUBLE_EQ(x[3][0], 2.0); - ASSERT_DOUBLE_EQ(x[3][1], -2.0); - ASSERT_DOUBLE_EQ(x[3][2], 0.1); - ASSERT_DOUBLE_EQ(v[0][0], 0.0); - ASSERT_DOUBLE_EQ(v[0][1], 0.0); - ASSERT_DOUBLE_EQ(v[0][2], 0.0); - ASSERT_DOUBLE_EQ(v[1][0], 0.0); - ASSERT_DOUBLE_EQ(v[1][1], 0.0); - ASSERT_DOUBLE_EQ(v[1][2], 0.0); - ASSERT_DOUBLE_EQ(v[2][0], 0.0); - ASSERT_DOUBLE_EQ(v[2][1], 0.0); - ASSERT_DOUBLE_EQ(v[2][2], 0.0); - ASSERT_DOUBLE_EQ(v[3][0], 0.0); - ASSERT_DOUBLE_EQ(v[3][1], 0.0); - ASSERT_DOUBLE_EQ(v[3][2], 0.0); - ASSERT_DOUBLE_EQ(q[0], -0.5); - ASSERT_DOUBLE_EQ(q[1], 0.5); - ASSERT_DOUBLE_EQ(q[2], -1.0); - ASSERT_DOUBLE_EQ(q[3], 1.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][1], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][1], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][2], 0.1); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][2], 0.0); + ASSERT_DOUBLE_EQ(q[GETIDX(1)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(2)], 0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(3)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(4)], 1.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[1], 4.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[2], 2.4); @@ -704,7 +761,7 @@ TEST_F(AtomStyleTest, charge) lmp->input->one("delete_atoms group two compress no"); lmp->input->one("write_restart test_atom_styles.restart"); lmp->input->one("clear"); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); + EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); lmp->input->one("read_restart test_atom_styles.restart"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("charge")); @@ -722,25 +779,48 @@ TEST_F(AtomStyleTest, charge) x = lmp->atom->x; v = lmp->atom->v; q = lmp->atom->q; - ASSERT_DOUBLE_EQ(x[0][0], -2.0); - ASSERT_DOUBLE_EQ(x[0][1], 2.0); - ASSERT_DOUBLE_EQ(x[0][2], 0.1); - ASSERT_DOUBLE_EQ(x[1][0], 2.0); - ASSERT_DOUBLE_EQ(x[1][1], 2.0); - ASSERT_DOUBLE_EQ(x[1][2], -0.1); - ASSERT_DOUBLE_EQ(v[0][0], 0.0); - ASSERT_DOUBLE_EQ(v[0][1], 0.0); - ASSERT_DOUBLE_EQ(v[0][2], 0.0); - ASSERT_DOUBLE_EQ(v[1][0], 0.0); - ASSERT_DOUBLE_EQ(v[1][1], 0.0); - ASSERT_DOUBLE_EQ(v[1][2], 0.0); - ASSERT_DOUBLE_EQ(q[0], -0.5); - ASSERT_DOUBLE_EQ(q[1], -1.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][2], -0.1); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][2], 0.0); + ASSERT_DOUBLE_EQ(q[GETIDX(1)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(3)], -1.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[1], 4.0); ASSERT_DOUBLE_EQ(lmp->atom->mass[2], 2.4); ASSERT_EQ(lmp->atom->mass_setflag[1], 1); ASSERT_EQ(lmp->atom->mass_setflag[2], 1); + + if (!verbose) ::testing::internal::CaptureStdout(); + lmp->input->one("reset_ids"); + lmp->input->one("replicate 2 2 2"); + if (!verbose) ::testing::internal::GetCapturedStdout(); + ASSERT_EQ(lmp->atom->map_tag_max, 16); + q = lmp->atom->q; + ASSERT_DOUBLE_EQ(q[GETIDX(1)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(2)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(3)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(4)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(5)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(6)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(7)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(8)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(9)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(10)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(11)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(12)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(13)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(14)], -1.0); + ASSERT_DOUBLE_EQ(q[GETIDX(15)], -0.5); + ASSERT_DOUBLE_EQ(q[GETIDX(16)], -1.0); } TEST_F(AtomStyleTest, sphere) @@ -993,50 +1073,50 @@ TEST_F(AtomStyleTest, sphere) ASSERT_EQ(lmp->atom->map_user, 1); ASSERT_EQ(lmp->atom->map_tag_max, 4); - double **x = lmp->atom->x; - double **v = lmp->atom->v; - double *rmass = lmp->atom->rmass; + double **x = lmp->atom->x; + double **v = lmp->atom->v; + double *rmass = lmp->atom->rmass; double **omega = lmp->atom->omega; - ASSERT_DOUBLE_EQ(x[0][0], -2.0); - ASSERT_DOUBLE_EQ(x[0][1], 2.0); - ASSERT_DOUBLE_EQ(x[0][2], 0.1); - ASSERT_DOUBLE_EQ(x[1][0], -2.0); - ASSERT_DOUBLE_EQ(x[1][1], -2.0); - ASSERT_DOUBLE_EQ(x[1][2], -0.1); - ASSERT_DOUBLE_EQ(x[2][0], 2.0); - ASSERT_DOUBLE_EQ(x[2][1], 2.0); - ASSERT_DOUBLE_EQ(x[2][2], -0.1); - ASSERT_DOUBLE_EQ(x[3][0], 2.0); - ASSERT_DOUBLE_EQ(x[3][1], -2.0); - ASSERT_DOUBLE_EQ(x[3][2], 0.1); - ASSERT_DOUBLE_EQ(v[0][0], 0.0); - ASSERT_DOUBLE_EQ(v[0][1], 0.0); - ASSERT_DOUBLE_EQ(v[0][2], 0.0); - ASSERT_DOUBLE_EQ(v[1][0], 0.0); - ASSERT_DOUBLE_EQ(v[1][1], 0.0); - ASSERT_DOUBLE_EQ(v[1][2], 0.0); - ASSERT_DOUBLE_EQ(v[2][0], 0.0); - ASSERT_DOUBLE_EQ(v[2][1], 0.0); - ASSERT_DOUBLE_EQ(v[2][2], 0.0); - ASSERT_DOUBLE_EQ(v[3][0], 0.0); - ASSERT_DOUBLE_EQ(v[3][1], 0.0); - ASSERT_DOUBLE_EQ(v[3][2], 0.0); - ASSERT_DOUBLE_EQ(rmass[0], 4.0); - ASSERT_DOUBLE_EQ(rmass[1], 4.0); - ASSERT_DOUBLE_EQ(rmass[2], 2.4); - ASSERT_DOUBLE_EQ(rmass[3], 2.4); - ASSERT_DOUBLE_EQ(omega[0][0], -0.5); - ASSERT_DOUBLE_EQ(omega[0][1], 0.1); - ASSERT_DOUBLE_EQ(omega[0][2], 0.1); - ASSERT_DOUBLE_EQ(omega[1][0], 0.5); - ASSERT_DOUBLE_EQ(omega[1][1], -0.1); - ASSERT_DOUBLE_EQ(omega[1][2], -0.1); - ASSERT_DOUBLE_EQ(omega[2][0], -1.0); - ASSERT_DOUBLE_EQ(omega[2][1], 0.0); - ASSERT_DOUBLE_EQ(omega[2][2], 0.0); - ASSERT_DOUBLE_EQ(omega[3][0], 0.0); - ASSERT_DOUBLE_EQ(omega[3][1], 1.0); - ASSERT_DOUBLE_EQ(omega[3][2], 0.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][0], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][1], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(2)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][1], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(3)][2], -0.1); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][0], 2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][1], -2.0); + ASSERT_DOUBLE_EQ(x[GETIDX(4)][2], 0.1); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(1)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(2)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(3)][2], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][0], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][1], 0.0); + ASSERT_DOUBLE_EQ(v[GETIDX(4)][2], 0.0); + ASSERT_DOUBLE_EQ(rmass[GETIDX(1)], 4.0); + ASSERT_DOUBLE_EQ(rmass[GETIDX(2)], 4.0); + ASSERT_DOUBLE_EQ(rmass[GETIDX(3)], 2.4); + ASSERT_DOUBLE_EQ(rmass[GETIDX(4)], 2.4); + ASSERT_DOUBLE_EQ(omega[GETIDX(1)][0], -0.5); + ASSERT_DOUBLE_EQ(omega[GETIDX(1)][1], 0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(2)][0], 0.5); + ASSERT_DOUBLE_EQ(omega[GETIDX(2)][1], -0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(2)][2], -0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(3)][0], -1.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(3)][1], 0.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(3)][2], 0.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(4)][0], 0.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(4)][1], 1.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(4)][2], 0.0); if (!verbose) ::testing::internal::CaptureStdout(); lmp->input->one("pair_coeff * *"); @@ -1044,45 +1124,41 @@ TEST_F(AtomStyleTest, sphere) lmp->input->one("delete_atoms group two compress no"); lmp->input->one("write_restart test_atom_styles.restart"); lmp->input->one("clear"); - ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); + EXPECT_THAT(std::string(lmp->atom->atom_style), Eq("atomic")); lmp->input->one("read_restart test_atom_styles.restart"); + lmp->input->one("replicate 1 1 2"); + lmp->input->one("reset_ids"); if (!verbose) ::testing::internal::GetCapturedStdout(); ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("sphere")); ASSERT_NE(lmp->atom->avec, nullptr); - ASSERT_EQ(lmp->atom->natoms, 2); - ASSERT_EQ(lmp->atom->nlocal, 2); + ASSERT_EQ(lmp->atom->natoms, 4); + ASSERT_EQ(lmp->atom->nlocal, 4); ASSERT_EQ(lmp->atom->nghost, 0); ASSERT_NE(lmp->atom->nmax, -1); ASSERT_EQ(lmp->atom->tag_enable, 1); ASSERT_EQ(lmp->atom->molecular, 0); ASSERT_EQ(lmp->atom->ntypes, 2); - ASSERT_EQ(lmp->atom->tag_consecutive(), 0); - ASSERT_EQ(lmp->atom->map_tag_max, 3); + ASSERT_EQ(lmp->atom->tag_consecutive(), 1); + ASSERT_EQ(lmp->atom->map_tag_max, 4); - x = lmp->atom->x; - v = lmp->atom->v; rmass = lmp->atom->rmass; omega = lmp->atom->omega; - ASSERT_DOUBLE_EQ(x[0][0], -2.0); - ASSERT_DOUBLE_EQ(x[0][1], 2.0); - ASSERT_DOUBLE_EQ(x[0][2], 0.1); - ASSERT_DOUBLE_EQ(x[1][0], 2.0); - ASSERT_DOUBLE_EQ(x[1][1], 2.0); - ASSERT_DOUBLE_EQ(x[1][2], -0.1); - ASSERT_DOUBLE_EQ(v[0][0], 0.0); - ASSERT_DOUBLE_EQ(v[0][1], 0.0); - ASSERT_DOUBLE_EQ(v[0][2], 0.0); - ASSERT_DOUBLE_EQ(v[1][0], 0.0); - ASSERT_DOUBLE_EQ(v[1][1], 0.0); - ASSERT_DOUBLE_EQ(v[1][2], 0.0); - ASSERT_DOUBLE_EQ(rmass[0], 4.0); - ASSERT_DOUBLE_EQ(rmass[1], 2.4); - ASSERT_DOUBLE_EQ(omega[0][0], -0.5); - ASSERT_DOUBLE_EQ(omega[0][1], 0.1); - ASSERT_DOUBLE_EQ(omega[0][2], 0.1); - ASSERT_DOUBLE_EQ(omega[1][0], -1.0); - ASSERT_DOUBLE_EQ(omega[1][1], 0.0); - ASSERT_DOUBLE_EQ(omega[1][2], 0.0); + ASSERT_DOUBLE_EQ(rmass[GETIDX(1)], 4.0); + ASSERT_DOUBLE_EQ(rmass[GETIDX(2)], 2.4); + ASSERT_DOUBLE_EQ(rmass[GETIDX(3)], 4.0); + ASSERT_DOUBLE_EQ(rmass[GETIDX(4)], 2.4); + ASSERT_DOUBLE_EQ(omega[GETIDX(1)][0], -0.5); + ASSERT_DOUBLE_EQ(omega[GETIDX(1)][1], 0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(1)][2], 0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(2)][0], -1.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(2)][1], 0.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(2)][2], 0.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(3)][0], -0.5); + ASSERT_DOUBLE_EQ(omega[GETIDX(3)][1], 0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(3)][2], 0.1); + ASSERT_DOUBLE_EQ(omega[GETIDX(4)][0], -1.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(4)][1], 0.0); + ASSERT_DOUBLE_EQ(omega[GETIDX(4)][2], 0.0); } } // namespace LAMMPS_NS From fc090c22f4818ab55ad71dbeb21d090f02fd6d65 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 22:24:06 -0400 Subject: [PATCH 25/54] fix typo --- doc/src/Build_development.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index deb9d5b3cb..3b3d532d7e 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -216,7 +216,7 @@ The force style test programs have a common set of options: - verbose output: also print the executed LAMMPS commands The ``ctest`` tool has no mechanism to directly pass flags to the individual -test programs, but a workaround has been implmented where these flags can be +test programs, but a workaround has been implemented where these flags can be set in an environment variable ``TEST_ARGS``. Example: .. code-block:: bash From a0fdb6af4776436b56ca40001526f4d3c72bee25 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 22:34:08 -0400 Subject: [PATCH 26/54] silence compiler warning --- src/MLIAP/mliap_descriptor_snap.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index db677881d5..ed2ac47474 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -441,6 +441,7 @@ double MLIAPDescriptorSNAP::get_cutmax() if (cut > cutmax) cutmax = cut; return cutmax; } + return cutmax; } /* ---------------------------------------------------------------------- From 516a31796ebb6ab218043f0cabefc12958be5e23 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 22 Jun 2020 23:12:11 -0400 Subject: [PATCH 27/54] need to move destruction of base per-atom properties back to atom.cpp so we don't leak memory in read_restart and don't crash with replicate --- src/atom.cpp | 8 ++++ src/atom_vec.cpp | 97 +++++++++++++++++++++--------------------------- src/atom_vec.h | 4 -- 3 files changed, 51 insertions(+), 58 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 42ff9d4613..2a5d3c494e 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -243,6 +243,14 @@ Atom::~Atom() memory->destroy(next); memory->destroy(permute); + memory->destroy(tag); + memory->destroy(type); + memory->destroy(mask); + memory->destroy(image); + memory->destroy(x); + memory->destroy(v); + memory->destroy(f); + // delete peratom data struct for (int i = 0; i < nperatom; i++) diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 5a86caa4fb..85afd46d32 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -33,8 +33,6 @@ using namespace MathConst; #define DELTA 16384 #define DELTA_BONUS 8192 -int AtomVec::num_atom_vecs = 0; - /* ---------------------------------------------------------------------- */ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp) @@ -52,11 +50,14 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp) kokkosable = 0; nargcopy = 0; - argcopy = NULL; + argcopy = nullptr; - threads = NULL; + tag = nullptr; + type = mask = nullptr; + image = nullptr; + x = v = f = nullptr; - ++num_atom_vecs; + threads = nullptr; // peratom variables auto-included in corresponding child style fields string // these fields cannot be specified in the fields string @@ -97,48 +98,36 @@ 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); - memory->destroy(atom->image); - memory->destroy(atom->x); - memory->destroy(atom->v); - memory->destroy(atom->f); - - for (int i = 0; i < ngrow; i++) { - pdata = mgrow.pdata[i]; - datatype = mgrow.datatype[i]; - cols = mgrow.cols[i]; - if (datatype == Atom::DOUBLE) { - if (cols == 0) - memory->destroy(*((double **) pdata)); - else if (cols > 0) - memory->destroy(*((double ***) pdata)); - else { - memory->destroy(*((double ***) pdata)); - } - } else if (datatype == Atom::INT) { - if (cols == 0) - memory->destroy(*((int **) pdata)); - else if (cols > 0) - memory->destroy(*((int ***) pdata)); - else { - memory->destroy(*((int ***) pdata)); - } - } else if (datatype == Atom::BIGINT) { - if (cols == 0) - memory->destroy(*((bigint **) pdata)); - else if (cols > 0) - memory->destroy(*((bigint ***) pdata)); - else { - memory->destroy(*((bigint ***) pdata)); - } + for (int i = 0; i < ngrow; i++) { + pdata = mgrow.pdata[i]; + datatype = mgrow.datatype[i]; + cols = mgrow.cols[i]; + if (datatype == Atom::DOUBLE) { + if (cols == 0) + memory->destroy(*((double **) pdata)); + else if (cols > 0) + memory->destroy(*((double ***) pdata)); + else { + memory->destroy(*((double ***) pdata)); + } + } else if (datatype == Atom::INT) { + if (cols == 0) + memory->destroy(*((int **) pdata)); + else if (cols > 0) + memory->destroy(*((int ***) pdata)); + else { + memory->destroy(*((int ***) pdata)); + } + } else if (datatype == Atom::BIGINT) { + if (cols == 0) + memory->destroy(*((bigint **) pdata)); + else if (cols > 0) + memory->destroy(*((bigint ***) pdata)); + else { + memory->destroy(*((bigint ***) pdata)); } } } @@ -194,7 +183,7 @@ void AtomVec::init() deform_groupbit = domain->deform_groupbit; h_rate = domain->h_rate; - if (lmp->kokkos != NULL && !kokkosable) + if (lmp->kokkos != nullptr && !kokkosable) error->all(FLERR,"KOKKOS package requires a kokkos enabled atom_style"); } @@ -2492,8 +2481,8 @@ void AtomVec::setup_fields() int AtomVec::process_fields(char *str, const char *default_str, Method *method) { - if (str == NULL) { - method->index = NULL; + if (str == nullptr) { + method->index = nullptr; return 0; } @@ -2572,13 +2561,13 @@ void AtomVec::create_method(int nfield, Method *method) void AtomVec::init_method(Method *method) { - method->pdata = NULL; - method->datatype = NULL; - method->cols = NULL; - method->maxcols = NULL; - method->collength = NULL; - method->plength = NULL; - method->index = NULL; + method->pdata = nullptr; + method->datatype = nullptr; + method->cols = nullptr; + method->maxcols = nullptr; + method->collength = nullptr; + method->plength = nullptr; + method->index = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec.h b/src/atom_vec.h index 625307face..8ccf922c4b 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -209,10 +209,6 @@ class AtomVec : protected Pointers { bool *threads; - // counter for atom vec instances - - static int num_atom_vecs; - // local methods void grow_nmax(); From fae96f07d9c3b25342872e7e86d6af59cb9ba252 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 06:51:10 -0400 Subject: [PATCH 28/54] single_enable and respa_enable may only be set if *all* styles support it. --- src/pair_hybrid.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 6e2cbf75d7..afecfd93d0 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -369,8 +369,8 @@ void PairHybrid::flags() styles[m]->comm_reverse_off); } - // single_enable = 1 if any sub-style is set - // respa_enable = 1 if any sub-style is set + // single_enable = 1 if all sub-styles are set + // respa_enable = 1 if all sub-styles are set // manybody_flag = 1 if any sub-style is set // no_virial_fdotr_compute = 1 if any sub-style is set // ghostneigh = 1 if any sub-style is set @@ -380,9 +380,10 @@ void PairHybrid::flags() single_enable = 0; compute_flag = 0; + respa_enable = 0; for (m = 0; m < nstyles; m++) { - if (styles[m]->single_enable) single_enable = 1; - if (styles[m]->respa_enable) respa_enable = 1; + if (styles[m]->single_enable) ++single_enable; + if (styles[m]->respa_enable) ++respa_enable; if (styles[m]->manybody_flag) manybody_flag = 1; if (styles[m]->no_virial_fdotr_compute) no_virial_fdotr_compute = 1; if (styles[m]->ghostneigh) ghostneigh = 1; @@ -396,6 +397,8 @@ void PairHybrid::flags() if (styles[m]->compute_flag) compute_flag = 1; if (styles[m]->centroidstressflag & 4) centroidstressflag |= 4; } + single_enable = (single_enable == nstyles) ? 1 : 0; + respa_enable = (respa_enable == nstyles) ? 1 : 0; init_svector(); } From 66414067c87516c7b6da9ec8c834432b118bf93a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 06:51:42 -0400 Subject: [PATCH 29/54] add tests for SNAP package --- .../tests/manybody-pair-snap.yaml | 157 +++++++++++++++++ .../tests/manybody-pair-snap_chem.yaml | 159 ++++++++++++++++++ 2 files changed, 316 insertions(+) create mode 100644 unittest/force-styles/tests/manybody-pair-snap.yaml create mode 100644 unittest/force-styles/tests/manybody-pair-snap_chem.yaml diff --git a/unittest/force-styles/tests/manybody-pair-snap.yaml b/unittest/force-styles/tests/manybody-pair-snap.yaml new file mode 100644 index 0000000000..a1c3461466 --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-snap.yaml @@ -0,0 +1,157 @@ +--- +lammps_version: 15 Jun 2020 +date_generated: Tue Jun 23 06:48:10 202 +epsilon: 5e-13 +prerequisites: ! | + pair snap + pair zbl +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on +post_commands: ! "" +input_file: in.manybody +pair_style: hybrid/overlay zbl 4.0 4.8 snap +pair_coeff: ! | + 1*8 1*8 zbl 73 73 + * * snap Ta06A.snapcoeff Ta06A.snapparam Ta Ta Ta Ta Ta Ta Ta Ta +extract: ! "" +natoms: 64 +init_vdwl: -473.569864629026 +init_coul: 0 +init_stress: ! |2- + 3.9989504688551557e+02 4.0778136516737010e+02 4.3596322435184823e+02 -2.5242497284339528e+01 1.2811620806363672e+02 2.8644673361821371e+00 +init_forces: ! |2 + 2 -7.6696525239232614e+00 -3.7674335682223381e-01 -5.7958054718422796e+00 + 4 -4.7103509354198474e+00 9.2783458784125976e+00 4.3108702582741394e+00 + 5 -2.0331946400488965e+00 -2.9593716047756224e+00 -1.6136351145373165e+00 + 9 5.2043326273130175e-01 -2.9340446386400014e+00 -7.6461969078455798e+00 + 10 -6.2786875145099574e-01 5.6606570005199780e-02 -5.3746300485699585e+00 + 13 -3.2260600618006539e+00 1.3854745225224621e+01 -1.8038061855949397e+00 + 11 8.1946917251451801e+00 -6.7267140406524657e+00 2.5930013855034550e+00 + 12 -1.4328402235895096e+01 -8.0774309292156143e+00 -7.6980199570965535e+00 + 19 -2.9132243097469304e+00 -1.1018213008189472e+00 -2.8349170179881722e+00 + 21 3.9250706073854151e+00 -1.0562396695052101e+00 -9.1632104209006702e+00 + 8 2.7148403621334438e-01 1.3063473238306025e+00 -1.1268098385676197e+00 + 29 -6.6151960592236190e+00 1.6410275382967952e+00 -1.0570398181017480e+00 + 16 3.7310502876344760e+00 1.9788328492752696e+00 1.5687925430243098e+01 + 17 5.0755393464331515e+00 6.1278868384113512e+00 -1.0750955741273687e+01 + 27 4.3406014531279222e+00 -2.9009678649007347e+00 5.2435008444617166e+00 + 3 -2.9221261341044469e-01 -1.2984917885683769e+00 2.2320440844884373e+00 + 18 1.7371660543384104e+00 3.0620693584379275e+00 7.2701166654624956e+00 + 24 3.1860163425620680e+00 4.7170150104555351e+00 6.3461114127051061e+00 + 26 -1.8170871697803483e+00 -3.7700946621068332e-01 6.2457161242681802e-01 + 1 -3.7538180163781281e+00 8.8612947043788459e+00 6.7712977816731925e+00 + 32 -7.8831496558114598e+00 4.7917666582558249e-01 8.5821461480120664e-01 + 36 1.7666626040313678e+00 -4.4698105712986056e+00 2.0563602888033050e-01 + 37 -3.8714388913204454e+00 5.6357721515897268e+00 -6.6078854304621739e+00 + 7 -3.0573043543220679e+00 -4.0575899915120344e+00 1.5283788878527855e+00 + 41 2.4000089474498232e-01 1.0045144396502841e+00 -2.3032449685213674e+00 + 45 -1.8910274064700999e-01 3.9137627573846210e+00 -7.4450993876429434e+00 + 15 -8.6349846297037978e+00 9.1996942753987128e+00 -9.5905201240122828e+00 + 33 1.0742815926879521e+01 -5.8142728701457003e+00 9.7282423280124668e+00 + 44 8.0196107396135172e+00 -8.1793730426384510e+00 3.5131695854462555e+00 + 6 1.8086748683348595e+00 4.6479727629048604e+00 3.0425695895914578e-01 + 49 -2.3978299788759889e+00 -1.2283692236805230e+01 -8.3755937565454222e+00 + 53 5.8389424736085607e+00 7.5295796786576119e+00 5.5403096028203374e+00 + 14 -2.9498732270039882e+00 8.5589611530655603e+00 2.0530716609447491e-01 + 23 2.8936071278420714e+00 5.3816164530412882e+00 7.4597216732837177e+00 + 40 9.5193696695210672e+00 -7.0213638399035494e+00 -1.5692669012530698e+00 + 57 2.1375440189893022e+00 -1.3001299791681298e+00 -8.9740026386466110e-01 + 61 9.6892046530363873e-01 3.6493959386458283e+00 -8.3809793809505218e-01 + 31 -3.1645464836586603e+00 3.4678442856970015e-01 -3.0903933004747017e+00 + 48 2.1755560727357048e+00 2.9996491762493229e+00 -9.9575511910098058e-01 + 22 -1.5634125465245702e+01 8.9090677007239911e+00 -1.2750204519006152e+01 + 52 1.2943573147098915e+01 -1.1745909799528659e+01 1.6522312348562515e+01 + 30 -3.6949627314218136e+00 2.0505225752289307e+00 -1.5676706969561185e+00 + 56 -3.5699586538972254e-02 1.5545384984529775e+00 -5.2139902048630420e+00 + 60 -5.1586404521695721e+00 -1.5178664164309573e+01 -9.8559725391425026e+00 + 64 7.5837965251215627e+00 7.5954689486766194e+00 1.6804021764142050e+01 + 35 2.5212001799950725e+00 -2.2938190564661243e+00 5.7029334689778004e+00 + 39 4.1718406489245954e+00 -6.3270387696640595e+00 -1.1208012916569130e+01 + 42 -9.4741999244791391e+00 -6.3134658287662759e+00 -3.6928028439517928e+00 + 34 -1.3523086688998043e+00 -1.1117518205645371e-01 1.6057041203339621e+00 + 43 2.7218639962411589e-01 -1.3813634477251094e+01 5.5147832931992469e-01 + 47 5.1131478665605368e+00 2.3800985688973464e+00 5.1348001359881970e+00 + 38 1.4632813171776620e+00 -3.3182377007830421e-01 -8.4412322782159954e-01 + 51 -3.0166275666360338e+00 1.1037977712957444e+01 8.8691052932904118e+00 + 25 8.8078411119651601e-01 -1.4554648001614772e+00 1.6812657581308250e+00 + 46 -3.5282857552811713e+00 -5.1713579630178099e+00 1.2477491203990516e+01 + 55 4.9846400582125172e+00 -8.4400769236810991e+00 -6.5776931744173242e+00 + 59 9.0343971306644413e+00 4.2302611807585278e+00 -1.8088550980511922e+00 + 63 5.8570431431678962e+00 -6.2896068000076291e+00 -3.8788666930728652e+00 + 20 -1.6464048708371493e+01 2.4791517492525514e+00 3.4072780064525776e-01 + 50 3.6161933080447870e+00 5.6291551969069200e+00 -6.9709721613230791e-01 + 54 4.6678942858445627e+00 -5.7948610984029827e+00 -4.7138910958393687e+00 + 58 5.2652486142639470e+00 -2.5529130533710904e+00 2.0016357749194574e-01 + 62 -6.2693637951458747e+00 5.5593866650560697e+00 -4.0417158962655790e+00 + 28 -7.0542478046176460e-01 1.0981989037209763e+00 1.3116499712117605e+01 +run_vdwl: -489.468066110652 +run_coul: 0 +run_stress: ! |2- + 3.7167872895847830e+02 3.7917710068041873e+02 4.0385320198584725e+02 -1.3691599706785620e+01 9.5517308985478394e+01 9.7589276560909521e+00 +run_forces: ! |2 + 2 -6.0189354199893019e+00 -5.0918745113944830e-01 -5.3313245647285648e+00 + 4 -3.0213465402043487e+00 6.9725231357285153e+00 2.1167504663792407e+00 + 5 -1.7586848423194326e+00 -3.2933741468811117e+00 -9.3080751290254016e-01 + 9 8.0189242689618823e-01 -3.0847017825088363e+00 -6.9542340364711066e+00 + 10 -8.9128976791778891e-01 -6.7393019870597731e-02 -3.2723844475537320e+00 + 13 -4.8758021083011011e-01 1.0840591566757565e+01 1.4417301279067557e-01 + 11 4.5456393443054974e+00 -4.5148464719144279e+00 2.1620709337140723e-01 + 12 -1.0605260639103403e+01 -3.7437284480399842e+00 -4.2782571870680659e+00 + 19 -2.7367744247531327e+00 -8.2975485638465007e-01 -2.0790334392182368e+00 + 21 3.4454631697777542e+00 -7.8278081568080538e-01 -9.0435968147049799e+00 + 8 -5.4873779786283237e-02 1.5854566692139447e+00 -1.0066392618014397e+00 + 29 -6.1417582599413354e+00 3.9164321009856218e-01 9.7685688363946144e-02 + 16 2.6358192742443785e+00 1.7064832375902417e-01 1.0429654093017437e+01 + 17 2.6492424666949455e+00 4.1865915382220500e+00 -9.0595086171557959e+00 + 27 3.2706304707445777e+00 -1.9852603643313336e+00 4.2180376607986387e+00 + 3 -8.3868957617451234e-01 -8.8585183150041003e-01 2.9968107645220114e+00 + 18 1.1206473927094001e+00 2.2123081794070760e+00 5.8589201221087279e+00 + 24 2.9885018662472969e+00 2.9838762041792903e+00 4.3228545839763228e+00 + 26 -1.8763705008872573e+00 -1.2599849620161119e-01 6.2992383249895434e-01 + 1 -2.6200062192163260e+00 6.5895070779555445e+00 5.6608861291961485e+00 + 32 -6.1422237837124252e+00 -5.1210288634459333e-01 5.4514825686867274e-01 + 36 1.2821238454090340e+00 -3.9489216486981480e+00 -8.6269270447000523e-01 + 37 -2.7537235028447959e+00 4.6513692386669554e+00 -5.6290489372162806e+00 + 7 -2.0012695381122851e+00 -2.5159443018298582e+00 6.2116996571725824e-01 + 41 1.0342805569135010e+00 1.6523945993277342e+00 -1.5772104911433944e+00 + 45 3.0267523524516227e-01 2.2378774625062987e+00 -4.7768000279857130e+00 + 15 -5.6397727632249390e+00 5.8479631324846224e+00 -5.1195271857482370e+00 + 33 7.4141036509796736e+00 -2.7884535553661554e+00 6.2033448623898471e+00 + 44 6.9463399563146995e+00 -6.4872117822671029e+00 1.0874644094280221e+00 + 6 2.2991165379551060e+00 3.3795036971656316e+00 2.2660197467513185e-01 + 49 -1.1421201760383086e+00 -1.0752096896646723e+01 -6.5722133309475623e+00 + 53 3.4161226658911676e+00 5.7780690168335100e+00 4.1927204150859296e+00 + 14 -2.8043941505268619e+00 6.4438899074281046e+00 1.6101766369425701e+00 + 23 2.3598327627157203e+00 4.6653030563297317e+00 6.1390590162436585e+00 + 40 7.4374269075019397e+00 -4.3433135301581913e+00 -4.0455383168565001e-01 + 57 2.1690816717712806e+00 -1.3704555520632966e+00 -6.0759785348038831e-01 + 61 1.1003078657122041e+00 3.5366731859023495e+00 -1.4254057900337927e-01 + 31 -2.6098520190441916e+00 2.2795861569826048e-01 -2.7458401111959478e+00 + 48 2.2413400699812356e+00 3.3580569902180799e+00 -1.2661375290157366e+00 + 22 -9.9116182027989090e+00 3.7537117149502670e+00 -6.2041013601324995e+00 + 52 8.0098592133005599e+00 -5.9122394581044402e+00 1.0101406704527053e+01 + 30 -3.1388355174211191e+00 1.6122297260129153e+00 -1.1081505352088727e+00 + 56 5.1189498205615092e-01 1.1342419773973298e+00 -4.2814131693242929e+00 + 60 -2.3372986868253895e+00 -1.1397492261021370e+01 -7.3457073057764726e+00 + 64 4.3353125159604211e+00 4.7586391643778230e+00 1.2965475525931369e+01 + 35 1.5632007556515235e+00 -9.5418452153129252e-01 4.1257737822747229e+00 + 39 2.1765892902345456e+00 -3.8586421759387384e+00 -9.0645286263473448e+00 + 42 -8.1195815614370250e+00 -5.8763972130775572e+00 -3.1222551004416705e+00 + 34 -1.4244505798620775e+00 -3.3429770690754701e-02 1.9184700282588940e+00 + 43 -2.7912198462705029e-01 -1.1167330547751900e+01 -6.3698536543291662e-02 + 47 4.2785305080294629e+00 1.5325832230443761e+00 3.3589203411901534e+00 + 38 1.9992052623036145e+00 -4.2983333004702029e-01 -1.0733048030047021e+00 + 51 -1.7223504936880034e+00 9.2697024243389841e+00 7.0442106476591402e+00 + 25 6.1001404235466761e-01 -1.1881822928224532e+00 1.5040997261686671e+00 + 46 -2.2570016757486253e+00 -4.0040746828789366e+00 9.8689525243895222e+00 + 55 2.5539298626493867e+00 -5.6377686174334265e+00 -3.5151115361687300e+00 + 59 6.7962624211316438e+00 2.0240756728927010e+00 -8.0188277109815520e-01 + 63 4.4200660412946480e+00 -4.6975137723775253e+00 -2.5446183902678623e+00 + 20 -1.2201950287425831e+01 8.9293356122794254e-01 -6.4486216284158071e-01 + 50 3.4180454936299873e+00 5.0411589857253878e+00 -5.8332155561549115e-01 + 54 2.4972457061023641e+00 -3.7172022065563843e+00 -2.6131222195234560e+00 + 58 4.3539661764216335e+00 -1.4572581960607045e+00 -9.9173296914446007e-01 + 62 -5.1368600009373031e+00 3.5663926174152052e+00 -2.2708852648200208e+00 + 28 -3.1071530373299716e-01 1.5750530088540271e+00 9.6837465049814764e+00 +... diff --git a/unittest/force-styles/tests/manybody-pair-snap_chem.yaml b/unittest/force-styles/tests/manybody-pair-snap_chem.yaml new file mode 100644 index 0000000000..f9bf56e8b3 --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-snap_chem.yaml @@ -0,0 +1,159 @@ +--- +lammps_version: 15 Jun 2020 +date_generated: Tue Jun 23 06:28:49 202 +epsilon: 5e-13 +prerequisites: ! | + pair snap + pair zbl +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on +post_commands: ! "" +input_file: in.manybody +pair_style: hybrid/overlay zbl 4.0 4.2 snap +pair_coeff: ! | + 1*4 1*4 zbl 49 49 + 1*4 5*8 zbl 49 15 + 5*8 5*8 zbl 15 15 + * * snap InP_JCPA2020.snapcoeff InP_JCPA2020.snapparam In In In In P P P P +extract: ! "" +natoms: 64 +init_vdwl: -185.3871232982 +init_coul: 0 +init_stress: ! |2- + 2.1627572764873958e+02 2.1843973818802479e+02 2.2323704161405172e+02 -5.3476822166124478e+00 2.9965125280145408e+01 1.1801773510997722e+00 +init_forces: ! |2 + 2 -2.3497957616596601e+00 -7.0361817598817122e-01 -1.5634923191374748e+00 + 4 -2.0337936615474375e+00 2.9491894607511475e+00 9.8066478014365421e-01 + 5 -1.9807302026626257e+00 -4.1921845197040186e-01 -3.9514999290883601e-01 + 6 -1.0256636650331943e-01 2.3662295416638237e+00 9.0816298775387250e-01 + 7 -6.0657120592984948e-01 -8.0634286798072208e-01 2.1759740426498699e+00 + 8 6.0627276316788437e-01 1.0677577347039469e+00 -1.2887262448970853e+00 + 9 -3.0674852805674085e-01 -2.0605633540913710e+00 -2.5500662803249257e+00 + 10 -1.9428976574806139e-01 -1.4648835736857648e+00 -2.8490531930038245e+00 + 11 3.1532548864214434e+00 -2.9033258960601409e+00 2.2619034310429735e+00 + 12 -5.4038968585110823e+00 -3.2935652899479924e+00 -2.5707355493491781e+00 + 13 -6.1736753137043776e-01 5.1000477579656494e+00 -1.3304391624961633e+00 + 14 -1.4190543180546618e+00 3.3413841917147384e+00 4.6351390250498770e-01 + 15 -3.1131424694968604e+00 4.4700267996081555e+00 -3.2364337367424172e+00 + 16 1.7079914236492750e+00 -1.9995742761541913e-01 5.0185841295230240e+00 + 17 2.3724862536641012e+00 3.0987980523865000e+00 -3.4198379943456869e+00 + 27 1.9066785243503706e+00 -2.9510326328255049e-01 1.2119553206259739e+00 + 33 4.3597028481189959e+00 -2.6773596435480336e+00 3.1791467867699503e+00 + 44 3.0506037114469589e+00 -3.3226877009576863e+00 1.7796293414951667e+00 + 3 6.2372158338858497e-01 2.7149161557212964e-01 -4.8035793806964389e-01 + 18 -2.5111265055015947e-01 7.3348166166902828e-01 3.0622036193004099e+00 + 19 -1.2828262181283474e+00 -2.2345757410919127e+00 -3.3669351804164727e-01 + 21 1.3962036186373230e+00 3.9865506204929702e-01 -2.5893554970082704e+00 + 22 -5.1263732155413759e+00 3.6744897485626451e+00 -4.8303251395784246e+00 + 23 1.7617874308698238e+00 2.9253519141342759e+00 1.4679679444255609e+00 + 24 1.5937879337284910e+00 8.9992286487733819e-01 2.8087468575298824e+00 + 26 -3.5670456442877890e-01 -3.9811471877481980e-01 8.1854393579980245e-01 + 49 -2.3858202682345580e+00 -4.2223184267227767e+00 -2.7959407680025370e+00 + 1 -8.9407797360085417e-01 3.1174511790027033e+00 1.7848004756991056e+00 + 29 -2.7893073887365949e+00 7.8106446652879102e-01 -8.2039261846998079e-01 + 30 -1.8694503114341436e+00 7.0812686858708307e-01 -9.1751940639239338e-01 + 31 -7.0985766256762384e-01 8.6963471463259445e-01 -7.5188557225015273e-01 + 32 -2.4089849337056681e+00 4.0992982351371432e-01 -1.1381600041412421e-01 + 60 -2.2387715060954041e+00 -5.2442113310349816e+00 -2.6985516164859176e+00 + 25 1.0286448774492718e+00 -4.3669506584228501e-01 1.2594354985828644e+00 + 35 1.2413218618562072e+00 -4.1427608114771164e-01 2.5651243684278686e+00 + 36 -1.1152887975138681e-01 -2.3088354090108663e+00 -2.3687452176819115e-01 + 37 -2.1752322691080077e+00 1.9377327531750539e+00 -2.2419453197067281e+00 + 38 -9.9594979744324563e-01 -1.8147173502133507e-01 6.8832530755714350e-01 + 39 2.8779281856552128e+00 -1.7332955648283563e+00 -3.4260103364251724e+00 + 40 4.3351429466694649e+00 -2.2624572291840521e+00 -1.7065975882223487e+00 + 34 5.1607419486495609e-01 1.3141798772668922e-01 8.7023229642903210e-02 + 41 2.5124166305689100e-01 -4.2179260496370724e-01 -1.2503380336802215e+00 + 42 -3.5352439688397150e+00 -1.6053715846066683e+00 -6.7917775288119064e-01 + 43 8.4817996010401164e-01 -4.8899181684596407e+00 1.7369510897908452e-01 + 45 -1.8374092699066706e+00 1.5294723708757618e+00 -2.7502022232711760e+00 + 46 -9.1023563070749047e-01 -1.7778137773508695e+00 4.9843270240840001e+00 + 47 2.6124800260927614e+00 1.6175231582888077e+00 1.5805303054926736e+00 + 48 1.4743780750991404e+00 3.6707315780788008e-02 -2.9750115931287535e-01 + 59 2.9909449561888724e+00 2.1621928717215835e+00 -2.3820831167094303e+00 + 20 -5.9491949074906936e+00 3.2510448152978871e-01 6.8450449383664713e-01 + 50 2.4067134019907233e-01 2.8105796871762414e+00 -1.0687621004291805e+00 + 51 -1.7932456135513868e+00 2.6201558060481331e+00 3.7648454668413773e+00 + 52 4.6358669186214048e+00 -4.8660554435252061e+00 5.0894919019571017e+00 + 53 2.9898995132891715e+00 3.3216926541391611e+00 2.4227995842838892e+00 + 54 1.8732808586337415e+00 -3.0909639789911147e+00 -2.2880122319661975e+00 + 55 1.1426678804104569e+00 -2.5892472259617465e+00 -3.2449552890237303e+00 + 56 -1.1541931360327828e-01 -8.3260558816076080e-02 -1.7966753733604066e+00 + 58 2.4813755367140664e+00 -1.2765007868407994e+00 1.5628981219370055e+00 + 28 2.5221087546188337e-01 1.4370172575473001e+00 4.1039332214108235e+00 + 57 -1.2751171337205386e-01 -8.8899643643851600e-01 -5.0726814112212137e-02 + 61 -1.0184694703280139e+00 1.5256818152660501e+00 -1.0113329140640543e+00 + 62 -2.7862663394350529e+00 2.5876139756856724e+00 -1.7815179130043091e+00 + 63 2.4339134295594320e+00 -3.1961735689987627e+00 -4.7891394265908005e-01 + 64 3.0382364587319786e+00 3.0430454898558628e+00 5.3416679902175552e+00 +run_vdwl: -187.654391839485 +run_coul: 0 +run_stress: ! |2- + 2.1286434186597299e+02 2.1516140376524689e+02 2.2014270591458128e+02 -4.1189309434632548e+00 2.5671737667284461e+01 3.4094574165482725e+00 +run_forces: ! |2 + 2 -2.2299658853721507e+00 -7.5585568905659772e-01 -1.5309002377019625e+00 + 4 -1.6432999484262130e+00 2.7237882915593326e+00 4.6054246395477350e-01 + 5 -1.9915642544829777e+00 -5.0514454245912876e-01 -2.4023101827231486e-01 + 6 3.1580339744901054e-01 2.2624378988705449e+00 1.0700232878883553e+00 + 7 -4.3667900724171116e-01 -4.6326888074447586e-01 1.8815161287461819e+00 + 8 4.0891558557491903e-01 9.8444761132021974e-01 -1.1994011642190254e+00 + 9 -3.9943153478794785e-01 -2.2209279455737687e+00 -2.5915912103444536e+00 + 10 -1.9471351965318492e-01 -1.4496690804153829e+00 -2.2623893657434921e+00 + 11 2.4362905726150617e+00 -2.3810030225467420e+00 1.8905835689476449e+00 + 12 -4.8961713945288228e+00 -2.6394975897948645e+00 -2.0372233198924476e+00 + 13 1.3378868571704855e-01 4.5775961871578907e+00 -9.1227708328467871e-01 + 14 -1.5297526207810295e+00 3.0522662572662123e+00 4.9107580456119615e-01 + 15 -2.6765425425933334e+00 3.8247215679835032e+00 -2.5375795218582140e+00 + 16 1.5196290196835556e+00 -3.2914146438877845e-01 4.1849431488039270e+00 + 17 2.0043578760825422e+00 2.8234226231079971e+00 -2.9923076186199409e+00 + 27 1.9119897296615496e+00 -3.9246942513009608e-01 1.2080897134421995e+00 + 33 3.7351462993820155e+00 -2.1144175359802881e+00 2.6418390367829723e+00 + 44 2.9022254223989687e+00 -3.0658233607366552e+00 1.4095258293816753e+00 + 3 2.8912410060638449e-01 4.3705738858658072e-01 -2.1722808227079787e-01 + 18 -5.0347976264338157e-01 8.8149323898758825e-01 2.9370157524159088e+00 + 19 -1.4078018510609771e+00 -2.2820746919860460e+00 -3.7825546052718551e-01 + 21 1.4678310024890893e+00 1.7118675240828019e-01 -2.7319662502952085e+00 + 22 -4.2798753174007320e+00 3.0607656650226183e+00 -3.9192708818666397e+00 + 23 1.8070160916189471e+00 2.8893260418555005e+00 1.4715768249778427e+00 + 24 1.7943331384890664e+00 5.6727833662929228e-01 2.4453386937887518e+00 + 26 -4.7367357683059208e-01 -2.6670219998362554e-01 8.5910453505401185e-01 + 49 -2.4980250315840102e+00 -4.2937298563437452e+00 -2.7685866462265638e+00 + 1 -7.3369133823406019e-01 2.7667970855721902e+00 1.6328050345720770e+00 + 29 -2.7287724915818701e+00 7.5140952246304527e-01 -7.1978618410779327e-01 + 30 -1.6121881543481651e+00 4.7145279745822616e-01 -9.4382533006887137e-01 + 31 -6.9302105329787711e-01 8.6622808992775280e-01 -7.1688447301762670e-01 + 32 -2.1877722619109301e+00 3.1241022059139323e-01 -2.0363529214606668e-01 + 60 -2.2516089079595991e+00 -4.9525359014312302e+00 -2.6471467342704198e+00 + 25 9.4127417840102356e-01 -3.2082226320612112e-01 1.0317887157557417e+00 + 35 1.2481610501512823e+00 -1.4422631315933354e-01 2.3732508438175111e+00 + 36 -4.1515332308320341e-01 -2.0958691183365024e+00 -6.0782500168499043e-01 + 37 -1.8737832564668908e+00 1.5868160141680490e+00 -2.1502811274719473e+00 + 38 -8.3799314060680841e-01 -1.1168329368636565e-01 7.5420009101162666e-01 + 39 2.4623601668269171e+00 -1.3731570495025507e+00 -3.1300208221580808e+00 + 40 4.2396805048038306e+00 -1.9896514878251730e+00 -1.6439304927095406e+00 + 34 4.3814257629996445e-01 1.4381263658420362e-01 1.5892319607512650e-01 + 41 4.5291426717441718e-01 -2.1649648555890250e-01 -1.0103115219148269e+00 + 42 -3.4063198353809976e+00 -1.7197481999679383e+00 -7.1574757576947656e-01 + 43 6.7969745762235467e-01 -4.4139560697511886e+00 -7.1374160410194093e-02 + 45 -1.8021584516545357e+00 1.1139426059206683e+00 -2.3612665451280677e+00 + 46 -6.4055392057875782e-01 -1.5437936507527341e+00 4.7629947723944017e+00 + 47 2.4596732256156790e+00 1.3839195366764618e+00 1.4983351229907567e+00 + 48 1.4286951465559086e+00 2.5226997121024208e-01 -3.1703206977278198e-01 + 59 2.7939168112815249e+00 2.0644797911549686e+00 -2.2194096868290583e+00 + 20 -5.3044185428231110e+00 -5.5789399083649077e-02 4.5964111618433978e-01 + 50 2.3859148339052361e-01 2.5999038034992537e+00 -1.1882197967404982e+00 + 51 -1.8541927042572204e+00 2.5220449582545088e+00 3.6251170038994083e+00 + 52 4.0017526007315150e+00 -3.9563125820844296e+00 4.1997432909076826e+00 + 53 2.9944010593604045e+00 3.2831372076580529e+00 2.6928034831187961e+00 + 54 1.5871022597839053e+00 -2.8228944858891403e+00 -1.9576122929926121e+00 + 55 6.8049238759975206e-01 -2.2839449322075804e+00 -2.6675101357177620e+00 + 56 -1.1904103145926614e-01 -4.1523795497198490e-01 -1.6223721062486220e+00 + 58 2.4136361939725424e+00 -9.4464777619607587e-01 1.2128229032096640e+00 + 28 1.8999192393940767e-01 1.6499913470409551e+00 3.7514920356690027e+00 + 57 -1.3403241451059458e-01 -1.1130134152852698e+00 -1.0367473155144701e-01 + 61 -9.1969687435720449e-01 1.4906668816471547e+00 -9.1416116187656105e-01 + 62 -2.5974358252612548e+00 2.3448472464785857e+00 -1.4775087114289507e+00 + 63 2.3319640999455045e+00 -3.2577489670850390e+00 -4.7807587290002118e-01 + 64 2.9639114599347867e+00 3.0313370540601516e+00 5.0817272896875902e+00 +... From 2e48ea868016149132d4f18be9b3d5e3af1400fc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 07:11:30 -0400 Subject: [PATCH 30/54] include MLIAP package in cross-compiler builds --- cmake/presets/mingw-cross.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 588ad04138..d187586df8 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -1,6 +1,6 @@ set(WIN_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GPU - GRANULAR KSPACE LATTE MANYBODY MC MISC MOLECULE OPT PERI - POEMS QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI + GRANULAR KSPACE LATTE MANYBODY MC MISC MLIAP MOLECULE OPT + PERI POEMS QEQ REPLICA RIGID SHOCK SNAP SPIN SRD VORONOI USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-INTEL USER-MANIFOLD USER-MEAMC USER-MESODPD From b9d989769dfe06d0b4a80985e1939595aec19c17 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 08:26:55 -0400 Subject: [PATCH 31/54] pair style zbl does not have restart support --- src/pair_zbl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 199e4f0907..4c1187efba 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -32,7 +32,9 @@ using namespace PairZBLConstants; /* ---------------------------------------------------------------------- */ -PairZBL::PairZBL(LAMMPS *lmp) : Pair(lmp) {} +PairZBL::PairZBL(LAMMPS *lmp) : Pair(lmp) { + restartinfo = 0; +} /* ---------------------------------------------------------------------- */ From 1a0095e51bcaa2d0189d28827efdc5e83472cae5 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 23 Jun 2020 08:32:17 -0400 Subject: [PATCH 32/54] Use utils::logmesg() and fmt::format() --- src/MLIAP/mliap_descriptor_snap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index ed2ac47474..eedeeb4483 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -27,6 +27,7 @@ #include "sna.h" #include "memory.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -338,8 +339,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) char* keyval = strtok(NULL,"' \t\n\r\f"); if (comm->me == 0) { - if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); - if (logfile) fprintf(logfile,"SNAP keyword %s %s \n",keywd,keyval); + utils::logmesg(lmp, fmt::format("SNAP keyword {} {} \n", keywd, keyval)); } // check for keywords with one value per element From cc6371b00bd2c2b9fa03f4d23cc353b5d861e4c7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 08:51:37 -0400 Subject: [PATCH 33/54] add restart and data file handling to pair style zbl --- src/pair_zbl.cpp | 101 ++++++++++++++++++++++++++++++++++++++++++++++- src/pair_zbl.h | 6 +++ 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 199e4f0907..4be0cad125 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -18,11 +18,13 @@ #include "pair_zbl.h" #include #include "atom.h" +#include "comm.h" #include "force.h" #include "neighbor.h" #include "neigh_list.h" #include "memory.h" #include "error.h" +#include "utils.h" // From J.F. Zeigler, J. P. Biersack and U. Littmark, // "The Stopping and Range of Ions in Matter" volume 1, Pergamon, 1985. @@ -32,7 +34,9 @@ using namespace PairZBLConstants; /* ---------------------------------------------------------------------- */ -PairZBL::PairZBL(LAMMPS *lmp) : Pair(lmp) {} +PairZBL::PairZBL(LAMMPS *lmp) : Pair(lmp) { + writedata = 1; +} /* ---------------------------------------------------------------------- */ @@ -254,6 +258,101 @@ double PairZBL::init_one(int i, int j) return cut_global; } +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairZBL::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i; + for (i = 1; i <= atom->ntypes; i++) { + fwrite(&setflag[i][i],sizeof(int),1,fp); + if (setflag[i][i]) fwrite(&z[i],sizeof(double),1,fp); + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairZBL::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) { + if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,NULL,error); + MPI_Bcast(&setflag[i][i],1,MPI_INT,0,world); + if (setflag[i][i]) { + if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,NULL,error); + MPI_Bcast(&z[i],1,MPI_DOUBLE,0,world); + } + } + + for (i = 1; i <= atom->ntypes; i++) + for (j = 1; j <= atom->ntypes; j++) + set_coeff(i,j,z[i],z[j]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairZBL::write_restart_settings(FILE *fp) +{ + fwrite(&cut_global,sizeof(double),1,fp); + fwrite(&cut_inner,sizeof(double),1,fp); + fwrite(&offset_flag,sizeof(int),1,fp); + fwrite(&mix_flag,sizeof(int),1,fp); + fwrite(&tail_flag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairZBL::read_restart_settings(FILE *fp) +{ + int me = comm->me; + if (me == 0) { + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + } + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_inner,1,MPI_DOUBLE,0,world); + MPI_Bcast(&offset_flag,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); + MPI_Bcast(&tail_flag,1,MPI_INT,0,world); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairZBL::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp,"%d %g\n",i,z[i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairZBL::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp,"%d %d %g %g\n",i,j,z[i],z[j]); +} + /* ---------------------------------------------------------------------- */ double PairZBL::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, diff --git a/src/pair_zbl.h b/src/pair_zbl.h index b89dd680b2..55a5dc5fa4 100644 --- a/src/pair_zbl.h +++ b/src/pair_zbl.h @@ -33,6 +33,12 @@ class PairZBL : public Pair { void coeff(int, char **); virtual void init_style(); virtual double init_one(int, int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_restart_settings(FILE *); + void read_restart_settings(FILE *); + void write_data(FILE *); + void write_data_all(FILE *); double single(int, int, int, int, double, double, double, double &); protected: From 68d5d74fd354c4c8325e916ee27033db53689551 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 08:51:37 -0400 Subject: [PATCH 34/54] add restart and data file handling to pair style zbl --- src/pair_zbl.cpp | 99 +++++++++++++++++++++++++++++++++++++++++++++++- src/pair_zbl.h | 6 +++ 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 4c1187efba..4be0cad125 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -18,11 +18,13 @@ #include "pair_zbl.h" #include #include "atom.h" +#include "comm.h" #include "force.h" #include "neighbor.h" #include "neigh_list.h" #include "memory.h" #include "error.h" +#include "utils.h" // From J.F. Zeigler, J. P. Biersack and U. Littmark, // "The Stopping and Range of Ions in Matter" volume 1, Pergamon, 1985. @@ -33,7 +35,7 @@ using namespace PairZBLConstants; /* ---------------------------------------------------------------------- */ PairZBL::PairZBL(LAMMPS *lmp) : Pair(lmp) { - restartinfo = 0; + writedata = 1; } /* ---------------------------------------------------------------------- */ @@ -256,6 +258,101 @@ double PairZBL::init_one(int i, int j) return cut_global; } +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairZBL::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i; + for (i = 1; i <= atom->ntypes; i++) { + fwrite(&setflag[i][i],sizeof(int),1,fp); + if (setflag[i][i]) fwrite(&z[i],sizeof(double),1,fp); + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairZBL::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) { + if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,NULL,error); + MPI_Bcast(&setflag[i][i],1,MPI_INT,0,world); + if (setflag[i][i]) { + if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,NULL,error); + MPI_Bcast(&z[i],1,MPI_DOUBLE,0,world); + } + } + + for (i = 1; i <= atom->ntypes; i++) + for (j = 1; j <= atom->ntypes; j++) + set_coeff(i,j,z[i],z[j]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairZBL::write_restart_settings(FILE *fp) +{ + fwrite(&cut_global,sizeof(double),1,fp); + fwrite(&cut_inner,sizeof(double),1,fp); + fwrite(&offset_flag,sizeof(int),1,fp); + fwrite(&mix_flag,sizeof(int),1,fp); + fwrite(&tail_flag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairZBL::read_restart_settings(FILE *fp) +{ + int me = comm->me; + if (me == 0) { + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + } + MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_inner,1,MPI_DOUBLE,0,world); + MPI_Bcast(&offset_flag,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); + MPI_Bcast(&tail_flag,1,MPI_INT,0,world); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairZBL::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp,"%d %g\n",i,z[i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairZBL::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp,"%d %d %g %g\n",i,j,z[i],z[j]); +} + /* ---------------------------------------------------------------------- */ double PairZBL::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, diff --git a/src/pair_zbl.h b/src/pair_zbl.h index b89dd680b2..55a5dc5fa4 100644 --- a/src/pair_zbl.h +++ b/src/pair_zbl.h @@ -33,6 +33,12 @@ class PairZBL : public Pair { void coeff(int, char **); virtual void init_style(); virtual double init_one(int, int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_restart_settings(FILE *); + void read_restart_settings(FILE *); + void write_data(FILE *); + void write_data_all(FILE *); double single(int, int, int, int, double, double, double, double &); protected: From 8285e068da3841c59b93b9d44f19f105ca0972d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 06:51:10 -0400 Subject: [PATCH 35/54] single_enable and respa_enable may only be set if *all* styles support it. --- src/pair_hybrid.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 6e2cbf75d7..afecfd93d0 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -369,8 +369,8 @@ void PairHybrid::flags() styles[m]->comm_reverse_off); } - // single_enable = 1 if any sub-style is set - // respa_enable = 1 if any sub-style is set + // single_enable = 1 if all sub-styles are set + // respa_enable = 1 if all sub-styles are set // manybody_flag = 1 if any sub-style is set // no_virial_fdotr_compute = 1 if any sub-style is set // ghostneigh = 1 if any sub-style is set @@ -380,9 +380,10 @@ void PairHybrid::flags() single_enable = 0; compute_flag = 0; + respa_enable = 0; for (m = 0; m < nstyles; m++) { - if (styles[m]->single_enable) single_enable = 1; - if (styles[m]->respa_enable) respa_enable = 1; + if (styles[m]->single_enable) ++single_enable; + if (styles[m]->respa_enable) ++respa_enable; if (styles[m]->manybody_flag) manybody_flag = 1; if (styles[m]->no_virial_fdotr_compute) no_virial_fdotr_compute = 1; if (styles[m]->ghostneigh) ghostneigh = 1; @@ -396,6 +397,8 @@ void PairHybrid::flags() if (styles[m]->compute_flag) compute_flag = 1; if (styles[m]->centroidstressflag & 4) centroidstressflag |= 4; } + single_enable = (single_enable == nstyles) ? 1 : 0; + respa_enable = (respa_enable == nstyles) ? 1 : 0; init_svector(); } From ddcc104df653b427f042de02ffe6cf9b744451e5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 09:21:47 -0400 Subject: [PATCH 36/54] must also reissue hybrid pair style commands after restarts --- unittest/force-styles/pair_style.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/pair_style.cpp b/unittest/force-styles/pair_style.cpp index 9354ad7f03..3bc14746b1 100644 --- a/unittest/force-styles/pair_style.cpp +++ b/unittest/force-styles/pair_style.cpp @@ -32,6 +32,7 @@ #include "modify.h" #include "pair.h" #include "universe.h" +#include "utils.h" #include #include @@ -159,7 +160,8 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg) command("clear"); command("read_restart " + cfg.basename + ".restart"); - if (!lmp->force->pair) { + // need to re-issue pair style with non-restartable and hybrid pair styles + if ((!lmp->force->pair) || (utils::strmatch(cfg.pair_style,"^hybrid"))) { command("pair_style " + cfg.pair_style); } if (!lmp->force->pair->restartinfo || !lmp->force->pair->writedata) { From 2ace7ef8172e2a8498ac81c1873010ab33ad49f6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 09:24:51 -0400 Subject: [PATCH 37/54] may only flag having restart info if all substyles support it --- src/pair_hybrid.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index afecfd93d0..b0def607e4 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -381,9 +381,11 @@ void PairHybrid::flags() single_enable = 0; compute_flag = 0; respa_enable = 0; + restartinfo = 0; for (m = 0; m < nstyles; m++) { if (styles[m]->single_enable) ++single_enable; if (styles[m]->respa_enable) ++respa_enable; + if (styles[m]->restartinfo) ++restartinfo; if (styles[m]->manybody_flag) manybody_flag = 1; if (styles[m]->no_virial_fdotr_compute) no_virial_fdotr_compute = 1; if (styles[m]->ghostneigh) ghostneigh = 1; @@ -399,6 +401,7 @@ void PairHybrid::flags() } single_enable = (single_enable == nstyles) ? 1 : 0; respa_enable = (respa_enable == nstyles) ? 1 : 0; + restartinfo = (restartinfo == nstyles) ? 1 : 0; init_svector(); } From 06a0b3331aa3417b08a339ccd906e3bafd71e67a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 09:24:51 -0400 Subject: [PATCH 38/54] may only flag having restart info if all substyles support it --- src/pair_hybrid.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index afecfd93d0..b0def607e4 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -381,9 +381,11 @@ void PairHybrid::flags() single_enable = 0; compute_flag = 0; respa_enable = 0; + restartinfo = 0; for (m = 0; m < nstyles; m++) { if (styles[m]->single_enable) ++single_enable; if (styles[m]->respa_enable) ++respa_enable; + if (styles[m]->restartinfo) ++restartinfo; if (styles[m]->manybody_flag) manybody_flag = 1; if (styles[m]->no_virial_fdotr_compute) no_virial_fdotr_compute = 1; if (styles[m]->ghostneigh) ghostneigh = 1; @@ -399,6 +401,7 @@ void PairHybrid::flags() } single_enable = (single_enable == nstyles) ? 1 : 0; respa_enable = (respa_enable == nstyles) ? 1 : 0; + restartinfo = (restartinfo == nstyles) ? 1 : 0; init_svector(); } From fefdd3dd9a86cdc4f3855ab6443d472949513bde Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 09:29:09 -0400 Subject: [PATCH 39/54] move MLIAP potential files to potentials folder and replace with symlinks --- examples/mliap/InP_JCPA2020.mliap | 20 +- examples/mliap/InP_JCPA2020.mliap.descriptor | 21 +- examples/mliap/InP_JCPA2020.mliap.model | 486 +---------------- examples/mliap/Ta06A.mliap | 18 +- examples/mliap/Ta06A.mliap.descriptor | 22 +- examples/mliap/Ta06A.mliap.model | 38 +- examples/mliap/W.quadratic.mliap | 16 +- examples/mliap/W.quadratic.mliap.descriptor | 21 +- examples/mliap/W.quadratic.mliap.model | 503 +----------------- examples/mliap/WBe_Wood_PRB2019.mliap | 17 +- .../mliap/WBe_Wood_PRB2019.mliap.descriptor | 21 +- examples/mliap/WBe_Wood_PRB2019.mliap.model | 118 +--- potentials/InP_JCPA2020.mliap | 19 + potentials/InP_JCPA2020.mliap.descriptor | 20 + potentials/InP_JCPA2020.mliap.model | 485 +++++++++++++++++ potentials/Ta06A.mliap | 17 + potentials/Ta06A.mliap.descriptor | 21 + potentials/Ta06A.mliap.model | 37 ++ potentials/W.quadratic.mliap | 15 + potentials/W.quadratic.mliap.descriptor | 20 + potentials/W.quadratic.mliap.model | 502 +++++++++++++++++ potentials/WBe_Wood_PRB2019.mliap | 16 + potentials/WBe_Wood_PRB2019.mliap.descriptor | 20 + potentials/WBe_Wood_PRB2019.mliap.model | 117 ++++ 24 files changed, 1301 insertions(+), 1289 deletions(-) mode change 100644 => 120000 examples/mliap/InP_JCPA2020.mliap mode change 100644 => 120000 examples/mliap/InP_JCPA2020.mliap.descriptor mode change 100644 => 120000 examples/mliap/InP_JCPA2020.mliap.model mode change 100644 => 120000 examples/mliap/Ta06A.mliap mode change 100644 => 120000 examples/mliap/Ta06A.mliap.descriptor mode change 100644 => 120000 examples/mliap/Ta06A.mliap.model mode change 100644 => 120000 examples/mliap/W.quadratic.mliap mode change 100644 => 120000 examples/mliap/W.quadratic.mliap.descriptor mode change 100644 => 120000 examples/mliap/W.quadratic.mliap.model mode change 100644 => 120000 examples/mliap/WBe_Wood_PRB2019.mliap mode change 100644 => 120000 examples/mliap/WBe_Wood_PRB2019.mliap.descriptor mode change 100644 => 120000 examples/mliap/WBe_Wood_PRB2019.mliap.model create mode 100644 potentials/InP_JCPA2020.mliap create mode 100644 potentials/InP_JCPA2020.mliap.descriptor create mode 100644 potentials/InP_JCPA2020.mliap.model create mode 100644 potentials/Ta06A.mliap create mode 100644 potentials/Ta06A.mliap.descriptor create mode 100644 potentials/Ta06A.mliap.model create mode 100644 potentials/W.quadratic.mliap create mode 100644 potentials/W.quadratic.mliap.descriptor create mode 100644 potentials/W.quadratic.mliap.model create mode 100644 potentials/WBe_Wood_PRB2019.mliap create mode 100644 potentials/WBe_Wood_PRB2019.mliap.descriptor create mode 100644 potentials/WBe_Wood_PRB2019.mliap.model diff --git a/examples/mliap/InP_JCPA2020.mliap b/examples/mliap/InP_JCPA2020.mliap deleted file mode 100644 index 19d044df97..0000000000 --- a/examples/mliap/InP_JCPA2020.mliap +++ /dev/null @@ -1,19 +0,0 @@ -# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) - -# Definition of SNAP+ZBL potential. - -variable zblcutinner index 4 -variable zblcutouter index 4.2 -variable zblz1 index 49 -variable zblz2 index 15 - -# Specify hybrid with SNAP and ZBL - -pair_style hybrid/overlay & -zbl ${zblcutinner} ${zblcutouter} & -mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor -pair_coeff 1 1 zbl ${zblz1} ${zblz1} -pair_coeff 1 2 zbl ${zblz1} ${zblz2} -pair_coeff 2 2 zbl ${zblz2} ${zblz2} -pair_coeff * * mliap In P - diff --git a/examples/mliap/InP_JCPA2020.mliap b/examples/mliap/InP_JCPA2020.mliap new file mode 120000 index 0000000000..18b103c85f --- /dev/null +++ b/examples/mliap/InP_JCPA2020.mliap @@ -0,0 +1 @@ +../../potentials/InP_JCPA2020.mliap \ No newline at end of file diff --git a/examples/mliap/InP_JCPA2020.mliap.descriptor b/examples/mliap/InP_JCPA2020.mliap.descriptor deleted file mode 100644 index 287eac59c4..0000000000 --- a/examples/mliap/InP_JCPA2020.mliap.descriptor +++ /dev/null @@ -1,20 +0,0 @@ -# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) - -# required -rcutfac 1.0 -twojmax 6 - -# elements - -nelems 2 -elems In P -radelems 3.81205 3.82945 -welems 1 0.929316 - -# optional -rfac0 0.99363 -rmin0 0.0 -bzeroflag 1 -wselfallflag 1 -chemflag 1 -bnormflag 1 diff --git a/examples/mliap/InP_JCPA2020.mliap.descriptor b/examples/mliap/InP_JCPA2020.mliap.descriptor new file mode 120000 index 0000000000..c24708894d --- /dev/null +++ b/examples/mliap/InP_JCPA2020.mliap.descriptor @@ -0,0 +1 @@ +../../potentials/InP_JCPA2020.mliap.descriptor \ No newline at end of file diff --git a/examples/mliap/InP_JCPA2020.mliap.model b/examples/mliap/InP_JCPA2020.mliap.model deleted file mode 100644 index 7ef9039ba2..0000000000 --- a/examples/mliap/InP_JCPA2020.mliap.model +++ /dev/null @@ -1,485 +0,0 @@ -# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) - -2 241 - 0.000000000000 # B[0] Block = 1 Type = In - -0.000666721868 # B[1, 0, 0, 0] Block = 1 Type = In - 0.032408881964 # B[2, 1, 0, 1] Block = 1 Type = In - 0.182277739455 # B[3, 1, 1, 2] Block = 1 Type = In - 0.001455902168 # B[4, 2, 0, 2] Block = 1 Type = In - 0.086259367737 # B[5, 2, 1, 3] Block = 1 Type = In - -0.044840628371 # B[6, 2, 2, 2] Block = 1 Type = In - -0.175973261191 # B[7, 2, 2, 4] Block = 1 Type = In - -0.052429169415 # B[8, 3, 0, 3] Block = 1 Type = In - 0.195529228497 # B[9, 3, 1, 4] Block = 1 Type = In - 0.078718744520 # B[10, 3, 2, 3] Block = 1 Type = In - -0.688127658121 # B[11, 3, 2, 5] Block = 1 Type = In - 0.059084058400 # B[12, 3, 3, 4] Block = 1 Type = In - 0.006795099274 # B[13, 3, 3, 6] Block = 1 Type = In - -0.043061553886 # B[14, 4, 0, 4] Block = 1 Type = In - -0.046619800530 # B[15, 4, 1, 5] Block = 1 Type = In - -0.117451659827 # B[16, 4, 2, 4] Block = 1 Type = In - -0.233615100720 # B[17, 4, 2, 6] Block = 1 Type = In - 0.015358771114 # B[18, 4, 3, 5] Block = 1 Type = In - 0.022474133984 # B[19, 4, 4, 4] Block = 1 Type = In - 0.002165850235 # B[20, 4, 4, 6] Block = 1 Type = In - 0.003458938546 # B[21, 5, 0, 5] Block = 1 Type = In - -0.053507775670 # B[22, 5, 1, 6] Block = 1 Type = In - 0.120989101467 # B[23, 5, 2, 5] Block = 1 Type = In - 0.092637875162 # B[24, 5, 3, 6] Block = 1 Type = In - 0.071459233521 # B[25, 5, 4, 5] Block = 1 Type = In - 0.086291858607 # B[26, 5, 5, 6] Block = 1 Type = In - 0.006749966752 # B[27, 6, 0, 6] Block = 1 Type = In - 0.144917284093 # B[28, 6, 2, 6] Block = 1 Type = In - 0.055178211309 # B[29, 6, 4, 6] Block = 1 Type = In - -0.005619133266 # B[30, 6, 6, 6] Block = 1 Type = In - 0.005430513632 # B[1, 0, 0, 0] Block = 2 Type = In - 0.057269488101 # B[2, 1, 0, 1] Block = 2 Type = In - 0.320412300575 # B[3, 1, 1, 2] Block = 2 Type = In - 0.035481869944 # B[4, 2, 0, 2] Block = 2 Type = In - 0.111076763087 # B[5, 2, 1, 3] Block = 2 Type = In - 0.039770598731 # B[6, 2, 2, 2] Block = 2 Type = In - 0.141315510383 # B[7, 2, 2, 4] Block = 2 Type = In - 0.067792661762 # B[8, 3, 0, 3] Block = 2 Type = In - -0.080858457946 # B[9, 3, 1, 4] Block = 2 Type = In - 0.258942062632 # B[10, 3, 2, 3] Block = 2 Type = In - 0.061756985062 # B[11, 3, 2, 5] Block = 2 Type = In - -0.112424676196 # B[12, 3, 3, 4] Block = 2 Type = In - 0.168376857205 # B[13, 3, 3, 6] Block = 2 Type = In - -0.029743698629 # B[14, 4, 0, 4] Block = 2 Type = In - -0.093967263289 # B[15, 4, 1, 5] Block = 2 Type = In - 0.137229827290 # B[16, 4, 2, 4] Block = 2 Type = In - 0.056897919200 # B[17, 4, 2, 6] Block = 2 Type = In - 0.095137344320 # B[18, 4, 3, 5] Block = 2 Type = In - -0.008598816416 # B[19, 4, 4, 4] Block = 2 Type = In - 0.038890602482 # B[20, 4, 4, 6] Block = 2 Type = In - -0.034624751006 # B[21, 5, 0, 5] Block = 2 Type = In - -0.282625695473 # B[22, 5, 1, 6] Block = 2 Type = In - 0.103089891872 # B[23, 5, 2, 5] Block = 2 Type = In - -0.024380802146 # B[24, 5, 3, 6] Block = 2 Type = In - -0.063847809434 # B[25, 5, 4, 5] Block = 2 Type = In - -0.024896682749 # B[26, 5, 5, 6] Block = 2 Type = In - 0.000464369553 # B[27, 6, 0, 6] Block = 2 Type = In - 0.082229290277 # B[28, 6, 2, 6] Block = 2 Type = In - -0.008875503360 # B[29, 6, 4, 6] Block = 2 Type = In - -0.009039017094 # B[30, 6, 6, 6] Block = 2 Type = In - 0.005430513686 # B[1, 0, 0, 0] Block = 3 Type = In - -0.004352445887 # B[2, 1, 0, 1] Block = 3 Type = In - 0.149882860704 # B[3, 1, 1, 2] Block = 3 Type = In - -0.015528472583 # B[4, 2, 0, 2] Block = 3 Type = In - 0.558662861756 # B[5, 2, 1, 3] Block = 3 Type = In - 0.039770598731 # B[6, 2, 2, 2] Block = 3 Type = In - 0.179060667136 # B[7, 2, 2, 4] Block = 3 Type = In - 0.034759981675 # B[8, 3, 0, 3] Block = 3 Type = In - 0.603083480153 # B[9, 3, 1, 4] Block = 3 Type = In - 0.176946655350 # B[10, 3, 2, 3] Block = 3 Type = In - 0.165639632803 # B[11, 3, 2, 5] Block = 3 Type = In - 0.055627509305 # B[12, 3, 3, 4] Block = 3 Type = In - 0.049782791218 # B[13, 3, 3, 6] Block = 3 Type = In - 0.036078617029 # B[14, 4, 0, 4] Block = 3 Type = In - 0.064493563641 # B[15, 4, 1, 5] Block = 3 Type = In - 0.149250535822 # B[16, 4, 2, 4] Block = 3 Type = In - -0.060208330201 # B[17, 4, 2, 6] Block = 3 Type = In - 0.105119833648 # B[18, 4, 3, 5] Block = 3 Type = In - -0.008598816416 # B[19, 4, 4, 4] Block = 3 Type = In - 0.041210118888 # B[20, 4, 4, 6] Block = 3 Type = In - -0.002705345469 # B[21, 5, 0, 5] Block = 3 Type = In - 0.170191392493 # B[22, 5, 1, 6] Block = 3 Type = In - 0.226897293272 # B[23, 5, 2, 5] Block = 3 Type = In - 0.013009034793 # B[24, 5, 3, 6] Block = 3 Type = In - -0.020734586320 # B[25, 5, 4, 5] Block = 3 Type = In - -0.018139074523 # B[26, 5, 5, 6] Block = 3 Type = In - -0.016001848874 # B[27, 6, 0, 6] Block = 3 Type = In - 0.016663324316 # B[28, 6, 2, 6] Block = 3 Type = In - -0.024245533697 # B[29, 6, 4, 6] Block = 3 Type = In - -0.009039017094 # B[30, 6, 6, 6] Block = 3 Type = In - -0.005654800687 # B[1, 0, 0, 0] Block = 4 Type = In - -0.071064263981 # B[2, 1, 0, 1] Block = 4 Type = In - -0.009868049046 # B[3, 1, 1, 2] Block = 4 Type = In - -0.061297753855 # B[4, 2, 0, 2] Block = 4 Type = In - -0.239682636759 # B[5, 2, 1, 3] Block = 4 Type = In - 0.015954956116 # B[6, 2, 2, 2] Block = 4 Type = In - 0.176005610703 # B[7, 2, 2, 4] Block = 4 Type = In - -0.081125948095 # B[8, 3, 0, 3] Block = 4 Type = In - -0.170847987084 # B[9, 3, 1, 4] Block = 4 Type = In - 0.242239715395 # B[10, 3, 2, 3] Block = 4 Type = In - 0.082507688294 # B[11, 3, 2, 5] Block = 4 Type = In - 0.247785108978 # B[12, 3, 3, 4] Block = 4 Type = In - -0.008194303016 # B[13, 3, 3, 6] Block = 4 Type = In - 0.014786217107 # B[14, 4, 0, 4] Block = 4 Type = In - -0.096877379511 # B[15, 4, 1, 5] Block = 4 Type = In - 0.164908528605 # B[16, 4, 2, 4] Block = 4 Type = In - 0.151575252604 # B[17, 4, 2, 6] Block = 4 Type = In - 0.099757230122 # B[18, 4, 3, 5] Block = 4 Type = In - 0.035047662350 # B[19, 4, 4, 4] Block = 4 Type = In - 0.007150552805 # B[20, 4, 4, 6] Block = 4 Type = In - 0.019198319779 # B[21, 5, 0, 5] Block = 4 Type = In - -0.127113932870 # B[22, 5, 1, 6] Block = 4 Type = In - 0.114478010571 # B[23, 5, 2, 5] Block = 4 Type = In - 0.050915227324 # B[24, 5, 3, 6] Block = 4 Type = In - 0.096853268510 # B[25, 5, 4, 5] Block = 4 Type = In - 0.067894750884 # B[26, 5, 5, 6] Block = 4 Type = In - -0.002405537661 # B[27, 6, 0, 6] Block = 4 Type = In - 0.058549926350 # B[28, 6, 2, 6] Block = 4 Type = In - 0.009481237049 # B[29, 6, 4, 6] Block = 4 Type = In - -0.008649958571 # B[30, 6, 6, 6] Block = 4 Type = In - 0.005430513686 # B[1, 0, 0, 0] Block = 5 Type = In - 0.057269488102 # B[2, 1, 0, 1] Block = 5 Type = In - 0.149882860704 # B[3, 1, 1, 2] Block = 5 Type = In - 0.035481869944 # B[4, 2, 0, 2] Block = 5 Type = In - 0.378916788823 # B[5, 2, 1, 3] Block = 5 Type = In - 0.039770598731 # B[6, 2, 2, 2] Block = 5 Type = In - 0.179060667136 # B[7, 2, 2, 4] Block = 5 Type = In - 0.067792661762 # B[8, 3, 0, 3] Block = 5 Type = In - 0.272613304171 # B[9, 3, 1, 4] Block = 5 Type = In - 0.258942062632 # B[10, 3, 2, 3] Block = 5 Type = In - 0.100130474069 # B[11, 3, 2, 5] Block = 5 Type = In - 0.055627509305 # B[12, 3, 3, 4] Block = 5 Type = In - 0.049782791218 # B[13, 3, 3, 6] Block = 5 Type = In - -0.029743698629 # B[14, 4, 0, 4] Block = 5 Type = In - -0.013420300314 # B[15, 4, 1, 5] Block = 5 Type = In - 0.137229827290 # B[16, 4, 2, 4] Block = 5 Type = In - -0.034447269506 # B[17, 4, 2, 6] Block = 5 Type = In - -0.033847124314 # B[18, 4, 3, 5] Block = 5 Type = In - -0.008598816416 # B[19, 4, 4, 4] Block = 5 Type = In - 0.041210118888 # B[20, 4, 4, 6] Block = 5 Type = In - -0.034624751006 # B[21, 5, 0, 5] Block = 5 Type = In - 0.041662678638 # B[22, 5, 1, 6] Block = 5 Type = In - 0.103089891872 # B[23, 5, 2, 5] Block = 5 Type = In - -0.044572198386 # B[24, 5, 3, 6] Block = 5 Type = In - -0.063847809434 # B[25, 5, 4, 5] Block = 5 Type = In - -0.018139074523 # B[26, 5, 5, 6] Block = 5 Type = In - 0.000464369553 # B[27, 6, 0, 6] Block = 5 Type = In - 0.082229290277 # B[28, 6, 2, 6] Block = 5 Type = In - -0.008875503360 # B[29, 6, 4, 6] Block = 5 Type = In - -0.009039017094 # B[30, 6, 6, 6] Block = 5 Type = In - -0.005654800687 # B[1, 0, 0, 0] Block = 6 Type = In - -0.001217874195 # B[2, 1, 0, 1] Block = 6 Type = In - -0.009868049046 # B[3, 1, 1, 2] Block = 6 Type = In - -0.092827766060 # B[4, 2, 0, 2] Block = 6 Type = In - 0.439274283244 # B[5, 2, 1, 3] Block = 6 Type = In - 0.015954956116 # B[6, 2, 2, 2] Block = 6 Type = In - 0.176005610703 # B[7, 2, 2, 4] Block = 6 Type = In - 0.102468480364 # B[8, 3, 0, 3] Block = 6 Type = In - 0.674122225402 # B[9, 3, 1, 4] Block = 6 Type = In - 0.072529538087 # B[10, 3, 2, 3] Block = 6 Type = In - 0.330711171466 # B[11, 3, 2, 5] Block = 6 Type = In - 0.247785108978 # B[12, 3, 3, 4] Block = 6 Type = In - -0.008194303016 # B[13, 3, 3, 6] Block = 6 Type = In - 0.052250780232 # B[14, 4, 0, 4] Block = 6 Type = In - 0.374231060518 # B[15, 4, 1, 5] Block = 6 Type = In - 0.326667869620 # B[16, 4, 2, 4] Block = 6 Type = In - 0.079031873518 # B[17, 4, 2, 6] Block = 6 Type = In - 0.224004472527 # B[18, 4, 3, 5] Block = 6 Type = In - 0.035047662350 # B[19, 4, 4, 4] Block = 6 Type = In - 0.007150552805 # B[20, 4, 4, 6] Block = 6 Type = In - 0.040682917098 # B[21, 5, 0, 5] Block = 6 Type = In - 0.046855927526 # B[22, 5, 1, 6] Block = 6 Type = In - 0.219695071346 # B[23, 5, 2, 5] Block = 6 Type = In - -0.001426581661 # B[24, 5, 3, 6] Block = 6 Type = In - 0.028514699601 # B[25, 5, 4, 5] Block = 6 Type = In - 0.067894750884 # B[26, 5, 5, 6] Block = 6 Type = In - -0.049888149225 # B[27, 6, 0, 6] Block = 6 Type = In - 0.009259151039 # B[28, 6, 2, 6] Block = 6 Type = In - 0.003868002128 # B[29, 6, 4, 6] Block = 6 Type = In - -0.008649958571 # B[30, 6, 6, 6] Block = 6 Type = In - -0.005654800692 # B[1, 0, 0, 0] Block = 7 Type = In - -0.071064263981 # B[2, 1, 0, 1] Block = 7 Type = In - -0.085085203640 # B[3, 1, 1, 2] Block = 7 Type = In - -0.061297753855 # B[4, 2, 0, 2] Block = 7 Type = In - 0.223668616358 # B[5, 2, 1, 3] Block = 7 Type = In - 0.015954956116 # B[6, 2, 2, 2] Block = 7 Type = In - 0.033706085249 # B[7, 2, 2, 4] Block = 7 Type = In - -0.081125948095 # B[8, 3, 0, 3] Block = 7 Type = In - -0.005054494008 # B[9, 3, 1, 4] Block = 7 Type = In - 0.242239715395 # B[10, 3, 2, 3] Block = 7 Type = In - -0.000886414104 # B[11, 3, 2, 5] Block = 7 Type = In - 0.059178212190 # B[12, 3, 3, 4] Block = 7 Type = In - 0.008498646326 # B[13, 3, 3, 6] Block = 7 Type = In - 0.014786217107 # B[14, 4, 0, 4] Block = 7 Type = In - -0.178665293356 # B[15, 4, 1, 5] Block = 7 Type = In - 0.164908528605 # B[16, 4, 2, 4] Block = 7 Type = In - -0.117717485069 # B[17, 4, 2, 6] Block = 7 Type = In - 0.146739677531 # B[18, 4, 3, 5] Block = 7 Type = In - 0.035047662350 # B[19, 4, 4, 4] Block = 7 Type = In - 0.088770688382 # B[20, 4, 4, 6] Block = 7 Type = In - 0.019198319779 # B[21, 5, 0, 5] Block = 7 Type = In - -0.148162265312 # B[22, 5, 1, 6] Block = 7 Type = In - 0.114478010571 # B[23, 5, 2, 5] Block = 7 Type = In - 0.114731400461 # B[24, 5, 3, 6] Block = 7 Type = In - 0.096853268510 # B[25, 5, 4, 5] Block = 7 Type = In - 0.031183854107 # B[26, 5, 5, 6] Block = 7 Type = In - -0.002405537661 # B[27, 6, 0, 6] Block = 7 Type = In - 0.058549926350 # B[28, 6, 2, 6] Block = 7 Type = In - 0.009481237049 # B[29, 6, 4, 6] Block = 7 Type = In - -0.008649958571 # B[30, 6, 6, 6] Block = 7 Type = In - 0.017733403092 # B[1, 0, 0, 0] Block = 8 Type = In - 0.015168905151 # B[2, 1, 0, 1] Block = 8 Type = In - -0.212358294308 # B[3, 1, 1, 2] Block = 8 Type = In - 0.115608035432 # B[4, 2, 0, 2] Block = 8 Type = In - 0.128621845177 # B[5, 2, 1, 3] Block = 8 Type = In - -0.055682216710 # B[6, 2, 2, 2] Block = 8 Type = In - 0.168986321733 # B[7, 2, 2, 4] Block = 8 Type = In - -0.087186888529 # B[8, 3, 0, 3] Block = 8 Type = In - 0.378810692322 # B[9, 3, 1, 4] Block = 8 Type = In - 0.036128510376 # B[10, 3, 2, 3] Block = 8 Type = In - 0.179888488204 # B[11, 3, 2, 5] Block = 8 Type = In - -0.001405954437 # B[12, 3, 3, 4] Block = 8 Type = In - 0.010551104009 # B[13, 3, 3, 6] Block = 8 Type = In - -0.059381370200 # B[14, 4, 0, 4] Block = 8 Type = In - 0.475432753620 # B[15, 4, 1, 5] Block = 8 Type = In - 0.095868282640 # B[16, 4, 2, 4] Block = 8 Type = In - 0.106524975238 # B[17, 4, 2, 6] Block = 8 Type = In - 0.058941182257 # B[18, 4, 3, 5] Block = 8 Type = In - 0.012512778321 # B[19, 4, 4, 4] Block = 8 Type = In - 0.080549204239 # B[20, 4, 4, 6] Block = 8 Type = In - -0.068536821891 # B[21, 5, 0, 5] Block = 8 Type = In - 0.089459777664 # B[22, 5, 1, 6] Block = 8 Type = In - 0.163187761880 # B[23, 5, 2, 5] Block = 8 Type = In - 0.139719330200 # B[24, 5, 3, 6] Block = 8 Type = In - 0.145095171389 # B[25, 5, 4, 5] Block = 8 Type = In - 0.074157391376 # B[26, 5, 5, 6] Block = 8 Type = In - 0.018646775951 # B[27, 6, 0, 6] Block = 8 Type = In - 0.035882498943 # B[28, 6, 2, 6] Block = 8 Type = In - 0.050420424420 # B[29, 6, 4, 6] Block = 8 Type = In - 0.009994821144 # B[30, 6, 6, 6] Block = 8 Type = In - 0.000000000000 # B[0] Block = 1 Type = P - -0.002987589706 # B[1, 0, 0, 0] Block = 1 Type = P - -0.072158389412 # B[2, 1, 0, 1] Block = 1 Type = P - -0.025322250603 # B[3, 1, 1, 2] Block = 1 Type = P - -0.030241379192 # B[4, 2, 0, 2] Block = 1 Type = P - -0.676287334962 # B[5, 2, 1, 3] Block = 1 Type = P - -0.172216278028 # B[6, 2, 2, 2] Block = 1 Type = P - -0.246535097343 # B[7, 2, 2, 4] Block = 1 Type = P - -0.035782528462 # B[8, 3, 0, 3] Block = 1 Type = P - -0.560641780823 # B[9, 3, 1, 4] Block = 1 Type = P - -0.549579515296 # B[10, 3, 2, 3] Block = 1 Type = P - -0.016920837991 # B[11, 3, 2, 5] Block = 1 Type = P - -0.288447245376 # B[12, 3, 3, 4] Block = 1 Type = P - 0.069076859372 # B[13, 3, 3, 6] Block = 1 Type = P - -0.052298717507 # B[14, 4, 0, 4] Block = 1 Type = P - -0.434250953671 # B[15, 4, 1, 5] Block = 1 Type = P - -0.322043860507 # B[16, 4, 2, 4] Block = 1 Type = P - -0.096837010372 # B[17, 4, 2, 6] Block = 1 Type = P - -0.213169352789 # B[18, 4, 3, 5] Block = 1 Type = P - -0.019566740546 # B[19, 4, 4, 4] Block = 1 Type = P - -0.029415128740 # B[20, 4, 4, 6] Block = 1 Type = P - -0.036591077655 # B[21, 5, 0, 5] Block = 1 Type = P - -0.300384511072 # B[22, 5, 1, 6] Block = 1 Type = P - -0.111126537447 # B[23, 5, 2, 5] Block = 1 Type = P - -0.000209831053 # B[24, 5, 3, 6] Block = 1 Type = P - -0.000023632674 # B[25, 5, 4, 5] Block = 1 Type = P - 0.009497323905 # B[26, 5, 5, 6] Block = 1 Type = P - -0.042287705828 # B[27, 6, 0, 6] Block = 1 Type = P - -0.113311457350 # B[28, 6, 2, 6] Block = 1 Type = P - 0.029574563913 # B[29, 6, 4, 6] Block = 1 Type = P - -0.027748295426 # B[30, 6, 6, 6] Block = 1 Type = P - -0.001747658243 # B[1, 0, 0, 0] Block = 2 Type = P - -0.026182047943 # B[2, 1, 0, 1] Block = 2 Type = P - 0.089481157533 # B[3, 1, 1, 2] Block = 2 Type = P - -0.076525139004 # B[4, 2, 0, 2] Block = 2 Type = P - -0.107925591359 # B[5, 2, 1, 3] Block = 2 Type = P - -0.059117110271 # B[6, 2, 2, 2] Block = 2 Type = P - -0.256324252168 # B[7, 2, 2, 4] Block = 2 Type = P - -0.020755324452 # B[8, 3, 0, 3] Block = 2 Type = P - -0.337284108142 # B[9, 3, 1, 4] Block = 2 Type = P - -0.073956723908 # B[10, 3, 2, 3] Block = 2 Type = P - -0.149119927857 # B[11, 3, 2, 5] Block = 2 Type = P - 0.047627781519 # B[12, 3, 3, 4] Block = 2 Type = P - 0.061394929126 # B[13, 3, 3, 6] Block = 2 Type = P - -0.082660360252 # B[14, 4, 0, 4] Block = 2 Type = P - -0.183225932285 # B[15, 4, 1, 5] Block = 2 Type = P - -0.046981555049 # B[16, 4, 2, 4] Block = 2 Type = P - -0.046846685850 # B[17, 4, 2, 6] Block = 2 Type = P - -0.014388943769 # B[18, 4, 3, 5] Block = 2 Type = P - 0.012133725790 # B[19, 4, 4, 4] Block = 2 Type = P - 0.085321452425 # B[20, 4, 4, 6] Block = 2 Type = P - -0.034945525448 # B[21, 5, 0, 5] Block = 2 Type = P - -0.028326642109 # B[22, 5, 1, 6] Block = 2 Type = P - -0.085701075837 # B[23, 5, 2, 5] Block = 2 Type = P - 0.108257997015 # B[24, 5, 3, 6] Block = 2 Type = P - 0.045837409910 # B[25, 5, 4, 5] Block = 2 Type = P - -0.014180512722 # B[26, 5, 5, 6] Block = 2 Type = P - 0.010756044042 # B[27, 6, 0, 6] Block = 2 Type = P - 0.023429477590 # B[28, 6, 2, 6] Block = 2 Type = P - -0.007794133717 # B[29, 6, 4, 6] Block = 2 Type = P - 0.002019828318 # B[30, 6, 6, 6] Block = 2 Type = P - -0.001747658242 # B[1, 0, 0, 0] Block = 3 Type = P - 0.047070626642 # B[2, 1, 0, 1] Block = 3 Type = P - -0.126595340298 # B[3, 1, 1, 2] Block = 3 Type = P - 0.022286899829 # B[4, 2, 0, 2] Block = 3 Type = P - -0.483695340547 # B[5, 2, 1, 3] Block = 3 Type = P - -0.059117110271 # B[6, 2, 2, 2] Block = 3 Type = P - -0.067694089340 # B[7, 2, 2, 4] Block = 3 Type = P - 0.034974727122 # B[8, 3, 0, 3] Block = 3 Type = P - -0.226290583408 # B[9, 3, 1, 4] Block = 3 Type = P - -0.184699579267 # B[10, 3, 2, 3] Block = 3 Type = P - 0.063122270285 # B[11, 3, 2, 5] Block = 3 Type = P - 0.041271206739 # B[12, 3, 3, 4] Block = 3 Type = P - -0.004229157928 # B[13, 3, 3, 6] Block = 3 Type = P - 0.050689134214 # B[14, 4, 0, 4] Block = 3 Type = P - -0.138276744014 # B[15, 4, 1, 5] Block = 3 Type = P - 0.097985494164 # B[16, 4, 2, 4] Block = 3 Type = P - -0.083537235645 # B[17, 4, 2, 6] Block = 3 Type = P - 0.098390585361 # B[18, 4, 3, 5] Block = 3 Type = P - 0.012133725790 # B[19, 4, 4, 4] Block = 3 Type = P - -0.038067814334 # B[20, 4, 4, 6] Block = 3 Type = P - 0.029636266108 # B[21, 5, 0, 5] Block = 3 Type = P - -0.157117938354 # B[22, 5, 1, 6] Block = 3 Type = P - -0.027712542047 # B[23, 5, 2, 5] Block = 3 Type = P - 0.084730212710 # B[24, 5, 3, 6] Block = 3 Type = P - 0.023437407693 # B[25, 5, 4, 5] Block = 3 Type = P - 0.017747856995 # B[26, 5, 5, 6] Block = 3 Type = P - 0.050161344183 # B[27, 6, 0, 6] Block = 3 Type = P - -0.098577816149 # B[28, 6, 2, 6] Block = 3 Type = P - -0.046997533090 # B[29, 6, 4, 6] Block = 3 Type = P - 0.002019828318 # B[30, 6, 6, 6] Block = 3 Type = P - -0.003152987881 # B[1, 0, 0, 0] Block = 4 Type = P - 0.014621850469 # B[2, 1, 0, 1] Block = 4 Type = P - 0.098860641022 # B[3, 1, 1, 2] Block = 4 Type = P - 0.069546644549 # B[4, 2, 0, 2] Block = 4 Type = P - 0.180804700658 # B[5, 2, 1, 3] Block = 4 Type = P - 0.034244852922 # B[6, 2, 2, 2] Block = 4 Type = P - 0.044579888557 # B[7, 2, 2, 4] Block = 4 Type = P - 0.001526239292 # B[8, 3, 0, 3] Block = 4 Type = P - 0.203861850923 # B[9, 3, 1, 4] Block = 4 Type = P - 0.021679218740 # B[10, 3, 2, 3] Block = 4 Type = P - 0.185899872703 # B[11, 3, 2, 5] Block = 4 Type = P - -0.063472862380 # B[12, 3, 3, 4] Block = 4 Type = P - -0.015662648111 # B[13, 3, 3, 6] Block = 4 Type = P - 0.076209869795 # B[14, 4, 0, 4] Block = 4 Type = P - -0.050213789331 # B[15, 4, 1, 5] Block = 4 Type = P - 0.038175316256 # B[16, 4, 2, 4] Block = 4 Type = P - 0.041946424186 # B[17, 4, 2, 6] Block = 4 Type = P - -0.023902281235 # B[18, 4, 3, 5] Block = 4 Type = P - 0.008537822812 # B[19, 4, 4, 4] Block = 4 Type = P - 0.039989757491 # B[20, 4, 4, 6] Block = 4 Type = P - 0.022210126714 # B[21, 5, 0, 5] Block = 4 Type = P - 0.010855258243 # B[22, 5, 1, 6] Block = 4 Type = P - 0.021570527219 # B[23, 5, 2, 5] Block = 4 Type = P - -0.119983534986 # B[24, 5, 3, 6] Block = 4 Type = P - -0.019726935513 # B[25, 5, 4, 5] Block = 4 Type = P - -0.015720476443 # B[26, 5, 5, 6] Block = 4 Type = P - -0.024522109113 # B[27, 6, 0, 6] Block = 4 Type = P - -0.051478859538 # B[28, 6, 2, 6] Block = 4 Type = P - 0.017216285614 # B[29, 6, 4, 6] Block = 4 Type = P - -0.003565797401 # B[30, 6, 6, 6] Block = 4 Type = P - -0.001747658242 # B[1, 0, 0, 0] Block = 5 Type = P - -0.026182047943 # B[2, 1, 0, 1] Block = 5 Type = P - -0.126595340298 # B[3, 1, 1, 2] Block = 5 Type = P - -0.076525139004 # B[4, 2, 0, 2] Block = 5 Type = P - -0.157814129312 # B[5, 2, 1, 3] Block = 5 Type = P - -0.059117110271 # B[6, 2, 2, 2] Block = 5 Type = P - -0.067694089340 # B[7, 2, 2, 4] Block = 5 Type = P - -0.020755324452 # B[8, 3, 0, 3] Block = 5 Type = P - -0.216746420586 # B[9, 3, 1, 4] Block = 5 Type = P - -0.073956723908 # B[10, 3, 2, 3] Block = 5 Type = P - -0.263593571569 # B[11, 3, 2, 5] Block = 5 Type = P - 0.041271206739 # B[12, 3, 3, 4] Block = 5 Type = P - -0.004229157928 # B[13, 3, 3, 6] Block = 5 Type = P - -0.082660360252 # B[14, 4, 0, 4] Block = 5 Type = P - -0.305032662779 # B[15, 4, 1, 5] Block = 5 Type = P - -0.046981555049 # B[16, 4, 2, 4] Block = 5 Type = P - -0.187955078269 # B[17, 4, 2, 6] Block = 5 Type = P - -0.121808447372 # B[18, 4, 3, 5] Block = 5 Type = P - 0.012133725790 # B[19, 4, 4, 4] Block = 5 Type = P - -0.038067814334 # B[20, 4, 4, 6] Block = 5 Type = P - -0.034945525448 # B[21, 5, 0, 5] Block = 5 Type = P - -0.226555787648 # B[22, 5, 1, 6] Block = 5 Type = P - -0.085701075837 # B[23, 5, 2, 5] Block = 5 Type = P - -0.121081797087 # B[24, 5, 3, 6] Block = 5 Type = P - 0.045837409910 # B[25, 5, 4, 5] Block = 5 Type = P - 0.017747856995 # B[26, 5, 5, 6] Block = 5 Type = P - 0.010756044042 # B[27, 6, 0, 6] Block = 5 Type = P - 0.023429477590 # B[28, 6, 2, 6] Block = 5 Type = P - -0.007794133717 # B[29, 6, 4, 6] Block = 5 Type = P - 0.002019828318 # B[30, 6, 6, 6] Block = 5 Type = P - -0.003152987881 # B[1, 0, 0, 0] Block = 6 Type = P - -0.003431824919 # B[2, 1, 0, 1] Block = 6 Type = P - 0.098860641022 # B[3, 1, 1, 2] Block = 6 Type = P - -0.049867192647 # B[4, 2, 0, 2] Block = 6 Type = P - 0.130247785083 # B[5, 2, 1, 3] Block = 6 Type = P - 0.034244852922 # B[6, 2, 2, 2] Block = 6 Type = P - 0.044579888557 # B[7, 2, 2, 4] Block = 6 Type = P - 0.051064338359 # B[8, 3, 0, 3] Block = 6 Type = P - -0.034769100897 # B[9, 3, 1, 4] Block = 6 Type = P - -0.055923569507 # B[10, 3, 2, 3] Block = 6 Type = P - 0.101065442824 # B[11, 3, 2, 5] Block = 6 Type = P - -0.063472862380 # B[12, 3, 3, 4] Block = 6 Type = P - -0.015662648111 # B[13, 3, 3, 6] Block = 6 Type = P - -0.020942037301 # B[14, 4, 0, 4] Block = 6 Type = P - 0.057686438719 # B[15, 4, 1, 5] Block = 6 Type = P - 0.061281723131 # B[16, 4, 2, 4] Block = 6 Type = P - 0.041003214284 # B[17, 4, 2, 6] Block = 6 Type = P - 0.104968889582 # B[18, 4, 3, 5] Block = 6 Type = P - 0.008537822812 # B[19, 4, 4, 4] Block = 6 Type = P - 0.039989757491 # B[20, 4, 4, 6] Block = 6 Type = P - 0.058310887739 # B[21, 5, 0, 5] Block = 6 Type = P - 0.043642228702 # B[22, 5, 1, 6] Block = 6 Type = P - 0.119827018636 # B[23, 5, 2, 5] Block = 6 Type = P - -0.017878741482 # B[24, 5, 3, 6] Block = 6 Type = P - 0.013615249763 # B[25, 5, 4, 5] Block = 6 Type = P - -0.015720476443 # B[26, 5, 5, 6] Block = 6 Type = P - 0.028210503571 # B[27, 6, 0, 6] Block = 6 Type = P - 0.138982983531 # B[28, 6, 2, 6] Block = 6 Type = P - 0.020848948259 # B[29, 6, 4, 6] Block = 6 Type = P - -0.003565797401 # B[30, 6, 6, 6] Block = 6 Type = P - -0.003152987876 # B[1, 0, 0, 0] Block = 7 Type = P - 0.014621850469 # B[2, 1, 0, 1] Block = 7 Type = P - 0.136917412546 # B[3, 1, 1, 2] Block = 7 Type = P - 0.069546644549 # B[4, 2, 0, 2] Block = 7 Type = P - 0.134471034367 # B[5, 2, 1, 3] Block = 7 Type = P - 0.034244852922 # B[6, 2, 2, 2] Block = 7 Type = P - 0.073714102880 # B[7, 2, 2, 4] Block = 7 Type = P - 0.001526239292 # B[8, 3, 0, 3] Block = 7 Type = P - 0.029314077312 # B[9, 3, 1, 4] Block = 7 Type = P - 0.021679218740 # B[10, 3, 2, 3] Block = 7 Type = P - 0.005384023182 # B[11, 3, 2, 5] Block = 7 Type = P - 0.029912954139 # B[12, 3, 3, 4] Block = 7 Type = P - 0.036308629380 # B[13, 3, 3, 6] Block = 7 Type = P - 0.076209869795 # B[14, 4, 0, 4] Block = 7 Type = P - -0.095659211777 # B[15, 4, 1, 5] Block = 7 Type = P - 0.038175316256 # B[16, 4, 2, 4] Block = 7 Type = P - -0.054559433157 # B[17, 4, 2, 6] Block = 7 Type = P - -0.079205893849 # B[18, 4, 3, 5] Block = 7 Type = P - 0.008537822812 # B[19, 4, 4, 4] Block = 7 Type = P - 0.072688459278 # B[20, 4, 4, 6] Block = 7 Type = P - 0.022210126714 # B[21, 5, 0, 5] Block = 7 Type = P - 0.032318678024 # B[22, 5, 1, 6] Block = 7 Type = P - 0.021570527219 # B[23, 5, 2, 5] Block = 7 Type = P - 0.038881258714 # B[24, 5, 3, 6] Block = 7 Type = P - -0.019726935513 # B[25, 5, 4, 5] Block = 7 Type = P - 0.030961312127 # B[26, 5, 5, 6] Block = 7 Type = P - -0.024522109113 # B[27, 6, 0, 6] Block = 7 Type = P - -0.051478859538 # B[28, 6, 2, 6] Block = 7 Type = P - 0.017216285614 # B[29, 6, 4, 6] Block = 7 Type = P - -0.003565797401 # B[30, 6, 6, 6] Block = 7 Type = P - 0.000279543258 # B[1, 0, 0, 0] Block = 8 Type = P - 0.031561006068 # B[2, 1, 0, 1] Block = 8 Type = P - 0.164297477481 # B[3, 1, 1, 2] Block = 8 Type = P - 0.020394103829 # B[4, 2, 0, 2] Block = 8 Type = P - -0.136924810031 # B[5, 2, 1, 3] Block = 8 Type = P - 0.011488762740 # B[6, 2, 2, 2] Block = 8 Type = P - -0.174577132596 # B[7, 2, 2, 4] Block = 8 Type = P - -0.104272988787 # B[8, 3, 0, 3] Block = 8 Type = P - -0.126737159959 # B[9, 3, 1, 4] Block = 8 Type = P - 0.006355291540 # B[10, 3, 2, 3] Block = 8 Type = P - -0.116847920709 # B[11, 3, 2, 5] Block = 8 Type = P - 0.093716628094 # B[12, 3, 3, 4] Block = 8 Type = P - -0.015327516258 # B[13, 3, 3, 6] Block = 8 Type = P - -0.015071645969 # B[14, 4, 0, 4] Block = 8 Type = P - 0.054380965184 # B[15, 4, 1, 5] Block = 8 Type = P - 0.113826098444 # B[16, 4, 2, 4] Block = 8 Type = P - 0.012970945123 # B[17, 4, 2, 6] Block = 8 Type = P - -0.047881183904 # B[18, 4, 3, 5] Block = 8 Type = P - -0.010520024430 # B[19, 4, 4, 4] Block = 8 Type = P - -0.077321883428 # B[20, 4, 4, 6] Block = 8 Type = P - -0.087378280220 # B[21, 5, 0, 5] Block = 8 Type = P - -0.221370705680 # B[22, 5, 1, 6] Block = 8 Type = P - 0.004554405520 # B[23, 5, 2, 5] Block = 8 Type = P - -0.164836672985 # B[24, 5, 3, 6] Block = 8 Type = P - -0.015080843808 # B[25, 5, 4, 5] Block = 8 Type = P - -0.010907038616 # B[26, 5, 5, 6] Block = 8 Type = P - -0.022228801431 # B[27, 6, 0, 6] Block = 8 Type = P - -0.055154587470 # B[28, 6, 2, 6] Block = 8 Type = P - 0.007347917376 # B[29, 6, 4, 6] Block = 8 Type = P - -0.009369956559 # B[30, 6, 6, 6] Block = 8 Type = P diff --git a/examples/mliap/InP_JCPA2020.mliap.model b/examples/mliap/InP_JCPA2020.mliap.model new file mode 120000 index 0000000000..91c9324a53 --- /dev/null +++ b/examples/mliap/InP_JCPA2020.mliap.model @@ -0,0 +1 @@ +../../potentials/InP_JCPA2020.mliap.model \ No newline at end of file diff --git a/examples/mliap/Ta06A.mliap b/examples/mliap/Ta06A.mliap deleted file mode 100644 index 21d3bab6e3..0000000000 --- a/examples/mliap/Ta06A.mliap +++ /dev/null @@ -1,17 +0,0 @@ -# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) - -# Definition of SNAP potential Ta_Cand06A -# Assumes 1 LAMMPS atom type - -variable zblcutinner equal 4 -variable zblcutouter equal 4.8 -variable zblz equal 73 - -# Specify hybrid with SNAP, ZBL - -pair_style hybrid/overlay & -zbl ${zblcutinner} ${zblcutouter} & -mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor -pair_coeff 1 1 zbl ${zblz} ${zblz} -pair_coeff * * mliap Ta - diff --git a/examples/mliap/Ta06A.mliap b/examples/mliap/Ta06A.mliap new file mode 120000 index 0000000000..c87007ce82 --- /dev/null +++ b/examples/mliap/Ta06A.mliap @@ -0,0 +1 @@ +../../potentials/Ta06A.mliap \ No newline at end of file diff --git a/examples/mliap/Ta06A.mliap.descriptor b/examples/mliap/Ta06A.mliap.descriptor deleted file mode 100644 index 481ebf7e44..0000000000 --- a/examples/mliap/Ta06A.mliap.descriptor +++ /dev/null @@ -1,21 +0,0 @@ -# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) - -# LAMMPS SNAP parameters for Ta_Cand06A - -# required -rcutfac 4.67637 -twojmax 6 - -# elements - -nelems 1 -elems Ta -radelems 0.5 -welems 1 - -# optional - -rfac0 0.99363 -rmin0 0 -bzeroflag 0 - diff --git a/examples/mliap/Ta06A.mliap.descriptor b/examples/mliap/Ta06A.mliap.descriptor new file mode 120000 index 0000000000..bbf88cc21a --- /dev/null +++ b/examples/mliap/Ta06A.mliap.descriptor @@ -0,0 +1 @@ +../../potentials/Ta06A.mliap.descriptor \ No newline at end of file diff --git a/examples/mliap/Ta06A.mliap.model b/examples/mliap/Ta06A.mliap.model deleted file mode 100644 index a7e36f1648..0000000000 --- a/examples/mliap/Ta06A.mliap.model +++ /dev/null @@ -1,37 +0,0 @@ -# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) - -# LAMMPS SNAP coefficients for Ta_Cand06A - -# nelements ncoeff -1 31 --2.92477 --0.01137 --0.00775 --0.04907 --0.15047 -0.09157 -0.05590 -0.05785 --0.11615 --0.17122 --0.10583 -0.03941 --0.11284 -0.03939 --0.07331 --0.06582 --0.09341 --0.10587 --0.15497 -0.04820 -0.00205 -0.00060 --0.04898 --0.05084 --0.03371 --0.01441 --0.01501 --0.00599 --0.06373 -0.03965 -0.01072 diff --git a/examples/mliap/Ta06A.mliap.model b/examples/mliap/Ta06A.mliap.model new file mode 120000 index 0000000000..b6a8e09026 --- /dev/null +++ b/examples/mliap/Ta06A.mliap.model @@ -0,0 +1 @@ +../../potentials/Ta06A.mliap.model \ No newline at end of file diff --git a/examples/mliap/W.quadratic.mliap b/examples/mliap/W.quadratic.mliap deleted file mode 100644 index 36cb352f84..0000000000 --- a/examples/mliap/W.quadratic.mliap +++ /dev/null @@ -1,15 +0,0 @@ -# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none - -# Definition of SNAP+ZBL potential. -variable zblcutinner equal 4 -variable zblcutouter equal 4.8 -variable zblz equal 74 - -# Specify hybrid with SNAP and ZBL - -pair_style hybrid/overlay & -zbl ${zblcutinner} ${zblcutouter} & -mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor -pair_coeff 1 1 zbl ${zblz} ${zblz} -pair_coeff * * mliap W - diff --git a/examples/mliap/W.quadratic.mliap b/examples/mliap/W.quadratic.mliap new file mode 120000 index 0000000000..de204a2e79 --- /dev/null +++ b/examples/mliap/W.quadratic.mliap @@ -0,0 +1 @@ +../../potentials/W.quadratic.mliap \ No newline at end of file diff --git a/examples/mliap/W.quadratic.mliap.descriptor b/examples/mliap/W.quadratic.mliap.descriptor deleted file mode 100644 index 7db38ba7f5..0000000000 --- a/examples/mliap/W.quadratic.mliap.descriptor +++ /dev/null @@ -1,20 +0,0 @@ -# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none - -# required - -rcutfac 4.73442 -twojmax 6 - -# elements - -nelems 1 -elems W -radelems 0.5 -welems 1 - -# optional - -rfac0 0.99363 -rmin0 0 -bzeroflag 1 - diff --git a/examples/mliap/W.quadratic.mliap.descriptor b/examples/mliap/W.quadratic.mliap.descriptor new file mode 120000 index 0000000000..1bae3391e3 --- /dev/null +++ b/examples/mliap/W.quadratic.mliap.descriptor @@ -0,0 +1 @@ +../../potentials/W.quadratic.mliap.descriptor \ No newline at end of file diff --git a/examples/mliap/W.quadratic.mliap.model b/examples/mliap/W.quadratic.mliap.model deleted file mode 100644 index d16b535fb9..0000000000 --- a/examples/mliap/W.quadratic.mliap.model +++ /dev/null @@ -1,502 +0,0 @@ -# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none - -# LAMMPS SNAP coefficients for Quadratic W - -# nelements ncoeff -1 496 - 0.000000000000 - -0.000019342340 - 0.000039964908 - -0.000450771142 - -0.000233498664 - -0.000519872659 - -0.000089734174 - -0.000106353291 - -0.000035475344 - -0.000254116041 - -0.000520021242 - 0.000065038801 - -0.000304498225 - -0.000032230341 - -0.000007420702 - -0.000159369530 - -0.000144907916 - 0.000078858361 - -0.000238070583 - -0.000050556167 - -0.000008662153 - 0.000017439967 - -0.000028764863 - 0.000022504717 - 0.000001821340 - -0.000089967846 - -0.000106392838 - 0.000013771852 - 0.000070228097 - -0.000024152909 - -0.000006036274 --4.2551325e-05 -0.0001982986695 -5.4994526e-05 -0.0001760061375 -0.0005287969295 --0.00045677476 --0.007136016296 -0.0003868434375 --0.0006071085215 --0.000554512177 --0.0006596292555 --0.0007585367005 -7.62333015e-05 -0.0002137614635 -0.000379897335 -0.0005441952125 -0.000128413515 -5.74706545e-05 -0.0002303380555 --0.0005759952885 --0.0001530888095 --0.0001614394285 --3.80386335e-05 --0.0006390699265 --2.44191e-05 --0.000627990564 --0.000199645294 --3.63524105e-05 --0.0004350939225 --0.000230192872 --0.000456462716 --0.00096561205 --0.0016793622125 -0.008264605054 -0.005768043843 -0.0259523273965 -0.002379667484 -0.001798185681 -0.001411261095 -0.0046629902735 --0.001249069583 --0.003518728846 --0.00152218625 --0.0005803019955 --0.002443813614 -0.003302653151 --0.0035163183225 -0.005378221661 --0.0005157550285 -0.0005802384085 --8.4625189e-05 --0.0003100449505 -0.0016035457395 --0.006841896086 -0.00327970803 -0.000517873278 -0.000462624598 -0.001556398782 -0.000629663951 -0.004036847861 -0.000410623118 -0.0033671740175 -0.0060744662315 -0.0460285453095 -0.0106979441315 -0.006457375952 --0.0043000712405 --0.0196789547465 --0.009589713549 --0.0152983426785 -0.003041488452 --0.0032366707575 --0.0119067345335 -0.0049313311815 --0.0030034838505 -8.7700383e-05 -0.0007061505055 -0.0097234329625 -0.007217090323 -0.000235882459 --0.0033595857445 --0.0168665065145 -0.017786509719 -0.001877013067 -0.0006351836775 -0.004600906728 -0.012509628713 --0.003427408333 --0.0014640751665 --0.003888408385 --0.0062058291515 --0.001642104699 --0.00105774282 --0.0059780195505 --0.001753939287 -0.000479345105 --0.0019904699045 -4.98541965e-05 --0.0041212491675 --0.0042906641465 --0.002351418317 --0.0106697325275 --0.000648222198 --0.002286882867 --0.000626754824 --0.00073748291 -0.0016922435575 -0.0037496719655 -0.004656851048 --0.0002176673305 --0.0006739876965 --0.0006208869175 -7.61738615e-05 -0.0019258401385 -0.005690172208 -0.007318906809 --0.035200169396 -0.009167226287 --0.000404285392 --0.00348855982 --0.0024229238155 -0.0022336200925 --0.012584737991 -0.0016262069595 -0.0048016592015 -0.0004657340115 -0.0025051890895 --0.0104101829395 -0.016176490711 --0.0094539511845 --0.002289487018 --0.0002052188655 --0.007085549731 -0.02162608233 --0.002238154953 -0.0190676087705 -0.0002139442795 -0.0010403767345 -0.003360683249 -0.003153376576 --0.001249764819 --0.068537163077 -0.0023354667295 -0.001767860664 --0.0033006265215 -0.0146223252485 --0.003180595809 -0.0069092040305 -0.0010583439885 --0.003447267898 --0.001106713702 -0.00523272471 --0.010758599437 --0.001822397317 -0.018487732527 --0.0024400507145 --0.007514714512 --0.003947742615 -0.012413627732 -0.003092235017 -0.018069399047 --0.0035369320715 -0.0011168541665 --0.0014980962775 --1.2944254e-05 --0.041955689351 -0.0023033776335 --0.040725631204 --0.0693632023935 -0.020674975135 --0.0341006922645 --0.006059344895 -0.002385437006 --0.004177512167 --0.0146544701995 --0.0008310261785 --0.010934674355 -0.006492824537 --0.014812643723 -0.004033748718 --0.004155996547 --0.013113411806 --0.0088014221285 -0.0037541341 --0.000805304258 -0.006318190602 -0.012552958042 -0.004200553135 --0.00681355806 --0.001852228976 -0.0017381476065 --0.002643779529 -0.0049358851655 -0.001522146164 -0.002260955858 --0.000839707664 -0.0008487292955 -0.002671028789 --0.000193952538 -0.003111368392 -0.0007482047125 -0.0020401970905 -0.000530116057 --0.0022777656015 --0.0045238154695 -0.0018290760485 --0.0003309336725 -0.00293571563 -0.000172269209 -0.001414752092 -0.0005614625055 -0.000441310903 --0.002473120026 --0.015420836338 --0.0058494470115 --0.013440044608 --0.009774364656 --0.0019064948385 --1.70476245e-05 -0.0049669399345 --0.0050880033155 -0.001600486319 --0.0018417989075 --0.0111031210975 -0.0007780738275 --0.004930202896 --0.002537539117 --0.0090246084865 --0.002694202287 --0.0062002945005 -0.0031924710865 -0.0021120090085 --0.003067483203 --0.0002847253785 --0.016407568729 --0.0012875748665 --0.0136223073595 --0.00152438356 -0.0012803681485 --0.002216406572 --0.001518786423 --0.004453055438 --0.0078894618465 -0.001421143537 --0.0050288776725 -0.001199592632 --0.002661588749 --0.004357715347 -0.009525078378 -0.0026286979515 -0.0043289788665 -0.0004994005155 -0.003791227565 -0.0004056536255 -0.0033347889035 --0.000464347336 --0.0069517390965 --0.0079588750315 --0.004154738239 -0.006620101338 -0.008608842617 -0.0056131740625 -0.0011860229985 -0.007580086232 -0.003260306951 -0.000979553031 --0.0044626742655 --0.005235925737 --0.0161268610495 --0.0069229581565 -0.003724916317 -0.0023613845 -0.0013633397005 -0.001433661889 --0.0009859245845 --0.019516619562 --0.0051345232355 --0.0003792145305 --0.009160883563 --0.0052408213305 --0.000837343292 --0.010077898583 --0.000297970588 --0.000858261403 --0.0001092992995 --0.002443805024 --0.0025107490965 --0.0062944996435 -0.0026546548665 -0.0006955853785 -0.000103592795 -0.000708964143 -0.0019193670325 --0.0001578612265 --0.005585721575 --0.000421551186 -0.0022745774245 --0.004927140737 -0.0004199419505 --0.0037407737345 -0.002130170551 --0.0030979189135 --0.0019395201255 -0.0067944948975 --0.000359694345 --0.0002144026575 -0.0025529098515 -0.0001917158465 --0.000540725939 -0.001239653721 -0.00159659403 --5.5652017e-05 -4.5092483e-05 -0.002495602056 --0.0035351180395 -0.0009665743545 --0.0023236857675 --0.0014564171785 --0.0008165505935 --0.000118027852 -0.002536872662 -0.0009829535115 -0.0019442113705 -0.000664158062 -0.000326715061 -0.00019900621 -0.0004767582395 -0.000900303081 --2.91049685e-05 --0.004411179905 --0.004064521081 -0.00692497271 --0.005195674108 --0.006544598492 -0.0029896960935 -0.000425073164 --8.0017505e-05 -0.000846844414 -0.003287511416 --0.009662064447 -0.0014047560985 --0.0008689313915 -0.0009517570465 -0.000152017235 -1.6514158e-05 -0.00066355894 -0.0067775973265 -0.0021844858475 -0.0056757292145 -0.0054950676515 -0.0002498690125 --0.006315915302 --0.0059966827865 --0.0034483171305 -0.0073702392255 -0.007591193081 -0.0004062066825 -0.000913827769 -0.000622164767 -0.0002438011115 -0.01119218957 -0.010457943327 --0.002352405766 --0.000761350789 -0.000146360756 --0.00052151391 --0.001421163661 --0.0098259784665 --0.001387664408 --0.0010876399735 -0.000794093996 -0.003036965154 --0.0017118732635 --0.0015837318195 --0.006679253783 -0.000882488727 -0.0093074758655 -0.0013319314085 --0.011547004122 --0.003864301947 --0.007112747006 --0.00330951085 --0.0007122545915 --0.001201815256 -0.0041789351005 --0.0001805522685 --0.0007465084205 -0.008838667361 -0.0048153576585 --9.8403371e-05 --0.010102205467 --0.0090783851625 --0.0014465915755 -0.0056402904815 -0.004713889865 --0.000958685828 -0.002844420936 -0.000886932857 -0.0002483938575 -0.000144967791 --0.0012477036845 -0.004783753466 --0.0076604636325 -0.00091901227 -0.0010552043375 -0.0013117699705 --0.000302204736 -0.002096120671 --0.0002417090715 -0.0008896279815 -8.3058685e-05 -0.002360101467 -0.003364314747 -0.0008746445705 --0.0011215585125 --0.0003387424825 -0.0005632970265 --0.0006617281215 -0.0003733063965 -0.0002623090815 -0.004593469114 -0.0040372304995 --0.001688451935 --0.003686908717 --0.004326202128 --0.000870929915 --0.0001854711995 -0.0002189774835 -0.00071865135 -0.007416398218 -0.0020460979 --0.008020256566 --0.016722806328 -0.001376213073 -0.000347513599 -0.0016684763755 --0.000874786219 -0.001891181919 --0.000534904311 -0.000846430852 --0.000641433051 -0.0007377551475 -0.001358126396 --0.000866748663 -0.011124487718 -0.005228666165 --0.001490438881 --0.0008813532175 --0.0001303988565 -0.0007163794045 -0.004674505138 --0.000722641184 --0.002023585289 -0.001547283689 -0.000753938405 -0.000470918236 --0.0003316097225 --0.0002293860925 -6.90841455e-05 --0.001301344263 --0.0004029179255 -6.69084325e-05 --0.000142497889 -0.0002207077485 --0.000201523756 diff --git a/examples/mliap/W.quadratic.mliap.model b/examples/mliap/W.quadratic.mliap.model new file mode 120000 index 0000000000..f6864e175f --- /dev/null +++ b/examples/mliap/W.quadratic.mliap.model @@ -0,0 +1 @@ +../../potentials/W.quadratic.mliap.model \ No newline at end of file diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap b/examples/mliap/WBe_Wood_PRB2019.mliap deleted file mode 100644 index 9298bf8fdf..0000000000 --- a/examples/mliap/WBe_Wood_PRB2019.mliap +++ /dev/null @@ -1,16 +0,0 @@ -# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) -# Definition of SNAP+ZBL potential. -variable zblcutinner equal 4 -variable zblcutouter equal 4.8 -variable zblz1 equal 74 -variable zblz2 equal 4 - -# Specify hybrid with SNAP and ZBL - -pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} & -mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor -pair_coeff 1 1 zbl ${zblz1} ${zblz1} -pair_coeff 1 2 zbl ${zblz1} ${zblz2} -pair_coeff 2 2 zbl ${zblz2} ${zblz2} -pair_coeff * * mliap W Be - diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap b/examples/mliap/WBe_Wood_PRB2019.mliap new file mode 120000 index 0000000000..c62bf7a337 --- /dev/null +++ b/examples/mliap/WBe_Wood_PRB2019.mliap @@ -0,0 +1 @@ +../../potentials/WBe_Wood_PRB2019.mliap \ No newline at end of file diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor b/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor deleted file mode 100644 index 0ba762fcfa..0000000000 --- a/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor +++ /dev/null @@ -1,20 +0,0 @@ -# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) - -# required - -rcutfac 4.8123 -twojmax 8 - -# elements - -nelems 2 -elems W Be -radelems 0.5 0.417932 -welems 1 0.959049 - -# optional - -rfac0 0.99363 -rmin0 0 -bzeroflag 1 - diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor b/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor new file mode 120000 index 0000000000..bc231e383a --- /dev/null +++ b/examples/mliap/WBe_Wood_PRB2019.mliap.descriptor @@ -0,0 +1 @@ +../../potentials/WBe_Wood_PRB2019.mliap.descriptor \ No newline at end of file diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.model b/examples/mliap/WBe_Wood_PRB2019.mliap.model deleted file mode 100644 index b25398e91a..0000000000 --- a/examples/mliap/WBe_Wood_PRB2019.mliap.model +++ /dev/null @@ -1,117 +0,0 @@ -# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) -# LAMMPS SNAP coefficients for WBe - -# nelements ncoeff -2 56 - -0.000000000000 # B[0] - -0.001487061994 # B[1, 0, 0, 0] - 0.075808306870 # B[2, 1, 0, 1] - 0.538735683870 # B[3, 1, 1, 2] - -0.074148039366 # B[4, 2, 0, 2] - 0.602629813770 # B[5, 2, 1, 3] - -0.147022424344 # B[6, 2, 2, 2] - 0.117756828488 # B[7, 2, 2, 4] - -0.026490439049 # B[8, 3, 0, 3] - -0.035162708767 # B[9, 3, 1, 4] - 0.064315385091 # B[10, 3, 2, 3] - -0.131936948089 # B[11, 3, 2, 5] - -0.021272860272 # B[12, 3, 3, 4] - -0.091171134054 # B[13, 3, 3, 6] - -0.024396224398 # B[14, 4, 0, 4] - -0.059813132803 # B[15, 4, 1, 5] - 0.069585393203 # B[16, 4, 2, 4] - -0.085344044181 # B[17, 4, 2, 6] - -0.155425254597 # B[18, 4, 3, 5] - -0.117031758367 # B[19, 4, 3, 7] - -0.040956258020 # B[20, 4, 4, 4] - -0.084465000389 # B[21, 4, 4, 6] - -0.020367513630 # B[22, 4, 4, 8] - -0.010730484318 # B[23, 5, 0, 5] - -0.054777575658 # B[24, 5, 1, 6] - 0.050742893747 # B[25, 5, 2, 5] - -0.004686334611 # B[26, 5, 2, 7] - -0.116372907121 # B[27, 5, 3, 6] - 0.005542497708 # B[28, 5, 3, 8] - -0.126526795635 # B[29, 5, 4, 5] - -0.080163926221 # B[30, 5, 4, 7] - -0.082426250179 # B[31, 5, 5, 6] - -0.010558777281 # B[32, 5, 5, 8] - -0.001939058038 # B[33, 6, 0, 6] - -0.027907949962 # B[34, 6, 1, 7] - 0.049483908476 # B[35, 6, 2, 6] - 0.005103754385 # B[36, 6, 2, 8] - -0.054751505141 # B[37, 6, 3, 7] - -0.055556071011 # B[38, 6, 4, 6] - -0.006026917619 # B[39, 6, 4, 8] - -0.060889030109 # B[40, 6, 5, 7] - -0.029977673973 # B[41, 6, 6, 6] - -0.014987527280 # B[42, 6, 6, 8] - -0.006697686658 # B[43, 7, 0, 7] - 0.017369624409 # B[44, 7, 1, 8] - 0.047864358817 # B[45, 7, 2, 7] - -0.001989812679 # B[46, 7, 3, 8] - 0.000153530925 # B[47, 7, 4, 7] - -0.003862356345 # B[48, 7, 5, 8] - -0.009754314198 # B[49, 7, 6, 7] - 0.000777958970 # B[50, 7, 7, 8] - -0.003031424287 # B[51, 8, 0, 8] - 0.015612715209 # B[52, 8, 2, 8] - 0.003210129646 # B[53, 8, 4, 8] - -0.013088799947 # B[54, 8, 6, 8] - 0.001465970755 # B[55, 8, 8, 8] - 0.000000000000 # B[0] - -0.000112143918 # B[1, 0, 0, 0] - 0.002449805180 # B[2, 1, 0, 1] - 0.189705916830 # B[3, 1, 1, 2] - -0.019967429692 # B[4, 2, 0, 2] - 0.286015704682 # B[5, 2, 1, 3] - 0.072864063124 # B[6, 2, 2, 2] - 0.108748154196 # B[7, 2, 2, 4] - -0.005203284351 # B[8, 3, 0, 3] - 0.043948598532 # B[9, 3, 1, 4] - 0.105425889093 # B[10, 3, 2, 3] - 0.060460134045 # B[11, 3, 2, 5] - -0.003406205141 # B[12, 3, 3, 4] - 0.002306765306 # B[13, 3, 3, 6] - -0.003845115174 # B[14, 4, 0, 4] - 0.029471162073 # B[15, 4, 1, 5] - 0.054901130330 # B[16, 4, 2, 4] - 0.010910192753 # B[17, 4, 2, 6] - 0.033885210622 # B[18, 4, 3, 5] - 0.008053439551 # B[19, 4, 3, 7] - -0.001432298168 # B[20, 4, 4, 4] - 0.017478027729 # B[21, 4, 4, 6] - -0.003402034990 # B[22, 4, 4, 8] - -0.002655339820 # B[23, 5, 0, 5] - 0.012668749892 # B[24, 5, 1, 6] - 0.037521561888 # B[25, 5, 2, 5] - -0.000682693314 # B[26, 5, 2, 7] - 0.008525913627 # B[27, 5, 3, 6] - 0.008977936348 # B[28, 5, 3, 8] - 0.006922732235 # B[29, 5, 4, 5] - 0.003031883044 # B[30, 5, 4, 7] - -0.000345577975 # B[31, 5, 5, 6] - -0.001041600679 # B[32, 5, 5, 8] - -0.001407625493 # B[33, 6, 0, 6] - 0.004211558640 # B[34, 6, 1, 7] - 0.014450875461 # B[35, 6, 2, 6] - -0.007033326252 # B[36, 6, 2, 8] - 0.004998742185 # B[37, 6, 3, 7] - -0.002824617682 # B[38, 6, 4, 6] - 0.003831871934 # B[39, 6, 4, 8] - -0.005700892700 # B[40, 6, 5, 7] - 0.000184422409 # B[41, 6, 6, 6] - 0.001592696824 # B[42, 6, 6, 8] - -0.000804927645 # B[43, 7, 0, 7] - 0.008465358642 # B[44, 7, 1, 8] - 0.005460531160 # B[45, 7, 2, 7] - -0.000639605094 # B[46, 7, 3, 8] - -0.002403948393 # B[47, 7, 4, 7] - -0.001267042453 # B[48, 7, 5, 8] - 0.003836940623 # B[49, 7, 6, 7] - 0.002333141437 # B[50, 7, 7, 8] - -0.000665360637 # B[51, 8, 0, 8] - -0.003460637865 # B[52, 8, 2, 8] - -0.001598726043 # B[53, 8, 4, 8] - 0.001478744304 # B[54, 8, 6, 8] - 0.000806643203 # B[55, 8, 8, 8] diff --git a/examples/mliap/WBe_Wood_PRB2019.mliap.model b/examples/mliap/WBe_Wood_PRB2019.mliap.model new file mode 120000 index 0000000000..a815d68a92 --- /dev/null +++ b/examples/mliap/WBe_Wood_PRB2019.mliap.model @@ -0,0 +1 @@ +../../potentials/WBe_Wood_PRB2019.mliap.model \ No newline at end of file diff --git a/potentials/InP_JCPA2020.mliap b/potentials/InP_JCPA2020.mliap new file mode 100644 index 0000000000..19d044df97 --- /dev/null +++ b/potentials/InP_JCPA2020.mliap @@ -0,0 +1,19 @@ +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +# Definition of SNAP+ZBL potential. + +variable zblcutinner index 4 +variable zblcutouter index 4.2 +variable zblz1 index 49 +variable zblz2 index 15 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff * * mliap In P + diff --git a/potentials/InP_JCPA2020.mliap.descriptor b/potentials/InP_JCPA2020.mliap.descriptor new file mode 100644 index 0000000000..287eac59c4 --- /dev/null +++ b/potentials/InP_JCPA2020.mliap.descriptor @@ -0,0 +1,20 @@ +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +# required +rcutfac 1.0 +twojmax 6 + +# elements + +nelems 2 +elems In P +radelems 3.81205 3.82945 +welems 1 0.929316 + +# optional +rfac0 0.99363 +rmin0 0.0 +bzeroflag 1 +wselfallflag 1 +chemflag 1 +bnormflag 1 diff --git a/potentials/InP_JCPA2020.mliap.model b/potentials/InP_JCPA2020.mliap.model new file mode 100644 index 0000000000..7ef9039ba2 --- /dev/null +++ b/potentials/InP_JCPA2020.mliap.model @@ -0,0 +1,485 @@ +# DATE: 2020-06-01 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Cusentino, M. A. Wood, and A.P. Thompson, "Explicit Multi-element Extension of the Spectral Neighbor Analysis Potential for Chemically Complex Systems", J. Phys. Chem. A, xxxxxx (2020) + +2 241 + 0.000000000000 # B[0] Block = 1 Type = In + -0.000666721868 # B[1, 0, 0, 0] Block = 1 Type = In + 0.032408881964 # B[2, 1, 0, 1] Block = 1 Type = In + 0.182277739455 # B[3, 1, 1, 2] Block = 1 Type = In + 0.001455902168 # B[4, 2, 0, 2] Block = 1 Type = In + 0.086259367737 # B[5, 2, 1, 3] Block = 1 Type = In + -0.044840628371 # B[6, 2, 2, 2] Block = 1 Type = In + -0.175973261191 # B[7, 2, 2, 4] Block = 1 Type = In + -0.052429169415 # B[8, 3, 0, 3] Block = 1 Type = In + 0.195529228497 # B[9, 3, 1, 4] Block = 1 Type = In + 0.078718744520 # B[10, 3, 2, 3] Block = 1 Type = In + -0.688127658121 # B[11, 3, 2, 5] Block = 1 Type = In + 0.059084058400 # B[12, 3, 3, 4] Block = 1 Type = In + 0.006795099274 # B[13, 3, 3, 6] Block = 1 Type = In + -0.043061553886 # B[14, 4, 0, 4] Block = 1 Type = In + -0.046619800530 # B[15, 4, 1, 5] Block = 1 Type = In + -0.117451659827 # B[16, 4, 2, 4] Block = 1 Type = In + -0.233615100720 # B[17, 4, 2, 6] Block = 1 Type = In + 0.015358771114 # B[18, 4, 3, 5] Block = 1 Type = In + 0.022474133984 # B[19, 4, 4, 4] Block = 1 Type = In + 0.002165850235 # B[20, 4, 4, 6] Block = 1 Type = In + 0.003458938546 # B[21, 5, 0, 5] Block = 1 Type = In + -0.053507775670 # B[22, 5, 1, 6] Block = 1 Type = In + 0.120989101467 # B[23, 5, 2, 5] Block = 1 Type = In + 0.092637875162 # B[24, 5, 3, 6] Block = 1 Type = In + 0.071459233521 # B[25, 5, 4, 5] Block = 1 Type = In + 0.086291858607 # B[26, 5, 5, 6] Block = 1 Type = In + 0.006749966752 # B[27, 6, 0, 6] Block = 1 Type = In + 0.144917284093 # B[28, 6, 2, 6] Block = 1 Type = In + 0.055178211309 # B[29, 6, 4, 6] Block = 1 Type = In + -0.005619133266 # B[30, 6, 6, 6] Block = 1 Type = In + 0.005430513632 # B[1, 0, 0, 0] Block = 2 Type = In + 0.057269488101 # B[2, 1, 0, 1] Block = 2 Type = In + 0.320412300575 # B[3, 1, 1, 2] Block = 2 Type = In + 0.035481869944 # B[4, 2, 0, 2] Block = 2 Type = In + 0.111076763087 # B[5, 2, 1, 3] Block = 2 Type = In + 0.039770598731 # B[6, 2, 2, 2] Block = 2 Type = In + 0.141315510383 # B[7, 2, 2, 4] Block = 2 Type = In + 0.067792661762 # B[8, 3, 0, 3] Block = 2 Type = In + -0.080858457946 # B[9, 3, 1, 4] Block = 2 Type = In + 0.258942062632 # B[10, 3, 2, 3] Block = 2 Type = In + 0.061756985062 # B[11, 3, 2, 5] Block = 2 Type = In + -0.112424676196 # B[12, 3, 3, 4] Block = 2 Type = In + 0.168376857205 # B[13, 3, 3, 6] Block = 2 Type = In + -0.029743698629 # B[14, 4, 0, 4] Block = 2 Type = In + -0.093967263289 # B[15, 4, 1, 5] Block = 2 Type = In + 0.137229827290 # B[16, 4, 2, 4] Block = 2 Type = In + 0.056897919200 # B[17, 4, 2, 6] Block = 2 Type = In + 0.095137344320 # B[18, 4, 3, 5] Block = 2 Type = In + -0.008598816416 # B[19, 4, 4, 4] Block = 2 Type = In + 0.038890602482 # B[20, 4, 4, 6] Block = 2 Type = In + -0.034624751006 # B[21, 5, 0, 5] Block = 2 Type = In + -0.282625695473 # B[22, 5, 1, 6] Block = 2 Type = In + 0.103089891872 # B[23, 5, 2, 5] Block = 2 Type = In + -0.024380802146 # B[24, 5, 3, 6] Block = 2 Type = In + -0.063847809434 # B[25, 5, 4, 5] Block = 2 Type = In + -0.024896682749 # B[26, 5, 5, 6] Block = 2 Type = In + 0.000464369553 # B[27, 6, 0, 6] Block = 2 Type = In + 0.082229290277 # B[28, 6, 2, 6] Block = 2 Type = In + -0.008875503360 # B[29, 6, 4, 6] Block = 2 Type = In + -0.009039017094 # B[30, 6, 6, 6] Block = 2 Type = In + 0.005430513686 # B[1, 0, 0, 0] Block = 3 Type = In + -0.004352445887 # B[2, 1, 0, 1] Block = 3 Type = In + 0.149882860704 # B[3, 1, 1, 2] Block = 3 Type = In + -0.015528472583 # B[4, 2, 0, 2] Block = 3 Type = In + 0.558662861756 # B[5, 2, 1, 3] Block = 3 Type = In + 0.039770598731 # B[6, 2, 2, 2] Block = 3 Type = In + 0.179060667136 # B[7, 2, 2, 4] Block = 3 Type = In + 0.034759981675 # B[8, 3, 0, 3] Block = 3 Type = In + 0.603083480153 # B[9, 3, 1, 4] Block = 3 Type = In + 0.176946655350 # B[10, 3, 2, 3] Block = 3 Type = In + 0.165639632803 # B[11, 3, 2, 5] Block = 3 Type = In + 0.055627509305 # B[12, 3, 3, 4] Block = 3 Type = In + 0.049782791218 # B[13, 3, 3, 6] Block = 3 Type = In + 0.036078617029 # B[14, 4, 0, 4] Block = 3 Type = In + 0.064493563641 # B[15, 4, 1, 5] Block = 3 Type = In + 0.149250535822 # B[16, 4, 2, 4] Block = 3 Type = In + -0.060208330201 # B[17, 4, 2, 6] Block = 3 Type = In + 0.105119833648 # B[18, 4, 3, 5] Block = 3 Type = In + -0.008598816416 # B[19, 4, 4, 4] Block = 3 Type = In + 0.041210118888 # B[20, 4, 4, 6] Block = 3 Type = In + -0.002705345469 # B[21, 5, 0, 5] Block = 3 Type = In + 0.170191392493 # B[22, 5, 1, 6] Block = 3 Type = In + 0.226897293272 # B[23, 5, 2, 5] Block = 3 Type = In + 0.013009034793 # B[24, 5, 3, 6] Block = 3 Type = In + -0.020734586320 # B[25, 5, 4, 5] Block = 3 Type = In + -0.018139074523 # B[26, 5, 5, 6] Block = 3 Type = In + -0.016001848874 # B[27, 6, 0, 6] Block = 3 Type = In + 0.016663324316 # B[28, 6, 2, 6] Block = 3 Type = In + -0.024245533697 # B[29, 6, 4, 6] Block = 3 Type = In + -0.009039017094 # B[30, 6, 6, 6] Block = 3 Type = In + -0.005654800687 # B[1, 0, 0, 0] Block = 4 Type = In + -0.071064263981 # B[2, 1, 0, 1] Block = 4 Type = In + -0.009868049046 # B[3, 1, 1, 2] Block = 4 Type = In + -0.061297753855 # B[4, 2, 0, 2] Block = 4 Type = In + -0.239682636759 # B[5, 2, 1, 3] Block = 4 Type = In + 0.015954956116 # B[6, 2, 2, 2] Block = 4 Type = In + 0.176005610703 # B[7, 2, 2, 4] Block = 4 Type = In + -0.081125948095 # B[8, 3, 0, 3] Block = 4 Type = In + -0.170847987084 # B[9, 3, 1, 4] Block = 4 Type = In + 0.242239715395 # B[10, 3, 2, 3] Block = 4 Type = In + 0.082507688294 # B[11, 3, 2, 5] Block = 4 Type = In + 0.247785108978 # B[12, 3, 3, 4] Block = 4 Type = In + -0.008194303016 # B[13, 3, 3, 6] Block = 4 Type = In + 0.014786217107 # B[14, 4, 0, 4] Block = 4 Type = In + -0.096877379511 # B[15, 4, 1, 5] Block = 4 Type = In + 0.164908528605 # B[16, 4, 2, 4] Block = 4 Type = In + 0.151575252604 # B[17, 4, 2, 6] Block = 4 Type = In + 0.099757230122 # B[18, 4, 3, 5] Block = 4 Type = In + 0.035047662350 # B[19, 4, 4, 4] Block = 4 Type = In + 0.007150552805 # B[20, 4, 4, 6] Block = 4 Type = In + 0.019198319779 # B[21, 5, 0, 5] Block = 4 Type = In + -0.127113932870 # B[22, 5, 1, 6] Block = 4 Type = In + 0.114478010571 # B[23, 5, 2, 5] Block = 4 Type = In + 0.050915227324 # B[24, 5, 3, 6] Block = 4 Type = In + 0.096853268510 # B[25, 5, 4, 5] Block = 4 Type = In + 0.067894750884 # B[26, 5, 5, 6] Block = 4 Type = In + -0.002405537661 # B[27, 6, 0, 6] Block = 4 Type = In + 0.058549926350 # B[28, 6, 2, 6] Block = 4 Type = In + 0.009481237049 # B[29, 6, 4, 6] Block = 4 Type = In + -0.008649958571 # B[30, 6, 6, 6] Block = 4 Type = In + 0.005430513686 # B[1, 0, 0, 0] Block = 5 Type = In + 0.057269488102 # B[2, 1, 0, 1] Block = 5 Type = In + 0.149882860704 # B[3, 1, 1, 2] Block = 5 Type = In + 0.035481869944 # B[4, 2, 0, 2] Block = 5 Type = In + 0.378916788823 # B[5, 2, 1, 3] Block = 5 Type = In + 0.039770598731 # B[6, 2, 2, 2] Block = 5 Type = In + 0.179060667136 # B[7, 2, 2, 4] Block = 5 Type = In + 0.067792661762 # B[8, 3, 0, 3] Block = 5 Type = In + 0.272613304171 # B[9, 3, 1, 4] Block = 5 Type = In + 0.258942062632 # B[10, 3, 2, 3] Block = 5 Type = In + 0.100130474069 # B[11, 3, 2, 5] Block = 5 Type = In + 0.055627509305 # B[12, 3, 3, 4] Block = 5 Type = In + 0.049782791218 # B[13, 3, 3, 6] Block = 5 Type = In + -0.029743698629 # B[14, 4, 0, 4] Block = 5 Type = In + -0.013420300314 # B[15, 4, 1, 5] Block = 5 Type = In + 0.137229827290 # B[16, 4, 2, 4] Block = 5 Type = In + -0.034447269506 # B[17, 4, 2, 6] Block = 5 Type = In + -0.033847124314 # B[18, 4, 3, 5] Block = 5 Type = In + -0.008598816416 # B[19, 4, 4, 4] Block = 5 Type = In + 0.041210118888 # B[20, 4, 4, 6] Block = 5 Type = In + -0.034624751006 # B[21, 5, 0, 5] Block = 5 Type = In + 0.041662678638 # B[22, 5, 1, 6] Block = 5 Type = In + 0.103089891872 # B[23, 5, 2, 5] Block = 5 Type = In + -0.044572198386 # B[24, 5, 3, 6] Block = 5 Type = In + -0.063847809434 # B[25, 5, 4, 5] Block = 5 Type = In + -0.018139074523 # B[26, 5, 5, 6] Block = 5 Type = In + 0.000464369553 # B[27, 6, 0, 6] Block = 5 Type = In + 0.082229290277 # B[28, 6, 2, 6] Block = 5 Type = In + -0.008875503360 # B[29, 6, 4, 6] Block = 5 Type = In + -0.009039017094 # B[30, 6, 6, 6] Block = 5 Type = In + -0.005654800687 # B[1, 0, 0, 0] Block = 6 Type = In + -0.001217874195 # B[2, 1, 0, 1] Block = 6 Type = In + -0.009868049046 # B[3, 1, 1, 2] Block = 6 Type = In + -0.092827766060 # B[4, 2, 0, 2] Block = 6 Type = In + 0.439274283244 # B[5, 2, 1, 3] Block = 6 Type = In + 0.015954956116 # B[6, 2, 2, 2] Block = 6 Type = In + 0.176005610703 # B[7, 2, 2, 4] Block = 6 Type = In + 0.102468480364 # B[8, 3, 0, 3] Block = 6 Type = In + 0.674122225402 # B[9, 3, 1, 4] Block = 6 Type = In + 0.072529538087 # B[10, 3, 2, 3] Block = 6 Type = In + 0.330711171466 # B[11, 3, 2, 5] Block = 6 Type = In + 0.247785108978 # B[12, 3, 3, 4] Block = 6 Type = In + -0.008194303016 # B[13, 3, 3, 6] Block = 6 Type = In + 0.052250780232 # B[14, 4, 0, 4] Block = 6 Type = In + 0.374231060518 # B[15, 4, 1, 5] Block = 6 Type = In + 0.326667869620 # B[16, 4, 2, 4] Block = 6 Type = In + 0.079031873518 # B[17, 4, 2, 6] Block = 6 Type = In + 0.224004472527 # B[18, 4, 3, 5] Block = 6 Type = In + 0.035047662350 # B[19, 4, 4, 4] Block = 6 Type = In + 0.007150552805 # B[20, 4, 4, 6] Block = 6 Type = In + 0.040682917098 # B[21, 5, 0, 5] Block = 6 Type = In + 0.046855927526 # B[22, 5, 1, 6] Block = 6 Type = In + 0.219695071346 # B[23, 5, 2, 5] Block = 6 Type = In + -0.001426581661 # B[24, 5, 3, 6] Block = 6 Type = In + 0.028514699601 # B[25, 5, 4, 5] Block = 6 Type = In + 0.067894750884 # B[26, 5, 5, 6] Block = 6 Type = In + -0.049888149225 # B[27, 6, 0, 6] Block = 6 Type = In + 0.009259151039 # B[28, 6, 2, 6] Block = 6 Type = In + 0.003868002128 # B[29, 6, 4, 6] Block = 6 Type = In + -0.008649958571 # B[30, 6, 6, 6] Block = 6 Type = In + -0.005654800692 # B[1, 0, 0, 0] Block = 7 Type = In + -0.071064263981 # B[2, 1, 0, 1] Block = 7 Type = In + -0.085085203640 # B[3, 1, 1, 2] Block = 7 Type = In + -0.061297753855 # B[4, 2, 0, 2] Block = 7 Type = In + 0.223668616358 # B[5, 2, 1, 3] Block = 7 Type = In + 0.015954956116 # B[6, 2, 2, 2] Block = 7 Type = In + 0.033706085249 # B[7, 2, 2, 4] Block = 7 Type = In + -0.081125948095 # B[8, 3, 0, 3] Block = 7 Type = In + -0.005054494008 # B[9, 3, 1, 4] Block = 7 Type = In + 0.242239715395 # B[10, 3, 2, 3] Block = 7 Type = In + -0.000886414104 # B[11, 3, 2, 5] Block = 7 Type = In + 0.059178212190 # B[12, 3, 3, 4] Block = 7 Type = In + 0.008498646326 # B[13, 3, 3, 6] Block = 7 Type = In + 0.014786217107 # B[14, 4, 0, 4] Block = 7 Type = In + -0.178665293356 # B[15, 4, 1, 5] Block = 7 Type = In + 0.164908528605 # B[16, 4, 2, 4] Block = 7 Type = In + -0.117717485069 # B[17, 4, 2, 6] Block = 7 Type = In + 0.146739677531 # B[18, 4, 3, 5] Block = 7 Type = In + 0.035047662350 # B[19, 4, 4, 4] Block = 7 Type = In + 0.088770688382 # B[20, 4, 4, 6] Block = 7 Type = In + 0.019198319779 # B[21, 5, 0, 5] Block = 7 Type = In + -0.148162265312 # B[22, 5, 1, 6] Block = 7 Type = In + 0.114478010571 # B[23, 5, 2, 5] Block = 7 Type = In + 0.114731400461 # B[24, 5, 3, 6] Block = 7 Type = In + 0.096853268510 # B[25, 5, 4, 5] Block = 7 Type = In + 0.031183854107 # B[26, 5, 5, 6] Block = 7 Type = In + -0.002405537661 # B[27, 6, 0, 6] Block = 7 Type = In + 0.058549926350 # B[28, 6, 2, 6] Block = 7 Type = In + 0.009481237049 # B[29, 6, 4, 6] Block = 7 Type = In + -0.008649958571 # B[30, 6, 6, 6] Block = 7 Type = In + 0.017733403092 # B[1, 0, 0, 0] Block = 8 Type = In + 0.015168905151 # B[2, 1, 0, 1] Block = 8 Type = In + -0.212358294308 # B[3, 1, 1, 2] Block = 8 Type = In + 0.115608035432 # B[4, 2, 0, 2] Block = 8 Type = In + 0.128621845177 # B[5, 2, 1, 3] Block = 8 Type = In + -0.055682216710 # B[6, 2, 2, 2] Block = 8 Type = In + 0.168986321733 # B[7, 2, 2, 4] Block = 8 Type = In + -0.087186888529 # B[8, 3, 0, 3] Block = 8 Type = In + 0.378810692322 # B[9, 3, 1, 4] Block = 8 Type = In + 0.036128510376 # B[10, 3, 2, 3] Block = 8 Type = In + 0.179888488204 # B[11, 3, 2, 5] Block = 8 Type = In + -0.001405954437 # B[12, 3, 3, 4] Block = 8 Type = In + 0.010551104009 # B[13, 3, 3, 6] Block = 8 Type = In + -0.059381370200 # B[14, 4, 0, 4] Block = 8 Type = In + 0.475432753620 # B[15, 4, 1, 5] Block = 8 Type = In + 0.095868282640 # B[16, 4, 2, 4] Block = 8 Type = In + 0.106524975238 # B[17, 4, 2, 6] Block = 8 Type = In + 0.058941182257 # B[18, 4, 3, 5] Block = 8 Type = In + 0.012512778321 # B[19, 4, 4, 4] Block = 8 Type = In + 0.080549204239 # B[20, 4, 4, 6] Block = 8 Type = In + -0.068536821891 # B[21, 5, 0, 5] Block = 8 Type = In + 0.089459777664 # B[22, 5, 1, 6] Block = 8 Type = In + 0.163187761880 # B[23, 5, 2, 5] Block = 8 Type = In + 0.139719330200 # B[24, 5, 3, 6] Block = 8 Type = In + 0.145095171389 # B[25, 5, 4, 5] Block = 8 Type = In + 0.074157391376 # B[26, 5, 5, 6] Block = 8 Type = In + 0.018646775951 # B[27, 6, 0, 6] Block = 8 Type = In + 0.035882498943 # B[28, 6, 2, 6] Block = 8 Type = In + 0.050420424420 # B[29, 6, 4, 6] Block = 8 Type = In + 0.009994821144 # B[30, 6, 6, 6] Block = 8 Type = In + 0.000000000000 # B[0] Block = 1 Type = P + -0.002987589706 # B[1, 0, 0, 0] Block = 1 Type = P + -0.072158389412 # B[2, 1, 0, 1] Block = 1 Type = P + -0.025322250603 # B[3, 1, 1, 2] Block = 1 Type = P + -0.030241379192 # B[4, 2, 0, 2] Block = 1 Type = P + -0.676287334962 # B[5, 2, 1, 3] Block = 1 Type = P + -0.172216278028 # B[6, 2, 2, 2] Block = 1 Type = P + -0.246535097343 # B[7, 2, 2, 4] Block = 1 Type = P + -0.035782528462 # B[8, 3, 0, 3] Block = 1 Type = P + -0.560641780823 # B[9, 3, 1, 4] Block = 1 Type = P + -0.549579515296 # B[10, 3, 2, 3] Block = 1 Type = P + -0.016920837991 # B[11, 3, 2, 5] Block = 1 Type = P + -0.288447245376 # B[12, 3, 3, 4] Block = 1 Type = P + 0.069076859372 # B[13, 3, 3, 6] Block = 1 Type = P + -0.052298717507 # B[14, 4, 0, 4] Block = 1 Type = P + -0.434250953671 # B[15, 4, 1, 5] Block = 1 Type = P + -0.322043860507 # B[16, 4, 2, 4] Block = 1 Type = P + -0.096837010372 # B[17, 4, 2, 6] Block = 1 Type = P + -0.213169352789 # B[18, 4, 3, 5] Block = 1 Type = P + -0.019566740546 # B[19, 4, 4, 4] Block = 1 Type = P + -0.029415128740 # B[20, 4, 4, 6] Block = 1 Type = P + -0.036591077655 # B[21, 5, 0, 5] Block = 1 Type = P + -0.300384511072 # B[22, 5, 1, 6] Block = 1 Type = P + -0.111126537447 # B[23, 5, 2, 5] Block = 1 Type = P + -0.000209831053 # B[24, 5, 3, 6] Block = 1 Type = P + -0.000023632674 # B[25, 5, 4, 5] Block = 1 Type = P + 0.009497323905 # B[26, 5, 5, 6] Block = 1 Type = P + -0.042287705828 # B[27, 6, 0, 6] Block = 1 Type = P + -0.113311457350 # B[28, 6, 2, 6] Block = 1 Type = P + 0.029574563913 # B[29, 6, 4, 6] Block = 1 Type = P + -0.027748295426 # B[30, 6, 6, 6] Block = 1 Type = P + -0.001747658243 # B[1, 0, 0, 0] Block = 2 Type = P + -0.026182047943 # B[2, 1, 0, 1] Block = 2 Type = P + 0.089481157533 # B[3, 1, 1, 2] Block = 2 Type = P + -0.076525139004 # B[4, 2, 0, 2] Block = 2 Type = P + -0.107925591359 # B[5, 2, 1, 3] Block = 2 Type = P + -0.059117110271 # B[6, 2, 2, 2] Block = 2 Type = P + -0.256324252168 # B[7, 2, 2, 4] Block = 2 Type = P + -0.020755324452 # B[8, 3, 0, 3] Block = 2 Type = P + -0.337284108142 # B[9, 3, 1, 4] Block = 2 Type = P + -0.073956723908 # B[10, 3, 2, 3] Block = 2 Type = P + -0.149119927857 # B[11, 3, 2, 5] Block = 2 Type = P + 0.047627781519 # B[12, 3, 3, 4] Block = 2 Type = P + 0.061394929126 # B[13, 3, 3, 6] Block = 2 Type = P + -0.082660360252 # B[14, 4, 0, 4] Block = 2 Type = P + -0.183225932285 # B[15, 4, 1, 5] Block = 2 Type = P + -0.046981555049 # B[16, 4, 2, 4] Block = 2 Type = P + -0.046846685850 # B[17, 4, 2, 6] Block = 2 Type = P + -0.014388943769 # B[18, 4, 3, 5] Block = 2 Type = P + 0.012133725790 # B[19, 4, 4, 4] Block = 2 Type = P + 0.085321452425 # B[20, 4, 4, 6] Block = 2 Type = P + -0.034945525448 # B[21, 5, 0, 5] Block = 2 Type = P + -0.028326642109 # B[22, 5, 1, 6] Block = 2 Type = P + -0.085701075837 # B[23, 5, 2, 5] Block = 2 Type = P + 0.108257997015 # B[24, 5, 3, 6] Block = 2 Type = P + 0.045837409910 # B[25, 5, 4, 5] Block = 2 Type = P + -0.014180512722 # B[26, 5, 5, 6] Block = 2 Type = P + 0.010756044042 # B[27, 6, 0, 6] Block = 2 Type = P + 0.023429477590 # B[28, 6, 2, 6] Block = 2 Type = P + -0.007794133717 # B[29, 6, 4, 6] Block = 2 Type = P + 0.002019828318 # B[30, 6, 6, 6] Block = 2 Type = P + -0.001747658242 # B[1, 0, 0, 0] Block = 3 Type = P + 0.047070626642 # B[2, 1, 0, 1] Block = 3 Type = P + -0.126595340298 # B[3, 1, 1, 2] Block = 3 Type = P + 0.022286899829 # B[4, 2, 0, 2] Block = 3 Type = P + -0.483695340547 # B[5, 2, 1, 3] Block = 3 Type = P + -0.059117110271 # B[6, 2, 2, 2] Block = 3 Type = P + -0.067694089340 # B[7, 2, 2, 4] Block = 3 Type = P + 0.034974727122 # B[8, 3, 0, 3] Block = 3 Type = P + -0.226290583408 # B[9, 3, 1, 4] Block = 3 Type = P + -0.184699579267 # B[10, 3, 2, 3] Block = 3 Type = P + 0.063122270285 # B[11, 3, 2, 5] Block = 3 Type = P + 0.041271206739 # B[12, 3, 3, 4] Block = 3 Type = P + -0.004229157928 # B[13, 3, 3, 6] Block = 3 Type = P + 0.050689134214 # B[14, 4, 0, 4] Block = 3 Type = P + -0.138276744014 # B[15, 4, 1, 5] Block = 3 Type = P + 0.097985494164 # B[16, 4, 2, 4] Block = 3 Type = P + -0.083537235645 # B[17, 4, 2, 6] Block = 3 Type = P + 0.098390585361 # B[18, 4, 3, 5] Block = 3 Type = P + 0.012133725790 # B[19, 4, 4, 4] Block = 3 Type = P + -0.038067814334 # B[20, 4, 4, 6] Block = 3 Type = P + 0.029636266108 # B[21, 5, 0, 5] Block = 3 Type = P + -0.157117938354 # B[22, 5, 1, 6] Block = 3 Type = P + -0.027712542047 # B[23, 5, 2, 5] Block = 3 Type = P + 0.084730212710 # B[24, 5, 3, 6] Block = 3 Type = P + 0.023437407693 # B[25, 5, 4, 5] Block = 3 Type = P + 0.017747856995 # B[26, 5, 5, 6] Block = 3 Type = P + 0.050161344183 # B[27, 6, 0, 6] Block = 3 Type = P + -0.098577816149 # B[28, 6, 2, 6] Block = 3 Type = P + -0.046997533090 # B[29, 6, 4, 6] Block = 3 Type = P + 0.002019828318 # B[30, 6, 6, 6] Block = 3 Type = P + -0.003152987881 # B[1, 0, 0, 0] Block = 4 Type = P + 0.014621850469 # B[2, 1, 0, 1] Block = 4 Type = P + 0.098860641022 # B[3, 1, 1, 2] Block = 4 Type = P + 0.069546644549 # B[4, 2, 0, 2] Block = 4 Type = P + 0.180804700658 # B[5, 2, 1, 3] Block = 4 Type = P + 0.034244852922 # B[6, 2, 2, 2] Block = 4 Type = P + 0.044579888557 # B[7, 2, 2, 4] Block = 4 Type = P + 0.001526239292 # B[8, 3, 0, 3] Block = 4 Type = P + 0.203861850923 # B[9, 3, 1, 4] Block = 4 Type = P + 0.021679218740 # B[10, 3, 2, 3] Block = 4 Type = P + 0.185899872703 # B[11, 3, 2, 5] Block = 4 Type = P + -0.063472862380 # B[12, 3, 3, 4] Block = 4 Type = P + -0.015662648111 # B[13, 3, 3, 6] Block = 4 Type = P + 0.076209869795 # B[14, 4, 0, 4] Block = 4 Type = P + -0.050213789331 # B[15, 4, 1, 5] Block = 4 Type = P + 0.038175316256 # B[16, 4, 2, 4] Block = 4 Type = P + 0.041946424186 # B[17, 4, 2, 6] Block = 4 Type = P + -0.023902281235 # B[18, 4, 3, 5] Block = 4 Type = P + 0.008537822812 # B[19, 4, 4, 4] Block = 4 Type = P + 0.039989757491 # B[20, 4, 4, 6] Block = 4 Type = P + 0.022210126714 # B[21, 5, 0, 5] Block = 4 Type = P + 0.010855258243 # B[22, 5, 1, 6] Block = 4 Type = P + 0.021570527219 # B[23, 5, 2, 5] Block = 4 Type = P + -0.119983534986 # B[24, 5, 3, 6] Block = 4 Type = P + -0.019726935513 # B[25, 5, 4, 5] Block = 4 Type = P + -0.015720476443 # B[26, 5, 5, 6] Block = 4 Type = P + -0.024522109113 # B[27, 6, 0, 6] Block = 4 Type = P + -0.051478859538 # B[28, 6, 2, 6] Block = 4 Type = P + 0.017216285614 # B[29, 6, 4, 6] Block = 4 Type = P + -0.003565797401 # B[30, 6, 6, 6] Block = 4 Type = P + -0.001747658242 # B[1, 0, 0, 0] Block = 5 Type = P + -0.026182047943 # B[2, 1, 0, 1] Block = 5 Type = P + -0.126595340298 # B[3, 1, 1, 2] Block = 5 Type = P + -0.076525139004 # B[4, 2, 0, 2] Block = 5 Type = P + -0.157814129312 # B[5, 2, 1, 3] Block = 5 Type = P + -0.059117110271 # B[6, 2, 2, 2] Block = 5 Type = P + -0.067694089340 # B[7, 2, 2, 4] Block = 5 Type = P + -0.020755324452 # B[8, 3, 0, 3] Block = 5 Type = P + -0.216746420586 # B[9, 3, 1, 4] Block = 5 Type = P + -0.073956723908 # B[10, 3, 2, 3] Block = 5 Type = P + -0.263593571569 # B[11, 3, 2, 5] Block = 5 Type = P + 0.041271206739 # B[12, 3, 3, 4] Block = 5 Type = P + -0.004229157928 # B[13, 3, 3, 6] Block = 5 Type = P + -0.082660360252 # B[14, 4, 0, 4] Block = 5 Type = P + -0.305032662779 # B[15, 4, 1, 5] Block = 5 Type = P + -0.046981555049 # B[16, 4, 2, 4] Block = 5 Type = P + -0.187955078269 # B[17, 4, 2, 6] Block = 5 Type = P + -0.121808447372 # B[18, 4, 3, 5] Block = 5 Type = P + 0.012133725790 # B[19, 4, 4, 4] Block = 5 Type = P + -0.038067814334 # B[20, 4, 4, 6] Block = 5 Type = P + -0.034945525448 # B[21, 5, 0, 5] Block = 5 Type = P + -0.226555787648 # B[22, 5, 1, 6] Block = 5 Type = P + -0.085701075837 # B[23, 5, 2, 5] Block = 5 Type = P + -0.121081797087 # B[24, 5, 3, 6] Block = 5 Type = P + 0.045837409910 # B[25, 5, 4, 5] Block = 5 Type = P + 0.017747856995 # B[26, 5, 5, 6] Block = 5 Type = P + 0.010756044042 # B[27, 6, 0, 6] Block = 5 Type = P + 0.023429477590 # B[28, 6, 2, 6] Block = 5 Type = P + -0.007794133717 # B[29, 6, 4, 6] Block = 5 Type = P + 0.002019828318 # B[30, 6, 6, 6] Block = 5 Type = P + -0.003152987881 # B[1, 0, 0, 0] Block = 6 Type = P + -0.003431824919 # B[2, 1, 0, 1] Block = 6 Type = P + 0.098860641022 # B[3, 1, 1, 2] Block = 6 Type = P + -0.049867192647 # B[4, 2, 0, 2] Block = 6 Type = P + 0.130247785083 # B[5, 2, 1, 3] Block = 6 Type = P + 0.034244852922 # B[6, 2, 2, 2] Block = 6 Type = P + 0.044579888557 # B[7, 2, 2, 4] Block = 6 Type = P + 0.051064338359 # B[8, 3, 0, 3] Block = 6 Type = P + -0.034769100897 # B[9, 3, 1, 4] Block = 6 Type = P + -0.055923569507 # B[10, 3, 2, 3] Block = 6 Type = P + 0.101065442824 # B[11, 3, 2, 5] Block = 6 Type = P + -0.063472862380 # B[12, 3, 3, 4] Block = 6 Type = P + -0.015662648111 # B[13, 3, 3, 6] Block = 6 Type = P + -0.020942037301 # B[14, 4, 0, 4] Block = 6 Type = P + 0.057686438719 # B[15, 4, 1, 5] Block = 6 Type = P + 0.061281723131 # B[16, 4, 2, 4] Block = 6 Type = P + 0.041003214284 # B[17, 4, 2, 6] Block = 6 Type = P + 0.104968889582 # B[18, 4, 3, 5] Block = 6 Type = P + 0.008537822812 # B[19, 4, 4, 4] Block = 6 Type = P + 0.039989757491 # B[20, 4, 4, 6] Block = 6 Type = P + 0.058310887739 # B[21, 5, 0, 5] Block = 6 Type = P + 0.043642228702 # B[22, 5, 1, 6] Block = 6 Type = P + 0.119827018636 # B[23, 5, 2, 5] Block = 6 Type = P + -0.017878741482 # B[24, 5, 3, 6] Block = 6 Type = P + 0.013615249763 # B[25, 5, 4, 5] Block = 6 Type = P + -0.015720476443 # B[26, 5, 5, 6] Block = 6 Type = P + 0.028210503571 # B[27, 6, 0, 6] Block = 6 Type = P + 0.138982983531 # B[28, 6, 2, 6] Block = 6 Type = P + 0.020848948259 # B[29, 6, 4, 6] Block = 6 Type = P + -0.003565797401 # B[30, 6, 6, 6] Block = 6 Type = P + -0.003152987876 # B[1, 0, 0, 0] Block = 7 Type = P + 0.014621850469 # B[2, 1, 0, 1] Block = 7 Type = P + 0.136917412546 # B[3, 1, 1, 2] Block = 7 Type = P + 0.069546644549 # B[4, 2, 0, 2] Block = 7 Type = P + 0.134471034367 # B[5, 2, 1, 3] Block = 7 Type = P + 0.034244852922 # B[6, 2, 2, 2] Block = 7 Type = P + 0.073714102880 # B[7, 2, 2, 4] Block = 7 Type = P + 0.001526239292 # B[8, 3, 0, 3] Block = 7 Type = P + 0.029314077312 # B[9, 3, 1, 4] Block = 7 Type = P + 0.021679218740 # B[10, 3, 2, 3] Block = 7 Type = P + 0.005384023182 # B[11, 3, 2, 5] Block = 7 Type = P + 0.029912954139 # B[12, 3, 3, 4] Block = 7 Type = P + 0.036308629380 # B[13, 3, 3, 6] Block = 7 Type = P + 0.076209869795 # B[14, 4, 0, 4] Block = 7 Type = P + -0.095659211777 # B[15, 4, 1, 5] Block = 7 Type = P + 0.038175316256 # B[16, 4, 2, 4] Block = 7 Type = P + -0.054559433157 # B[17, 4, 2, 6] Block = 7 Type = P + -0.079205893849 # B[18, 4, 3, 5] Block = 7 Type = P + 0.008537822812 # B[19, 4, 4, 4] Block = 7 Type = P + 0.072688459278 # B[20, 4, 4, 6] Block = 7 Type = P + 0.022210126714 # B[21, 5, 0, 5] Block = 7 Type = P + 0.032318678024 # B[22, 5, 1, 6] Block = 7 Type = P + 0.021570527219 # B[23, 5, 2, 5] Block = 7 Type = P + 0.038881258714 # B[24, 5, 3, 6] Block = 7 Type = P + -0.019726935513 # B[25, 5, 4, 5] Block = 7 Type = P + 0.030961312127 # B[26, 5, 5, 6] Block = 7 Type = P + -0.024522109113 # B[27, 6, 0, 6] Block = 7 Type = P + -0.051478859538 # B[28, 6, 2, 6] Block = 7 Type = P + 0.017216285614 # B[29, 6, 4, 6] Block = 7 Type = P + -0.003565797401 # B[30, 6, 6, 6] Block = 7 Type = P + 0.000279543258 # B[1, 0, 0, 0] Block = 8 Type = P + 0.031561006068 # B[2, 1, 0, 1] Block = 8 Type = P + 0.164297477481 # B[3, 1, 1, 2] Block = 8 Type = P + 0.020394103829 # B[4, 2, 0, 2] Block = 8 Type = P + -0.136924810031 # B[5, 2, 1, 3] Block = 8 Type = P + 0.011488762740 # B[6, 2, 2, 2] Block = 8 Type = P + -0.174577132596 # B[7, 2, 2, 4] Block = 8 Type = P + -0.104272988787 # B[8, 3, 0, 3] Block = 8 Type = P + -0.126737159959 # B[9, 3, 1, 4] Block = 8 Type = P + 0.006355291540 # B[10, 3, 2, 3] Block = 8 Type = P + -0.116847920709 # B[11, 3, 2, 5] Block = 8 Type = P + 0.093716628094 # B[12, 3, 3, 4] Block = 8 Type = P + -0.015327516258 # B[13, 3, 3, 6] Block = 8 Type = P + -0.015071645969 # B[14, 4, 0, 4] Block = 8 Type = P + 0.054380965184 # B[15, 4, 1, 5] Block = 8 Type = P + 0.113826098444 # B[16, 4, 2, 4] Block = 8 Type = P + 0.012970945123 # B[17, 4, 2, 6] Block = 8 Type = P + -0.047881183904 # B[18, 4, 3, 5] Block = 8 Type = P + -0.010520024430 # B[19, 4, 4, 4] Block = 8 Type = P + -0.077321883428 # B[20, 4, 4, 6] Block = 8 Type = P + -0.087378280220 # B[21, 5, 0, 5] Block = 8 Type = P + -0.221370705680 # B[22, 5, 1, 6] Block = 8 Type = P + 0.004554405520 # B[23, 5, 2, 5] Block = 8 Type = P + -0.164836672985 # B[24, 5, 3, 6] Block = 8 Type = P + -0.015080843808 # B[25, 5, 4, 5] Block = 8 Type = P + -0.010907038616 # B[26, 5, 5, 6] Block = 8 Type = P + -0.022228801431 # B[27, 6, 0, 6] Block = 8 Type = P + -0.055154587470 # B[28, 6, 2, 6] Block = 8 Type = P + 0.007347917376 # B[29, 6, 4, 6] Block = 8 Type = P + -0.009369956559 # B[30, 6, 6, 6] Block = 8 Type = P diff --git a/potentials/Ta06A.mliap b/potentials/Ta06A.mliap new file mode 100644 index 0000000000..21d3bab6e3 --- /dev/null +++ b/potentials/Ta06A.mliap @@ -0,0 +1,17 @@ +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# Definition of SNAP potential Ta_Cand06A +# Assumes 1 LAMMPS atom type + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 + +# Specify hybrid with SNAP, ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff * * mliap Ta + diff --git a/potentials/Ta06A.mliap.descriptor b/potentials/Ta06A.mliap.descriptor new file mode 100644 index 0000000000..481ebf7e44 --- /dev/null +++ b/potentials/Ta06A.mliap.descriptor @@ -0,0 +1,21 @@ +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# LAMMPS SNAP parameters for Ta_Cand06A + +# required +rcutfac 4.67637 +twojmax 6 + +# elements + +nelems 1 +elems Ta +radelems 0.5 +welems 1 + +# optional + +rfac0 0.99363 +rmin0 0 +bzeroflag 0 + diff --git a/potentials/Ta06A.mliap.model b/potentials/Ta06A.mliap.model new file mode 100644 index 0000000000..a7e36f1648 --- /dev/null +++ b/potentials/Ta06A.mliap.model @@ -0,0 +1,37 @@ +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# LAMMPS SNAP coefficients for Ta_Cand06A + +# nelements ncoeff +1 31 +-2.92477 +-0.01137 +-0.00775 +-0.04907 +-0.15047 +0.09157 +0.05590 +0.05785 +-0.11615 +-0.17122 +-0.10583 +0.03941 +-0.11284 +0.03939 +-0.07331 +-0.06582 +-0.09341 +-0.10587 +-0.15497 +0.04820 +0.00205 +0.00060 +-0.04898 +-0.05084 +-0.03371 +-0.01441 +-0.01501 +-0.00599 +-0.06373 +0.03965 +0.01072 diff --git a/potentials/W.quadratic.mliap b/potentials/W.quadratic.mliap new file mode 100644 index 0000000000..36cb352f84 --- /dev/null +++ b/potentials/W.quadratic.mliap @@ -0,0 +1,15 @@ +# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none + +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 74 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +mliap model quadratic W.quadratic.mliap.model descriptor sna W.quadratic.mliap.descriptor +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff * * mliap W + diff --git a/potentials/W.quadratic.mliap.descriptor b/potentials/W.quadratic.mliap.descriptor new file mode 100644 index 0000000000..7db38ba7f5 --- /dev/null +++ b/potentials/W.quadratic.mliap.descriptor @@ -0,0 +1,20 @@ +# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none + +# required + +rcutfac 4.73442 +twojmax 6 + +# elements + +nelems 1 +elems W +radelems 0.5 +welems 1 + +# optional + +rfac0 0.99363 +rmin0 0 +bzeroflag 1 + diff --git a/potentials/W.quadratic.mliap.model b/potentials/W.quadratic.mliap.model new file mode 100644 index 0000000000..d16b535fb9 --- /dev/null +++ b/potentials/W.quadratic.mliap.model @@ -0,0 +1,502 @@ +# DATE: 2020-06-21 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: none + +# LAMMPS SNAP coefficients for Quadratic W + +# nelements ncoeff +1 496 + 0.000000000000 + -0.000019342340 + 0.000039964908 + -0.000450771142 + -0.000233498664 + -0.000519872659 + -0.000089734174 + -0.000106353291 + -0.000035475344 + -0.000254116041 + -0.000520021242 + 0.000065038801 + -0.000304498225 + -0.000032230341 + -0.000007420702 + -0.000159369530 + -0.000144907916 + 0.000078858361 + -0.000238070583 + -0.000050556167 + -0.000008662153 + 0.000017439967 + -0.000028764863 + 0.000022504717 + 0.000001821340 + -0.000089967846 + -0.000106392838 + 0.000013771852 + 0.000070228097 + -0.000024152909 + -0.000006036274 +-4.2551325e-05 +0.0001982986695 +5.4994526e-05 +0.0001760061375 +0.0005287969295 +-0.00045677476 +-0.007136016296 +0.0003868434375 +-0.0006071085215 +-0.000554512177 +-0.0006596292555 +-0.0007585367005 +7.62333015e-05 +0.0002137614635 +0.000379897335 +0.0005441952125 +0.000128413515 +5.74706545e-05 +0.0002303380555 +-0.0005759952885 +-0.0001530888095 +-0.0001614394285 +-3.80386335e-05 +-0.0006390699265 +-2.44191e-05 +-0.000627990564 +-0.000199645294 +-3.63524105e-05 +-0.0004350939225 +-0.000230192872 +-0.000456462716 +-0.00096561205 +-0.0016793622125 +0.008264605054 +0.005768043843 +0.0259523273965 +0.002379667484 +0.001798185681 +0.001411261095 +0.0046629902735 +-0.001249069583 +-0.003518728846 +-0.00152218625 +-0.0005803019955 +-0.002443813614 +0.003302653151 +-0.0035163183225 +0.005378221661 +-0.0005157550285 +0.0005802384085 +-8.4625189e-05 +-0.0003100449505 +0.0016035457395 +-0.006841896086 +0.00327970803 +0.000517873278 +0.000462624598 +0.001556398782 +0.000629663951 +0.004036847861 +0.000410623118 +0.0033671740175 +0.0060744662315 +0.0460285453095 +0.0106979441315 +0.006457375952 +-0.0043000712405 +-0.0196789547465 +-0.009589713549 +-0.0152983426785 +0.003041488452 +-0.0032366707575 +-0.0119067345335 +0.0049313311815 +-0.0030034838505 +8.7700383e-05 +0.0007061505055 +0.0097234329625 +0.007217090323 +0.000235882459 +-0.0033595857445 +-0.0168665065145 +0.017786509719 +0.001877013067 +0.0006351836775 +0.004600906728 +0.012509628713 +-0.003427408333 +-0.0014640751665 +-0.003888408385 +-0.0062058291515 +-0.001642104699 +-0.00105774282 +-0.0059780195505 +-0.001753939287 +0.000479345105 +-0.0019904699045 +4.98541965e-05 +-0.0041212491675 +-0.0042906641465 +-0.002351418317 +-0.0106697325275 +-0.000648222198 +-0.002286882867 +-0.000626754824 +-0.00073748291 +0.0016922435575 +0.0037496719655 +0.004656851048 +-0.0002176673305 +-0.0006739876965 +-0.0006208869175 +7.61738615e-05 +0.0019258401385 +0.005690172208 +0.007318906809 +-0.035200169396 +0.009167226287 +-0.000404285392 +-0.00348855982 +-0.0024229238155 +0.0022336200925 +-0.012584737991 +0.0016262069595 +0.0048016592015 +0.0004657340115 +0.0025051890895 +-0.0104101829395 +0.016176490711 +-0.0094539511845 +-0.002289487018 +-0.0002052188655 +-0.007085549731 +0.02162608233 +-0.002238154953 +0.0190676087705 +0.0002139442795 +0.0010403767345 +0.003360683249 +0.003153376576 +-0.001249764819 +-0.068537163077 +0.0023354667295 +0.001767860664 +-0.0033006265215 +0.0146223252485 +-0.003180595809 +0.0069092040305 +0.0010583439885 +-0.003447267898 +-0.001106713702 +0.00523272471 +-0.010758599437 +-0.001822397317 +0.018487732527 +-0.0024400507145 +-0.007514714512 +-0.003947742615 +0.012413627732 +0.003092235017 +0.018069399047 +-0.0035369320715 +0.0011168541665 +-0.0014980962775 +-1.2944254e-05 +-0.041955689351 +0.0023033776335 +-0.040725631204 +-0.0693632023935 +0.020674975135 +-0.0341006922645 +-0.006059344895 +0.002385437006 +-0.004177512167 +-0.0146544701995 +-0.0008310261785 +-0.010934674355 +0.006492824537 +-0.014812643723 +0.004033748718 +-0.004155996547 +-0.013113411806 +-0.0088014221285 +0.0037541341 +-0.000805304258 +0.006318190602 +0.012552958042 +0.004200553135 +-0.00681355806 +-0.001852228976 +0.0017381476065 +-0.002643779529 +0.0049358851655 +0.001522146164 +0.002260955858 +-0.000839707664 +0.0008487292955 +0.002671028789 +-0.000193952538 +0.003111368392 +0.0007482047125 +0.0020401970905 +0.000530116057 +-0.0022777656015 +-0.0045238154695 +0.0018290760485 +-0.0003309336725 +0.00293571563 +0.000172269209 +0.001414752092 +0.0005614625055 +0.000441310903 +-0.002473120026 +-0.015420836338 +-0.0058494470115 +-0.013440044608 +-0.009774364656 +-0.0019064948385 +-1.70476245e-05 +0.0049669399345 +-0.0050880033155 +0.001600486319 +-0.0018417989075 +-0.0111031210975 +0.0007780738275 +-0.004930202896 +-0.002537539117 +-0.0090246084865 +-0.002694202287 +-0.0062002945005 +0.0031924710865 +0.0021120090085 +-0.003067483203 +-0.0002847253785 +-0.016407568729 +-0.0012875748665 +-0.0136223073595 +-0.00152438356 +0.0012803681485 +-0.002216406572 +-0.001518786423 +-0.004453055438 +-0.0078894618465 +0.001421143537 +-0.0050288776725 +0.001199592632 +-0.002661588749 +-0.004357715347 +0.009525078378 +0.0026286979515 +0.0043289788665 +0.0004994005155 +0.003791227565 +0.0004056536255 +0.0033347889035 +-0.000464347336 +-0.0069517390965 +-0.0079588750315 +-0.004154738239 +0.006620101338 +0.008608842617 +0.0056131740625 +0.0011860229985 +0.007580086232 +0.003260306951 +0.000979553031 +-0.0044626742655 +-0.005235925737 +-0.0161268610495 +-0.0069229581565 +0.003724916317 +0.0023613845 +0.0013633397005 +0.001433661889 +-0.0009859245845 +-0.019516619562 +-0.0051345232355 +-0.0003792145305 +-0.009160883563 +-0.0052408213305 +-0.000837343292 +-0.010077898583 +-0.000297970588 +-0.000858261403 +-0.0001092992995 +-0.002443805024 +-0.0025107490965 +-0.0062944996435 +0.0026546548665 +0.0006955853785 +0.000103592795 +0.000708964143 +0.0019193670325 +-0.0001578612265 +-0.005585721575 +-0.000421551186 +0.0022745774245 +-0.004927140737 +0.0004199419505 +-0.0037407737345 +0.002130170551 +-0.0030979189135 +-0.0019395201255 +0.0067944948975 +-0.000359694345 +-0.0002144026575 +0.0025529098515 +0.0001917158465 +-0.000540725939 +0.001239653721 +0.00159659403 +-5.5652017e-05 +4.5092483e-05 +0.002495602056 +-0.0035351180395 +0.0009665743545 +-0.0023236857675 +-0.0014564171785 +-0.0008165505935 +-0.000118027852 +0.002536872662 +0.0009829535115 +0.0019442113705 +0.000664158062 +0.000326715061 +0.00019900621 +0.0004767582395 +0.000900303081 +-2.91049685e-05 +-0.004411179905 +-0.004064521081 +0.00692497271 +-0.005195674108 +-0.006544598492 +0.0029896960935 +0.000425073164 +-8.0017505e-05 +0.000846844414 +0.003287511416 +-0.009662064447 +0.0014047560985 +-0.0008689313915 +0.0009517570465 +0.000152017235 +1.6514158e-05 +0.00066355894 +0.0067775973265 +0.0021844858475 +0.0056757292145 +0.0054950676515 +0.0002498690125 +-0.006315915302 +-0.0059966827865 +-0.0034483171305 +0.0073702392255 +0.007591193081 +0.0004062066825 +0.000913827769 +0.000622164767 +0.0002438011115 +0.01119218957 +0.010457943327 +-0.002352405766 +-0.000761350789 +0.000146360756 +-0.00052151391 +-0.001421163661 +-0.0098259784665 +-0.001387664408 +-0.0010876399735 +0.000794093996 +0.003036965154 +-0.0017118732635 +-0.0015837318195 +-0.006679253783 +0.000882488727 +0.0093074758655 +0.0013319314085 +-0.011547004122 +-0.003864301947 +-0.007112747006 +-0.00330951085 +-0.0007122545915 +-0.001201815256 +0.0041789351005 +-0.0001805522685 +-0.0007465084205 +0.008838667361 +0.0048153576585 +-9.8403371e-05 +-0.010102205467 +-0.0090783851625 +-0.0014465915755 +0.0056402904815 +0.004713889865 +-0.000958685828 +0.002844420936 +0.000886932857 +0.0002483938575 +0.000144967791 +-0.0012477036845 +0.004783753466 +-0.0076604636325 +0.00091901227 +0.0010552043375 +0.0013117699705 +-0.000302204736 +0.002096120671 +-0.0002417090715 +0.0008896279815 +8.3058685e-05 +0.002360101467 +0.003364314747 +0.0008746445705 +-0.0011215585125 +-0.0003387424825 +0.0005632970265 +-0.0006617281215 +0.0003733063965 +0.0002623090815 +0.004593469114 +0.0040372304995 +-0.001688451935 +-0.003686908717 +-0.004326202128 +-0.000870929915 +-0.0001854711995 +0.0002189774835 +0.00071865135 +0.007416398218 +0.0020460979 +-0.008020256566 +-0.016722806328 +0.001376213073 +0.000347513599 +0.0016684763755 +-0.000874786219 +0.001891181919 +-0.000534904311 +0.000846430852 +-0.000641433051 +0.0007377551475 +0.001358126396 +-0.000866748663 +0.011124487718 +0.005228666165 +-0.001490438881 +-0.0008813532175 +-0.0001303988565 +0.0007163794045 +0.004674505138 +-0.000722641184 +-0.002023585289 +0.001547283689 +0.000753938405 +0.000470918236 +-0.0003316097225 +-0.0002293860925 +6.90841455e-05 +-0.001301344263 +-0.0004029179255 +6.69084325e-05 +-0.000142497889 +0.0002207077485 +-0.000201523756 diff --git a/potentials/WBe_Wood_PRB2019.mliap b/potentials/WBe_Wood_PRB2019.mliap new file mode 100644 index 0000000000..9298bf8fdf --- /dev/null +++ b/potentials/WBe_Wood_PRB2019.mliap @@ -0,0 +1,16 @@ +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) +# Definition of SNAP+ZBL potential. +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz1 equal 74 +variable zblz2 equal 4 + +# Specify hybrid with SNAP and ZBL + +pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} & +mliap model linear WBe_Wood_PRB2019.mliap.model descriptor sna WBe_Wood_PRB2019.mliap.descriptor +pair_coeff 1 1 zbl ${zblz1} ${zblz1} +pair_coeff 1 2 zbl ${zblz1} ${zblz2} +pair_coeff 2 2 zbl ${zblz2} ${zblz2} +pair_coeff * * mliap W Be + diff --git a/potentials/WBe_Wood_PRB2019.mliap.descriptor b/potentials/WBe_Wood_PRB2019.mliap.descriptor new file mode 100644 index 0000000000..0ba762fcfa --- /dev/null +++ b/potentials/WBe_Wood_PRB2019.mliap.descriptor @@ -0,0 +1,20 @@ +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) + +# required + +rcutfac 4.8123 +twojmax 8 + +# elements + +nelems 2 +elems W Be +radelems 0.5 0.417932 +welems 1 0.959049 + +# optional + +rfac0 0.99363 +rmin0 0 +bzeroflag 1 + diff --git a/potentials/WBe_Wood_PRB2019.mliap.model b/potentials/WBe_Wood_PRB2019.mliap.model new file mode 100644 index 0000000000..b25398e91a --- /dev/null +++ b/potentials/WBe_Wood_PRB2019.mliap.model @@ -0,0 +1,117 @@ +# DATE: 2019-09-18 UNITS: metal CONTRIBUTOR: Mary Alice Cusentino mcusent@sandia.gov CITATION: M.A. Wood, M.A. Cusentino, B.D. Wirth, and A.P. Thompson, "Data-driven material models for atomistic simulation", Physical Review B 99, 184305 (2019) +# LAMMPS SNAP coefficients for WBe + +# nelements ncoeff +2 56 + -0.000000000000 # B[0] + -0.001487061994 # B[1, 0, 0, 0] + 0.075808306870 # B[2, 1, 0, 1] + 0.538735683870 # B[3, 1, 1, 2] + -0.074148039366 # B[4, 2, 0, 2] + 0.602629813770 # B[5, 2, 1, 3] + -0.147022424344 # B[6, 2, 2, 2] + 0.117756828488 # B[7, 2, 2, 4] + -0.026490439049 # B[8, 3, 0, 3] + -0.035162708767 # B[9, 3, 1, 4] + 0.064315385091 # B[10, 3, 2, 3] + -0.131936948089 # B[11, 3, 2, 5] + -0.021272860272 # B[12, 3, 3, 4] + -0.091171134054 # B[13, 3, 3, 6] + -0.024396224398 # B[14, 4, 0, 4] + -0.059813132803 # B[15, 4, 1, 5] + 0.069585393203 # B[16, 4, 2, 4] + -0.085344044181 # B[17, 4, 2, 6] + -0.155425254597 # B[18, 4, 3, 5] + -0.117031758367 # B[19, 4, 3, 7] + -0.040956258020 # B[20, 4, 4, 4] + -0.084465000389 # B[21, 4, 4, 6] + -0.020367513630 # B[22, 4, 4, 8] + -0.010730484318 # B[23, 5, 0, 5] + -0.054777575658 # B[24, 5, 1, 6] + 0.050742893747 # B[25, 5, 2, 5] + -0.004686334611 # B[26, 5, 2, 7] + -0.116372907121 # B[27, 5, 3, 6] + 0.005542497708 # B[28, 5, 3, 8] + -0.126526795635 # B[29, 5, 4, 5] + -0.080163926221 # B[30, 5, 4, 7] + -0.082426250179 # B[31, 5, 5, 6] + -0.010558777281 # B[32, 5, 5, 8] + -0.001939058038 # B[33, 6, 0, 6] + -0.027907949962 # B[34, 6, 1, 7] + 0.049483908476 # B[35, 6, 2, 6] + 0.005103754385 # B[36, 6, 2, 8] + -0.054751505141 # B[37, 6, 3, 7] + -0.055556071011 # B[38, 6, 4, 6] + -0.006026917619 # B[39, 6, 4, 8] + -0.060889030109 # B[40, 6, 5, 7] + -0.029977673973 # B[41, 6, 6, 6] + -0.014987527280 # B[42, 6, 6, 8] + -0.006697686658 # B[43, 7, 0, 7] + 0.017369624409 # B[44, 7, 1, 8] + 0.047864358817 # B[45, 7, 2, 7] + -0.001989812679 # B[46, 7, 3, 8] + 0.000153530925 # B[47, 7, 4, 7] + -0.003862356345 # B[48, 7, 5, 8] + -0.009754314198 # B[49, 7, 6, 7] + 0.000777958970 # B[50, 7, 7, 8] + -0.003031424287 # B[51, 8, 0, 8] + 0.015612715209 # B[52, 8, 2, 8] + 0.003210129646 # B[53, 8, 4, 8] + -0.013088799947 # B[54, 8, 6, 8] + 0.001465970755 # B[55, 8, 8, 8] + 0.000000000000 # B[0] + -0.000112143918 # B[1, 0, 0, 0] + 0.002449805180 # B[2, 1, 0, 1] + 0.189705916830 # B[3, 1, 1, 2] + -0.019967429692 # B[4, 2, 0, 2] + 0.286015704682 # B[5, 2, 1, 3] + 0.072864063124 # B[6, 2, 2, 2] + 0.108748154196 # B[7, 2, 2, 4] + -0.005203284351 # B[8, 3, 0, 3] + 0.043948598532 # B[9, 3, 1, 4] + 0.105425889093 # B[10, 3, 2, 3] + 0.060460134045 # B[11, 3, 2, 5] + -0.003406205141 # B[12, 3, 3, 4] + 0.002306765306 # B[13, 3, 3, 6] + -0.003845115174 # B[14, 4, 0, 4] + 0.029471162073 # B[15, 4, 1, 5] + 0.054901130330 # B[16, 4, 2, 4] + 0.010910192753 # B[17, 4, 2, 6] + 0.033885210622 # B[18, 4, 3, 5] + 0.008053439551 # B[19, 4, 3, 7] + -0.001432298168 # B[20, 4, 4, 4] + 0.017478027729 # B[21, 4, 4, 6] + -0.003402034990 # B[22, 4, 4, 8] + -0.002655339820 # B[23, 5, 0, 5] + 0.012668749892 # B[24, 5, 1, 6] + 0.037521561888 # B[25, 5, 2, 5] + -0.000682693314 # B[26, 5, 2, 7] + 0.008525913627 # B[27, 5, 3, 6] + 0.008977936348 # B[28, 5, 3, 8] + 0.006922732235 # B[29, 5, 4, 5] + 0.003031883044 # B[30, 5, 4, 7] + -0.000345577975 # B[31, 5, 5, 6] + -0.001041600679 # B[32, 5, 5, 8] + -0.001407625493 # B[33, 6, 0, 6] + 0.004211558640 # B[34, 6, 1, 7] + 0.014450875461 # B[35, 6, 2, 6] + -0.007033326252 # B[36, 6, 2, 8] + 0.004998742185 # B[37, 6, 3, 7] + -0.002824617682 # B[38, 6, 4, 6] + 0.003831871934 # B[39, 6, 4, 8] + -0.005700892700 # B[40, 6, 5, 7] + 0.000184422409 # B[41, 6, 6, 6] + 0.001592696824 # B[42, 6, 6, 8] + -0.000804927645 # B[43, 7, 0, 7] + 0.008465358642 # B[44, 7, 1, 8] + 0.005460531160 # B[45, 7, 2, 7] + -0.000639605094 # B[46, 7, 3, 8] + -0.002403948393 # B[47, 7, 4, 7] + -0.001267042453 # B[48, 7, 5, 8] + 0.003836940623 # B[49, 7, 6, 7] + 0.002333141437 # B[50, 7, 7, 8] + -0.000665360637 # B[51, 8, 0, 8] + -0.003460637865 # B[52, 8, 2, 8] + -0.001598726043 # B[53, 8, 4, 8] + 0.001478744304 # B[54, 8, 6, 8] + 0.000806643203 # B[55, 8, 8, 8] From b8866c9acca50571eb2ba8fd20b8f4fa6acd3f1d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 09:35:00 -0400 Subject: [PATCH 40/54] add tests for MLIAP (same data as SNAP) --- .../tests/manybody-pair-mliap_snap.yaml | 157 +++++++++++++++++ .../tests/manybody-pair-mliap_snap_chem.yaml | 161 ++++++++++++++++++ 2 files changed, 318 insertions(+) create mode 100644 unittest/force-styles/tests/manybody-pair-mliap_snap.yaml create mode 100644 unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml new file mode 100644 index 0000000000..f565eec3ca --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-mliap_snap.yaml @@ -0,0 +1,157 @@ +--- +lammps_version: 15 Jun 2020 +date_generated: Tue Jun 23 06:48:10 202 +epsilon: 5e-13 +prerequisites: ! | + pair mliap + pair zbl +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on +post_commands: ! "" +input_file: in.manybody +pair_style: hybrid/overlay zbl 4.0 4.8 mliap model linear Ta06A.mliap.model descriptor sna Ta06A.mliap.descriptor +pair_coeff: ! | + 1*8 1*8 zbl 73 73 + * * mliap Ta Ta Ta Ta Ta Ta Ta Ta +extract: ! "" +natoms: 64 +init_vdwl: -473.569864629026 +init_coul: 0 +init_stress: ! |2- + 3.9989504688551557e+02 4.0778136516737010e+02 4.3596322435184823e+02 -2.5242497284339528e+01 1.2811620806363672e+02 2.8644673361821371e+00 +init_forces: ! |2 + 2 -7.6696525239232614e+00 -3.7674335682223381e-01 -5.7958054718422796e+00 + 4 -4.7103509354198474e+00 9.2783458784125976e+00 4.3108702582741394e+00 + 5 -2.0331946400488965e+00 -2.9593716047756224e+00 -1.6136351145373165e+00 + 9 5.2043326273130175e-01 -2.9340446386400014e+00 -7.6461969078455798e+00 + 10 -6.2786875145099574e-01 5.6606570005199780e-02 -5.3746300485699585e+00 + 13 -3.2260600618006539e+00 1.3854745225224621e+01 -1.8038061855949397e+00 + 11 8.1946917251451801e+00 -6.7267140406524657e+00 2.5930013855034550e+00 + 12 -1.4328402235895096e+01 -8.0774309292156143e+00 -7.6980199570965535e+00 + 19 -2.9132243097469304e+00 -1.1018213008189472e+00 -2.8349170179881722e+00 + 21 3.9250706073854151e+00 -1.0562396695052101e+00 -9.1632104209006702e+00 + 8 2.7148403621334438e-01 1.3063473238306025e+00 -1.1268098385676197e+00 + 29 -6.6151960592236190e+00 1.6410275382967952e+00 -1.0570398181017480e+00 + 16 3.7310502876344760e+00 1.9788328492752696e+00 1.5687925430243098e+01 + 17 5.0755393464331515e+00 6.1278868384113512e+00 -1.0750955741273687e+01 + 27 4.3406014531279222e+00 -2.9009678649007347e+00 5.2435008444617166e+00 + 3 -2.9221261341044469e-01 -1.2984917885683769e+00 2.2320440844884373e+00 + 18 1.7371660543384104e+00 3.0620693584379275e+00 7.2701166654624956e+00 + 24 3.1860163425620680e+00 4.7170150104555351e+00 6.3461114127051061e+00 + 26 -1.8170871697803483e+00 -3.7700946621068332e-01 6.2457161242681802e-01 + 1 -3.7538180163781281e+00 8.8612947043788459e+00 6.7712977816731925e+00 + 32 -7.8831496558114598e+00 4.7917666582558249e-01 8.5821461480120664e-01 + 36 1.7666626040313678e+00 -4.4698105712986056e+00 2.0563602888033050e-01 + 37 -3.8714388913204454e+00 5.6357721515897268e+00 -6.6078854304621739e+00 + 7 -3.0573043543220679e+00 -4.0575899915120344e+00 1.5283788878527855e+00 + 41 2.4000089474498232e-01 1.0045144396502841e+00 -2.3032449685213674e+00 + 45 -1.8910274064700999e-01 3.9137627573846210e+00 -7.4450993876429434e+00 + 15 -8.6349846297037978e+00 9.1996942753987128e+00 -9.5905201240122828e+00 + 33 1.0742815926879521e+01 -5.8142728701457003e+00 9.7282423280124668e+00 + 44 8.0196107396135172e+00 -8.1793730426384510e+00 3.5131695854462555e+00 + 6 1.8086748683348595e+00 4.6479727629048604e+00 3.0425695895914578e-01 + 49 -2.3978299788759889e+00 -1.2283692236805230e+01 -8.3755937565454222e+00 + 53 5.8389424736085607e+00 7.5295796786576119e+00 5.5403096028203374e+00 + 14 -2.9498732270039882e+00 8.5589611530655603e+00 2.0530716609447491e-01 + 23 2.8936071278420714e+00 5.3816164530412882e+00 7.4597216732837177e+00 + 40 9.5193696695210672e+00 -7.0213638399035494e+00 -1.5692669012530698e+00 + 57 2.1375440189893022e+00 -1.3001299791681298e+00 -8.9740026386466110e-01 + 61 9.6892046530363873e-01 3.6493959386458283e+00 -8.3809793809505218e-01 + 31 -3.1645464836586603e+00 3.4678442856970015e-01 -3.0903933004747017e+00 + 48 2.1755560727357048e+00 2.9996491762493229e+00 -9.9575511910098058e-01 + 22 -1.5634125465245702e+01 8.9090677007239911e+00 -1.2750204519006152e+01 + 52 1.2943573147098915e+01 -1.1745909799528659e+01 1.6522312348562515e+01 + 30 -3.6949627314218136e+00 2.0505225752289307e+00 -1.5676706969561185e+00 + 56 -3.5699586538972254e-02 1.5545384984529775e+00 -5.2139902048630420e+00 + 60 -5.1586404521695721e+00 -1.5178664164309573e+01 -9.8559725391425026e+00 + 64 7.5837965251215627e+00 7.5954689486766194e+00 1.6804021764142050e+01 + 35 2.5212001799950725e+00 -2.2938190564661243e+00 5.7029334689778004e+00 + 39 4.1718406489245954e+00 -6.3270387696640595e+00 -1.1208012916569130e+01 + 42 -9.4741999244791391e+00 -6.3134658287662759e+00 -3.6928028439517928e+00 + 34 -1.3523086688998043e+00 -1.1117518205645371e-01 1.6057041203339621e+00 + 43 2.7218639962411589e-01 -1.3813634477251094e+01 5.5147832931992469e-01 + 47 5.1131478665605368e+00 2.3800985688973464e+00 5.1348001359881970e+00 + 38 1.4632813171776620e+00 -3.3182377007830421e-01 -8.4412322782159954e-01 + 51 -3.0166275666360338e+00 1.1037977712957444e+01 8.8691052932904118e+00 + 25 8.8078411119651601e-01 -1.4554648001614772e+00 1.6812657581308250e+00 + 46 -3.5282857552811713e+00 -5.1713579630178099e+00 1.2477491203990516e+01 + 55 4.9846400582125172e+00 -8.4400769236810991e+00 -6.5776931744173242e+00 + 59 9.0343971306644413e+00 4.2302611807585278e+00 -1.8088550980511922e+00 + 63 5.8570431431678962e+00 -6.2896068000076291e+00 -3.8788666930728652e+00 + 20 -1.6464048708371493e+01 2.4791517492525514e+00 3.4072780064525776e-01 + 50 3.6161933080447870e+00 5.6291551969069200e+00 -6.9709721613230791e-01 + 54 4.6678942858445627e+00 -5.7948610984029827e+00 -4.7138910958393687e+00 + 58 5.2652486142639470e+00 -2.5529130533710904e+00 2.0016357749194574e-01 + 62 -6.2693637951458747e+00 5.5593866650560697e+00 -4.0417158962655790e+00 + 28 -7.0542478046176460e-01 1.0981989037209763e+00 1.3116499712117605e+01 +run_vdwl: -489.468066110652 +run_coul: 0 +run_stress: ! |2- + 3.7167872895847830e+02 3.7917710068041873e+02 4.0385320198584725e+02 -1.3691599706785620e+01 9.5517308985478394e+01 9.7589276560909521e+00 +run_forces: ! |2 + 2 -6.0189354199893019e+00 -5.0918745113944830e-01 -5.3313245647285648e+00 + 4 -3.0213465402043487e+00 6.9725231357285153e+00 2.1167504663792407e+00 + 5 -1.7586848423194326e+00 -3.2933741468811117e+00 -9.3080751290254016e-01 + 9 8.0189242689618823e-01 -3.0847017825088363e+00 -6.9542340364711066e+00 + 10 -8.9128976791778891e-01 -6.7393019870597731e-02 -3.2723844475537320e+00 + 13 -4.8758021083011011e-01 1.0840591566757565e+01 1.4417301279067557e-01 + 11 4.5456393443054974e+00 -4.5148464719144279e+00 2.1620709337140723e-01 + 12 -1.0605260639103403e+01 -3.7437284480399842e+00 -4.2782571870680659e+00 + 19 -2.7367744247531327e+00 -8.2975485638465007e-01 -2.0790334392182368e+00 + 21 3.4454631697777542e+00 -7.8278081568080538e-01 -9.0435968147049799e+00 + 8 -5.4873779786283237e-02 1.5854566692139447e+00 -1.0066392618014397e+00 + 29 -6.1417582599413354e+00 3.9164321009856218e-01 9.7685688363946144e-02 + 16 2.6358192742443785e+00 1.7064832375902417e-01 1.0429654093017437e+01 + 17 2.6492424666949455e+00 4.1865915382220500e+00 -9.0595086171557959e+00 + 27 3.2706304707445777e+00 -1.9852603643313336e+00 4.2180376607986387e+00 + 3 -8.3868957617451234e-01 -8.8585183150041003e-01 2.9968107645220114e+00 + 18 1.1206473927094001e+00 2.2123081794070760e+00 5.8589201221087279e+00 + 24 2.9885018662472969e+00 2.9838762041792903e+00 4.3228545839763228e+00 + 26 -1.8763705008872573e+00 -1.2599849620161119e-01 6.2992383249895434e-01 + 1 -2.6200062192163260e+00 6.5895070779555445e+00 5.6608861291961485e+00 + 32 -6.1422237837124252e+00 -5.1210288634459333e-01 5.4514825686867274e-01 + 36 1.2821238454090340e+00 -3.9489216486981480e+00 -8.6269270447000523e-01 + 37 -2.7537235028447959e+00 4.6513692386669554e+00 -5.6290489372162806e+00 + 7 -2.0012695381122851e+00 -2.5159443018298582e+00 6.2116996571725824e-01 + 41 1.0342805569135010e+00 1.6523945993277342e+00 -1.5772104911433944e+00 + 45 3.0267523524516227e-01 2.2378774625062987e+00 -4.7768000279857130e+00 + 15 -5.6397727632249390e+00 5.8479631324846224e+00 -5.1195271857482370e+00 + 33 7.4141036509796736e+00 -2.7884535553661554e+00 6.2033448623898471e+00 + 44 6.9463399563146995e+00 -6.4872117822671029e+00 1.0874644094280221e+00 + 6 2.2991165379551060e+00 3.3795036971656316e+00 2.2660197467513185e-01 + 49 -1.1421201760383086e+00 -1.0752096896646723e+01 -6.5722133309475623e+00 + 53 3.4161226658911676e+00 5.7780690168335100e+00 4.1927204150859296e+00 + 14 -2.8043941505268619e+00 6.4438899074281046e+00 1.6101766369425701e+00 + 23 2.3598327627157203e+00 4.6653030563297317e+00 6.1390590162436585e+00 + 40 7.4374269075019397e+00 -4.3433135301581913e+00 -4.0455383168565001e-01 + 57 2.1690816717712806e+00 -1.3704555520632966e+00 -6.0759785348038831e-01 + 61 1.1003078657122041e+00 3.5366731859023495e+00 -1.4254057900337927e-01 + 31 -2.6098520190441916e+00 2.2795861569826048e-01 -2.7458401111959478e+00 + 48 2.2413400699812356e+00 3.3580569902180799e+00 -1.2661375290157366e+00 + 22 -9.9116182027989090e+00 3.7537117149502670e+00 -6.2041013601324995e+00 + 52 8.0098592133005599e+00 -5.9122394581044402e+00 1.0101406704527053e+01 + 30 -3.1388355174211191e+00 1.6122297260129153e+00 -1.1081505352088727e+00 + 56 5.1189498205615092e-01 1.1342419773973298e+00 -4.2814131693242929e+00 + 60 -2.3372986868253895e+00 -1.1397492261021370e+01 -7.3457073057764726e+00 + 64 4.3353125159604211e+00 4.7586391643778230e+00 1.2965475525931369e+01 + 35 1.5632007556515235e+00 -9.5418452153129252e-01 4.1257737822747229e+00 + 39 2.1765892902345456e+00 -3.8586421759387384e+00 -9.0645286263473448e+00 + 42 -8.1195815614370250e+00 -5.8763972130775572e+00 -3.1222551004416705e+00 + 34 -1.4244505798620775e+00 -3.3429770690754701e-02 1.9184700282588940e+00 + 43 -2.7912198462705029e-01 -1.1167330547751900e+01 -6.3698536543291662e-02 + 47 4.2785305080294629e+00 1.5325832230443761e+00 3.3589203411901534e+00 + 38 1.9992052623036145e+00 -4.2983333004702029e-01 -1.0733048030047021e+00 + 51 -1.7223504936880034e+00 9.2697024243389841e+00 7.0442106476591402e+00 + 25 6.1001404235466761e-01 -1.1881822928224532e+00 1.5040997261686671e+00 + 46 -2.2570016757486253e+00 -4.0040746828789366e+00 9.8689525243895222e+00 + 55 2.5539298626493867e+00 -5.6377686174334265e+00 -3.5151115361687300e+00 + 59 6.7962624211316438e+00 2.0240756728927010e+00 -8.0188277109815520e-01 + 63 4.4200660412946480e+00 -4.6975137723775253e+00 -2.5446183902678623e+00 + 20 -1.2201950287425831e+01 8.9293356122794254e-01 -6.4486216284158071e-01 + 50 3.4180454936299873e+00 5.0411589857253878e+00 -5.8332155561549115e-01 + 54 2.4972457061023641e+00 -3.7172022065563843e+00 -2.6131222195234560e+00 + 58 4.3539661764216335e+00 -1.4572581960607045e+00 -9.9173296914446007e-01 + 62 -5.1368600009373031e+00 3.5663926174152052e+00 -2.2708852648200208e+00 + 28 -3.1071530373299716e-01 1.5750530088540271e+00 9.6837465049814764e+00 +... diff --git a/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml b/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml new file mode 100644 index 0000000000..2edfbaf3a4 --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-mliap_snap_chem.yaml @@ -0,0 +1,161 @@ +--- +lammps_version: 15 Jun 2020 +date_generated: Tue Jun 23 06:28:49 202 +epsilon: 5e-13 +prerequisites: ! | + pair mliap + pair zbl +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on + variable zblz1 index 49 + variable zblz2 index 15 +post_commands: ! "" +input_file: in.manybody +pair_style: hybrid/overlay zbl 4.0 4.2 mliap model linear InP_JCPA2020.mliap.model descriptor sna InP_JCPA2020.mliap.descriptor +pair_coeff: ! | + 1*4 1*4 zbl ${zblz1} ${zblz1} + 1*4 5*8 zbl ${zblz1} ${zblz2} + 5*8 5*8 zbl ${zblz2} ${zblz2} + * * mliap In In In In P P P P +extract: ! "" +natoms: 64 +init_vdwl: -185.3871232982 +init_coul: 0 +init_stress: ! |2- + 2.1627572764873958e+02 2.1843973818802479e+02 2.2323704161405172e+02 -5.3476822166124478e+00 2.9965125280145408e+01 1.1801773510997722e+00 +init_forces: ! |2 + 2 -2.3497957616596601e+00 -7.0361817598817122e-01 -1.5634923191374748e+00 + 4 -2.0337936615474375e+00 2.9491894607511475e+00 9.8066478014365421e-01 + 5 -1.9807302026626257e+00 -4.1921845197040186e-01 -3.9514999290883601e-01 + 6 -1.0256636650331943e-01 2.3662295416638237e+00 9.0816298775387250e-01 + 7 -6.0657120592984948e-01 -8.0634286798072208e-01 2.1759740426498699e+00 + 8 6.0627276316788437e-01 1.0677577347039469e+00 -1.2887262448970853e+00 + 9 -3.0674852805674085e-01 -2.0605633540913710e+00 -2.5500662803249257e+00 + 10 -1.9428976574806139e-01 -1.4648835736857648e+00 -2.8490531930038245e+00 + 11 3.1532548864214434e+00 -2.9033258960601409e+00 2.2619034310429735e+00 + 12 -5.4038968585110823e+00 -3.2935652899479924e+00 -2.5707355493491781e+00 + 13 -6.1736753137043776e-01 5.1000477579656494e+00 -1.3304391624961633e+00 + 14 -1.4190543180546618e+00 3.3413841917147384e+00 4.6351390250498770e-01 + 15 -3.1131424694968604e+00 4.4700267996081555e+00 -3.2364337367424172e+00 + 16 1.7079914236492750e+00 -1.9995742761541913e-01 5.0185841295230240e+00 + 17 2.3724862536641012e+00 3.0987980523865000e+00 -3.4198379943456869e+00 + 27 1.9066785243503706e+00 -2.9510326328255049e-01 1.2119553206259739e+00 + 33 4.3597028481189959e+00 -2.6773596435480336e+00 3.1791467867699503e+00 + 44 3.0506037114469589e+00 -3.3226877009576863e+00 1.7796293414951667e+00 + 3 6.2372158338858497e-01 2.7149161557212964e-01 -4.8035793806964389e-01 + 18 -2.5111265055015947e-01 7.3348166166902828e-01 3.0622036193004099e+00 + 19 -1.2828262181283474e+00 -2.2345757410919127e+00 -3.3669351804164727e-01 + 21 1.3962036186373230e+00 3.9865506204929702e-01 -2.5893554970082704e+00 + 22 -5.1263732155413759e+00 3.6744897485626451e+00 -4.8303251395784246e+00 + 23 1.7617874308698238e+00 2.9253519141342759e+00 1.4679679444255609e+00 + 24 1.5937879337284910e+00 8.9992286487733819e-01 2.8087468575298824e+00 + 26 -3.5670456442877890e-01 -3.9811471877481980e-01 8.1854393579980245e-01 + 49 -2.3858202682345580e+00 -4.2223184267227767e+00 -2.7959407680025370e+00 + 1 -8.9407797360085417e-01 3.1174511790027033e+00 1.7848004756991056e+00 + 29 -2.7893073887365949e+00 7.8106446652879102e-01 -8.2039261846998079e-01 + 30 -1.8694503114341436e+00 7.0812686858708307e-01 -9.1751940639239338e-01 + 31 -7.0985766256762384e-01 8.6963471463259445e-01 -7.5188557225015273e-01 + 32 -2.4089849337056681e+00 4.0992982351371432e-01 -1.1381600041412421e-01 + 60 -2.2387715060954041e+00 -5.2442113310349816e+00 -2.6985516164859176e+00 + 25 1.0286448774492718e+00 -4.3669506584228501e-01 1.2594354985828644e+00 + 35 1.2413218618562072e+00 -4.1427608114771164e-01 2.5651243684278686e+00 + 36 -1.1152887975138681e-01 -2.3088354090108663e+00 -2.3687452176819115e-01 + 37 -2.1752322691080077e+00 1.9377327531750539e+00 -2.2419453197067281e+00 + 38 -9.9594979744324563e-01 -1.8147173502133507e-01 6.8832530755714350e-01 + 39 2.8779281856552128e+00 -1.7332955648283563e+00 -3.4260103364251724e+00 + 40 4.3351429466694649e+00 -2.2624572291840521e+00 -1.7065975882223487e+00 + 34 5.1607419486495609e-01 1.3141798772668922e-01 8.7023229642903210e-02 + 41 2.5124166305689100e-01 -4.2179260496370724e-01 -1.2503380336802215e+00 + 42 -3.5352439688397150e+00 -1.6053715846066683e+00 -6.7917775288119064e-01 + 43 8.4817996010401164e-01 -4.8899181684596407e+00 1.7369510897908452e-01 + 45 -1.8374092699066706e+00 1.5294723708757618e+00 -2.7502022232711760e+00 + 46 -9.1023563070749047e-01 -1.7778137773508695e+00 4.9843270240840001e+00 + 47 2.6124800260927614e+00 1.6175231582888077e+00 1.5805303054926736e+00 + 48 1.4743780750991404e+00 3.6707315780788008e-02 -2.9750115931287535e-01 + 59 2.9909449561888724e+00 2.1621928717215835e+00 -2.3820831167094303e+00 + 20 -5.9491949074906936e+00 3.2510448152978871e-01 6.8450449383664713e-01 + 50 2.4067134019907233e-01 2.8105796871762414e+00 -1.0687621004291805e+00 + 51 -1.7932456135513868e+00 2.6201558060481331e+00 3.7648454668413773e+00 + 52 4.6358669186214048e+00 -4.8660554435252061e+00 5.0894919019571017e+00 + 53 2.9898995132891715e+00 3.3216926541391611e+00 2.4227995842838892e+00 + 54 1.8732808586337415e+00 -3.0909639789911147e+00 -2.2880122319661975e+00 + 55 1.1426678804104569e+00 -2.5892472259617465e+00 -3.2449552890237303e+00 + 56 -1.1541931360327828e-01 -8.3260558816076080e-02 -1.7966753733604066e+00 + 58 2.4813755367140664e+00 -1.2765007868407994e+00 1.5628981219370055e+00 + 28 2.5221087546188337e-01 1.4370172575473001e+00 4.1039332214108235e+00 + 57 -1.2751171337205386e-01 -8.8899643643851600e-01 -5.0726814112212137e-02 + 61 -1.0184694703280139e+00 1.5256818152660501e+00 -1.0113329140640543e+00 + 62 -2.7862663394350529e+00 2.5876139756856724e+00 -1.7815179130043091e+00 + 63 2.4339134295594320e+00 -3.1961735689987627e+00 -4.7891394265908005e-01 + 64 3.0382364587319786e+00 3.0430454898558628e+00 5.3416679902175552e+00 +run_vdwl: -187.654391839485 +run_coul: 0 +run_stress: ! |2- + 2.1286434186597299e+02 2.1516140376524689e+02 2.2014270591458128e+02 -4.1189309434632548e+00 2.5671737667284461e+01 3.4094574165482725e+00 +run_forces: ! |2 + 2 -2.2299658853721507e+00 -7.5585568905659772e-01 -1.5309002377019625e+00 + 4 -1.6432999484262130e+00 2.7237882915593326e+00 4.6054246395477350e-01 + 5 -1.9915642544829777e+00 -5.0514454245912876e-01 -2.4023101827231486e-01 + 6 3.1580339744901054e-01 2.2624378988705449e+00 1.0700232878883553e+00 + 7 -4.3667900724171116e-01 -4.6326888074447586e-01 1.8815161287461819e+00 + 8 4.0891558557491903e-01 9.8444761132021974e-01 -1.1994011642190254e+00 + 9 -3.9943153478794785e-01 -2.2209279455737687e+00 -2.5915912103444536e+00 + 10 -1.9471351965318492e-01 -1.4496690804153829e+00 -2.2623893657434921e+00 + 11 2.4362905726150617e+00 -2.3810030225467420e+00 1.8905835689476449e+00 + 12 -4.8961713945288228e+00 -2.6394975897948645e+00 -2.0372233198924476e+00 + 13 1.3378868571704855e-01 4.5775961871578907e+00 -9.1227708328467871e-01 + 14 -1.5297526207810295e+00 3.0522662572662123e+00 4.9107580456119615e-01 + 15 -2.6765425425933334e+00 3.8247215679835032e+00 -2.5375795218582140e+00 + 16 1.5196290196835556e+00 -3.2914146438877845e-01 4.1849431488039270e+00 + 17 2.0043578760825422e+00 2.8234226231079971e+00 -2.9923076186199409e+00 + 27 1.9119897296615496e+00 -3.9246942513009608e-01 1.2080897134421995e+00 + 33 3.7351462993820155e+00 -2.1144175359802881e+00 2.6418390367829723e+00 + 44 2.9022254223989687e+00 -3.0658233607366552e+00 1.4095258293816753e+00 + 3 2.8912410060638449e-01 4.3705738858658072e-01 -2.1722808227079787e-01 + 18 -5.0347976264338157e-01 8.8149323898758825e-01 2.9370157524159088e+00 + 19 -1.4078018510609771e+00 -2.2820746919860460e+00 -3.7825546052718551e-01 + 21 1.4678310024890893e+00 1.7118675240828019e-01 -2.7319662502952085e+00 + 22 -4.2798753174007320e+00 3.0607656650226183e+00 -3.9192708818666397e+00 + 23 1.8070160916189471e+00 2.8893260418555005e+00 1.4715768249778427e+00 + 24 1.7943331384890664e+00 5.6727833662929228e-01 2.4453386937887518e+00 + 26 -4.7367357683059208e-01 -2.6670219998362554e-01 8.5910453505401185e-01 + 49 -2.4980250315840102e+00 -4.2937298563437452e+00 -2.7685866462265638e+00 + 1 -7.3369133823406019e-01 2.7667970855721902e+00 1.6328050345720770e+00 + 29 -2.7287724915818701e+00 7.5140952246304527e-01 -7.1978618410779327e-01 + 30 -1.6121881543481651e+00 4.7145279745822616e-01 -9.4382533006887137e-01 + 31 -6.9302105329787711e-01 8.6622808992775280e-01 -7.1688447301762670e-01 + 32 -2.1877722619109301e+00 3.1241022059139323e-01 -2.0363529214606668e-01 + 60 -2.2516089079595991e+00 -4.9525359014312302e+00 -2.6471467342704198e+00 + 25 9.4127417840102356e-01 -3.2082226320612112e-01 1.0317887157557417e+00 + 35 1.2481610501512823e+00 -1.4422631315933354e-01 2.3732508438175111e+00 + 36 -4.1515332308320341e-01 -2.0958691183365024e+00 -6.0782500168499043e-01 + 37 -1.8737832564668908e+00 1.5868160141680490e+00 -2.1502811274719473e+00 + 38 -8.3799314060680841e-01 -1.1168329368636565e-01 7.5420009101162666e-01 + 39 2.4623601668269171e+00 -1.3731570495025507e+00 -3.1300208221580808e+00 + 40 4.2396805048038306e+00 -1.9896514878251730e+00 -1.6439304927095406e+00 + 34 4.3814257629996445e-01 1.4381263658420362e-01 1.5892319607512650e-01 + 41 4.5291426717441718e-01 -2.1649648555890250e-01 -1.0103115219148269e+00 + 42 -3.4063198353809976e+00 -1.7197481999679383e+00 -7.1574757576947656e-01 + 43 6.7969745762235467e-01 -4.4139560697511886e+00 -7.1374160410194093e-02 + 45 -1.8021584516545357e+00 1.1139426059206683e+00 -2.3612665451280677e+00 + 46 -6.4055392057875782e-01 -1.5437936507527341e+00 4.7629947723944017e+00 + 47 2.4596732256156790e+00 1.3839195366764618e+00 1.4983351229907567e+00 + 48 1.4286951465559086e+00 2.5226997121024208e-01 -3.1703206977278198e-01 + 59 2.7939168112815249e+00 2.0644797911549686e+00 -2.2194096868290583e+00 + 20 -5.3044185428231110e+00 -5.5789399083649077e-02 4.5964111618433978e-01 + 50 2.3859148339052361e-01 2.5999038034992537e+00 -1.1882197967404982e+00 + 51 -1.8541927042572204e+00 2.5220449582545088e+00 3.6251170038994083e+00 + 52 4.0017526007315150e+00 -3.9563125820844296e+00 4.1997432909076826e+00 + 53 2.9944010593604045e+00 3.2831372076580529e+00 2.6928034831187961e+00 + 54 1.5871022597839053e+00 -2.8228944858891403e+00 -1.9576122929926121e+00 + 55 6.8049238759975206e-01 -2.2839449322075804e+00 -2.6675101357177620e+00 + 56 -1.1904103145926614e-01 -4.1523795497198490e-01 -1.6223721062486220e+00 + 58 2.4136361939725424e+00 -9.4464777619607587e-01 1.2128229032096640e+00 + 28 1.8999192393940767e-01 1.6499913470409551e+00 3.7514920356690027e+00 + 57 -1.3403241451059458e-01 -1.1130134152852698e+00 -1.0367473155144701e-01 + 61 -9.1969687435720449e-01 1.4906668816471547e+00 -9.1416116187656105e-01 + 62 -2.5974358252612548e+00 2.3448472464785857e+00 -1.4775087114289507e+00 + 63 2.3319640999455045e+00 -3.2577489670850390e+00 -4.7807587290002118e-01 + 64 2.9639114599347867e+00 3.0313370540601516e+00 5.0817272896875902e+00 +... From 9aea4e509e8e80ad30ee6ef00fca43ef2021c39b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 09:50:17 -0400 Subject: [PATCH 41/54] Revert "must also reissue hybrid pair style commands after restarts" This reverts commit ddcc104df653b427f042de02ffe6cf9b744451e5. --- unittest/force-styles/pair_style.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/unittest/force-styles/pair_style.cpp b/unittest/force-styles/pair_style.cpp index 3bc14746b1..9354ad7f03 100644 --- a/unittest/force-styles/pair_style.cpp +++ b/unittest/force-styles/pair_style.cpp @@ -32,7 +32,6 @@ #include "modify.h" #include "pair.h" #include "universe.h" -#include "utils.h" #include #include @@ -160,8 +159,7 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg) command("clear"); command("read_restart " + cfg.basename + ".restart"); - // need to re-issue pair style with non-restartable and hybrid pair styles - if ((!lmp->force->pair) || (utils::strmatch(cfg.pair_style,"^hybrid"))) { + if (!lmp->force->pair) { command("pair_style " + cfg.pair_style); } if (!lmp->force->pair->restartinfo || !lmp->force->pair->writedata) { From a766b6a901896e3cbda898e085145eee24adefaa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 10:24:47 -0400 Subject: [PATCH 42/54] make sure numbers for atoms outside the compute group are zero --- src/compute_hexorder_atom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index 96d4c47678..b4ffd91b43 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -239,7 +239,7 @@ void ComputeHexOrderAtom::compute_peratom() } qn[0] = usum/nnn; qn[1] = vsum/nnn; - } + } else qn[0] = qn[1] = 0.0; } } From 5d1d406e019762333bde5502d09c8aea12c7f1fa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 23 Jun 2020 11:02:57 -0400 Subject: [PATCH 43/54] must initialize ngrow in the constructor --- src/atom_vec.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 85afd46d32..fd8ab545a4 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -38,6 +38,7 @@ using namespace MathConst; AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp) { nmax = 0; + ngrow = 0; molecular = 0; bonds_allow = angles_allow = dihedrals_allow = impropers_allow = 0; From 8cec13a038977be6ed032e4862f4a8fc9f2fa325 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 23 Jun 2020 13:23:11 -0400 Subject: [PATCH 44/54] Add memory checker support in CMake If ENABLE_TESTING is ON, you can now use memory checking tools to run the test suite and check for memory leaks. By default CMake will try to find valgrind in your path and set some default options. To customize this behavior use the MEMORYCHECK_COMMAND and MEMORYCHECK_COMMAND_OPTIONS variables. To run tests with the memory checker, use the MemCheck action in ctest: Run entire test suite: ctest -T MemCheck Run single test: ctest -T MemCheck -R TESTNAME Run test in verbose mode: ctest -V -T MemCheck -R TESTNAME --- cmake/Modules/Testing.cmake | 20 +++++ tools/valgrind/OpenMP.supp | 74 +++++++++++++++++ tools/valgrind/OpenMPI.supp | 158 ++++++++++++++++++++++++++++++++++++ tools/valgrind/Python3.supp | 145 +++++++++++++++++++++++++++++++++ 4 files changed, 397 insertions(+) create mode 100644 tools/valgrind/OpenMP.supp create mode 100644 tools/valgrind/OpenMPI.supp create mode 100644 tools/valgrind/Python3.supp diff --git a/cmake/Modules/Testing.cmake b/cmake/Modules/Testing.cmake index a9f9a2ac21..f46043d7e7 100644 --- a/cmake/Modules/Testing.cmake +++ b/cmake/Modules/Testing.cmake @@ -3,6 +3,26 @@ ############################################################################### option(ENABLE_TESTING "Enable testing" OFF) if(ENABLE_TESTING) + find_program(VALGRIND_BINARY NAMES valgrind) + set(VALGRIND_DEFAULT_OPTIONS "--leak-check=full --show-leak-kinds=all --track-origins=yes") + + if(BUILD_MPI) + set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${LAMMPS_TOOLS_DIR}/valgrind/OpenMP.supp") + endif() + + if(BUILD_OMP) + set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${LAMMPS_TOOLS_DIR}/valgrind/OpenMP.supp") + endif() + + if(PKG_PYTHON) + set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${LAMMPS_TOOLS_DIR}/valgrind/Python3.supp") + endif() + + set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command") + set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options") + + include(CTest) + enable_testing() get_filename_component(LAMMPS_UNITTEST_DIR ${LAMMPS_SOURCE_DIR}/../unittest ABSOLUTE) get_filename_component(LAMMPS_UNITTEST_BIN ${CMAKE_BINARY_DIR}/unittest ABSOLUTE) diff --git a/tools/valgrind/OpenMP.supp b/tools/valgrind/OpenMP.supp new file mode 100644 index 0000000000..6d9c8b2867 --- /dev/null +++ b/tools/valgrind/OpenMP.supp @@ -0,0 +1,74 @@ +{ + OpenMP_cuda_init_part1 + Memcheck:Leak + match-leak-kinds: reachable + fun:calloc + fun:_dlerror_run + fun:dlopen* + obj:*/lib*/libcuda.so.* + obj:* + ... + fun:call_init.part.0 + fun:_dl_init + obj:/usr/lib*/ld-2.*.so +} +{ + OpenMP_init_part1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + ... + obj:/usr/lib*/libgomp.so.1* + fun:call_init.part.0 + fun:_dl_init +} +{ + OpenMP_init_part2 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + ... + obj:/usr/lib*/libgomp.so.1* + fun:GOMP_parallel + ... + fun:main +} +{ + OpenMP_init_part3 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + ... + obj:/usr/lib*/libgomp.so.1* + fun:omp_set_num_threads + ... + fun:main +} +{ + OpenMP_init_part4 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + ... + fun:GOMP_parallel + ... +} +{ + OpenMP_init_part5 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + ... + obj:/usr/lib*/libgomp.so.1* + fun:omp_set_num_threads + ... +} +{ + OpenMP_init_part6 + Memcheck:Leak + match-leak-kinds: possible + fun:calloc + ... + fun:GOMP_parallel + ... +} diff --git a/tools/valgrind/OpenMPI.supp b/tools/valgrind/OpenMPI.supp new file mode 100644 index 0000000000..a4aeaf95be --- /dev/null +++ b/tools/valgrind/OpenMPI.supp @@ -0,0 +1,158 @@ +{ + OpenMPI_MPI_init1 + Memcheck:Leak + match-leak-kinds: indirect + fun:malloc + obj:* + ... + fun:ompi_mpi_init + fun:PMPI_Init + fun:main +} +{ + OpenMPI_MPI_init2 + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + ... + fun:mca_pml_base_select +} +{ + OpenMPI_MPI_init3 + Memcheck:Leak + match-leak-kinds: indirect + fun:malloc + ... + fun:mca_pml_base_select +} +{ + OpenMPI_MPI_init3 + Memcheck:Leak + match-leak-kinds: definite + fun:?alloc + ... + fun:ompi_mpi_init + fun:PMPI_Init + fun:main +} +{ + OpenMPI_MPI_init4 + Memcheck:Leak + match-leak-kinds: reachable + fun:?alloc + ... + fun:ompi_mpi_init + fun:PMPI_Init + fun:main +} +{ + OpenMPI_MPI_init5 + Memcheck:Leak + match-leak-kinds: reachable + fun:?alloc + obj:*/libopen-pal.so.* + fun:mca_base_framework_components_open + fun:mca_base_framework_open + ... + fun:ompi_mpi_init + fun:PMPI_Init +} +{ + OpenMPI_MPI_init6 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:realloc + obj:*/libopen-pal.so.* + ... + fun:opal_progress + fun:ompi_mpi_init + fun:PMPI_Init + fun:main +} +{ + OpenMPI_MPI_init7 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:realloc + obj:*/libopen-pal.so.* + ... + fun:orte_init + fun:ompi_mpi_init +} +{ + OpenMPI_MPI_init8 + Memcheck:Leak + match-leak-kinds: reachable + fun:?alloc + ... + fun:orte_init + fun:ompi_mpi_init +} +{ + OpenMPI_MPI_thread1 + Memcheck:Leak + match-leak-kinds: definite + fun:?alloc + ... + fun:start_thread + fun:clone +} +{ + OpenMPI_MPI_thread2 + Memcheck:Leak + match-leak-kinds: reachable + fun:?alloc + ... + fun:start_thread + fun:clone +} +{ + OpenMPI_comm_init1 + Memcheck:Leak + match-leak-kinds: definite + fun:?alloc + ... + fun:ompi_comm_enable + fun:mca_topo_base_cart_create + fun:PMPI_Cart_create +} +{ + OpenMPI_comm_init2 + Memcheck:Leak + match-leak-kinds: reachable + fun:?alloc + ... + fun:ompi_comm_enable + fun:mca_topo_base_cart_create + fun:PMPI_Cart_create +} +{ + OpenMPI_comm_init3 + Memcheck:Leak + match-leak-kinds: reachable + fun:realloc + ... + fun:mca_topo_base_comm_select + fun:PMPI_Cart_create +} +{ + OpenMPI_comm_init4 + Memcheck:Leak + match-leak-kinds: reachable + fun:?alloc + ... + fun:mca_topo_base_comm_select + fun:PMPI_Cart_create +} +{ + OpenMPI_dlopen_strdup1 + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:strdup + obj:* + ... + fun:dlopen* +} diff --git a/tools/valgrind/Python3.supp b/tools/valgrind/Python3.supp new file mode 100644 index 0000000000..2e455c8db4 --- /dev/null +++ b/tools/valgrind/Python3.supp @@ -0,0 +1,145 @@ +{ + Python3_main_1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + ... + fun:_Py_UnixMain +} +{ + Python3_main_2 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + fun:PyUnicode_New + ... + fun:_Py_Init_posix + ... +} +{ + Python3_main_3 + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyObject_Malloc + ... + fun:_Py_UnixMain + ... +} +{ + Python3_main_4 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + fun:PyUnicode_New + ... + fun:PyInit_posix + ... +} +{ + Python3_eval_1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + ... + fun:_PyEval_EvalFrameDefault +} +{ + Python3_eval_2 + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyObject_Malloc + ... + fun:_PyEval_EvalFrameDefault +} +{ + Python3_eval_3 + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyObject_Malloc + ... + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCodeEx +} +{ + Python3_call_1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + fun:PyCode_New + ... + fun:_PyCFunction_FastCallKeywords +} +{ + Python3_call_2 + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyObject_Malloc + fun:PyUnicode_New + ... + fun:_PyMethodDef_RawFastCallKeywords + fun:_PyCFunction_FastCallKeywords +} +{ + Python3_call_3 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + fun:PyBytes_FromStringAndSize + ... + fun:_PyMethodDef_RawFastCallKeywords +} +{ + Python3_call_4 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + fun:_PyObject_GC_Malloc + fun:PyType_GenericAlloc + ... + fun:_PyMethodDef_RawFastCallKeywords + fun:_PyCFunction_FastCallKeywords + ... +} +{ + Python3_call_5 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + fun:_PyObject_GC_Malloc + fun:PyType_GenericAlloc + ... + fun:_PyMethodDef_RawFastCallKeywords +} +{ + Python3_tuple_1 + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyObject_Malloc + fun:_PyObject_GC_Malloc + fun:_PyObject_GC_NewVar + fun:PyTuple_New + ... +} +{ + Python3_unicode_1 + Memcheck:Leak + match-leak-kinds: reachable + fun:malloc + fun:PyObject_Malloc + fun:PyUnicode_New + fun:PyUnicode_FromKindAndData + ... +} From f812b94e400a21767bbe5ba73402a45bc4d3909b Mon Sep 17 00:00:00 2001 From: Sievers Date: Tue, 23 Jun 2020 14:23:41 -0700 Subject: [PATCH 45/54] Update relative paths to dynamic links --- .../phonon/dynamical_matrix_command/Silicon/SiCGe.tersoff | 1 + .../phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp | 2 +- .../USER/phonon/dynamical_matrix_command/python/SiCGe.tersoff | 1 + .../USER/phonon/dynamical_matrix_command/python/dynmat.py | 4 ++-- .../phonon/dynamical_matrix_command/python/ff-silicon.lmp | 1 + .../dynamical_matrix_command/python/silicon_input_file.lmp | 1 + 6 files changed, 7 insertions(+), 3 deletions(-) create mode 120000 examples/USER/phonon/dynamical_matrix_command/Silicon/SiCGe.tersoff create mode 120000 examples/USER/phonon/dynamical_matrix_command/python/SiCGe.tersoff create mode 120000 examples/USER/phonon/dynamical_matrix_command/python/ff-silicon.lmp create mode 120000 examples/USER/phonon/dynamical_matrix_command/python/silicon_input_file.lmp diff --git a/examples/USER/phonon/dynamical_matrix_command/Silicon/SiCGe.tersoff b/examples/USER/phonon/dynamical_matrix_command/Silicon/SiCGe.tersoff new file mode 120000 index 0000000000..74f53c4e75 --- /dev/null +++ b/examples/USER/phonon/dynamical_matrix_command/Silicon/SiCGe.tersoff @@ -0,0 +1 @@ +../../../../../potentials/SiCGe.tersoff \ No newline at end of file diff --git a/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp b/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp index 5768408b61..d7ee38b175 100755 --- a/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp +++ b/examples/USER/phonon/dynamical_matrix_command/Silicon/ff-silicon.lmp @@ -16,4 +16,4 @@ mass ${Si} 28.08550 ########################### pair_style tersoff -pair_coeff * * ../../../../../potentials/SiCGe.tersoff Si(D) +pair_coeff * * SiCGe.tersoff Si(D) diff --git a/examples/USER/phonon/dynamical_matrix_command/python/SiCGe.tersoff b/examples/USER/phonon/dynamical_matrix_command/python/SiCGe.tersoff new file mode 120000 index 0000000000..74f53c4e75 --- /dev/null +++ b/examples/USER/phonon/dynamical_matrix_command/python/SiCGe.tersoff @@ -0,0 +1 @@ +../../../../../potentials/SiCGe.tersoff \ No newline at end of file diff --git a/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py b/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py index 33cc3419b3..b628a96121 100644 --- a/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py +++ b/examples/USER/phonon/dynamical_matrix_command/python/dynmat.py @@ -9,8 +9,8 @@ import numpy as np """ LAMMPS VARIABLES """ # data files -infile = "../Silicon/silicon_input_file.lmp" -ff_file = "../Silicon/ff-silicon.lmp" +infile = "silicon_input_file.lmp" +ff_file = "ff-silicon.lmp" # full output useful for testing lmp = lammps() diff --git a/examples/USER/phonon/dynamical_matrix_command/python/ff-silicon.lmp b/examples/USER/phonon/dynamical_matrix_command/python/ff-silicon.lmp new file mode 120000 index 0000000000..8b025f7c2b --- /dev/null +++ b/examples/USER/phonon/dynamical_matrix_command/python/ff-silicon.lmp @@ -0,0 +1 @@ +../Silicon/ff-silicon.lmp \ No newline at end of file diff --git a/examples/USER/phonon/dynamical_matrix_command/python/silicon_input_file.lmp b/examples/USER/phonon/dynamical_matrix_command/python/silicon_input_file.lmp new file mode 120000 index 0000000000..fb12681042 --- /dev/null +++ b/examples/USER/phonon/dynamical_matrix_command/python/silicon_input_file.lmp @@ -0,0 +1 @@ +../Silicon/silicon_input_file.lmp \ No newline at end of file From ee5be4202697f77d5e0598afb6e42f012c96bee9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 09:32:59 -0400 Subject: [PATCH 46/54] avoid having to use external test runner script by parsing environment variables directly --- src/utils.cpp | 80 ++++++++++++++++++++++++++ src/utils.h | 15 +++++ unittest/force-styles/CMakeLists.txt | 28 +++------ unittest/force-styles/TestRunner.cmake | 8 --- unittest/force-styles/test_main.cpp | 15 +++++ unittest/utils/test_utils.cpp | 19 ++++++ 6 files changed, 137 insertions(+), 28 deletions(-) delete mode 100644 unittest/force-styles/TestRunner.cmake diff --git a/src/utils.cpp b/src/utils.cpp index 1e1ded3c0b..ae4575980f 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -430,6 +430,86 @@ size_t utils::trim_and_count_words(const std::string & text, const std::string & return utils::count_words(utils::trim_comment(text), separators); } +/* ---------------------------------------------------------------------- + Convert string into words on whitespace while handling single and + double quotes. +------------------------------------------------------------------------- */ +std::vector utils::split_words(const std::string &text) +{ + std::vector list; + const char *buf = text.c_str(); + std::size_t beg = 0; + std::size_t len = 0; + char c = *buf; + + while (c) { + // leading whitespace + if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f') { + c = *++buf; + ++beg; + continue; + }; + len = 0; + + // handle escaped/quoted text. + quoted: + + // handle single quote + if (c == '\'') { + c = *++buf; + ++len; + while (((c != '\'') && (c != '\0')) + || ((c == '\\') && (buf[1] == '\''))) { + if ((c == '\\') && (buf[1] == '\'')) { + ++buf; + ++len; + } + c = *++buf; + ++len; + } + c = *++buf; + ++len; + + // handle double quote + } else if (c == '"') { + c = *++buf; + ++len; + while (((c != '"') && (c != '\0')) + || ((c == '\\') && (buf[1] == '"'))) { + if ((c == '\\') && (buf[1] == '"')) { + ++buf; + ++len; + } + c = *++buf; + ++len; + } + c = *++buf; + ++len; + } + + // unquoted + while (1) { + if ((c == '\'') || (c == '"')) goto quoted; + // skip escaped quote + if ((c == '\\') && ((buf[1] == '\'') || (buf[1] == '"'))) { + ++buf; + ++len; + c = *++buf; + ++len; + } + if ((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n') + || (c == '\f') || (c == '\0')) { + list.push_back(text.substr(beg,len)); + beg += len; + break; + } + c = *++buf; + ++len; + } + } + return list; +} + /* ---------------------------------------------------------------------- Return whether string is a valid integer number ------------------------------------------------------------------------- */ diff --git a/src/utils.h b/src/utils.h index 91e5024121..e43be03a87 100644 --- a/src/utils.h +++ b/src/utils.h @@ -18,6 +18,7 @@ #include "lmptype.h" #include +#include #include namespace LAMMPS_NS { @@ -181,6 +182,20 @@ namespace LAMMPS_NS { */ size_t trim_and_count_words(const std::string & text, const std::string & separators = " \t\r\n\f"); + /** + * \brief Take text and split into non-whitespace words. + * + * This can handle single and double quotes, escaped quotes, + * and escaped codes within quotes, but due to using an STL + * container and STL strings is rather slow because of making + * copies. Designed for parsing command lines and similar text + * and not for time critical processing. Use a tokenizer for that. + * + * \param text string that should be split + * \return STL vector with the words + */ + std::vector split_words(const std::string &text); + /** * \brief Check if string can be converted to valid integer * \param text string that should be checked diff --git a/unittest/force-styles/CMakeLists.txt b/unittest/force-styles/CMakeLists.txt index aed715ee65..f68f58cd48 100644 --- a/unittest/force-styles/CMakeLists.txt +++ b/unittest/force-styles/CMakeLists.txt @@ -37,20 +37,15 @@ target_link_libraries(pair_style PRIVATE lammps style_tests) file(GLOB MOL_PAIR_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/mol-pair-*.yaml) foreach(TEST ${MOL_PAIR_TESTS}) string(REGEX REPLACE "^.*mol-pair-(.*)\.yaml" "MolPairStyle:\\1" TNAME ${TEST}) - add_test(NAME ${TNAME} - COMMAND ${CMAKE_COMMAND} -DTEST_EXECUTABLE=$ - -DTEST_INPUT=${TEST} -DTEST_NAME=${TNAME} -P ${CMAKE_CURRENT_SOURCE_DIR}/TestRunner.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME ${TNAME} COMMAND pair_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") endforeach() # tests for metal-like atomic systems and related pair styles file(GLOB ATOMIC_PAIR_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/atomic-pair-*.yaml) foreach(TEST ${ATOMIC_PAIR_TESTS}) string(REGEX REPLACE "^.*atomic-pair-(.*)\.yaml" "AtomicPairStyle:\\1" TNAME ${TEST}) - add_test(NAME ${TNAME} - COMMAND ${CMAKE_COMMAND} -DTEST_EXECUTABLE=$ - -DTEST_INPUT=${TEST} -DTEST_NAME=${TNAME} -P ${CMAKE_CURRENT_SOURCE_DIR}/TestRunner.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME ${TNAME} COMMAND pair_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") endforeach() @@ -58,10 +53,7 @@ endforeach() file(GLOB MANYBODY_PAIR_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/manybody-pair-*.yaml) foreach(TEST ${MANYBODY_PAIR_TESTS}) string(REGEX REPLACE "^.*manybody-pair-(.*)\.yaml" "ManybodyPairStyle:\\1" TNAME ${TEST}) - add_test(NAME ${TNAME} - COMMAND ${CMAKE_COMMAND} -DTEST_EXECUTABLE=$ - -DTEST_INPUT=${TEST} -DTEST_NAME=${TNAME} -P ${CMAKE_CURRENT_SOURCE_DIR}/TestRunner.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME ${TNAME} COMMAND pair_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") endforeach() @@ -72,10 +64,8 @@ target_link_libraries(bond_style PRIVATE lammps style_tests) file(GLOB BOND_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/bond-*.yaml) foreach(TEST ${BOND_TESTS}) string(REGEX REPLACE "^.*bond-(.*)\.yaml" "BondStyle:\\1" TNAME ${TEST}) - add_test(NAME ${TNAME} - COMMAND ${CMAKE_COMMAND} -DTEST_EXECUTABLE=$ - -DTEST_INPUT=${TEST} -DTEST_NAME=${TNAME} -P ${CMAKE_CURRENT_SOURCE_DIR}/TestRunner.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME ${TNAME} COMMAND bond_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") endforeach() # angle style tester @@ -85,8 +75,6 @@ target_link_libraries(angle_style PRIVATE lammps style_tests) file(GLOB ANGLE_TESTS LIST_DIRECTORIES false ${TEST_INPUT_FOLDER}/angle-*.yaml) foreach(TEST ${ANGLE_TESTS}) string(REGEX REPLACE "^.*angle-(.*)\.yaml" "AngleStyle:\\1" TNAME ${TEST}) - add_test(NAME ${TNAME} - COMMAND ${CMAKE_COMMAND} -DTEST_EXECUTABLE=$ - -DTEST_INPUT=${TEST} -DTEST_NAME=${TNAME} -P ${CMAKE_CURRENT_SOURCE_DIR}/TestRunner.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME ${TNAME} COMMAND angle_style ${TEST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_tests_properties(${TNAME} PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") endforeach() diff --git a/unittest/force-styles/TestRunner.cmake b/unittest/force-styles/TestRunner.cmake deleted file mode 100644 index 325704137c..0000000000 --- a/unittest/force-styles/TestRunner.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# workaround to allow passing extra arguments to test runs -# through ctest via a TEST_ARGS environment variable -# This can be used to, e.g. reset reference data for individual -# tests from the build folder with "env TEST_ARGS=-u ctest -R sometest" -execute_process(COMMAND ${TEST_EXECUTABLE} ${TEST_INPUT} $ENV{TEST_ARGS} RESULT_VARIABLE rv) -if(NOT "${rv}" STREQUAL "0") - message(FATAL_ERROR "Test ${TEST_NAME} failed with status ${rv}") -endif() diff --git a/unittest/force-styles/test_main.cpp b/unittest/force-styles/test_main.cpp index 6ff5194076..e9d08b61c4 100644 --- a/unittest/force-styles/test_main.cpp +++ b/unittest/force-styles/test_main.cpp @@ -17,9 +17,11 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include #include #include #include +#include // common read_yaml_file function bool read_yaml_file(const char *infile, TestConfig &config) @@ -76,6 +78,19 @@ int main(int argc, char **argv) return 2; } + // handle arguments passed via environment variable + std::vector env = utils::split_words(getenv("TEST_ARGS")); + for (auto arg : env) { + if (arg == "-u") { + generate_yaml_file(argv[1], test_config); + return 0; + } else if (arg == "-s") { + print_stats = true; + } else if (arg == "-v") { + verbose = true; + } + } + int iarg = 2; while (iarg < argc) { diff --git a/unittest/utils/test_utils.cpp b/unittest/utils/test_utils.cpp index ff73f2de22..c1312e7725 100644 --- a/unittest/utils/test_utils.cpp +++ b/unittest/utils/test_utils.cpp @@ -18,6 +18,7 @@ #include #include #include +#include using namespace LAMMPS_NS; using ::testing::Eq; @@ -48,6 +49,24 @@ TEST(Utils, count_words_with_extra_spaces) ASSERT_EQ(utils::count_words(" some text # comment "), 4); } +TEST(Utils, split_words_simple) +{ + std::vector list = utils::split_words("one two three"); + ASSERT_EQ(list.size(), 3); +} + +TEST(Utils, split_words_quoted) +{ + std::vector list = utils::split_words("one 'two' \"three\""); + ASSERT_EQ(list.size(), 3); +} + +TEST(Utils, split_words_escaped) +{ + std::vector list = utils::split_words("1\\' '\"two\"' 3\\\""); + ASSERT_EQ(list.size(), 3); +} + TEST(Utils, valid_integer1) { ASSERT_TRUE(utils::is_integer("10")); From 5ea9b1b38d439185db9f868205e55b0c5eb6ed9a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 09:33:19 -0400 Subject: [PATCH 47/54] simplify detection and application of valgrind suppressions --- cmake/Modules/Testing.cmake | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/cmake/Modules/Testing.cmake b/cmake/Modules/Testing.cmake index f46043d7e7..05e3f12e3d 100644 --- a/cmake/Modules/Testing.cmake +++ b/cmake/Modules/Testing.cmake @@ -5,18 +5,10 @@ option(ENABLE_TESTING "Enable testing" OFF) if(ENABLE_TESTING) find_program(VALGRIND_BINARY NAMES valgrind) set(VALGRIND_DEFAULT_OPTIONS "--leak-check=full --show-leak-kinds=all --track-origins=yes") - - if(BUILD_MPI) - set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${LAMMPS_TOOLS_DIR}/valgrind/OpenMP.supp") - endif() - - if(BUILD_OMP) - set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${LAMMPS_TOOLS_DIR}/valgrind/OpenMP.supp") - endif() - - if(PKG_PYTHON) - set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${LAMMPS_TOOLS_DIR}/valgrind/Python3.supp") - endif() + file(GLOB VALGRIND_SUPPRESSION_FILES ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp) + foreach(SUPP ${VALLGRIND_SUPPRESSION_FILES}) + set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${SUPP}") + endforeach() set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command") set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options") From 6824b69ae9d07dca65abe3e12e3916196b475f3e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 09:34:40 -0400 Subject: [PATCH 48/54] add missing include --- unittest/force-styles/test_main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/test_main.cpp b/unittest/force-styles/test_main.cpp index e9d08b61c4..62ddc2c32e 100644 --- a/unittest/force-styles/test_main.cpp +++ b/unittest/force-styles/test_main.cpp @@ -14,6 +14,7 @@ #include "test_main.h" #include "test_config.h" #include "test_config_reader.h" +#include "utils.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -23,6 +24,8 @@ #include #include +using LAMMPS_NS::utils::split_words; + // common read_yaml_file function bool read_yaml_file(const char *infile, TestConfig &config) { @@ -79,7 +82,7 @@ int main(int argc, char **argv) } // handle arguments passed via environment variable - std::vector env = utils::split_words(getenv("TEST_ARGS")); + std::vector env = split_words(getenv("TEST_ARGS")); for (auto arg : env) { if (arg == "-u") { generate_yaml_file(argv[1], test_config); From 2af8d7a751cc0edf1beafad2f75cfc79f0d4ff54 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 09:53:56 -0400 Subject: [PATCH 49/54] add argument passing via TEST_ARGS environment variable to all tests with an explicit main function --- unittest/commands/test_simple_commands.cpp | 13 ++++++++++++ unittest/force-styles/test_main.cpp | 20 ++++++++++--------- unittest/formats/test_atom_styles.cpp | 12 +++++++++++ .../test_eim_potential_file_reader.cpp | 12 +++++++++++ .../formats/test_potential_file_reader.cpp | 11 ++++++++++ 5 files changed, 59 insertions(+), 9 deletions(-) diff --git a/unittest/commands/test_simple_commands.cpp b/unittest/commands/test_simple_commands.cpp index 1f5d4b5493..d425bb1555 100644 --- a/unittest/commands/test_simple_commands.cpp +++ b/unittest/commands/test_simple_commands.cpp @@ -26,6 +26,8 @@ // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; +using LAMMPS_NS::utils::split_words; + namespace LAMMPS_NS { using ::testing::Eq; @@ -127,6 +129,17 @@ int main(int argc, char **argv) { MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); + + // handle arguments passed via environment variable + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = split_words(var); + for (auto arg : env) { + if (arg == "-v") { + verbose = true; + } + } + } + if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; int rv = RUN_ALL_TESTS(); diff --git a/unittest/force-styles/test_main.cpp b/unittest/force-styles/test_main.cpp index 62ddc2c32e..3e991b26ad 100644 --- a/unittest/force-styles/test_main.cpp +++ b/unittest/force-styles/test_main.cpp @@ -82,15 +82,17 @@ int main(int argc, char **argv) } // handle arguments passed via environment variable - std::vector env = split_words(getenv("TEST_ARGS")); - for (auto arg : env) { - if (arg == "-u") { - generate_yaml_file(argv[1], test_config); - return 0; - } else if (arg == "-s") { - print_stats = true; - } else if (arg == "-v") { - verbose = true; + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = split_words(var); + for (auto arg : env) { + if (arg == "-u") { + generate_yaml_file(argv[1], test_config); + return 0; + } else if (arg == "-s") { + print_stats = true; + } else if (arg == "-v") { + verbose = true; + } } } diff --git a/unittest/formats/test_atom_styles.cpp b/unittest/formats/test_atom_styles.cpp index b7feedc728..a405a240aa 100644 --- a/unittest/formats/test_atom_styles.cpp +++ b/unittest/formats/test_atom_styles.cpp @@ -38,6 +38,8 @@ #define GETIDX(i) lmp->atom->map(i) +using LAMMPS_NS::utils::split_words; + // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; @@ -1167,6 +1169,16 @@ int main(int argc, char **argv) { MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); + + // handle arguments passed via environment variable + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = split_words(var); + for (auto arg : env) { + if (arg == "-v") { + verbose = true; + } + } + } if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; int rv = RUN_ALL_TESTS(); diff --git a/unittest/formats/test_eim_potential_file_reader.cpp b/unittest/formats/test_eim_potential_file_reader.cpp index bf0d9ba8dd..2c192bbd06 100644 --- a/unittest/formats/test_eim_potential_file_reader.cpp +++ b/unittest/formats/test_eim_potential_file_reader.cpp @@ -23,6 +23,7 @@ #include using namespace LAMMPS_NS; +using utils::split_words; // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; @@ -208,6 +209,17 @@ int main(int argc, char **argv) { MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); + + // handle arguments passed via environment variable + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = split_words(var); + for (auto arg : env) { + if (arg == "-v") { + verbose = true; + } + } + } + if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; int rv = RUN_ALL_TESTS(); diff --git a/unittest/formats/test_potential_file_reader.cpp b/unittest/formats/test_potential_file_reader.cpp index d168ca22c0..54dc26e4dc 100644 --- a/unittest/formats/test_potential_file_reader.cpp +++ b/unittest/formats/test_potential_file_reader.cpp @@ -34,6 +34,7 @@ #include using namespace LAMMPS_NS; +using utils::split_words; // whether to print verbose output (i.e. not capturing LAMMPS screen output). bool verbose = false; @@ -198,6 +199,16 @@ int main(int argc, char **argv) { MPI_Init(&argc, &argv); ::testing::InitGoogleMock(&argc, argv); + + // handle arguments passed via environment variable + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = split_words(var); + for (auto arg : env) { + if (arg == "-v") { + verbose = true; + } + } + } if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; int rv = RUN_ALL_TESTS(); From 57538fb91cce96dea0a569177ccb596ca47e30b8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 13:34:47 -0400 Subject: [PATCH 50/54] add leak sanitizer option --- cmake/CMakeLists.txt | 4 ++-- doc/src/Build_development.rst | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e5dc5b194d..d84761de42 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -256,9 +256,9 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") endif() endif() -set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, thread, undefined)") +set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)") mark_as_advanced(ENABLE_SANITIZER) -set(ENABLE_SANITIZER_VALUES none address thread undefined) +set(ENABLE_SANITIZER_VALUES none address leak thread undefined) set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES}) validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES) string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER) diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index deb9d5b3cb..f86084acb5 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -52,6 +52,7 @@ compilation and linking stages. This is done through setting the -D ENABLE_SANITIZER=none # no sanitizer active (default) -D ENABLE_SANITIZER=address # enable address sanitizer / memory leak checker + -D ENABLE_SANITIZER=leak # enable memory leak checker (only) -D ENABLE_SANITIZER=undefined # enable undefined behavior sanitizer -D ENABLE_SANITIZER=thread # enable thread sanitizer From 3525d1f104c66a607bb2d4c3d8fc85e0730f2eb8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 13:35:36 -0400 Subject: [PATCH 51/54] simplify suppression handling by creating a custom local file --- cmake/Modules/Testing.cmake | 9 ++++++--- doc/src/Build_development.rst | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/Testing.cmake b/cmake/Modules/Testing.cmake index 05e3f12e3d..a36067938f 100644 --- a/cmake/Modules/Testing.cmake +++ b/cmake/Modules/Testing.cmake @@ -4,11 +4,14 @@ option(ENABLE_TESTING "Enable testing" OFF) if(ENABLE_TESTING) find_program(VALGRIND_BINARY NAMES valgrind) - set(VALGRIND_DEFAULT_OPTIONS "--leak-check=full --show-leak-kinds=all --track-origins=yes") + # generate custom suppression file + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "\n") file(GLOB VALGRIND_SUPPRESSION_FILES ${LAMMPS_TOOLS_DIR}/valgrind/[^.]*.supp) - foreach(SUPP ${VALLGRIND_SUPPRESSION_FILES}) - set(VALGRIND_DEFAULT_OPTIONS "${VALGRIND_DEFAULT_OPTIONS} --suppressions=${SUPP}") + foreach(SUPP ${VALGRIND_SUPPRESSION_FILES}) + file(READ ${SUPP} SUPPRESSIONS) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/lammps.supp "${SUPPRESSIONS}") endforeach() + set(VALGRIND_DEFAULT_OPTIONS "--leak-check=full --show-leak-kinds=all --track-origins=yes --suppressions=${CMAKE_BINARY_DIR}/lammps.supp") set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command") set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options") diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index f86084acb5..09eca00c69 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -122,6 +122,8 @@ The ``ctest`` command has many options, the most important ones are: - exclude subset of tests matching the regular expression * - -N - dry-run: display list of tests without running them + * - -T memcheck + - run tests with valgrind memory checker (if available) In its full implementation, the unit test framework will consist of multiple kinds of tests implemented in different programming languages (C++, C, Python, From 3e39b8c62d3741d4de8d58e5d6c67d36296e1215 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 17:23:20 -0400 Subject: [PATCH 52/54] make sure class pointers are initialized to NULL and virial accumulator. --- src/angle.cpp | 1 + src/angle_hybrid.cpp | 3 +++ src/bond.cpp | 1 + src/bond_hybrid.cpp | 3 +++ 4 files changed, 8 insertions(+) diff --git a/src/angle.cpp b/src/angle.cpp index ee7e855782..2796ae01b7 100644 --- a/src/angle.cpp +++ b/src/angle.cpp @@ -29,6 +29,7 @@ using namespace MathConst; Angle::Angle(LAMMPS *lmp) : Pointers(lmp) { energy = 0.0; + virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0; writedata = 1; allocated = 0; diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 7c0cbd3008..52cc685684 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -33,6 +33,9 @@ AngleHybrid::AngleHybrid(LAMMPS *lmp) : Angle(lmp) { writedata = 0; nstyles = 0; + nanglelist = nullptr; + maxangle = nullptr; + anglelist = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/bond.cpp b/src/bond.cpp index 82da29f60d..0fb42da98a 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -39,6 +39,7 @@ enum{NONE,LINEAR,SPLINE}; Bond::Bond(LAMMPS *lmp) : Pointers(lmp) { energy = 0.0; + virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0; writedata = 1; allocated = 0; diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index c66d2c1425..70d0883836 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -34,6 +34,9 @@ BondHybrid::BondHybrid(LAMMPS *lmp) : Bond(lmp) writedata = 0; nstyles = 0; has_quartic = -1; + nbondlist = nullptr; + maxbond = nullptr; + bondlist = nullptr; } /* ---------------------------------------------------------------------- */ From 5a2704efc24152ca7d7b202975945f6d084a5fff Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 17:24:47 -0400 Subject: [PATCH 53/54] ensure that local per-thread storage is completely cleared in hybrid styles. --- src/angle_hybrid.cpp | 12 ++++++++++++ src/bond_hybrid.cpp | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 52cc685684..882749b6b2 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -108,6 +108,18 @@ void AngleHybrid::compute(int eflag, int vflag) ev_init(eflag,vflag); + // need to clear per-thread storage here, when using multiple threads + // with thread-enabled substyles to avoid uninitlialized data access. + + const int nthreads = comm->nthreads; + if (comm->nthreads > 1) { + const int nall = atom->nlocal + atom->nghost; + if (eflag_atom) + memset(&eatom[0],0,nall*nthreads*sizeof(double)); + if (vflag_atom) + memset(&vatom[0][0],0,6*nall*nthreads*sizeof(double)); + } + for (m = 0; m < nstyles; m++) { neighbor->nanglelist = nanglelist[m]; neighbor->anglelist = anglelist[m]; diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 70d0883836..aadc25987a 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -108,6 +108,18 @@ void BondHybrid::compute(int eflag, int vflag) ev_init(eflag,vflag); + // need to clear per-thread storage once here, when using multiple threads + // with thread-enabled substyles to avoid uninitlialized data access. + + const int nthreads = comm->nthreads; + if (nthreads > 1) { + const int nall = atom->nlocal + atom->nghost; + if (eflag_atom) + memset(&eatom[0],0,nall*nthreads*sizeof(double)); + if (vflag_atom) + memset(&vatom[0][0],0,6*nall*nthreads*sizeof(double)); + } + for (m = 0; m < nstyles; m++) { neighbor->nbondlist = nbondlist[m]; neighbor->bondlist = bondlist[m]; From fdf728203060aaaef272f69e26806cc2eeb75197 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jun 2020 17:38:39 -0400 Subject: [PATCH 54/54] simplify output creation --- src/thermo.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/thermo.cpp b/src/thermo.cpp index fcc61be503..ea476dda04 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -313,15 +313,9 @@ void Thermo::header() { if (lineflag == MULTILINE) return; - int loc = 0; - for (int i = 0; i < nfield; i++) - loc += sprintf(&line[loc],"%s ",keyword[i]); - sprintf(&line[loc],"\n"); - - if (me == 0) { - if (screen) fprintf(screen,"%s",line); - if (logfile) fprintf(logfile,"%s",line); - } + std::string hdr; + for (int i = 0; i < nfield; i++) hdr += keyword[i] + std::string(" "); + if (me == 0) utils::logmesg(lmp,hdr); } /* ---------------------------------------------------------------------- */ @@ -385,11 +379,8 @@ void Thermo::compute(int flag) // print line to screen and logfile if (me == 0) { - if (screen) fprintf(screen,"%s",line); - if (logfile) { - fprintf(logfile,"%s",line); - if (flushflag) fflush(logfile); - } + utils::logmesg(lmp,line); + if (logfile && flushflag) fflush(logfile); } // set to 1, so that subsequent invocations of CPU time will be non-zero