PROGRESS  master
prg_dos_mod.F90
Go to the documentation of this file.
1 
8 module prg_dos_mod
9 
11  use prg_ptable_mod
12 
13  implicit none
14 
15  private
16 
17  integer, parameter :: dp = kind(1.0d0)
18 
19  public :: prg_write_tdos
20 
21 contains
22 
34  subroutine prg_write_tdos(eigenvals, gamma, npts, emin, emax, filename)
35  implicit none
36  character(len=*),intent(in) :: filename
37  integer :: i, io
38  integer, intent(in) :: npts
39  real(dp) :: de
40  real(dp), allocatable :: loads(:)
41  real(dp), intent(in) :: eigenvals(:), emax, emin, gamma
42 
43  call prg_open_file(io,filename)
44 
45  de = (emax-emin)/real(npts)
46 
47  allocate(loads(size(eigenvals)))
48 
49  loads = 1.0_dp
50  write(io,*)"# Energy DOS"
51  do i = 1, npts
52  write(io,*) emin + de*i,lorentz(emin + de*i, eigenvals, loads, gamma)
53  end do
54 
55  close(io)
56 
57  call prg_open_file(io, "eigenvals")
58 
59  write(io,*)"# i Eval"
60  do i = 1, size(eigenvals,dim=1)
61  write(io,*) i, eigenvals(i)
62  end do
63 
64  close(io)
65 
66  end subroutine prg_write_tdos
67 
68 
76  real(dp) function lorentz(energy, eigenvals, loads, gamma)
77  implicit none
78  integer :: nstates, k
79  real(dp) :: auxfactor, auxterm, pi
80  real(dp), intent(in) :: gamma, eigenvals(:), energy, loads(:)
81 
82  nstates = size(eigenvals,dim=1)
83  pi = 3.14159265358979323846264338327950_dp
84 
85  !Lorentz parameters
86  auxfactor = gamma/(2.0_dp*pi)
87  auxterm = (gamma/2.0_dp)**2
88  lorentz = 0.0_dp
89 
90  do k = 1, nstates
91  lorentz = lorentz + loads(k)/((energy-eigenvals(k))**2 + auxterm)
92  end do
93 
94  lorentz = auxfactor*lorentz
95 
96  end function lorentz
97 
98 
99 end module prg_dos_mod
A module to compute the Density of state (DOS) and lDOS.
Definition: prg_dos_mod.F90:8
subroutine, public prg_write_tdos(eigenvals, gamma, npts, emin, emax, filename)
Writes the total DOS into a file. Where .
Definition: prg_dos_mod.F90:35
real(dp) function lorentz(energy, eigenvals, loads, Gamma)
Lorentzian Function.
Definition: prg_dos_mod.F90:77
integer, parameter dp
Definition: prg_dos_mod.F90:17
Module to handle input output files for the PROGRESS lib.
subroutine, public prg_open_file(io, name)
Opens a file to write.
Periodic table of elements.