Skip to content

Commit

Permalink
Merge pull request #15 from vincefn/master
Browse files Browse the repository at this point in the history
Update libobjcryst
  • Loading branch information
sbillinge authored Jun 21, 2021
2 parents 4bb5517 + 2f81f37 commit 8382a88
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/ObjCryst/ObjCryst/CIF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,8 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX

bool import_multiple = true;
if(pCryst!=NULL) import_multiple = false;

bool crystal_found = false;

for(map<string,CIFData>::iterator pos=cif.mvData.begin();pos!=cif.mvData.end();++pos)
if(pos->second.mvLatticePar.size()==6)
{
Expand Down Expand Up @@ -1102,6 +1103,7 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX
else
pCryst->Init(pos->second.mvLatticePar[0],pos->second.mvLatticePar[1],pos->second.mvLatticePar[2],
pos->second.mvLatticePar[3],pos->second.mvLatticePar[4],pos->second.mvLatticePar[5],spg, "");
crystal_found = true;
if( (pos->second.mSpacegroupSymbolHall=="")
&&(pos->second.mvSymmetry_equiv_pos_as_xyz.size()>0)
&&(pos->second.mSpacegroupHermannMauguin!="")
Expand Down Expand Up @@ -1290,6 +1292,7 @@ Crystal* CreateCrystalFromCIF(CIF &cif,const bool verbose,const bool checkSymAsX
if(pCryst->GetName()=="") pCryst->SetName(pCryst->GetFormula());
if(!import_multiple) return pCryst;
}
if(!crystal_found) throw ObjCrystException("CreateCrystalFromCIF: no structure found");
return pCryst;
}

Expand Down
17 changes: 17 additions & 0 deletions src/ObjCryst/ObjCryst/Molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ bool MolAtom::IsNonFlipAtom() const
return mIsNonFlipAtom;
}

size_t MolAtom::int_ptr() const {return (size_t)this;}

#ifdef __WX__CRYST__
WXCrystObjBasic* MolAtom::WXCreate(wxWindow* parent)
{
Expand Down Expand Up @@ -634,6 +636,9 @@ void MolBond::SetFreeTorsion(const bool isFreeTorsion)
mIsFreeTorsion=isFreeTorsion;
mpMol->GetBondListClock().Click();
}

size_t MolBond::int_ptr() const {return (size_t)this;}

#ifdef __WX__CRYST__
WXCrystObjBasic* MolBond::WXCreate(wxWindow* parent)
{
Expand Down Expand Up @@ -941,6 +946,9 @@ void MolBondAngle::SetAtom3(MolAtom& at){mvpAtom[2]=&at;}
std::size_t MolBondAngle::size() const {return mvpAtom.size();}
vector<MolAtom*>::const_iterator MolBondAngle::begin() const {return mvpAtom.begin();}
vector<MolAtom*>::const_iterator MolBondAngle::end() const {return mvpAtom.end();}

size_t MolBondAngle::int_ptr() const {return (size_t)this;}

#ifdef __WX__CRYST__
WXCrystObjBasic* MolBondAngle::WXCreate(wxWindow* parent)
{
Expand Down Expand Up @@ -1301,6 +1309,9 @@ MolAtom& MolDihedralAngle::GetAtom4(){return *(mvpAtom[3]);}
std::size_t MolDihedralAngle::size() const {return mvpAtom.size();}
vector<MolAtom*>::const_iterator MolDihedralAngle::begin() const {return mvpAtom.begin();}
vector<MolAtom*>::const_iterator MolDihedralAngle::end() const {return mvpAtom.end();}

size_t MolDihedralAngle::int_ptr() const {return (size_t)this;}

#ifdef __WX__CRYST__
WXCrystObjBasic* MolDihedralAngle::WXCreate(wxWindow* parent)
{
Expand All @@ -1325,6 +1336,9 @@ string RigidGroup::GetName()const
for(;at!=this->end();++at) name+=", "+(*at)->GetName();
return name;
}

size_t RigidGroup::int_ptr() const {return (size_t)this;}

//######################################################################
//
// MolRing
Expand All @@ -1338,6 +1352,9 @@ const std::list<MolAtom*>& MolRing::GetAtomList()const

std::list<MolAtom*>& MolRing::GetAtomList()
{return mvpAtom;}

size_t MolRing::int_ptr() const {return (size_t)this;}

//######################################################################
//
// Quaternion
Expand Down
13 changes: 12 additions & 1 deletion src/ObjCryst/ObjCryst/Molecule.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class MolAtom
void SetNonFlipAtom(const bool nonflip);
/// Can this atom be flipped (return=false) or should its absolute configuration be kept (return=true)
bool IsNonFlipAtom() const;
/// Access to the integer address of this object, for unique identification from python
size_t int_ptr() const;
private:
/// Name for this atom
string mName;
Expand Down Expand Up @@ -229,7 +231,8 @@ class MolBond:public Restraint
void SetBondOrder(const REAL length);
bool IsFreeTorsion()const;
void SetFreeTorsion(const bool isInRing);

/// Access to the integer address of this object, for unique identification from python
size_t int_ptr() const;
private:
pair<MolAtom*,MolAtom*> mAtomPair;
REAL mLength0,mDelta,mSigma;
Expand Down Expand Up @@ -320,6 +323,8 @@ class MolBondAngle:public Restraint
std::size_t size() const;
vector<MolAtom*>::const_iterator begin() const;
vector<MolAtom*>::const_iterator end() const;
/// Access to the integer address of this object, for unique identification from python
size_t int_ptr() const;
private:
/// The vector of the 3 atoms involved in the bond angle.
vector<MolAtom*> mvpAtom;
Expand Down Expand Up @@ -415,6 +420,8 @@ class MolDihedralAngle:public Restraint
std::size_t size() const;
vector<MolAtom*>::const_iterator begin() const;
vector<MolAtom*>::const_iterator end() const;
/// Access to the integer address of this object, for unique identification from python
size_t int_ptr() const;
private:
/// The vector of the 4 atoms involved in the bond angle.
vector<MolAtom*> mvpAtom;
Expand Down Expand Up @@ -454,6 +461,8 @@ class MolRing
MolRing();
const std::list<MolAtom*>& GetAtomList()const;
std::list<MolAtom*>& GetAtomList();
/// Access to the integer address of this object, for unique identification from python
size_t int_ptr() const;
private:
std::list<MolAtom*> mvpAtom;
};
Expand Down Expand Up @@ -529,6 +538,8 @@ class RigidGroup:public std::set<MolAtom *>
/// Temporary list of the atoms indices in the molecule, used during optimization
/// This is created in Molecule::BeginOptimization()
mutable std::set<unsigned int> mvIdx;
/// Access to the integer address of this object, for unique identification from python
size_t int_ptr() const;
};

/** Abstract base Stretch Mode for Molecule objects
Expand Down
1 change: 1 addition & 0 deletions src/ObjCryst/RefinableObj/RefinableObj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1981,6 +1981,7 @@ void RefinableObj::TagNewBestConfig()const
}
const RefinableObjClock& RefinableObj::GetClockMaster()const{return mClockMaster;}

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

void RefinableObj::UpdateDisplay()const
{
Expand Down
2 changes: 2 additions & 0 deletions src/ObjCryst/RefinableObj/RefinableObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,8 @@ class RefinableObj
virtual void TagNewBestConfig()const;
/// This clocks records _any_ change in the object. See refinableObj::mClockMaster
const RefinableObjClock& GetClockMaster()const;
/// Access to the integer address of this object, for unique identification from python
size_t int_ptr() const;
protected:
/// Find a refinable parameter with a given name
long FindPar(const string &name) const;
Expand Down

0 comments on commit 8382a88

Please sign in to comment.