Commit 29dcdec8 authored by Dan Stefan Bolintineanu's avatar Dan Stefan Bolintineanu
Browse files

Separated templated pair granular from pair granular/multi

parent 18f8f68e
Loading
Loading
Loading
Loading
+874 −195

File changed.

Preview size limit exceeded, changes collapsed.

+22 −11
Original line number Diff line number Diff line
@@ -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;
+1837 −0

File added.

Preview size limit exceeded, changes collapsed.

+108 −0
Original line number Diff line number Diff line
/* ----------------------------------------------------------
   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.

 */
+5 −3
Original line number Diff line number Diff line
@@ -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;

Loading