Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Crystal.h

00001 /* 
00002 * ObjCryst++ : a Crystallographic computing library in C++
00003 *        http://objcryst.sourceforge.net
00004 *        http://www.ccp14.ac.uk/ccp/web-mirrors/objcryst/
00005 *
00006 *  (c) 2000-2001 Vincent FAVRE-NICOLIN vincefn@users.sourceforge.net
00007 *
00008 */
00009 /*   Crystal.h header file for the Crystal object
00010 *
00011 */
00012 #ifndef _OBJCRYST_CRYSTAL_H_
00013 #define _OBJCRYST_CRYSTAL_H_
00014 
00015 #include "CrystVector/CrystVector.h"
00016 
00017 #include "ObjCryst/General.h"
00018 #include "RefinableObj/RefinableObj.h"
00019 #include "ObjCryst/SpaceGroup.h"
00020 #include "ObjCryst/ScatteringPower.h"
00021 #include "ObjCryst/Scatterer.h"
00022 
00023 //#include <stdlib.h>
00024 #include <string>
00025 //#include <iomanip>
00026 //#include <cmath>
00027 //#include <typeinfo>
00028 //#include <fstream>
00029 //#include <ctime>
00030 
00031 namespace ObjCryst
00032 {
00033 extern const RefParType *gpRefParTypeCrystal;
00034 extern const RefParType *gpRefParTypeUnitCell;
00035 extern const RefParType *gpRefParTypeUnitCellLength;
00036 extern const RefParType *gpRefParTypeUnitCellAngle;
00037 
00038 //######################################################################
00066 //######################################################################
00067 class Crystal:public RefinableObj
00068 {
00069    public:
00071       Crystal();
00076       Crystal(const double a, const double b, const double c,
00077               const string &SpaceGroupId);
00083       Crystal(const double a, const double b, const double c, const double alpha,
00084               const double beta, const double gamma,const string &SpaceGroupId);
00085               
00087       Crystal(const Crystal &oldCryst);
00089       ~Crystal();
00090       virtual const string GetClassName() const;
00091       
00103       void AddScatterer(Scatterer *scatt);
00105       void RemoveScatterer(Scatterer *scatt);
00106       
00108       long GetNbScatterer()const;
00113       Scatterer & GetScatt(const string &scattName);
00118       const Scatterer & GetScatt(const string &scattName) const;
00123       Scatterer & GetScatt(const long scattIndex);
00128       const Scatterer & GetScatt(const long scattIndex) const;
00129       
00131       ObjRegistry<Scatterer>& GetScattererRegistry();
00133       ObjRegistry<ScatteringPower>& GetScatteringPowerRegistry();
00135       const ObjRegistry<ScatteringPower>& GetScatteringPowerRegistry()const;
00136 
00139       void AddScatteringPower(ScatteringPower *scattPow);
00142       void RemoveScatteringPower(ScatteringPower *scattPow);
00144       ScatteringPower& GetScatteringPower(const string &name);
00145       
00151       virtual const ScatteringComponentList& GetScatteringComponentList()const;
00154       CrystVector_double GetLatticePar() const;
00157       double GetLatticePar(const int whichPar)const;
00164       const CrystMatrix_double& GetBMatrix() const;
00172       CrystVector_double GetOrthonormalCoords(const double x,const double y,const double z) const;
00180       void FractionalToOrthonormalCoords(double &x,double &y,double &z) const;
00188       void OrthonormalToFractionalCoords(double &x,double &y,double &z) const;
00192       void Print(ostream &os=cout) const;
00193             
00195       const SpaceGroup & GetSpaceGroup()const;
00197       SpaceGroup & GetSpaceGroup();
00198       
00214       CrystMatrix_double GetMinDistanceTable(const double minDistance=0.1) const;
00219       void PrintMinDistanceTable(const double minDistance=0.1,ostream &os=cout) const;
00220 
00231       ostream& POVRayDescription(ostream &os,bool onlyIndependentAtoms=false)const;
00232       
00240       virtual void GLInitDisplayList(const bool onlyIndependentAtoms=false,
00241                                      const double xMin=-.1,const double xMax=1.1,
00242                                      const double yMin=-.1,const double yMax=1.1,
00243                                      const double zMin=-.1,const double zMax=1.1)const;
00244       
00265       void CalcDynPopCorr(const double overlapDist=1., const double mergeDist=.0)const ;
00267       void ResetDynPopCorr()const ;
00280       void SetUseDynPopCorr(const int use);
00288       double GetBumpMergeCostFunction() const;
00292       void SetBumpMergeDistance(const ScatteringPower &scatt1,
00293                                 const ScatteringPower &scatt2, const double dist=1.5);
00295       void SetBumpMergeDistance(const ScatteringPower &scatt1,
00296                                 const ScatteringPower &scatt2, const double dist,
00297                                 const bool allowMerge);
00299       const RefinableObjClock& GetClockLatticePar()const;
00301       const RefinableObjClock& GetClockScattererList()const;
00302       //Cost functions
00303          unsigned int GetNbCostFunction()const;
00304          const string& GetCostFunctionName(const unsigned int)const;
00305          const string& GetCostFunctionDescription(const unsigned int)const;
00306          virtual double GetCostFunctionValue(const unsigned int);
00307          
00308       virtual void XMLOutput(ostream &os,int indent=0)const;
00309       virtual void XMLInput(istream &is,const XMLCrystTag &tag);
00310       //virtual void XMLInputOld(istream &is,const IOCrystTag &tag);
00311       
00312       virtual void GlobalOptRandomMove(const double mutationAmplitude);
00319       virtual void CIFOutput(ostream &os)const;
00320       
00321    protected:
00322    
00323    private:
00330       void Init(const double a, const double b, const double c, const double alpha,
00331                 const double beta, const double gamma,const string &SpaceGroupId,
00332                 const string& name);
00333       
00336       int FindScatterer(const string &scattName)const;
00337       
00340       void InitMatrices() const;
00346       void UpdateLatticePar();
00347 
00353       void InitRefParList();
00354       
00381       void CalcDistTable(const bool fast,const double asymUnitMargin=4)const;
00382             
00387       CrystVector_double mCellDim;
00389       SpaceGroup mSpaceGroup ;
00391       ObjRegistry<Scatterer> mScattererRegistry ;
00392       
00402       mutable CrystMatrix_double mBMatrix;
00413       mutable CrystMatrix_double mOrthMatrix;
00415       mutable CrystMatrix_double mOrthMatrixInvert;
00416             
00427       mutable CrystMatrix_double mDistTableSq;
00433       mutable CrystVector_long  mDistTableIndex;
00435       mutable ScatteringComponentList mScattCompList;
00436          
00438       RefinableObjClock mLatticeClock;
00441       RefObjOpt mUseDynPopCorr;
00443       CrystMatrix_double mBumpDistanceMatrix;
00445       CrystMatrix_bool mAllowMerge;
00446       
00448       ObjRegistry<ScatteringPower> mScatteringPowerRegistry;
00449       
00450       //Clocks
00452       RefinableObjClock mClockScattererList;
00454       RefinableObjClock mClockLatticePar;
00456       mutable RefinableObjClock mClockMetricMatrix;
00458       mutable RefinableObjClock mClockScattCompList;
00460       mutable RefinableObjClock mClockNeighborTable;
00462       mutable RefinableObjClock mClockLatticeParUpdate;
00464       mutable RefinableObjClock mClockDynPopCorr;
00465    #ifdef __WX__CRYST__
00466    public:
00467       virtual WXCrystObjBasic* WXCreate(wxWindow*);
00468       friend class WXCrystal;
00469    #endif
00470 };
00471 
00473 extern ObjRegistry<Crystal> gCrystalRegistry;
00474 
00475 
00476 }// namespace
00477 
00478 
00479 #endif //_OBJCRYST_CRYSTAL_H_

Generated on Wed Nov 14 19:48:35 2001 for ObjCryst++ by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001