Skip to content

Commit 8382a88

Browse files
authored
Merge pull request #15 from vincefn/master
Update libobjcryst
2 parents 4bb5517 + 2f81f37 commit 8382a88

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

src/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

src/ObjCryst/ObjCryst/Molecule.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ bool MolAtom::IsNonFlipAtom() const
355355
return mIsNonFlipAtom;
356356
}
357357

358+
size_t MolAtom::int_ptr() const {return (size_t)this;}
359+
358360
#ifdef __WX__CRYST__
359361
WXCrystObjBasic* MolAtom::WXCreate(wxWindow* parent)
360362
{
@@ -634,6 +636,9 @@ void MolBond::SetFreeTorsion(const bool isFreeTorsion)
634636
mIsFreeTorsion=isFreeTorsion;
635637
mpMol->GetBondListClock().Click();
636638
}
639+
640+
size_t MolBond::int_ptr() const {return (size_t)this;}
641+
637642
#ifdef __WX__CRYST__
638643
WXCrystObjBasic* MolBond::WXCreate(wxWindow* parent)
639644
{
@@ -941,6 +946,9 @@ void MolBondAngle::SetAtom3(MolAtom& at){mvpAtom[2]=&at;}
941946
std::size_t MolBondAngle::size() const {return mvpAtom.size();}
942947
vector<MolAtom*>::const_iterator MolBondAngle::begin() const {return mvpAtom.begin();}
943948
vector<MolAtom*>::const_iterator MolBondAngle::end() const {return mvpAtom.end();}
949+
950+
size_t MolBondAngle::int_ptr() const {return (size_t)this;}
951+
944952
#ifdef __WX__CRYST__
945953
WXCrystObjBasic* MolBondAngle::WXCreate(wxWindow* parent)
946954
{
@@ -1301,6 +1309,9 @@ MolAtom& MolDihedralAngle::GetAtom4(){return *(mvpAtom[3]);}
13011309
std::size_t MolDihedralAngle::size() const {return mvpAtom.size();}
13021310
vector<MolAtom*>::const_iterator MolDihedralAngle::begin() const {return mvpAtom.begin();}
13031311
vector<MolAtom*>::const_iterator MolDihedralAngle::end() const {return mvpAtom.end();}
1312+
1313+
size_t MolDihedralAngle::int_ptr() const {return (size_t)this;}
1314+
13041315
#ifdef __WX__CRYST__
13051316
WXCrystObjBasic* MolDihedralAngle::WXCreate(wxWindow* parent)
13061317
{
@@ -1325,6 +1336,9 @@ string RigidGroup::GetName()const
13251336
for(;at!=this->end();++at) name+=", "+(*at)->GetName();
13261337
return name;
13271338
}
1339+
1340+
size_t RigidGroup::int_ptr() const {return (size_t)this;}
1341+
13281342
//######################################################################
13291343
//
13301344
// MolRing
@@ -1338,6 +1352,9 @@ const std::list<MolAtom*>& MolRing::GetAtomList()const
13381352

13391353
std::list<MolAtom*>& MolRing::GetAtomList()
13401354
{return mvpAtom;}
1355+
1356+
size_t MolRing::int_ptr() const {return (size_t)this;}
1357+
13411358
//######################################################################
13421359
//
13431360
// Quaternion

src/ObjCryst/ObjCryst/Molecule.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class MolAtom
117117
void SetNonFlipAtom(const bool nonflip);
118118
/// Can this atom be flipped (return=false) or should its absolute configuration be kept (return=true)
119119
bool IsNonFlipAtom() const;
120+
/// Access to the integer address of this object, for unique identification from python
121+
size_t int_ptr() const;
120122
private:
121123
/// Name for this atom
122124
string mName;
@@ -229,7 +231,8 @@ class MolBond:public Restraint
229231
void SetBondOrder(const REAL length);
230232
bool IsFreeTorsion()const;
231233
void SetFreeTorsion(const bool isInRing);
232-
234+
/// Access to the integer address of this object, for unique identification from python
235+
size_t int_ptr() const;
233236
private:
234237
pair<MolAtom*,MolAtom*> mAtomPair;
235238
REAL mLength0,mDelta,mSigma;
@@ -320,6 +323,8 @@ class MolBondAngle:public Restraint
320323
std::size_t size() const;
321324
vector<MolAtom*>::const_iterator begin() const;
322325
vector<MolAtom*>::const_iterator end() const;
326+
/// Access to the integer address of this object, for unique identification from python
327+
size_t int_ptr() const;
323328
private:
324329
/// The vector of the 3 atoms involved in the bond angle.
325330
vector<MolAtom*> mvpAtom;
@@ -415,6 +420,8 @@ class MolDihedralAngle:public Restraint
415420
std::size_t size() const;
416421
vector<MolAtom*>::const_iterator begin() const;
417422
vector<MolAtom*>::const_iterator end() const;
423+
/// Access to the integer address of this object, for unique identification from python
424+
size_t int_ptr() const;
418425
private:
419426
/// The vector of the 4 atoms involved in the bond angle.
420427
vector<MolAtom*> mvpAtom;
@@ -454,6 +461,8 @@ class MolRing
454461
MolRing();
455462
const std::list<MolAtom*>& GetAtomList()const;
456463
std::list<MolAtom*>& GetAtomList();
464+
/// Access to the integer address of this object, for unique identification from python
465+
size_t int_ptr() const;
457466
private:
458467
std::list<MolAtom*> mvpAtom;
459468
};
@@ -529,6 +538,8 @@ class RigidGroup:public std::set<MolAtom *>
529538
/// Temporary list of the atoms indices in the molecule, used during optimization
530539
/// This is created in Molecule::BeginOptimization()
531540
mutable std::set<unsigned int> mvIdx;
541+
/// Access to the integer address of this object, for unique identification from python
542+
size_t int_ptr() const;
532543
};
533544

534545
/** Abstract base Stretch Mode for Molecule objects

src/ObjCryst/RefinableObj/RefinableObj.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,7 @@ void RefinableObj::TagNewBestConfig()const
19811981
}
19821982
const RefinableObjClock& RefinableObj::GetClockMaster()const{return mClockMaster;}
19831983

1984+
size_t RefinableObj::int_ptr() const {return (size_t)this;}
19841985

19851986
void RefinableObj::UpdateDisplay()const
19861987
{

src/ObjCryst/RefinableObj/RefinableObj.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,8 @@ class RefinableObj
12381238
virtual void TagNewBestConfig()const;
12391239
/// This clocks records _any_ change in the object. See refinableObj::mClockMaster
12401240
const RefinableObjClock& GetClockMaster()const;
1241+
/// Access to the integer address of this object, for unique identification from python
1242+
size_t int_ptr() const;
12411243
protected:
12421244
/// Find a refinable parameter with a given name
12431245
long FindPar(const string &name) const;

0 commit comments

Comments
 (0)