22 #ifndef _OBJCRYST_CRYSTAL_H_
23 #define _OBJCRYST_CRYSTAL_H_
25 #include "ObjCryst/CrystVector/CrystVector.h"
27 #include "ObjCryst/ObjCryst/General.h"
28 #include "ObjCryst/RefinableObj/RefinableObj.h"
29 #include "ObjCryst/ObjCryst/UnitCell.h"
30 #include "ObjCryst/ObjCryst/ScatteringPower.h"
31 #include "ObjCryst/ObjCryst/Scatterer.h"
44 extern const RefParType *gpRefParTypeCrystal;
52 gpRefParTypeCrystal=
new RefParType (gpRefParTypeUnitCell,
"Crystal");
59 delete gpRefParTypeCrystal;
60 gpRefParTypeCrystal=0;
106 Crystal(
const REAL a,
const REAL b,
const REAL c,
107 const string &SpaceGroupId);
113 Crystal(
const REAL a,
const REAL b,
const REAL c,
const REAL alpha,
114 const REAL beta,
const REAL gamma,
const string &SpaceGroupId);
191 void Print(ostream &os=cout)
const;
239 const REAL xMin=-.1,
const REAL xMax=1.1,
240 const REAL yMin=-.1,
const REAL yMax=1.1,
241 const REAL zMin=-.1,
const REAL zMax=1.1,
242 const bool displayNames=
false,
243 const bool hideHydrogens=
false)
const;
265 void CalcDynPopCorr(
const REAL overlapDist=1.,
const REAL mergeDist=.0)
const ;
302 const bool allowMerge);
316 BumpMergePar(
const REAL dist,
const bool canOverlap=
false);
326 const VBumpMergePar& GetBumpMergeParList()
const;
327 VBumpMergePar& GetBumpMergeParList();
331 virtual void XMLOutput(ostream &os,
int indent=0)
const;
346 virtual void CIFOutput(ostream &os,
double mindist = 0.5)
const;
349 CrystVector_uint & groupIndex,
350 unsigned int &firstGroup)
const;
352 const bool enableRestraints=
false);
359 std::map<pair<const ScatteringPower*,const ScatteringPower*>, REAL>& GetBondValenceRoList();
360 const std::map<pair<const ScatteringPower*,const ScatteringPower*>, REAL>& GetBondValenceRoList()
const;
367 void Init(
const REAL a,
const REAL b,
const REAL c,
const REAL alpha,
368 const REAL beta,
const REAL gamma,
const string &SpaceGroupId,
383 void ConnectAtoms(
const REAL min_relat_dist=0.4,
const REAL max_relat_dist=1.3,
const bool warnuser_fail=
false);
435 Neighbour(
const unsigned long neighbourIndex,
const int sym,
515 bool mDeleteSubObjInDestructor;
531 #endif //_OBJCRYST_CRYSTAL_H_
RefinableObjClock mBondValenceCalcClock
Last time Bond Valences were calculated.
const RefinableObjClock & GetMasterClockScatteringPower() const
Get the clock which reports all changes in ScatteringPowers.
void RemoveBumpMergeDistance(const ScatteringPower &scatt1, const ScatteringPower &scatt2)
Remove an Anti-bumping distance between two scattering types.
void RemoveScatterer(Scatterer *scatt, const bool del=true)
Remove a Scatterer. This also deletes the scatterer unless del=false.
RefinableObjClock mClockScattCompList
void CalcBondValenceSum() const
Calculate all Bond Valences.
Crystal()
Default Constructor.
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 GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
~Crystal()
Crystal destructor.
virtual const ScatteringComponentList & GetScatteringComponentList() const
Get the list of all scattering components.
REAL mBondValenceCostScale
Bond Valence cost scale factor.
void Print(ostream &os=cout) const
Prints some info about the crystal.
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
void SetUseDynPopCorr(const int use)
Set the use of dynamical population correction (Crystal::mUseDynPopCorr).
RefinableObjClock mLatticeClock
Clock for lattice paramaters.
int FindScatterer(const string &scattName) const
Find a scatterer (its index # in mpScatterrer[]) with a given name.
Interatomic distance for a given neighbour.
RefinableObjClock mBondValenceCostClock
Last time the Bond Valence cost was calculated.
ObjRegistry< ScatteringPower > mScatteringPowerRegistry
The registry of ScatteringPower for this Crystal.
ObjRegistry< Scatterer > mScattererRegistry
The registry of scatterers for this UnitCell.
int GetUseDynPopCorr() const
Get dynamical population correction setting.
REAL GetBumpMergeCost() const
Get the Anti-bumping/pro-Merging cost function.
bool mCanOverlap
Can the two atoms completely overlap ?
REAL mDist2
The squared antibump interatomic distance.
virtual REAL GetLogLikelihood() const
Get -log(likelihood) of the current configuration for the object.
void SetBumpMergeDistance(const ScatteringPower &scatt1, const ScatteringPower &scatt2, const REAL dist=1.5)
Set the Anti-bumping distance between two scattering types.
RefinableObjClock mClockDynPopCorr
const RefinableObjClock & GetClockScattererList() const
When was the list of scatterers last changed ?
RefinableObjClock mClockScattererList
Last time the list of Scatterers was changed.
void CalcDynPopCorr(const REAL overlapDist=1., const REAL mergeDist=.0) const
Compute the 'Dynamical population correction for all atoms. Atoms which are considered "equivalent" (...
REAL mBumpMergeScale
Bump-merge scale factor.
RefinableObjClock mMasterClockScatteringPower
master clock recording every change in Scattering Powers
Generic Refinable Object.
void AddScatterer(Scatterer *scatt)
Add a scatterer to the crystal.
RefinableObjClock mBondValenceParClock
Last Time Bond Valence parameters were changed.
ScatteringComponentList mScattCompList
The list of all scattering components in the crystal.
void ResetDynPopCorr() const
Reset Dynamical Population Correction factors (ie set it to 1)
RefinableObjClock mBumpMergeParClock
Last Time Anti-bump parameters were changed.
ObjRegistry< Crystal > gCrystalRegistry("List of all Crystals")
Global registry for all Crystal objects.
Abstract base class for all objects in wxCryst.
void SetDeleteSubObjInDestructor(const bool b)
Set whether to delete the Scatterers and ScatteringPowers in the destructor.
REAL mBondValenceCost
Current Bond Valence cost.
REAL GetBondValenceCost() const
Get the Bond-Valence cost function, which compares the expected valence to the one computed from Bond...
void RemoveScatteringPower(ScatteringPower *scattPow, const bool del=true)
Remove a ScatteringPower for this Crystal.
std::vector< NeighbourHood > mvDistTableSq
Interatomic distance table for all unique atoms.
void ConnectAtoms(const REAL min_relat_dist=0.4, const REAL max_relat_dist=1.3, const bool warnuser_fail=false)
Convert as much as possible the crystal's atoms to molecule(s).
unsigned long mIndex
Index of the atom in the scattering component list.
Class to store POV-Ray output options.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
const RefinableObjClock & GetClockScattCompList() const
Get the list of all scattering components.
REAL mBumpMergeCost
Current bump-merge cost.
RefObjOpt mUseDynPopCorr
Use Dynamical population correction (ScatteringComponent::mDynPopCorr) during Structure factor calcul...
wxCryst class for Crystals
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
ostream & POVRayDescription(ostream &os, const CrystalPOVRayOptions &options) const
XMLOutput POV-Ray Description for this Crystal.
std::vector< Crystal::Neighbour > mvNeighbour
List of neighbours.
Scatterer & GetScatt(const string &scattName)
Provides an access to the scatterers.
virtual void GetGeneGroup(const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
Get the gene group assigned to each parameter.
REAL GetDynPopCorr(const Scatterer *pscatt, unsigned int component) const
Access the Dynamical Occupancy Correction for a given component (atom) in a given Scatterer...
ObjRegistry< Scatterer > & GetScattererRegistry()
Get the registry of scatterers.
CrystMatrix_REAL GetMinDistanceTable(const REAL minDistance=0.1) const
Minimum interatomic distance between all scattering components (atoms) in the crystal.
unsigned int mUniquePosSymmetryIndex
Index of the symmetry operation for the chosen unique position in the (pseudo) asymmetric unit...
ObjRegistry< ScatteringPower > & GetScatteringPowerRegistry()
Get the registry of ScatteringPower included in this Crystal.
VBumpMergePar mvBumpMergePar
Anti-bump parameters map.
void CalcDistTable(const bool fast) const
Compute the distance Table (mDistTable) for all scattering components.
RefObjOpt mDisplayEnantiomer
Display the enantiomeric (mirror along x) structure in 3D? This can be helpful for non-centrosymmetri...
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.
virtual void CIFOutput(ostream &os, double mindist=0.5) const
output Crystal structure as a cif file (EXPERIMENTAL !)
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
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 bool hideHydrogens=false) const
Create an OpenGL DisplayList of the crystal.
Unit Cell class: Unit cell with spacegroup information.
map< pair< const ScatteringPower *, const ScatteringPower * >, REAL > mvBondValenceRo
Map of Bond Valence "Ro" parameters for each couple of ScatteringPower.
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.
RefinableObjClock mClockNeighborTable
std::map< long, REAL > mvBondValenceCalc
List of calculated bond valences, as a map, the key being the index of the atom in Crystal::mScattCom...
Table of neighbours for a given unique atom.
Crystal class: Unit cell, spacegroup, scatterers.
unsigned int mNeighbourSymmetryIndex
The symmetry position associated to the neighbour (its index in the Crystal's scattering component li...
Storage for anti-bump/merge parameters.
class to input or output a well-formatted xml beginning or ending tag.
RefinableObjClock mDistTableClock
The time when the distance table was last calculated.
long GetNbScatterer() const
Number of scatterers in the crystal.
unsigned long mNeighbourIndex
The number associated to the neighbour (its index in the Crystal's scattering component list) ...
ScatteringPower & GetScatteringPower(const string &name)
Find a ScatteringPower from its name. Names must be unique in a given Crystal.
class of refinable parameter types.
list of scattering positions in a crystal, associated with the corresponding occupancy and a pointer ...
REAL mDist2
The squared distance, in square Angstroems.
Generic type of scatterer: can be an atom, or a more complex assembly of atoms.
void AddScatteringPower(ScatteringPower *scattPow)
Add a ScatteringPower for this Crystal.
RefinableObjClock mBumpMergeCostClock
Last Time Anti-bump parameters were changed.
const RefParType * gpRefParTypeObjCryst
Top RefParType for the ObjCryst++ library.
REAL mDistTableMaxDistance
The distance up to which the distance table & neighbours needs to be calculated.
void InitOptions()
Init options.
std::map< pair< const ScatteringPower *, const ScatteringPower * >, Crystal::BumpMergePar > VBumpMergePar
Anti-bump parameters.
Abstract Base Class to describe the scattering power of any Scatterer component in a crystal...