LIBINT 2.9.0
shell.h
1/*
2 * Copyright (C) 2004-2024 Edward F. Valeev
3 *
4 * This file is part of Libint library.
5 *
6 * Libint library is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Libint library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with Libint library. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#ifndef _libint2_src_lib_libint_shell_h_
22#define _libint2_src_lib_libint_shell_h_
23
24#include <libint2/util/cxxstd.h>
25#if LIBINT2_CPLUSPLUS_STD < 2011
26#error "libint2/shell.h requires C++11 support"
27#endif
28
29#include <libint2.h>
30#include <libint2/config.h>
31#include <libint2/util/small_vector.h>
32
33#include <array>
34#include <cassert>
35#include <cmath>
36#include <iostream>
37#include <type_traits>
38#include <vector>
39
40namespace libint2 {
41
42namespace math {
43
45static constexpr std::array<int64_t, 21> fac = {{1LL,
46 1LL,
47 2LL,
48 6LL,
49 24LL,
50 120LL,
51 720LL,
52 5040LL,
53 40320LL,
54 362880LL,
55 3628800LL,
56 39916800LL,
57 479001600LL,
58 6227020800LL,
59 87178291200LL,
60 1307674368000LL,
61 20922789888000LL,
62 355687428096000LL,
63 6402373705728000LL,
64 121645100408832000LL,
65 2432902008176640000LL}};
66
72static constexpr std::array<long double, 171> fac_ld = {
73 {1.l,
74 1.l,
75 2.l,
76 6.l,
77 24.l,
78 120.l,
79 720.l,
80 5040.l,
81 40320.l,
82 362880.l,
83 3.6288e6l,
84 3.99168e7l,
85 4.790016e8l,
86 6.2270208e9l,
87 8.71782912e10l,
88 1.307674368e12l,
89 2.0922789888e13l,
90 3.55687428096e14l,
91 6.402373705728e15l,
92 1.21645100408832e17l,
93 2.43290200817664e18l,
94 5.109094217170944e19l,
95 1.12400072777760768e21l,
96 2.585201673888497664e22l,
97 6.2044840173323943936e23l,
98 1.5511210043330985984e25l,
99 4.03291461126605635584e26l,
100 1.0888869450418352160768e28l,
101 3.04888344611713860501504e29l,
102 8.841761993739701954543616e30l,
103 2.6525285981219105863630848e32l,
104 8.22283865417792281772556288e33l,
105 2.6313083693369353016721801216e35l,
106 8.68331761881188649551819440128e36l,
107 2.9523279903960414084761860964352e38l,
108 1.03331479663861449296666513375232e40l,
109 3.719933267899012174679994481508352e41l,
110 1.37637530912263450463159795815809024e43l,
111 5.23022617466601111760007224100074291e44l,
112 2.03978820811974433586402817399028974e46l,
113 8.15915283247897734345611269596115894e47l,
114 3.34525266131638071081700620534407517e49l,
115 1.40500611775287989854314260624451157e51l,
116 6.04152630633738356373551320685139975e52l,
117 2.65827157478844876804362581101461589e54l,
118 1.19622220865480194561963161495657715e56l,
119 5.50262215981208894985030542880025489e57l,
120 2.5862324151116818064296435515361198e59l,
121 1.2413915592536072670862289047373375e61l,
122 6.08281864034267560872252163321295377e62l,
123 3.04140932017133780436126081660647688e64l,
124 1.55111875328738228022424301646930321e66l,
125 8.0658175170943878571660636856403767e67l,
126 4.27488328406002556429801375338939965e69l,
127 2.30843697339241380472092742683027581e71l,
128 1.2696403353658275925965100847566517e73l,
129 7.1099858780486345185404564746372495e74l,
130 4.05269195048772167556806019054323221e76l,
131 2.35056133128287857182947491051507468e78l,
132 1.38683118545689835737939019720389406e80l,
133 8.32098711274139014427634118322336438e81l,
134 5.07580213877224798800856812176625227e83l,
135 3.14699732603879375256531223549507641e85l,
136 1.98260831540444006411614670836189814e87l,
137 1.26886932185884164103433389335161481e89l,
138 8.24765059208247066672317030678549625e90l,
139 5.44344939077443064003729240247842753e92l,
140 3.64711109181886852882498590966054644e94l,
141 2.48003554243683059960099041856917158e96l,
142 1.71122452428141311372468338881272839e98l,
143 1.19785716699698917960727837216890987e100l,
144 8.5047858856786231752116764423992601e101l,
145 6.12344583768860868615240703852746727e103l,
146 4.47011546151268434089125713812505111e105l,
147 3.30788544151938641225953028221253782e107l,
148 2.48091408113953980919464771165940337e109l,
149 1.88549470166605025498793226086114656e111l,
150 1.45183092028285869634070784086308285e113l,
151 1.13242811782062978314575211587320462e115l,
152 8.94618213078297528685144171539831652e116l,
153 7.15694570462638022948115337231865322e118l,
154 5.79712602074736798587973423157810911e120l,
155 4.75364333701284174842138206989404947e122l,
156 3.94552396972065865118974711801206106e124l,
157 3.31424013456535326699938757913013129e126l,
158 2.81710411438055027694947944226061159e128l,
159 2.42270953836727323817655232034412597e130l,
160 2.1077572983795277172136005186993896e132l,
161 1.85482642257398439114796845645546284e134l,
162 1.65079551609084610812169192624536193e136l,
163 1.48571596448176149730952273362082574e138l,
164 1.35200152767840296255166568759495142e140l,
165 1.24384140546413072554753243258735531e142l,
166 1.15677250708164157475920516230624044e144l,
167 1.08736615665674308027365285256786601e146l,
168 1.03299784882390592625997020993947271e148l,
169 9.91677934870949689209571401541893801e149l,
170 9.61927596824821198533284259495636987e151l,
171 9.42689044888324774562618574305724247e153l,
172 9.33262154439441526816992388562667005e155l,
173 9.33262154439441526816992388562667005e157l,
174 9.42594775983835942085162312448293675e159l,
175 9.61446671503512660926865558697259548e161l,
176 9.90290071648618040754671525458177335e163l,
177 1.02990167451456276238485838647650443e166l,
178 1.08139675824029090050410130580032965e168l,
179 1.14628056373470835453434738414834943e170l,
180 1.22652020319613793935175170103873389e172l,
181 1.3246418194518289744998918371218326e174l,
182 1.44385958320249358220488210246279753e176l,
183 1.58824554152274294042537031270907729e178l,
184 1.76295255109024466387216104710707579e180l,
185 1.97450685722107402353682037275992488e182l,
186 2.23119274865981364659660702121871512e184l,
187 2.54355973347218755712013200418933523e186l,
188 2.92509369349301569068815180481773552e188l,
189 3.3931086844518982011982560935885732e190l,
190 3.96993716080872089540195962949863065e192l,
191 4.68452584975429065657431236280838416e194l,
192 5.57458576120760588132343171174197716e196l,
193 6.68950291344912705758811805409037259e198l,
194 8.09429852527344373968162284544935083e200l,
195 9.87504420083360136241157987144820801e202l,
196 1.21463043670253296757662432418812959e205l,
197 1.50614174151114087979501416199328069e207l,
198 1.88267717688892609974376770249160086e209l,
199 2.37217324288004688567714730513941708e211l,
200 3.01266001845765954480997707752705969e213l,
201 3.85620482362580421735677065923463641e215l,
202 4.97450422247728744039023415041268096e217l,
203 6.46685548922047367250730439553648525e219l,
204 8.47158069087882051098456875815279568e221l,
205 1.11824865119600430744996307607616903e224l,
206 1.48727070609068572890845089118130481e226l,
207 1.99294274616151887673732419418294845e228l,
208 2.6904727073180504835953876621469804e230l,
209 3.65904288195254865768972722051989335e232l,
210 5.01288874827499166103492629211225388e234l,
211 6.91778647261948849222819828311491036e236l,
212 9.6157231969410890041971956135297254e238l,
213 1.34620124757175246058760738589416156e241l,
214 1.89814375907617096942852641411076779e243l,
215 2.69536413788816277658850750803729027e245l,
216 3.85437071718007277052156573649332508e247l,
217 5.55029383273930478955105466055038812e249l,
218 8.04792605747199194484902925779806277e251l,
219 1.17499720439091082394795827163851716e254l,
220 1.72724589045463891120349865930862023e256l,
221 2.55632391787286558858117801577675794e258l,
222 3.80892263763056972698595524350736934e260l,
223 5.713383956445854590478932865261054e262l,
224 8.62720977423324043162318862654419154e264l,
225 1.31133588568345254560672467123471711e267l,
226 2.00634390509568239477828874698911719e269l,
227 3.08976961384735088795856467036324047e271l,
228 4.78914290146339387633577523906302272e273l,
229 7.47106292628289444708380937293831545e275l,
230 1.17295687942641442819215807155131553e278l,
231 1.85327186949373479654360975305107853e280l,
232 2.94670227249503832650433950735121486e282l,
233 4.71472363599206132240694321176194378e284l,
234 7.59070505394721872907517857093672949e286l,
235 1.22969421873944943411017892849175018e289l,
236 2.00440157654530257759959165344155279e291l,
237 3.28721858553429622726333031164414657e293l,
238 5.42391066613158877498449501421284184e295l,
239 9.00369170577843736647426172359331746e297l,
240 1.50361651486499904020120170784008402e300l,
241 2.52607574497319838753801886917134115e302l,
242 4.26906800900470527493925188889956654e304l,
243 7.25741561530799896739672821112926311e306l}};
244
246
250template <typename Int, typename = typename std::enable_if<
251 std::is_integral<Int>::value>::type>
252constexpr int64_t fac_int(Int k) {
253#if LIBINT2_CPLUSPLUS_STD >= 2014
254 assert(!std::is_signed<Int>::value || k >= 0);
255 assert(k < fac.size());
256#endif
257 return fac[k];
258}
259
261
265template <
266 typename Real, typename Int,
267 typename = typename std::enable_if<std::is_integral<Int>::value>::type>
268constexpr Real fac_real(Int k) {
269#if LIBINT2_CPLUSPLUS_STD >= 2014
270 assert(!std::is_signed<Int>::value || k >= 0);
271 assert(k < fac.size() || k < fac_ld.size());
272 // for extended-precision types should do better ...
273 assert(k < fac.size() || (std::is_same<Real, double>::value ||
274 std::is_same<Real, long double>::value));
275#endif
276
277 // use exact representation when available
278 return (k < fac.size()) ? static_cast<Real>(fac[k])
279 : static_cast<Real>(fac_ld[k]);
280}
281
283static constexpr std::array<int64_t, 35> df_Kminus1 = {{1LL,
284 1LL,
285 1LL,
286 2LL,
287 3LL,
288 8LL,
289 15LL,
290 48LL,
291 105LL,
292 384LL,
293 945LL,
294 3840LL,
295 10395LL,
296 46080LL,
297 135135LL,
298 645120LL,
299 2027025LL,
300 10321920LL,
301 34459425LL,
302 185794560LL,
303 654729075LL,
304 3715891200LL,
305 13749310575LL,
306 81749606400LL,
307 316234143225LL,
308 1961990553600LL,
309 7905853580625LL,
310 51011754393600LL,
311 213458046676875LL,
312 1428329123020800LL,
313 6190283353629375LL,
314 42849873690624000LL,
315 191898783962510625LL,
316 1371195958099968000LL,
317 6332659870762850625LL}};
318
324static constexpr std::array<long double, 302> df_Kminus1_ld = {
325 {1.l,
326 1.l,
327 1.l,
328 2.l,
329 3.l,
330 8.l,
331 15.l,
332 48.l,
333 105.l,
334 384.l,
335 945.l,
336 3840.l,
337 10395.l,
338 46080.l,
339 135135.l,
340 645120.l,
341 2.027025e6l,
342 1.032192e7l,
343 3.4459425e7l,
344 1.8579456e8l,
345 6.54729075e8l,
346 3.7158912e9l,
347 1.3749310575e10l,
348 8.17496064e10l,
349 3.16234143225e11l,
350 1.9619905536e12l,
351 7.905853580625e12l,
352 5.10117543936e13l,
353 2.13458046676875e14l,
354 1.4283291230208e15l,
355 6.190283353629375e15l,
356 4.2849873690624e16l,
357 1.91898783962510625e17l,
358 1.371195958099968e18l,
359 6.332659870762850625e18l,
360 4.6620662575398912e19l,
361 2.21643095476699771875e20l,
362 1.678343852714360832e21l,
363 8.200794532637891559375e21l,
364 6.3777066403145711616e22l,
365 3.19830986772877770815625e23l,
366 2.55108265612582846464e24l,
367 1.3113070457687988603440625e25l,
368 1.0714547155728479551488e26l,
369 5.63862029680583509947946875e26l,
370 4.71440074852053100265472e27l,
371 2.5373791335626257947657609375e28l,
372 2.1686243443194442612211712e29l,
373 1.192568192774434123539907640625e30l,
374 1.040939685273333245386162176e31l,
375 5.8435841445947272053455474390625e31l,
376 5.20469842636666622693081088e32l,
377 2.980227913743310874726229193921875e33l,
378 2.7064431817106664380040216576e34l,
379 1.57952079428395476360490147277859375e35l,
380 1.461479318123759876522171695104e36l,
381 8.68736436856175119982695810028226562e36l,
382 8.1842841814930553085241614925824e37l,
383 4.95179769008019818390136611716089141e38l,
384 4.746884825265972078944013665697792e39l,
385 2.92156063714731692850180600912492593e40l,
386 2.8481308951595832473664081994186752e41l,
387 1.78215198865986332638610166556620482e42l,
388 1.76584115499894161336717308363957862e43l,
389 1.12275575285571389562324404930670903e44l,
390 1.13013833919932263255499077352933032e45l,
391 7.29791239356214032155108632049360873e45l,
392 7.45891303871552937486293910529358011e46l,
393 4.88960130368663401543922783473071785e47l,
394 5.07206086632655997490679859159963447e48l,
395 3.37382489954377747065306720596419531e49l,
396 3.55044260642859198243475901411974413e50l,
397 2.39541567867608200416367771623457867e51l,
398 2.55631867662858622735302649016621577e52l,
399 1.74865344543353986303948473285124243e53l,
400 1.89167582070515380824123960272299967e54l,
401 1.31149008407515489727961354963843182e55l,
402 1.43767362373591689426334209806947975e56l,
403 1.0098473647378692709053024332215925e57l,
404 1.12138542651401517752540683649419421e58l,
405 7.97779418142916724015188922245058078e58l,
406 8.97108341211212142020325469195355365e59l,
407 6.46201328695762546452303027018497043e60l,
408 7.35628839793193956456666884740191399e61l,
409 5.36347102817482913555411512425352546e62l,
410 6.17928225426282923423600183181760775e63l,
411 4.55895037394860476522099785561549664e64l,
412 5.31418273866603314144296157536314267e65l,
413 3.96628682533528614574226813438548208e66l,
414 4.67648081002610916446980618631956555e67l,
415 3.52999527454840466971061863960307905e68l,
416 4.20883272902349824802282556768760899e69l,
417 3.21229569983904824943666296203880193e70l,
418 3.87212611070161838818099952227260027e71l,
419 2.9874350008503148719760965546960858e72l,
420 3.63979854405952128489013955093624426e73l,
421 2.83806325080779912837729172696128151e74l,
422 3.49420660229714043349453396889879449e75l,
423 2.75292135328356515452597297515244306e76l,
424 3.4243224702511976248246432895208186e77l,
425 2.72539213975072950298071324540091863e78l,
426 3.4243224702511976248246432895208186e79l,
427 2.75264606114823679801052037785492782e80l,
428 3.49280891965622157732113615531123497e81l,
429 2.83522544298268390195083598919057565e82l,
430 3.63252127644247044041398160152368437e83l,
431 2.97698671513181809704837778865010444e84l,
432 3.85047255302901866683882049761510543e85l,
433 3.18537578519104536384176423385561175e86l,
434 4.15851035727134016018592613742431386e87l,
435 3.4720596058582394465875230149026168e88l,
436 4.57436139299847417620451875116674525e89l,
437 3.85398616250264578571215054654190465e90l,
438 5.12328476015829107734906100130675468e91l,
439 4.35500436362798973785473011759235226e92l,
440 5.84054462658045182817792954148970034e93l,
441 5.0082550181721881985329396352312051e94l,
442 6.77503176683332412068639826812805239e95l,
443 5.85965837126146019228353937322050996e96l,
444 7.99453748486332246240994995639110182e97l,
445 6.97299346180113762881741185413240686e98l,
446 9.59344498183598695489193994766932219e99l,
447 8.4373220887793765308690683435002123e100l,
448 1.17040028778399040849681667361565731e102l,
449 1.03779061691986331329689540625052611e103l,
450 1.45129635685214810653605267528341506e104l,
451 1.29723827114982914162111925781315764e105l,
452 1.82863340963370661423542637085710298e106l,
453 1.6474926043602830098588214574227102e107l,
454 2.34065076433114446622134575469709181e108l,
455 2.12526545962476508271787968007529616e109l,
456 3.04284599363048780608774948110621935e110l,
457 2.78409775210844225836042238089863797e111l,
458 4.01655671159224390403582931506020954e112l,
459 3.7028500103042282036193617665951885e113l,
460 5.38218599353360683140801128218068079e114l,
461 4.99884751391070807488613838490350448e115l,
462 7.31977295120570529071489534376572587e116l,
463 6.84842109405767006259400958731780114e117l,
464 1.01012866726638733011865555743967017e119l,
465 9.51930532074016138700567332637174358e119l,
466 1.41418013417294226216611778041553824e121l,
467 1.34222205022436275556779993901841585e122l,
468 2.0081357905255780122758872481900643e123l,
469 1.91937753182083874046195391279633466e124l,
470 2.89171553835683233767727763739369259e125l,
471 2.78309742114021617366983317355468525e126l,
472 4.22190468600097521300882535059479118e127l,
473 4.09115320907611777529465476512538732e128l,
474 6.24841893528144331525306151888029095e129l,
475 6.09581828152341548518903560003682711e130l,
476 9.37262840292216497287959227832043642e131l,
477 9.20468560510035738263544375605560894e132l,
478 1.42463951724416907587769802630470634e134l,
479 1.40831689758035467954322289467650817e135l,
480 2.19394485655602037685165496050924776e136l,
481 2.18289119124954975329199548674858766e137l,
482 3.4225539762273917878885817383944265e138l,
483 3.42713917026179311266843291419528263e139l,
484 5.40763528243927902486395914666319387e140l,
485 5.44915128071625104914280833357049938e141l,
486 8.6522164519028464397823346346611102e142l,
487 8.773133561953164189119921417048504e143l,
488 1.40165906520826112324473821081509985e145l,
489 1.43002077059836576282654719097890615e146l,
490 2.29872086694154824212137066573676376e147l,
491 2.35953427148730350866380286511519515e148l,
492 3.81587663912297008192147530512302784e149l,
493 3.9404222333837968594685507847423759e150l,
494 6.41067275372658973762807851260668677e151l,
495 6.65931357441861669250185082621461527e152l,
496 1.08981436813352025539677334714313675e154l,
497 1.13874262122558345441781649128269921e155l,
498 1.87448071318965483928245015708619521e156l,
499 1.97002473472025937614282252991906964e157l,
500 3.26159644094999942035146327332997967e158l,
501 3.44754328576045390824993942735837186e159l,
502 5.74040973607199897981857536106076421e160l,
503 6.1021516157960034176023927864243182e161l,
504 1.02179293302081581840770641426881603e163l,
505 1.09228513922748461175082830876995296e164l,
506 1.83922727943746847313387154568386885e165l,
507 1.97703610200174714726899923887361485e166l,
508 3.34739364857619262110364621314464131e167l,
509 3.61797606666319727950226860713871518e168l,
510 6.15920431338019442283070903218614002e169l,
511 6.69325572332691496707919692320662308e170l,
512 1.14561200228871616264651187998662204e172l,
513 1.25163882026213309884380982463963852e173l,
514 2.15375056430278638577544233437484944e174l,
515 2.3655973702954315568148005685689168e175l,
516 4.09212607217529413297334043531221394e176l,
517 4.51829097726427427351626908596663108e177l,
518 7.85688205857656473530881363579945076e178l,
519 8.72030158612004934788639933591559799e179l,
520 1.52423511936385355864990984534509345e181l,
521 1.70045880929340962283784787050354161e182l,
522 2.98750083395315297495382329687638316e183l,
523 3.34990385430801695699056030489197697e184l,
524 5.91525165122724289040857012781523865e185l,
525 6.66630867007295374441121500673503416e186l,
526 1.18305033024544857808171402556304773e188l,
527 1.33992804268466370262665421635374187e189l,
528 2.38976166709580612772506233163735642e190l,
529 2.72005392664986731633210805919809599e191l,
530 4.87511380087544450055912715654020709e192l,
531 5.57611054963222799848082152135609678e193l,
532 1.00427344298034156711518019424728266e195l,
533 1.15425488377387119568553005492071203e196l,
534 2.08888876139911045959957480403434793e197l,
535 2.41239270708739079898275781478428815e198l,
536 4.38666639893813196515910708847213066e199l,
537 5.090148611954394585853618989194848e200l,
538 9.299732765748839766137307027560917e201l,
539 1.08420165434628604678682084469850262e203l,
540 1.99014281187025170995338370389803624e204l,
541 2.33103355684451500059166481610178064e205l,
542 4.29870847363974369349930880041975827e206l,
543 5.05834281835259755128391265094086399e207l,
544 9.37118447253464125182849318491507304e208l,
545 1.10777707721921886373117687055604921e210l,
546 2.06166058395762107540226850068131607e211l,
547 2.44818734065447368884590088392886876e212l,
548 4.57688649638591878739303607151252167e213l,
549 5.45945776965947632612635897116137734e214l,
550 1.02522257519044580837604008001880485e216l,
551 1.2283779981733821733784307685113099e217l,
552 2.31700301993040752692985058084249897e218l,
553 2.78841805585357753356903784452067348e219l,
554 5.28276688544132916140005932432089765e220l,
555 6.38547734790469255187309666395234226e221l,
556 1.21503638365150570712201364459380646e223l,
557 1.47504526736598397948268532937299106e224l,
558 2.81888441007149324052307165545763099e225l,
559 3.43685547296274267219465681743906917e226l,
560 6.59618951956729418282398767377085651e227l,
561 8.07661036146244527965744352098181256e228l,
562 1.55670072661788142714646109100992214e230l,
563 1.91415665566659953127881411447268958e231l,
564 3.70494772935055779660857739660361469e232l,
565 4.57483440704317287975636573358972809e233l,
566 8.89187455044133871186058575184867524e234l,
567 1.10253509209740466402128414179512447e236l,
568 2.15183364120680396827026175194737941e237l,
569 2.67916027379669333357172046456215246e238l,
570 5.25047408454460168257943867475160576e239l,
571 6.56394267080189866725071513817727353e240l,
572 1.29161662479797201391454191398889502e242l,
573 1.62129383968806897081092663912978656e243l,
574 3.20320922949897059450806394669245964e244l,
575 4.03702166082329173731920733143316854e245l,
576 8.0080230737474264862701598667311491e246l,
577 1.0132924368666462260671210401897253e248l,
578 2.01802181458435147454008028641624957e249l,
579 2.56362986527261495194981623168000502e250l,
580 5.12577540904425274533180392749727392e251l,
581 6.53725615644516812747203139078401279e252l,
582 1.31219850471532870280494180543930212e254l,
583 1.68007483220640820876031206743149129e255l,
584 3.38547214216554805323674985803339948e256l,
585 4.35139381541459726068920825464756243e257l,
586 8.80222756963042493841554963088683864e258l,
587 1.1357137858232098850398833544630138e260l,
588 2.30618362324317133386487400329235172e261l,
589 2.98692725671504199765489322223772628e262l,
590 6.08832476536197232140326736869180855e263l,
591 7.91535723029486129378546703892997465e264l,
592 1.61949438758628463749326912007202107e266l,
593 2.11340038048872796544071969939430323e267l,
594 4.34024495873124282848196124179301648e268l,
595 5.68504702351467822703553599137067569e269l,
596 1.17186613885743556369012953528411445e271l,
597 1.54064774337247779952663025366145311e272l,
598 3.1874758976922247332371523359727913e273l,
599 4.205968339406864392707700592495767e274l,
600 8.73368395967669576906979740056544817e275l,
601 1.15664129333688770799461766293633592e277l,
602 2.41049677287076803226326408255606369e278l,
603 3.20389638254317895114509092633365051e279l,
604 6.70118102858073512969187414950585707e280l,
605 8.93887090729546927369480368447088492e281l,
606 1.87633068800260583631372476186163998e283l,
607 2.51182272495002686590823983533631866e284l,
608 5.29125254016734845840470382844982474e285l,
609 7.10845831160857603052031873400178182e286l,
610 1.50271572140752696218693588727975023e288l,
611 2.02591061880844416869829083919050782e289l,
612 4.29776696322552711185463663762008565e290l,
613 5.81436347598023476416409470847675744e291l,
614 1.23775688540895180821413535163458467e293l,
615 1.6803510445582878468434233707497829e294l,
616 3.58949496768596024382099251974029553e295l,
617 4.88982153966461763431436200888186824e296l,
618 1.0481325305643003911957298157641663e298l,
619 1.43271771112173296685410806860238739e299l,
620 3.08150963985904315011544565834664891e300l,
621 4.22651724780911225221961880237704281e301l,
622 9.12126853398276772434171914870608078e302l,
623 1.25527562259930633890922678430598171e304l,
624 2.71813802312686478185383230631441207e305l,
625 3.75327411157192595333858808507488533e306l,
626 8.15441406938059434556149691894323621e307l}};
627
629
633template <typename Int, typename = typename std::enable_if<
634 std::is_integral<Int>::value>::type>
635constexpr int64_t df_Kminus1_int(Int k) {
636#if LIBINT2_CPLUSPLUS_STD >= 2014
637 assert(!std::is_signed<Int>::value || k >= 0);
638 assert(k < df_Kminus1.size());
639#endif
640 return df_Kminus1[k];
641}
642
644
649template <
650 typename Real, typename Int,
651 typename = typename std::enable_if<std::is_integral<Int>::value>::type>
652constexpr Real df_Kminus1_real(Int k) {
653#if LIBINT2_CPLUSPLUS_STD >= 2014
654 assert(!std::is_signed<Int>::value || k >= 0);
655 assert(k < df_Kminus1.size() || k < df_Kminus1_ld.size());
656 // for extended-precision types should do better ...
657 assert(k < df_Kminus1.size() || (std::is_same<Real, double>::value ||
658 std::is_same<Real, long double>::value));
659#endif
660 // use exact representation when available
661 return (k < df_Kminus1.size()) ? static_cast<Real>(df_Kminus1[k])
662 : static_cast<Real>(df_Kminus1_ld[k]);
663}
664
666
671template <typename Int, typename = typename std::enable_if<
672 std::is_integral<Int>::value>::type>
673constexpr int64_t bc_int(Int i, Int j) {
674#if LIBINT2_CPLUSPLUS_STD >= 2014
675 assert(i >= j);
676#endif
677 return fac_int(i) / (fac_int(j) * fac_int(i - j));
678}
679
681
687template <
688 typename Real, typename Int,
689 typename = typename std::enable_if<std::is_integral<Int>::value>::type>
690constexpr Real bc_real(Int i, Int j) {
691#if LIBINT2_CPLUSPLUS_STD >= 2014
692 assert(!std::is_signed<Int>::value || (i >= 0 && j >= 0));
693 assert(i >= j);
694#endif
695 return fac_real<Real>(i) / (fac_real<Real>(j) * fac_real<Real>(i - j));
696}
697
698} // namespace math
699
701
720struct Shell {
721 typedef double real_t;
722
725 struct Contraction {
726 int l;
727 bool pure;
728 svector<real_t> coeff;
729
730 bool operator==(const Contraction& other) const {
731 return &other == this ||
732 (l == other.l && pure == other.pure && coeff == other.coeff);
733 }
734 bool operator!=(const Contraction& other) const {
735 return not this->operator==(other);
736 }
737 size_t cartesian_size() const { return (l + 1) * (l + 2) / 2; }
738 size_t size() const { return pure ? (2 * l + 1) : cartesian_size(); }
739 };
740
741 svector<real_t> alpha;
742 svector<Contraction> contr;
743 std::array<real_t, 3> O;
744 svector<real_t> max_ln_coeff;
746
747 Shell() = default;
748 Shell(const Shell&) = default;
749 // intel does not support "move ctor = default"
750 Shell(Shell&& other) noexcept
751 : alpha(std::move(other.alpha)),
752 contr(std::move(other.contr)),
753 O(std::move(other.O)),
754 max_ln_coeff(std::move(other.max_ln_coeff)) {}
755 Shell& operator=(const Shell&) = default;
756 // intel does not support "move asgnmt = default"
757 Shell& operator=(Shell&& other) noexcept {
758 alpha = std::move(other.alpha);
759 contr = std::move(other.contr);
760 O = std::move(other.O);
761 max_ln_coeff = std::move(other.max_ln_coeff);
762 return *this;
763 }
767 Shell(svector<real_t> _alpha, svector<Contraction> _contr,
768 std::array<real_t, 3> _O,
769 bool embed_normalization_into_coefficients = true)
770 : alpha(std::move(_alpha)), contr(std::move(_contr)), O(std::move(_O)) {
771 // embed normalization factors into contraction coefficients
772 if (embed_normalization_into_coefficients)
773 renorm();
774 else {
775 update_max_ln_coeff();
776 }
777 }
778
779 Shell& move(std::array<real_t, 3> new_origin) {
780 O = std::move(new_origin);
781 return *this;
782 }
783
784 size_t cartesian_size() const {
785 size_t s = 0;
786 for (const auto& c : contr) {
787 s += c.cartesian_size();
788 }
789 return s;
790 }
791 size_t size() const {
792 size_t s = 0;
793 for (const auto& c : contr) {
794 s += c.size();
795 }
796 return s;
797 }
798
799 size_t ncontr() const { return contr.size(); }
800 size_t nprim() const { return alpha.size(); }
801
802 bool operator==(const Shell& other) const {
803 return &other == this ||
804 (O == other.O && alpha == other.alpha && contr == other.contr);
805 }
806 bool operator!=(const Shell& other) const {
807 return not this->operator==(other);
808 }
809
814 static char am_symbol(size_t l) {
815 assert(l <= sizeof(LIBINT_AM2SYMBOL) - 1);
816 static char lsymb[] = LIBINT_AM2SYMBOL;
817 return lsymb[l];
818 }
819
827 static unsigned short am_symbol_to_l(char am_symbol) {
828 const char AM_SYMBOL = ::toupper(am_symbol);
829 switch (AM_SYMBOL) {
830 case 'S':
831 return 0;
832 case 'P':
833 return 1;
834 case 'D':
835 return 2;
836 case 'F':
837 return 3;
838 case 'G':
839 return 4;
840 case 'H':
841 return 5;
842 case 'I':
843 return 6;
844 case 'K':
845 return 7;
846 case 'L':
847 return 8;
848 case 'M':
849 return 9;
850 case 'N':
851 return 10;
852 case 'O':
853 return 11;
854 case 'Q':
855 return 12;
856 case 'R':
857 return 13;
858 case 'T':
859 return 14;
860 case 'U':
861 return 15;
862 case 'V':
863 return 16;
864 case 'W':
865 return 17;
866 case 'X':
867 return 18;
868 case 'Y':
869 return 19;
870 case 'Z':
871 return 20;
872 default:
873 throw std::invalid_argument{"invalid angular momentum label"};
874 }
875 }
876
878 typedef enum { false_value = 0, true_value = 1, default_value = 2 } value_t;
879 defaultable_boolean() : value_(default_value) {}
880 defaultable_boolean(bool v) : value_(static_cast<value_t>(v ? 1 : 0)) {}
881 bool is_default() const { return value_ == default_value; }
882 operator bool() const {
883 assert(value_ != default_value);
884 return value_ == true_value;
885 }
886
887 private:
888 value_t value_;
889 };
890
897 static bool result{true};
898 if (not flag.is_default()) {
899 result = flag;
900 }
901 return result;
902 }
903
906 static const Shell& unit() {
907 static const Shell unitshell{make_unit()};
908 return unitshell;
909 }
910
915 real_t coeff_normalized(size_t c, size_t p) const {
916 const auto alpha = this->alpha.at(p);
917 assert(alpha >= 0.0);
918 const auto l = contr.at(c).l;
919
920 using libint2::math::df_Kminus1_real;
921 const auto sqrt_Pi_cubed = real_t{5.56832799683170784528481798212};
922 const auto two_alpha = 2 * alpha;
923 const auto two_alpha_to_am32 = pow(two_alpha, l + 1) * sqrt(two_alpha);
924 const auto one_over_N =
925 sqrt((sqrt_Pi_cubed * df_Kminus1_real<real_t>(2 * l)) /
926 (pow(2, l) * two_alpha_to_am32));
927 return contr.at(c).coeff[p] * one_over_N;
928 }
929
931
936 Shell extract_primitive(size_t p, bool unit_normalized = true) const {
937 assert(p < nprim());
938 svector<Contraction> prim_contr;
939 prim_contr.reserve(ncontr());
940 for (auto&& c : contr) {
941 prim_contr.emplace_back(Contraction{c.l, c.pure, {1.}});
942 }
943 return Shell({alpha[p]}, prim_contr, O, unit_normalized);
944 }
945
946 private:
947 // this makes a unit shell
948 struct make_unit {};
949 Shell(make_unit)
950 : alpha{0.0}, // exponent = 0
951 contr{{0, false, {1}}}, // contraction coefficient = 1
952 O{{0, 0, 0}}, // placed at origin
953 max_ln_coeff{0} {}
954
958 void renorm() {
959 using libint2::math::df_Kminus1_real;
960 using std::pow;
961 const auto sqrt_Pi_cubed = real_t{5.56832799683170784528481798212};
962 const auto np = nprim();
963 for (auto& c : contr) {
964 for (auto p = 0ul; p != np; ++p) {
965 assert(alpha[p] >= 0);
966 if (alpha[p] != 0) {
967 const auto two_alpha = 2 * alpha[p];
968 const auto two_alpha_to_am32 =
969 pow(two_alpha, c.l + 1) * sqrt(two_alpha);
970 const auto normalization_factor =
971 sqrt(pow(2, c.l) * two_alpha_to_am32 /
972 (sqrt_Pi_cubed * df_Kminus1_real<real_t>(2 * c.l)));
973
974 c.coeff[p] *= normalization_factor;
975 }
976 }
977
978 // need to force normalization to unity?
979 if (do_enforce_unit_normalization()) {
980 // compute the self-overlap of the , scale coefficients by its inverse
981 // square root
982 double norm{0};
983 for (auto p = 0ul; p != np; ++p) {
984 for (decltype(p) q = 0ul; q <= p; ++q) {
985 auto gamma = alpha[p] + alpha[q];
986 norm += (p == q ? 1 : 2) * df_Kminus1_real<real_t>(2 * c.l) *
987 sqrt_Pi_cubed * c.coeff[p] * c.coeff[q] /
988 (pow(2, c.l) * pow(gamma, c.l + 1) * sqrt(gamma));
989 }
990 }
991 auto normalization_factor = 1 / sqrt(norm);
992 for (auto p = 0ul; p != np; ++p) {
993 c.coeff[p] *= normalization_factor;
994 }
995 }
996 }
997
998 update_max_ln_coeff();
999 }
1000
1001 void update_max_ln_coeff() {
1002 // update max log coefficients
1003 max_ln_coeff.resize(nprim());
1004 for (auto p = 0ul; p != nprim(); ++p) {
1005 real_t max_ln_c = -std::numeric_limits<real_t>::max();
1006 for (auto& c : contr) {
1007 max_ln_c = std::max(max_ln_c, std::log(std::abs(c.coeff[p])));
1008 }
1009 max_ln_coeff[p] = max_ln_c;
1010 }
1011 }
1012};
1013
1014inline std::ostream& operator<<(std::ostream& os, const Shell& sh) {
1015 os << "Shell:( O={" << sh.O[0] << "," << sh.O[1] << "," << sh.O[2] << "}"
1016 << std::endl;
1017 os << " ";
1018 for (const auto& c : sh.contr) {
1019 os << " {l=" << c.l << ",sph=" << c.pure << "}";
1020 }
1021 os << std::endl;
1022
1023 for (auto i = 0ul; i < sh.alpha.size(); ++i) {
1024 os << " " << sh.alpha[i];
1025 for (const auto& c : sh.contr) {
1026 os << " " << c.coeff.at(i);
1027 }
1028 os << std::endl;
1029 }
1030
1031 return os;
1032}
1033
1034// clang-format off
1041 enum class ScreeningMethod {
1045 Original = 0x0001,
1049 Conservative = 0x0010,
1053 Schwarz = 0x0100,
1057 SchwarzInf = 0x1000,
1058 Invalid = 0x0000
1059 };
1060// clang-format on
1061
1062namespace detail {
1063inline ScreeningMethod& default_screening_method_accessor() {
1064 static ScreeningMethod default_screening_method = ScreeningMethod::Original;
1065 return default_screening_method;
1066}
1067} // namespace detail
1068
1069inline ScreeningMethod default_screening_method() {
1070 return detail::default_screening_method_accessor();
1071}
1072
1073inline void default_screening_method(ScreeningMethod screening_method) {
1074 detail::default_screening_method_accessor() = screening_method;
1075}
1076
1080 typedef Shell::real_t real_t;
1081
1082 // clang-format off
1085 real_t P[3];
1086 real_t K;
1089 real_t ln_scr;
1090 int p1;
1091 int p2;
1092 };
1093 // clang-format on
1094
1095 std::vector<PrimPairData> primpairs;
1096 real_t AB[3];
1097 real_t ln_prec = std::numeric_limits<real_t>::lowest();
1098 ScreeningMethod screening_method_ = ScreeningMethod::Invalid;
1099
1100 ShellPair() : primpairs() {
1101 for (int i = 0; i != 3; ++i) AB[i] = 0.;
1102 }
1103
1104 ShellPair(size_t max_nprim) : primpairs() {
1105 primpairs.reserve(max_nprim * max_nprim);
1106 for (int i = 0; i != 3; ++i) AB[i] = 0.;
1107 }
1108 template <typename Real>
1109 ShellPair(const Shell& s1, const Shell& s2, Real ln_prec,
1110 ScreeningMethod screening_method = default_screening_method()) {
1111 init(s1, s2, ln_prec, screening_method);
1112 }
1113 template <typename Real, typename SchwarzFactorEvaluator>
1114 ShellPair(const Shell& s1, const Shell& s2, Real ln_prec,
1115 ScreeningMethod screening_method,
1116 SchwarzFactorEvaluator&& schwarz_factor_evaluator) {
1117 init(s1, s2, ln_prec, screening_method,
1118 std::forward<SchwarzFactorEvaluator>(schwarz_factor_evaluator));
1119 }
1120
1123 void reset() {
1124 primpairs.clear();
1125 for (int i = 0; i != 3; ++i) AB[i] = 0.;
1126 ln_prec = std::numeric_limits<real_t>::lowest();
1127 screening_method_ = ScreeningMethod::Invalid;
1128 }
1129
1130 void resize(std::size_t max_nprim) {
1131 const auto max_nprim2 = max_nprim * max_nprim;
1132 if (max_nprim * max_nprim > primpairs.size()) primpairs.resize(max_nprim2);
1133 }
1134
1137 template <typename Real>
1138 void init(const Shell& s1, const Shell& s2, Real ln_prec,
1139 ScreeningMethod screening_method = ScreeningMethod::Original) {
1140 assert(screening_method == ScreeningMethod::Original ||
1141 screening_method == ScreeningMethod::Conservative);
1142
1143 using std::log;
1144
1145 primpairs.clear();
1146
1147 const auto& A = s1.O;
1148 const auto& B = s2.O;
1149 real_t AB2 = 0.;
1150 for (int i = 0; i != 3; ++i) {
1151 AB[i] = A[i] - B[i];
1152 AB2 += AB[i] * AB[i];
1153 }
1154
1155 auto max_l = [](const Shell& s) {
1156 using std::begin;
1157 using std::end;
1158 return std::max_element(
1159 begin(s.contr), end(s.contr),
1160 [](const Shell::Contraction& c1,
1161 const Shell::Contraction& c2) { return c1.l < c2.l; })
1162 ->l;
1163 };
1164 const auto max_l1 = max_l(s1);
1165 const auto max_l2 = max_l(s2);
1166
1167 const auto nprim1 = s1.alpha.size();
1168 const auto nprim2 = s2.alpha.size();
1169 size_t c = 0;
1170 for (size_t p1 = 0; p1 != nprim1; ++p1) {
1171 for (size_t p2 = 0; p2 != nprim2; ++p2) {
1172 const auto& a1 = s1.alpha[p1];
1173 const auto& a2 = s2.alpha[p2];
1174 const auto gamma = a1 + a2;
1175 const auto oogamma = 1 / gamma;
1176
1177 const auto rho = a1 * a2 * oogamma;
1178 const auto minus_rho_times_AB2 = -rho * AB2;
1179 real_t ln_screen_fac =
1180 minus_rho_times_AB2 + s1.max_ln_coeff[p1] + s2.max_ln_coeff[p2];
1181 if (screening_method == ScreeningMethod::Original &&
1182 ln_screen_fac < ln_prec)
1183 continue;
1184
1185 real_t P[3];
1186 if (AB2 == 0.) { // this buys a bit more precision
1187 P[0] = A[0];
1188 P[1] = A[1];
1189 P[2] = A[2];
1190 } else {
1191 P[0] = (a1 * A[0] + a2 * B[0]) * oogamma;
1192 P[1] = (a1 * A[1] + a2 * B[1]) * oogamma;
1193 P[2] = (a1 * A[2] + a2 * B[2]) * oogamma;
1194 }
1195
1196 // conservative screening:
1197 // - partitions the error among all primitive pairs (use \epsilon /
1198 // nprim to screen, instead of \epsilon itself), and
1199 // - accounts for the proper spherical gaussian prefactor in the
1200 // integrals (namely, adds extra \sqrt{2 \pi^{52}}/\gamma_{ab} factor)
1201 // - accounts for the nonspherical gaussians ... namely
1202 // magnitude of primitive (ab|00) integral for nonzero L differs from
1203 // that of (00|00) by the magnitude of:
1204 // - (max_i|PA_i|)^La (max_i|PB_i|)^Lb when A-B separation is large,
1205 // or
1206 // - La! Lb! / gammap^(La+Lb) when the separation is small
1207 real_t nonspherical_scr_factor = 0;
1208 if (screening_method == ScreeningMethod::Conservative) {
1209 const auto maxabs_PA_i_to_l1 = std::pow(
1210 std::max(std::max(std::abs(P[0] - A[0]), std::abs(P[1] - A[1])),
1211 std::abs(P[2] - A[2])),
1212 max_l1);
1213 const auto maxabs_PB_i_to_l2 = std::pow(
1214 std::max(std::max(std::abs(P[0] - B[0]), std::abs(P[1] - B[1])),
1215 std::abs(P[2] - B[2])),
1216 max_l2);
1217 const auto fac_l1_fac_l2_oogamma_to_l =
1218 math::fac_real<Real>(max_l1) * math::fac_real<Real>(max_l2) *
1219 std::pow(oogamma, max_l1 + max_l2);
1220 nonspherical_scr_factor =
1221 std::max(maxabs_PA_i_to_l1 * maxabs_PB_i_to_l2,
1222 fac_l1_fac_l2_oogamma_to_l);
1223 const auto ln_nonspherical_scr_factor =
1224 log(std::max(nonspherical_scr_factor, static_cast<real_t>(1)));
1225
1226 constexpr decltype(rho) ln_sqrt_two_times_M_PI_to_1pt25 =
1227 1.777485947591722872387900; // \ln(\sqrt{2} (\pi)^{5/4})
1228 const auto ln_spherical_scr_extra_factor =
1229 ln_sqrt_two_times_M_PI_to_1pt25 + log(oogamma);
1230 const auto ln_nprim = log(nprim1 * nprim2);
1231 ln_screen_fac += ln_spherical_scr_extra_factor +
1232 ln_nonspherical_scr_factor + ln_nprim;
1233 if (ln_screen_fac < ln_prec) continue;
1234 }
1235
1236 primpairs.resize(c + 1);
1237 PrimPairData& p = primpairs[c];
1238 p.ln_scr = ln_screen_fac;
1239 p.p1 = p1;
1240 p.p2 = p2;
1241 constexpr decltype(rho) sqrt_two_times_M_PI_to_1pt25 =
1242 5.9149671727956128778; // \sqrt{2} (\pi)^{5/4}
1243 p.K = sqrt_two_times_M_PI_to_1pt25 * exp(minus_rho_times_AB2) * oogamma;
1244 p.P[0] = P[0];
1245 p.P[1] = P[1];
1246 p.P[2] = P[2];
1247 p.nonsph_screen_fac = nonspherical_scr_factor;
1248 p.one_over_gamma = oogamma;
1249
1250 ++c;
1251 }
1252 }
1253
1254 this->ln_prec = ln_prec;
1255 this->screening_method_ = screening_method;
1256 }
1257
1259 template <typename Real, typename SchwarzFactorEvaluator>
1260 void init(const Shell& s1, const Shell& s2, Real ln_prec,
1261 ScreeningMethod screening_method,
1262 SchwarzFactorEvaluator&& schwarz_factor_evaluator) {
1263 assert(screening_method == ScreeningMethod::Schwarz ||
1264 screening_method == ScreeningMethod::SchwarzInf);
1265
1266 using std::log;
1267
1268 primpairs.clear();
1269
1270 const auto& A = s1.O;
1271 const auto& B = s2.O;
1272 real_t AB2 = 0.;
1273 for (int i = 0; i != 3; ++i) {
1274 AB[i] = A[i] - B[i];
1275 AB2 += AB[i] * AB[i];
1276 }
1277
1278 const auto nprim1 = s1.alpha.size();
1279 const auto nprim2 = s2.alpha.size();
1280 const auto nprim12 = nprim1 * nprim2;
1281 size_t c = 0;
1282 for (size_t p1 = 0; p1 != nprim1; ++p1) {
1283 for (size_t p2 = 0; p2 != nprim2; ++p2) {
1284 const auto ln_screen_fac =
1285 log(nprim12 * schwarz_factor_evaluator(s1, p1, s2, p2)) +
1286 s1.max_ln_coeff[p1] + s2.max_ln_coeff[p2];
1287 if (ln_screen_fac < ln_prec) continue;
1288
1289 const auto& a1 = s1.alpha[p1];
1290 const auto& a2 = s2.alpha[p2];
1291 const auto gamma = a1 + a2;
1292 const auto oogamma = 1 / gamma;
1293
1294 const auto rho = a1 * a2 * oogamma;
1295 const auto minus_rho_times_AB2 = -rho * AB2;
1296
1297 real_t P[3];
1298 if (AB2 == 0.) { // this buys a bit more precision
1299 P[0] = A[0];
1300 P[1] = A[1];
1301 P[2] = A[2];
1302 } else {
1303 P[0] = (a1 * A[0] + a2 * B[0]) * oogamma;
1304 P[1] = (a1 * A[1] + a2 * B[1]) * oogamma;
1305 P[2] = (a1 * A[2] + a2 * B[2]) * oogamma;
1306 }
1307
1308 primpairs.resize(c + 1);
1309 PrimPairData& p = primpairs[c];
1310 p.ln_scr = ln_screen_fac;
1311 p.p1 = p1;
1312 p.p2 = p2;
1313 constexpr decltype(rho) sqrt_two_times_M_PI_to_1pt25 =
1314 5.9149671727956128778; // \sqrt{2} (\pi)^{5/4}
1315 p.K = sqrt_two_times_M_PI_to_1pt25 * exp(minus_rho_times_AB2) * oogamma;
1316 p.P[0] = P[0];
1317 p.P[1] = P[1];
1318 p.P[2] = P[2];
1319 p.nonsph_screen_fac = 0;
1320 p.one_over_gamma = oogamma;
1321
1322 ++c;
1323 }
1324 }
1325
1326 this->ln_prec = ln_prec;
1327 this->screening_method_ = screening_method;
1328 }
1329};
1330
1331} // namespace libint2
1332
1333#endif /* _libint2_src_lib_libint_shell_h_ */
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24
ScreeningMethod
describes method for primitive screening used by ShellPair and Engine
Definition shell.h:1041
@ Original
standard screening method:
@ Conservative
conservative screening:
@ Schwarz
Schwarz screening method using Frobenius norm:
@ SchwarzInf
Schwarz screening method using infinity norm:
PrimPairData contains pre-computed primitive pair data.
Definition shell.h:1084
real_t ln_scr
natural log of the primitive pair screening factor (see ScreeningMethod )
Definition shell.h:1089
int p1
first primitive index
Definition shell.h:1090
real_t nonsph_screen_fac
used only when screening_method_==ScreeningMethod::Conservative: approximate upper bound for the modu...
Definition shell.h:1088
real_t P[3]
Definition shell.h:1085
real_t K
Definition shell.h:1086
int p2
second primitive index
Definition shell.h:1091
real_t one_over_gamma
Definition shell.h:1087
ShellPair contains pre-computed shell-pair data, primitive pairs are screened to finite precision.
Definition shell.h:1079
void init(const Shell &s1, const Shell &s2, Real ln_prec, ScreeningMethod screening_method=ScreeningMethod::Original)
initializes the shell pair data using original or conservative screening methods
Definition shell.h:1138
void reset()
makes this equivalent to a default-initialized ShellPair, however the memory allocated in primpairs i...
Definition shell.h:1123
void init(const Shell &s1, const Shell &s2, Real ln_prec, ScreeningMethod screening_method, SchwarzFactorEvaluator &&schwarz_factor_evaluator)
initializes the shell pair data using Schwarz screening methods
Definition shell.h:1260
contracted Gaussian = angular momentum + sph/cart flag + contraction coefficients
Definition shell.h:725
generally-contracted Solid-Harmonic/Cartesion Gaussian Shell
Definition shell.h:720
svector< Contraction > contr
contractions
Definition shell.h:742
svector< real_t > max_ln_coeff
maximum ln of (absolute) contraction coefficient for each primitive
Definition shell.h:744
Shell(svector< real_t > _alpha, svector< Contraction > _contr, std::array< real_t, 3 > _O, bool embed_normalization_into_coefficients=true)
Definition shell.h:767
static bool do_enforce_unit_normalization(defaultable_boolean flag=defaultable_boolean())
sets and/or reports whether the auto-renormalization to unity is set if called without arguments,...
Definition shell.h:895
static char am_symbol(size_t l)
Definition shell.h:814
static unsigned short am_symbol_to_l(char am_symbol)
inverse of am_symbol()
Definition shell.h:827
static const Shell & unit()
Definition shell.h:906
real_t coeff_normalized(size_t c, size_t p) const
Definition shell.h:915
std::array< real_t, 3 > O
origin
Definition shell.h:743
Shell extract_primitive(size_t p, bool unit_normalized=true) const
extract primitive shell
Definition shell.h:936
svector< real_t > alpha
exponents
Definition shell.h:741