22 #ifndef _OBJCRYST_MOLECULE_H_
23 #define _OBJCRYST_MOLECULE_H_
31 #include "ObjCryst/ObjCryst/General.h"
32 #include "ObjCryst/ObjCryst/ScatteringPower.h"
33 #include "ObjCryst/ObjCryst/Scatterer.h"
45 XYZ(REAL x=0,REAL y=0,REAL z=0);
64 MolAtom(
const REAL x,
const REAL y,
const REAL z,
72 void SetName(
const string &name);
73 const string& GetName()
const;
86 REAL GetOccupancy()
const;
88 void SetX(
const REAL)
const;
94 void SetY(
const REAL)
const;
95 void SetZ(
const REAL)
const;
97 void SetOccupancy(
const REAL);
105 virtual void XMLOutput(ostream &os,
int indent=0)
const;
106 virtual void XMLInput(istream &is,
const XMLCrystTag &tag);
111 bool IsInRing()
const;
133 mutable REAL
mX,mY,mZ;
150 void WXNotifyDelete();
186 const REAL length,
const REAL sigma,
const REAL delta,
187 Molecule &parent,
const REAL bondOrder=1.);
197 virtual void XMLOutput(ostream &os,
int indent=0)
const;
198 virtual void XMLInput(istream &is,
const XMLCrystTag &tag);
204 REAL
GetDeriv(
const std::map<const MolAtom*,XYZ> &m,
const bool llk=
false)
const;
213 const MolAtom& GetAtom1()
const;
214 const MolAtom& GetAtom2()
const;
219 REAL GetLength()
const;
220 REAL GetLength0()
const;
221 REAL GetLengthDelta()
const;
222 REAL GetLengthSigma()
const;
223 REAL GetBondOrder()
const;
228 void SetLength0(
const REAL length);
229 void SetLengthDelta(
const REAL length);
230 void SetLengthSigma(
const REAL length);
231 void SetBondOrder(
const REAL length);
232 bool IsFreeTorsion()
const;
233 void SetFreeTorsion(
const bool isInRing);
237 pair<MolAtom*,MolAtom*> mAtomPair;
238 REAL mLength0,mDelta,mSigma;
260 void WXNotifyDelete();
277 const REAL angle,
const REAL sigma,
const REAL delta,
285 string GetName()
const;
286 virtual void XMLOutput(ostream &os,
int indent=0)
const;
287 virtual void XMLInput(istream &is,
const XMLCrystTag &tag);
293 REAL
GetDeriv(
const std::map<const MolAtom*,XYZ> &m,
const bool llk=
false)
const;
302 REAL GetAngle()
const;
306 REAL GetAngle0()
const;
307 REAL GetAngleDelta()
const;
308 REAL GetAngleSigma()
const;
309 void SetAngle0(
const REAL angle);
310 void SetAngleDelta(
const REAL delta);
311 void SetAngleSigma(
const REAL sigma);
312 const MolAtom& GetAtom1()
const;
313 const MolAtom& GetAtom2()
const;
314 const MolAtom& GetAtom3()
const;
321 bool IsFlexible()
const;
322 void SetFlexible(
const bool isInRing);
323 std::size_t size()
const;
324 vector<MolAtom*>::const_iterator begin()
const;
325 vector<MolAtom*>::const_iterator end()
const;
331 REAL mAngle0,mDelta,mSigma;
355 void WXNotifyDelete();
373 const REAL angle,
const REAL sigma,
const REAL delta,
381 string GetName()
const;
382 virtual void XMLOutput(ostream &os,
int indent=0)
const;
383 virtual void XMLInput(istream &is,
const XMLCrystTag &tag);
389 REAL
GetDeriv(
const std::map<const MolAtom*,XYZ> &m,
const bool llk=
false)
const;
398 REAL GetAngle()
const;
402 REAL GetAngle0()
const;
403 REAL GetAngleDelta()
const;
404 REAL GetAngleSigma()
const;
405 void SetAngle0(
const REAL angle);
406 void SetAngleDelta(
const REAL delta);
407 void SetAngleSigma(
const REAL sigma);
408 const MolAtom& GetAtom1()
const;
409 const MolAtom& GetAtom2()
const;
410 const MolAtom& GetAtom3()
const;
411 const MolAtom& GetAtom4()
const;
420 std::size_t size()
const;
421 vector<MolAtom*>::const_iterator begin()
const;
422 vector<MolAtom*>::const_iterator end()
const;
428 REAL mAngle0, mDelta, mSigma;
448 void WXNotifyDelete();
462 const std::list<MolAtom*>& GetAtomList()
const;
463 std::list<MolAtom*>& GetAtomList();
467 std::list<MolAtom*> mvpAtom;
480 Quaternion(
const REAL q0,
const REAL q1,
const REAL q2,
const REAL q3,
bool unit=
true);
489 void XMLOutput(ostream &os,
int indent=0)
const;
500 const REAL& Q0()
const;
501 const REAL& Q1()
const;
502 const REAL& Q2()
const;
503 const REAL& Q3()
const;
512 mutable REAL
mQ0,mQ1,mQ2,mQ3;
513 bool mIsUniQuaternion;
529 std::string GetName()
const;
537 mutable REAL
mX,mY,mZ;
540 mutable std::set<unsigned int>
mvIdx;
559 virtual void CalcDeriv(
const bool derivllk=
true)
const=0;
561 virtual void Print(ostream &os,
bool full=
true)
const=0;
563 virtual void Stretch(
const REAL change,
const bool keepCenter=
true)=0;
565 virtual void RandomStretch(
const REAL amplitude,
const bool keepCenter=
true)=0;
602 virtual void CalcDeriv(
const bool derivllk=
true)
const;
604 virtual void Print(ostream &os,
bool full=
true)
const;
606 virtual void Stretch(
const REAL change,
const bool keepCenter=
true);
608 virtual void RandomStretch(
const REAL amplitude,
const bool keepCenter=
true);
631 virtual void CalcDeriv(
const bool derivllk=
true)
const;
633 virtual void Print(ostream &os,
bool full=
true)
const;
635 virtual void Stretch(
const REAL change,
const bool keepCenter=
true);
637 virtual void RandomStretch(
const REAL amplitude,
const bool keepCenter=
true);
662 virtual void CalcDeriv(
const bool derivllk=
true)
const;
664 virtual void Print(ostream &os,
bool full=
true)
const;
666 virtual void Stretch(
const REAL change,
const bool keepCenter=
true);
668 virtual void RandomStretch(
const REAL amplitude,
const bool keepCenter=
true);
693 virtual void CalcDeriv(
const bool derivllk=
true)
const;
695 virtual void Print(ostream &os,
bool full=
true)
const;
697 virtual void Stretch(
const REAL change,
const bool keepCenter=
true);
699 virtual void RandomStretch(
const REAL amplitude,
const bool keepCenter=
true);
722 std::set<MolBond*> &vb,
723 std::set<MolBondAngle*> &va,
724 std::set<MolDihedralAngle*> &vd);
726 void Print(ostream &os,
bool full=
true)
const;
727 std::set<MolAtom*> mvpAtom;
728 std::vector<MolBond*> mvpBond;
729 std::vector<MolBondAngle*> mvpBondAngle;
730 std::vector<MolDihedralAngle*> mvpDihedralAngle;
741 unsigned long mBondAtom,mBondAngleAtom,mDihedralAtom;
742 REAL mBondLength,mBondAngle,mDihedralAngle;
776 virtual void SetName(
const string &name);
779 virtual void Print()
const;
780 virtual void XMLOutput(ostream &os,
int indent=0)
const;
783 virtual void BeginOptimization(
const bool allowApproximations=
false,
const bool enableRestraints=
false);
791 virtual const CrystVector_REAL&
GetLSQCalc(
const unsigned int)
const;
792 virtual const CrystVector_REAL&
GetLSQObs(
const unsigned int)
const;
793 virtual const CrystVector_REAL&
GetLSQWeight(
const unsigned int)
const;
804 virtual void GLInitDisplayList(
const bool onlyIndependentAtoms=
false,
805 const REAL xMin=-.1,
const REAL xMax=1.1,
806 const REAL yMin=-.1,
const REAL yMax=1.1,
807 const REAL zMin=-.1,
const REAL zMax=1.1,
808 const bool displayEnantiomer=
false,
809 const bool displayNames=
false,
810 const bool hideHydrogens=
false,
811 const REAL fadeDistance=0,
812 const bool fullMoleculeInLimits=
false)
const;
819 void AddAtom(
const REAL x,
const REAL y,
const REAL z,
821 const bool updateDisplay=
true);
836 const REAL length,
const REAL sigma,
const REAL delta,
837 const REAL bondOrder=1.,
838 const bool updateDisplay=
true);
860 const REAL angle,
const REAL sigma,
const REAL delta,
861 const bool updateDisplay=
true);
879 const REAL angle,
const REAL sigma,
const REAL delta,
880 const bool updateDisplay=
true);
902 std::vector<RigidGroup*>::iterator
RemoveRigidGroup(
const RigidGroup &group,
const bool updateDisplay=
true,
const bool del =
true);
904 MolAtom &GetAtom(
unsigned int i);
905 const MolAtom &GetAtom(
unsigned int i)
const;
906 MolAtom &GetAtom(
const string &name);
907 const MolAtom &GetAtom(
const string &name)
const;
911 vector<MolAtom*>::reverse_iterator
FindAtom(
const string &name);
914 vector<MolAtom*>::const_reverse_iterator
FindAtom(
const string &name)
const;
952 const std::vector<MolBond*> &vb,
const std::vector<MolBondAngle*> &va,
953 const std::vector<MolDihedralAngle*> &vd,
954 std::map<
RigidGroup*,std::pair<XYZ,XYZ> > &vr, REAL nrj0=0);
955 const std::vector<MolAtom*>& GetAtomList()
const;
956 const std::vector<MolBond*>& GetBondList()
const;
957 const std::vector<MolBondAngle*>& GetBondAngleList()
const;
958 const std::vector<MolDihedralAngle*>& GetDihedralAngleList()
const;
959 std::vector<MolAtom*>& GetAtomList();
960 std::vector<MolBond*>& GetBondList();
961 std::vector<MolBondAngle*>& GetBondAngleList();
962 std::vector<MolDihedralAngle*>& GetDihedralAngleList();
964 std::list<StretchModeBondLength>& GetStretchModeBondLengthList();
965 std::list<StretchModeBondAngle>& GetStretchModeBondAngleList();
966 std::list<StretchModeTorsion>& GetStretchModeTorsionList();
968 const std::list<StretchModeBondLength>& GetStretchModeBondLengthList()
const;
969 const std::list<StretchModeBondAngle>& GetStretchModeBondAngleList()
const;
970 const std::list<StretchModeTorsion>& GetStretchModeTorsionList()
const;
985 const set<MolAtom *> &atoms,
const REAL angle,
986 const bool keepCenter=
true);
993 const set<MolAtom *> &atoms,
const REAL angle,
994 const bool keepCenter=
true);
1001 const REAL dx,
const REAL dy,
const REAL dz,
1002 const bool keepCenter=
true);
1042 const bool respectRestraint=
true);
1050 const bool respectRestraint=
true);
1058 const bool respectRestraint=
true);
1070 const std::vector<MolZAtom>&
AsZMatrix(
const bool keeporder)
const;
1202 REAL mBaseRotationAmplitude;
1228 unsigned long mLocalParamSet;
1229 mutable unsigned long mRandomConformChangeNbTest;
1230 mutable unsigned long mRandomConformChangeNbAccept;
1231 mutable REAL mRandomConformChangeTemp;
1233 bool mIsSelfOptimizing;
1372 std::set<StretchMode*> mvpStretchMode;
1373 std::set<const MolBond*> mvpBrokenBond;
1374 std::set<const MolBondAngle*> mvpBrokenBondAngle;
1375 std::set<const MolDihedralAngle*> mvpBrokenDihedralAngle;
1410 #ifdef __WX__CRYST__
1428 const map<
MolAtom*,set<MolAtom*> > &connect,
1429 set<MolAtom*> &atomlist,
const MolAtom* finalAtom=0);
1443 const map<
MolAtom*,set<MolAtom*> > &connect,
1444 map<MolAtom*,unsigned long> &atomlist,
const unsigned long maxdepth,
unsigned long depth=0);
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
REAL GetBondLength(const MolAtom &at1, const MolAtom &at2)
Get The Bond Length between two atoms.
Molecule * ZScatterer2Molecule(ZScatterer *scatt)
Converter from ZScatterer to a Molecule object.
void ExpandAtomGroupRecursive(MolAtom *atom, const map< MolAtom *, set< MolAtom * > > &connect, set< MolAtom * > &atomlist, const MolAtom *finalAtom)
Build recursively a list of atoms, starting from a one atom, and given a connectivity table.
REAL GetDihedralAngle(const MolAtom &at1, const MolAtom &at2, const MolAtom &at3, const MolAtom &at4)
Get The dihedral angle defined by 4 atoms.
REAL GetBondAngle(const MolAtom &at1, const MolAtom &at2, const MolAtom &at3)
Get The Bond Angle of 3 atoms.
Crystal class: Unit cell, spacegroup, scatterers.
Class to store POV-Ray output options.
Structure holding 3 coordinates, or deriviatives with respect to each of these coordinates.
MolAtom : atom inside a Molecule.
virtual ~MolAtom()
Destructor.
const ScatteringPower * mpScattPow
ScatteringPower.
REAL mX
Cartesian oordinates in the Molecule reference frame.
size_t int_ptr() const
Access to the integer address of this object, for unique identification from python.
bool mIsInRing
Is the atom in a ring ?
MolAtom(const REAL x, const REAL y, const REAL z, const ScatteringPower *pPow, const string &name, Molecule &parent)
Constructor for a MolAtom.
Molecule * mpMol
Parent Molecule.
bool IsDummy() const
Returns true if this is a dummy atom, i.e.
bool mIsNonFlipAtom
Can the atom be flipped (this is used for optically active atom which should keep their absolute conf...
void SetX(const REAL) const
Set the X,Y,Z coordinate - this is const because sometimes their coordinate must be changed even thou...
string mName
Name for this atom.
bool IsNonFlipAtom() const
Can this atom be flipped (return=false) or should its absolute configuration be kept (return=true)
REAL mOccupancy
Occupancy.
void SetNonFlipAtom(const bool nonflip)
Set a flag to prevent the atom's absolute configuration to be changed.
void SetIsInRing(const bool r) const
Flag this atom as being in a ring (or not).
Bond between two atoms, also a restraint on the associated bond length.
size_t int_ptr() const
Access to the integer address of this object, for unique identification from python.
virtual ~MolBond()
Destructor.
REAL mLLK
Stored log(likelihood)
REAL GetDeriv(const std::map< const MolAtom *, XYZ > &m, const bool llk=false) const
Get the derivative of the bond length, given the derivatives of the atom positions This requires that...
virtual REAL GetLogLikelihood() const
Get -ln(likelihood) for this restraint.
string GetName() const
Name of the bond, e.g. "C3-O4".
MolBond(MolAtom &atom1, MolAtom &atom2, const REAL length, const REAL sigma, const REAL delta, Molecule &parent, const REAL bondOrder=1.)
Constructor.
void CalcGradient(std::map< MolAtom *, XYZ > &m) const
Calc log(likelihood) gradient - versus all atomic coordinates.
Molecule * mpMol
Parent Molecule.
REAL mDerivLLKCoeff
The factor used to change the derivative of the length/angle, to the derivative of the log(likelihood...
XYZ mDerivAtom1
Derivatives of the bond length with respect to the coordinates of the atoms.
Bond angle restraint between 3 atoms.
virtual REAL GetLogLikelihood() const
Get -ln(likelihood) for this restraint.
REAL GetDeriv(const std::map< const MolAtom *, XYZ > &m, const bool llk=false) const
Get the derivative of the angle, given the derivatives of the atom positions This requires that GetLo...
bool mIsFlexible
When using the user-chosen flexibility model, this allows some flexibility for this bond angle,...
XYZ mDerivAtom1
Partial derivatives of the angle with respect to the coordinates of the atoms.
void CalcGradient(std::map< MolAtom *, XYZ > &m) const
Calc log(likelihood) gradient - versus all atomic coordinates.
MolBondAngle(MolAtom &atom1, MolAtom &atom2, MolAtom &atom3, const REAL angle, const REAL sigma, const REAL delta, Molecule &parent)
Constructor.
size_t int_ptr() const
Access to the integer address of this object, for unique identification from python.
REAL mLLK
Stored log(likelihood)
Molecule * mpMol
Parent Molecule.
vector< MolAtom * > mvpAtom
The vector of the 3 atoms involved in the bond angle.
REAL mDerivLLKCoeff
The factor used to change the derivative of the length/angle, to the derivative of the log(likelihood...
virtual ~MolBondAngle()
Destructor.
Dihedral angle restraint between 4 atoms.
XYZ mDerivAtom1
Partial derivatives of the angle with respect to the coordinates of the atoms.
size_t int_ptr() const
Access to the integer address of this object, for unique identification from python.
vector< MolAtom * > mvpAtom
The vector of the 4 atoms involved in the bond angle.
REAL mDerivLLKCoeff
The factor used to change the derivative of the length/angle, to the derivative of the log(likelihood...
virtual ~MolDihedralAngle()
Destructor.
void CalcGradient(std::map< MolAtom *, XYZ > &m) const
Calc log(likelihood) gradient - versus all atomic coordinates.
REAL mLLK
Stored log(likelihood)
MolDihedralAngle(MolAtom &atom1, MolAtom &atom2, MolAtom &atom3, MolAtom &atom4, const REAL angle, const REAL sigma, const REAL delta, Molecule &parent)
Constructor.
Molecule * mpMol
Parent Molecule.
virtual REAL GetLogLikelihood() const
Get -ln(likelihood) for this restraint.
REAL GetDeriv(const std::map< const MolAtom *, XYZ > &m, const bool llk=false) const
Get the derivative of the Angle, given the derivatives of the atom positions This requires that GetLo...
size_t int_ptr() const
Access to the integer address of this object, for unique identification from python.
A quaternion class, used to represent the orientation of the molecule.
Quaternion GetConjugate() const
Get the conjugate of this quaternion (== the inverse if unit quaternion)
Quaternion operator*(const Quaternion &q) const
Quaternion multiplication.
REAL mQ0
The components of the quaternion z=(q0,v) with v=(q1,q2,q3)
static Quaternion RotationQuaternion(const REAL ang, const REAL v1, const REAL v2, const REAL v3)
Create a rotation quaternion around a given vector for a given angle.
void Normalize() const
Re-normalize the quaternion to unity.
Quaternion()
Default constructor, yields q=(1,0,0,0)
void RotateVector(REAL &v1, REAL &v2, REAL &v3) const
Rotate vector v=(v1,v2,v3). The rotated components are directly written.
Rigid groups of atoms inside a molecule.
std::set< unsigned int > mvIdx
Temporary list of the atoms indices in the molecule, used during optimization This is created in Mole...
Quaternion mQuat
The unit quaternion defining the orientation - this is used during optimizations to rotate all atoms ...
size_t int_ptr() const
Access to the integer address of this object, for unique identification from python.
REAL mX
The translation of all the atoms as a group The values will be resetted whenever entering or leaving ...
Abstract base Stretch Mode for Molecule objects.
virtual void RandomStretch(const REAL amplitude, const bool keepCenter=true)=0
Move the atoms according to this mode, randomly.
virtual void Stretch(const REAL change, const bool keepCenter=true)=0
Move the atoms according to this mode.
std::map< const MolBondAngle *, REAL > mvpBrokenBondAngle
List of bond angle restraints modified by this mode The key is the restraint, the value is the deriva...
Molecule * mpMol
The Molecule corresponding to this stretch mode.
std::map< const MolAtom *, XYZ > mDerivXYZ
Derivative of the atomic positions versus a change of the bond length.
virtual void CalcDeriv(const bool derivllk=true) const =0
Calculate the derivative of the Molecule's Log(likelihood) and atomic positions versus a change of th...
std::map< const MolBond *, REAL > mvpBrokenBond
List of bond restraints affected by this mode The key is the restraint, the value is the derivative o...
virtual void Print(ostream &os, bool full=true) const =0
Print one-line list of atoms moved.
std::map< const MolDihedralAngle *, REAL > mvpBrokenDihedralAngle
List of dihedral angle restraints modified by this mode The key is the restraint, the value is the de...
REAL mBaseAmplitude
The recommended change amplitude, for a base global optimization displacement, to obtain an average 0...
REAL mLLKDeriv
Derivative of the Molecule's Log(likelihood) versus a change of the bond length.
Group of atoms for random moves changing a bond length.
virtual void RandomStretch(const REAL amplitude, const bool keepCenter=true)
Move the atoms according to this mode, randomly.
MolAtom * mpAtom0
The first atom (fixed).
const MolBond * mpBond
The (optional) bond length which this stretch mode should respect.
StretchModeBondLength(MolAtom &at0, MolAtom &at1, const MolBond *pBond)
Constructor If pBond!=0, the bond length restraint is respected.
virtual void Print(ostream &os, bool full=true) const
Print one-line list of atoms moved.
virtual void CalcDeriv(const bool derivllk=true) const
Calculate the derivative of the Molecule's Log(likelihood) and atomic positions versus a change of th...
set< MolAtom * > mvTranslatedAtomList
The set of atoms that are to be translated, including at1.
MolAtom * mpAtom1
The second atom (first atom moved)
virtual void Stretch(const REAL change, const bool keepCenter=true)
Move the atoms according to this mode.
Atoms moved when changing a bond angle.
MolAtom * mpAtom2
The third atom.
set< MolAtom * > mvRotatedAtomList
The set of atoms that are to be rotated around the direction going through at1 and perpendicular to t...
virtual void Print(ostream &os, bool full=true) const
Print one-line list of atoms moved.
virtual void RandomStretch(const REAL amplitude, const bool keepCenter=true)
Move the atoms according to this mode, randomly.
MolAtom * mpAtom0
The first atom.
virtual void CalcDeriv(const bool derivllk=true) const
Calculate the derivative of the Molecule's Log(likelihood) and atomic positions versus a change of th...
virtual void Stretch(const REAL change, const bool keepCenter=true)
Move the atoms according to this mode.
StretchModeBondAngle(MolAtom &at0, MolAtom &at1, MolAtom &at2, const MolBondAngle *pBondAngle)
Constructor If pBondAngle!=0, the bond angle length restraint is respected.
MolAtom * mpAtom1
The second atom.
const MolBondAngle * mpBondAngle
The (optional) bond angle restraint which this stretch mode should respect.
Atoms moved when rotated around a bond at0-at1-at2-at3.
MolAtom * mpAtom1
The first atom.
MolAtom * mpAtom2
The second atom.
StretchModeTorsion(MolAtom &at1, MolAtom &at2, const MolDihedralAngle *pDihedralAngle)
Constructor If pDihedralAngle!=0, the dihedral angle length restraint is respected.
virtual void Print(ostream &os, bool full=true) const
Print one-line list of atoms moved.
const MolDihedralAngle * mpDihedralAngle
The (optional) bond angle restraint which this stretch mode should respect.
virtual void RandomStretch(const REAL amplitude, const bool keepCenter=true)
Move the atoms according to this mode, randomly.
set< MolAtom * > mvRotatedAtomList
The set of atoms that are to be rotated around at1-at2.
virtual void Stretch(const REAL change, const bool keepCenter=true)
Move the atoms according to this mode.
virtual void CalcDeriv(const bool derivllk=true) const
Calculate the derivative of the Molecule's Log(likelihood) and atomic positions versus a change of th...
Atoms moved between two other atoms, using a "twist" of their positions - only small twists of their ...
MolAtom * mpAtom2
The second atom.
virtual void Print(ostream &os, bool full=true) const
Print one-line list of atoms moved.
set< MolAtom * > mvRotatedAtomList
The set of atoms that are to be rotated around at1-at2.
StretchModeTwist(MolAtom &at1, MolAtom &at2)
Constructor If pDihedralAngle!=0, the dihedral angle length restraint is respected.
virtual void Stretch(const REAL change, const bool keepCenter=true)
Move the atoms according to this mode.
MolAtom * mpAtom1
The first atom.
virtual void RandomStretch(const REAL amplitude, const bool keepCenter=true)
Move the atoms according to this mode, randomly.
virtual void CalcDeriv(const bool derivllk=true) const
Calculate the derivative of the Molecule's Log(likelihood) and atomic positions versus a change of th...
Groups of atoms that can be moved using molecular dynamics principles, taking a list of restraints as...
MDAtomGroup()
Default constructor.
void Print(ostream &os, bool full=true) const
Print one-line list of atoms moved.
Light-weight representation of an atom in the molecule, as a part of a Z-matrix.
Molecule : class for complex scatterer descriptions using cartesian coordinates with bond length/angl...
virtual const ScatteringComponentList & GetScatteringComponentList() const
Get the list of all scattering components for this scatterer.
vector< MolBondAngle * >::iterator RemoveBondAngle(const MolBondAngle &, const bool del=true)
Remove a BondAngle.
void BuildMDAtomGroups()
Find groups of atoms that cannot be moved relatively to each other using the free or non-free stretch...
void TranslateAtomGroup(const set< MolAtom * > &atoms, const REAL dx, const REAL dy, const REAL dz, const bool keepCenter=true)
Translate a group of atoms in a given direction.
map< MolAtom *, set< MolAtom * > > mConnectivityTable
Connectivity table: for each atom, keep the list of atoms bonded to it.
void InitOptions()
Build options for this object.
void BuildStretchModeTorsion()
Build the groups of atoms moved when changing a dihedral angle, while respecting the Molecule restrai...
void SetDeleteSubObjInDestructor(const bool b)
Set whether to delete the MolAtoms, MolBonds, MolBondAngles and MolDihedralAngles in the destructor.
vector< MolDihedralAngle * > mvpDihedralAngle
The list of dihedral angles.
std::list< StretchMode * > mvpStretchModeFree
Groups of StretchMode not breaking any restraint (unless the one they are associated to)
list< RotorGroup > mvRotorGroupTorsionSingleChain
List of RotorGroups corresponding to free torsion bonds, but with only one chain of atoms listed.
void SetCenterAtom(const MolAtom &at)
Get the atom defining the origin of the Molecule Equal to 0 if no atom as been set.
void AddBondAngle(MolAtom &atom1, MolAtom &atom2, MolAtom &atom3, const REAL angle, const REAL sigma, const REAL delta, const bool updateDisplay=true)
Add a bond angle restraint.
const MolAtom * GetCenterAtom() const
Get the atom defining the origin of the Molecule Equal to 0 if no atom as been set.
virtual ostream & POVRayDescription(ostream &os, const CrystalPOVRayOptions &options) const
virtual void EndOptimization()
This should be called by any optimization class at the end of an optimization.
RefObjOpt mFlexModel
OPtion for the different types of flexibility possible for this molecule: rigid body,...
list< MolRing > mvRing
The list of rings.
virtual void SetName(const string &name)
Name of the object.
void BuildRotorGroup()
Build the groups of atoms that will be rotated during global optimization.
void BuildStretchModeBondAngle()
Build the groups of atoms moved when changing a bond angle, while respecting the Molecule restraints.
virtual unsigned int GetNbLSQFunction() const
Number of LSQ functions.
std::vector< RigidGroup * > mvRigidGroup
Rigid groups of atoms.
std::vector< MolZAtom > mAsZMatrix
The Molecule, as a lightweight ZMatrix, for export purposes.
void BuildConnectivityTable() const
Build the Connectivity table.
list< MDAtomGroup > mvMDAtomGroup
Groups of atoms that should be moved according to molecular dynamics principles.
RefObjOpt mMoleculeCenter
Option to choose the center of rotation of the Molecule for the global orientation either as the geom...
void FlipAtomGroup(const FlipGroup &, const bool keepCenter=true)
Flip a group of atom. See Molecule::FlipGroup.
list< StretchModeTwist > mvStretchModeTwist
List of StretchModeTwist.
void UpdateScattCompList() const
Update the Molecule::mScattCompList from the cartesian coordinates of all atoms, and the orientation ...
vector< MolDihedralAngle * >::iterator RemoveDihedralAngle(const MolDihedralAngle &, const bool del=true)
Remove a dihedral angle.
void RigidifyWithDihedralAngles()
Add dihedral angles so as to rigidify the Molecule.
list< StretchModeBondAngle > mvStretchModeBondAngle
List of StretchModeBondLength.
const std::vector< RigidGroup * > & GetRigidGroupList() const
List of rigid group of atoms.
virtual void InitRefParList()
vector< MolBondAngle * >::const_iterator FindBondAngle(const MolAtom &at1, const MolAtom &at0, const MolAtom &at2) const
Searches whether a bond between three atoms already exists, searching for either (at1,...
bool mDeleteSubObjInDestructor
Base Rotation amplitude (in radians) for the Molecule, so that the average atomic displacement is equ...
REAL mMDMoveEnergy
Relative energy of molecule during molecular dynamics move Default: 40, 10 (slow conformation change)...
Quaternion mQuat
The unit quaternion defining the orientation.
CrystVector_REAL mLSQObs
Current LSQ Calc - one value for each restraint (bond distance, angle or dihedral angle ideal values)
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
vector< MolAtom * >::iterator RemoveAtom(MolAtom &, const bool del=true)
Remove an atom.
virtual void BeginOptimization(const bool allowApproximations=false, const bool enableRestraints=false)
This should be called by any optimization class at the begining of an optimization.
vector< MolDihedralAngle * >::const_iterator FindDihedralAngle(const MolAtom &at1, const MolAtom &at2, const MolAtom &at3, const MolAtom &at4) const
Searches whether a dihedral between four atoms already exists, searching for either (at1,...
RefinableObjClock & GetRigidGroupClock()
Get the clock associated to the list of rigid groups (clicked also whenever a rigid group is modified...
virtual void TagNewBestConfig() const
During a global optimization, tells the object that the current config is the latest "best" config.
CrystVector_REAL mLSQWeight
Current LSQ Calc - one value for each restraint(bond distance, angle or dihedral angle sigmas)
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
vector< MolBond * >::const_iterator FindBond(const MolAtom &, const MolAtom &) const
Searches whether a bond between two atoms already exists.
list< FlipGroup > mvFlipGroup
The list of FlipGroups.
void AddAtom(const REAL x, const REAL y, const REAL z, const ScatteringPower *pPow, const string &name, const bool updateDisplay=true)
Add an atom.
virtual Molecule * CreateCopy() const
vector< MolAtom * >::reverse_iterator FindAtom(const string &name)
Search a MolAtom from its name.
REAL mLogLikelihoodScale
Scale (multiplier) for the log(likelihood)
void BuildStretchModeTwist()
Build the groups of atoms used to twist internally the Molecule, e.g.
virtual const CrystVector_REAL & GetLSQObs(const unsigned int) const
Get the observed values for the LSQ function.
virtual int GetNbComponent() const
Number of components in the scatterer (eg number of point scatterers)
void BuildStretchModeGroups()
Separate StretchMode that break more than their assigned restraint from others.
const RefinableObjClock & GetAtomScattPowClock() const
Get the clock associated to the scattering powers.
const std::vector< MolZAtom > & AsZMatrix(const bool keeporder) const
Molecule as Z-matrix.
list< StretchModeTorsion > mvStretchModeTorsion
List of StretchModeBondLength.
RefinableObjClock mClockRestraint
This clock is the parent of mClockAtomList, mClockBondList, mClockBondAngleList, mClockDihedralAngleL...
void AddRigidGroup(const RigidGroup &, const bool updateDisplay=true)
Add a rigid group of atoms.
RefObjOpt mOptimizeOrientation
Option to optimize the Molecule's orientation.
void OptimizeConformation(const long nbTrial=10000, const REAL stopCost=0.)
Minimize configuration from internal restraints (bond lengths, angles and dihedral angles).
const MolAtom * mpCenterAtom
Atom chosen as center of rotation, if mRotationCenter is set to use an atom rather than the geometric...
virtual void RandomizeConfiguration()
Randomize Configuration (before a global optimization).
void BuildRingList()
Build the list of rings in the molecule.
virtual REAL GetLogLikelihood() const
Get -log(likelihood) of the current configuration for the object.
void MolecularDynamicsEvolve(std::map< MolAtom *, XYZ > &v0, const unsigned nbStep, const REAL dt, const std::vector< MolBond * > &vb, const std::vector< MolBondAngle * > &va, const std::vector< MolDihedralAngle * > &vd, std::map< RigidGroup *, std::pair< XYZ, XYZ > > &vr, REAL nrj0=0)
Change the conformation of the molecule using molecular dynamics principles.
std::string GetFormula() const
Formula with atoms in alphabetic order.
void RestraintStatus(ostream &os) const
Print the status of all restraints (bond length, angles...)
void RotateAtomGroup(const MolAtom &at1, const MolAtom &at2, const set< MolAtom * > &atoms, const REAL angle, const bool keepCenter=true)
Rotate a group of atoms around an axis defined by two atoms.
vector< MolBondAngle * > mvpBondAngle
The list of bond angles.
void RestraintExport(ostream &os) const
Print the restraints (bond length, angles...) as whole labels and number in column text format which ...
void TuneGlobalOptimRotationAmplitude()
Tune the rotation amplitude for free torsions and for the overall Molecule Rotation.
CrystVector_REAL mLSQCalc
Current LSQ Calc - one value for each restraint (bond distance, angle or dihedral angle)
vector< MolBond * >::iterator RemoveBond(const MolBond &, const bool del=true)
Remove a bond.
void AddBond(MolAtom &atom1, MolAtom &atom2, const REAL length, const REAL sigma, const REAL delta, const REAL bondOrder=1., const bool updateDisplay=true)
Add a bond.
list< StretchModeBondLength > mvStretchModeBondLength
List of StretchModeBondLength.
virtual string GetComponentName(const int i) const
Name for the i-th component of this scatterer.
virtual void UpdateDisplay() const
If there is an interface, this should be automatically be called each time there is a 'new,...
vector< MolBond * > mvpBond
The list of bonds.
void ResetRigidGroupsPar() const
Set the orientation & translation parameters of all rigid groups to 0, after correcting the atomic po...
void AddDihedralAngle(MolAtom &atom1, MolAtom &atom2, MolAtom &atom3, MolAtom &atom4, const REAL angle, const REAL sigma, const REAL delta, const bool updateDisplay=true)
Add a dihedral angle restraint.
virtual void Print() const
Print some info about the scatterer (ideally this should be one line...).
std::vector< RigidGroup * >::iterator RemoveRigidGroup(const RigidGroup &group, const bool updateDisplay=true, const bool del=true)
Remove a rigid group of atoms.
const map< MolAtom *, set< MolAtom * > > & GetConnectivityTable()
Get the connectivity table.
void BuildStretchModeBondLength()
Build the groups of atoms moved when stretching a bond length, while respecting the Molecule restrain...
void OptimizeConformationSteepestDescent(const REAL maxStep=0.1, const unsigned nbStep=1)
Optimize the conformation from internal restraints (bond lengths, angles and dihedral angles),...
list< RotorGroup > mvRotorGroupInternal
List of RotorGroups for internal rotations.
void BuildFlipGroup()
Build the groups of atoms that can be flipped.
REAL mLogLikelihood
The current log(likelihood)
virtual const CrystVector_REAL & GetLSQDeriv(const unsigned int n, RefinablePar &par)
Get the first derivative values for the LSQ function, for a given parameter.
Molecule(Crystal &cryst, const string &name="")
Constructor.
vector< MolAtom * > mvpAtom
The list of atoms.
map< MolAtom *, std::vector< MolBond * > > mvAtomBond
List of Bonds for each atom.
REAL BondAngleRandomChange(const StretchModeBondAngle &mode, const REAL amplitude, const bool respectRestraint=true)
change a bond angle, while respecting the Restraint (if any).
REAL BondLengthRandomChange(const StretchModeBondLength &mode, const REAL amplitude, const bool respectRestraint=true)
Stretch a bond, while respecting the Restraint (if any).
RefinableObjClock & GetBondListClock()
get the clock associated to the list of bonds
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type)
Make a random move of the current configuration.
RefinableObjClock & GetAtomPositionClock()
Get the clock associated to the atomic positions.
ScatteringComponentList mScattCompList
The list of scattering components.
RefObjOpt mAutoOptimizeConformation
Option to automatically optimize the starting conformation, if the total restraint cost is too high.
std::list< StretchMode * > mvpStretchModeNotFree
Groups of StretchMode breaking restraints (beyond the one they are associated to)
REAL mMDMoveFreq
Frequency of using molecular dynamics move during GlobalOptRandomMove()
virtual const CrystVector_REAL & GetLSQCalc(const unsigned int) const
Get the current calculated value for the LSQ function.
std::set< MolAtom * > mvMDFullAtomGroup
Full list of atoms that can be moved using molecular dynamics This excludes any atom part of a rigid ...
virtual const CrystVector_REAL & GetLSQWeight(const unsigned int) const
Get the weight values for the LSQ function.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
list< RotorGroup > mvRotorGroupTorsion
List of RotorGroups corresponding to free torsion bonds.
REAL DihedralAngleRandomChange(const StretchModeTorsion &mode, const REAL amplitude, const bool respectRestraint=true)
Change a dihedral angle, while respecting the Restraint (if any).
Defines a group of atoms which can be rotated around an axis defined by two other atoms.
RotorGroup(const MolAtom &at1, const MolAtom &at2)
Constructor, with the two atoms around which the rotation shall be made.
set< MolAtom * > mvRotatedAtomList
The set of atoms that are to be rotated.
const MolAtom * mpAtom1
The first atom defining the rotation axis.
REAL mBaseRotationAmplitude
The recommended rotation amplitude, for a base global optimization displacement, to obtain an average...
const MolAtom * mpAtom2
The second atom defining the rotation axis.
When 3(A1..1n) or more atoms are connected to a same atom A, it defines a 'flip' group,...
list< pair< const MolAtom *, set< MolAtom * > > > mvRotatedChainList
The set of atoms that are to be rotated during the flip.
const MolAtom * mpAtom2
The second atom defining the rotation axis.
const MolAtom * mpAtom0
The atom which is an asymmetric center.
FlipGroup(const MolAtom &at0, const MolAtom &at1, const MolAtom &at2)
Constructor, with the central atom.
unsigned long mNbTest
Number of times this flip has been tried, and the number of times it has been accepted.
const MolAtom * mpAtom1
The first atom defining the rotation axis.
Group of concurrent StretchModes (affecting common restraints) A given stretch mode can only belong t...
Generic type of scatterer: can be an atom, or a more complex assembly of atoms.
Abstract Base Class to describe the scattering power of any Scatterer component in a crystal.
list of scattering positions in a crystal, associated with the corresponding occupancy and a pointer ...
ZScatterer: the basic type of complex scatterers, where atom positions are defined using a standard "...
class to input or output a well-formatted xml beginning or ending tag.
class of refinable parameter types.
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
Restraint: generic class for a restraint of a given model.
Generic class for parameters of refinable objects.
Abstract base class for all objects in wxCryst.