| 1 | // | 
|---|
| 2 | // irrep.cc | 
|---|
| 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 | /* irrep.cc -- implementation 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 |  | 
|---|
| 50 | #include <stdlib.h> | 
|---|
| 51 |  | 
|---|
| 52 | #include <util/misc/newstring.h> | 
|---|
| 53 | #include <math/symmetry/pointgrp.h> | 
|---|
| 54 | #include <util/misc/formio.h> | 
|---|
| 55 |  | 
|---|
| 56 | using namespace std; | 
|---|
| 57 | using namespace sc; | 
|---|
| 58 |  | 
|---|
| 59 | ///////////////////////////////////////////////////////////////////////// | 
|---|
| 60 |  | 
|---|
| 61 | IrreducibleRepresentation::IrreducibleRepresentation() : | 
|---|
| 62 | g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(0), rep(0), csymb(0) | 
|---|
| 63 | { | 
|---|
| 64 | } | 
|---|
| 65 |  | 
|---|
| 66 | IrreducibleRepresentation::IrreducibleRepresentation( | 
|---|
| 67 | int order, int d, const char *lab, const char *clab) : | 
|---|
| 68 | g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(0), rep(0), csymb(0) | 
|---|
| 69 | { | 
|---|
| 70 | init(order,d,lab,clab); | 
|---|
| 71 | } | 
|---|
| 72 |  | 
|---|
| 73 |  | 
|---|
| 74 | IrreducibleRepresentation::IrreducibleRepresentation( | 
|---|
| 75 | const IrreducibleRepresentation& ir) : | 
|---|
| 76 | g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(0), rep(0), csymb(0) | 
|---|
| 77 | { | 
|---|
| 78 | *this = ir; | 
|---|
| 79 | } | 
|---|
| 80 |  | 
|---|
| 81 | IrreducibleRepresentation::~IrreducibleRepresentation() | 
|---|
| 82 | { | 
|---|
| 83 | init(); | 
|---|
| 84 | } | 
|---|
| 85 |  | 
|---|
| 86 | IrreducibleRepresentation& | 
|---|
| 87 | IrreducibleRepresentation::operator=(const IrreducibleRepresentation& ir) | 
|---|
| 88 | { | 
|---|
| 89 | init(ir.g,ir.degen,ir.symb,ir.csymb); | 
|---|
| 90 |  | 
|---|
| 91 | nrot_ = ir.nrot_; | 
|---|
| 92 | ntrans_ = ir.ntrans_; | 
|---|
| 93 | complex_ = ir.complex_; | 
|---|
| 94 |  | 
|---|
| 95 | for (int i=0; i < g; i++) | 
|---|
| 96 | rep[i]=ir.rep[i]; | 
|---|
| 97 |  | 
|---|
| 98 | return *this; | 
|---|
| 99 | } | 
|---|
| 100 |  | 
|---|
| 101 | void | 
|---|
| 102 | IrreducibleRepresentation::init(int order, int d, const char *lab, | 
|---|
| 103 | const char *clab) | 
|---|
| 104 | { | 
|---|
| 105 | g=order; | 
|---|
| 106 | degen=d; | 
|---|
| 107 | ntrans_=nrot_=complex_=0; | 
|---|
| 108 |  | 
|---|
| 109 | delete[] symb; | 
|---|
| 110 | symb = new_string(lab); | 
|---|
| 111 |  | 
|---|
| 112 | delete[] csymb; | 
|---|
| 113 | if (clab) csymb = new_string(clab); | 
|---|
| 114 | else csymb = 0; | 
|---|
| 115 |  | 
|---|
| 116 | if (rep) { | 
|---|
| 117 | delete[] rep; | 
|---|
| 118 | rep=0; | 
|---|
| 119 | } | 
|---|
| 120 |  | 
|---|
| 121 | if (g) { | 
|---|
| 122 | rep = new SymRep[g]; | 
|---|
| 123 | for (int i=0; i < g; i++) | 
|---|
| 124 | rep[i].set_dim(d); | 
|---|
| 125 | } | 
|---|
| 126 | } | 
|---|
| 127 |  | 
|---|
| 128 | void | 
|---|
| 129 | IrreducibleRepresentation::print(ostream& os) const | 
|---|
| 130 | { | 
|---|
| 131 | if (!g) | 
|---|
| 132 | return; | 
|---|
| 133 |  | 
|---|
| 134 | int i,d; | 
|---|
| 135 |  | 
|---|
| 136 | os << indent << scprintf("%-5s",symb); | 
|---|
| 137 |  | 
|---|
| 138 | for (i=0; i < g; i++) | 
|---|
| 139 | os << scprintf(" %6.3f",character(i)); | 
|---|
| 140 | os << " | " << ntrans_ << " t, " << nrot_ << " R\n"; | 
|---|
| 141 |  | 
|---|
| 142 | for (d=0; d < nproj(); d++) { | 
|---|
| 143 | os << indent << "     "; | 
|---|
| 144 | for (i=0; i < g; i++) | 
|---|
| 145 | os << scprintf(" %6.3f",p(d,i)); | 
|---|
| 146 | os << endl; | 
|---|
| 147 | } | 
|---|
| 148 | } | 
|---|
| 149 |  | 
|---|
| 150 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 151 |  | 
|---|
| 152 | // Local Variables: | 
|---|
| 153 | // mode: c++ | 
|---|
| 154 | // c-file-style: "ETS" | 
|---|
| 155 | // End: | 
|---|