-
Notifications
You must be signed in to change notification settings - Fork 5
/
AlphaPolar.f
190 lines (129 loc) · 4.72 KB
/
AlphaPolar.f
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
module Embedded_FF_Alpha
use type_m
use f95_precision
use blas95
use lapack95
use constants_m
use parameters_m , only : EnvField_, Induced_ , verbose
use Overlap_Builder , only : Overlap_Matrix
use Hamiltonians , only : X_ij , even_more_extended_Huckel
use DP_main_m , only : DP_matrix_AO , Dipole_Moment
public :: AlphaPolar
private
! module variables ...
real*8 , ALLOCATABLE :: H0(:,:) , S(:,:)
contains
!=======================================
subroutine AlphaPolar( system , basis )
!=======================================
implicit none
type(structure) , intent(inout) :: system
type(STO_basis) , intent(in) :: basis(:)
! local variables ...
integer :: mm , i , j , xyz
real*8 :: alpha_ii(3)
real*8 , ALLOCATABLE :: H(:,:) , DP_AO(:,:)
type(R_eigen) :: UNI
type(R3_vector) :: Induced(-2:2)
! local parameters ...
real*8 , parameter :: base_Field = 5.0d-4 ! <== in Volts/Angs ...
real*8 , parameter :: Debye_unit = 4.803204d0 ! <== 1e*d[Angs]*4.803204 = p[Debye]
real*8 , parameter :: factor = 14.39965173d0 ! <== 1e/Volt = 14.399 Angs
mm = size(basis)
! build the field independent H and S matrices ...
CALL Build_H0_and_S( system , basis )
ALLOCATE( H(mm,mm) , source=D_zero )
! field dependent hamiltonian and Induced DP moments (DP is calculated in Debyes) ...
ALLOCATE( DP_AO(mm,mm) , source=D_zero )
! for each molecular axis F_xyz ...
do xyz = 1 , 3
select case ( xyz )
case (1)
forall( i=1:mm , j=1:mm ) DP_AO(i,j) = DP_matrix_AO(i,j,xyz) + basis(i)%x*S(i,j)
case (2)
forall( i=1:mm , j=1:mm ) DP_AO(i,j) = DP_matrix_AO(i,j,xyz) + basis(i)%y*S(i,j)
case (3)
forall( i=1:mm , j=1:mm ) DP_AO(i,j) = DP_matrix_AO(i,j,xyz) + basis(i)%z*S(i,j)
end select
do i = -2 , 2
If( i /= 0 ) then
H(:,:) = H0(:,:) + DP_AO(:,:)*base_Field*float(i)
CALL Eigenstates( H , UNI )
! Dipole moment in Debye ...
CALL Dipole_Moment( system , basis , UNI%L , UNI%R , DP_total=Induced(i)%DP )
end if
end do
! diagonal elements of the Alpha tensor , JCP 109, 7756 (1998) ...
Alpha_ii(xyz) = two/three * (Induced(1)%DP(xyz) - Induced(-1)%DP(xyz)) - D_one/twelve * (Induced(2)%DP(xyz) - Induced(-2)%DP(xyz))
! diagonal elements of the polarizability tensor in Angs^{3} ...
Alpha_ii(xyz) = ( (Alpha_ii(xyz)/Debye_unit) / base_Field ) * factor
end do
Print 188 , Alpha_ii , sum( Alpha_ii ) / three
Print 189 , Alpha_ii / (a_Bohr*a_Bohr*a_Bohr) , sum( Alpha_ii ) / (three*a_Bohr*a_Bohr*a_Bohr)
DEALLOCATE( H , H0 , S , DP_AO )
include 'formats.h'
end subroutine AlphaPolar
!
!
!
!
!===========================================
subroutine Build_H0_and_S( system , basis )
!===========================================
implicit none
type(structure) , intent(in) :: system
type(STO_basis) , intent(in) :: basis(:)
! local variables ...
integer :: i , j
verbose = .NOT. verbose
CALL Overlap_Matrix( system , basis , S )
ALLOCATE( H0(size(basis),size(basis)) , source=D_zero)
If( EnvField_ .OR. Induced_ ) then
H0(:,:) = even_more_extended_Huckel( system , basis , S )
else
do j = 1 , size(basis)
do i = 1 , j
H0(i,j) = X_ij( i , j , basis ) * S(i,j)
end do
end do
end if
end subroutine Build_H0_and_S
!
!
!
!================================
subroutine Eigenstates( H , QM )
!================================
implicit none
real*8 , allocatable , intent(inout) :: H(:,:)
type(R_eigen) , intent(inout) :: QM
! local variables ...
integer :: mm , info
real*8 , ALLOCATABLE :: Lv(:,:) , Rv(:,:)
real*8 , ALLOCATABLE :: dumb_s(:,:)
mm = size( H(:,1) )
ALLOCATE( dumb_S(mm,mm) , source=S )
If( .NOT. allocated(QM%erg) ) ALLOCATE( QM%erg(mm) )
CALL SYGVD( H , dumb_S , QM%erg , 1 , 'V' , 'U' , info )
DEALLOCATE(dumb_S)
ALLOCATE( Lv(mm,mm) )
Lv = H
ALLOCATE( Rv(mm,mm) )
CALL gemm( S , Lv , Rv , 'N' , 'N' , D_one , D_zero )
!----------------------------------------------------------
! normalizes the L&R eigenvectors as < L(i) | R(i) > = 1
If( .NOT. allocated(QM%L) ) ALLOCATE( QM%L(mm,mm) )
! eigenvectors in the rows of QM%L
QM%L = transpose(Lv)
DEALLOCATE( Lv )
If( .NOT. ALLOCATED(QM%R) ) ALLOCATE( QM%R(mm,mm) )
! eigenvectors in the columns of QM%R
QM%R = Rv
DEALLOCATE( Rv )
! the order of storage is the ascending order of eigenvalues
!----------------------------------------------------------
end subroutine Eigenstates
!
!
!
end module Embedded_FF_Alpha