28 #ifndef _chemistry_qc_scf_ltbgrad_h
29 #define _chemistry_qc_scf_ltbgrad_h
33 #include <util/misc/regtime.h>
34 #include <math/scmat/offset.h>
36 #include <chemistry/qc/basis/tbint.h>
37 #include <chemistry/qc/basis/petite.h>
39 #include <chemistry/qc/scf/tbgrad.h>
64 double *tbg,
double pm,
double a,
int nt = 1,
int tn = 0,
65 double exchange_fraction = 1.0) :
67 tbgrad(tbg), pmax_(pm), accuracy_(a), threadno_(tn), nthread_(nt)
80 int nproc = grp_->
n();
89 double *tbint =
new double[mol.
natom()*3];
90 memset(tbint, 0,
sizeof(
double)*mol.
natom()*3);
93 int PPmax = (int) (log(6.0*pmax_*pmax_)/log(2.0));
94 int threshold = (int) (log(accuracy_)/log(2.0));
98 for (
int i=0; i < gbs.
nshell(); i++) {
102 int ni=gbs(i).nfunction();
105 for (
int j=0; j <= i; j++) {
106 int ij=i_offset(i)+j;
113 int nj=gbs(j).nfunction();
116 for (
int k=0; k <= i; k++,kindex++) {
117 if (kindex%nproc != me)
121 if (threadind % nthread_ != threadno_)
124 int nk=gbs(k).nfunction();
127 for (
int l=0; l <= ((i==k)?j:k); l++) {
131 int kl=i_offset(k)+l;
133 if (!(qijkl=pl.in_p4(ij,kl,i,j,k,l)))
136 int nl=gbs(l).nfunction();
142 const double * buf = tbi.
buffer();
146 this->set_scale(cscl, escl, i, j, k, l);
151 for (
int x=0; x < nx; x++) {
154 for (
int ixyz=0; ixyz < 3; ixyz++) {
155 double tx = tbint[ixyz+ix*3];
156 double to = tbint[ixyz+io*3];
158 for (
int ip=0, ii=fi; ip < ni; ip++, ii++) {
159 for (
int jp=0, jj=fj; jp < nj; jp++, jj++) {
160 for (
int kp=0, kk=fk; kp < nk; kp++, kk++) {
161 for (
int lp=0, ll=fl; lp < nl; lp++, ll++, indijkl++) {
163 double qint = buf[indijkl]*qijkl;
192 tbint[ixyz+ix*3] = tx;
193 tbint[ixyz+io*3] = to;
204 for (
int alpha=0; alpha < mol.
natom(); alpha++) {
205 double tbx = tbint[alpha*3+0];
206 double tby = tbint[alpha*3+1];
207 double tbz = tbint[alpha*3+2];
209 for (
int g=1; g < ct.
order(); g++) {
211 int ap = pl.atom_map(alpha,g);
213 tbx += tbint[ap*3+0]*so(0,0) + tbint[ap*3+1]*so(1,0) +
214 tbint[ap*3+2]*so(2,0);
215 tby += tbint[ap*3+0]*so(0,1) + tbint[ap*3+1]*so(1,1) +
216 tbint[ap*3+2]*so(2,1);
217 tbz += tbint[ap*3+0]*so(0,2) + tbint[ap*3+1]*so(1,2) +
218 tbint[ap*3+2]*so(2,2);
220 double scl = 1.0/(double)ct.
order();
221 tbgrad[alpha*3+0] += tbx*scl;
222 tbgrad[alpha*3+1] += tby*scl;
223 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:321
void run()
This is called with the Thread is run from a ThreadGrp.
Definition: ltbgrad.h:78
unsigned int nshell() const
Return the number of shells.
Definition: gaussbas.h:500
The Molecule class contains information about molecules.
Definition: molecule.h:149
const Ref< PointGroup > & point_group() const
Returns the PointGroup of the molecule.
virtual void compute_shell(int sh0, int sh1, int sh2, int sh3, DerivCenters &dercenters)=0
Given for shell indices, this will cause the derivative integral shell set to be computed.
The SymmetryOperation class provides a 3 by 3 matrix representation of a symmetry operation,...
Definition: pointgrp.h:66
A template class that maintains references counts.
Definition: ref.h:361
int omitted_atom() const
Definition: dercent.h:86
int order() const
Returns the order of the point group.
Definition: pointgrp.h:368
T * pointer() const
Returns a pointer the reference counted object.
Definition: ref.h:413
int me()
Returns my processor number. In the range [0,n()).
Definition: message.h:194
PetiteList is a petite list (see Dupuis & King, IJQC 11,613,(1977) ) that can be used for constructin...
Definition: petite.h:120
int n()
Returns the number of processors.
Definition: message.h:192
This is an abstract base type for classes that compute geometric derivatives of the integrals involvi...
Definition: tbint.h:554
const double * buffer() const
The computed shell-set of integrals will be put in the buffer returned by this member.
Ref< Molecule > molecule() const
Return the Molecule object.
Definition: gaussbas.h:489
int n() const
The number of centers for which derivatives have been computed.
Definition: dercent.h:69
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:141
size_t natom() const
Returns the number of atoms in the molecule.
Definition: molecule.h:327
int shell_to_function(int i) const
Return the number of the first function in the given shell.
Definition: gaussbas.h:540
SymmetryOperation & symm_operation(int i)
Returns the i'th symmetry operation.
Definition: pointgrp.h:374
DerivCenters keeps track the centers that derivatives are taken with respect to.
Definition: dercent.h:42
The MessageGrp abstract class provides a mechanism for moving data and objects between nodes in a par...
Definition: message.h:120
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
int atom(int i) const
Definition: dercent.h:77
Generated at Sun Jan 26 2020 23:24:00 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.