1 /**********************************************************************
2 Cont_Matrix1.c:
3
4 Cont_Matrix1.c is a subroutine to contract a Matrix1 (HNL or iHNL)
5
6 Log of Cont_Matrix1.c:
7
8 8/Jan/2004 Released by T.Ozaki
9
10 ***********************************************************************/
11
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <math.h>
15 #include <time.h>
16 #include "openmx_common.h"
17
Cont_Matrix1(double **** Mat,double **** CMat)18 void Cont_Matrix1(double ****Mat, double ****CMat)
19 {
20 int spin,Mc_AN,Gc_AN,h_AN,Gh_AN,Mh_AN,L,L1,M1;
21 int p,q,p0,q0,al,be,Cwan,Hwan;
22 double sumS,tmp0;
23
24 for (Mc_AN=1; Mc_AN<=Matomnum; Mc_AN++){
25 Gc_AN = M2G[Mc_AN];
26 Cwan = WhatSpecies[Gc_AN];
27
28 for (h_AN=0; h_AN<=FNAN[Gc_AN]; h_AN++){
29 Gh_AN = natn[Gc_AN][h_AN];
30 Hwan = WhatSpecies[Gh_AN];
31 Mh_AN = F_G2M[Gh_AN];
32
33 for (al=0; al<Spe_Total_CNO[Cwan]; al++){
34 be = -1;
35 for (L=1; L<=Spe_Num_RVPS[Hwan]; L++){
36 L1 = Spe_VPS_List[Hwan][L];
37 for (M1=-L1; M1<=L1; M1++){
38 be++;
39 sumS = 0.0;
40 for (p=0; p<Spe_Specified_Num[Cwan][al]; p++){
41 p0 = Spe_Trans_Orbital[Cwan][al][p];
42 sumS += CntCoes[Mc_AN][al][p]*Mat[Mc_AN][h_AN][p0][be];
43 }
44 CMat[Mc_AN][h_AN][al][be] = sumS;
45 Mat[Mc_AN][h_AN][al][be] = sumS;
46 }
47 }
48 }
49 }
50 }
51 }
52