source: ThirdParty/mpqc_open/src/lib/chemistry/qc/cints/int2e.cc@ bbc982

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since bbc982 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: 5.0 KB
Line 
1//
2// int2e.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/misc/formio.h>
33#include <chemistry/qc/basis/integral.h>
34#include <chemistry/qc/cints/int2e.h>
35
36using namespace std;
37using namespace sc;
38
39inline int max(int a,int b) { return (a > b) ? a : b;}
40inline void fail()
41{
42 ExEnv::errn() << scprintf("failing module:\n%s",__FILE__) << endl;
43 abort();
44}
45
46Int2eCints::Int2eCints(Integral *integral,
47 const Ref<GaussianBasisSet>& b1,
48 const Ref<GaussianBasisSet>& b2,
49 const Ref<GaussianBasisSet>& b3,
50 const Ref<GaussianBasisSet>& b4,
51 size_t storage) :
52 integral_(integral),
53 grp_(integral->messagegrp()),
54 permute_(0)
55{
56 bs1_ = b1;
57 bs2_ = b2;
58 bs3_ = b3;
59 bs4_ = b4;
60
61 if (bs2_.null()) bs2_ = bs1_;
62 if (bs3_.null()) bs3_ = bs2_;
63 if (bs4_.null()) bs4_ = bs3_;
64
65 /*--- Initialize storage ---*/
66 init_storage(storage);
67
68 /*--- allocate scratch for transformation ---*/
69 if (bs1_->has_pure() || bs2_->has_pure() || bs3_->has_pure() || bs4_->has_pure() ||
70 bs1_->max_ncontraction() != 1 || bs2_->max_ncontraction() != 1 ||
71 bs3_->max_ncontraction() != 1 || bs4_->max_ncontraction() != 1) {
72 // compute how much space one contraction quartet may need
73 int nshell1 = bs1_->nshell();
74 int maxncart1 = 0;
75 for(int sh1=0; sh1<nshell1;sh1++) {
76 int maxncart = bs1_->shell(sh1).max_cartesian();
77 if (maxncart > maxncart1) maxncart1 = maxncart;
78 }
79 int nshell2 = bs2_->nshell();
80 int maxncart2 = 0;
81 for(int sh2=0; sh2<nshell2;sh2++) {
82 int maxncart = bs2_->shell(sh2).max_cartesian();
83 if (maxncart > maxncart2) maxncart2 = maxncart;
84 }
85 int nshell3 = bs3_->nshell();
86 int maxncart3 = 0;
87 for(int sh3=0; sh3<nshell3;sh3++) {
88 int maxncart = bs3_->shell(sh3).max_cartesian();
89 if (maxncart > maxncart3) maxncart3 = maxncart;
90 }
91 int nshell4 = bs4_->nshell();
92 int maxncart4 = 0;
93 for(int sh4=0; sh4<nshell4;sh4++) {
94 int maxncart = bs4_->shell(sh4).max_cartesian();
95 if (maxncart > maxncart4) maxncart4 = maxncart;
96 }
97 tformbuf_ = new double[maxncart1*maxncart2*maxncart3*maxncart4];
98 }
99 else {
100 tformbuf_ = 0;
101 }
102}
103
104
105Int2eCints::~Int2eCints()
106{
107 if (tformbuf_)
108 delete[] tformbuf_;
109 done_storage();
110}
111
112size_t
113Int2eCints::storage_required_(const Ref<GaussianBasisSet>& b1,
114 const Ref<GaussianBasisSet>& b2,
115 const Ref<GaussianBasisSet>& b3,
116 const Ref<GaussianBasisSet>& b4)
117{
118 size_t storage_required = 0;
119
120 Ref<GaussianBasisSet> bs1 = b1;
121 Ref<GaussianBasisSet> bs2 = b2;
122 Ref<GaussianBasisSet> bs3 = b3;
123 Ref<GaussianBasisSet> bs4 = b4;
124
125 if (bs2.null())
126 bs2 = bs1;
127 if (bs3.null())
128 bs3 = bs1;
129 if (bs4.null())
130 bs4 = bs1;
131
132 if (bs1->has_pure() || bs2->has_pure() || bs3->has_pure() || bs4->has_pure() ||
133 bs1->max_ncontraction() != 1 || bs2->max_ncontraction() != 1 ||
134 bs3->max_ncontraction() != 1 || bs4->max_ncontraction() != 1) {
135 // compute how much space one contraction quartet may need
136 int nshell1 = bs1->nshell();
137 int maxncart1 = 0;
138 for(int sh1=0; sh1<nshell1;sh1++) {
139 int maxncart = bs1->shell(sh1).max_cartesian();
140 if (maxncart > maxncart1) maxncart1 = maxncart;
141 }
142 int nshell2 = bs2->nshell();
143 int maxncart2 = 0;
144 for(int sh2=0; sh2<nshell2;sh2++) {
145 int maxncart = bs2->shell(sh2).max_cartesian();
146 if (maxncart > maxncart2) maxncart2 = maxncart;
147 }
148 int nshell3 = bs3->nshell();
149 int maxncart3 = 0;
150 for(int sh3=0; sh3<nshell3;sh3++) {
151 int maxncart = bs3->shell(sh3).max_cartesian();
152 if (maxncart > maxncart3) maxncart3 = maxncart;
153 }
154 int nshell4 = bs4->nshell();
155 int maxncart4 = 0;
156 for(int sh4=0; sh4<nshell4;sh4++) {
157 int maxncart = bs4->shell(sh4).max_cartesian();
158 if (maxncart > maxncart4) maxncart4 = maxncart;
159 }
160 storage_required = maxncart1*maxncart2*maxncart3*maxncart4*sizeof(double);
161 }
162 else {
163 storage_required = 0;
164 }
165
166 return storage_required;
167}
168
169/////////////////////////////////////////////////////////////////////////////
170
171// Local Variables:
172// mode: c++
173// c-file-style: "CLJ-CONDENSED"
174// End:
Note: See TracBrowser for help on using the repository browser.