MPQC  3.0.0-alpha
pointgrp.h
1 //
2 // pointgrp.h
3 //
4 // Modifications are
5 // Copyright (C) 1996 Limit Point Systems, Inc.
6 //
7 // Author: Edward Seidl <seidl@janed.com>
8 // Maintainer: LPS
9 //
10 // This file is part of the SC Toolkit.
11 //
12 // The SC Toolkit is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU Library General Public License as published by
14 // the Free Software Foundation; either version 2, or (at your option)
15 // any later version.
16 //
17 // The SC Toolkit is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Library General Public License for more details.
21 //
22 // You should have received a copy of the GNU Library General Public License
23 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
24 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25 //
26 // The U.S. Government is granted a limited license as per AL 91-7.
27 //
28 
29 /* pointgrp.h -- definition of the point group classes
30  *
31  * THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
32  * "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE
33  * AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT
34  * CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE
35  * PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
36  * RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
37  *
38  * Author:
39  * E. T. Seidl
40  * Bldg. 12A, Rm. 2033
41  * Computer Systems Laboratory
42  * Division of Computer Research and Technology
43  * National Institutes of Health
44  * Bethesda, Maryland 20892
45  * Internet: seidl@alw.nih.gov
46  * June, 1993
47  */
48 
49 #ifndef _math_symmetry_pointgrp_h
50 #define _math_symmetry_pointgrp_h
51 
52 #include <iostream>
53 
54 #include <util/class/class.h>
55 #include <util/state/state.h>
56 #include <util/keyval/keyval.h>
57 #include <math/scmat/vector3.h>
58 
59 namespace sc {
60 
61 // //////////////////////////////////////////////////////////////////
62 
67  private:
68  double d[3][3];
69 
70  public:
74 
76  double trace() const { return d[0][0]+d[1][1]+d[2][2]; }
77 
79  double* operator[](int i) { return d[i]; }
80 
82  const double* operator[](int i) const { return d[i]; }
83 
86  double& operator()(int i, int j) { return d[i][j]; }
87 
89  double operator()(int i, int j) const { return d[i][j]; }
90 
92  void zero() { memset(d,0,sizeof(double)*9); }
93 
96 
99 
101  void unit() { zero(); d[0][0] = d[1][1] = d[2][2] = 1.0; }
102 
104  void E() { unit(); }
105 
107  void i() { zero(); d[0][0] = d[1][1] = d[2][2] = -1.0; }
108 
110  void sigma_h() { unit(); d[2][2] = -1.0; }
111 
113  void sigma_xz() { unit(); d[1][1] = -1.0; }
114 
116  void sigma_yz() { unit(); d[0][0] = -1.0; }
117 
119  void rotation(int n);
120  void rotation(double theta);
121 
123  void c2_x() { i(); d[0][0] = 1.0; }
124 
126  void c2_y() { i(); d[1][1] = 1.0; }
127 
128  void transpose();
129 
131  void print(std::ostream& =ExEnv::out0()) const;
132 };
133 
134 // //////////////////////////////////////////////////////////////////
135 
141 class SymRep {
142  private:
143  int n;
144  double d[5][5];
145 
146  public:
147  SymRep(int =0);
148  SymRep(const SymmetryOperation&);
149  ~SymRep();
150 
152  operator SymmetryOperation() const;
153 
155  inline double trace() const;
156 
158  void set_dim(int i) { n=i; }
159 
161  double* operator[](int i) { return d[i]; }
163  const double* operator[](int i) const { return d[i]; }
164 
167  double& operator()(int i, int j) { return d[i][j]; }
169  double operator()(int i, int j) const { return d[i][j]; }
170 
172  void zero() { memset(d,0,sizeof(double)*25); }
173 
175  SymRep operate(const SymRep& r) const;
176 
178  SymRep transform(const SymRep& r) const;
179 
181  void unit() {
182  zero(); d[0][0] = d[1][1] = d[2][2] = d[3][3] = d[4][4] = 1.0;
183  }
184 
186  void E() { unit(); }
187 
189  void i() { zero(); d[0][0] = d[1][1] = d[2][2] = d[3][3] = d[4][4] = -1.0;}
190 
192  void sigma_h();
193 
195  void sigma_xz();
196 
198  void sigma_yz();
199 
201  void rotation(int n);
202  void rotation(double theta);
203 
205  void c2_x();
206 
208  void c2_y();
209 
211  void print(std::ostream& =ExEnv::out0()) const;
212 };
213 
214 inline double
216 {
217  double r=0;
218  for (int i=0; i < n; i++)
219  r += d[i][i];
220  return r;
221 }
222 
223 // //////////////////////////////////////////////////////////////////
224 
225 
226 class CharacterTable;
227 
236  friend class CharacterTable;
237 
238  private:
239  int g; // the order of the group
240  int degen; // the degeneracy of the irrep
241  int nrot_; // the number of rotations in this irrep
242  int ntrans_; // the number of translations in this irrep
243  int complex_; // true if this irrep has a complex representation
244  char *symb; // mulliken symbol for this irrep
245  char *csymb; // mulliken symbol for this irrep w/o special characters
246 
247  SymRep *rep; // representation matrices for the symops
248 
249  public:
255  IrreducibleRepresentation(int,int,const char*,const char* =0);
256 
258 
260 
262  void init(int =0, int =0, const char* =0, const char* =0);
263 
265  int order() const { return g; }
266 
268  int degeneracy() const { return degen; }
269 
271  int complex() const { return complex_; }
272 
274  int nproj() const { return degen*degen; }
275 
277  int nrot() const { return nrot_; }
278 
280  int ntrans() const { return ntrans_; }
281 
283  const char * symbol() const { return symb; }
284 
288  const char * symbol_ns() const { return (csymb?csymb:symb); }
289 
292  double character(int i) const {
293  return complex_ ? 0.5*rep[i].trace() : rep[i].trace();
294  }
295 
297  double p(int x1, int x2, int i) const { return rep[i](x1,x2); }
298 
301  double p(int d, int i) const {
302  int dc=d/degen; int dr=d%degen;
303  return rep[i](dr,dc);
304  }
305 
309  void print(std::ostream& =ExEnv::out0()) const;
310 };
311 
312 // ///////////////////////////////////////////////////////////
322  public:
323  enum pgroups {C1, CS, CI, CN, CNV, CNH, DN, DND, DNH, SN, T, TH, TD, O,
324  OH, I, IH};
325 
326  private:
327  int g; // the order of the point group
328  int nt; // order of the princ rot axis
329  pgroups pg; // the class of the point group
330  int nirrep_; // the number of irreps in this pg
331  IrreducibleRepresentation *gamma_; // an array of irreps
332  SymmetryOperation *symop; // the matrices describing sym ops
333  int *_inv; // index of the inverse symop
334  char *symb; // the Schoenflies symbol for the pg
335 
337  int parse_symbol();
339  int make_table();
340 
341  // these create the character tables for the cubic groups
342  void t();
343  void th();
344  void td();
345  void o();
346  void oh();
347  void i();
348  void ih();
349 
350  public:
351  CharacterTable();
354  CharacterTable(const char*);
358  CharacterTable(const char*,const SymmetryOperation&);
359 
361  ~CharacterTable();
362 
363  CharacterTable& operator=(const CharacterTable&);
364 
366  int nirrep() const { return nirrep_; }
368  int order() const { return g; }
370  const char * symbol() const { return symb; }
372  IrreducibleRepresentation& gamma(int i) { return gamma_[i]; }
374  SymmetryOperation& symm_operation(int i) { return symop[i]; }
375 
379  int complex() const {
380  if (pg==CN || pg==SN || pg==CNH || pg==T || pg==TH)
381  return 1;
382  return 0;
383  }
384 
386  int inverse(int i) const { return _inv[i]; }
387 
388  int ncomp() const {
389  int ret=0;
390  for (int i=0; i < nirrep_; i++) {
391  int nc = (gamma_[i].complex()) ? 1 : gamma_[i].degen;
392  ret += nc;
393  }
394  return ret;
395  }
396 
398  int which_irrep(int i) {
399  for (int ir=0, cn=0; ir < nirrep_; ir++) {
400  int nc = (gamma_[ir].complex()) ? 1 : gamma_[ir].degen;
401  for (int c=0; c < nc; c++,cn++)
402  if (cn==i)
403  return ir;
404  }
405  return -1;
406  }
407 
409  int which_comp(int i) {
410  for (int ir=0, cn=0; ir < nirrep_; ir++) {
411  int nc = (gamma_[ir].complex()) ? 1 : gamma_[ir].degen;
412  for (int c=0; c < nc; c++,cn++)
413  if (cn==i)
414  return c;
415  }
416  return -1;
417  }
418 
420  void print(std::ostream& =ExEnv::out0()) const;
421 };
422 
423 // ///////////////////////////////////////////////////////////
424 
432 class PointGroup: public SavableState {
433  private:
434  std::string symb;
435  SymmetryOperation frame;
436  SCVector3 origin_;
437 
438  public:
439  PointGroup();
442  PointGroup(std::string);
445  PointGroup(std::string,SymmetryOperation&);
448  PointGroup(std::string,SymmetryOperation&,const SCVector3&);
483  PointGroup(const Ref<KeyVal>&);
484 
486  PointGroup(const PointGroup&);
487  PointGroup(const Ref<PointGroup>&);
488  ~PointGroup();
489 
490  PointGroup& operator=(const PointGroup&);
491 
493  int order() const { return char_table().order(); }
494 
496  bool equiv(const Ref<PointGroup> &, double tol = 1.0e-6) const;
497 
499  CharacterTable char_table() const;
501  std::string symbol() const { return symb; }
503  SymmetryOperation& symm_frame() { return frame; }
505  const SymmetryOperation& symm_frame() const { return frame; }
507  SCVector3& origin() { return origin_; }
508  const SCVector3& origin() const { return origin_; }
509 
511  void set_symbol(std::string);
512 
513  void save_data_state(StateOut& so);
514 
515  void print(std::ostream&o=ExEnv::out0()) const;
516 };
517 
518 }
519 
520 #endif
521 
522 // Local Variables:
523 // mode: c++
524 // c-file-style: "ETS"
525 // End:
sc::IrreducibleRepresentation::print
void print(std::ostream &=ExEnv::out0()) const
This prints the irrep to the given file, or stdout if none is given.
sc::IrreducibleRepresentation::ntrans
int ntrans() const
Returns the number of translations associated with the irrep.
Definition: pointgrp.h:280
sc::CharacterTable
The CharacterTable class provides a workable character table for all of the non-cubic point groups.
Definition: pointgrp.h:321
sc::PointGroup::save_data_state
void save_data_state(StateOut &so)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::SymmetryOperation::sigma_yz
void sigma_yz()
Set equal to reflection in yz plane.
Definition: pointgrp.h:116
sc::SymRep::operator[]
double * operator[](int i)
returns the i'th row of the transformation matrix
Definition: pointgrp.h:161
sc::CharacterTable::inverse
int inverse(int i) const
Returns the index of the symop which is the inverse of symop[i].
Definition: pointgrp.h:386
sc::SymRep::operate
SymRep operate(const SymRep &r) const
This operates on this with r (i.e. return r * this).
sc::SymmetryOperation
The SymmetryOperation class provides a 3 by 3 matrix representation of a symmetry operation,...
Definition: pointgrp.h:66
sc::SymRep::sigma_xz
void sigma_xz()
Set equal to reflection in xz plane.
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::SymmetryOperation::sigma_h
void sigma_h()
Set equal to reflection in xy plane.
Definition: pointgrp.h:110
sc::IrreducibleRepresentation::p
double p(int x1, int x2, int i) const
Returns the element (x1,x2) of the i'th representation matrix.
Definition: pointgrp.h:297
sc::CharacterTable::order
int order() const
Returns the order of the point group.
Definition: pointgrp.h:368
sc::CharacterTable::complex
int complex() const
Cn, Cnh, Sn, T, and Th point groups have complex representations.
Definition: pointgrp.h:379
sc::SymRep::zero
void zero()
zero out the symop
Definition: pointgrp.h:172
sc::SymRep::i
void i()
Set equal to an inversion.
Definition: pointgrp.h:189
sc::SymmetryOperation::i
void i()
Set equal to an inversion.
Definition: pointgrp.h:107
sc::PointGroup::origin
SCVector3 & origin()
Returns the origin of the symmetry frame.
Definition: pointgrp.h:507
sc::PointGroup::symm_frame
SymmetryOperation & symm_frame()
Returns the frame of reference for this point group.
Definition: pointgrp.h:503
sc::IrreducibleRepresentation::complex
int complex() const
Returns the value of complex_.
Definition: pointgrp.h:271
sc::IrreducibleRepresentation::degeneracy
int degeneracy() const
Returns the degeneracy of the irrep.
Definition: pointgrp.h:268
sc::SymmetryOperation::operate
SymmetryOperation operate(const SymmetryOperation &r) const
This operates on this with r (i.e. return r * this).
sc::SymmetryOperation::operator()
double & operator()(int i, int j)
returns a reference to the (i,j)th element of the transformation matrix
Definition: pointgrp.h:86
sc::PointGroup::char_table
CharacterTable char_table() const
Returns the CharacterTable for this point group.
sc::SymRep
The SymRep class provides an n dimensional matrix representation of a symmetry operation,...
Definition: pointgrp.h:141
sc::CharacterTable::symbol
const char * symbol() const
Returns the Schoenflies symbol for the point group.
Definition: pointgrp.h:370
sc::SymRep::sigma_yz
void sigma_yz()
Set equal to reflection in yz plane.
sc::SymmetryOperation::operator[]
double * operator[](int i)
returns the i'th row of the transformation matrix
Definition: pointgrp.h:79
sc::SymRep::E
void E()
Set equal to the identity.
Definition: pointgrp.h:186
sc::SymRep::operator()
double operator()(int i, int j) const
const version of double& operator()(int i, int j)
Definition: pointgrp.h:169
sc::SymmetryOperation::operator[]
const double * operator[](int i) const
const version of the above
Definition: pointgrp.h:82
sc::IrreducibleRepresentation::nrot
int nrot() const
Returns the number of rotations associated with the irrep.
Definition: pointgrp.h:277
sc::StateIn
Definition: statein.h:79
sc::SymRep::trace
double trace() const
returns the trace of the transformation matrix
Definition: pointgrp.h:215
sc::SymRep::sigma_h
void sigma_h()
Set equal to reflection in xy plane.
sc::SymmetryOperation::rotation
void rotation(int n)
Set equal to a clockwise rotation by 2pi/n.
sc::IrreducibleRepresentation::init
void init(int=0, int=0, const char *=0, const char *=0)
Initialize the order, degeneracy, and Mulliken symbol of the irrep.
sc::PointGroup::equiv
bool equiv(const Ref< PointGroup > &, double tol=1.0e-6) const
Returns true if the point groups are equivalent, false otherwise.
sc::IrreducibleRepresentation::symbol
const char * symbol() const
Returns the Mulliken symbol for the irrep.
Definition: pointgrp.h:283
sc::SymmetryOperation::trace
double trace() const
returns the trace of the transformation matrix
Definition: pointgrp.h:76
sc::IrreducibleRepresentation::character
double character(int i) const
Returns the character for the i'th symmetry operation of the point group.
Definition: pointgrp.h:292
sc::CharacterTable::gamma
IrreducibleRepresentation & gamma(int i)
Returns the i'th irrep.
Definition: pointgrp.h:372
sc::SymmetryOperation::c2_y
void c2_y()
Set equal to C2 about the x axis.
Definition: pointgrp.h:126
sc::CharacterTable::which_irrep
int which_irrep(int i)
Returns the irrep component i belongs to.
Definition: pointgrp.h:398
sc::SymmetryOperation::print
void print(std::ostream &=ExEnv::out0()) const
print the matrix
sc::PointGroup
The PointGroup class is really a place holder for a CharacterTable.
Definition: pointgrp.h:432
sc::PointGroup::symbol
std::string symbol() const
Returns the Schoenflies symbol for this point group.
Definition: pointgrp.h:501
sc::SymmetryOperation::sigma_xz
void sigma_xz()
Set equal to reflection in xz plane.
Definition: pointgrp.h:113
sc::SymRep::print
void print(std::ostream &=ExEnv::out0()) const
print the matrix
sc::SymRep::rotation
void rotation(int n)
Set equal to a clockwise rotation by 2pi/n.
sc::SymmetryOperation::zero
void zero()
zero out the symop
Definition: pointgrp.h:92
sc::SymmetryOperation::operator()
double operator()(int i, int j) const
const version of the above
Definition: pointgrp.h:89
sc::PointGroup::order
int order() const
returns the order of the point group
Definition: pointgrp.h:493
sc::PointGroup::set_symbol
void set_symbol(std::string)
Sets (or resets) the Schoenflies symbol.
sc::PointGroup::symm_frame
const SymmetryOperation & symm_frame() const
A const version of the above.
Definition: pointgrp.h:505
sc::SymmetryOperation::E
void E()
Set equal to E.
Definition: pointgrp.h:104
sc::IrreducibleRepresentation::symbol_ns
const char * symbol_ns() const
Returns the Mulliken symbol for the irrep without special characters.
Definition: pointgrp.h:288
sc::IrreducibleRepresentation::nproj
int nproj() const
Returns the number of projection operators for the irrep.
Definition: pointgrp.h:274
sc::SymRep::transform
SymRep transform(const SymRep &r) const
This performs the transform r * this * r~.
sc::CI
CI is a configuration interaction ManyBodyWavefunction.
Definition: ci.h:15
sc::SymmetryOperation::c2_x
void c2_x()
Set equal to C2 about the x axis.
Definition: pointgrp.h:123
sc::CharacterTable::print
void print(std::ostream &=ExEnv::out0()) const
This prints the irrep to the given file, or stdout if none is given.
sc::SCVector3
a 3-element version of SCVector
Definition: vector3.h:43
sc::CharacterTable::nirrep
int nirrep() const
Returns the number of irreps.
Definition: pointgrp.h:366
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc::SymRep::c2_y
void c2_y()
Set equal to C2 about the x axis.
sc::SymRep::operator[]
const double * operator[](int i) const
const version of the above
Definition: pointgrp.h:163
sc::SavableState
Base class for objects that can save/restore state.
Definition: state.h:45
sc::IrreducibleRepresentation::p
double p(int d, int i) const
Returns the character for the d'th contribution to the i'th representation matrix.
Definition: pointgrp.h:301
sc::SymRep::set_dim
void set_dim(int i)
set the dimension of d
Definition: pointgrp.h:158
sc::CharacterTable::symm_operation
SymmetryOperation & symm_operation(int i)
Returns the i'th symmetry operation.
Definition: pointgrp.h:374
sc::PointGroup::print
void print(std::ostream &o=ExEnv::out0()) const
Print the object.
sc::SymmetryOperation::transform
SymmetryOperation transform(const SymmetryOperation &r) const
This performs the transform r * this * r~.
sc::SymRep::operator()
double & operator()(int i, int j)
returns a reference to the (i,j)th element of the transformation matrix
Definition: pointgrp.h:167
sc::CharacterTable::which_comp
int which_comp(int i)
Returns which component i is.
Definition: pointgrp.h:409
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::SymmetryOperation::unit
void unit()
Set equal to a unit matrix.
Definition: pointgrp.h:101
sc::SymRep::unit
void unit()
Set equal to a unit matrix.
Definition: pointgrp.h:181
sc::IrreducibleRepresentation::order
int order() const
Returns the order of the group.
Definition: pointgrp.h:265
sc::SymRep::c2_x
void c2_x()
Set equal to C2 about the x axis.
sc::IrreducibleRepresentation
The IrreducibleRepresentation class provides information associated with a particular irreducible rep...
Definition: pointgrp.h:235

Generated at Sun Jan 26 2020 23:24:00 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.