ls1-MarDyn
ls1-MarDyn molecular dynamics code
Lattice.h
1/*
2 * Copyright (c) 2012-2017 Christoph Niethammer <christoph.niethammer@gmail.com>
3 *
4 * $COPYRIGHT$
5 *
6 * Additional copyrights may follow
7 *
8 * $HEADER
9 */
10
11#ifndef LATTICE_H
12#define LATTICE_H
13
14#include <string>
15
16#include "utils/xmlfileUnits.h"
17
19enum LatticeSystem {
20 unknownSystem = -1,
21 triclinic = 0,
22 monoclinic,
23 orthorombic,
24 tetragonal,
25 rhomboedral,
26 hexagonal,
27 cubic
28};
29typedef enum LatticeSystem LatticeSystem;
30
32enum LatticeCentering {
33 unknownCentering = -1,
34 primitive = 0,
35 body,
36 face,
37 base_A,
38 base_B,
39 base_C
40};
41typedef enum LatticeCentering LatticeCentering;
42
43
44class Lattice {
45public:
50
65 void readXML(XMLfileUnits& xmlconfig);
66
74 void init(LatticeSystem system, LatticeCentering centering, double a[3], double b[3], double c[3]);
75
79 void setDimsMin(long dimsMin[3]);
80
84 void setDimsMax(long dimsMax[3]);
85
91 int getPoint(double* r);
92
96 bool checkValidity();
97
98 void setSystem(LatticeSystem system) { _system = system; }
99 LatticeSystem system() { return _system; }
100
101 void setCentering(LatticeCentering centering) { _centering = centering; }
102 LatticeCentering centering() { return _centering; }
103 int numCenters() { return numCenters(centering()); }
104
106 const char* systemName();
108 const char* centeringName();
110 static int numCenters(LatticeCentering centering);
112 static LatticeCentering centering(std::string name);
114 static LatticeSystem system(std::string name);
116 inline const double* a() { return _a; }
118 inline const double* b() { return _b; }
120 inline const double* c() { return _c; }
121
122
123private:
124 LatticeSystem _system;
125 LatticeCentering _centering;
126 /* Lattice vectors */
127 double _a[3];
128 double _b[3];
129 double _c[3];
130 /* Lattice dimensions in multiples of a,b,c */
131 long _dimsMin[3];
132 long _dimsMax[3];
133
134 /* internal counter for current point output */
135 long _pos[3]; /* Current lattice cell */
136 int _centeringCounter; /* Next centering in lattice cell */
137};
138
139#endif /* LATTICE_H */
Definition: Lattice.h:44
const double * b()
Definition: Lattice.h:118
void setDimsMax(long dimsMax[3])
Definition: Lattice.cpp:226
int getPoint(double *r)
Definition: Lattice.cpp:117
void init(LatticeSystem system, LatticeCentering centering, double a[3], double b[3], double c[3])
Definition: Lattice.cpp:106
const char * centeringName()
Definition: Lattice.cpp:235
void setDimsMin(long dimsMin[3])
Definition: Lattice.cpp:219
Lattice()
Definition: Lattice.h:47
~Lattice()
Definition: Lattice.h:49
void readXML(XMLfileUnits &xmlconfig)
Read in XML configuration for Lattice and all its included objects.
Definition: Lattice.cpp:78
const double * c()
Definition: Lattice.h:120
bool checkValidity()
Definition: Lattice.cpp:153
const char * systemName()
Definition: Lattice.cpp:232
const double * a()
Definition: Lattice.h:116
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
::xsd::cxx::tree::name< char, token > name
C++ type corresponding to the Name XML Schema built-in type.
Definition: vtk-punstructured.h:288
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270
XML input file with unit handling/conversion support.