28 #ifndef _chemistry_qc_scf_ltbgrad_h
29 #define _chemistry_qc_scf_ltbgrad_h
37 #include <util/misc/timer.h>
38 #include <math/scmat/offset.h>
40 #include <chemistry/qc/basis/tbint.h>
41 #include <chemistry/qc/basis/petite.h>
43 #include <chemistry/qc/scf/tbgrad.h>
68 double *tbg,
double pm,
double a,
int nt = 1,
int tn = 0,
69 double exchange_fraction = 1.0) :
71 tbgrad(tbg), pmax_(pm), accuracy_(a), threadno_(tn), nthread_(nt)
84 int nproc = grp_->
n();
93 double *tbint =
new double[mol.
natom()*3];
94 memset(tbint, 0,
sizeof(
double)*mol.
natom()*3);
97 int PPmax = (int) (log(6.0*pmax_*pmax_)/log(2.0));
98 int threshold = (int) (log(accuracy_)/log(2.0));
102 for (
int i=0; i < gbs.
nshell(); i++) {
106 int ni=gbs(i).nfunction();
109 for (
int j=0; j <= i; j++) {
110 int ij=i_offset(i)+j;
117 int nj=gbs(j).nfunction();
120 for (
int k=0; k <= i; k++,kindex++) {
121 if (kindex%nproc != me)
125 if (threadind % nthread_ != threadno_)
128 int nk=gbs(k).nfunction();
131 for (
int l=0; l <= ((i==k)?j:k); l++) {
135 int kl=i_offset(k)+l;
137 if (!(qijkl=pl.in_p4(ij,kl,i,j,k,l)))
140 int nl=gbs(l).nfunction();
146 const double * buf = tbi.
buffer();
150 this->set_scale(cscl, escl, i, j, k, l);
155 for (
int x=0; x < nx; x++) {
158 for (
int ixyz=0; ixyz < 3; ixyz++) {
159 double tx = tbint[ixyz+ix*3];
160 double to = tbint[ixyz+io*3];
162 for (
int ip=0, ii=fi; ip < ni; ip++, ii++) {
163 for (
int jp=0, jj=fj; jp < nj; jp++, jj++) {
164 for (
int kp=0, kk=fk; kp < nk; kp++, kk++) {
165 for (
int lp=0, ll=fl; lp < nl; lp++, ll++, indijkl++) {
167 double qint = buf[indijkl]*qijkl;
196 tbint[ixyz+ix*3] = tx;
197 tbint[ixyz+io*3] = to;
208 for (
int alpha=0; alpha < mol.
natom(); alpha++) {
209 double tbx = tbint[alpha*3+0];
210 double tby = tbint[alpha*3+1];
211 double tbz = tbint[alpha*3+2];
213 for (
int g=1; g < ct.
order(); g++) {
215 int ap = pl.atom_map(alpha,g);
217 tbx += tbint[ap*3+0]*so(0,0) + tbint[ap*3+1]*so(1,0) +
218 tbint[ap*3+2]*so(2,0);
219 tby += tbint[ap*3+0]*so(0,1) + tbint[ap*3+1]*so(1,1) +
220 tbint[ap*3+2]*so(2,1);
221 tbz += tbint[ap*3+0]*so(0,2) + tbint[ap*3+1]*so(1,2) +
222 tbint[ap*3+2]*so(2,2);
224 double scl = 1.0/(double)ct.
order();
225 tbgrad[alpha*3+0] += tbx*scl;
226 tbgrad[alpha*3+1] += tby*scl;
227 tbgrad[alpha*3+2] += tbz*scl;
The CharacterTable class provides a workable character table for all of the non-cubic point groups.
Definition: pointgrp.h:325
void run()
This is called with the Thread is run from a ThreadGrp.
Definition: ltbgrad.h:82
The Molecule class contains information about molecules.
Definition: molecule.h:127
The SymmetryOperation class provides a 3 by 3 matrix representation of a symmetry operation,...
Definition: pointgrp.h:70
A template class that maintains references counts.
Definition: ref.h:332
int omitted_atom() const
Definition: dercent.h:100
int order() const
Returns the order of the point group.
Definition: pointgrp.h:372
T * pointer() const
Returns a pointer the reference counted object.
Definition: ref.h:383
virtual void compute_shell(int, int, int, int, DerivCenters &)=0
Given for shell indices, this will cause the integral buffer to be filled in.
int natom() const
Returns the number of atoms in the molcule.
Definition: molecule.h:288
int me()
Returns my processor number. In the range [0,n()).
Definition: message.h:138
int n()
Returns the number of processors.
Definition: message.h:136
Ref< PointGroup > point_group() const
Returns the PointGroup of the molecule.
This is an abstract base type for classes that compute integrals involving two electrons.
Definition: tbint.h:422
const double * buffer() const
The computed shell integrals will be put in the buffer returned by this member.
Ref< Molecule > molecule() const
Return the Molecule object.
Definition: gaussbas.h:406
int n() const
The number of centers for which derivatives have been computed.
Definition: dercent.h:83
virtual int log2_shell_bound(int=-1, int=-1, int=-1, int=-1)=0
Return log base 2 of the maximum magnitude of any integral in a shell block.
The GaussianBasisSet class is used describe a basis set composed of atomic gaussian orbitals.
Definition: gaussbas.h:145
int shell_to_function(int i) const
Return the number of the first function in the given shell.
Definition: gaussbas.h:454
SymmetryOperation & symm_operation(int i)
Returns the i'th symmetry operation.
Definition: pointgrp.h:378
DerivCenters keeps track the centers that derivatives are taken with respect to.
Definition: dercent.h:41
int nshell() const
Return the number of shells.
Definition: gaussbas.h:417
The MessageGrp abstract class provides a mechanism for moving data and objects between nodes in a par...
Definition: message.h:109
int atom(int i) const
Definition: dercent.h:91
Generated at Sun Jan 26 2020 23:33:04 for MPQC
2.3.1 using the documentation package Doxygen
1.8.16.