Line data Source code
1 : !--------------------------------------------------------------------------------
2 : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
3 : ! This file is part of FLEUR and available as free software under the conditions
4 : ! of the MIT license as expressed in the LICENSE file in more detail.
5 : !--------------------------------------------------------------------------------
6 :
7 : module m_wann_dipole3
8 : contains
9 0 : subroutine wann_dipole3(
10 0 : > jspins_in,omtil,natd,pos,
11 0 : > amat,bmat,taual,num_wann,
12 0 : > ntype,neq,zatom,l_nocosoc)
13 : c***************************************
14 : c Calculate electronic polarization.
15 : c Frank Freimuth
16 : c***************************************
17 : use m_wann_dipole_electronic
18 : use m_wann_dipole_takehome
19 : use m_wann_dipole_ionic
20 :
21 : implicit none
22 : integer,intent(in) :: jspins_in
23 : real,intent(in) :: omtil
24 : integer,intent(in) :: natd
25 : real,intent(in) :: pos(3,natd)
26 : real,intent(in) :: amat(3,3),bmat(3,3)
27 : real,intent(in) :: taual(3,natd)
28 : integer,intent(in) :: num_wann(2)
29 : integer,intent(in) :: ntype
30 : integer,intent(in) :: neq(ntype)
31 : real,intent(in) :: zatom(ntype)
32 : logical,intent(in) :: l_nocosoc
33 :
34 : integer :: jspins
35 : integer :: nwfs,i
36 : integer :: num_atoms
37 : integer :: j,k,ind,jj,jspin
38 : real,allocatable :: ioncharge(:)
39 : character(len=2),allocatable :: namat(:)
40 : character(len=2) :: symbol
41 : real,allocatable :: wann_centers(:,:)
42 : integer,allocatable :: wann_of_at(:)
43 : real :: polarization,charge
44 : integer :: num_symbols
45 : real :: ionic_moment(3)
46 : real :: shifted_polari(3)
47 : real :: size_polari
48 : real :: smallest_polari
49 : real :: final_polarization(3)
50 : real :: final_moment(3)
51 : real :: electronic_polari(3,2)
52 : real :: electronic_moment(3,2)
53 : real,parameter :: elemchargmu=1.60217646e-13
54 : real,parameter :: bohrtocm=0.529177e-8
55 : character*2 :: namat2(0:103)
56 : character(len=2) :: spin12(0:2)
57 :
58 : character(len=6) :: filename
59 : logical :: l_file
60 : real :: pos_inv(3,natd)
61 : real :: taual_inv(3,natd)
62 : real :: coordinate
63 : integer :: nwf
64 : integer,allocatable :: waind(:)
65 : integer :: yesorno
66 :
67 : data spin12/' ', '.1', '.2'/
68 0 : call timestart("wann_dipole3")
69 0 : jspins=jspins_in
70 0 : yesorno=1
71 0 : if(l_nocosoc)then
72 0 : jspins=1
73 0 : yesorno=0
74 : endif
75 0 : open(666,file='polarization_out')
76 :
77 : c-----calculate ionic contribution
78 0 : ionic_moment=0.0
79 : call wann_dipole_ionic(
80 : > natd,pos,omtil,
81 : > amat,taual,ntype,
82 : > neq,zatom,.false.,
83 : > .true.,
84 0 : < ionic_moment)
85 :
86 : c-----calculate electronic contribution
87 0 : electronic_moment=0.0
88 : call wann_dipole_electronic(
89 : > natd,pos,omtil,
90 : > jspins,.false.,num_wann,
91 0 : < electronic_moment)
92 :
93 : c-----sum up terms
94 0 : write(666,*)"*****************************"
95 0 : write(666,*)" Sum of terms "
96 0 : write(666,*)"*****************************"
97 0 : write(*,*) "*****************************"
98 0 : write(*,*) " Sum of terms "
99 0 : write(*,*) "*****************************"
100 : final_moment(:) = electronic_moment(:,1) +
101 : + electronic_moment(:,jspins)*yesorno +
102 0 : + ionic_moment(:)
103 0 : write(*, fmt=555)final_moment(:)
104 0 : write(666,fmt=555)final_moment(:)
105 : final_polarization = final_moment /
106 0 : / omtil*elemchargmu/((bohrtocm)**2)
107 0 : write(*, fmt=777)final_polarization(:)
108 0 : write(666,fmt=777)final_polarization(:)
109 :
110 : c-----Check if the polarization may be reduced by adding
111 : c-----contributions due to electrons shifted by primitive
112 : c-----lattice translations. This is the solution to the
113 : c-----problem of Wannier functions being pulled away from
114 : c-----their host atom to a mirror host atom during the
115 : c-----Wannierization process.
116 : call wann_dipole_takehome(
117 : > jspins,.false.,
118 : > amat,bmat,omtil,
119 0 : < electronic_moment)
120 :
121 : c-----sum up terms
122 0 : write(666,*)"*****************************"
123 0 : write(666,*)" Sum of terms "
124 0 : write(666,*)"*****************************"
125 0 : write(*,*) "*****************************"
126 0 : write(*,*) " Sum of terms "
127 0 : write(*,*) "*****************************"
128 : final_moment(:) = electronic_moment(:,1) +
129 : + electronic_moment(:,jspins)*yesorno +
130 0 : + ionic_moment(:)
131 0 : write(*, fmt=555)final_moment(:)
132 0 : write(666,fmt=555)final_moment(:)
133 : final_polarization = final_moment /
134 0 : / omtil*elemchargmu/((bohrtocm)**2)
135 0 : write(*, fmt=777)final_polarization(:)
136 0 : write(666,fmt=777)final_polarization(:)
137 :
138 0 : close(666)
139 :
140 : 555 format("final moment = (",3f12.6,")a.u.")
141 : 777 format("final polarization = (",3f12.6,")uC/cm**2")
142 :
143 0 : call timestop("wann_dipole3")
144 0 : end subroutine wann_dipole3
145 : end module m_wann_dipole3
|