The Elk Code
 
Loading...
Searching...
No Matches
vecplot.f90
Go to the documentation of this file.
1
2! Copyright (C) 2002-2006 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6!BOP
7! !ROUTINE: vecplot
8! !INTERFACE:
9subroutine vecplot
10! !DESCRIPTION:
11! Outputs a 2D or 3D vector field for plotting. The vector field can be the
12! magnetisation vector field, ${\bf m}$; the exchange-correlation magnetic
13! field, ${\bf B}_{\rm xc}$; or the electric field
14! ${\bf E}\equiv-\nabla V_{\rm C}$. The magnetisation is obtained from the
15! spin density matrix, $\rho_{\alpha\beta}$, by solving
16! $$ \rho_{\alpha\beta}({\bf r})=\frac{1}{2}\left(n({\bf r})
17! \delta_{\alpha\beta}+\sigma\cdot {\bf m}({\bf r})\right), $$
18! where $n\equiv\tr\rho_{\alpha\beta}$ is the total density. In the case of 2D
19! plots, the magnetisation vectors are still 3D, but are in the coordinate
20! system of the plane.
21!
22! !REVISION HISTORY:
23! Created August 2004 (JKD)
24! Included electric field plots, August 2006 (JKD)
25!EOP
26!BOC
27use modmain
28implicit none
29! allocatable arrays
30real(8), allocatable :: rvfmt(:,:,:),rvfir(:,:)
31! initialise universal variables
32call init0
33if ((task == 72).or.(task == 73).or.(task == 82).or.(task == 83)) then
34 if (.not.spinpol) then
35 write(*,*)
36 write(*,'("Error(vecplot): spin-unpolarised magnetisation/field is zero")')
37 write(*,*)
38 stop
39 end if
40end if
41! read magnetisation and exchange-correlation magnetic field from file
42call readstate
43allocate(rvfmt(npmtmax,natmtot,3),rvfir(ngtot,3))
44select case(task)
45case(71,72,73)
46! magnetisation
47 if (ncmag) then
48! non-collinear
49 rvfmt(:,:,:)=magmt(:,:,:)
50 rvfir(:,:)=magir(:,:)
51 else
52! collinear
53 rvfmt(:,:,1:2)=0.d0
54 rvfir(:,1:2)=0.d0
55 rvfmt(:,:,3)=magmt(:,:,1)
56 rvfir(:,3)=magir(:,1)
57 end if
58case(81,82,83)
59! exchange-correlation magnetic field
60 if (ncmag) then
61! non-collinear
62 rvfmt(:,:,:)=bxcmt(:,:,:)
63 rvfir(:,:)=bxcir(:,:)
64 else
65! collinear
66 rvfmt(:,:,1:2)=0.d0
67 rvfir(:,1:2)=0.d0
68 rvfmt(:,:,3)=bxcmt(:,:,1)
69 rvfir(:,3)=bxcir(:,1)
70 end if
71case(141,142,143)
72! electric field
73 call gradrf(vclmt,vclir,rvfmt,rvfir)
74! use the negative of the gradient
75 rvfmt(:,:,:)=-rvfmt(:,:,:)
76 rvfir(:,:)=-rvfir(:,:)
77case(151,152,153)
78 if (.not.ncmag) then
79 write(*,*)
80 write(*,'("Error(vecplot): collinear m(r) x B_xc(r) is zero")')
81 write(*,*)
82 stop
83 end if
84 call rvfcross(magmt,magir,bxcmt,bxcir,rvfmt,rvfir)
85end select
86select case(task)
87case(71,81,141,151)
88 if (task == 71) then
89 open(50,file='MAG1D.OUT',form='FORMATTED')
90 open(51,file='MAGLINES.OUT',form='FORMATTED')
91 else if (task == 81) then
92 open(50,file='BXC1D.OUT',form='FORMATTED')
93 open(51,file='BXCLINES.OUT',form='FORMATTED')
94 else if (task == 141) then
95 open(50,file='EF1D.OUT',form='FORMATTED')
96 open(51,file='EFLINES.OUT',form='FORMATTED')
97 else
98 open(50,file='MCBXC1D.OUT',form='FORMATTED')
99 open(51,file='MCBXCLINES.OUT',form='FORMATTED')
100 end if
101 call plot1d(50,51,3,rvfmt,rvfir)
102 close(50)
103 write(*,*)
104 write(*,'("Info(vecplot):")')
105 if (task == 71) then
106 write(*,'(" 1D magnetisation density written to MAG1D.OUT")')
107 write(*,'(" vertex location lines written to MAGLINES.OUT")')
108 else if (task == 81) then
109 write(*,'(" 1D exchange-correlation field written to BXC1D.OUT")')
110 write(*,'(" vertex location lines written to BXCLINES.OUT")')
111 else if (task == 141) then
112 write(*,'(" 1D electric field written to EF1D.OUT")')
113 write(*,'(" vertex location lines written to EFLINES.OUT")')
114 else
115 write(*,'(" 1D m(r) x B_xc(r) written to MCBXC1D.OUT")')
116 write(*,'(" vertex location lines written to MCBXCLINES.OUT")')
117 end if
118case(72,82,142,152)
119 if (task == 72) then
120 open(50,file='MAG2D.OUT',form='FORMATTED')
121 else if (task == 82) then
122 open(50,file='BXC2D.OUT',form='FORMATTED')
123 else if (task == 142) then
124 open(50,file='EF2D.OUT',form='FORMATTED')
125 else
126 open(50,file='MCBXC2D.OUT',form='FORMATTED')
127 end if
128 call plot2d(.true.,50,3,rvfmt,rvfir)
129 close(50)
130 write(*,*)
131 write(*,'("Info(vecplot):")')
132 if (task == 72) then
133 write(*,'(" 2D magnetisation density written to MAG2D.OUT")')
134 else if (task == 82) then
135 write(*,'(" 2D exchange-correlation field written to BXC2D.OUT")')
136 else if (task == 142) then
137 write(*,'(" 2D electric field written to EF2D.OUT")')
138 else
139 write(*,'(" 2D m(r) x B_xc(r) written to MCBXC2D.OUT")')
140 end if
141 write(*,'(" Note that the 3D vector field has been locally projected")')
142 write(*,'(" onto the 2D plotting plane axes")')
143case(73,83,143,153)
144 if (task == 73) then
145 open(50,file='MAG3D.OUT',form='FORMATTED')
146 else if (task == 83) then
147 open(50,file='BXC3D.OUT',form='FORMATTED')
148 else if (task == 143) then
149 open(50,file='EF3D.OUT',form='FORMATTED')
150 else
151 open(50,file='MCBXC3D.OUT',form='FORMATTED')
152 end if
153 call plot3d(50,3,rvfmt,rvfir)
154 close(50)
155 write(*,*)
156 write(*,'("Info(vecplot):")')
157 if (task == 73) then
158 write(*,'(" 3D magnetisation density written to MAG3D.OUT")')
159 else if (task == 83) then
160 write(*,'(" 3D exchange-correlation field written to BXC3D.OUT")')
161 else if (task == 143) then
162 write(*,'(" 3D electric field written to EF3D.OUT")')
163 else
164 write(*,'(" 3D m(r) x B_xc(r) written to MCBXC3D.OUT")')
165 end if
166end select
167deallocate(rvfmt,rvfir)
168end subroutine
169!EOC
170
subroutine gradrf(rfmt, rfir, grfmt, grfir)
Definition gradrf.f90:7
subroutine init0
Definition init0.f90:10
real(8), dimension(:,:,:), allocatable bxcmt
Definition modmain.f90:636
integer ngtot
Definition modmain.f90:390
logical ncmag
Definition modmain.f90:240
real(8), dimension(:,:,:), pointer, contiguous magmt
Definition modmain.f90:616
logical spinpol
Definition modmain.f90:228
real(8), dimension(:,:), allocatable bxcir
Definition modmain.f90:636
integer natmtot
Definition modmain.f90:40
real(8), dimension(:), allocatable vclir
Definition modmain.f90:624
integer task
Definition modmain.f90:1298
real(8), dimension(:,:), pointer, contiguous magir
Definition modmain.f90:616
integer npmtmax
Definition modmain.f90:216
real(8), dimension(:,:), allocatable vclmt
Definition modmain.f90:624
subroutine plot1d(fnum1, fnum2, nf, rfmt, rfir)
Definition plot1d.f90:10
subroutine plot2d(tproj, fnum, nf, rfmt, rfir)
Definition plot2d.f90:10
subroutine plot3d(fnum, nf, rfmt, rfir)
Definition plot3d.f90:10
subroutine readstate
Definition readstate.f90:10
subroutine rvfcross(rvfmt1, rvfir1, rvfmt2, rvfir2, rvfmt3, rvfir3)
Definition rvfcross.f90:10
subroutine vecplot
Definition vecplot.f90:10