1 /* ----------------------------------------------------------------------
2     This is the
3 
4     ██╗     ██╗ ██████╗  ██████╗  ██████╗ ██╗  ██╗████████╗███████╗
5     ██║     ██║██╔════╝ ██╔════╝ ██╔════╝ ██║  ██║╚══██╔══╝██╔════╝
6     ██║     ██║██║  ███╗██║  ███╗██║  ███╗███████║   ██║   ███████╗
7     ██║     ██║██║   ██║██║   ██║██║   ██║██╔══██║   ██║   ╚════██║
8     ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║  ██║   ██║   ███████║
9     ╚══════╝╚═╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝®
10 
11     DEM simulation engine, released by
12     DCS Computing Gmbh, Linz, Austria
13     http://www.dcs-computing.com, office@dcs-computing.com
14 
15     LIGGGHTS® is part of CFDEM®project:
16     http://www.liggghts.com | http://www.cfdem.com
17 
18     Core developer and main author:
19     Christoph Kloss, christoph.kloss@dcs-computing.com
20 
21     LIGGGHTS® is open-source, distributed under the terms of the GNU Public
22     License, version 2 or later. It is distributed in the hope that it will
23     be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
24     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
25     received a copy of the GNU General Public License along with LIGGGHTS®.
26     If not, see http://www.gnu.org/licenses . See also top-level README
27     and LICENSE files.
28 
29     LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
30     the producer of the LIGGGHTS® software and the CFDEM®coupling software
31     See http://www.cfdem.com/terms-trademark-policy for details.
32 
33 -------------------------------------------------------------------------
34     Contributing author and copyright for this file:
35     This file is from LAMMPS, but has been modified. Copyright for
36     modification:
37 
38     Copyright 2012-     DCS Computing GmbH, Linz
39     Copyright 2009-2012 JKU Linz
40 
41     Copyright of original file:
42     LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
43     http://lammps.sandia.gov, Sandia National Laboratories
44     Steve Plimpton, sjplimp@sandia.gov
45 
46     Copyright (2003) Sandia Corporation.  Under the terms of Contract
47     DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
48     certain rights in this software.  This software is distributed under
49     the GNU General Public License.
50 ------------------------------------------------------------------------- */
51 
52 #ifdef FIX_CLASS
53 
54 FixStyle(contacthistory,FixContactHistory)
55 
56 #else
57 
58 #ifndef LMP_FIX_CONTACT_HISTORY_H
59 #define LMP_FIX_CONTACT_HISTORY_H
60 
61 #include "fix.h"
62 #include "my_page.h"
63 #include "vector_liggghts.h"
64 
65 namespace LAMMPS_NS {
66 
67 class FixContactHistory : public Fix {
68   friend class Neighbor;
69   friend class PairGran;
70 
71  public:
72   FixContactHistory(class LAMMPS *, int, char **);
73   ~FixContactHistory();
74   virtual void post_create() {}
75   virtual int setmask();
76   virtual void init();
77   virtual void setup_pre_exchange();
78   virtual void setup_pre_neighbor() {}
79   virtual void pre_exchange();
80   virtual void min_setup_pre_exchange();
81   void min_pre_exchange();
82 
83   virtual double memory_usage();
84   virtual void grow_arrays(int);
85   virtual void copy_arrays(int, int, int);
86   void set_arrays(int);
87   int pack_exchange(int, double *);
88   virtual int unpack_exchange(int, double *);
89   virtual void write_restart(FILE *fp);
90   void restart(char *buf);
91   int pack_restart(int, double *);
92   virtual void unpack_restart(int, int);
93   int size_restart(int);
94   int maxsize_restart();
95 
96   // inline access
97   inline int n_partner(int i)
98   { return npartner_[i]; }
99 
100   inline int partner(int i,int j)
101   { return partner_[i][j]; }
102 
103   inline void contacthistory(int i,int j,double *h)
104   { vectorCopyN(&(contacthistory_[i][j*dnum_]),h,dnum_); }
105 
106   inline double* contacthistory(int i,int j)
107   { return &(contacthistory_[i][j*dnum_]); }
108 
109   inline int get_dnum()
110   { return dnum_; }
111 
112  protected:
113 
114   int iarg_;
115 
116   int dnum_;
117   char *variablename_;
118   int *newtonflag_;
119   char **history_id_;
120   int index_decide_noncontacting_;
121 
122   int *npartner_;                // # of touching partners of each atom
123   int **partner_;                // tags for the partners
124   double **contacthistory_;     // contact history values with the partner
125   int maxtouch_;                 // max # of touching partners for my atoms
126 
127   class Pair *pair_gran_;
128   int *computeflag_;             // computeflag in PairGranHookeHistory
129 
130   int pgsize_,oneatom_;          // copy of settings in Neighbor
131   MyPage<int> *ipage_;           // pages of partner atom IDs
132   MyPage<double> *dpage_;        // pages of shear history with partners
133 
134   virtual void allocate_pages();
135 
136 };
137 
138 }
139 
140 #endif
141 #endif
142 
143 /* ERROR/WARNING messages:
144 
145 E: Pair style granular with history requires atoms have IDs
146 
147 Atoms in the simulation do not have IDs, so history effects
148 cannot be tracked by the granular pair potential.
149 
150 E: Too many touching neighbors - boost MAXTOUCH
151 
152 A granular simulation has too many neighbors touching one atom.  The
153 MAXTOUCH parameter in fix_shear_history.cpp must be set larger and
154 LAMMPS must be re-built.
155 
156 */
157