00001 #ifndef _OBJCRYST_ZSCATTERER_H_
00002 #define _OBJCRYST_ZSCATTERER_H_
00003
00004 #include "CrystVector/CrystVector.h"
00005
00006 #include "ObjCryst/General.h"
00007
00008 #include "ObjCryst/ScatteringPower.h"
00009 #include "ObjCryst/Scatterer.h"
00010
00011
00012 #include <string>
00013
00014 namespace ObjCryst
00015 {
00016
00017
00018
00019
00032
00033
00034 class GlobalScatteringPower:virtual public ScatteringPower
00035 {
00036 public:
00037 GlobalScatteringPower();
00038 GlobalScatteringPower(const ZScatterer &scatt);
00039 GlobalScatteringPower(const GlobalScatteringPower& old);
00040 ~GlobalScatteringPower();
00042 void Init(const ZScatterer &scatt);
00043 virtual CrystVector_double GetScatteringFactor(const ScatteringData &data,
00044 const int spgSymPosIndex=0) const;
00045 virtual CrystVector_double GetTemperatureFactor(const ScatteringData &data,
00046 const int spgSymPosIndex=0) const;
00047 virtual CrystMatrix_double GetResonantScattFactReal(const ScatteringData &data,
00048 const int spgSymPosIndex=0) const;
00049 virtual CrystMatrix_double GetResonantScattFactImag(const ScatteringData &data,
00050 const int spgSymPosIndex=0) const;
00051 virtual double GetRadius()const;
00052 protected:
00053 virtual void InitRefParList();
00055 ZScatterer *mpZScatterer;
00056 private:
00057 };
00058
00059
00063
00064
00065 class ZAtom
00066 {
00067 public:
00068 ZAtom(ZScatterer &scatt,const ScatteringPower *pow,
00069 const long atomBond=0, const double bondLength=1,
00070 const long atomAngle=0, const double bondAngle=M_PI,
00071 const long atomDihedral=0, const double dihedralAngle=M_PI,
00072 const double popu=1., const string &name="");
00073 ~ZAtom();
00074 const string& GetClassName()const;
00075 const string& GetName()const;
00076 void SetName(const string&);
00078 const ZScatterer& GetZScatterer()const;
00080 ZScatterer& GetZScatterer();
00081
00084 long GetZBondAtom()const;
00087 long GetZAngleAtom()const;
00090 long GetZDihedralAngleAtom()const;
00091
00093 double GetZBondLength()const;
00095 double GetZAngle()const;
00097 double GetZDihedralAngle()const;
00099 double GetOccupancy()const;
00101 const ScatteringPower* GetScatteringPower()const;
00102
00104 void SetZBondLength(const double);
00106 void SetZAngle(const double);
00108 void SetZDihedralAngle(const double);
00110 void SetOccupancy(const double);
00112 void SetScatteringPower(const ScatteringPower*);
00113 void XMLOutput(ostream &os,int indent=0)const;
00114 void XMLInput(istream &is,const XMLCrystTag &tag);
00115 private:
00117 const ScatteringPower *mpScattPow;
00120 long mAtomBond,mAtomAngle,mAtomDihed;
00122 double mBondLength,mAngle,mDihed,mOccupancy;
00124 string mName;
00126 ZScatterer *mpScatt;
00127
00128 friend class ZScatterer;
00129
00130 #ifdef __WX__CRYST__
00131 public:
00132 WXCrystObjBasic* WXCreate(wxWindow *parent);
00133 WXCrystObjBasic* WXGet();
00134 void WXDelete();
00135 void WXNotifyDelete();
00136 private:
00137 WXCrystObjBasic *mpWXCrystObj;
00138 friend class WXZAtom;
00139 #endif
00140 };
00141
00142
00146
00147
00148 class ZScatterer: public Scatterer
00149 {
00150 public:
00159 ZScatterer(const string &name,const Crystal &cryst,
00160 const double x=0.,const double y=0.,const double z=0.,
00161 const double phi=0.,const double chi=0., const double psi=0.);
00165 ZScatterer(const ZScatterer &old);
00166 ~ZScatterer();
00169 virtual ZScatterer* CreateCopy() const;
00170 virtual const string GetClassName() const;
00174 void AddAtom(const string &name,const ScatteringPower *pow,
00175 const long atomBond, const double bondLength,
00176 const long atomAngle, const double bondAngle,
00177 const long atomDihedral, const double dihedralAngle,
00178 const double popu=1.);
00179
00180 virtual int GetNbComponent() const;
00181 virtual const ScatteringComponentList& GetScatteringComponentList() const;
00182 virtual string GetComponentName(const int i) const;
00183
00185 void Print() const;
00186
00188 double GetPhi()const;
00190 double GetChi()const;
00192 double GetPsi()const;
00194 void SetPhi(const double);
00196 void SetChi(const double);
00198 void SetPsi(const double);
00199
00202 long GetZBondAtom(const int i)const;
00205 long GetZAngleAtom(const int i)const;
00208 long GetZDihedralAngleAtom(const int i)const;
00209
00211 double GetZBondLength(const int i)const;
00213 double GetZAngle(const int i)const;
00215 double GetZDihedralAngle(const int i)const;
00216
00218 void SetZBondLength(const int i,const double);
00220 void SetZAngle(const int i,const double);
00222 void SetZDihedralAngle(const int i,const double);
00223
00225 const ObjRegistry<ZAtom>& GetZAtomRegistry()const;
00227 virtual ostream& POVRayDescription(ostream &os,
00228 const bool onlyIndependentAtoms=false)const;
00229
00230 virtual void GLInitDisplayList(const bool onlyIndependentAtoms=false,
00231 const double xMin=-.1,const double xMax=1.1,
00232 const double yMin=-.1,const double yMax=1.1,
00233 const double zMin=-.1,const double zMax=1.1)const;
00243 virtual void SetUseGlobalScatteringPower(const bool useIt);
00244 virtual void XMLOutput(ostream &os,int indent=0)const;
00245 virtual void XMLInput(istream &is,const XMLCrystTag &tag);
00246
00247 protected:
00248 void Update() const;
00263 CrystMatrix_long m3DDisplayIndex;
00265 mutable ScatteringComponentList mScattCompList;
00267 long mNbAtom;
00268 private:
00270 virtual void InitRefParList();
00271
00273 long mNbDummyAtom;
00274
00280 CrystVector_int mComponentIndex;
00281
00306 double mPhi,mChi,mPsi;
00307
00309 ObjRegistry<ZAtom> mZAtomRegistry;
00312 long mCenterAtomIndex;
00313
00315 mutable CrystMatrix_double mPhiChiPsiMatrix;
00316
00319 bool mUseGlobalScattPow;
00320
00323 GlobalScatteringPower* mpGlobalScattPow;
00324
00327 mutable CrystVector_double mXCoord,mYCoord,mZCoord;
00328 #ifdef __WX__CRYST__
00329 public:
00330 virtual WXCrystObjBasic* WXCreate(wxWindow*);
00331 friend class WXZScatterer;
00332 #endif
00333 };
00334
00335
00336
00337
00338
00339
00340
00341 enum RegularPolyhedraType { TETRAHEDRON, OCTAHEDRON, SQUARE_PLANE, CUBE, ANTIPRISM_TETRAGONAL,
00342 PRISM_TETRAGONAL_MONOCAP, PRISM_TETRAGONAL_DICAP,
00343 PRISM_TRIGONAL,PRISM_TRIGONAL_TRICAPPED,
00344 ICOSAHEDRON, TRIANGLE_PLANE};
00345
00346
00353
00354 class ZPolyhedron: public ZScatterer
00355 {
00356 public:
00375 ZPolyhedron( const RegularPolyhedraType type, const Crystal &cryst,
00376 const double x, const double y, const double z,
00377 const string &name, const ScatteringPower *centralAtomPow,
00378 const ScatteringPower *periphAtomPow,const double centralPeriphDist,
00379 const double ligandPopu=1,
00380 const double phi=0., const double chi=0., const double psi=0.);
00381
00384 virtual ZPolyhedron* CreateCopy() const;
00385
00386
00387
00388
00389
00390 protected:
00391 private:
00392
00393
00394
00396 RegularPolyhedraType mPolyhedraType;
00397 };
00398
00399 }
00400 #include "ObjCryst/Crystal.h"
00401
00402 #endif