File: write_eig_data.F

package info (click to toggle)
aces3 3.0.6-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 82,460 kB
  • sloc: fortran: 225,647; ansic: 20,413; cpp: 4,349; makefile: 953; sh: 137
file content (194 lines) | stat: -rw-r--r-- 6,083 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
C  Copyright (c) 2003-2010 University of Florida
C
C  This program is free software; you can redistribute it and/or modify
C  it under the terms of the GNU General Public License as published by
C  the Free Software Foundation; either version 2 of the License, or
C  (at your option) any later version.

C  This program is distributed in the hope that it will be useful,
C  but WITHOUT ANY WARRANTY; without even the implied warranty of
C  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
C  GNU General Public License for more details.

C  The GNU General Public License is included in this distribution
C  in the file COPYRIGHT.
      subroutine write_eig_data(ca, cb, focka, fockb, n, need_predef)
c---------------------------------------------------------------------------
c   Writes eigenvector/eigenvalue data to jobarc file.
c---------------------------------------------------------------------------
      implicit none
      include 'int_gen_parms.h'
      include 'machine_types.h'
#ifdef ALTIX
      include 'sheap.h'
#endif

      integer n
      logical need_predef(*)
      double precision ca(n,n), cb(n,n), focka(n,n), fockb(n,n)
      double precision scr(n)

      integer i, j, ierd

      double precision dbuf(1)
      integer ibuf(1)
#ifdef ALTIX
      pointer (iptr, ibuf)
      pointer (dptr, dbuf)
#else
      equivalence (ibuf(1), dbuf(1))
      common dbuf
#endif

#ifdef ALTIX
      iptr = ishptr
      dptr = dshptr
#endif
      if (intpkg .eq. flocke_package) then

c---------------------------------------------------------------------------
c   Transform the CA and CB data from ERD order/scaling to VMOL order/scaling.
c---------------------------------------------------------------------------

         if (need_predef(1) .or.
     *       need_predef(2)) then
            do j = 1, n
               do i = 1, n
                  scr(i) = ca(i,j)
               enddo

               do i = 1, n
                  ierd = ibuf(ierdind+i-1)
                  ca(ierd,j) = scr(i)/dbuf(iscale_fac+ierd-1)
               enddo
            enddo   
         endif

         if (need_predef(3)) then 
            do j = 1, n
               do i = 1, n
                  scr(i) = cb(i,j)
               enddo

               do i = 1, n
                  ierd = ibuf(ierdind+i-1)
                  cb(ierd,j) = scr(i)/dbuf(iscale_fac+ierd-1)
               enddo
            enddo
         endif   

c---------------------------------------------------------------------------
c   Save the diagonals of the FOCKA array.
c---------------------------------------------------------------------------

         if (need_predef(9)) then
            do i = 1, n
               scr(i) = focka(i,i)
            enddo

c---------------------------------------------------------------------------
c   Unscramble the shells from the binpack'ed order.
c---------------------------------------------------------------------------

            call descramble_coefficients(ca, n, scr, nfps, ixshells, 
     *                                nshells)

            do i = 1, n
               focka(i,i) = scr(i)
            enddo
         endif   

c---------------------------------------------------------------------------
c   Save the diagonals of the FOCKB array.
c---------------------------------------------------------------------------

         if (need_predef(10)) then
            do i = 1, n
               scr(i) = fockb(i,i)
            enddo

c---------------------------------------------------------------------------
c   Unscramble the shells from the binpack'ed order.
c---------------------------------------------------------------------------

            call descramble_coefficients(cb, n, scr, nfps, ixshells,
     *                                nshells)

            do i = 1, n
               fockb(i,i) = scr(i)
            enddo
         endif  ! need_predef
      endif     ! flocke_package

c---------------------------------------------------------------------------
c   Write the eigenvector data to JOBARC.
c---------------------------------------------------------------------------

         if (need_predef(1) .or.
     *       need_predef(2)) then
            call dputrec(1,'JOBARC','SCFEVCA0',n*n, ca)
         endif

         if (need_predef(3)) then
            call dputrec(1,'JOBARC','SCFEVCB0',n*n, cb)
         endif

c---------------------------------------------------------------------------
c   Write the eigenvalue data to JOBARC.
c---------------------------------------------------------------------------

      if (need_predef(9)) then
         do i = 1, n
            scr(i) = focka(i,i)
         enddo

         call dputrec(1, 'JOBARC', 'SCFEVLA0',n, scr)
      endif

c---------------------------------------------------------------------------
c   Write the data to JOBARC.
c---------------------------------------------------------------------------

      if (need_predef(10)) then
         do i = 1, n
            scr(i) = fockb(i,i)
         enddo

         call dputrec(1, 'JOBARC', 'SCFEVLB0',n, scr)
      endif

c---------------------------------------------------------------------------
c   Write out OCCUPYA0, OCCUPYB0.
c---------------------------------------------------------------------------

      call iputrec(1, 'JOBARC', 'OCCUPYA0', 1, nalpha_occupied)
      call iputrec(1, 'JOBARC', 'OCCUPYB0', 1, nbeta_occupied)

c---------------------------------------------------------------------------
c   Write out the SCFOCCA and SCFOCCB values.
c---------------------------------------------------------------------------

      do i = 1, n
         if (i .le. nalpha_occupied) then
            scr(i) = 1.
         else
            scr(i) = 0.
         endif
      enddo

      call dputrec(1, 'JOBARC', 'SCFOCCA', nalpha_occupied, scr)

      do i = 1, n
         if (i .le. nbeta_occupied) then
            scr(i) = 1.
         else
            scr(i) = 0.
         endif
      enddo

      call dputrec(1, 'JOBARC', 'SCFOCCB', nbeta_occupied, scr)


      return
      end