| 36 |
#include "gather_q_of_Ndim_lattice.hh" |
#include "gather_q_of_Ndim_lattice.hh" |
| 37 |
#include "ReducedLatticeToCheckBravais.hh" |
#include "ReducedLatticeToCheckBravais.hh" |
| 38 |
#include "LatticeFigureOfMerit.hh" |
#include "LatticeFigureOfMerit.hh" |
| 39 |
|
#include "../qc/gather_qcal2.hh" |
| 40 |
|
|
| 41 |
const Double LatticeFigureOfMerit::m_cv2 = 9.0; |
const Double LatticeFigureOfMerit::m_cv2 = 9.0; |
| 42 |
|
|
| 271 |
|
|
| 272 |
|
|
| 273 |
void LatticeFigureOfMerit::putMillerIndicesInRange(const Double& qend, |
void LatticeFigureOfMerit::putMillerIndicesInRange(const Double& qend, |
| 274 |
vector<HKL_Q>& cal_hkl_tray) const |
const Int4& irc_type, |
| 275 |
|
vector<HKL_Q>& cal_hkl_tray) const |
| 276 |
{ |
{ |
| 277 |
cal_hkl_tray.clear(); |
cal_hkl_tray.clear(); |
| 278 |
|
|
| 279 |
vector<HKL_Q> cal_hkl_tray2; |
vector<HKL_Q> cal_hkl_tray2; |
| 280 |
gatherQcal(this->putSellingReducedForm(), qend, cal_hkl_tray2); |
gatherQcal(this->putSellingReducedForm(), qend, m_S_optimized.second, this->putBravaisType(), irc_type, cal_hkl_tray2); |
| 281 |
|
|
| 282 |
set< VecDat3<Int4> > found_hkl_tray; |
set< VecDat3<Int4> > found_hkl_tray; |
| 283 |
vector<MillerIndex3> equiv_hkl_tray; |
vector<MillerIndex3> equiv_hkl_tray; |
|
VecDat3<Int4> hkl; |
|
| 284 |
|
|
| 285 |
PGNormalSeriesTray normal_tray(m_brat.enumLaueGroup()); |
PGNormalSeriesTray normal_tray(m_brat.enumLaueGroup()); |
| 286 |
LaueGroup lg(m_brat.enumLaueGroup()); |
LaueGroup lg(m_brat.enumLaueGroup()); |
| 287 |
|
VecDat3<Int4> hkl; |
| 288 |
|
|
| 289 |
for(vector<HKL_Q>::const_iterator it=upper_bound(cal_hkl_tray2.begin(), cal_hkl_tray2.end(), HKL_Q(NRVec<Int4>(), 0.0)); |
for(vector<HKL_Q>::const_iterator it=upper_bound(cal_hkl_tray2.begin(), cal_hkl_tray2.end(), HKL_Q(NRVec<Int4>(), 0.0)); |
| 290 |
it<cal_hkl_tray2.end(); it++) |
it<cal_hkl_tray2.end(); it++) |
| 291 |
{ |
{ |
| 292 |
hkl = product_hkl(it->HKL(), m_S_optimized.second); |
hkl = it->HKL(); |
| 293 |
if( found_hkl_tray.find(hkl) != found_hkl_tray.end() ) |
if( found_hkl_tray.find(hkl) != found_hkl_tray.end() ) |
| 294 |
{ |
{ |
| 295 |
continue; |
continue; |
| 343 |
const SymMat<Double> S_sup( this->putSellingReducedForm() ); |
const SymMat<Double> S_sup( this->putSellingReducedForm() ); |
| 344 |
|
|
| 345 |
vector<HKL_Q> cal_hkl_tray; |
vector<HKL_Q> cal_hkl_tray; |
| 346 |
gatherQcal(S_sup, MaxQ, cal_hkl_tray); |
gatherQcal(S_sup, MaxQ, m_S_optimized.second, cal_hkl_tray); |
| 347 |
if( cal_hkl_tray.empty() ) return; |
if( cal_hkl_tray.empty() ) return; |
| 348 |
|
|
| 349 |
vector< vector<HKL_Q>::const_iterator > closest_hkl_q_tray; |
vector< vector<HKL_Q>::const_iterator > closest_hkl_q_tray; |
| 358 |
Int4 num_q_observed = 0; |
Int4 num_q_observed = 0; |
| 359 |
for(Int4 k=0; k<num_Q; k++) |
for(Int4 k=0; k<num_Q; k++) |
| 360 |
{ |
{ |
| 361 |
closest_hkl_tray[k] = product_hkl( closest_hkl_q_tray[k]->HKL(), m_S_optimized.second); |
closest_hkl_tray[k] = closest_hkl_q_tray[k]->HKL(); |
| 362 |
diff = qdata[k].q - closest_hkl_q_tray[k]->Q(); |
diff = qdata[k].q - closest_hkl_q_tray[k]->Q(); |
| 363 |
actually_disc += fabs( diff ); |
actually_disc += fabs( diff ); |
| 364 |
if( diff * diff <= m_cv2 * qdata[k].q_var ) |
if( diff * diff <= m_cv2 * qdata[k].q_var ) |
| 376 |
|
|
| 377 |
const LaueGroup lg(m_brat.enumLaueGroup()); |
const LaueGroup lg(m_brat.enumLaueGroup()); |
| 378 |
|
|
| 379 |
Double inv_mult = 2.0 / lg->LaueMultiplicity( product_hkl(it_begin->HKL(), m_S_optimized.second) ); |
Double inv_mult = 2.0 / lg->LaueMultiplicity( it_begin->HKL() ); |
| 380 |
Double num_total_hkl = inv_mult; |
Double num_total_hkl = inv_mult; |
| 381 |
Double rev_actually_disc = fabs( it_begin->Q() - closest_q_tray[0]->q ) * inv_mult; |
Double rev_actually_disc = fabs( it_begin->Q() - closest_q_tray[0]->q ) * inv_mult; |
| 382 |
|
|
| 384 |
Int4 index = 1; |
Int4 index = 1; |
| 385 |
for(vector<HKL_Q>::const_iterator it=it_begin+1; it<it_end; it++, index++) |
for(vector<HKL_Q>::const_iterator it=it_begin+1; it<it_end; it++, index++) |
| 386 |
{ |
{ |
| 387 |
inv_mult = 2.0 / lg->LaueMultiplicity( product_hkl(it->HKL(), m_S_optimized.second) ); |
inv_mult = 2.0 / lg->LaueMultiplicity( it->HKL() ); |
| 388 |
num_total_hkl += inv_mult; |
num_total_hkl += inv_mult; |
| 389 |
rev_actually_disc += fabs( it->Q() - closest_q_tray[index]->q ) * inv_mult; |
rev_actually_disc += fabs( it->Q() - closest_q_tray[index]->q ) * inv_mult; |
| 390 |
|
|
| 403 |
|
|
| 404 |
|
|
| 405 |
|
|
| 406 |
void LatticeFigureOfMerit::setDeWolffFigureOfMerit(const Int4& num_ref_figure_of_merit, |
void LatticeFigureOfMerit::setDeWolffFigureOfMerit( |
| 407 |
|
const Int4& num_ref_figure_of_merit, |
| 408 |
|
const Int4& irc_type, |
| 409 |
const vector<QData>& qdata) |
const vector<QData>& qdata) |
| 410 |
{ |
{ |
| 411 |
assert( num_ref_figure_of_merit <= (Int4)qdata.size() ); |
assert( num_ref_figure_of_merit <= (Int4)qdata.size() ); |
| 421 |
const SymMat<Double> S_sup( this->putSellingReducedForm() ); |
const SymMat<Double> S_sup( this->putSellingReducedForm() ); |
| 422 |
|
|
| 423 |
vector<HKL_Q> cal_hkl_tray; |
vector<HKL_Q> cal_hkl_tray; |
| 424 |
gatherQcal(S_sup, MaxQ, cal_hkl_tray); |
gatherQcal(S_sup, MaxQ, m_S_optimized.second, this->putBravaisType(), irc_type, cal_hkl_tray); |
| 425 |
if( cal_hkl_tray.empty() ) return; |
if( cal_hkl_tray.empty() ) return; |
| 426 |
|
|
| 427 |
vector< vector<HKL_Q>::const_iterator > closest_hkl_q_tray; |
vector< vector<HKL_Q>::const_iterator > closest_hkl_q_tray; |
| 442 |
Double num_total_hkl = 0.0; |
Double num_total_hkl = 0.0; |
| 443 |
for(vector<HKL_Q>::const_iterator it=it_begin; it<it_end; it++) |
for(vector<HKL_Q>::const_iterator it=it_begin; it<it_end; it++) |
| 444 |
{ |
{ |
| 445 |
num_total_hkl += 2.0 / lg->LaueMultiplicity( product_hkl(it->HKL(), m_S_optimized.second) ); |
num_total_hkl += 2.0 / lg->LaueMultiplicity( it->HKL() ); |
| 446 |
} |
} |
| 447 |
|
|
| 448 |
// Calculate the symmetric figures of merit by Wolff. |
// Calculate the symmetric figures of merit by Wolff. |