| 1 |
rtomiyasu |
3 |
/* |
| 2 |
|
|
* The MIT License |
| 3 |
|
|
|
| 4 |
|
|
Conograph (powder auto-indexing program) |
| 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 |
rtomiyasu |
25 |
#include "../utility_data_structure/SymMatNplus1N.hh" |
| 32 |
rtomiyasu |
3 |
#include "../utility_data_structure/VecDat3.hh" |
| 33 |
|
|
#include "../utility_func/transform_sym_matrix.hh" |
| 34 |
|
|
#include "../utility_func/lattice_constant.hh" |
| 35 |
|
|
#include "../utility_func/chToDouble.hh" |
| 36 |
rtomiyasu |
25 |
#include "../utility_lattice_reduction/matrix_NbyN.hh" |
| 37 |
|
|
#include "../centring_type/enumCentringType.hh" |
| 38 |
rtomiyasu |
3 |
#include "../point_group/enumPointGroup.hh" |
| 39 |
|
|
#include "../laue_group/LaueGroup.hh" |
| 40 |
|
|
#include "../zparam/ZParawError.hh" |
| 41 |
|
|
#include "../model_function/profile_function/global_function/enumPeakShiftFunctionType.hh" |
| 42 |
|
|
#include "../bravais_type/BravaisType.hh" |
| 43 |
|
|
#include "enumSortCriterion.hh" |
| 44 |
|
|
#include "HKL_Q.hh" |
| 45 |
rtomiyasu |
25 |
#include "check_equiv.hh" |
| 46 |
rtomiyasu |
3 |
|
| 47 |
|
|
|
| 48 |
rtomiyasu |
25 |
// Class for outputting information about a lattice in index file. |
| 49 |
|
|
class LatticeFigureOfMerit |
| 50 |
rtomiyasu |
3 |
{ |
| 51 |
rtomiyasu |
25 |
friend inline bool operator<(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs); |
| 52 |
rtomiyasu |
3 |
|
| 53 |
|
|
public: |
| 54 |
rtomiyasu |
25 |
class SetOfFigureOfMerit |
| 55 |
rtomiyasu |
3 |
{ |
| 56 |
rtomiyasu |
25 |
private: |
| 57 |
|
|
Int4 m_num_ref_figure_of_merit; |
| 58 |
|
|
Int4 m_num_q_observed; |
| 59 |
|
|
Double m_num_total_hkl; |
| 60 |
|
|
Double m_figure_of_merit_Wolff; |
| 61 |
|
|
Double m_figure_of_merit_Wu; |
| 62 |
|
|
Double m_reversed_figure_of_merit; |
| 63 |
rtomiyasu |
3 |
|
| 64 |
rtomiyasu |
25 |
static string putStrFigureOfMeritWolff(const Int4& num_ref_fom){ return putLabel(SCM) + num2str(num_ref_fom); }; |
| 65 |
|
|
static string putStrFigureOfMeritWu(const Int4& num_ref_fom){ return putLabel(SCWuM) + num2str(num_ref_fom); }; |
| 66 |
|
|
static string putStrReversedFigureOfMeritWolff(const Int4& num_ref_fom){ return putLabel(SCRevM) + num2str(num_ref_fom); }; |
| 67 |
|
|
static string putStrSymmetricFigureOfMeritWolff(const Int4& num_ref_fom){ return putLabel(SCSymM) + num2str(num_ref_fom); }; |
| 68 |
rtomiyasu |
3 |
|
| 69 |
rtomiyasu |
25 |
public: |
| 70 |
|
|
SetOfFigureOfMerit(){ this->reset(); } |
| 71 |
|
|
~SetOfFigureOfMerit(){} |
| 72 |
rtomiyasu |
3 |
|
| 73 |
rtomiyasu |
25 |
inline void reset() |
| 74 |
|
|
{ |
| 75 |
|
|
m_num_ref_figure_of_merit = 0; |
| 76 |
|
|
m_num_q_observed = 0; |
| 77 |
|
|
m_num_total_hkl = 0.0; |
| 78 |
|
|
m_figure_of_merit_Wolff = 0.0; |
| 79 |
|
|
m_figure_of_merit_Wu = 0.0; |
| 80 |
|
|
m_reversed_figure_of_merit = 0.0; |
| 81 |
|
|
} |
| 82 |
rtomiyasu |
3 |
|
| 83 |
rtomiyasu |
25 |
inline Int4& putNumberOfReflectionsForFigureOfMerit() { return m_num_ref_figure_of_merit; }; |
| 84 |
|
|
inline Int4& putNumQobsAssociatedWithCloseHKL() { return m_num_q_observed; }; |
| 85 |
|
|
inline Double& putContinuousNumberOfHKLInRange() { return m_num_total_hkl; }; |
| 86 |
rtomiyasu |
3 |
|
| 87 |
rtomiyasu |
25 |
inline const Int4& putNumQobsAssociatedWithCloseHKL() const { return m_num_q_observed; }; |
| 88 |
|
|
inline const Int4& putNumberOfReflectionsForFigureOfMerit() const { return m_num_ref_figure_of_merit; }; |
| 89 |
|
|
inline const Double& putContinuousNumberOfHKLInRange() const { return m_num_total_hkl; }; |
| 90 |
rtomiyasu |
3 |
|
| 91 |
rtomiyasu |
25 |
inline Double& putFigureOfMeritWolff() { return m_figure_of_merit_Wolff; }; |
| 92 |
|
|
inline Double& putFigureOfMeritWu() { return m_figure_of_merit_Wu; }; |
| 93 |
|
|
inline Double& putReversedFigureOfMerit() { return m_reversed_figure_of_merit; }; |
| 94 |
rtomiyasu |
3 |
|
| 95 |
rtomiyasu |
25 |
inline const Double& putFigureOfMeritWolff() const { return m_figure_of_merit_Wolff; }; |
| 96 |
|
|
inline const Double& putFigureOfMeritWu() const { return m_figure_of_merit_Wu; }; |
| 97 |
|
|
inline const Double& putReversedFigureOfMerit() const { return m_reversed_figure_of_merit; }; |
| 98 |
rtomiyasu |
3 |
|
| 99 |
rtomiyasu |
25 |
inline string putLabel_FigureOfMeritWolff() const { return putStrFigureOfMeritWolff(m_num_ref_figure_of_merit); }; |
| 100 |
|
|
inline string putLabel_FigureOfMeritWu() const { return putStrFigureOfMeritWu(m_num_ref_figure_of_merit); }; |
| 101 |
|
|
inline string putLabel_ReversedFigureOfMeritWolff() const { return putStrReversedFigureOfMeritWolff(m_num_ref_figure_of_merit); }; |
| 102 |
|
|
inline string putLabel_SymmetricFigureOfMeritWolff() const { return putStrSymmetricFigureOfMeritWolff(m_num_ref_figure_of_merit); }; |
| 103 |
rtomiyasu |
3 |
|
| 104 |
rtomiyasu |
25 |
inline Double putSymmetricFigureOfMerit() const { return m_reversed_figure_of_merit * m_figure_of_merit_Wolff; }; |
| 105 |
|
|
}; |
| 106 |
rtomiyasu |
3 |
|
| 107 |
|
|
private: |
| 108 |
|
|
static const NRMat<Int4> m_tmat_prim_to_face; |
| 109 |
|
|
static const NRMat<Int4> m_tmat_prim_to_body; |
| 110 |
|
|
static const NRMat<Int4> m_tmat_prim_to_rhomhex; |
| 111 |
|
|
static const NRMat<Int4> m_tmat_prim_to_base[3]; |
| 112 |
|
|
static const NRMat<Int4> m_tmat_prim_to_prim; |
| 113 |
|
|
|
| 114 |
|
|
BravaisType m_brat; |
| 115 |
|
|
|
| 116 |
|
|
// This matrix is a result of optimization, therefore, it may be not reduced. |
| 117 |
|
|
// m_S_optimized.second * m_S_optimized.first * Transpose(m_S_optimized.second) is obtuse. |
| 118 |
|
|
SymMat43_Double m_S_optimized; |
| 119 |
|
|
|
| 120 |
rtomiyasu |
25 |
// The inverse of m_S_red is Buerger-reduced. |
| 121 |
rtomiyasu |
3 |
SymMat<Double> m_S_red; |
| 122 |
|
|
|
| 123 |
|
|
Double m_determ_S_red; |
| 124 |
|
|
|
| 125 |
|
|
SetOfFigureOfMerit m_figures_of_merit; |
| 126 |
|
|
|
| 127 |
|
|
// Sets m_S_red from m_S_optimized. |
| 128 |
rtomiyasu |
25 |
// On output, trans_mat gives the matrix such that trans_mat * m_S_red * transpose(trans_mat) = m_S_optimized.first. |
| 129 |
|
|
void setInverseOfBuergerReducedForm(NRMat<Int4>& trans_mat); |
| 130 |
rtomiyasu |
3 |
|
| 131 |
rtomiyasu |
25 |
// Returns unit-cell parameters with other centrings using m_S_red. |
| 132 |
|
|
void putEquivalentLatticeConstantsDegreeWithOtherCentring(const eABCaxis& abc_axis, |
| 133 |
|
|
const eRHaxis& rh_axis, |
| 134 |
|
|
const Double& resol, |
| 135 |
|
|
vector< pair< eBravaisType, SymMat<Double> > >& ans) const; |
| 136 |
|
|
|
| 137 |
rtomiyasu |
3 |
protected: |
| 138 |
|
|
static const Double m_cv2; |
| 139 |
|
|
|
| 140 |
|
|
public: |
| 141 |
|
|
LatticeFigureOfMerit(); |
| 142 |
|
|
LatticeFigureOfMerit(const Double& rhs); // Sets only m_determ_GramMat = rhs; |
| 143 |
|
|
LatticeFigureOfMerit(const BravaisType& ebrat, |
| 144 |
|
|
const SymMat43_Double& S_red); |
| 145 |
|
|
virtual ~LatticeFigureOfMerit(){}; |
| 146 |
|
|
|
| 147 |
rtomiyasu |
25 |
void putMillerIndicesInRange(const Double& qrange_end, |
| 148 |
rtomiyasu |
33 |
const Int4& irc_type, |
| 149 |
rtomiyasu |
3 |
vector<HKL_Q>& cal_hkl_tray) const; |
| 150 |
|
|
|
| 151 |
rtomiyasu |
33 |
void setDeWolffFigureOfMerit(const Int4& num_ref_figure_of_merit, const Int4& irc_type, const vector<QData>& qdata); |
| 152 |
rtomiyasu |
25 |
|
| 153 |
rtomiyasu |
3 |
void setWuFigureOfMerit(const Int4& num_ref_figure_of_merit, const vector<QData>& qdata, |
| 154 |
|
|
const Double& min_thred_num_hkl, |
| 155 |
|
|
const Double& max_thred_num_hkl); |
| 156 |
|
|
|
| 157 |
|
|
// Return false if Qdata is not set or |
| 158 |
|
|
// the number of unindexed reflections is larger max_num_false_peak. |
| 159 |
|
|
void setFigureOfMerit(const Int4& num_ref_figure_of_merit, const vector<QData>& qdata, |
| 160 |
|
|
vector< VecDat3<Int4> >& closest_hkl_tray, |
| 161 |
|
|
Vec_BOOL& Q_observed_flag); |
| 162 |
rtomiyasu |
25 |
|
| 163 |
rtomiyasu |
3 |
inline void setFigureOfMerit(const Int4& num_ref_figure_of_merit, const vector<QData>& qdata) |
| 164 |
|
|
{ |
| 165 |
|
|
vector< VecDat3<Int4> > closest_hkl_tray; |
| 166 |
|
|
Vec_BOOL Q_observed_flag; |
| 167 |
|
|
setFigureOfMerit(num_ref_figure_of_merit, qdata, closest_hkl_tray, Q_observed_flag); |
| 168 |
|
|
}; |
| 169 |
|
|
|
| 170 |
|
|
// true : NormM has been improved. |
| 171 |
|
|
// false : NormM has not been improved. |
| 172 |
|
|
pair<bool, ZErrorMessage> fitLatticeParameterLinear(const vector<QData>& qdata, |
| 173 |
|
|
const vector< VecDat3<Int4> >& hkl_to_fit, |
| 174 |
|
|
const vector<bool>& fix_or_fit_flag, |
| 175 |
|
|
const bool& output_view_flag); |
| 176 |
|
|
|
| 177 |
|
|
// Change the lattice constants to string. |
| 178 |
|
|
inline string printOptimizedLatticeConstants(const eABCaxis& axis1, |
| 179 |
|
|
const eRHaxis& axis2, |
| 180 |
|
|
const Int4& precision) const; |
| 181 |
|
|
|
| 182 |
|
|
// Output information on the lattice. |
| 183 |
|
|
void printLatticeInformation(const eABCaxis& abc_axis, |
| 184 |
|
|
const eRHaxis& rh_axis, |
| 185 |
rtomiyasu |
25 |
const Double& resol, |
| 186 |
rtomiyasu |
3 |
const Int4& label_start0, |
| 187 |
|
|
ostream* os) const; |
| 188 |
|
|
|
| 189 |
|
|
// Set-functions. |
| 190 |
|
|
// This method assumes that S.second * S.first * Transpose(S.second) is obtuse. |
| 191 |
|
|
void setLatticeConstants43(const BravaisType& brat, const SymMat43_Double& S); |
| 192 |
|
|
|
| 193 |
|
|
ZErrorMessage setLatticeConstants(const BravaisType& brat, const SymMat<Double>& S); |
| 194 |
|
|
|
| 195 |
|
|
Int4 checkDominantZone() const; |
| 196 |
|
|
|
| 197 |
|
|
// Replace m_S_optimized by m_S_red. |
| 198 |
|
|
// On output, trans_mat gives the matrix such that trans_mat * m_S_red * transpose(trans_mat) equals the original m_S_optimized. |
| 199 |
|
|
inline void reduceLatticeConstants(NRMat<Int4>& trans_mat); |
| 200 |
|
|
|
| 201 |
|
|
// The unit of alpha, beta, gamma is degree. |
| 202 |
|
|
inline ZErrorMessage setLatticeConstantsDegree(const BravaisType& brat, |
| 203 |
|
|
const VecDat3<Double>& length_axis, |
| 204 |
|
|
const VecDat3<Double>& angle_axis); |
| 205 |
|
|
|
| 206 |
|
|
static void putLatticeConstantsDegree(const BravaisType& brat, |
| 207 |
|
|
const SymMat<Double>& S, |
| 208 |
|
|
const eABCaxis& axis1, |
| 209 |
|
|
const eRHaxis& axis2, |
| 210 |
|
|
VecDat3<Double>& length, VecDat3<Double>& angle); |
| 211 |
|
|
|
| 212 |
|
|
// Put-functions (Returns a value.) |
| 213 |
|
|
inline void putOptimizedLatticeConstantsDegree(const eABCaxis& axis1, |
| 214 |
|
|
const eRHaxis& axis2, |
| 215 |
|
|
VecDat3<Double>& length, VecDat3<Double>& angle) const; |
| 216 |
|
|
|
| 217 |
|
|
inline void putReducedLatticeConstantsDegree(const eABCaxis& axis1, |
| 218 |
|
|
const eRHaxis& axis2, |
| 219 |
|
|
VecDat3<Double>& length, VecDat3<Double>& angle) const; |
| 220 |
|
|
|
| 221 |
|
|
inline Double putLatticeVolume() const { return 1.0 / sqrt(m_determ_S_red); }; |
| 222 |
|
|
|
| 223 |
|
|
// Put-functions (Returns a constant reference.) |
| 224 |
|
|
inline const Double& putCriticalValueSquare() const { return m_cv2; }; |
| 225 |
|
|
|
| 226 |
rtomiyasu |
17 |
inline const ePointGroup& enumLaueGroup() const { return m_brat.enumLaueGroup(); }; |
| 227 |
rtomiyasu |
25 |
inline const eCentringType& enumCentringType() const { return m_brat.enumCentringType(); }; |
| 228 |
|
|
inline const eBravaisType& enumBravaisType() const { return m_brat.enumBravaisType(); }; |
| 229 |
rtomiyasu |
3 |
inline const BravaisType& putBravaisType() const { return m_brat; }; |
| 230 |
|
|
|
| 231 |
rtomiyasu |
25 |
// The returned matrix is Buerger-reduced matrix equivalent with m_S_red_optimized. |
| 232 |
|
|
inline const SymMat<Double>& putInverseOfBuergerReducedForm() const { return m_S_red; }; |
| 233 |
rtomiyasu |
3 |
|
| 234 |
|
|
inline const SymMat43_Double& putOptimizedForm() const { return m_S_optimized; }; |
| 235 |
|
|
inline SymMat<Double> putSellingReducedForm() const { return transform_sym_matrix(m_S_optimized.second, m_S_optimized.first); }; |
| 236 |
|
|
|
| 237 |
|
|
inline const Double& putDeterminantOfGramMatrix() const { return m_determ_S_red; }; |
| 238 |
|
|
inline const SetOfFigureOfMerit& putFiguresOfMerit() const { return m_figures_of_merit; }; |
| 239 |
|
|
|
| 240 |
|
|
// Put-functions (Returns a non-constant reference.) |
| 241 |
rtomiyasu |
25 |
// Returns almost equivalent unit-cell parameters of different centring-types. |
| 242 |
|
|
void putEquivalentLatticeConstantsDegreeWithOtherCentring(const eABCaxis& abc_axis, |
| 243 |
|
|
const eRHaxis& rh_axis, |
| 244 |
|
|
const Double& resol, |
| 245 |
|
|
vector< pair< eBravaisType, pair< VecDat3<Double>, VecDat3<Double> > > >& ans) const; |
| 246 |
rtomiyasu |
3 |
|
| 247 |
|
|
static bool cmpFOMdeWolff(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 248 |
|
|
{ |
| 249 |
|
|
return lhs.m_figures_of_merit.putFigureOfMeritWolff() > rhs.m_figures_of_merit.putFigureOfMeritWolff(); |
| 250 |
|
|
} |
| 251 |
|
|
|
| 252 |
|
|
static bool cmpFOMWu(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 253 |
|
|
{ |
| 254 |
|
|
return lhs.m_figures_of_merit.putFigureOfMeritWu() > rhs.m_figures_of_merit.putFigureOfMeritWu(); |
| 255 |
|
|
} |
| 256 |
|
|
|
| 257 |
|
|
static bool cmpFOMReversed(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 258 |
|
|
{ |
| 259 |
|
|
return lhs.m_figures_of_merit.putReversedFigureOfMerit() > rhs.m_figures_of_merit.putReversedFigureOfMerit(); |
| 260 |
|
|
} |
| 261 |
|
|
|
| 262 |
|
|
static bool cmpFOMSymmetric(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 263 |
|
|
{ |
| 264 |
|
|
return lhs.m_figures_of_merit.putSymmetricFigureOfMerit() > rhs.m_figures_of_merit.putSymmetricFigureOfMerit(); |
| 265 |
|
|
} |
| 266 |
|
|
|
| 267 |
|
|
// For GUI |
| 268 |
|
|
const BravaisType &getref_m_brat() const {return m_brat;} |
| 269 |
|
|
BravaisType &getref_m_brat() {return m_brat;} |
| 270 |
|
|
const SetOfFigureOfMerit &getref_m_figures_of_merit() const {return m_figures_of_merit;} |
| 271 |
|
|
SetOfFigureOfMerit &getref_m_figures_of_merit() {return m_figures_of_merit;} |
| 272 |
|
|
const SymMat43_Double &getref_m_S_red_optimized() const {return m_S_optimized;} |
| 273 |
|
|
SymMat43_Double &getref_m_S_red_optimized() {return m_S_optimized;} |
| 274 |
|
|
const Double &getref_m_determ_S_red() const {return m_determ_S_red;} |
| 275 |
|
|
Double &getref_m_determ_S_red() {return m_determ_S_red;} |
| 276 |
rtomiyasu |
16 |
const SymMat<Double> &getref_m_S_red() const {return m_S_red;} |
| 277 |
|
|
SymMat<Double> &getref_m_S_red() {return m_S_red;} |
| 278 |
|
|
|
| 279 |
rtomiyasu |
3 |
}; |
| 280 |
|
|
|
| 281 |
|
|
|
| 282 |
|
|
inline string LatticeFigureOfMerit::printOptimizedLatticeConstants(const eABCaxis& axis1, |
| 283 |
|
|
const eRHaxis& axis2, |
| 284 |
|
|
const Int4& precision) const |
| 285 |
|
|
{ |
| 286 |
|
|
VecDat3<Double> length_axis, angle_axis; |
| 287 |
|
|
putOptimizedLatticeConstantsDegree(axis1, axis2, length_axis, angle_axis); |
| 288 |
|
|
return chToString(length_axis, angle_axis, precision); |
| 289 |
|
|
} |
| 290 |
|
|
|
| 291 |
|
|
|
| 292 |
|
|
inline void LatticeFigureOfMerit::putOptimizedLatticeConstantsDegree(const eABCaxis& axis1, |
| 293 |
|
|
const eRHaxis& axis2, |
| 294 |
|
|
VecDat3<Double>& length_axis, VecDat3<Double>& angle_axis) const |
| 295 |
|
|
{ |
| 296 |
|
|
putLatticeConstantsDegree( m_brat, m_S_optimized.first, axis1, axis2, length_axis, angle_axis ); |
| 297 |
|
|
} |
| 298 |
|
|
|
| 299 |
|
|
|
| 300 |
|
|
inline void LatticeFigureOfMerit::putReducedLatticeConstantsDegree( |
| 301 |
|
|
const eABCaxis& axis1, |
| 302 |
|
|
const eRHaxis& axis2, VecDat3<Double>& length_axis, VecDat3<Double>& angle_axis) const |
| 303 |
|
|
{ |
| 304 |
rtomiyasu |
25 |
putLatticeConstantsDegree( m_brat, this->putInverseOfBuergerReducedForm(), |
| 305 |
rtomiyasu |
3 |
axis1, axis2, length_axis, angle_axis ); |
| 306 |
|
|
} |
| 307 |
|
|
|
| 308 |
|
|
|
| 309 |
|
|
|
| 310 |
|
|
inline ZErrorMessage LatticeFigureOfMerit::setLatticeConstantsDegree(const BravaisType& brat, |
| 311 |
|
|
const VecDat3<Double>& length, |
| 312 |
|
|
const VecDat3<Double>& angle) |
| 313 |
|
|
{ |
| 314 |
rtomiyasu |
17 |
LaueGroup lg(brat.enumLaueGroup()); |
| 315 |
rtomiyasu |
3 |
ZErrorMessage zerr = lg->checkLatticeConstantError(length, angle); |
| 316 |
|
|
if( zerr.putErrorType() != ZErrorNoError ) return zerr; |
| 317 |
|
|
|
| 318 |
|
|
SymMat<Double> Sval(3); |
| 319 |
|
|
calCoParameter(length, angle, Sval); |
| 320 |
|
|
|
| 321 |
|
|
return this->setLatticeConstants(brat, Sval); |
| 322 |
|
|
} |
| 323 |
|
|
|
| 324 |
|
|
inline void LatticeFigureOfMerit::reduceLatticeConstants(NRMat<Int4>& trans_mat) |
| 325 |
|
|
{ |
| 326 |
rtomiyasu |
33 |
// trans_mat * m_S_red * transpose(trans_mat) = m_S_optimized.first(old). |
| 327 |
rtomiyasu |
25 |
setInverseOfBuergerReducedForm(trans_mat); |
| 328 |
rtomiyasu |
33 |
// m_S_optimized.first(new) = m_S_red. |
| 329 |
rtomiyasu |
3 |
m_S_optimized.first = m_S_red; |
| 330 |
rtomiyasu |
33 |
|
| 331 |
|
|
// m_S_optimized.second(new) * m_S_optimized.first(new) * transpose(m_S_optimized.second(new)) |
| 332 |
|
|
// = m_S_optimized.second(old) * m_S_optimized.first(old) * transpose(m_S_optimized.second(old)) is Delone reduced. |
| 333 |
rtomiyasu |
3 |
m_S_optimized.second = mprod(m_S_optimized.second, trans_mat); |
| 334 |
|
|
} |
| 335 |
|
|
|
| 336 |
|
|
|
| 337 |
|
|
template<class T> |
| 338 |
|
|
inline T norm(const VecDat3<Int4>& lhs, const SymMat<T>& rhs) |
| 339 |
|
|
{ |
| 340 |
|
|
assert( rhs.size() >= 3 ); |
| 341 |
|
|
|
| 342 |
|
|
return rhs(0,0)*(lhs[0]*lhs[0]) + rhs(1,1)*(lhs[1]*lhs[1]) + rhs(2,2)*(lhs[2]*lhs[2]) |
| 343 |
|
|
+ ( rhs(0,1)*(lhs[0]*lhs[1]) + rhs(0,2)*(lhs[0]*lhs[2]) + rhs(1,2)*(lhs[1]*lhs[2]) )*2.0; |
| 344 |
|
|
} |
| 345 |
|
|
|
| 346 |
|
|
|
| 347 |
|
|
inline bool operator<(const LatticeFigureOfMerit& lhs, const LatticeFigureOfMerit& rhs) |
| 348 |
|
|
{ |
| 349 |
|
|
return lhs.m_determ_S_red < rhs.m_determ_S_red; |
| 350 |
|
|
} |
| 351 |
|
|
|
| 352 |
rtomiyasu |
25 |
void putTransformMatrixToBuergerReduced(const SymMat<Double>& S, NRMat<Int4>& trans_mat); |
| 353 |
rtomiyasu |
3 |
|
| 354 |
|
|
#endif /*LATTICEFIGUREOFMERIT_HH_*/ |