FOX/ObjCryst++  1.10.X (development)
SpaceGroup.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 /* Spacegroup.h header for Spacegroup and AsymmetricUnit classes
20 *
21 */
22 #ifndef _OBJCRYST_SPACEGROUP_H_
23 #define _OBJCRYST_SPACEGROUP_H_
24 
25 #include "ObjCryst/CrystVector/CrystVector.h"
26 
27 #include "ObjCryst/ObjCryst/General.h"
28 #include "ObjCryst/RefinableObj/RefinableObj.h"
29 #include <complex>
30 
31 //#include "cctbx/sgtbx/space_group.h"
32 namespace cctbx{namespace sgtbx{class space_group;}}
33 
34 namespace ObjCryst
35 {
36 class SpaceGroup;
37 //######################################################################
38 // AsymmetricUnit.
52 //######################################################################
53 
55 {
56  public:
60  AsymmetricUnit(const SpaceGroup &spg);
61  ~AsymmetricUnit();
63  void SetSpaceGroup(const SpaceGroup &spg);
65  bool IsInAsymmetricUnit(const REAL x, const REAL y, const REAL z)const;
66  REAL Xmin() const;
67  REAL Xmax() const;
68  REAL Ymin() const;
69  REAL Ymax() const;
70  REAL Zmin() const;
71  REAL Zmax() const;
72  protected:
73  private:
74  REAL mXmin,mXmax,mYmin,mYmax,mZmin,mZmax;
75 };
76 
77 //######################################################################
78 // SpaceGroup
101 //######################################################################
102 
103 
105 {
106  public:
110  SpaceGroup();
116  SpaceGroup(const string &spgId);
118  ~SpaceGroup();
120  void ChangeSpaceGroup(const string &spgId);
123  const string& GetName()const;
125  bool IsInAsymmetricUnit(const REAL x, const REAL y, const REAL z) const;
129  void ChangeToAsymmetricUnit(REAL x, REAL y, REAL z) const;//:TODO:
131  const AsymmetricUnit& GetAsymUnit() const;
132 
134  int GetSpaceGroupNumber()const;
135 
137  bool IsCentrosymmetric()const;
138 
143  int GetNbTranslationVectors()const;
144 
146  struct TRx
147  {
148  REAL tr[3];
149  };
150 
152  struct SMx
153  {
154  REAL mx[9];
155  REAL tr[3];
156  };
157 
173  const std::vector<SpaceGroup::TRx>& GetTranslationVectors()const;
174 
177  const std::vector<SpaceGroup::SMx>& GetSymmetryOperations()const;
178 
200  CrystMatrix_REAL GetAllSymmetrics(const REAL x, const REAL y, const REAL z,
201  const bool noCenter=false,const bool noTransl=false,
202  const bool noIdentical=false) const;
221  void GetSymmetric(unsigned int i, REAL &x, REAL &y, REAL &z,
222  const bool noCenter=false,const bool noTransl=false,
223  const bool derivative=false) const;
224 
231  int GetNbSymmetrics(const bool noCenter=false,const bool noTransl=false)const;
232 
236  void Print()const;
238  bool HasInversionCenter()const;
240  bool IsInversionCenterAtOrigin()const;
242  const cctbx::sgtbx::space_group& GetCCTbxSpg()const;
245  const RefinableObjClock& GetClockSpaceGroup() const;
247  unsigned int GetUniqueAxis()const;
249  char GetExtension()const;
251  CrystVector_REAL GetInversionCenter()const;
256  unsigned int AreReflEquiv(const REAL h1, const REAL k1, const REAL l1,
257  const REAL h2, const REAL k2, const REAL l2)const;
271  CrystMatrix_REAL GetAllEquivRefl(const REAL h, const REAL k, const REAL l,
272  const bool excludeFriedelMate=false,
273  const bool forceFriedelLaw=false,
274  const REAL sf_re=0,const REAL sf_im=0) const;
276  bool IsReflSystematicAbsent(const REAL h, const REAL k, const REAL l)const;
278  bool IsReflCentric(const REAL h, const REAL k, const REAL l)const;
291  unsigned int GetExpectedIntensityFactor(const REAL h, const REAL k, const REAL l)const;
292  protected:
293  private:
300  void InitSpaceGroup(const string &spgId);
301 
305  string mId;
306 
313  cctbx::sgtbx::space_group *mpCCTbxSpaceGroup;
314 
323 
326 
330  unsigned int mUniqueAxisId;
332  unsigned long mNbSym;
334  unsigned long mNbTrans;
336  unsigned long mSpgNumber;
340  std::vector<SMx> mvSym;
342  std::vector<TRx> mvTrans;
343 };
344 
345 }//namespace
346 #endif //_OBJCRYST_SPACEGROUP_H_
std::vector< TRx > mvTrans
Store floating-point translation vectors for faster use.
Definition: SpaceGroup.h:342
unsigned int AreReflEquiv(const REAL h1, const REAL k1, const REAL l1, const REAL h2, const REAL k2, const REAL l2) const
Are these reflections equivalent ?
Definition: SpaceGroup.cpp:481
int GetNbSymmetrics(const bool noCenter=false, const bool noTransl=false) const
Return the number of equivalent positions in the spacegroup, ie the multilicity of the general positi...
Definition: SpaceGroup.cpp:419
const cctbx::sgtbx::space_group & GetCCTbxSpg() const
Get the underlying cctbx Spacegroup object.
Definition: SpaceGroup.cpp:465
const RefinableObjClock & GetClockSpaceGroup() const
Get the SpaceGroup Clock (corresponding to the time of the initialization of the SpaceGroup) ...
Definition: SpaceGroup.cpp:467
char mExtension
Extension to space group symbol (1,2:origin choice ; R,H=rhomboedral/hexagonal)
Definition: SpaceGroup.h:338
std::vector< SMx > mvSym
Store floating-point matrices for faster use.
Definition: SpaceGroup.h:340
SpaceGroup()
Default Constructor (initializes in P1)
Definition: SpaceGroup.cpp:212
Struct to store trans matrix.
Definition: SpaceGroup.h:146
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 GetInversionCenter() const
Get the inversion center.
Definition: SpaceGroup.cpp:473
unsigned long mNbTrans
Number of lattice translations, including (0,0,0).
Definition: SpaceGroup.h:334
bool mIsInversionCenterAtOrigin
Is center of symmetry at the origin ?
Definition: SpaceGroup.h:322
bool IsCentrosymmetric() const
Is the crystal centrosymmetric ?
Definition: SpaceGroup.cpp:254
bool HasInversionCenter() const
Is centrosymmetric ?
Definition: SpaceGroup.cpp:463
unsigned int GetUniqueAxis() const
Which is the unique axis (for monoclinic space groups )
Definition: SpaceGroup.cpp:469
const string & GetName() const
Get the name of this spacegroup (its name, as supplied initially by the calling program or user) ...
Definition: SpaceGroup.cpp:233
unsigned long mNbSym
Number of symmetry operations (excluding center, and translations).
Definition: SpaceGroup.h:332
void SetSpaceGroup(const SpaceGroup &spg)
Assign a SpaceGroup and generate the corrsponding Xmax, Ymax, ZMax.
Definition: SpaceGroup.cpp:87
void GetSymmetric(unsigned int i, REAL &x, REAL &y, REAL &z, const bool noCenter=false, const bool noTransl=false, const bool derivative=false) const
Get all equivalent positions of a (xyz) position.
Definition: SpaceGroup.cpp:366
int GetNbTranslationVectors() const
Number of translation vectors (1 for 'P' cells, 2 for 'I', 4 for 'F',etc..)
Definition: SpaceGroup.cpp:259
bool IsInAsymmetricUnit(const REAL x, const REAL y, const REAL z) const
Test if a given scatterer at (x,y,z) is in the asymmetric unit.
Definition: SpaceGroup.cpp:235
const AsymmetricUnit & GetAsymUnit() const
Get the AsymmetricUnit for this spacegroup.
Definition: SpaceGroup.cpp:245
The crystallographic space group, and the cell choice.
Definition: SpaceGroup.h:104
unsigned long mSpgNumber
SpaceGroup Number.
Definition: SpaceGroup.h:336
unsigned int mUniqueAxisId
Unique axis number (0=a,1=b,2=c)
Definition: SpaceGroup.h:330
bool IsReflCentric(const REAL h, const REAL k, const REAL l) const
Is the reflection centric ?
Definition: SpaceGroup.cpp:553
CrystMatrix_REAL GetAllSymmetrics(const REAL x, const REAL y, const REAL z, const bool noCenter=false, const bool noTransl=false, const bool noIdentical=false) const
Get all equivalent positions of a (xyz) position.
Definition: SpaceGroup.cpp:274
const std::vector< SpaceGroup::SMx > & GetSymmetryOperations() const
Get all symmetry operations stored in vector of struct SMx.
Definition: SpaceGroup.cpp:269
cctbx::sgtbx::space_group * mpCCTbxSpaceGroup
SgOps structure for this spacegroup.
Definition: SpaceGroup.h:313
~SpaceGroup()
Destructor.
Definition: SpaceGroup.cpp:222
CrystMatrix_REAL GetAllEquivRefl(const REAL h, const REAL k, const REAL l, const bool excludeFriedelMate=false, const bool forceFriedelLaw=false, const REAL sf_re=0, const REAL sf_im=0) const
Get the list of all equivalent reflections.
Definition: SpaceGroup.cpp:514
bool IsInAsymmetricUnit(const REAL x, const REAL y, const REAL z) const
Test if (x,y,z) is in the asymmetric unit.
Definition: SpaceGroup.cpp:193
The basic description of spacegroup asymmetric unit.
Definition: SpaceGroup.h:54
Struct to store rot+trans matrix.
Definition: SpaceGroup.h:152
bool IsInversionCenterAtOrigin() const
Is the center of symmetry at the origin ?
Definition: SpaceGroup.cpp:464
unsigned int GetExpectedIntensityFactor(const REAL h, const REAL k, const REAL l) const
Get the "expected intensity factor" for a given reflection.
Definition: SpaceGroup.cpp:562
bool IsReflSystematicAbsent(const REAL h, const REAL k, const REAL l) const
Is the reflection systematically absent ?
Definition: SpaceGroup.cpp:544
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: Atom.cpp:47
AsymmetricUnit()
Default Constructor.
Definition: SpaceGroup.cpp:65
RefinableObjClock mClock
The Spacegroup clock.
Definition: SpaceGroup.h:328
void ChangeSpaceGroup(const string &spgId)
Change the Spacegroup.
Definition: SpaceGroup.cpp:227
bool mHasInversionCenter
Is spacegroup centrosymmetric ?
Definition: SpaceGroup.h:318
int GetSpaceGroupNumber() const
Id number of the spacegroup.
Definition: SpaceGroup.cpp:249
void Print() const
Prints a description of the spacegroup (symbol, properties).
Definition: SpaceGroup.cpp:434
void ChangeToAsymmetricUnit(REAL x, REAL y, REAL z) const
Move (x,y,z) coordinates to their equivalent in the asym unit.
Definition: SpaceGroup.cpp:240
AsymmetricUnit mAsymmetricUnit
The spacegroup asymmetric unit.
Definition: SpaceGroup.h:325
void InitSpaceGroup(const string &spgId)
Init the spaceGroup object from its name.
Definition: SpaceGroup.cpp:573
string mId
Spacegroup's name ( 'I422', 'D2^8','230') Maybe we should only store the Hermann-Mauguin symbol...
Definition: SpaceGroup.h:305
char GetExtension() const
Extension to space group symbol ('1','2':origin choice ; 'R','H'=rhomboedral/hexagonal) ...
Definition: SpaceGroup.cpp:471
const std::vector< SpaceGroup::TRx > & GetTranslationVectors() const
Return all Translation Vectors, as a 3 columns-array.
Definition: SpaceGroup.cpp:264