MPQC 2.3.1
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#ifdef __GNUC__
50#pragma interface
51#endif
52
53#ifndef _math_symmetry_pointgrp_h
54#define _math_symmetry_pointgrp_h
55
56#include <iostream>
57
58#include <util/class/class.h>
59#include <util/state/state.h>
60#include <util/keyval/keyval.h>
61#include <math/scmat/vector3.h>
62
63namespace sc {
64
65// //////////////////////////////////////////////////////////////////
66
71 private:
72 double d[3][3];
73
74 public:
78
80 double trace() const { return d[0][0]+d[1][1]+d[2][2]; }
81
83 double* operator[](int i) { return d[i]; }
84
86 const double* operator[](int i) const { return d[i]; }
87
90 double& operator()(int i, int j) { return d[i][j]; }
91
93 double operator()(int i, int j) const { return d[i][j]; }
94
96 void zero() { memset(d,0,sizeof(double)*9); }
97
100
103
105 void unit() { zero(); d[0][0] = d[1][1] = d[2][2] = 1.0; }
106
108 void E() { unit(); }
109
111 void i() { zero(); d[0][0] = d[1][1] = d[2][2] = -1.0; }
112
114 void sigma_h() { unit(); d[2][2] = -1.0; }
115
117 void sigma_xz() { unit(); d[1][1] = -1.0; }
118
120 void sigma_yz() { unit(); d[0][0] = -1.0; }
121
123 void rotation(int n);
124 void rotation(double theta);
125
127 void c2_x() { i(); d[0][0] = 1.0; }
128
130 void c2_y() { i(); d[1][1] = 1.0; }
131
132 void transpose();
133
135 void print(std::ostream& =ExEnv::out0()) const;
136};
137
138// //////////////////////////////////////////////////////////////////
139
145class SymRep {
146 private:
147 int n;
148 double d[5][5];
149
150 public:
151 SymRep(int =0);
153 ~SymRep();
154
156 operator SymmetryOperation() const;
157
159 inline double trace() const;
160
162 void set_dim(int i) { n=i; }
163
165 double* operator[](int i) { return d[i]; }
167 const double* operator[](int i) const { return d[i]; }
168
171 double& operator()(int i, int j) { return d[i][j]; }
173 double operator()(int i, int j) const { return d[i][j]; }
174
176 void zero() { memset(d,0,sizeof(double)*25); }
177
179 SymRep operate(const SymRep& r) const;
180
182 SymRep transform(const SymRep& r) const;
183
185 void unit() {
186 zero(); d[0][0] = d[1][1] = d[2][2] = d[3][3] = d[4][4] = 1.0;
187 }
188
190 void E() { unit(); }
191
193 void i() { zero(); d[0][0] = d[1][1] = d[2][2] = d[3][3] = d[4][4] = -1.0;}
194
196 void sigma_h();
197
199 void sigma_xz();
200
202 void sigma_yz();
203
205 void rotation(int n);
206 void rotation(double theta);
207
209 void c2_x();
210
212 void c2_y();
213
215 void print(std::ostream& =ExEnv::out0()) const;
216};
217
218inline double
220{
221 double r=0;
222 for (int i=0; i < n; i++)
223 r += d[i][i];
224 return r;
225}
226
227// //////////////////////////////////////////////////////////////////
228
229
230class CharacterTable;
231
240 friend class CharacterTable;
241
242 private:
243 int g; // the order of the group
244 int degen; // the degeneracy of the irrep
245 int nrot_; // the number of rotations in this irrep
246 int ntrans_; // the number of translations in this irrep
247 int complex_; // true if this irrep has a complex representation
248 char *symb; // mulliken symbol for this irrep
249 char *csymb; // mulliken symbol for this irrep w/o special characters
250
251 SymRep *rep; // representation matrices for the symops
252
253 public:
259 IrreducibleRepresentation(int,int,const char*,const char* =0);
260
262
264
266 void init(int =0, int =0, const char* =0, const char* =0);
267
269 int order() const { return g; }
270
272 int degeneracy() const { return degen; }
273
275 int complex() const { return complex_; }
276
278 int nproj() const { return degen*degen; }
279
281 int nrot() const { return nrot_; }
282
284 int ntrans() const { return ntrans_; }
285
287 const char * symbol() const { return symb; }
288
292 const char * symbol_ns() const { return (csymb?csymb:symb); }
293
296 double character(int i) const {
297 return complex_ ? 0.5*rep[i].trace() : rep[i].trace();
298 }
299
301 double p(int x1, int x2, int i) const { return rep[i](x1,x2); }
302
305 double p(int d, int i) const {
306 int dc=d/degen; int dr=d%degen;
307 return rep[i](dr,dc);
308 }
309
313 void print(std::ostream& =ExEnv::out0()) const;
314};
315
316// ///////////////////////////////////////////////////////////
326 public:
327 enum pgroups {C1, CS, CI, CN, CNV, CNH, DN, DND, DNH, SN, T, TH, TD, O,
328 OH, I, IH};
329
330 private:
331 int g; // the order of the point group
332 int nt; // order of the princ rot axis
333 pgroups pg; // the class of the point group
334 int nirrep_; // the number of irreps in this pg
335 IrreducibleRepresentation *gamma_; // an array of irreps
336 SymmetryOperation *symop; // the matrices describing sym ops
337 int *_inv; // index of the inverse symop
338 char *symb; // the Schoenflies symbol for the pg
339
341 int parse_symbol();
343 int make_table();
344
345 // these create the character tables for the cubic groups
346 void t();
347 void th();
348 void td();
349 void o();
350 void oh();
351 void i();
352 void ih();
353
354 public:
358 CharacterTable(const char*);
363
366
367 CharacterTable& operator=(const CharacterTable&);
368
370 int nirrep() const { return nirrep_; }
372 int order() const { return g; }
374 const char * symbol() const { return symb; }
376 IrreducibleRepresentation& gamma(int i) { return gamma_[i]; }
378 SymmetryOperation& symm_operation(int i) { return symop[i]; }
379
383 int complex() const {
384 if (pg==CN || pg==SN || pg==CNH || pg==T || pg==TH)
385 return 1;
386 return 0;
387 }
388
390 int inverse(int i) const { return _inv[i]; }
391
392 int ncomp() const {
393 int ret=0;
394 for (int i=0; i < nirrep_; i++) {
395 int nc = (gamma_[i].complex()) ? 1 : gamma_[i].degen;
396 ret += nc;
397 }
398 return ret;
399 }
400
402 int which_irrep(int i) {
403 for (int ir=0, cn=0; ir < nirrep_; ir++) {
404 int nc = (gamma_[ir].complex()) ? 1 : gamma_[ir].degen;
405 for (int c=0; c < nc; c++,cn++)
406 if (cn==i)
407 return ir;
408 }
409 return -1;
410 }
411
413 int which_comp(int i) {
414 for (int ir=0, cn=0; ir < nirrep_; ir++) {
415 int nc = (gamma_[ir].complex()) ? 1 : gamma_[ir].degen;
416 for (int c=0; c < nc; c++,cn++)
417 if (cn==i)
418 return c;
419 }
420 return -1;
421 }
422
424 void print(std::ostream& =ExEnv::out0()) const;
425};
426
427// ///////////////////////////////////////////////////////////
428
437 private:
438 char *symb;
439 SymmetryOperation frame;
440 SCVector3 origin_;
441
442 public:
443 PointGroup();
446 PointGroup(const char*);
488
490 PointGroup(const PointGroup&);
492 ~PointGroup();
493
494 PointGroup& operator=(const PointGroup&);
495
497 int equiv(const Ref<PointGroup> &, double tol = 1.0e-6) const;
498
502 const char * symbol() const { return symb; }
504 SymmetryOperation& symm_frame() { return frame; }
506 const SymmetryOperation& symm_frame() const { return frame; }
508 SCVector3& origin() { return origin_; }
509 const SCVector3& origin() const { return origin_; }
510
512 void set_symbol(const char*);
513
515
516 void print(std::ostream&o=ExEnv::out0()) const;
517};
518
519}
520
521#endif
522
523// Local Variables:
524// mode: c++
525// c-file-style: "ETS"
526// End:
The CharacterTable class provides a workable character table for all of the non-cubic point groups.
Definition pointgrp.h:325
IrreducibleRepresentation & gamma(int i)
Returns the i'th irrep.
Definition pointgrp.h:376
int order() const
Returns the order of the point group.
Definition pointgrp.h:372
int which_irrep(int i)
Returns the irrep component i belongs to.
Definition pointgrp.h:402
CharacterTable(const char *)
This constructor takes the Schoenflies symbol of a point group as input.
void print(std::ostream &=ExEnv::out0()) const
This prints the irrep to the given file, or stdout if none is given.
SymmetryOperation & symm_operation(int i)
Returns the i'th symmetry operation.
Definition pointgrp.h:378
const char * symbol() const
Returns the Schoenflies symbol for the point group.
Definition pointgrp.h:374
int complex() const
Cn, Cnh, Sn, T, and Th point groups have complex representations.
Definition pointgrp.h:383
int inverse(int i) const
Returns the index of the symop which is the inverse of symop[i].
Definition pointgrp.h:390
int which_comp(int i)
Returns which component i is.
Definition pointgrp.h:413
CharacterTable(const char *, const SymmetryOperation &)
This is like the above, but it also takes a reference to a SymmetryOperation which is the frame of re...
int nirrep() const
Returns the number of irreps.
Definition pointgrp.h:370
static std::ostream & out0()
Return an ostream that writes from node 0.
The IrreducibleRepresentation class provides information associated with a particular irreducible rep...
Definition pointgrp.h:239
int ntrans() const
Returns the number of translations associated with the irrep.
Definition pointgrp.h:284
const char * symbol_ns() const
Returns the Mulliken symbol for the irrep without special characters.
Definition pointgrp.h:292
int order() const
Returns the order of the group.
Definition pointgrp.h:269
IrreducibleRepresentation(int, int, const char *, const char *=0)
This constructor takes as arguments the order of the point group, the degeneracy of the irrep,...
void init(int=0, int=0, const char *=0, const char *=0)
Initialize the order, degeneracy, and Mulliken symbol of the irrep.
int nproj() const
Returns the number of projection operators for the irrep.
Definition pointgrp.h:278
double p(int d, int i) const
Returns the character for the d'th contribution to the i'th representation matrix.
Definition pointgrp.h:305
int degeneracy() const
Returns the degeneracy of the irrep.
Definition pointgrp.h:272
double p(int x1, int x2, int i) const
Returns the element (x1,x2) of the i'th representation matrix.
Definition pointgrp.h:301
int complex() const
Returns the value of complex_.
Definition pointgrp.h:275
int nrot() const
Returns the number of rotations associated with the irrep.
Definition pointgrp.h:281
double character(int i) const
Returns the character for the i'th symmetry operation of the point group.
Definition pointgrp.h:296
const char * symbol() const
Returns the Mulliken symbol for the irrep.
Definition pointgrp.h:287
void print(std::ostream &=ExEnv::out0()) const
This prints the irrep to the given file, or stdout if none is given.
The PointGroup class is really a place holder for a CharacterTable.
Definition pointgrp.h:436
int equiv(const Ref< PointGroup > &, double tol=1.0e-6) const
Returns 1 if the point groups are equivalent, 0 otherwise.
PointGroup(const char *, SymmetryOperation &)
Like the above, but this constructor also takes a frame of reference as an argument.
void set_symbol(const char *)
Sets (or resets) the Schoenflies symbol.
const char * symbol() const
Returns the Schoenflies symbol for this point group.
Definition pointgrp.h:502
void print(std::ostream &o=ExEnv::out0()) const
Print the object.
SCVector3 & origin()
Returns the origin of the symmetry frame.
Definition pointgrp.h:508
PointGroup(const char *)
This constructor takes a string containing the Schoenflies symbol of the point group as its only argu...
CharacterTable char_table() const
Returns the CharacterTable for this point group.
const SymmetryOperation & symm_frame() const
A const version of the above.
Definition pointgrp.h:506
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 ...
PointGroup(const Ref< KeyVal > &)
The PointGroup KeyVal constructor looks for three keywords: symmetry, symmetry_frame,...
SymmetryOperation & symm_frame()
Returns the frame of reference for this point group.
Definition pointgrp.h:504
PointGroup(const char *, SymmetryOperation &, const SCVector3 &)
Like the above, but this constructor also takes a point of origin as an argument.
A template class that maintains references counts.
Definition ref.h:332
Definition vector3.h:46
Base class for objects that can save/restore state.
Definition state.h:46
Restores objects that derive from SavableState.
Definition statein.h:70
Serializes objects that derive from SavableState.
Definition stateout.h:61
The SymRep class provides an n dimensional matrix representation of a symmetry operation,...
Definition pointgrp.h:145
void c2_y()
Set equal to C2 about the x axis.
const double * operator[](int i) const
const version of the above
Definition pointgrp.h:167
SymRep operate(const SymRep &r) const
This operates on this with r (i.e. return r * this).
double & operator()(int i, int j)
returns a reference to the (i,j)th element of the transformation matrix
Definition pointgrp.h:171
void E()
Set equal to the identity.
Definition pointgrp.h:190
void set_dim(int i)
set the dimension of d
Definition pointgrp.h:162
void rotation(int n)
Set equal to a clockwise rotation by 2pi/n.
void unit()
Set equal to a unit matrix.
Definition pointgrp.h:185
void sigma_h()
Set equal to reflection in xy plane.
void sigma_yz()
Set equal to reflection in yz plane.
void c2_x()
Set equal to C2 about the x axis.
void zero()
zero out the symop
Definition pointgrp.h:176
double * operator[](int i)
returns the i'th row of the transformation matrix
Definition pointgrp.h:165
void print(std::ostream &=ExEnv::out0()) const
print the matrix
void sigma_xz()
Set equal to reflection in xz plane.
void i()
Set equal to an inversion.
Definition pointgrp.h:193
double trace() const
returns the trace of the transformation matrix
Definition pointgrp.h:219
double operator()(int i, int j) const
const version of double& operator()(int i, int j)
Definition pointgrp.h:173
SymRep transform(const SymRep &r) const
This performs the transform r * this * r~.
The SymmetryOperation class provides a 3 by 3 matrix representation of a symmetry operation,...
Definition pointgrp.h:70
void unit()
Set equal to a unit matrix.
Definition pointgrp.h:105
double operator()(int i, int j) const
const version of the above
Definition pointgrp.h:93
void c2_x()
Set equal to C2 about the x axis.
Definition pointgrp.h:127
SymmetryOperation operate(const SymmetryOperation &r) const
This operates on this with r (i.e. return r * this).
void rotation(int n)
Set equal to a clockwise rotation by 2pi/n.
double * operator[](int i)
returns the i'th row of the transformation matrix
Definition pointgrp.h:83
double & operator()(int i, int j)
returns a reference to the (i,j)th element of the transformation matrix
Definition pointgrp.h:90
void c2_y()
Set equal to C2 about the x axis.
Definition pointgrp.h:130
double trace() const
returns the trace of the transformation matrix
Definition pointgrp.h:80
SymmetryOperation transform(const SymmetryOperation &r) const
This performs the transform r * this * r~.
void zero()
zero out the symop
Definition pointgrp.h:96
void E()
Set equal to E.
Definition pointgrp.h:108
void sigma_h()
Set equal to reflection in xy plane.
Definition pointgrp.h:114
void i()
Set equal to an inversion.
Definition pointgrp.h:111
void sigma_xz()
Set equal to reflection in xz plane.
Definition pointgrp.h:117
void print(std::ostream &=ExEnv::out0()) const
print the matrix
void sigma_yz()
Set equal to reflection in yz plane.
Definition pointgrp.h:120
const double * operator[](int i) const
const version of the above
Definition pointgrp.h:86

Generated at Fri Jan 31 2025 00:00:00 for MPQC 2.3.1 using the documentation package Doxygen 1.12.0.