// // sobasis.cc --- implementation of the Integral class // // Copyright (C) 1998 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 #include #include #include using namespace std; using namespace sc; SOBasis::SOBasis(const Ref &basis, const Ref&integral) { int i,j,k; basis_ = basis; Ref mol = basis_->molecule(); CharacterTable ct = mol->point_group()->char_table(); nirrep_ = ct.nirrep(); // count the number of so shells nshell_ = 0; for (i=0; inunique(); i++) { nshell_ += basis_->nshell_on_center(mol->unique(i)); } // map each ao shell to an so shell int *aoshell_to_soshell = new int[basis_->nshell()]; int soshell = 0; for (i=0; inunique(); i++) { for (j=0; jnshell_on_center(mol->unique(i)); j++) { for (k=0; knequivalent(i); k++) { int aoshell = basis_->shell_on_center(mol->equivalent(i,k),j); aoshell_to_soshell[aoshell] = soshell; } soshell++; } } ncomp_ = new int[nirrep_]; for (i=0; i petite = new PetiteList(basis_, integral); int nblocks = petite->nblocks(); SO_block *soblocks = petite->aotoso_info(); trans_ = new SOTransform[nshell_]; for (i=0; ifunction_to_shell(bfn0); int soshell0 = aoshell_to_soshell[aoshell0]; int atom0 = basis_->shell_to_center(aoshell0); int nequiv0 = mol->nequivalent(mol->atom_to_unique(atom0)); trans_[soshell0].set_naoshell(nequiv0); } } int nfuncall = 0; for (i=0; ifunction_to_shell(bfn0); int soshell0 = aoshell_to_soshell[aoshell0]; int sofunc = nfunc_[soshell0][irrep]; int naofunc = basis_->shell(aoshell0).nfunction(); if (naofunc_[soshell0] && (naofunc_[soshell0] != naofunc)) { ExEnv::errn() << "ERROR: SOBasis: mismatch in naofunc" << endl; abort(); } naofunc_[soshell0] = naofunc; nfunc_[soshell0][irrep]++; nfuncall++; for (k=0; kfunction_to_shell(bfn); int aoshellfunc = bfn - basis_->shell_to_function(aoshell); int soshell = aoshell_to_soshell[aoshell]; if (soshell != soshell0) { ExEnv::outn() << "ERROR: SOBasis: shell changed" << endl; abort(); } trans_[soshell].add_transform(aoshell,irrep, coef,aoshellfunc,sofunc); } } } if (nfuncall != basis_->nbasis()) { ExEnv::out0() << "ERROR: SOBasis: miscounted number of functions" << endl; print(); abort(); } delete[] soblocks; delete[] aoshell_to_soshell; for (i=0; inbasis()]; func_within_irrep_ = new int[basis_->nbasis()]; nfunc_in_irrep_ = new int[nirrep_]; for (i=0; i maxn) maxn = n; } return maxn; } int SOBasis::nfunction(int ishell) const { int n=0; for (int i=0; i0) ExEnv::out0() << endl; for (j=0; j=naoshell_allocated) { ExEnv::outn() << "ERROR: SOTransform: add_transform allocation too small" << endl; abort(); } aoshell[i].add_func(irrep,coef,aofunc,sofunc); aoshell[i].aoshell = aoshellnum; if (i==naoshell) naoshell++; } ///////////////////////////////////////////////////////////////////////////// SOTransformShell::SOTransformShell() { nfunc = 0; func = 0; } SOTransformShell::~SOTransformShell() { delete[] func; } void SOTransformShell::add_func(int irrep, double coef, int aofunc, int sofunc) { SOTransformFunction *newfunc = new SOTransformFunction[nfunc+1]; for (int i=0; i