13 integer,
parameter ::
dp = kind(1.0d0)
35 type(bml_matrix_t),
intent(in) :: rho_bml
36 type(bml_matrix_t),
intent(in) :: ham_bml
37 type(bml_matrix_t) :: aux_bml
38 type(bml_matrix_t),
intent(inout) :: pcm_bml
39 integer,
intent(in) :: m
40 integer :: norb, verbose
41 real(
dp),
intent(in) :: threshold
42 character(20),
intent(in) :: bml_type
44 if(verbose.eq.2)
write(*,*)
"In prg_PulayComponent0 ..."
46 norb = bml_get_n(rho_bml)
48 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb ,norb,aux_bml)
50 if(bml_get_n(pcm_bml).le.0)
then
51 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb,norb,pcm_bml)
53 call bml_deallocate(pcm_bml)
54 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb,norb,pcm_bml)
57 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb ,norb,pcm_bml)
59 call bml_multiply(rho_bml, ham_bml, aux_bml, 1.0d0, 1.0d0,threshold)
61 call bml_multiply(aux_bml,rho_bml,pcm_bml, 1.0d0, 1.0d0,threshold)
63 call bml_scale(0.5_dp, pcm_bml)
65 call bml_deallocate(aux_bml)
86 type(bml_matrix_t),
intent(in) :: rho_bml
87 type(bml_matrix_t),
intent(in) :: ham_bml
88 type(bml_matrix_t),
intent(in) :: zmat_bml
89 type(bml_matrix_t) :: aux_bml
90 type(bml_matrix_t) :: aux1_bml
91 type(bml_matrix_t),
intent(inout) :: pcm_bml
92 integer,
intent(in) :: m
93 integer :: norb, verbose
94 real(
dp),
intent(in) :: threshold
95 character(20),
intent(in) :: bml_type
97 if(verbose.eq.2)
write(*,*)
"In prg_PulayComponentT ..."
99 norb = bml_get_n(rho_bml)
101 if(bml_get_n(pcm_bml).le.0)
then
102 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb,norb,pcm_bml)
104 call bml_deallocate(pcm_bml)
105 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb,norb,pcm_bml)
108 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb ,norb,aux_bml)
109 call bml_zero_matrix(bml_type,bml_element_real,
dp,norb ,norb,aux1_bml)
111 if(bml_get_n(zmat_bml).lt.0)
then
112 stop
'ERROR: zmat_bml not allocated'
115 call bml_multiply(zmat_bml,zmat_bml,aux_bml,1.0d0,1.0d0,threshold)
117 call bml_multiply(aux_bml,ham_bml,pcm_bml,1.0d0,1.0d0,threshold)
119 call bml_multiply(pcm_bml,rho_bml,aux1_bml,1.0d0,1.0d0,threshold)
121 call bml_scale(0.0_dp, pcm_bml)
123 call bml_multiply(ham_bml,aux_bml,pcm_bml,1.0d0,1.0d0,threshold)
125 call bml_scale(0.0_dp, aux_bml)
127 call bml_multiply(rho_bml,pcm_bml,aux_bml,1.0d0,1.0d0,threshold)
129 call bml_add_deprecated(0.5d0,aux_bml,0.5d0,aux1_bml)
131 call bml_copy(aux_bml,pcm_bml)
133 call bml_deallocate(aux_bml)
134 call bml_deallocate(aux1_bml)
151 dSx_bml,dSy_bml,dSz_bml,hindex,FPUL,threshold)
153 real(
dp),
allocatable,
intent(inout) :: fpul(:,:)
154 integer,
intent(in) :: nats
155 type(bml_matrix_t),
intent(in) :: dsx_bml, dsy_bml, dsz_bml
156 type(bml_matrix_t),
intent(in) :: rho_bml, ham_bml, zmat_bml
157 integer,
intent(in) :: hindex(:,:)
158 integer :: i_a, i_b, i , j, norb
159 real(
dp),
intent(in) :: threshold
160 type(bml_matrix_t) :: xtmp_bml, ytmp_bml, ztmp_bml, sihd_bml
161 type(bml_matrix_t) :: aux_bml
162 real(
dp),
allocatable :: diagxtmp(:), diagytmp(:), diagztmp(:)
165 write(*,*)
"In prg_get_pulayforce ..."
167 if(.not.
allocated(fpul))
then
168 allocate(fpul(3,nats))
173 norb = bml_get_n(rho_bml)
176 call bml_copy_new(zmat_bml,sihd_bml)
177 call bml_copy_new(zmat_bml,aux_bml)
178 call bml_transpose(zmat_bml,aux_bml)
179 call bml_multiply(zmat_bml,aux_bml,sihd_bml,2.0_dp,0.0_dp,threshold)
180 call bml_multiply(sihd_bml,ham_bml,aux_bml,1.0_dp,0.0_dp,threshold)
181 call bml_multiply(aux_bml,rho_bml,sihd_bml,1.0_dp,0.0_dp,threshold)
182 call bml_deallocate(aux_bml)
184 call bml_copy_new(rho_bml,xtmp_bml)
185 allocate(diagxtmp(norb))
186 call bml_multiply(dsx_bml,sihd_bml,xtmp_bml,1.0_dp,0.0_dp,threshold)
187 call bml_get_diagonal(xtmp_bml,diagxtmp)
188 call bml_deallocate(xtmp_bml)
190 call bml_copy_new(rho_bml,ytmp_bml)
191 allocate(diagytmp(norb))
192 call bml_multiply(dsy_bml,sihd_bml,ytmp_bml,1.0_dp,0.0_dp,threshold)
193 call bml_get_diagonal(ytmp_bml,diagytmp)
194 call bml_deallocate(ytmp_bml)
196 call bml_copy_new(rho_bml,ztmp_bml)
197 allocate(diagztmp(norb))
198 call bml_multiply(dsz_bml,sihd_bml,ztmp_bml,1.0_dp,0.0_dp,threshold)
199 call bml_get_diagonal(ztmp_bml,diagztmp)
200 call bml_deallocate(ztmp_bml)
202 call bml_deallocate(sihd_bml)
213 partrace = partrace + diagxtmp(j)
215 fpul(1,i) = partrace;
219 partrace = partrace + diagytmp(j)
221 fpul(2,i) = partrace;
225 partrace = partrace + diagztmp(j)
227 fpul(3,i) = partrace;
Produces a matrix to get the Pulay Component of the forces.
subroutine, public prg_pulaycomponentt(rho_bml, ham_bml, zmat_bml, pcm_bml, threshold, M, bml_type, verbose)
At , .
subroutine, public prg_get_pulayforce(nats, zmat_bml, ham_bml, rho_bml, dSx_bml, dSy_bml, dSz_bml, hindex, FPUL, threshold)
Pulay Force FPUL from .
subroutine, public prg_pulaycomponent0(rho_bml, ham_bml, pcm_bml, threshold, M, bml_type, verbose)
At , .