Unverified Commit 9a36fac3 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

Merge branch 'collected-small-changes' into progguide

parents bcb67444 729cc81f
Loading
Loading
Loading
Loading

.github/codecov.yml

0 → 100644
+29 −0
Original line number Diff line number Diff line
comment: false
coverage:
  notify:
    slack:
      default:
        url: "secret:HWZbvgtc6OD7F3v3PfrK3/rzCJvScbh69Fi1CkLwuHK0+wIBIHVR+Q5i7q6F9Ln4OChbiRGtYAEUUsT8/jmBu4qDpIi8mx746codc0z/Z3aafLd24pBrCEPLvdCfIZxqPnw3TuUgGhwmMDZf0+thg8YNUr/MbOZ7Li2L6+ZbYuA="
        threshold: 10%
        only_pulls: false
        branches:
          - "master"
        flags:
          - "unit"
        paths:
          - "src"
  status:
    project:
        default:
            branches:
              - "master"
            paths:
              - "src"
            informational: true
    patch:
        default:
            branches:
              - "master"
            paths:
              - "src"
            informational: true
+18 −0
Original line number Diff line number Diff line
@@ -118,6 +118,24 @@ Doc page with :doc:`ERROR messages <Errors_messages>`
   incorrect periodic images of atoms in interaction lists.  To avoid, either use
   :doc:`pair style zero <pair_zero>` with a suitable cutoff or use :doc:`comm_modify cutoff <comm_modify>`.

*Communication cutoff is shorter than a bond length based estimate. This may lead to errors.*

   Since LAMMPS stores topology data with individual atoms, all atoms
   comprising a bond, angle, dihedral or improper must be present on any
   sub-domain that "owns" the atom with the information, either as a
   local or a ghost atom. The communication cutoff is what determines up
   to what distance from a sub-domain boundary ghost atoms are created.
   The communication cutoff is by default the largest non-bonded cutoff
   plus the neighbor skin distance, but for short or non-bonded cutoffs
   and/or long bonds, this may not be sufficient. This warning indicates
   that there is an increased risk of a simulation stopping unexpectedly
   because of Bond/Angle/Dihedral/Improper atoms missing.  It can be
   silenced by manually setting the communication cutoff via
   :doc:`comm_modify cutoff <comm_modify>`.  However, since the
   heuristic used to determine the estimate is not always accurate, it
   is not changed automatically and the warning may be ignored depending
   on the specific system being simulated.

*Communication cutoff is too small for SNAP micro load balancing, increased to %lf*
   Self-explanatory.

+38 −14
Original line number Diff line number Diff line
@@ -32,11 +32,11 @@ using namespace LAMMPS_NS;

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

PairLJ_AB_MDF::PairLJ_AB_MDF(LAMMPS *lmp) : Pair(lmp) {}
PairLennardMDF::PairLennardMDF(LAMMPS *lmp) : Pair(lmp) {}

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

PairLJ_AB_MDF::~PairLJ_AB_MDF()
PairLennardMDF::~PairLennardMDF()
{
  if (allocated) {
    memory->destroy(setflag);
@@ -56,7 +56,7 @@ PairLJ_AB_MDF::~PairLJ_AB_MDF()

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

void PairLJ_AB_MDF::compute(int eflag, int vflag)
void PairLennardMDF::compute(int eflag, int vflag)
{
  int i,j,ii,jj,inum,jnum,itype,jtype;
  double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
@@ -153,7 +153,7 @@ void PairLJ_AB_MDF::compute(int eflag, int vflag)
   allocate all arrays
------------------------------------------------------------------------- */

void PairLJ_AB_MDF::allocate()
void PairLennardMDF::allocate()
{
  allocated = 1;
  int n = atom->ntypes;
@@ -180,7 +180,7 @@ void PairLJ_AB_MDF::allocate()
   global settings
------------------------------------------------------------------------- */

void PairLJ_AB_MDF::settings(int narg, char **arg)
void PairLennardMDF::settings(int narg, char **arg)
{
  if (narg != 2) error->all(FLERR,"Illegal pair_style command");

@@ -207,7 +207,7 @@ void PairLJ_AB_MDF::settings(int narg, char **arg)
   set coeffs for one or more type pairs
------------------------------------------------------------------------- */

void PairLJ_AB_MDF::coeff(int narg, char **arg)
void PairLennardMDF::coeff(int narg, char **arg)
{
  if (narg != 4 && narg != 6)
    error->all(FLERR,"Incorrect args for pair coefficients");
@@ -248,7 +248,7 @@ void PairLJ_AB_MDF::coeff(int narg, char **arg)
   init for one type pair i,j and corresponding j,i
------------------------------------------------------------------------- */

double PairLJ_AB_MDF::init_one(int i, int j)
double PairLennardMDF::init_one(int i, int j)
{
  if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");

@@ -259,6 +259,7 @@ double PairLJ_AB_MDF::init_one(int i, int j)
  lj3[i][j] = aparm[i][j];
  lj4[i][j] = bparm[i][j];

  cut[j][i] = cut[i][j];
  cut_inner[j][i] = cut_inner[i][j];
  cut_inner_sq[j][i] = cut_inner_sq[i][j];
  lj1[j][i] = lj1[i][j];
@@ -273,7 +274,7 @@ double PairLJ_AB_MDF::init_one(int i, int j)
  proc 0 writes to restart file
------------------------------------------------------------------------- */

void PairLJ_AB_MDF::write_restart(FILE *fp)
void PairLennardMDF::write_restart(FILE *fp)
{
  write_restart_settings(fp);

@@ -294,7 +295,7 @@ void PairLJ_AB_MDF::write_restart(FILE *fp)
  proc 0 reads from restart file, bcasts
------------------------------------------------------------------------- */

void PairLJ_AB_MDF::read_restart(FILE *fp)
void PairLennardMDF::read_restart(FILE *fp)
{
  read_restart_settings(fp);
  allocate();
@@ -324,7 +325,7 @@ void PairLJ_AB_MDF::read_restart(FILE *fp)
  proc 0 writes to restart file
------------------------------------------------------------------------- */

void PairLJ_AB_MDF::write_restart_settings(FILE *fp)
void PairLennardMDF::write_restart_settings(FILE *fp)
{
  fwrite(&mix_flag,sizeof(int),1,fp);
}
@@ -333,7 +334,7 @@ void PairLJ_AB_MDF::write_restart_settings(FILE *fp)
  proc 0 reads from restart file, bcasts
------------------------------------------------------------------------- */

void PairLJ_AB_MDF::read_restart_settings(FILE *fp)
void PairLennardMDF::read_restart_settings(FILE *fp)
{
  int me = comm->me;
  if (me == 0) {
@@ -342,9 +343,32 @@ void PairLJ_AB_MDF::read_restart_settings(FILE *fp)
  MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
}

/* ----------------------------------------------------------------------
   proc 0 writes to data file
------------------------------------------------------------------------- */

void PairLennardMDF::write_data(FILE *fp)
{
  for (int i = 1; i <= atom->ntypes; i++)
    fprintf(fp,"%d %g %g\n",i,aparm[i][i],bparm[i][i]);
}

/* ----------------------------------------------------------------------
   proc 0 writes all pairs to data file
------------------------------------------------------------------------- */

void PairLennardMDF::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 %g %g\n",
              i,j,aparm[i][j],bparm[i][j],
              cut_inner[i][j],cut[i][j]);
}

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

double PairLJ_AB_MDF::single(int /*i*/, int /*j*/, int itype, int jtype,
double PairLennardMDF::single(int /*i*/, int /*j*/, int itype, int jtype,
                             double rsq,
                             double /*factor_coul*/, double factor_lj,
                             double &fforce)
@@ -368,7 +392,7 @@ double PairLJ_AB_MDF::single(int /*i*/, int /*j*/, int itype, int jtype,
    dt = 30.* d*d * dd*dd * rr / dp;

    forcelj = forcelj*tt + philj*dt;
    philj *= dt;
    philj *= tt;
  }

  fforce = factor_lj*forcelj*r2inv;
@@ -378,7 +402,7 @@ double PairLJ_AB_MDF::single(int /*i*/, int /*j*/, int itype, int jtype,

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

void *PairLJ_AB_MDF::extract(const char *str, int &dim)
void *PairLennardMDF::extract(const char *str, int &dim)
{
  dim = 2;
  if (strcmp(str,"a") == 0) return (void *) aparm;
+8 −6
Original line number Diff line number Diff line
@@ -13,21 +13,21 @@

#ifdef PAIR_CLASS

PairStyle(lennard/mdf,PairLJ_AB_MDF)
PairStyle(lennard/mdf,PairLennardMDF)

#else

#ifndef LMP_PAIR_LJ_AB_MDF_H
#define LMP_PAIR_LJ_AB_MDF_H
#ifndef LMP_PAIR_LENNARD_MDF_H
#define LMP_PAIR_LENNARD_MDF_H

#include "pair.h"

namespace LAMMPS_NS {

class PairLJ_AB_MDF : public Pair {
class PairLennardMDF : public Pair {
 public:
  PairLJ_AB_MDF(class LAMMPS *);
  virtual ~PairLJ_AB_MDF();
  PairLennardMDF(class LAMMPS *);
  virtual ~PairLennardMDF();

  virtual void compute(int, int);
  void settings(int, char **);
@@ -37,6 +37,8 @@ class PairLJ_AB_MDF : public Pair {
  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 &);
  void *extract(const char *, int &);

+48 −63
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "reaxc_lookup.h"
#include "reaxc_tool_box.h"
#include "error.h"
#include "fmt/format.h"

// Functions defined in reaxc_init_md.cpp
extern int Init_MPI_Datatypes(reax_system*, storage*, mpi_datatypes*, MPI_Comm, char*);
@@ -55,6 +56,7 @@ int Init_ListsOMP(reax_system *system, control_params *control,
  int mincap = system->mincap;
  double safezone = system->safezone;
  double saferzone = system->saferzone;
  LAMMPS_NS::Error *error = system->error_ptr;

  bond_top = (int*) calloc(system->total_cap, sizeof(int));
  hb_top = (int*) calloc(system->local_cap, sizeof(int));
@@ -72,7 +74,7 @@ int Init_ListsOMP(reax_system *system, control_params *control,

    if(!Make_List(system->Hcap, total_hbonds, TYP_HBOND,
                    *lists+HBONDS)) {
      system->error_ptr->one( FLERR, "Not enough space for hbonds list. Terminating!" );
      error->one(FLERR, "Not enough space for hbonds list. Terminating!");
    }
  }

@@ -85,7 +87,7 @@ int Init_ListsOMP(reax_system *system, control_params *control,

  if(!Make_List(system->total_cap, bond_cap, TYP_BOND,
                  *lists+BONDS)) {
    system->error_ptr->one( FLERR, "Not enough space for bonds list. Terminating!\n" );
    error->one(FLERR, "Not enough space for bonds list. Terminating!\n");
  }

  int nthreads = control->nthreads;
@@ -93,14 +95,14 @@ int Init_ListsOMP(reax_system *system, control_params *control,

  for (i = 0; i < bonds->num_intrs; ++i)
    bonds->select.bond_list[i].bo_data.CdboReduction =
      (double*) smalloc(system->error_ptr, sizeof(double)*nthreads, "CdboReduction");
      (double*) smalloc(error, sizeof(double)*nthreads, "CdboReduction");

  /* 3bodies list */
  cap_3body = (int)(MAX(num_3body*safezone, MIN_3BODIES));
  if(!Make_List(bond_cap, cap_3body, TYP_THREE_BODY,
                  *lists+THREE_BODIES)){

    system->error_ptr->one( FLERR, "Problem in initializing angles list. Terminating!" );
    error->one(FLERR, "Problem in initializing angles list. Terminating!");
  }

  free(hb_top);
@@ -118,53 +120,36 @@ void InitializeOMP( reax_system *system, control_params *control,
                 mpi_datatypes *mpi_data, MPI_Comm comm)
{
  char msg[MAX_STR];
  char errmsg[512];
  LAMMPS_NS::Error *error = system->error_ptr;

  if (Init_MPI_Datatypes(system,workspace,mpi_data,comm,msg) == FAILURE)
    error->one(FLERR,"init_mpi_datatypes: could not create datatypes. "
               "Mpi_data could not be initialized! Terminating.");

  if (Init_MPI_Datatypes(system, workspace, mpi_data, comm, msg) == FAILURE) {
    system->error_ptr->one( FLERR, "init_mpi_datatypes: could not create datatypes. "
    "Mpi_data couldn't be initialized! Terminating.");
  }

  if (Init_System(system, control, msg) == FAILURE) {
    snprintf( errmsg, 512, "Error on: %s. "
    "System could not be initialized! Terminating.", msg );
    system->error_ptr->one(FLERR, errmsg);
  }

  if (Init_Simulation_Data( system, control, data, msg ) == FAILURE) {
    snprintf( errmsg, 512, "Error on: %s. "
    "Sim_data couldn't be initialized! Terminating.", msg );
    system->error_ptr->one(FLERR, errmsg);
  }
  if (Init_System(system,control,msg) == FAILURE)
    error->one(FLERR,fmt::format("Error on: {}. System could not be "
                                  "initialized! Terminating.",msg));

  if (Init_Workspace( system, control, workspace, msg ) ==
      FAILURE) {
    system->error_ptr->one(FLERR, "init_workspace: not enough memory. "
    "Workspace couldn't be initialized! Terminating.");
  }
  if (Init_Simulation_Data(system,control,data,msg) == FAILURE)
    error->one(FLERR,fmt::format("Error on: {}. Sim_data could not be "
                                  "initialized! Terminating.",msg));

  if (Init_ListsOMP( system, control, data, workspace, lists, mpi_data, msg ) ==
      FAILURE) {
      snprintf( errmsg, 512, "Error on: %s. "
      "System could not be initialized! Terminating.", msg );
      system->error_ptr->one(FLERR, errmsg);
    }
  if (Init_Workspace(system,control,workspace,msg) == FAILURE)
    error->one(FLERR,"init_workspace: not enough memory. "
               "Workspace could not be initialized. Terminating.");

  if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) {
    snprintf( errmsg, 512, "Error on: %s"
    "Could not open output files! Terminating.", msg );
    system->error_ptr->one(FLERR, errmsg);
  }
  if (Init_ListsOMP(system,control,data,workspace,lists,mpi_data,msg) == FAILURE)
    error->one(FLERR,fmt::format("Error on: {}. System could not be "
                                  "initialized. Terminating.",msg));

  if (control->tabulate) {
    if (Init_Lookup_Tables( system, control, workspace, mpi_data, msg ) == FAILURE) {
      snprintf( errmsg, 512, "Error on: %s."
      " Couldn't create lookup table! Terminating.", msg );
      system->error_ptr->one(FLERR, errmsg);
    }
  }
  if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE)
    error->one(FLERR,fmt::format("Error on: {}. Could not open output files! "
                                  "Terminating.",msg));

  if (control->tabulate)
    if (Init_Lookup_Tables(system,control,workspace,mpi_data,msg) == FAILURE)
      error->one(FLERR,fmt::format("Error on: {}. Could not create lookup "
                                    "table. Terminating.",msg));

  Init_Force_FunctionsOMP(control);
}
Loading