Skip to content

Commit 5ae1776

Browse files
authored
Merge pull request #43 from pavoljuhas/fix-spacegroup-recursion
Fix spacegroup recursion - part 2
2 parents 5f6e34f + 9a18bbd commit 5ae1776

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ObjCryst/ObjCryst/CIF.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,8 +1120,15 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX
11201120
unsigned int bestscore=0;
11211121
for(vector<string>::const_iterator posOrig=origin_list.begin();posOrig!=origin_list.end();++posOrig)
11221122
{
1123-
// The origin extension may not make sense, but this will be handled internally in SpaceGroup
1124-
pCryst->GetSpaceGroup().ChangeSpaceGroup(hmorig+*posOrig);
1123+
// The origin extension may not make sense, so we need to watch for exception
1124+
try
1125+
{
1126+
pCryst->GetSpaceGroup().ChangeSpaceGroup(hmorig+*posOrig);
1127+
}
1128+
catch(invalid_argument)
1129+
{
1130+
continue;
1131+
}
11251132

11261133
// If the symbol is the same as before, the origin probably was not understood - no need to test
11271134
if((posOrig!=origin_list.begin())&&(pCryst->GetSpaceGroup().GetName()==bestsymbol)) continue;

ObjCryst/ObjCryst/SpaceGroup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ void SpaceGroup::InitSpaceGroup(const string &spgId)
603603
{
604604
(*fpObjCrystInformUser)("Could not interpret Spacegroup Symbol:"+spgId);
605605
string emsg = "Space group symbol '" + spgId + "' not recognized";
606-
throw ObjCrystException(emsg);
606+
throw invalid_argument(emsg);
607607
}
608608
}
609609

@@ -654,7 +654,7 @@ void SpaceGroup::InitSpaceGroup(const string &spgId)
654654
}
655655
VFN_DEBUG_EXIT("SpaceGroup::InitSpaceGroup() could not interpret spacegroup:"<<spgId<<":"<<ex.what(),8)
656656
string emsg = "Space group symbol '" + spgId + "' not recognized";
657-
throw ObjCrystException(emsg);
657+
throw invalid_argument(emsg);
658658
}
659659

660660
mExtension=this->GetCCTbxSpg().match_tabulated_settings().extension();

0 commit comments

Comments
 (0)