FOX/ObjCryst++  1.10.X (development)
Scatterer.h
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2002 Vincent Favre-Nicolin vincefn@users.sourceforge.net
3  2000-2001 University of Geneva (Switzerland)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #ifndef _OBJCRYST_SCATTERER_H_
20 #define _OBJCRYST_SCATTERER_H_
21 
22 #include "ObjCryst/CrystVector/CrystVector.h"
23 
24 #include "ObjCryst/ObjCryst/General.h"
25 
26 #include "ObjCryst/ObjCryst/ScatteringPower.h"
27 
28 #include <string>
29 
30 namespace ObjCryst
31 {
32 class Crystal ; //forward declaration.:KLUDGE: ?
33 extern const RefParType *gpRefParTypeScatt;
34 extern const RefParType *gpRefParTypeScattTransl;
35 extern const RefParType *gpRefParTypeScattTranslX;
36 extern const RefParType *gpRefParTypeScattTranslY;
37 extern const RefParType *gpRefParTypeScattTranslZ;
38 extern const RefParType *gpRefParTypeScattOrient;
39 extern const RefParType *gpRefParTypeScattConform;
40 extern const RefParType *gpRefParTypeScattConformBondLength;
41 extern const RefParType *gpRefParTypeScattConformBondAngle;
42 extern const RefParType *gpRefParTypeScattConformDihedAngle;
43 extern const RefParType *gpRefParTypeScattConformX;
44 extern const RefParType *gpRefParTypeScattConformY;
45 extern const RefParType *gpRefParTypeScattConformZ;
46 extern const RefParType *gpRefParTypeScattOccup;
48 {
49  public:
51  {
52  if (mCount++ == 0)
53  {
54  gpRefParTypeScatt=new RefParType(gpRefParTypeObjCryst,"Scatterer");
55  gpRefParTypeScattTransl=new RefParType(gpRefParTypeScatt,"Translation");
56  gpRefParTypeScattTranslX=new RefParType(gpRefParTypeScattTransl,"Translation along X");
57  gpRefParTypeScattTranslY=new RefParType(gpRefParTypeScattTransl,"Translation along Y");
58  gpRefParTypeScattTranslZ=new RefParType(gpRefParTypeScattTransl,"Translation along Z");
59  gpRefParTypeScattOrient=new RefParType(gpRefParTypeScatt,"Orientation");
60  gpRefParTypeScattConform=new RefParType(gpRefParTypeScatt,"Conformation");
61  gpRefParTypeScattConformBondLength=new RefParType(gpRefParTypeScattConform,"BondLengths");
62  gpRefParTypeScattConformBondAngle=new RefParType(gpRefParTypeScattConform,"Bond Angles");
63  gpRefParTypeScattConformDihedAngle=new RefParType(gpRefParTypeScattConform,"Dihedral Angles ");
64  gpRefParTypeScattConformX=new RefParType(gpRefParTypeScattConform,"Orth. X coordinates");
65  gpRefParTypeScattConformY=new RefParType(gpRefParTypeScattConform,"Orth. Y coordinates");
66  gpRefParTypeScattConformZ=new RefParType(gpRefParTypeScattConform,"Orth. Z coordinates");
67  gpRefParTypeScattOccup=new RefParType(gpRefParTypeScatt,"Occupancy");
68  }
69  }
71  {
72  if (--mCount == 0)
73  {
74  delete gpRefParTypeScatt;
75  delete gpRefParTypeScattTransl;
76  delete gpRefParTypeScattTranslX;
77  delete gpRefParTypeScattTranslY;
78  delete gpRefParTypeScattTranslZ;
79  delete gpRefParTypeScattOrient;
80  delete gpRefParTypeScattConform;
81  delete gpRefParTypeScattConformBondLength;
82  delete gpRefParTypeScattConformBondAngle;
83  delete gpRefParTypeScattConformDihedAngle;
84  delete gpRefParTypeScattConformX;
85  delete gpRefParTypeScattConformY;
86  delete gpRefParTypeScattConformZ;
87  delete gpRefParTypeScattOccup;
88  gpRefParTypeScatt=0;
89  gpRefParTypeScattTransl=0;
90  gpRefParTypeScattTranslX=0;
91  gpRefParTypeScattTranslY=0;
92  gpRefParTypeScattTranslZ=0;
93  gpRefParTypeScattOrient=0;
94  gpRefParTypeScattConform=0;
95  gpRefParTypeScattConformBondLength=0;
96  gpRefParTypeScattConformBondAngle=0;
97  gpRefParTypeScattConformDihedAngle=0;
98  gpRefParTypeScattConformX=0;
99  gpRefParTypeScattConformY=0;
100  gpRefParTypeScattConformZ=0;
101  gpRefParTypeScattOccup=0;
102  }
103  }
104  private:
105  static long mCount;
106 };
107 static NiftyStaticGlobalObjectsInitializer_Scatterer NiftyStaticGlobalObjectsInitializer_Scatterer_counter;
108 
109 
110 //######################################################################
111 //
112 // SCATTERER
128 //######################################################################
129 
130 class Scatterer:virtual public RefinableObj
131 {
132  public:
134  Scatterer();
136  Scatterer(const Scatterer &old);
138  virtual ~Scatterer();
141  virtual Scatterer* CreateCopy() const=0;
142  virtual const string& GetClassName() const;
143 
145  virtual int GetNbComponent() const=0;
146 
153  virtual const ScatteringComponentList& GetScatteringComponentList() const=0;
162  virtual string GetComponentName(const int i) const=0;
163 
167  REAL GetX() const;
171  REAL GetY() const;
175  REAL GetZ() const;
176 
185  REAL GetOccupancy() const ;
186 
190  virtual void SetX(const REAL x);
194  virtual void SetY(const REAL y);
198  virtual void SetZ(const REAL z);
207  virtual void SetOccupancy(const REAL occupancy) ;
208 
212  operator string()const;
214  virtual void Print() const=0;
215 
219  virtual const string& GetColour()const;
223  virtual const float* GetColourRGB()const;
224 
230  virtual ostream& POVRayDescription(ostream &os,
231  const CrystalPOVRayOptions &options)const=0;
245  virtual void GLInitDisplayList(const bool noSymmetrics=false,
246  const REAL xMin=-.1,const REAL xMax=1.1,
247  const REAL yMin=-.1,const REAL yMax=1.1,
248  const REAL zMin=-.1,const REAL zMax=1.1,
249  const bool displayEnantiomer=false,
250  const bool displayNames=false,
251  const bool hideHydrogens=false)const=0;
253  const RefinableObjClock& GetClockScatterer()const;
257  void SetCrystal(Crystal&);
259  const Crystal& GetCrystal()const;
261  Crystal& GetCrystal();
262  protected:
264  virtual void InitRefParList()=0;
269  virtual void InitRGBColour();
273  CrystVector_REAL mXYZ;
274 
281  string mColourName;
283  float mColourRGB[3];
295 
296  private:
297  #ifdef __WX__CRYST__
298  public:
299  virtual WXCrystObjBasic* WXCreate(wxWindow*);
300  friend class WXScatterer;
301  #endif
302 };
303 
306 
307 
308 }//namespace
309 
310 #include "ObjCryst/ObjCryst/Crystal.h"
311 
312 #endif //_OBJCRYST_SCATTERER_H_
virtual void Print() const =0
Print some info about the scatterer (ideally this should be one line...).
const RefinableObjClock & GetClockScattCompList() const
Last time the ScatteringComponentList was generated.
string mColourName
Colour for this scatterer (from POVRay)
Definition: Scatterer.h:281
virtual ostream & POVRayDescription(ostream &os, const CrystalPOVRayOptions &options) const =0
const RefinableObjClock & GetClockScatterer() const
Last time anything in the scatterer was changed (atoms, positions, scattering power) ...
Definition: Scatterer.cpp:133
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
Definition: RefinableObj.h:138
CrystVector_REAL mXYZ
coordinates of the scatterer (or of its center..)
Definition: Scatterer.h:273
virtual Scatterer * CreateCopy() const =0
float mColourRGB[3]
Colour for this scatterer using RGB.
Definition: Scatterer.h:283
virtual const float * GetColourRGB() const
Colour associated to this scatterer, 3 RGB Coordinates.
Definition: Scatterer.cpp:131
virtual int GetNbComponent() const =0
Number of components in the scatterer (eg number of point scatterers)
Generic Refinable Object.
Definition: RefinableObj.h:752
REAL GetZ() const
Z coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Definition: Scatterer.cpp:105
REAL GetOccupancy() const
Get the occupancy of the scatterer (0.
Definition: Scatterer.cpp:106
Abstract base class for all objects in wxCryst.
Definition: wxCryst.h:127
Scatterer()
Constructor.
Definition: Scatterer.cpp:69
Class to store POV-Ray output options.
Definition: General.h:175
virtual void SetY(const REAL y)
Y coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Definition: Scatterer.cpp:110
RefinableObjClock mClockScattCompList
Definition: Scatterer.h:287
virtual void GLInitDisplayList(const bool noSymmetrics=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 displayEnantiomer=false, const bool displayNames=false, const bool hideHydrogens=false) const =0
REAL GetX() const
X coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Definition: Scatterer.cpp:103
virtual ~Scatterer()
Destructor.
Definition: Scatterer.cpp:91
REAL mOccupancy
Occupancy : 0 <= occ <= 1 For a multi-atom scatterer (polyhedron,..), this is the overall occupancy o...
Definition: Scatterer.h:279
virtual const string & GetColour() const
Colour associated to this scatterer (using POVRay names)
Definition: Scatterer.cpp:130
virtual void SetX(const REAL x)
X coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Definition: Scatterer.cpp:109
void SetCrystal(Crystal &)
Set the crystal in which is included this Scatterer.
Definition: Scatterer.cpp:136
virtual string GetComponentName(const int i) const =0
Name for the i-th component of this scatterer.
const Crystal & GetCrystal() const
In which crystal is this Scatterer included ?
Definition: Scatterer.cpp:137
ObjRegistry< Scatterer > gScattererRegistry("Global Scatterer Registry")
Global registry for all Scatterer objects.
Definition: Scatterer.h:305
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: Atom.cpp:47
virtual const ScatteringComponentList & GetScatteringComponentList() const =0
Get the list of all scattering components for this scatterer.
Crystal class: Unit cell, spacegroup, scatterers.
Definition: Crystal.h:97
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
Definition: Scatterer.cpp:97
REAL GetY() const
Y coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Definition: Scatterer.cpp:104
RefinableObjClock mClockScatterer
Last time anything (number of atoms, positions, scattering power) was changed.
Definition: Scatterer.h:285
class of refinable parameter types.
Definition: RefinableObj.h:78
list of scattering positions in a crystal, associated with the corresponding occupancy and a pointer ...
virtual void SetOccupancy(const REAL occupancy)
Change the occupancy of the scatterer (0.
Definition: Scatterer.cpp:112
virtual void InitRGBColour()
Get RGB Colour coordinates from Colour Name.
Definition: Scatterer.cpp:140
Generic type of scatterer: can be an atom, or a more complex assembly of atoms.
Definition: Scatterer.h:130
Crystal * mpCryst
The crystal in which the Scatterer is This is needed so that we can know which scattering powers are ...
Definition: Scatterer.h:294
virtual void InitRefParList()=0
const RefParType * gpRefParTypeObjCryst
Top RefParType for the ObjCryst++ library.
Object Registry.
Definition: RefinableObj.h:643
virtual void SetZ(const REAL z)
Z coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Definition: Scatterer.cpp:111
base wxCryst class for Scatterers
Definition: wxScatterer.h:35