Skip to content

Commit ac1875a

Browse files
committed
Merge branch 'master' of github.com:vincefn/objcryst into upstream-objcryst
* 'master' of github.com:vincefn/objcryst: CreateCrystalFromCIF: throw exception if no crystal structure is found
2 parents dfbc220 + e7bb063 commit ac1875a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ObjCryst/ObjCryst/CIF.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,8 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX
10141014

10151015
bool import_multiple = true;
10161016
if(pCryst!=NULL) import_multiple = false;
1017-
1017+
bool crystal_found = false;
1018+
10181019
for(map<string,CIFData>::iterator pos=cif.mvData.begin();pos!=cif.mvData.end();++pos)
10191020
if(pos->second.mvLatticePar.size()==6)
10201021
{
@@ -1102,6 +1103,7 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX
11021103
else
11031104
pCryst->Init(pos->second.mvLatticePar[0],pos->second.mvLatticePar[1],pos->second.mvLatticePar[2],
11041105
pos->second.mvLatticePar[3],pos->second.mvLatticePar[4],pos->second.mvLatticePar[5],spg, "");
1106+
crystal_found = true;
11051107
if( (pos->second.mSpacegroupSymbolHall=="")
11061108
&&(pos->second.mvSymmetry_equiv_pos_as_xyz.size()>0)
11071109
&&(pos->second.mSpacegroupHermannMauguin!="")
@@ -1290,6 +1292,7 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX
12901292
if(pCryst->GetName()=="") pCryst->SetName(pCryst->GetFormula());
12911293
if(!import_multiple) return pCryst;
12921294
}
1295+
if(!crystal_found) throw ObjCrystException("CreateCrystalFromCIF: no structure found");
12931296
return pCryst;
12941297
}
12951298

0 commit comments

Comments
 (0)