📄 pointgrp.h
字号:
//// pointgrp.h//// Modifications are// Copyright (C) 1996 Limit Point Systems, Inc.//// Author: Edward Seidl <seidl@janed.com>// Maintainer: LPS//// This file is part of the SC Toolkit.//// The SC Toolkit is free software; you can redistribute it and/or modify// it under the terms of the GNU Library General Public License as published by// the Free Software Foundation; either version 2, or (at your option)// any later version.//// The SC Toolkit is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU Library General Public License for more details.//// You should have received a copy of the GNU Library General Public License// along with the SC Toolkit; see the file COPYING.LIB. If not, write to// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.//// The U.S. Government is granted a limited license as per AL 91-7.///* pointgrp.h -- definition of the point group classes * * THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A * "UNITED STATES GOVERNMENT WORK". IT WAS WRITTEN AS A PART OF THE * AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE. THIS MEANS IT * CANNOT BE COPYRIGHTED. THIS SOFTWARE IS FREELY AVAILABLE TO THE * PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO * RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY. * * Author: * E. T. Seidl * Bldg. 12A, Rm. 2033 * Computer Systems Laboratory * Division of Computer Research and Technology * National Institutes of Health * Bethesda, Maryland 20892 * Internet: seidl@alw.nih.gov * June, 1993 */#ifdef __GNUC__#pragma interface#endif#ifndef _math_symmetry_pointgrp_h#define _math_symmetry_pointgrp_h#include <iostream>#include <util/class/class.h>#include <util/state/state.h>#include <util/keyval/keyval.h>#include <math/scmat/vector3.h>namespace sc {// ///////////////////////////////////////////////////////////////////** The SymmetryOperation class provides a 3 by 3 matrix representation of a symmetry operation, such as a rotation or reflection.*/class SymmetryOperation { private: double d[3][3]; public: SymmetryOperation(); SymmetryOperation(const SymmetryOperation &); ~SymmetryOperation(); /// returns the trace of the transformation matrix double trace() const { return d[0][0]+d[1][1]+d[2][2]; } /// returns the i'th row of the transformation matrix double* operator[](int i) { return d[i]; } /// const version of the above const double* operator[](int i) const { return d[i]; } /** returns a reference to the (i,j)th element of the transformation matrix */ double& operator()(int i, int j) { return d[i][j]; } /// const version of the above double operator()(int i, int j) const { return d[i][j]; } /// zero out the symop void zero() { memset(d,0,sizeof(double)*9); } /// This operates on this with r (i.e. return r * this). SymmetryOperation operate(const SymmetryOperation& r) const; /// This performs the transform r * this * r~ SymmetryOperation transform(const SymmetryOperation& r) const; /// Set equal to a unit matrix void unit() { zero(); d[0][0] = d[1][1] = d[2][2] = 1.0; } /// Set equal to E void E() { unit(); } /// Set equal to an inversion void i() { zero(); d[0][0] = d[1][1] = d[2][2] = -1.0; } /// Set equal to reflection in xy plane void sigma_h() { unit(); d[2][2] = -1.0; } /// Set equal to reflection in xz plane void sigma_xz() { unit(); d[1][1] = -1.0; } /// Set equal to reflection in yz plane void sigma_yz() { unit(); d[0][0] = -1.0; } /// Set equal to a clockwise rotation by 2pi/n void rotation(int n); void rotation(double theta); /// Set equal to C2 about the x axis void c2_x() { i(); d[0][0] = 1.0; } /// Set equal to C2 about the x axis void c2_y() { i(); d[1][1] = 1.0; } void transpose(); /// print the matrix void print(std::ostream& =ExEnv::out0()) const;};// ///////////////////////////////////////////////////////////////////** The SymRep class provides an n dimensional matrix representation of a symmetry operation, such as a rotation or reflection. The trace of a SymRep can be used as the character for that symmetry operation. d is hardwired to 5x5 since the H irrep in Ih is 5 dimensional.*/class SymRep { private: int n; double d[5][5]; public: SymRep(int =0); SymRep(const SymmetryOperation&); ~SymRep(); /// Cast to a SymmetryOperation. operator SymmetryOperation() const; /// returns the trace of the transformation matrix inline double trace() const; /// set the dimension of d void set_dim(int i) { n=i; } /// returns the i'th row of the transformation matrix double* operator[](int i) { return d[i]; } /// const version of the above const double* operator[](int i) const { return d[i]; } /** returns a reference to the (i,j)th element of the transformation matrix */ double& operator()(int i, int j) { return d[i][j]; } /// const version of double& operator()(int i, int j) double operator()(int i, int j) const { return d[i][j]; } /// zero out the symop void zero() { memset(d,0,sizeof(double)*25); } /// This operates on this with r (i.e. return r * this). SymRep operate(const SymRep& r) const; /// This performs the transform r * this * r~ SymRep transform(const SymRep& r) const; /// Set equal to a unit matrix void unit() { zero(); d[0][0] = d[1][1] = d[2][2] = d[3][3] = d[4][4] = 1.0; } /// Set equal to the identity void E() { unit(); } /// Set equal to an inversion void i() { zero(); d[0][0] = d[1][1] = d[2][2] = d[3][3] = d[4][4] = -1.0;} /// Set equal to reflection in xy plane void sigma_h(); /// Set equal to reflection in xz plane void sigma_xz(); /// Set equal to reflection in yz plane void sigma_yz(); /// Set equal to a clockwise rotation by 2pi/n void rotation(int n); void rotation(double theta); /// Set equal to C2 about the x axis void c2_x(); /// Set equal to C2 about the x axis void c2_y(); /// print the matrix void print(std::ostream& =ExEnv::out0()) const;};inline doubleSymRep::trace() const{ double r=0; for (int i=0; i < n; i++) r += d[i][i]; return r;}// //////////////////////////////////////////////////////////////////class CharacterTable;/** The IrreducibleRepresentation class provides information associated with a particular irreducible representation of a point group. This includes the Mulliken symbol for the irrep, the degeneracy of the irrep, the characters which represent the irrep, and the number of translations and rotations in the irrep. The order of the point group is also provided (this is equal to the number of characters in an irrep). */class IrreducibleRepresentation { friend class CharacterTable; private: int g; // the order of the group int degen; // the degeneracy of the irrep int nrot_; // the number of rotations in this irrep int ntrans_; // the number of translations in this irrep int complex_; // true if this irrep has a complex representation char *symb; // mulliken symbol for this irrep char *csymb; // mulliken symbol for this irrep w/o special characters SymRep *rep; // representation matrices for the symops public: IrreducibleRepresentation(); IrreducibleRepresentation(const IrreducibleRepresentation&); /** This constructor takes as arguments the order of the point group, the degeneracy of the irrep, and the Mulliken symbol of the irrep. The Mulliken symbol is copied internally. */ IrreducibleRepresentation(int,int,const char*,const char* =0); ~IrreducibleRepresentation(); IrreducibleRepresentation& operator=(const IrreducibleRepresentation&);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -