Logo Search packages:      
Sourcecode: objcryst-fox version File versions  Download package

ObjCryst::Crystal Class Reference

#include <Crystal.h>

Inheritance diagram for ObjCryst::Crystal:

ObjCryst::UnitCell ObjCryst::RefinableObj

List of all members.


Detailed Description

Crystal class: Unit cell, spacegroup, scatterers.

A Crystal object has several main characteristics : (1) a unit cell, (2) a Spacegroup and (3) a list of Scatterer. Also stored in the Crystal is a list of the ScttaringPower used by all the scatterers of this crystal.

The crystal is capable of giving a list of all scattering components (ie the list of all unique scattering 'points' (ScatteringComponent, ie atoms) in the unit cell, each associated to a ScatteringPower).

When those scattering components are on a special position or overlapping with another component of the same type, it is possible to correct dynamically the occupancy of this/these components to effectively have only one component instead of several due to the overlapping. This method is interesting for global optimization where atoms must not be "locked" on a special position. If this "Dynamical Occupancy Correction" is used then no occupancy should be corrected for special positions, since this will be done dynamically.

A crystal structure can be viewed in 3D using OpenGL.

Todo:
exporting (and importing) crystal structures to/from other files format than ObjCryst's XML (eg CIF, and format used by refinement software)
Currently only 3D crystal structures can be handled, with no magnetic structure (that may be done later) and no incommensurate structure.

Definition at line 97 of file Crystal.h.


Public Types

typedef std::map< pair< const
ScatteringPower *, const
ScatteringPower * >
, Crystal::BumpMergePar
VBumpMergePar

Public Member Functions

void AddBondValenceRo (const ScatteringPower &, const ScatteringPower &, const REAL ro)
void AddPar (RefinableObj &newRefParList, const bool copyParam=false)
void AddPar (RefinablePar *newRefPar)
void AddPar (const RefinablePar &newRefPar)
void AddRestraint (Restraint *pNewRestraint)
void AddScatterer (Scatterer *scatt)
 Add a scatterer to the crystal.
void AddScatteringPower (ScatteringPower *scattPow)
void BeginGlobalOptRandomMove ()
virtual void BeginOptimization (const bool allowApproximations=false, const bool enableRestraints=false)
void CalcDynPopCorr (const REAL overlapDist=1., const REAL mergeDist=.0) const
 Compute the 'Dynamical population correction for all atoms. Atoms which are considered "equivalent" (ie currently with the same Z number) and which are overlapping see their Dynamical occupancy changed so that when they fully overlap, they are equivalent to 1 atom.
virtual void CIFOutput (ostream &os) const
 output Crystal structure as a cif file (EXPERIMENTAL !)
void ClearParamSet (const unsigned long id) const
 Erase the param set with the given id, releasing memory.
unsigned long CreateParamSet (const string name="") const
 Save the current set of refined values in a new set.
 Crystal (const Crystal &oldCryst)
 Crystal copy constructor.
 Crystal (const REAL a, const REAL b, const REAL c, const REAL alpha, const REAL beta, const REAL gamma, const string &SpaceGroupId)
 Crystal Constructor (triclinic).
 Crystal (const REAL a, const REAL b, const REAL c, const string &SpaceGroupId)
 Crystal Constructor (orthorombic).
 Crystal ()
 Default Constructor.
virtual void DeRegisterClient (RefinableObj &) const
 Deregister an object (which not any more) using this object.
virtual void EndOptimization ()
const void EraseAllParamSet ()
 Erase all saved refpar sets.
void FixAllPar ()
 Fix All parameters.
void FractionalToOrthonormalCoords (REAL &x, REAL &y, REAL &z) const
 Get orthonormal cartesian coordinates for a set of (x,y,z) fractional coordinates.
const CrystMatrix_REAL & GetBMatrix () const
 Get the 'B' matrix (UnitCell::mBMatrix)for the UnitCell (orthogonalization matrix for the given lattice, in the reciprocal space).
REAL GetBondValenceCost () const
const std::map< pair< const
ScatteringPower *, const
ScatteringPower * >, REAL > & 
GetBondValenceRoList () const
std::map< pair< const
ScatteringPower *, const
ScatteringPower * >, REAL > & 
GetBondValenceRoList ()
REAL GetBumpMergeCost () const
VBumpMergeParGetBumpMergeParList ()
const VBumpMergeParGetBumpMergeParList () const
virtual const string & GetClassName () const
virtual ObjRegistry
< RefinableObj > & 
GetClientRegistry ()
 Get the list of clients.
virtual const ObjRegistry
< RefinableObj > & 
GetClientRegistry () const
 Get the list of clients.
const RefinableObjClockGetClockLatticePar () const
 last time the Lattice parameters were changed
const RefinableObjClockGetClockMaster () const
 This clocks records _any_ change in the object. See refinableObj::mClockMaster.
const RefinableObjClockGetClockMetricMatrix () const
 last time the metric matrices were changed
const RefinableObjClockGetClockScattCompList () const
 Get the list of all scattering components.
const RefinableObjClockGetClockScattererList () const
 When was the list of scatterers last changed ?
virtual void GetGeneGroup (const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
 Get the gene group assigned to each parameter.
REAL GetLatticePar (const int whichPar) const
CrystVector_REAL GetLatticePar () const
virtual REAL GetLogLikelihood () const
virtual const CrystVector_REAL & GetLSQCalc (const unsigned int) const
 Get the current calculated value for the LSQ function.
virtual const CrystVector_REAL & GetLSQDeriv (const unsigned int, RefinablePar &)
virtual const CrystVector_REAL & GetLSQObs (const unsigned int) const
 Get the observed values for the LSQ function.
virtual const CrystVector_REAL & GetLSQWeight (const unsigned int) const
 Get the weight values for the LSQ function.
const RefinableObjClockGetMasterClockScatteringPower () const
 Get the clock which reports all changes in ScatteringPowers.
CrystMatrix_REAL GetMinDistanceTable (const REAL minDistance=0.1) const
 Minimum interatomic distance between all scattering components (atoms) in the crystal.
virtual const string & GetName () const
 Name of the object.
virtual unsigned int GetNbLSQFunction () const
 Number of LSQ functions.
unsigned int GetNbOption () const
 Number of Options for this object.
long GetNbPar () const
long GetNbParNotFixed () const
 Total number of non-fixed parameters. Is initialized by PrepareForRefinement().
long GetNbScatterer () const
 Number of scatterers in the crystal.
const RefObjOptGetOption (const unsigned int i) const
 const access to the options
RefObjOptGetOption (const unsigned int i)
 Access to the options.
const CrystMatrix_REAL & GetOrthMatrix () const
 Get the orthogonalization matrix (UnitCell::mOrthMatrix)for the UnitCell in real space.
CrystVector_REAL GetOrthonormalCoords (const REAL x, const REAL y, const REAL z) const
 Get orthonormal cartesian coordinates for a set of (x,y,z) fractional coordinates.
const RefinableParGetPar (const REAL *) const
 Access parameter from its adress.
RefinableParGetPar (const REAL *)
 Access parameter from its adress.
const RefinableParGetPar (const string &name) const
 Access all parameters from their name.
RefinableParGetPar (const string &name)
 Access all parameters from their name.
const RefinableParGetPar (const long i) const
 Access all parameters in the order they were inputted.
RefinableParGetPar (const long i)
 Access all parameters in the order they were inputted.
CrystVector_REAL & GetParamSet (const unsigned long setId)
 Access one save refpar set.
const CrystVector_REAL & GetParamSet (const unsigned long setId) const
 Access one save refpar set.
REAL GetParamSet_ParNotFixedHumanValue (const unsigned long setId, const long parNumber) const
 Access the (human) value of one refined parameter in a saved set of parameters.
const string & GetParamSetName (const unsigned long setId) const
 Get the name associated to a refpar set.
const RefinableParGetParNotFixed (const long i) const
RefinableParGetParNotFixed (const long i)
const RefinableObjClockGetRefParListClock () const
virtual REAL GetRestraintCost () const
const ScattererGetScatt (const long scattIndex) const
 Provides a const access to the scatterers.
ScattererGetScatt (const long scattIndex)
 Provides an access to the scatterers.
const ScattererGetScatt (const string &scattName) const
 Provides a const access to the scatterers.
ScattererGetScatt (const string &scattName)
 Provides an access to the scatterers.
const ObjRegistry< Scatterer > & GetScattererRegistry () const
 Get the registry of scatterers.
ObjRegistry< Scatterer > & GetScattererRegistry ()
 Get the registry of scatterers.
virtual const
ScatteringComponentList
GetScatteringComponentList () const
 Get the list of all scattering components.
const ScatteringPowerGetScatteringPower (const string &name) const
 Find a ScatteringPower from its name. Names must be unique in a given Crystal.
ScatteringPowerGetScatteringPower (const string &name)
 Find a ScatteringPower from its name. Names must be unique in a given Crystal.
const ObjRegistry
< ScatteringPower > & 
GetScatteringPowerRegistry () const
 Get the registry of ScatteringPower included in this Crystal.
ObjRegistry< ScatteringPower > & GetScatteringPowerRegistry ()
 Get the registry of ScatteringPower included in this Crystal.
SpaceGroupGetSpaceGroup ()
 Access to the SpaceGroup object.
const SpaceGroupGetSpaceGroup () const
 Access to the SpaceGroup object.
const ObjRegistry< RefinableObj > & GetSubObjRegistry () const
 Access to the registry of RefinableObj used by this object.
ObjRegistry< RefinableObj > & GetSubObjRegistry ()
 Access to the registry of RefinableObj used by this object.
REAL GetVolume () const
 Volume of Unit Cell (in Angstroems).
virtual void GLInitDisplayList (const bool onlyIndependentAtoms=false, const REAL xMin=-.1, const REAL xMax=1.1, const REAL yMin=-.1, const REAL yMax=1.1, const REAL zMin=-.1, const REAL zMax=1.1, const bool displayNames=false) const
virtual void GlobalOptRandomMove (const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
bool IsBeingRefined () const
 Is the object being refined ? (Can be refined by one algorithm at a time only.).
void MillerToOrthonormalCoords (REAL &x, REAL &y, REAL &z) const
 Get Miller H,K, L indices from orthonormal coordinates in reciprocal space.
void OrthonormalToFractionalCoords (REAL &x, REAL &y, REAL &z) const
 Get fractional cartesian coordinates for a set of (x,y,z) orthonormal coordinates.
void OrthonormalToMillerCoords (REAL &x, REAL &y, REAL &z) const
 Get orthonormal coordinates given a set of H,K, L indices in reciprocal space.
ostream & POVRayDescription (ostream &os, const CrystalPOVRayOptions &options) const
 XMLOutput POV-Ray Description for this Crystal.
void PrepareForRefinement () const
virtual void Print () const
void Print (ostream &os=cout) const
void PrintMinDistanceTable (const REAL minDistance=0.1, ostream &os=cout) const
 Print the minimum distance table between all scattering centers (atoms) in the crystal.
virtual void RandomizeConfiguration ()
virtual void RegisterClient (RefinableObj &) const
void RemoveBondValenceRo (const ScatteringPower &, const ScatteringPower &)
void RemoveBumpMergeDistance (const ScatteringPower &scatt1, const ScatteringPower &scatt2)
 Remove an Anti-bumping distance between two scattering types.
vector< RefinablePar * >::iterator RemovePar (RefinablePar *refPar)
vector< Restraint * >::iterator RemoveRestraint (Restraint *pRestraint)
void RemoveScatterer (Scatterer *scatt)
 Remove a Scatterer. This also deletes the scatterer.
void RemoveScatteringPower (ScatteringPower *scattPow)
void ResetDynPopCorr () const
 Reset Dynamical Population Correction factors (ie set it to 1).
void ResetParList ()
void RestoreParamSet (const unsigned long id)
 Restore a saved set of values.
void SaveParamSet (const unsigned long id) const
 Save the current set of refined values over a previously-created set of saved values.
void SetBumpMergeDistance (const ScatteringPower &scatt1, const ScatteringPower &scatt2, const REAL dist, const bool allowMerge)
 Set the Anti-bumping distance between two scattering types.
void SetBumpMergeDistance (const ScatteringPower &scatt1, const ScatteringPower &scatt2, const REAL dist=1.5)
void SetDeleteRefParInDestructor (const bool b)
void SetGlobalOptimStep (const RefParType *type, const REAL step)
 Change the maximum step to use during Global Optimization algorithms.
void SetLimitsAbsolute (const RefParType *type, const REAL min, const REAL max)
 Change the limits for a category of parameters, giving absolute new limits.
void SetLimitsAbsolute (const string &parName, const REAL min, const REAL max)
 Change the limits for a given parameter, giving absolute new limits.
void SetLimitsProportional (const RefParType *type, const REAL min, const REAL max)
void SetLimitsProportional (const string &parName, const REAL min, const REAL max)
void SetLimitsRelative (const RefParType *type, const REAL min, const REAL max)
void SetLimitsRelative (const string &parName, const REAL min, const REAL max)
virtual void SetName (const string &name)
 Name of the object.
void SetParIsFixed (const RefParType *type, const bool fix)
 Fix/un-fix one family of parameters.
void SetParIsFixed (const string &parName, const bool fix)
 Fix/un-fix one parameter from its name.
void SetParIsFixed (const long parIndex, const bool fix)
 Fix/un-fix one parameter from its #.
void SetParIsUsed (const RefParType *type, const bool use)
 Set whether a family of parameters is used.
void SetParIsUsed (const string &parName, const bool use)
 Set whether a parameter is used.
void SetUseDynPopCorr (const int use)
virtual void TagNewBestConfig () const
void UnFixAllPar ()
 UnFix All parameters.
virtual void UpdateDisplay () const
virtual void XMLInput (istream &is, const XMLCrystTag &tag)
 Input From stream.
virtual void XMLOutput (ostream &os, int indent=0) const
 Output to stream in well-formed XML.
 ~Crystal ()
 Crystal destructor.

Protected Member Functions

void AddOption (RefObjOpt *opt)
void AddSubRefObj (RefinableObj &)
long FindPar (const REAL *) const
 Find a refinable parameter from the adress of its value.
long FindPar (const string &name) const
 Find a refinable parameter with a given name.
map< unsigned long, pair
< CrystVector_REAL, string >
>::iterator 
FindParamSet (unsigned long id) const
 Find a parameter set with a given id (and check if it is there).
void InitRefParList ()
 Prepare the refinable parameters list.
virtual void Prepare ()
void RemoveSubRefObj (RefinableObj &)

Protected Attributes

ObjRegistry< RefinableObjmClientObjRegistry
RefinableObjClock mClockMaster
bool mDeleteRefParInDestructor
bool mIsbeingRefined
 Is the object being refined ?
CrystVector_REAL mLSQDeriv
string mName
 Name for this RefinableObject. Should be unique, at least in the same scope.+.
long mNbRefParNotFixed
 Total of not-fixed parameters.
ObjRegistry< RefObjOptmOptionRegistry
bool mRandomMoveIsDone
RefinableObjClock mRefParListClock
 Last time the RefinableParList was modified (a parameter added or removed).
CrystVector_long mRefparNotFixedIndex
 Index of not-fixed parameters.
ObjRegistry< RefinableObjmSubObjRegistry
 Registry of RefinableObject needed for this object (owned by this object or not).
vector< RefinablePar * > mvpRefPar
 Vector of pointers to the refinable parameters.
vector< Restraint * > mvpRestraint
map< unsigned long, pair
< CrystVector_REAL, string > > 
mvpSavedValuesSet

Private Member Functions

void CalcBondValenceSum () const
void CalcDistTable (const bool fast) const
 Compute the distance Table (mDistTable) for all scattering components.
int FindScatterer (const string &scattName) const
void Init (const REAL a, const REAL b, const REAL c, const REAL alpha, const REAL beta, const REAL gamma, const string &SpaceGroupId, const string &name)
 Init all Crystal parameters.
void InitOptions ()

Private Attributes

RefinableObjClock mBondValenceCalcClock
 Last time Bond Valences were calculated.
REAL mBondValenceCost
 Current Bond Valence cost.
RefinableObjClock mBondValenceCostClock
 Last time the Bond Valence cost was calculated.
REAL mBondValenceCostScale
 Bond Valence cost scale factor.
RefinableObjClock mBondValenceParClock
 Last Time Bond Valence parameters were changed.
REAL mBumpMergeCost
 Current bump-merge cost.
RefinableObjClock mBumpMergeCostClock
 Last Time Anti-bump parameters were changed.
RefinableObjClock mBumpMergeParClock
 Last Time Anti-bump parameters were changed.
REAL mBumpMergeScale
 Bump-merge scale factor.
RefinableObjClock mClockDynPopCorr
RefinableObjClock mClockNeighborTable
RefinableObjClock mClockScattCompList
RefinableObjClock mClockScattererList
 Last time the list of Scatterers was changed.
RefObjOpt mDisplayEnantiomer
RefinableObjClock mDistTableClock
 The time when the distance table was last calculated.
REAL mDistTableMaxDistance
 The distance up to which the distance table & neighbours needs to be calculated.
RefinableObjClock mLatticeClock
 Clock for lattice paramaters.
RefinableObjClock mMasterClockScatteringPower
 master clock recording every change in Scattering Powers
ScatteringComponentList mScattCompList
 The list of all scattering components in the crystal.
ObjRegistry< ScatterermScattererRegistry
 The registry of scatterers for this UnitCell.
ObjRegistry< ScatteringPowermScatteringPowerRegistry
 The registry of ScatteringPower for this Crystal.
RefObjOpt mUseDynPopCorr
std::map< long, REAL > mvBondValenceCalc
map< pair< const
ScatteringPower *, const
ScatteringPower * >, REAL > 
mvBondValenceRo
VBumpMergePar mvBumpMergePar
 Anti-bump parameters map.
std::vector< NeighbourHoodmvDistTableSq

Classes

struct  BumpMergePar
 Storage for anti-bump/merge parameters. More...
struct  Neighbour
 Interatomic distance for a given neighbour. More...
struct  NeighbourHood
 Table of neighbours for a given unique atom. More...

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index