source: ThirdParty/mpqc_open/src/lib/chemistry/qc/intv3/intv3.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: 7.4 KB
Line 
1//
2// intv3.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 <stdexcept>
29
30#include <util/state/stateio.h>
31#include <chemistry/qc/basis/integral.h>
32#include <chemistry/qc/intv3/intv3.h>
33#include <chemistry/qc/intv3/cartitv3.h>
34#include <chemistry/qc/intv3/tformv3.h>
35#include <chemistry/qc/intv3/obintv3.h>
36#include <chemistry/qc/intv3/tbintv3.h>
37
38using namespace std;
39using namespace sc;
40
41static ClassDesc IntegralV3_cd(
42 typeid(IntegralV3),"IntegralV3",1,"public Integral",
43 0, create<IntegralV3>, create<IntegralV3>);
44
45extern Ref<Integral> default_integral;
46
47Integral*
48Integral::get_default_integral()
49{
50 if (default_integral.null())
51 default_integral = new IntegralV3;
52
53 return default_integral;
54}
55
56IntegralV3::IntegralV3(const Ref<GaussianBasisSet> &b1,
57 const Ref<GaussianBasisSet> &b2,
58 const Ref<GaussianBasisSet> &b3,
59 const Ref<GaussianBasisSet> &b4):
60 Integral(b1,b2,b3,b4)
61{
62 initialize_transforms();
63}
64
65IntegralV3::IntegralV3(StateIn& s) :
66 Integral(s)
67{
68 initialize_transforms();
69}
70
71IntegralV3::IntegralV3(const Ref<KeyVal>& k) :
72 Integral(k)
73{
74 initialize_transforms();
75}
76
77void
78IntegralV3::save_data_state(StateOut& s)
79{
80 Integral::save_data_state(s);
81}
82
83IntegralV3::~IntegralV3()
84{
85 free_transforms();
86}
87
88Integral*
89IntegralV3::clone()
90{
91 return new IntegralV3;
92}
93
94CartesianIter *
95IntegralV3::new_cartesian_iter(int l)
96{
97 return new CartesianIterV3(l);
98}
99
100RedundantCartesianIter *
101IntegralV3::new_redundant_cartesian_iter(int l)
102{
103 return new RedundantCartesianIterV3(l);
104}
105
106RedundantCartesianSubIter *
107IntegralV3::new_redundant_cartesian_sub_iter(int l)
108{
109 return new RedundantCartesianSubIterV3(l);
110}
111
112SphericalTransformIter *
113IntegralV3::new_spherical_transform_iter(int l, int inv, int subl)
114{
115 if (l>maxl_ || l<0) {
116 ExEnv::errn() << "IntegralV3::new_spherical_transform_iter: bad l" << endl;
117 abort();
118 }
119 if (subl == -1) subl = l;
120 if (subl < 0 || subl > l || (l-subl)%2 != 0) {
121 ExEnv::errn() << "IntegralV3::new_spherical_transform_iter: bad subl" << endl;
122 abort();
123 }
124 if (inv) {
125 return new SphericalTransformIter(ist_[l][(l-subl)/2]);
126 }
127 return new SphericalTransformIter(st_[l][(l-subl)/2]);
128}
129
130const SphericalTransform *
131IntegralV3::spherical_transform(int l, int inv, int subl)
132{
133 if (l>maxl_ || l<0) {
134 ExEnv::errn() << "IntegralV3::spherical_transform_iter: bad l" << endl;
135 abort();
136 }
137 if (subl == -1) subl = l;
138 if (subl < 0 || subl > l || (l-subl)%2 != 0) {
139 ExEnv::errn() << "IntegralV3::spherical_transform_iter: bad subl" << endl;
140 abort();
141 }
142 if (inv) {
143 return ist_[l][(l-subl)/2];
144 }
145 return st_[l][(l-subl)/2];
146}
147
148Ref<OneBodyInt>
149IntegralV3::overlap()
150{
151 return new OneBodyIntV3(this, bs1_, bs2_, &Int1eV3::overlap);
152}
153
154Ref<OneBodyInt>
155IntegralV3::kinetic()
156{
157 return new OneBodyIntV3(this, bs1_, bs2_, &Int1eV3::kinetic);
158}
159
160Ref<OneBodyInt>
161IntegralV3::nuclear()
162{
163 return new OneBodyIntV3(this, bs1_, bs2_, &Int1eV3::nuclear);
164}
165
166Ref<OneBodyInt>
167IntegralV3::hcore()
168{
169 return new OneBodyIntV3(this, bs1_, bs2_, &Int1eV3::hcore);
170}
171
172Ref<OneBodyOneCenterInt>
173IntegralV3::point_charge1(const Ref<PointChargeData>& dat)
174{
175 Ref<GaussianBasisSet> unit(new GaussianBasisSet(GaussianBasisSet::Unit));
176 return new OneBodyOneCenterWrapper(new PointChargeIntV3(this, bs1_, unit ,dat));
177}
178
179Ref<OneBodyInt>
180IntegralV3::point_charge(const Ref<PointChargeData>& dat)
181{
182 return new PointChargeIntV3(this, bs1_, bs2_, dat);
183}
184
185Ref<OneBodyInt>
186IntegralV3::efield_dot_vector(const Ref<EfieldDotVectorData>&dat)
187{
188 return new EfieldDotVectorIntV3(this, bs1_, bs2_, dat);
189}
190
191Ref<OneBodyInt>
192IntegralV3::dipole(const Ref<DipoleData>& dat)
193{
194 return new DipoleIntV3(this, bs1_, bs2_, dat);
195}
196
197Ref<OneBodyInt>
198IntegralV3::quadrupole(const Ref<DipoleData>& dat)
199{
200 throw std::runtime_error("IntegralV3 cannot compute quadrupole moment integrals yet. Try IntegralCints instead.");
201}
202
203Ref<OneBodyDerivInt>
204IntegralV3::overlap_deriv()
205{
206 return new OneBodyDerivIntV3(this, bs1_, bs2_, &Int1eV3::overlap_1der);
207}
208
209Ref<OneBodyDerivInt>
210IntegralV3::kinetic_deriv()
211{
212 return new OneBodyDerivIntV3(this, bs1_, bs2_, &Int1eV3::kinetic_1der);
213}
214
215Ref<OneBodyDerivInt>
216IntegralV3::nuclear_deriv()
217{
218 return new OneBodyDerivIntV3(this, bs1_, bs2_, &Int1eV3::nuclear_1der);
219}
220
221Ref<OneBodyDerivInt>
222IntegralV3::hcore_deriv()
223{
224 return new OneBodyDerivIntV3(this, bs1_, bs2_, &Int1eV3::hcore_1der);
225}
226
227Ref<TwoBodyInt>
228IntegralV3::electron_repulsion()
229{
230 return new TwoBodyIntV3(this, bs1_, bs2_, bs3_, bs4_, storage_);
231}
232
233Ref<TwoBodyThreeCenterInt>
234IntegralV3::electron_repulsion3()
235{
236 return new TwoBodyThreeCenterIntV3(this, bs1_, bs2_, bs3_, storage_);
237}
238
239Ref<TwoBodyTwoCenterInt>
240IntegralV3::electron_repulsion2()
241{
242 return new TwoBodyTwoCenterIntV3(this, bs1_, bs2_, storage_);
243}
244
245Ref<TwoBodyDerivInt>
246IntegralV3::electron_repulsion_deriv()
247{
248 return new TwoBodyDerivIntV3(this, bs1_, bs2_, bs3_, bs4_, storage_);
249}
250
251void
252IntegralV3::set_basis(const Ref<GaussianBasisSet> &b1,
253 const Ref<GaussianBasisSet> &b2,
254 const Ref<GaussianBasisSet> &b3,
255 const Ref<GaussianBasisSet> &b4)
256{
257 free_transforms();
258 Integral::set_basis(b1,b2,b3,b4);
259 initialize_transforms();
260}
261
262void
263IntegralV3::free_transforms()
264{
265 int i,j;
266 for (i=0; i<=maxl_; i++) {
267 for (j=0; j<=i/2; j++) {
268 delete st_[i][j];
269 delete ist_[i][j];
270 }
271 delete[] st_[i];
272 delete[] ist_[i];
273 }
274 delete[] st_;
275 delete[] ist_;
276 st_ = 0;
277 ist_ = 0;
278}
279
280void
281IntegralV3::initialize_transforms()
282{
283 maxl_ = -1;
284 int maxam;
285 maxam = bs1_.nonnull()?bs1_->max_angular_momentum():-1;
286 if (maxl_ < maxam) maxl_ = maxam;
287 maxam = bs2_.nonnull()?bs2_->max_angular_momentum():-1;
288 if (maxl_ < maxam) maxl_ = maxam;
289 maxam = bs3_.nonnull()?bs3_->max_angular_momentum():-1;
290 if (maxl_ < maxam) maxl_ = maxam;
291 maxam = bs4_.nonnull()?bs4_->max_angular_momentum():-1;
292 if (maxl_ < maxam) maxl_ = maxam;
293
294 st_ = new SphericalTransformV3**[maxl_+1];
295 ist_ = new ISphericalTransformV3**[maxl_+1];;
296 int i,j;
297 for (i=0; i<=maxl_; i++) {
298 st_[i] = new SphericalTransformV3*[i/2+1];
299 ist_[i] = new ISphericalTransformV3*[i/2+1];
300 for (j=0; j<=i/2; j++) {
301 st_[i][j] = new SphericalTransformV3(i,i-2*j);
302 ist_[i][j] = new ISphericalTransformV3(i,i-2*j);
303 }
304 }
305}
306
307/////////////////////////////////////////////////////////////////////////////
308
309// Local Variables:
310// mode: c++
311// c-file-style: "CLJ"
312// End:
Note: See TracBrowser for help on using the repository browser.