~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/cscf/rotate_vector.cc

  • 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
/*! \file
 
2
    \ingroup CSCF
 
3
    \brief Enter brief description of file here 
 
4
*/
 
5
/* $Log$
 
6
 * Revision 1.1  2000/02/04 22:52:32  evaleev
 
7
 * Initial revision
 
8
 *
 
9
/* Revision 1.2  1999/08/17 19:04:17  evaleev
 
10
/* Changed the default symmetric orthogonalization to the canonical
 
11
/* orthogonalization. Now, if near-linear dependencies in the basis are found,
 
12
/* eigenvectors of the overlap matrix with eigenvalues less than 1E-6 will be
 
13
/* left out. This will lead to num_mo != num_so, i.e. SCF eigenvector is no
 
14
/* longer a square matrix. Had to rework some routines in libfile30, and add some.
 
15
/* The progrem prints out a warning if near-linear dependencies are found. TRANSQT
 
16
/* and a whole bunch of other codes has to be fixed to work with such basis sets.
 
17
/*
 
18
/* Revision 1.1.1.1  1999/04/12 16:59:27  evaleev
 
19
/* Added a version of CSCF that can work with CINTS.
 
20
/* -Ed
 
21
 * */
 
22
 
 
23
#define EXTERN
 
24
#include "includes.h"
 
25
#include "common.h"
 
26
 
 
27
namespace psi { namespace cscf {
 
28
 
 
29
void check_rot(int nn, int num_mo, double **cold, double **cnew, 
 
30
  double *smat_pac, double *fock_evals, int irrep);
 
31
extern void formg_two(int iju, int* optest);
 
32
extern void formg_open();
 
33
 
 
34
void rotate_vector()
 
35
{
 
36
   int i,j,ij,k,nn,num_mo;
 
37
   int nc,no;
 
38
   int joff,oj;
 
39
   int *optest,iju=0;
 
40
   double **scr1,**scr2,**scr3;
 
41
   double tol=1.0e-15;
 
42
   struct symm *s;
 
43
 
 
44
   scr1 = (double **) init_matrix(nsfmax,nsfmax);
 
45
   scr2 = (double **) init_matrix(nsfmax,nsfmax);
 
46
   scr3 = (double **) init_matrix(nsfmax,nsfmax);
 
47
 
 
48
   dmat();
 
49
 
 
50
   if(twocon) {
 
51
      /* optest = (int *) init_array(ioff[nbasis]/2); */
 
52
      optest = (int *) init_int_array(ioff[nbasis]);
 
53
 
 
54
/* find open shells */
 
55
 
 
56
      for (i=0; i < num_ir ; i++) {
 
57
         iju += scf_info[i].num_so;
 
58
         if(scf_info[i].nopen) {
 
59
            iju = ioff[iju];
 
60
            break;
 
61
            }
 
62
         }
 
63
 
 
64
/* set up array of flags indicating open shells */
 
65
 
 
66
      for (k=0,joff=0; k < num_ir ; k++) {
 
67
         s = &scf_info[k];
 
68
         if (nn=s->num_so) {
 
69
            for (i=0; i < nn ; i++)
 
70
               for (j=0; j <= i ; j++)
 
71
                  if(s->nopen) optest[ioff[i+joff]+j+joff] = 1;
 
72
            joff += nn;
 
73
            }
 
74
         }
 
75
 
 
76
      formg_two(iju,optest);
 
77
      }
 
78
   else formg_open();
 
79
 
 
80
   for(i=0; i < num_ir ; i++) {
 
81
      s = &scf_info[i];
 
82
      if(nn=s->num_so) {
 
83
         num_mo = s->num_mo;
 
84
         nc=s->nclosed;
 
85
         no=s->nopen;
 
86
         add_arr(s->hmat,s->gmat,s->fock_pac,ioff[nn]);
 
87
 
 
88
         tri_to_sq(s->fock_pac,scr1,nn);
 
89
         mmult(s->cmat,1,scr1,0,scr2,0,num_mo,nn,nn,0);
 
90
         mmult(scr2,0,s->cmat,0,scr1,0,num_mo,nn,num_mo,0);
 
91
 
 
92
         zero_mat(scr2,nn,nn);
 
93
         for(j=0; j < nc ; j++)
 
94
            for(k=0; k < nc ; k++)
 
95
               scr2[j][k]=scr1[j][k];
 
96
         for(j=nc; j < nc+no ; j++)
 
97
            for(k=nc; k < nc+no ; k++)
 
98
               scr2[j][k]=scr1[j][k];
 
99
         for(j=nc+no; j < num_mo ; j++)
 
100
            for(k=nc+no; k < num_mo ; k++)
 
101
               scr2[j][k]=scr1[j][k];
 
102
 
 
103
         sq_rsp(num_mo,num_mo,scr2,s->fock_evals,1,scr3,tol);
 
104
 
 
105
         mmult(s->cmat,0,scr3,0,scr2,0,nn,num_mo,num_mo,0);
 
106
 
 
107
         if (icheck_rot)
 
108
           check_rot(nn, num_mo, s->cmat, scr2, s->smat, s->fock_evals, i);
 
109
 
 
110
         for(j=0; j < nn ; j++)
 
111
            for(k=0; k < num_mo ; k++)
 
112
               s->cmat[j][k]=scr2[j][k];
 
113
 
 
114
         }
 
115
      }
 
116
   free_matrix(scr1,nsfmax);
 
117
   free_matrix(scr2,nsfmax);
 
118
   free_matrix(scr3,nsfmax);
 
119
   }
 
120
 
 
121
}} // namespace psi::cscf