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 (if not contributing author is listed, this file has been contributed 36 by the core developer) 37 38 Copyright 2012- DCS Computing GmbH, Linz 39 Copyright 2009-2012 JKU Linz 40 ------------------------------------------------------------------------- */ 41 42 #ifdef FIX_CLASS 43 44 FixStyle(particletemplate/multiplespheres,FixTemplateMultiplespheres) 45 46 #else 47 48 #ifndef LMP_FIX_TEMPLATE_MULTIPLESPHERES_H 49 #define LMP_FIX_TEMPLATE_MULTIPLESPHERES_H 50 51 #include "fix.h" 52 #include "fix_template_sphere.h" 53 #include "fix_property_atom.h" 54 55 namespace PARTICLE_PACKING 56 { 57 58 class MultipleSphere : public Sphere 59 { 60 public: 61 MultipleSphere() : 62 Sphere(), 63 type(0), 64 bond_random_id(0.0) 65 {} 66 67 MultipleSphere(const double * const _x, const double _radius, const double _density, const int _id, const int _type, const double _bond_random_id) : 68 Sphere(_x, _radius, _density, _id), 69 type(_type), 70 bond_random_id(_bond_random_id) 71 {} 72 73 int get_type() const 74 { return type; } 75 76 double get_bond_random_id() const 77 { return bond_random_id; } 78 79 private: 80 int type; 81 double bond_random_id; 82 }; 83 84 } 85 86 namespace LAMMPS_NS { 87 88 class FixTemplateMultiplespheres : public FixTemplateSphere { 89 public: 90 91 FixTemplateMultiplespheres(class LAMMPS *, int, char **); 92 virtual ~FixTemplateMultiplespheres(); 93 94 virtual void post_create(); 95 double max_r_bound(); 96 double max_rad(); 97 double min_rad(); 98 int maxtype(); 99 int mintype(); 100 int number_spheres(); 101 bool is_bonded() 102 { return bonded; } 103 104 // single insertion 105 virtual void randomize_single(); 106 107 // multi insertion 108 virtual void init_ptilist(int n_random_max, const bool enforce_single = false, FixPropertyAtom * const fix_release = NULL); 109 void randomize_ptilist(int ,int ,int); 110 void direct_set_ptlist(const int i, const void * const data, const int distribution_groupbit, const int distorder); 111 112 virtual void finalize_insertion() {} 113 114 virtual unsigned int generate_hash(); 115 116 inline bool all_overlap_none() 117 { return no_overlap; } 118 119 inline bool all_overlap_atleast_one_slightly() 120 { return overlap_slightly; } 121 122 inline double get_bond_id(const int i) const 123 { return fix_bond_random_id ? fix_bond_random_id->vector_atom[i] : 0.0; } 124 125 protected: 126 127 // template calculations 128 virtual void calc_bounding_sphere(); 129 virtual void calc_center_of_mass(); 130 virtual void check_overlap(); 131 virtual void print_info(); 132 133 // sqr distance from x_sphere[j] to xtest 134 double dist_sqr(int j,double *xtest); 135 136 // generate random point in bbox 137 void generate_xtry(double *xtry); 138 139 // number of spheres in template 140 int nspheres; 141 142 // coords of each sphere with respect to center of mass 143 double **x_sphere; 144 145 // radius of each sphere 146 double *r_sphere; 147 148 // scale factor if read from a file 149 double scale_fact; 150 151 // atom type might be variable if read from file 152 int *atom_type_sphere; 153 154 // bounding box 155 double x_min[3], x_max[3]; 156 157 // bounding sphere - radius and coordinates with respect to com 158 double r_bound; 159 double x_bound[3]; 160 161 // radius of sphere with equal volume 162 double r_equiv; 163 164 // number of tries for mc 165 int ntry; 166 167 bool overlap_slightly; 168 169 bool no_overlap; 170 171 bool bonded; 172 class FixPropertyAtom *fix_bond_random_id; 173 }; 174 175 } 176 177 #endif 178 #endif 179