JDFTx  1.2.0
Symmetries.h
1 /*-------------------------------------------------------------------
2 Copyright 2011 Ravishankar Sundararaman
3 Copyright 1996-2003 Sohrab Ismail-Beigi
4 
5 This file is part of JDFTx.
6 
7 JDFTx is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 JDFTx is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
19 -------------------------------------------------------------------*/
20 
21 #ifndef JDFTX_ELECTRONIC_SYMMETRIES_H
22 #define JDFTX_ELECTRONIC_SYMMETRIES_H
23 
24 #include <electronic/common.h>
25 #include <core/matrix3.h>
26 #include <core/ScalarField.h>
27 #include <vector>
28 #include <list>
29 
30 enum SymmetryMode {SymmetriesNone, SymmetriesAutomatic, SymmetriesManual};
31 
33 {
34 public:
35  SymmetryMode mode;
36 
37  Symmetries();
38  ~Symmetries();
39  void setup(const Everything& everything);
40  void setupMesh();
41 
43  std::vector<QuantumNumber> reduceKmesh(const std::vector<QuantumNumber>& qnums) const;
44 
45  void symmetrize(ScalarField&) const;
46  void symmetrize(IonicGradient&) const;
47  void symmetrizeSpherical(matrix&, const SpeciesInfo* specie) const;
48  const std::vector< matrix3<int> >& getMatrices() const;
49  const std::vector< matrix3<int> >& getMeshMatrices() const;
50  const std::vector<matrix>& getSphericalMatrices(int l, bool relativistic) const;
51  const std::vector<int>& getKpointInvertList() const;
52  const std::vector<std::vector<std::vector<int> > >& getAtomMap() const;
53  void printKmap(FILE* fp) const;
54 
55  static matrix getSpinorRotation(const matrix3<>& rot); //calculate spinor rotation from Cartesian rotation matrix
56 private:
57  const Everything* e;
58  std::vector< matrix3<int> > sym;
59  std::vector< matrix3<int> > symMesh;
60  std::vector< std::vector<matrix> > symSpherical;
61  std::vector< std::vector<matrix> > symSpinAngle;
62 
63  std::vector<int> kpointInvertList;
64  std::vector<unsigned long long> kmap;
65  friend struct CommandSymmetries;
66  friend struct CommandSymmetryMatrix;
67  friend struct CommandDebug;
68 
69  bool shouldPrintMatrices;
70  bool shouldMoveAtoms;
71 
72  void calcSymmetries();
73 
75  std::vector< matrix3<int> > basisReduce(const std::vector< matrix3<int> >& symLattice, vector3<> offset=vector3<>()) const;
76 
77  void sortSymmetries();
78  void checkFFTbox();
79  void checkSymmetries() const;
80 
81  //Index map for scalar field (electron density, potential) symmetrization
82  int *symmIndex, nSymmIndex;
83  void initSymmIndex();
84 
85  //Atom maps:
86  std::vector<std::vector<std::vector<int> > > atomMap;
87  void initAtomMaps();
88 };
89 
90 #endif // JDFTX_ELECTRONIC_SYMMETRIES_H
const std::vector< matrix > & getSphericalMatrices(int l, bool relativistic) const
directly access the symmetry matrices (in Ylm or spin-angle basis at specified l, depending on relati...
void setup(const Everything &everything)
Phase 1 of setup which computes/checks lattice+basis symmetries.
void setupMesh()
Phase 2 of setup which computes / checks FFTbox and k-mesh dependent symmetries.
void symmetrize(ScalarField &) const
symmetrize a scalar field
General complex matrix.
Definition: matrix.h:58
Real and complex scalar fields in real and reciprocal space.
const std::vector< std::vector< std::vector< int > > > & getAtomMap() const
direct access to mapping of each atom under each symmetry matrix (index order species, atom, symmetry)
const std::vector< int > & getKpointInvertList() const
direct access to inversion property of symmetry group (see kpointInvertList)
std::vector< QuantumNumber > reduceKmesh(const std::vector< QuantumNumber > &qnums) const
Reduce a k-point mesh (and remember its inversion symmetry property in kpointInvertList) ...
const std::vector< matrix3< int > > & getMeshMatrices() const
directly access the symmetry matrices (in mesh coords)
Definition: Everything.h:41
void printKmap(FILE *fp) const
print the k-point map (cached in kmap)
void symmetrizeSpherical(matrix &, const SpeciesInfo *specie) const
symmetrize matrices in Ylm basis per atom of species sp (accounting for atom maps) ...
Definition: Symmetries.h:32
std::shared_ptr< ScalarFieldData > ScalarField
A smart reference-counting pointer to ScalarFieldData.
Definition: ScalarField.h:41
Definition: SpeciesInfo.h:33
const std::vector< matrix3< int > > & getMatrices() const
directly access the symmetry matrices (in lattice coords)
Object to hold all the forces.
Definition: IonicMinimizer.h:31
SymmetryMode mode
Symmetry mode (none, automatic or manual)
Definition: Symmetries.h:35