Skip to content

Commit 9a0b195

Browse files
committed
Merge branch 'master' of github.com:vincefn/objcryst into upstream-objcryst
* 'master' of github.com:vincefn/objcryst: Add relative_length_tolerance and absolute_angle_tolerance_degree to SpaceGroupExplorer::Run() and RunAll()
2 parents 4484b73 + 4d81b22 commit 9a0b195

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

ObjCryst/ObjCryst/PowderPattern.cpp

+14-9
Original file line numberDiff line numberDiff line change
@@ -6825,7 +6825,8 @@ SpaceGroupExplorer::SpaceGroupExplorer(PowderPatternDiffraction *pd):
68256825

68266826
SPGScore SpaceGroupExplorer::Run(const string &spgId, const bool fitprofile,
68276827
const bool verbose, const bool restore_orig,
6828-
const bool update_display)
6828+
const bool update_display, const REAL relative_length_tolerance,
6829+
const REAL absolute_angle_tolerance_degree)
68296830
{
68306831
cctbx::sgtbx::space_group sg;
68316832
try
@@ -6847,11 +6848,13 @@ SPGScore SpaceGroupExplorer::Run(const string &spgId, const bool fitprofile,
68476848
throw ObjCrystException(emsg);
68486849
}
68496850
}
6850-
return this->Run(sg, fitprofile, verbose, restore_orig, update_display);
6851+
return this->Run(sg, fitprofile, verbose, restore_orig, update_display,
6852+
relative_length_tolerance, absolute_angle_tolerance_degree);
68516853
}
68526854

68536855
SPGScore SpaceGroupExplorer::Run(const cctbx::sgtbx::space_group &spg, const bool fitprofile, const bool verbose,
6854-
const bool restore_orig, const bool update_display)
6856+
const bool restore_orig, const bool update_display,
6857+
const REAL relative_length_tolerance, const REAL absolute_angle_tolerance_degree)
68556858
{
68566859
TAU_PROFILE("SpaceGroupExplorer::Run()","void (wxCommandEvent &)",TAU_DEFAULT);
68576860
TAU_PROFILE_TIMER(timer1,"SpaceGroupExplorer::Run()LSQ-P1","", TAU_FIELD);
@@ -6871,7 +6874,7 @@ SPGScore SpaceGroupExplorer::Run(const cctbx::sgtbx::space_group &spg, const boo
68716874
const cctbx::sgtbx::space_group_symbols s = spg.match_tabulated_settings();
68726875
const string hm=s.universal_hermann_mauguin();
68736876
const cctbx::uctbx::unit_cell uc(scitbx::af::double6(a,b,c,d*RAD2DEG,e*RAD2DEG,f*RAD2DEG));
6874-
if(!spg.is_compatible_unit_cell(uc,0.01,0.1))
6877+
if(!spg.is_compatible_unit_cell(uc,relative_length_tolerance,absolute_angle_tolerance_degree))
68756878
{
68766879
throw ObjCrystException("Spacegroup is not compatible with unit cell.");
68776880
}
@@ -6976,7 +6979,8 @@ SPGScore SpaceGroupExplorer::Run(const cctbx::sgtbx::space_group &spg, const boo
69766979
}
69776980

69786981
void SpaceGroupExplorer::RunAll(const bool fitprofile_all, const bool verbose, const bool keep_best,
6979-
const bool update_display, const bool fitprofile_p1)
6982+
const bool update_display, const bool fitprofile_p1,
6983+
const REAL relative_length_tolerance, const REAL absolute_angle_tolerance_degree)
69806984
{
69816985
Crystal *pCrystal=&(mpDiff->GetCrystal());
69826986

@@ -6999,7 +7003,7 @@ void SpaceGroupExplorer::RunAll(const bool fitprofile_all, const bool verbose, c
69997003
cctbx::sgtbx::space_group_symbols s=it.next();
70007004
if(s.number()==0) break;
70017005
cctbx::sgtbx::space_group spg(s);
7002-
if(spg.is_compatible_unit_cell(uc,0.01,0.1)) nbspg++;
7006+
if(spg.is_compatible_unit_cell(uc,relative_length_tolerance, absolute_angle_tolerance_degree)) nbspg++;
70037007
//if(s.universal_hermann_mauguin().size()>hmlen) hmlen=s.universal_hermann_mauguin().size();
70047008
}
70057009
if(verbose) cout << boost::format("Beginning spacegroup exploration... %u to go...\n") % nbspg;
@@ -7018,7 +7022,7 @@ void SpaceGroupExplorer::RunAll(const bool fitprofile_all, const bool verbose, c
70187022
cctbx::sgtbx::space_group_symbols s=it.next();
70197023
if(s.number()==0) break;
70207024
cctbx::sgtbx::space_group spg(s);
7021-
bool compat=spg.is_compatible_unit_cell(uc,0.01,0.1);
7025+
bool compat=spg.is_compatible_unit_cell(uc,relative_length_tolerance,absolute_angle_tolerance_degree);
70227026
if(compat)
70237027
{
70247028
i++;
@@ -7041,8 +7045,9 @@ void SpaceGroupExplorer::RunAll(const bool fitprofile_all, const bool verbose, c
70417045
}
70427046
else
70437047
{
7044-
if(((s.number()==1) && fitprofile_p1) || fitprofile_all) mvSPG.push_back(this->Run(spg, true, false, false, update_display));
7045-
else mvSPG.push_back(this->Run(spg, false, false, true, update_display));
7048+
if(((s.number()==1) && fitprofile_p1) || fitprofile_all) mvSPG.push_back(this->Run(spg, true, false, false, update_display,
7049+
relative_length_tolerance, absolute_angle_tolerance_degree));
7050+
else mvSPG.push_back(this->Run(spg, false, false, true, update_display,relative_length_tolerance,absolute_angle_tolerance_degree));
70467051
if(s.number() == 1) nb_refl_p1 = mvSPG.back().nbreflused;
70477052
mvSPG.back().ngof *= mpDiff->GetNbReflBelowMaxSinThetaOvLambda() / (float)nb_refl_p1;
70487053
mvSPGExtinctionFingerprint.insert(make_pair(fgp, mvSPG.back()));

ObjCryst/ObjCryst/PowderPattern.h

+18-4
Original file line numberDiff line numberDiff line change
@@ -1211,22 +1211,31 @@ class SpaceGroupExplorer
12111211
* \param fitprofile: if true, will perform a full profile fitting instead of just Le Bail
12121212
* extraction. Much slower.
12131213
* \param restore_orig: if true, will go back to the original unit cell and spacegroup at the end
1214-
1214+
* \param relative_length_tolerance: relative length tolerance to determine compatible unit cells
1215+
* (i.e. the a/b ratio for quadratic spacegroups)
1216+
* \param absolute_angle_tolerance_degree: the absolute angular tolerance in degrees
1217+
* to determine compatible unit cells.
12151218
* \return: the SPGScore corresponding to this spacegroup
12161219
*/
12171220
SPGScore Run(const string &spg, const bool fitprofile=false, const bool verbose=false,
1218-
const bool restore_orig=false, const bool update_display=true);
1221+
const bool restore_orig=false, const bool update_display=true,
1222+
const REAL relative_length_tolerance=0.01, const REAL absolute_angle_tolerance_degree=0.5);
12191223
/** Run test on a single spacegroup
12201224
*
12211225
* \param spg: the cctbx::sgtbx::space_group
12221226
* \param fitprofile: if true, will perform a full profile fitting instead of just Le Bail
12231227
* extraction. Much slower.
12241228
* \param restore_orig: if true, will go back to the original unit cell and spacegroup at the end
12251229
* \param update_display: if true, update the display during the search
1230+
* \param relative_length_tolerance: relative length tolerance to determine compatible unit cells
1231+
* (i.e. the a/b ratio for quadratic spacegroups)
1232+
* \param absolute_angle_tolerance_degree: the absolute angular tolerance in degrees
1233+
* to determine compatible unit cells.
12261234
* \return: the SPGScore corresponding to this spacegroup
12271235
*/
12281236
SPGScore Run(const cctbx::sgtbx::space_group &spg, const bool fitprofile=false,
1229-
const bool verbose=false, const bool restore_orig=false, const bool update_display=true);
1237+
const bool verbose=false, const bool restore_orig=false, const bool update_display=true,
1238+
const REAL relative_length_tolerance=0.01, const REAL absolute_angle_tolerance_degree=0.5);
12301239
/** Run test on all spacegroups compatible with the unit cell
12311240
* Note that all scores's ngof values will be multiplied by nb_refl/nb_refl_P1 to
12321241
* have a better indicator of the quality taking into account the number of reflections used.
@@ -1238,10 +1247,15 @@ class SpaceGroupExplorer
12381247
* \param keep_best: if true, will keep the best solution at the end (default: restore the original one)
12391248
* \param update_display: if true, update the display during the search
12401249
* \param fitprofile_p1: if true, fit the profile for p1 (ignored if fitprofile_all=true)
1250+
* \param relative_length_tolerance: relative length tolerance to determine compatible unit cells
1251+
* (i.e. the a/b ratio for quadratic spacegroups)
1252+
* \param absolute_angle_tolerance_degree: the absolute angular tolerance in degrees
1253+
* to determine compatible unit cells.
12411254
* \return: the SPGScore corresponding to this spacegroup
12421255
*/
12431256
void RunAll(const bool fitprofile_all=false, const bool verbose=true, const bool keep_best=false,
1244-
const bool update_display=true, const bool fitprofile_p1=true);
1257+
const bool update_display=true, const bool fitprofile_p1=true,
1258+
const REAL relative_length_tolerance=0.01, const REAL absolute_angle_tolerance_degree=0.5);
12451259
/// Get the list of all scores obatined after using RunAll()
12461260
const list<SPGScore>& GetScores() const;
12471261
private:

0 commit comments

Comments
 (0)