source: ThirdParty/mpqc_open/src/lib/chemistry/qc/intv3/offsets.cc@ a844d8

Candidate_v1.6.1
Last change on this file since a844d8 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 6.0 KB
Line 
1//
2// offsets.cc
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
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#include <stdlib.h>
29#include <chemistry/qc/intv3/macros.h>
30#include <chemistry/qc/intv3/int1e.h>
31#include <chemistry/qc/intv3/int2e.h>
32
33using namespace sc;
34
35/* Compute the shell offset. */
36static int
37shell_offset(Ref<GaussianBasisSet> cs, int off)
38{
39 // unit shells have null cs's
40 if (cs.null()) return off + 1;
41 return off + cs->nshell();
42}
43
44/* Compute the prim offset. */
45static int
46prim_offset(Ref<GaussianBasisSet> cs, int off)
47{
48 // unit shells have null cs's
49 if (cs.null()) return off + 1;
50 return off + cs->nprimitive();
51}
52
53/* Compute the func offset. */
54static int
55func_offset(Ref<GaussianBasisSet> cs, int off)
56{
57 // unit shells have null cs's
58 if (cs.null()) return off + 1;
59 return off + cs->nbasis();
60}
61
62/////////////////////////////////////////////////////////////////////////
63
64/* This initializes the offset arrays for one electron integrals. */
65void
66Int1eV3::int_initialize_offsets1()
67{
68 int shell_offset1;
69 int prim_offset1;
70 int func_offset1;
71
72 /* Shell offset arrays. */
73 bs1_shell_offset_ = 0;
74 shell_offset1 = shell_offset(bs1_,0);
75 if (bs2_ != bs1_) {
76 shell_offset(bs2_,shell_offset1);
77 bs2_shell_offset_ = shell_offset1;
78 }
79 else {
80 bs2_shell_offset_ = bs1_shell_offset_;
81 }
82
83 /* Prim offset arrays. */
84 bs1_prim_offset_ = 0;
85 prim_offset1 = prim_offset(bs1_,0);
86 if (bs2_ != bs1_) {
87 prim_offset(bs2_,prim_offset1);
88 bs2_prim_offset_ = prim_offset1;
89 }
90 else {
91 bs2_prim_offset_ = bs1_prim_offset_;
92 }
93
94 /* Func offset arrays. */
95 bs1_func_offset_ = 0;
96 func_offset1 = func_offset(bs1_,0);
97 if (bs2_ != bs1_) {
98 func_offset(bs2_,func_offset1);
99 bs2_func_offset_ = func_offset1;
100 }
101 else {
102 bs2_func_offset_ = bs1_func_offset_;
103 }
104 }
105
106/* This is called to free the offsets. */
107void
108Int1eV3::int_done_offsets1()
109{
110}
111
112/* Initialize the offset arrays for two electron integrals. */
113void
114Int2eV3::int_initialize_offsets2()
115{
116 int shell_offset1;
117 int shell_offset2;
118 int shell_offset3;
119 int prim_offset1;
120 int prim_offset2;
121 int prim_offset3;
122 int func_offset1;
123 int func_offset2;
124 int func_offset3;
125
126 /* Shell offset arrays. */
127 bs1_shell_offset_ = 0;
128
129 shell_offset1 = shell_offset(bs1_,0);
130 if (bs2_ == bs1_) {
131 shell_offset2 = shell_offset1;
132 bs2_shell_offset_ = bs1_shell_offset_;
133 }
134 else {
135 shell_offset2 = shell_offset(bs2_,shell_offset1);
136 bs2_shell_offset_ = shell_offset1;
137 }
138
139 if (bs3_ == bs1_) {
140 shell_offset3 = shell_offset2;
141 bs3_shell_offset_ = bs1_shell_offset_;
142 }
143 else if (bs3_ == bs2_) {
144 shell_offset3 = shell_offset2;
145 bs3_shell_offset_ = bs2_shell_offset_;
146 }
147 else {
148 shell_offset3 = shell_offset(bs3_,shell_offset2);
149 bs3_shell_offset_ = shell_offset2;
150 }
151
152 if (bs4_ == bs1_) {
153 bs4_shell_offset_ = bs1_shell_offset_;
154 }
155 else if (bs4_ == bs2_) {
156 bs4_shell_offset_ = bs2_shell_offset_;
157 }
158 else if (bs4_ == bs3_) {
159 bs4_shell_offset_ = bs3_shell_offset_;
160 }
161 else {
162 bs4_shell_offset_ = shell_offset3;
163 }
164
165 /* Prim offset arrays. */
166 bs1_prim_offset_ = 0;
167
168 prim_offset1 = prim_offset(bs1_,0);
169 if (bs2_ == bs1_) {
170 prim_offset2 = prim_offset1;
171 bs2_prim_offset_ = bs1_prim_offset_;
172 }
173 else {
174 prim_offset2 = prim_offset(bs2_,prim_offset1);
175 bs2_prim_offset_ = prim_offset1;
176 }
177
178 if (bs3_ == bs1_) {
179 prim_offset3 = prim_offset2;
180 bs3_prim_offset_ = bs1_prim_offset_;
181 }
182 else if (bs3_ == bs2_) {
183 prim_offset3 = prim_offset2;
184 bs3_prim_offset_ = bs2_prim_offset_;
185 }
186 else {
187 prim_offset3 = prim_offset(bs3_,prim_offset2);
188 bs3_prim_offset_ = prim_offset2;
189 }
190
191 if (bs4_ == bs1_) {
192 bs4_prim_offset_ = bs1_prim_offset_;
193 }
194 else if (bs4_ == bs2_) {
195 bs4_prim_offset_ = bs2_prim_offset_;
196 }
197 else if (bs4_ == bs3_) {
198 bs4_prim_offset_ = bs3_prim_offset_;
199 }
200 else {
201 bs4_prim_offset_ = prim_offset3;
202 }
203
204 /* Func offset arrays. */
205 bs1_func_offset_ = 0;
206
207 func_offset1 = func_offset(bs1_,0);
208 if (bs2_ == bs1_) {
209 func_offset2 = func_offset1;
210 bs2_func_offset_ = bs1_func_offset_;
211 }
212 else {
213 func_offset2 = func_offset(bs2_,func_offset1);
214 bs2_func_offset_ = func_offset1;
215 }
216
217 if (bs3_ == bs1_) {
218 func_offset3 = func_offset2;
219 bs3_func_offset_ = bs1_func_offset_;
220 }
221 else if (bs3_ == bs2_) {
222 func_offset3 = func_offset2;
223 bs3_func_offset_ = bs2_func_offset_;
224 }
225 else {
226 func_offset3 = func_offset(bs3_,func_offset2);
227 bs3_func_offset_ = func_offset2;
228 }
229
230 if (bs4_ == bs1_) {
231 bs4_func_offset_ = bs1_func_offset_;
232 }
233 else if (bs4_ == bs2_) {
234 bs4_func_offset_ = bs2_func_offset_;
235 }
236 else if (bs4_ == bs3_) {
237 bs4_func_offset_ = bs3_func_offset_;
238 }
239 else {
240 bs4_func_offset_ = func_offset3;
241 }
242 }
243
244/* This is called to free the offsets. */
245void
246Int2eV3::int_done_offsets2()
247{
248}
249
250/////////////////////////////////////////////////////////////////////////////
251
252// Local Variables:
253// mode: c++
254// c-file-style: "CLJ"
255// End:
Note: See TracBrowser for help on using the repository browser.