Separated templated pair granular from pair granular/multi

This commit is contained in:
Dan Stefan Bolintineanu 2019-01-10 16:53:50 -07:00
parent 18f8f68e67
commit 29dcdec875
6 changed files with 2850 additions and 209 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,19 @@ class PairGranular : public Pair {
public:
PairGranular(class LAMMPS *);
virtual ~PairGranular();
virtual void compute(int, int);
void compute(int, int);
// comment next line to turn off templating
#define TEMPLATED_PAIR_GRANULAR
#ifdef TEMPLATED_PAIR_GRANULAR
template < int Tp_normal, int Tp_damping, int Tp_tangential,
int Tp_roll, int Tp_twist>
void compute_templated(int, int);
#else
void compute_untemplated(int, int, int, int, int,
int, int);
#endif
virtual void settings(int, char **);
virtual void coeff(int, char **);
void init_style();
@ -61,28 +73,27 @@ public:
int nmax; // allocated size of mass_rigid
virtual void allocate();
int beyond_contact;
int nondefault_history_transfer;
private:
int size_history;
//Per-type models
int **normal, **damping, **tangential, **roll, **twist;
int normal_global, damping_global;
int tangential_global, roll_global, twist_global;
//Models
int normal, damping, tangential, roll, twist;
//History flags
int tangential_history, roll_history, twist_history;
int tangential_history_index;
int roll_history_index;
int twist_history_index;
//Indices of history entries
int tangential_history_index, roll_history_index, twist_history_index;
//Coefficients declared in pair style command, used as default unless
// overwritten in pair coeff command
double *normal_coeffs_global;
double *tangential_coeffs_global;
double *roll_coeffs_global;
double *twist_coeffs_global;
//Per-type coefficients declared in pair coeff command
double ***normal_coeffs;
double ***tangential_coeffs;
double ***roll_coeffs;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
/* ----------------------------------------------------------
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(granular/multi,PairGranularMulti)
#else
#ifndef LMP_PAIR_GRANULAR_MULTI_H
#define LMP_PAIR_GRANULAR_MULTI_H
#include "pair.h"
namespace LAMMPS_NS {
class PairGranularMulti : public Pair {
public:
PairGranularMulti(class LAMMPS *);
virtual ~PairGranularMulti();
virtual void compute(int, int);
virtual void settings(int, char **);
virtual void coeff(int, char **);
void init_style();
double init_one(int, int);
void write_restart(FILE *);
void read_restart(FILE *);
void reset_dt();
virtual double single(int, int, int, int, double, double, double, double &);
int pack_forward_comm(int, int *, double *, int, int *);
void unpack_forward_comm(int, int, double *);
double memory_usage();
protected:
double cut_global;
double dt;
int freeze_group_bit;
int use_history;
int neighprev;
double *onerad_dynamic,*onerad_frozen;
double *maxrad_dynamic,*maxrad_frozen;
double **cut;
class FixNeighHistory *fix_history;
// storage of rigid body masses for use in granular interactions
class Fix *fix_rigid; // ptr to rigid body fix, NULL if none
double *mass_rigid; // rigid mass for owned+ghost atoms
int nmax; // allocated size of mass_rigid
virtual void allocate();
private:
int size_history;
//Per-type models
int **normal, **damping, **tangential, **roll, **twist;
int normal_global, damping_global;
int tangential_global, roll_global, twist_global;
int tangential_history, roll_history, twist_history;
int tangential_history_index;
int roll_history_index;
int twist_history_index;
double *normal_coeffs_global;
double *tangential_coeffs_global;
double *roll_coeffs_global;
double *twist_coeffs_global;
double ***normal_coeffs;
double ***tangential_coeffs;
double ***roll_coeffs;
double ***twist_coeffs;
double mix_stiffnessE(double Eii, double Ejj, double Gii, double Gjj);
double mix_stiffnessG(double Eii, double Ejj, double Gii, double Gjj);
double mix_geom(double valii, double valjj);
double pulloff_distance(double radius, int itype);
};
}
#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.
*/

View File

@ -408,7 +408,8 @@ void FixNeighHistory::pre_exchange_newton()
m = npartner[j]++;
partner[j][m] = tag[i];
jvalues = &valuepartner[j][dnum*m];
for (n = 0; n < dnum; n++) jvalues[n] = -onevalues[n];
if (pair->nondefault_history_transfer) pair->transfer_history(onevalues, jvalues);
else for (n = 0; n < dnum; n++) jvalues[n] = -onevalues[n];
}
}
}
@ -520,7 +521,8 @@ void FixNeighHistory::pre_exchange_no_newton()
m = npartner[j]++;
partner[j][m] = tag[i];
jvalues = &valuepartner[j][dnum*m];
for (n = 0; n < dnum; n++) jvalues[n] = -onevalues[n];
if (pair->nondefault_history_transfer) pair->transfer_history(onevalues, jvalues);
else for (n = 0; n < dnum; n++) jvalues[n] = -onevalues[n];
}
}
}
@ -604,7 +606,7 @@ void FixNeighHistory::post_neighbor()
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
rflag = sbmask(j);
rflag = sbmask(j) | pair->beyond_contact;
j &= NEIGHMASK;
jlist[jj] = j;

View File

@ -98,6 +98,8 @@ class Pair : protected Pointers {
enum{GEOMETRIC,ARITHMETIC,SIXTHPOWER}; // mixing options
int beyond_contact, nondefault_history_transfer; //for granular styles
// KOKKOS host/device flag and data masks
ExecutionSpace execution_space;
@ -180,6 +182,7 @@ class Pair : protected Pointers {
virtual void min_xf_pointers(int, double **, double **) {}
virtual void min_xf_get(int) {}
virtual void min_x_set(int) {}
virtual void transfer_history(double *, double*) {}
// management of callbacks to be run from ev_tally()
@ -202,6 +205,7 @@ class Pair : protected Pointers {
double tabinner; // inner cutoff for Coulomb table
double tabinner_disp; // inner cutoff for dispersion table
public:
// custom data type for accessing Coulomb tables