~ubuntu-branches/ubuntu/precise/psicode/precise

« back to all changes in this revision

Viewing changes to src/bin/input/build_transmat.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#define EXTERN
2
 
#include <stdio.h>
3
 
#include <stdlib.h>
4
 
#include <libciomr/libciomr.h>
5
 
#include <math.h>
6
 
#include <symmetry.h>
7
 
#include "input.h"
8
 
#include "global.h"
9
 
#include "defines.h"
10
 
 
11
 
 
12
 
/*-----------------------------------------------------------------------------------------------------------------
13
 
  This function builds global transformation matrices for each angular momentum type present in the basis
14
 
 -----------------------------------------------------------------------------------------------------------------*/
15
 
 
16
 
void build_transmat()
17
 
{
18
 
  int i,j,l;
19
 
  int irr,coeff,ao,ao_max;
20
 
  int oper,symop;
21
 
  int *xexp, *yexp, *zexp;
22
 
  int symX[8], symY[8], symZ[8];
23
 
  int max_l;
24
 
  int x,y,z;
25
 
 
26
 
    
27
 
    /*-------------------------------------------------------------------------------------
28
 
      Initialize global arrays of x, y, and z exponents for particular basis function type
29
 
     -------------------------------------------------------------------------------------*/
30
 
    xexp_ao = (int **) malloc(MAXANGMOM*sizeof(int *));
31
 
    yexp_ao = (int **) malloc(MAXANGMOM*sizeof(int *));
32
 
    zexp_ao = (int **) malloc(MAXANGMOM*sizeof(int *));
33
 
    for(l=0;l<MAXANGMOM;l++) {
34
 
      xexp_ao[l] = init_int_array(ioff[l+1]);
35
 
      yexp_ao[l] = init_int_array(ioff[l+1]);
36
 
      zexp_ao[l] = init_int_array(ioff[l+1]);
37
 
      ao = 0;
38
 
      for(i=0; i<=l; i++) {
39
 
        x = l - i;
40
 
        for(j=0; j<=i; j++) {
41
 
          y = i-j;
42
 
          z = j;
43
 
          xexp_ao[l][ao] = x;
44
 
          yexp_ao[l][ao] = y;
45
 
          zexp_ao[l][ao] = z;
46
 
          ao++;
47
 
        }
48
 
      }
49
 
    }
50
 
 
51
 
    symX[EFLAG]     =  1;  symY[EFLAG]     =  1;  symZ[EFLAG]     =  1;  
52
 
    symX[C2XFLAG]   =  1;  symY[C2XFLAG]   = -1;  symZ[C2XFLAG]   = -1;
53
 
    symX[C2YFLAG]   = -1;  symY[C2YFLAG]   =  1;  symZ[C2YFLAG]   = -1;  
54
 
    symX[C2ZFLAG]   = -1;  symY[C2ZFLAG]   = -1;  symZ[C2ZFLAG]   =  1;  
55
 
    symX[IFLAG]     = -1;  symY[IFLAG]     = -1;  symZ[IFLAG]     = -1;  
56
 
    symX[SIGXYFLAG] =  1;  symY[SIGXYFLAG] =  1;  symZ[SIGXYFLAG] = -1;  
57
 
    symX[SIGXZFLAG] =  1;  symY[SIGXZFLAG] = -1;  symZ[SIGXZFLAG] =  1;  
58
 
    symX[SIGYZFLAG] = -1;  symY[SIGYZFLAG] =  1;  symZ[SIGYZFLAG] =  1;
59
 
    
60
 
    
61
 
  
62
 
 
63
 
    /*Initialize global arrays*/
64
 
    max_l = MAX(max_angmom+1,MAXANGMOM);
65
 
    ao_type_transmat = (double ***) malloc(max_l*sizeof(double **));
66
 
    for(i=0;i<max_l;i++)
67
 
      ao_type_transmat[i] = init_matrix(nirreps,ioff[i+1]);
68
 
    num_cart_so = init_int_matrix(max_l,nirreps);
69
 
    ao_type_irr = (int **) malloc(sizeof(int *)*max_l);
70
 
    for(l=0;l<max_l;l++)
71
 
      ao_type_irr[l] = init_int_array(ioff[l+1]);
72
 
 
73
 
 
74
 
    for(l=0;l<max_l;l++) {
75
 
      xexp = xexp_ao[l];
76
 
      yexp = yexp_ao[l];
77
 
      zexp = zexp_ao[l];
78
 
      for(j=0;j<ioff[l+1];j++)
79
 
        ao_type_transmat[l][EFLAG][j] = 1.0;
80
 
      switch(l) {
81
 
        case 0:
82
 
          for(i=0;i<nirreps;i++)
83
 
            ao_type_transmat[l][i][0] = 1.0;
84
 
          break;
85
 
 
86
 
        default:
87
 
          for(i=1;i<nirreps;i++) {
88
 
            oper = sym_oper[i];
89
 
            for(j=0;j<ioff[l+1];j++)
90
 
              ao_type_transmat[l][i][j] = pow((double)symX[oper],(double)xexp[j])*
91
 
                                          pow((double)symY[oper],(double)yexp[j])*
92
 
                                          pow((double)symZ[oper],(double)zexp[j]);
93
 
          }
94
 
          break;
95
 
      }
96
 
    }
97
 
 
98
 
 
99
 
    /*--------------------------------------------------------------------------------------------
100
 
      Determine the number of cartesian SOs in each symmetry block for each angular momentum type
101
 
      and irreps to which every basis function type belongs
102
 
     --------------------------------------------------------------------------------------------*/
103
 
 
104
 
    num_cart_so[0][0] = 1;
105
 
    for(l=1;l<max_l;l++) {
106
 
      ao_max = ioff[l+1];
107
 
      for(ao=0;ao<ao_max;ao++)
108
 
        for(irr=0;irr<nirreps;irr++) {
109
 
          coeff = 0;
110
 
          for(symop=0;symop<nirreps;symop++)
111
 
            coeff += ao_type_transmat[l][symop][ao]*irr_char[irr][symop];
112
 
          if (coeff != 0) {
113
 
            ao_type_irr[l][ao] = irr;
114
 
            num_cart_so[l][irr]++;
115
 
          }
116
 
        }
117
 
    }
118
 
 
119
 
    /*
120
 
    fprintf(outfile,"  Transformation matrices :\n\n");
121
 
    for(l=0;l<max_l;l++) {
122
 
      fprintf(outfile,"   l = %d\n",l);
123
 
      for(i=0;i<nirreps;i++) {
124
 
        fprintf(outfile,"Symmetry Operation %d\n",i);
125
 
        for(j=0;j<ioff[l+1];j++)
126
 
          fprintf(outfile," %d  %lf\n",j+1,ao_type_transmat[l][i][j]);
127
 
        fprintf(outfile,"\n");
128
 
      }
129
 
      fprintf(outfile,"\n");
130
 
    }
131
 
    */
132
 
    
133
 
    return;
134
 
}
135
 
 
136
 
 
137