Skip to content

Commit

Permalink
Merge pull request #43 from pavoljuhas/fix-spacegroup-recursion
Browse files Browse the repository at this point in the history
Fix spacegroup recursion - part 2
  • Loading branch information
vincefn authored May 11, 2019
2 parents 5f6e34f + 9a18bbd commit 5ae1776
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions ObjCryst/ObjCryst/CIF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,15 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX
unsigned int bestscore=0;
for(vector<string>::const_iterator posOrig=origin_list.begin();posOrig!=origin_list.end();++posOrig)
{
// The origin extension may not make sense, but this will be handled internally in SpaceGroup
pCryst->GetSpaceGroup().ChangeSpaceGroup(hmorig+*posOrig);
// The origin extension may not make sense, so we need to watch for exception
try
{
pCryst->GetSpaceGroup().ChangeSpaceGroup(hmorig+*posOrig);
}
catch(invalid_argument)
{
continue;
}

// If the symbol is the same as before, the origin probably was not understood - no need to test
if((posOrig!=origin_list.begin())&&(pCryst->GetSpaceGroup().GetName()==bestsymbol)) continue;
Expand Down
4 changes: 2 additions & 2 deletions ObjCryst/ObjCryst/SpaceGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ void SpaceGroup::InitSpaceGroup(const string &spgId)
{
(*fpObjCrystInformUser)("Could not interpret Spacegroup Symbol:"+spgId);
string emsg = "Space group symbol '" + spgId + "' not recognized";
throw ObjCrystException(emsg);
throw invalid_argument(emsg);
}
}

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

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

0 comments on commit 5ae1776

Please sign in to comment.