source: ThirdParty/mpqc_open/src/lib/chemistry/qc/basis/gpetite.cc@ e4036a

ForceAnnealing_goodresults ForceAnnealing_tocheck
Last change on this file since e4036a was ce254c, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

FIX: Enforce template instantation in mpqc's gpetite.cc to avoid linker problems.

  • Property mode set to 100644
File size: 6.4 KB
Line 
1//
2// gpetite.cc --- implementation of GPetite4 and helpers
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@ca.sandia.gov>
7// Maintainer: SNL
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 __GNUC__
29#pragma implementation
30#endif
31
32#include <util/misc/formio.h>
33
34#include <chemistry/qc/basis/basis.h>
35#include <chemistry/qc/basis/gpetite.h>
36
37using namespace std;
38using namespace sc;
39
40////////////////////////////////////////////////////////////////////////////
41
42canonical_aaaa::canonical_aaaa()
43{
44}
45
46canonical_aaaa::canonical_aaaa(const Ref<GaussianBasisSet> bi,
47 const Ref<GaussianBasisSet> bj,
48 const Ref<GaussianBasisSet> bk,
49 const Ref<GaussianBasisSet> bl)
50{
51}
52
53////////////////////////////////////////////////////////////////////////////
54
55canonical_aabc::canonical_aabc(const Ref<GaussianBasisSet> bi,
56 const Ref<GaussianBasisSet> bj,
57 const Ref<GaussianBasisSet> bk,
58 const Ref<GaussianBasisSet> bl)
59{
60 nk_ = bk->nshell();
61 nl_ = bl->nshell();
62}
63
64////////////////////////////////////////////////////////////////////////////
65
66
67canonical_aabb::canonical_aabb(const Ref<GaussianBasisSet> bi,
68 const Ref<GaussianBasisSet> bj,
69 const Ref<GaussianBasisSet> bk,
70 const Ref<GaussianBasisSet> bl)
71{
72 int ni = bi->nshell();
73 nij_ = (ni*long(ni+1))>>1;
74}
75
76////////////////////////////////////////////////////////////////////////////
77
78canonical_abcd::canonical_abcd(const Ref<GaussianBasisSet> bi,
79 const Ref<GaussianBasisSet> bj,
80 const Ref<GaussianBasisSet> bk,
81 const Ref<GaussianBasisSet> bl)
82{
83 ni_ = bi->nshell();
84 nj_ = bj->nshell();
85 nk_ = bk->nshell();
86}
87
88
89/////////////////////////////////////////////////////////////////////////////
90
91GenPetite4::GenPetite4(const Ref<GaussianBasisSet> &b1,
92 const Ref<GaussianBasisSet> &b2,
93 const Ref<GaussianBasisSet> &b3,
94 const Ref<GaussianBasisSet> &b4)
95{
96 int **atom_map;
97 b1_ = b1;
98 b2_ = b2;
99 b3_ = b3;
100 b4_ = b4;
101
102 ng_ = b1->molecule()->point_group()->char_table().order();
103 if (b2->molecule()->point_group()->char_table().order() != ng_
104 || b3->molecule()->point_group()->char_table().order() != ng_
105 || b4->molecule()->point_group()->char_table().order() != ng_) {
106 throw std::runtime_error("GPetite4: not all point groups are the same");
107 }
108 c1_ = (ng_ == 1);
109
110 atom_map = compute_atom_map(b1);
111 shell_map_i_ = compute_shell_map(atom_map,b1);
112 delete_atom_map(atom_map,b1);
113
114 atom_map = compute_atom_map(b2);
115 shell_map_j_ = compute_shell_map(atom_map,b2);
116 delete_atom_map(atom_map,b2);
117
118 atom_map = compute_atom_map(b3);
119 shell_map_k_ = compute_shell_map(atom_map,b3);
120 delete_atom_map(atom_map,b3);
121
122 atom_map = compute_atom_map(b4);
123 shell_map_l_ = compute_shell_map(atom_map,b4);
124 delete_atom_map(atom_map,b4);
125}
126
127GenPetite4::~GenPetite4() {
128 delete_shell_map(shell_map_i_,b1_);
129 delete_shell_map(shell_map_j_,b2_);
130 delete_shell_map(shell_map_k_,b3_);
131 delete_shell_map(shell_map_l_,b4_);
132}
133
134/////////////////////////////////////////////////////////////////////////////
135
136template <class C4> GPetite4<C4>::GPetite4(const Ref<GaussianBasisSet> &b1,
137 const Ref<GaussianBasisSet> &b2,
138 const Ref<GaussianBasisSet> &b3,
139 const Ref<GaussianBasisSet> &b4,
140 const C4& c): GenPetite4(b1,b2,b3,b4), c_(c)
141{
142}
143
144template <class C4> GPetite4<C4>::~GPetite4()
145{
146}
147
148// enforce template instantation
149template GPetite4<canonical_aaaa>::GPetite4(const Ref<GaussianBasisSet> &b1,
150 const Ref<GaussianBasisSet> &b2,
151 const Ref<GaussianBasisSet> &b3,
152 const Ref<GaussianBasisSet> &b4,
153 const canonical_aaaa& c);
154template GPetite4<canonical_aabc>::GPetite4(const Ref<GaussianBasisSet> &b1,
155 const Ref<GaussianBasisSet> &b2,
156 const Ref<GaussianBasisSet> &b3,
157 const Ref<GaussianBasisSet> &b4,
158 const canonical_aabc& c);
159template GPetite4<canonical_aabb>::GPetite4(const Ref<GaussianBasisSet> &b1,
160 const Ref<GaussianBasisSet> &b2,
161 const Ref<GaussianBasisSet> &b3,
162 const Ref<GaussianBasisSet> &b4,
163 const canonical_aabb& c);
164template GPetite4<canonical_abcd>::GPetite4(const Ref<GaussianBasisSet> &b1,
165 const Ref<GaussianBasisSet> &b2,
166 const Ref<GaussianBasisSet> &b3,
167 const Ref<GaussianBasisSet> &b4,
168 const canonical_abcd& c);
169
170
171/////////////////////////////////////////////////////////////////////////////
172
173Ref<GenPetite4>
174sc::construct_gpetite(const Ref<GaussianBasisSet> &b1,
175 const Ref<GaussianBasisSet> &b2,
176 const Ref<GaussianBasisSet> &b3,
177 const Ref<GaussianBasisSet> &b4)
178{
179 if (b1 == b2 && b1 == b3 && b1 == b4) {
180 canonical_aaaa c4(b1,b2,b3,b4);
181 return new GPetite4<canonical_aaaa>(b1,b2,b3,b4,c4);
182 }
183 else if (b1 == b2 && b3 != b4) {
184 canonical_aabc c4(b1,b2,b3,b4);
185 return new GPetite4<canonical_aabc>(b1,b2,b3,b4,c4);
186 }
187 else if (b1 == b2 && b3 == b4) {
188 canonical_aabb c4(b1,b2,b3,b4);
189 return new GPetite4<canonical_aabb>(b1,b2,b3,b4,c4);
190 }
191 else {
192 canonical_abcd c4(b1,b2,b3,b4);
193 return new GPetite4<canonical_abcd>(b1,b2,b3,b4,c4);
194 }
195}
196
197/////////////////////////////////////////////////////////////////////////////
198
199// Local Variables:
200// mode: c++
201// c-file-style: "ETS"
202// End:
Note: See TracBrowser for help on using the repository browser.