source: ThirdParty/mpqc_open/src/lib/chemistry/qc/basis/tbint.cc@ aae63a

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 aae63a 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: 13.3 KB
Line 
1//
2// tbint.cc
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Edward Seidl <seidl@janed.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#ifdef __GNUC__
29#pragma implementation
30#endif
31
32#include <math/scmat/offset.h>
33
34#include <chemistry/qc/basis/tbint.h>
35#include <chemistry/qc/basis/integral.h>
36#include <chemistry/qc/basis/basis.h>
37
38using namespace sc;
39
40///////////////////////////////////////////////////////////////////////
41
42TwoBodyInt::TwoBodyInt(Integral *integral,
43 const Ref<GaussianBasisSet>&b1,
44 const Ref<GaussianBasisSet>&b2,
45 const Ref<GaussianBasisSet>&b3,
46 const Ref<GaussianBasisSet>&b4) :
47 integral_(integral),
48 bs1_(b1), bs2_(b2), bs3_(b3), bs4_(b4), redundant_(1)
49{
50 integral_->reference();
51 buffer_ = 0;
52}
53
54TwoBodyInt::~TwoBodyInt()
55{
56 integral_->dereference();
57 if (integral_->nreference() == 0) delete integral_;
58}
59
60int
61TwoBodyInt::nbasis() const
62{
63 return bs1_->nbasis();
64}
65
66int
67TwoBodyInt::nbasis1() const
68{
69 return bs1_->nbasis();
70}
71
72int
73TwoBodyInt::nbasis2() const
74{
75 return bs2_->nbasis();
76}
77
78int
79TwoBodyInt::nbasis3() const
80{
81 return bs3_->nbasis();
82}
83
84int
85TwoBodyInt::nbasis4() const
86{
87 return bs4_->nbasis();
88}
89
90int
91TwoBodyInt::nshell() const
92{
93 return bs1_->nshell();
94}
95
96int
97TwoBodyInt::nshell1() const
98{
99 return bs1_->nshell();
100}
101
102int
103TwoBodyInt::nshell2() const
104{
105 return bs2_->nshell();
106}
107
108int
109TwoBodyInt::nshell3() const
110{
111 return bs3_->nshell();
112}
113
114int
115TwoBodyInt::nshell4() const
116{
117 return bs4_->nshell();
118}
119
120Ref<GaussianBasisSet>
121TwoBodyInt::basis()
122{
123 return bs1_;
124}
125
126Ref<GaussianBasisSet>
127TwoBodyInt::basis1()
128{
129 return bs1_;
130}
131
132Ref<GaussianBasisSet>
133TwoBodyInt::basis2()
134{
135 return bs2_;
136}
137
138Ref<GaussianBasisSet>
139TwoBodyInt::basis3()
140{
141 return bs3_;
142}
143
144Ref<GaussianBasisSet>
145TwoBodyInt::basis4()
146{
147 return bs4_;
148}
149
150const double *
151TwoBodyInt::buffer(tbint_type i) const
152{
153 if (i==eri) return buffer_;
154 return 0;
155}
156
157void
158TwoBodyInt::set_integral_storage(size_t storage)
159{
160}
161
162///////////////////////////////////////////////////////////////////////
163
164TwoBodyThreeCenterInt::TwoBodyThreeCenterInt(Integral *integral,
165 const Ref<GaussianBasisSet>&b1,
166 const Ref<GaussianBasisSet>&b2,
167 const Ref<GaussianBasisSet>&b3) :
168 integral_(integral),
169 bs1_(b1), bs2_(b2), bs3_(b3), redundant_(1)
170{
171 integral_->reference();
172 buffer_ = 0;
173}
174
175TwoBodyThreeCenterInt::~TwoBodyThreeCenterInt()
176{
177 integral_->dereference();
178 if (integral_->nreference() == 0) delete integral_;
179}
180
181int
182TwoBodyThreeCenterInt::nbasis() const
183{
184 return bs1_->nbasis();
185}
186
187int
188TwoBodyThreeCenterInt::nbasis1() const
189{
190 return bs1_->nbasis();
191}
192
193int
194TwoBodyThreeCenterInt::nbasis2() const
195{
196 return bs2_->nbasis();
197}
198
199int
200TwoBodyThreeCenterInt::nbasis3() const
201{
202 return bs3_->nbasis();
203}
204
205int
206TwoBodyThreeCenterInt::nshell() const
207{
208 return bs1_->nshell();
209}
210
211int
212TwoBodyThreeCenterInt::nshell1() const
213{
214 return bs1_->nshell();
215}
216
217int
218TwoBodyThreeCenterInt::nshell2() const
219{
220 return bs2_->nshell();
221}
222
223int
224TwoBodyThreeCenterInt::nshell3() const
225{
226 return bs3_->nshell();
227}
228
229Ref<GaussianBasisSet>
230TwoBodyThreeCenterInt::basis()
231{
232 return bs1_;
233}
234
235Ref<GaussianBasisSet>
236TwoBodyThreeCenterInt::basis1()
237{
238 return bs1_;
239}
240
241Ref<GaussianBasisSet>
242TwoBodyThreeCenterInt::basis2()
243{
244 return bs2_;
245}
246
247Ref<GaussianBasisSet>
248TwoBodyThreeCenterInt::basis3()
249{
250 return bs3_;
251}
252
253const double *
254TwoBodyThreeCenterInt::buffer(tbint_type i) const
255{
256 if (i==eri) return buffer_;
257 return 0;
258}
259
260void
261TwoBodyThreeCenterInt::set_integral_storage(size_t storage)
262{
263}
264
265///////////////////////////////////////////////////////////////////////
266
267TwoBodyTwoCenterInt::TwoBodyTwoCenterInt(Integral *integral,
268 const Ref<GaussianBasisSet>&b1,
269 const Ref<GaussianBasisSet>&b2) :
270 integral_(integral),
271 bs1_(b1), bs2_(b2), redundant_(1)
272{
273 integral_->reference();
274 buffer_ = 0;
275}
276
277TwoBodyTwoCenterInt::~TwoBodyTwoCenterInt()
278{
279 integral_->dereference();
280 if (integral_->nreference() == 0) delete integral_;
281}
282
283int
284TwoBodyTwoCenterInt::nbasis() const
285{
286 return bs1_->nbasis();
287}
288
289int
290TwoBodyTwoCenterInt::nbasis1() const
291{
292 return bs1_->nbasis();
293}
294
295int
296TwoBodyTwoCenterInt::nbasis2() const
297{
298 return bs2_->nbasis();
299}
300
301int
302TwoBodyTwoCenterInt::nshell() const
303{
304 return bs1_->nshell();
305}
306
307int
308TwoBodyTwoCenterInt::nshell1() const
309{
310 return bs1_->nshell();
311}
312
313int
314TwoBodyTwoCenterInt::nshell2() const
315{
316 return bs2_->nshell();
317}
318
319Ref<GaussianBasisSet>
320TwoBodyTwoCenterInt::basis()
321{
322 return bs1_;
323}
324
325Ref<GaussianBasisSet>
326TwoBodyTwoCenterInt::basis1()
327{
328 return bs1_;
329}
330
331Ref<GaussianBasisSet>
332TwoBodyTwoCenterInt::basis2()
333{
334 return bs2_;
335}
336
337const double *
338TwoBodyTwoCenterInt::buffer(tbint_type i) const
339{
340 if (i==eri) return buffer_;
341 return 0;
342}
343
344void
345TwoBodyTwoCenterInt::set_integral_storage(size_t storage)
346{
347}
348
349///////////////////////////////////////////////////////////////////////
350
351ShellQuartetIter::ShellQuartetIter()
352{
353}
354
355ShellQuartetIter::~ShellQuartetIter()
356{
357}
358
359void
360ShellQuartetIter::init(const double * b,
361 int is, int js, int ks, int ls,
362 int fi, int fj, int fk, int fl,
363 int ni, int nj, int nk, int nl,
364 double scl, int redund)
365{
366 redund_ = redund;
367
368 e12 = (is==js);
369 e34 = (ks==ls);
370 e13e24 = (is==ks) && (js==ls);
371
372 istart=fi;
373 jstart=fj;
374 kstart=fk;
375 lstart=fl;
376
377 index=0;
378
379 iend=ni;
380 jend=nj;
381 kend=nk;
382 lend=nl;
383
384 buf=b;
385 scale_=scl;
386}
387
388void
389ShellQuartetIter::start()
390{
391 icur=0; i_ = istart;
392 jcur=0; j_ = jstart;
393 kcur=0; k_ = kstart;
394 lcur=0; l_ = lstart;
395}
396
397void
398ShellQuartetIter::next()
399{
400 index++;
401
402 if (redund_) {
403 if (lcur < lend-1) {
404 lcur++;
405 l_++;
406 return;
407 }
408
409 lcur=0;
410 l_=lstart;
411
412 if (kcur < kend-1) {
413 kcur++;
414 k_++;
415 return;
416 }
417
418 kcur=0;
419 k_=kstart;
420
421 if (jcur < jend-1) {
422 jcur++;
423 j_++;
424 return;
425 }
426
427 jcur=0;
428 j_=jstart;
429
430 icur++;
431 i_++;
432
433 } else {
434 if (lcur < ((e34) ? (((e13e24)&&((kcur)==(icur)))?(jcur):(kcur))
435 : ((e13e24)&&((kcur)==(icur)))?(jcur):(lend)-1)) {
436 lcur++;
437 l_++;
438 return;
439 }
440
441 lcur=0;
442 l_=lstart;
443
444 if (kcur < ((e13e24)?(icur):((kend)-1))) {
445 kcur++;
446 k_++;
447 return;
448 }
449
450 kcur=0;
451 k_=kstart;
452
453 if (jcur < ((e12)?(icur):((jend)-1))) {
454 jcur++;
455 j_++;
456 return;
457 }
458
459 jcur=0;
460 j_=jstart;
461
462 icur++;
463 i_++;
464 }
465}
466
467///////////////////////////////////////////////////////////////////////
468
469TwoBodyIntIter::TwoBodyIntIter()
470{
471}
472
473TwoBodyIntIter::TwoBodyIntIter(const Ref<TwoBodyInt>& t) :
474 tbi(t)
475{
476}
477
478TwoBodyIntIter::~TwoBodyIntIter()
479{
480}
481
482void
483TwoBodyIntIter::start()
484{
485 icur=0;
486 jcur=0;
487 kcur=0;
488 lcur=0;
489
490 iend = tbi->nshell();
491}
492
493void
494TwoBodyIntIter::next()
495{
496 if (lcur < ((icur==kcur) ? jcur : kcur)) { // increment l loop?
497 lcur++;
498 return;
499 }
500
501 // restart l loop
502 lcur=0;
503
504 if (kcur < icur) { // increment k loop?
505 kcur++;
506 return;
507 }
508
509 // restart k loop
510 kcur=0;
511
512 if (jcur < icur) { // increment j loop?
513 jcur++;
514 return;
515 }
516
517 // restart j loop
518 jcur=0;
519
520 // increment i loop
521 icur++;
522}
523
524double
525TwoBodyIntIter::scale() const
526{
527 return 1.0;
528}
529
530ShellQuartetIter&
531TwoBodyIntIter::current_quartet()
532{
533 tbi->compute_shell(icur,jcur,kcur,lcur);
534
535 sqi.init(tbi->buffer(),
536 icur, jcur, kcur, lcur,
537 tbi->basis()->shell_to_function(icur),
538 tbi->basis()->shell_to_function(jcur),
539 tbi->basis()->shell_to_function(kcur),
540 tbi->basis()->shell_to_function(lcur),
541 tbi->basis()->operator()(icur).nfunction(),
542 tbi->basis()->operator()(jcur).nfunction(),
543 tbi->basis()->operator()(kcur).nfunction(),
544 tbi->basis()->operator()(lcur).nfunction(),
545 scale(),
546 tbi->redundant()
547 );
548
549 return sqi;
550}
551
552///////////////////////////////////////////////////////////////////////
553
554TwoBodyDerivInt::TwoBodyDerivInt(Integral *integral,
555 const Ref<GaussianBasisSet>&b1,
556 const Ref<GaussianBasisSet>&b2,
557 const Ref<GaussianBasisSet>&b3,
558 const Ref<GaussianBasisSet>&b4):
559 integral_(integral),
560 bs1_(b1), bs2_(b2), bs3_(b3), bs4_(b4)
561{
562 integral_->reference();
563 buffer_ = 0;
564}
565
566TwoBodyDerivInt::~TwoBodyDerivInt()
567{
568 integral_->dereference();
569 if (integral_->nreference() == 0) delete integral_;
570}
571
572int
573TwoBodyDerivInt::nbasis() const
574{
575 return bs1_->nbasis();
576}
577
578int
579TwoBodyDerivInt::nbasis1() const
580{
581 return bs1_->nbasis();
582}
583
584int
585TwoBodyDerivInt::nbasis2() const
586{
587 return bs2_->nbasis();
588}
589
590int
591TwoBodyDerivInt::nbasis3() const
592{
593 return bs3_->nbasis();
594}
595
596int
597TwoBodyDerivInt::nbasis4() const
598{
599 return bs4_->nbasis();
600}
601
602int
603TwoBodyDerivInt::nshell() const
604{
605 return bs1_->nshell();
606}
607
608int
609TwoBodyDerivInt::nshell1() const
610{
611 return bs1_->nshell();
612}
613
614int
615TwoBodyDerivInt::nshell2() const
616{
617 return bs2_->nshell();
618}
619
620int
621TwoBodyDerivInt::nshell3() const
622{
623 return bs3_->nshell();
624}
625
626int
627TwoBodyDerivInt::nshell4() const
628{
629 return bs4_->nshell();
630}
631
632Ref<GaussianBasisSet>
633TwoBodyDerivInt::basis()
634{
635 return bs1_;
636}
637
638Ref<GaussianBasisSet>
639TwoBodyDerivInt::basis1()
640{
641 return bs1_;
642}
643
644Ref<GaussianBasisSet>
645TwoBodyDerivInt::basis2()
646{
647 return bs2_;
648}
649
650Ref<GaussianBasisSet>
651TwoBodyDerivInt::basis3()
652{
653 return bs3_;
654}
655
656Ref<GaussianBasisSet>
657TwoBodyDerivInt::basis4()
658{
659 return bs4_;
660}
661
662const double *
663TwoBodyDerivInt::buffer() const
664{
665 return buffer_;
666}
667
668///////////////////////////////////////////////////////////////////////
669
670TwoBodyThreeCenterDerivInt::TwoBodyThreeCenterDerivInt(Integral *integral,
671 const Ref<GaussianBasisSet>&b1,
672 const Ref<GaussianBasisSet>&b2,
673 const Ref<GaussianBasisSet>&b3):
674 integral_(integral),
675 bs1_(b1), bs2_(b2), bs3_(b3)
676{
677 integral_->reference();
678 buffer_ = 0;
679}
680
681TwoBodyThreeCenterDerivInt::~TwoBodyThreeCenterDerivInt()
682{
683 integral_->dereference();
684 if (integral_->nreference() == 0) delete integral_;
685}
686
687int
688TwoBodyThreeCenterDerivInt::nbasis() const
689{
690 return bs1_->nbasis();
691}
692
693int
694TwoBodyThreeCenterDerivInt::nbasis1() const
695{
696 return bs1_->nbasis();
697}
698
699int
700TwoBodyThreeCenterDerivInt::nbasis2() const
701{
702 return bs2_->nbasis();
703}
704
705int
706TwoBodyThreeCenterDerivInt::nbasis3() const
707{
708 return bs3_->nbasis();
709}
710
711int
712TwoBodyThreeCenterDerivInt::nshell() const
713{
714 return bs1_->nshell();
715}
716
717int
718TwoBodyThreeCenterDerivInt::nshell1() const
719{
720 return bs1_->nshell();
721}
722
723int
724TwoBodyThreeCenterDerivInt::nshell2() const
725{
726 return bs2_->nshell();
727}
728
729int
730TwoBodyThreeCenterDerivInt::nshell3() const
731{
732 return bs3_->nshell();
733}
734
735Ref<GaussianBasisSet>
736TwoBodyThreeCenterDerivInt::basis()
737{
738 return bs1_;
739}
740
741Ref<GaussianBasisSet>
742TwoBodyThreeCenterDerivInt::basis1()
743{
744 return bs1_;
745}
746
747Ref<GaussianBasisSet>
748TwoBodyThreeCenterDerivInt::basis2()
749{
750 return bs2_;
751}
752
753Ref<GaussianBasisSet>
754TwoBodyThreeCenterDerivInt::basis3()
755{
756 return bs3_;
757}
758
759const double *
760TwoBodyThreeCenterDerivInt::buffer() const
761{
762 return buffer_;
763}
764
765///////////////////////////////////////////////////////////////////////
766
767TwoBodyTwoCenterDerivInt::TwoBodyTwoCenterDerivInt(Integral *integral,
768 const Ref<GaussianBasisSet>&b1,
769 const Ref<GaussianBasisSet>&b2):
770 integral_(integral),
771 bs1_(b1), bs2_(b2)
772{
773 integral_->reference();
774 buffer_ = 0;
775}
776
777TwoBodyTwoCenterDerivInt::~TwoBodyTwoCenterDerivInt()
778{
779 integral_->dereference();
780 if (integral_->nreference() == 0) delete integral_;
781}
782
783int
784TwoBodyTwoCenterDerivInt::nbasis() const
785{
786 return bs1_->nbasis();
787}
788
789int
790TwoBodyTwoCenterDerivInt::nbasis1() const
791{
792 return bs1_->nbasis();
793}
794
795int
796TwoBodyTwoCenterDerivInt::nbasis2() const
797{
798 return bs2_->nbasis();
799}
800
801int
802TwoBodyTwoCenterDerivInt::nshell() const
803{
804 return bs1_->nshell();
805}
806
807int
808TwoBodyTwoCenterDerivInt::nshell1() const
809{
810 return bs1_->nshell();
811}
812
813int
814TwoBodyTwoCenterDerivInt::nshell2() const
815{
816 return bs2_->nshell();
817}
818
819Ref<GaussianBasisSet>
820TwoBodyTwoCenterDerivInt::basis()
821{
822 return bs1_;
823}
824
825Ref<GaussianBasisSet>
826TwoBodyTwoCenterDerivInt::basis1()
827{
828 return bs1_;
829}
830
831Ref<GaussianBasisSet>
832TwoBodyTwoCenterDerivInt::basis2()
833{
834 return bs2_;
835}
836
837const double *
838TwoBodyTwoCenterDerivInt::buffer() const
839{
840 return buffer_;
841}
842
843/////////////////////////////////////////////////////////////////////////////
844
845// Local Variables:
846// mode: c++
847// c-file-style: "ETS"
848// End:
Note: See TracBrowser for help on using the repository browser.