source: ThirdParty/mpqc_open/src/lib/chemistry/qc/mbpt/hsosv1e1.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: 5.0 KB
Line 
1//
2// hsosv1e1.cc
3// based on: csgrade12.cc
4//
5// Copyright (C) 1996 Limit Point Systems, Inc.
6//
7// Author: Ida Nielsen <ida@kemi.aau.dk>
8// Maintainer: LPS
9//
10// This file is part of the SC Toolkit.
11//
12// The SC Toolkit is free software; you can redistribute it and/or modify
13// it under the terms of the GNU Library General Public License as published by
14// the Free Software Foundation; either version 2, or (at your option)
15// any later version.
16//
17// The SC Toolkit is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU Library General Public License for more details.
21//
22// You should have received a copy of the GNU Library General Public License
23// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
24// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25//
26// The U.S. Government is granted a limited license as per AL 91-7.
27//
28
29#ifdef __GNUC__
30#pragma implementation
31#endif
32
33#include <math.h>
34
35#include <util/misc/formio.h>
36#include <chemistry/qc/mbpt/bzerofast.h>
37#include <chemistry/qc/mbpt/hsosv1e1.h>
38
39using namespace sc;
40
41#define PRINT1Q 0
42
43HSOSV1Erep1Qtr::HSOSV1Erep1Qtr(int mythread_a, int nthread_a,
44 int me_a, int nproc_a,
45 const Ref<ThreadLock> &lock_a,
46 const Ref<GaussianBasisSet> &basis_a,
47 const Ref<TwoBodyInt> &tbint_a,
48 int ni_a, double **scf_vector_a,
49 double tol_a, int debug_a)
50{
51 mythread = mythread_a;
52 nthread = nthread_a;
53 me = me_a;
54 nproc = nproc_a;
55 lock = lock_a;
56 basis = basis_a;
57 tbint = tbint_a;
58 ni = ni_a;
59 scf_vector = scf_vector_a;
60 tol = tol_a;
61 debug = debug_a;
62
63 nbasis = basis->nbasis();
64 nfuncmax = basis->max_nfunction_in_shell();
65 nshell = basis->nshell();
66
67 aoint_computed_ = 0;
68
69 trans_int1 = new double[nfuncmax*nfuncmax*nbasis*ni];
70
71 timer = new RegionTimer();
72}
73
74HSOSV1Erep1Qtr::~HSOSV1Erep1Qtr()
75{
76 delete[] trans_int1;
77}
78
79void
80HSOSV1Erep1Qtr::accum_buffer(double *buffer)
81{
82 int n = nr*ns*nbasis*ni;
83 for (int i=0; i<n; i++) {
84 buffer[i] += trans_int1[i];
85 }
86}
87
88void
89HSOSV1Erep1Qtr::set_data(int R_a,int nr_a,int S_a,int ns_a,int ni_a,int ioffset_a)
90{
91 R = R_a;
92 nr = nr_a;
93 S = S_a;
94 ns = ns_a;
95 ni = ni_a;
96 i_offset = ioffset_a;
97}
98
99void
100HSOSV1Erep1Qtr::run()
101{
102 int i;
103 int P, Q;
104 int bf1,bf2,bf3,bf4;
105 int p,q;
106 double *c_pi,*c_qi;
107
108 timer->enter("bzerofast trans_int1");
109 bzerofast(trans_int1,nfuncmax*nfuncmax*nbasis*ni);
110 timer->exit("bzerofast trans_int1");
111
112 const double *intbuf = tbint->buffer();
113
114 int shell_index = 0;
115 int thindex = 0;
116
117 for (P = 0; P < basis->nshell(); P++) {
118 int np = basis->shell(P).nfunction();
119
120 for (Q = 0; Q <= P; Q++) {
121 shell_index++;
122 if (shell_index%nproc != me) continue;
123 if (thindex++%nthread != mythread) continue;
124
125 if (tbint->log2_shell_bound(P,Q,R,S) < tol) {
126 continue; /* skip ereps less than tol */
127 }
128
129 aoint_computed_++;
130
131 int nq = basis->shell(Q).nfunction();
132
133 timer->enter("erep");
134 tbint->compute_shell(P,Q,R,S);
135 timer->exit("erep");
136
137 timer->enter("1. quart. tr.");
138
139 int index = 0;
140
141 for (bf1 = 0; bf1 < np; bf1++) {
142 p = basis->shell_to_function(P) + bf1;
143
144 for (bf2 = 0; bf2 < nq; bf2++) {
145 q = basis->shell_to_function(Q) + bf2;
146 if (q > p) {
147 /* if q > p: want to skip the loops over bf3-4 */
148 /* and larger bf2 values, so increment bf1 by 1 */
149 /* ("break") and adjust the value of index */
150 index = (bf1 + 1) * nq * nr * ns;
151 break;
152 }
153
154 for (bf3 = 0; bf3 < nr; bf3++) {
155
156 for (bf4 = 0; bf4 < ns; bf4++,index++) {
157 if (R==S && bf4>bf3) {
158 index = ((bf1*nq + bf2)*nr + (bf3+1))*ns;
159 break;
160 }
161
162 if (fabs(intbuf[index])>1.0e-15) {
163 double pqrs = intbuf[index];
164
165 double *iqrs = &trans_int1[((bf4*nr + bf3)*nbasis + q)*ni];
166 double *iprs = &trans_int1[((bf4*nr + bf3)*nbasis + p)*ni];
167
168 if (p == q) pqrs *= 0.5;
169
170 int col_index = i_offset;
171 c_pi = &scf_vector[p][col_index];
172 c_qi = &scf_vector[q][col_index];
173
174 for (i=ni; i; i--) {
175 *iqrs++ += pqrs * *c_pi++;
176 *iprs++ += pqrs * *c_qi++;
177 }
178 }
179 } /* exit bf4 loop */
180 } /* exit bf3 loop */
181 } /* exit bf2 loop */
182 } /* exit bf1 loop */
183 timer->exit("1. quart. tr.");
184 } /* exit Q loop */
185 } /* exit P loop */
186}
187
188////////////////////////////////////////////////////////////////////////////
189
190// Local Variables:
191// mode: c++
192// c-file-style: "CLJ-CONDENSED"
193// End:
Note: See TracBrowser for help on using the repository browser.