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
36     LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
37     http://lammps.sandia.gov, Sandia National Laboratories
38     Steve Plimpton, sjplimp@sandia.gov
39 
40     Copyright (2003) Sandia Corporation.  Under the terms of Contract
41     DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
42     certain rights in this software.  This software is distributed under
43     the GNU General Public License.
44 ------------------------------------------------------------------------- */
45 
46 #ifndef LMP_LATTICE_H
47 #define LMP_LATTICE_H
48 
49 #include "pointers.h"
50 
51 namespace LAMMPS_NS {
52 
53 class Lattice : protected Pointers {
54  public:
55   int style;                           // NONE,SC,FCC,etc
56   double xlattice,ylattice,zlattice;   // lattice scale factors in 3 dims
57   double a1[3],a2[3],a3[3];            // edge vectors of unit cell
58   int nbasis;                          // # of basis atoms in unit cell
59   double **basis;                      // fractional coords of each basis atom
60                                        // within unit cell (0 <= coord < 1)
61 
62   Lattice(class LAMMPS *, int, char **);
63   ~Lattice();
64   void lattice2box(double &, double &, double &);
65   void box2lattice(double &, double &, double &);
66   void bbox(int, double, double, double,
67             double &, double &, double &, double &, double &, double &);
68 
69 private:
70   double scale;
71   double origin[3];                    // lattice origin
72   int orientx[3];                      // lattice orientation vecs
73   int orienty[3];                      // orientx = what lattice dir lies
74   int orientz[3];                      //           along x dim in box
75 
76   double primitive[3][3];              // lattice <-> box transform matrices
77   double priminv[3][3];
78   double rotaterow[3][3];
79   double rotatecol[3][3];
80 
81   int orthogonal();
82   int right_handed();
83   int collinear();
84   void setup_transform();
85   void add_basis(double, double, double);
86   double dot(double *, double *);
87   void cross(double *, double *, double *);
88 };
89 
90 }
91 
92 #endif
93 
94 /* ERROR/WARNING messages:
95 
96 E: Illegal ... command
97 
98 Self-explanatory.  Check the input script syntax and compare to the
99 documentation for the command.  You can use -echo screen as a
100 command-line option when running LAMMPS to see the offending line.
101 
102 E: Lattice style incompatible with simulation dimension
103 
104 2d simulation can use sq, sq2, or hex lattice.  3d simulation can use
105 sc, bcc, or fcc lattice.
106 
107 E: Invalid option in lattice command for non-custom style
108 
109 Certain lattice keywords are not supported unless the
110 lattice style is "custom".
111 
112 E: No basis atoms in lattice
113 
114 Basis atoms must be defined for lattice style user.
115 
116 E: Lattice orient vectors are not orthogonal
117 
118 The three specified lattice orientation vectors must be mutually
119 orthogonal.
120 
121 E: Lattice orient vectors are not right-handed
122 
123 The three specified lattice orientation vectors must create a
124 right-handed coordinate system such that a1 cross a2 = a3.
125 
126 E: Lattice primitive vectors are collinear
127 
128 The specified lattice primitive vectors do not for a unit cell with
129 non-zero volume.
130 
131 E: Lattice settings are not compatible with 2d simulation
132 
133 One or more of the specified lattice vectors has a non-zero z
134 component.
135 
136 E: Lattice spacings are invalid
137 
138 Each x,y,z spacing must be > 0.
139 
140 E: Degenerate lattice primitive vectors
141 
142 Invalid set of 3 lattice vectors for lattice command.
143 
144 E: Zero-length lattice orient vector
145 
146 Self-explanatory.
147 
148 */
149