| 1 | // | 
|---|
| 2 | // shellpairs.cc | 
|---|
| 3 | // | 
|---|
| 4 | // Copyright (C) 2001 Edward Valeev | 
|---|
| 5 | // | 
|---|
| 6 | // Author: Edward Valeev <edward.valeev@chemistry.gatech.edu> | 
|---|
| 7 | // Maintainer: EV | 
|---|
| 8 | // | 
|---|
| 9 | // This file is part of the SC Toolkit. | 
|---|
| 10 | // | 
|---|
| 11 | // The SC Toolkit is free software; you can redistribute it and/or modify | 
|---|
| 12 | // it under the terms of the GNU Library General Public License as published by | 
|---|
| 13 | // the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 14 | // any later version. | 
|---|
| 15 | // | 
|---|
| 16 | // The SC Toolkit is distributed in the hope that it will be useful, | 
|---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 19 | // GNU Library General Public License for more details. | 
|---|
| 20 | // | 
|---|
| 21 | // You should have received a copy of the GNU Library General Public License | 
|---|
| 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to | 
|---|
| 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 
|---|
| 24 | // | 
|---|
| 25 | // The U.S. Government is granted a limited license as per AL 91-7. | 
|---|
| 26 | // | 
|---|
| 27 |  | 
|---|
| 28 | #ifdef __GNUG__ | 
|---|
| 29 | #pragma implementation | 
|---|
| 30 | #endif | 
|---|
| 31 |  | 
|---|
| 32 | #include <util/state/statein.h> | 
|---|
| 33 | #include <util/state/stateout.h> | 
|---|
| 34 | #include <util/misc/formio.h> | 
|---|
| 35 | #include <util/ref/ref.h> | 
|---|
| 36 | #include <chemistry/qc/basis/gaussshell.h> | 
|---|
| 37 | #include <chemistry/qc/basis/integral.h> | 
|---|
| 38 | #include <chemistry/qc/cints/shellpairs.h> | 
|---|
| 39 | #include <chemistry/qc/cints/primpairs.h> | 
|---|
| 40 |  | 
|---|
| 41 | using namespace std; | 
|---|
| 42 | using namespace sc; | 
|---|
| 43 |  | 
|---|
| 44 | inline int max(int a,int b) { return (a > b) ? a : b;} | 
|---|
| 45 | inline void fail() | 
|---|
| 46 | { | 
|---|
| 47 | ExEnv::errn() << scprintf("failing module:\n%s",__FILE__) << endl; | 
|---|
| 48 | abort(); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | /*---------------- | 
|---|
| 52 | ShellPairsCints | 
|---|
| 53 | ----------------*/ | 
|---|
| 54 | static ClassDesc ShellPairCints_cd( | 
|---|
| 55 | typeid(ShellPairCints),"ShellPairCints",1,"virtual public SavableState", | 
|---|
| 56 | 0, 0, create<ShellPairCints>); | 
|---|
| 57 |  | 
|---|
| 58 | ShellPairCints::ShellPairCints(Ref<PrimPairsCints>& p) | 
|---|
| 59 | { | 
|---|
| 60 | prim_pairs_ = p; | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | ShellPairCints::ShellPairCints(StateIn& si) : | 
|---|
| 64 | SavableState(si) | 
|---|
| 65 | { | 
|---|
| 66 | si.get(prim1_offset_); | 
|---|
| 67 | si.get(prim2_offset_); | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | ShellPairCints::~ShellPairCints() | 
|---|
| 71 | { | 
|---|
| 72 | } | 
|---|
| 73 |  | 
|---|
| 74 | void ShellPairCints::save_data_state(StateOut& so) | 
|---|
| 75 | { | 
|---|
| 76 | so.put(prim1_offset_); | 
|---|
| 77 | so.put(prim2_offset_); | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | void ShellPairCints::init(const int p1_offset, const int p2_offset) | 
|---|
| 81 | { | 
|---|
| 82 | prim1_offset_ = p1_offset; | 
|---|
| 83 | prim2_offset_ = p2_offset; | 
|---|
| 84 | } | 
|---|
| 85 |  | 
|---|
| 86 | /*---------------- | 
|---|
| 87 | ShellPairsCints | 
|---|
| 88 | ----------------*/ | 
|---|
| 89 | static ClassDesc ShellPairsCints_cd( | 
|---|
| 90 | typeid(ShellPairsCints),"ShellPairsCints",1,"virtual public SavableState", | 
|---|
| 91 | 0, 0, create<ShellPairsCints>); | 
|---|
| 92 |  | 
|---|
| 93 | ShellPairsCints::ShellPairsCints(const Ref<GaussianBasisSet>& bs1, | 
|---|
| 94 | const Ref<GaussianBasisSet>& bs2) | 
|---|
| 95 | { | 
|---|
| 96 | bs1_ = bs1; | 
|---|
| 97 | bs2_ = bs2; | 
|---|
| 98 | prim_pairs_ = new PrimPairsCints(bs1_,bs2_); | 
|---|
| 99 | shell_pair_ = new ShellPairCints(prim_pairs_); | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 | ShellPairsCints::ShellPairsCints(const Ref<ShellPairsCints>& sp) | 
|---|
| 103 | { | 
|---|
| 104 | bs1_ = sp->bs1_; | 
|---|
| 105 | bs2_ = sp->bs2_; | 
|---|
| 106 | prim_pairs_ = sp->prim_pairs_; | 
|---|
| 107 | shell_pair_ = new ShellPairCints(prim_pairs_); | 
|---|
| 108 | } | 
|---|
| 109 |  | 
|---|
| 110 | ShellPairsCints::ShellPairsCints(StateIn& si) : | 
|---|
| 111 | SavableState(si) | 
|---|
| 112 | { | 
|---|
| 113 | bs1_ << SavableState::restore_state(si); | 
|---|
| 114 | bs2_ << SavableState::restore_state(si); | 
|---|
| 115 | prim_pairs_ = new PrimPairsCints(bs1_,bs2_); | 
|---|
| 116 | shell_pair_ << SavableState::restore_state(si); | 
|---|
| 117 | init_shell_pair(*this); | 
|---|
| 118 | } | 
|---|
| 119 |  | 
|---|
| 120 | ShellPairsCints::~ShellPairsCints() | 
|---|
| 121 | { | 
|---|
| 122 | } | 
|---|
| 123 |  | 
|---|
| 124 | void ShellPairsCints::save_data_state(StateOut& so) | 
|---|
| 125 | { | 
|---|
| 126 | SavableState::save_state(bs1_.pointer(),so); | 
|---|
| 127 | SavableState::save_state(bs2_.pointer(),so); | 
|---|
| 128 | SavableState::save_state(shell_pair_.pointer(),so); | 
|---|
| 129 | } | 
|---|
| 130 |  | 
|---|
| 131 | namespace sc { | 
|---|
| 132 | void init_shell_pair(ShellPairsCints& sp) | 
|---|
| 133 | { sp.shell_pair_->prim_pairs_ = sp.prim_pairs_; } | 
|---|
| 134 | } | 
|---|
| 135 |  | 
|---|
| 136 |  | 
|---|
| 137 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 138 |  | 
|---|
| 139 | // Local Variables: | 
|---|
| 140 | // mode: c++ | 
|---|
| 141 | // c-file-style: "CLJ-CONDENSED" | 
|---|
| 142 | // End: | 
|---|