// // pointgrp.cc // // Copyright (C) 1997 Limit Point Systems, Inc. // // Author: Curtis Janssen // 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. // #ifdef __GNUC__ #pragma implementation #endif #include #include using namespace std; using namespace sc; //////////////////////////////////////////////////////////////////////// CorrelationTable::CorrelationTable(): n_(0), ngamma_(0), gamma_(0) { } CorrelationTable::CorrelationTable(const Ref& group, const Ref& subgroup): n_(0), ngamma_(0), gamma_(0) { int rc = initialize_table(group,subgroup); if (rc != 0) { ExEnv::err0() << "ERROR: CorrelationTable: " << error(rc) << endl; abort(); } } CorrelationTable::~CorrelationTable() { clear(); } int CorrelationTable::initialize_table(const Ref& group, const Ref& subgroup) { clear(); group_ = group; subgroup_ = subgroup; int i, j, k, l; CharacterTable ct = group_->char_table(); CharacterTable subct = subgroup_->char_table(); n_ = ct.nirrep(); subn_ = subct.nirrep(); ngamma_ = new int[n_]; gamma_ = new int*[n_]; // CAN ONLY HANDLE NONDEGENERATE POINT GROUPS for (i=0; i 1) { delete[] so_to_subso; delete[] subso_to_so; return -1; } } for (i=0; i= 0) { double subchr = subct.gamma(j).character(so_to_subso[k]); nmatch += subchr*chr; } } nmatch /= subct.order(); int inmatch = (int)(nmatch+0.5); if (fabs(nmatch-inmatch)>1.0e-6) { delete[] so_to_subso; delete[] subso_to_so; return -4; } if (inmatch > 0) { int *newgamma = new int[ngamma_[i] + inmatch]; memcpy(newgamma,gamma_[i],ngamma_[i]*sizeof(int)); for (k=0; kchar_table().gamma(i).degeneracy(); } int CorrelationTable::subdegen(int i) const { return subgroup_->char_table().gamma(i).degeneracy(); } void CorrelationTable::print(ostream &o) const { o << indent << "Correlation Table from " << group_->symbol() << " to " << subgroup_->symbol() << ":" << endl; CharacterTable ct = group_->char_table(); CharacterTable subct = subgroup_->char_table(); o << incindent; for (int i=0; i