| 1 |
/* |
| 2 |
* The MIT License |
| 3 |
|
| 4 |
BLDConograph (Bravais lattice determination module in Conograph) |
| 5 |
|
| 6 |
Copyright (c) <2012> <Ryoko Oishi-Tomiyasu, KEK> |
| 7 |
|
| 8 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 |
of this software and associated documentation files (the "Software"), to deal |
| 10 |
in the Software without restriction, including without limitation the rights |
| 11 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 |
copies of the Software, and to permit persons to whom the Software is |
| 13 |
furnished to do so, subject to the following conditions: |
| 14 |
|
| 15 |
The above copyright notice and this permission notice shall be included in |
| 16 |
all copies or substantial portions of the Software. |
| 17 |
|
| 18 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 |
THE SOFTWARE. |
| 25 |
* |
| 26 |
*/ |
| 27 |
#ifndef LATTICEFIGUREOFMERIT_HH_ |
| 28 |
#define LATTICEFIGUREOFMERIT_HH_ |
| 29 |
|
| 30 |
#include "../utility_data_structure/nrutil_nr.hh" |
| 31 |
#include "../utility_data_structure/SymMatNplus1N.hh" |
| 32 |
#include "../utility_data_structure/VecDat3.hh" |
| 33 |
#include "../utility_func/transform_sym_matrix.hh" |
| 34 |
#include "../utility_func/lattice_constant.hh" |
| 35 |
#include "../point_group/enumPointGroup.hh" |
| 36 |
#include "../bravais_type/BravaisType.hh" |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
// Class for outputting information about a lattice in index file. |
| 41 |
class LatticeFigureOfMerit |
| 42 |
{ |
| 43 |
private: |
| 44 |
static const NRMat<Int4> m_tmat_prim_to_face; |
| 45 |
static const NRMat<Int4> m_tmat_prim_to_body; |
| 46 |
static const NRMat<Int4> m_tmat_prim_to_rhomhex; |
| 47 |
static const NRMat<Int4> m_tmat_prim_to_base[3]; |
| 48 |
static const NRMat<Int4> m_tmat_prim_to_prim; |
| 49 |
|
| 50 |
BravaisType m_brat; |
| 51 |
|
| 52 |
// The inverse of m_S_red is Buerger-reduced. |
| 53 |
SymMat<Double> m_S_red; |
| 54 |
|
| 55 |
static void putLatticeConstantsDegree(const BravaisType& brat, |
| 56 |
const SymMat<Double>& S, |
| 57 |
const eABCaxis& axis1, |
| 58 |
const eRHaxis& axis2, |
| 59 |
VecDat3<Double>& length, VecDat3<Double>& angle); |
| 60 |
// Set m_S_red from S. |
| 61 |
// On output, trans_mat gives the matrix such that trans_mat * m_S_red * transpose(trans_mat) equals the original S. |
| 62 |
void setInverseOfBuergerReducedForm(NRMat<Int4>& trans_mat, const SymMat43_Double& S); |
| 63 |
|
| 64 |
public: |
| 65 |
LatticeFigureOfMerit(); |
| 66 |
LatticeFigureOfMerit(const BravaisType& ebrat, |
| 67 |
const SymMat43_Double& S_red); |
| 68 |
virtual ~LatticeFigureOfMerit(){}; |
| 69 |
|
| 70 |
// Change the lattice constants to string. |
| 71 |
inline string printOptimizedLatticeConstants(const eABCaxis& axis1, |
| 72 |
const eRHaxis& axis2, |
| 73 |
const Int4& precision) const; |
| 74 |
|
| 75 |
// Output information on the lattice. |
| 76 |
void printLatticeInformation(const eABCaxis& abc_axis, |
| 77 |
const eRHaxis& rh_axis, |
| 78 |
const Int4& label_start0, |
| 79 |
ostream* os) const; |
| 80 |
|
| 81 |
// Set-functions. |
| 82 |
void setLatticeConstants43(const BravaisType& brat, const SymMat43_Double& S); |
| 83 |
|
| 84 |
ZErrorMessage setLatticeConstants(const BravaisType& brat, const SymMat<Double>& S); |
| 85 |
|
| 86 |
// The unit of alpha, beta, gamma is degree. |
| 87 |
inline ZErrorMessage setLatticeConstantsDegree(const BravaisType& brat, |
| 88 |
const VecDat3<Double>& length_axis, |
| 89 |
const VecDat3<Double>& angle_axis); |
| 90 |
|
| 91 |
// Put-functions (Returns a value.) |
| 92 |
inline void putReducedLatticeConstantsDegree(const eABCaxis& axis1, |
| 93 |
const eRHaxis& axis2, |
| 94 |
VecDat3<Double>& length, VecDat3<Double>& angle) const; |
| 95 |
|
| 96 |
inline const ePointGroup& enumPointGroup() const { return m_brat.enumPointGroup(); }; |
| 97 |
inline const eCentringType& enumCentringType() const { return m_brat.enumCentringType(); }; |
| 98 |
inline const eBravaisType& enumBravaisType() const { return m_brat.enumBravaisType(); }; |
| 99 |
inline const BravaisType& putBravaisType() const { return m_brat; }; |
| 100 |
|
| 101 |
// The returned matrix is Buerger-reduced matrix equivalent with m_S_red_optimized. |
| 102 |
inline const SymMat<Double>& putInverseOfBuergerReducedForm() const { return m_S_red; }; |
| 103 |
}; |
| 104 |
|
| 105 |
inline void LatticeFigureOfMerit::putReducedLatticeConstantsDegree( |
| 106 |
const eABCaxis& axis1, |
| 107 |
const eRHaxis& axis2, VecDat3<Double>& length_axis, VecDat3<Double>& angle_axis) const |
| 108 |
{ |
| 109 |
putLatticeConstantsDegree( m_brat, this->putInverseOfBuergerReducedForm(), |
| 110 |
axis1, axis2, length_axis, angle_axis ); |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
inline ZErrorMessage LatticeFigureOfMerit::setLatticeConstantsDegree(const BravaisType& brat, |
| 116 |
const VecDat3<Double>& length, |
| 117 |
const VecDat3<Double>& angle) |
| 118 |
{ |
| 119 |
SymMat<Double> Sval(3); |
| 120 |
calCoParameter(length, angle, Sval); |
| 121 |
|
| 122 |
return this->setLatticeConstants(brat, Sval); |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
#endif /*LATTICEFIGUREOFMERIT_HH_*/ |