~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/nwdft/rt_tddft/rtutils/rt_tddft_moocc.F

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
C====================================================================
 
2
C
 
3
C     Calculates the time-dependent occupations of the molecular orbitals.
 
4
C
 
5
C     n_k(t) = C'_k^+ P'(t) C'_k
 
6
C
 
7
C     where C'_k is the k^th eigenvector of the ground state Fock
 
8
C     matrix, and P' is the density matrix in the MO basis.  Note that P
 
9
C     is complex, but C' is real since it is from the SCF.  This means
 
10
C     that we can just use the real part of the dens mat, and take
 
11
C     transpose of C' instead of conjg transpose.
 
12
C
 
13
C     Note, you can send this either the full dens mat, or just the
 
14
C     alpha or beta spin part.
 
15
C
 
16
C     Note, can also compute using matrix multiplications (XXX double check):
 
17
C     n_k(t) = [C'^+ P'(t) C']_kk
 
18
C
 
19
      subroutine rt_tddft_moocc_calc (params, g_densre_mo, g_movecs_gs,
 
20
     $     moocc)
 
21
      implicit none
 
22
 
 
23
#include "errquit.fh"
 
24
#include "mafdecls.fh"
 
25
#include "stdio.fh"
 
26
#include "global.fh"
 
27
#include "msgids.fh"
 
28
#include "geom.fh"
 
29
#include "util.fh"
 
30
#include "rt_tddft.fh"
 
31
#include "matutils.fh"      
 
32
 
 
33
C     == Inputs ==
 
34
      type (rt_params_t), intent(in) :: params
 
35
      integer, intent(in)            :: g_densre_mo  !re part of density matrix in MO basis
 
36
      integer, intent(in)            :: g_movecs_gs  !ground state movecs
 
37
 
 
38
 
 
39
C     == Outputs ==
 
40
      double precision, intent(out) :: moocc(*) !MO occupations
 
41
 
 
42
      
 
43
C     == Parameters ==
 
44
      character(*),parameter :: pname = "rt_tddft_moocc: "
 
45
 
 
46
 
 
47
C     == Variables ==
 
48
      integer me
 
49
      integer i
 
50
      integer lveck, iveck      !handle and index for kth eigenvector
 
51
      double precision occk     !occupation of orbital k
 
52
      integer g_veck, g_tmp, g_veckt
 
53
      integer k
 
54
      double precision dval
 
55
 
 
56
      me = ga_nodeid()
 
57
 
 
58
      
 
59
      if (.not. ga_create(mt_dbl, params%ns_mo, 1,
 
60
     $     "k^th evec", 0, 0, g_veck))
 
61
     $     call errquit ("failed to create veck", 0, GA_ERR)
 
62
 
 
63
      if (.not. ga_duplicate(g_veck, g_tmp, "moocc tmp"))
 
64
     $     call errquit ("failed to create g_tmp", 0, GA_ERR)
 
65
 
 
66
      if (.not. ga_duplicate(g_veck, g_veckt, "col of transpose C"))
 
67
     $     call errquit ("failed to create g_tmp", 0, GA_ERR)
 
68
 
 
69
C
 
70
C     Load k^th evec in g_veck and k^th column of C in g_vectk.
 
71
C
 
72
      do k = 1, params%ns_mo
 
73
CXXX  [KAL]: its redundant to have two g_veck
 
74
 
 
75
         call ga_zero (g_veck)
 
76
         call ga_zero (g_veckt)
 
77
         call ga_zero (g_tmp)
 
78
 
 
79
         call ga_copy_patch ("N",
 
80
     $        g_movecs_gs, 1, params%ns_mo, k, k,
 
81
     $        g_veck, 1, params%ns_mo, 1, 1)
 
82
         call ga_copy_patch ("T",
 
83
     $        g_movecs_gs, 1, params%ns_mo, k, k,
 
84
     $        g_veckt, 1, params%ns_mo, 1, 1)
 
85
 
 
86
 
 
87
C     Compute P'(t) C'_k.
 
88
         call ga_dgemm ("N", "N", params%ns_mo, 1, params%ns_mo,
 
89
     $        1d0, g_densre_mo, g_veck, 0d0, g_tmp)
 
90
 
 
91
         
 
92
C     Compute n_k = C'_k^T P'(t) C'_k.
 
93
         
 
94
         moocc(k) = ga_ddot (g_veckt, g_tmp)
 
95
      enddo
 
96
 
 
97
 
 
98
C     == Clean up ==
 
99
      if (.not. ga_destroy(g_veck))
 
100
     $     call errquit ("failed to destroy g_veck", 0, GA_ERR)
 
101
      if (.not. ga_destroy(g_tmp))
 
102
     $     call errquit ("failed to destroy g_tmp", 0, GA_ERR)
 
103
      if (.not. ga_destroy(g_veckt))
 
104
     $     call errquit ("failed to destroy g_tmp", 0, GA_ERR)
 
105
 
 
106
      end subroutine
 
107
 
 
108
 
 
109
C====================================================================
 
110
      subroutine rt_tddft_moocc_print (params, tt, moocc, moocc_tag)
 
111
      implicit none
 
112
 
 
113
#include "stdio.fh"
 
114
#include "global.fh"
 
115
#include "rt_tddft.fh"
 
116
 
 
117
 
 
118
C     == Inputs ==
 
119
      type(rt_params_t), intent(in) :: params
 
120
C      integer, intent(in)           :: it
 
121
      double precision, intent(in)  :: tt
 
122
      double precision, intent(in)  :: moocc(params%ns_mo)
 
123
      character(*), intent(in)      :: moocc_tag
 
124
 
 
125
 
 
126
C     == Parameters ==
 
127
      character(*), parameter :: pname = "rt_tddft_moocc_print: "
 
128
 
 
129
      
 
130
C     == Variables ==      
 
131
      integer me
 
132
      integer k
 
133
 
 
134
      me = ga_nodeid()
 
135
 
 
136
      if (params%nt < 1) call errquit (pname//"nt must be > 0", 0, 0)
 
137
      
 
138
      if (me.eq.0) then
 
139
 
 
140
 
 
141
C
 
142
C     Write rt-tddft tag and current time
 
143
C
 
144
         write (luout, "(a,2x,1f11.5)", advance="no")
 
145
     $        trim(params%tag), tt
 
146
         
 
147
C     $        trim(params%tag), it*100/params%nt, "% ", tt
 
148
         
 
149
         
 
150
C
 
151
C     Loop over all MOs and print
 
152
C     
 
153
         do k = 1, params%ns_mo
 
154
            write (luout, "(1es22.12e3)", advance="no") moocc(k)
 
155
         enddo
 
156
 
 
157
C
 
158
C     Print tag and finish line
 
159
C     
 
160
         write(luout, *) "    "//moocc_tag
 
161
         
 
162
      endif
 
163
      
 
164
      call util_flush (luout)
 
165
 
 
166
      end subroutine
 
167
 
 
168