I Obtain the Density of State using the Green function

AI Thread Summary
The discussion focuses on using the Green function to calculate the density of states for a one-dimensional lattice. The user is attempting to implement a Fortran program that iterates over energy and wave number loops, but is encountering issues with output values, particularly for the Green function and density of states. There are concerns about the mathematical logic behind the Green function relation, which is defined as the difference between complex energy data and real wave number data. Additionally, the user seeks guidance on correctly reading and processing data from files and expresses a need for references to the mathematical processes involved. The conversation highlights the importance of understanding the underlying mathematics before coding.
MahdiI84
Messages
22
Reaction score
1
Hi everyone. Using the Green function, I want to obtain the density of states of a one-dimensional (linear) lattice. Depending on the problem conditions, we will have an iterative loop with 4,000 data for the energy component and a iteration loop with 2,000 data for the wave number component. In the coding of that program, it must select a data from the energy loop, and in the next line of the program, it must enter the loop of the wave number, and in return a value that belongs to the energy loop must have 2,000 data for the wave number. The wave number obtained from the loop enters the relation (ek). After this step, the obtained data enters the relation of the Green function and then we separate the imaginary part from the output of the Green function and put it in the relation related to the density of states.The coding I did is as follows:

PROGRAM DensityOfState
IMPLICIT NONE

INTEGER :: omega=1 , t0=1 , a0=1


REAL :: eta=0.0015 , w , ek ,kx ,X

REAL,PARAMETER :: pi=3.14

COMPLEX , PARAMETER ::i=(0,1)

COMPLEX :: Energy
COMPLEX :: Density
COMPLEX :: GreenFunc
COMPLEX :: Y

DO w=-2,+2,0.001 ! Energy loop
OPEN(1,FILE='ENERGY.txt')
Energy=w+i*eta !Energy=(w,eta)
X=REAL(Energy)
Y=IMAG(ENERGY)
WRITE(1,*) Energy , X, Y
CLOSE(1)

DO kx=-1000,1000 ! WaveVector loop
OPEN(2,FILE='EPSILONK.txt')
ek= 2*t0*COS(kx)*a0
WRITE(2,*) ek
CLOSE(2)

OPEN(3,FILE='GREENF')
GreenFunc=( X+Y )- ek ! I'm not sure that is correct in terms of mathematical logic.
WRITE(3,*) GreenFunc
CLOSE(3)

END DO
END DO

OPEN(4,FILE='ImGrnFun')
WRITE(4,*) IMAG(GreenFunc)
CLOSE(4)

OPEN(5,FILE='Density')
Density= (1.0/pi*omega)*IMAG(GreenFunc)
WRITE(5,*) Density
CLOSE(5)

END PROGRAM DensityOfState
 
Physics news on Phys.org
But this coding does not seem to be logically correct. Because by running the program, I have only one output value for energy and also for (ek), and the program has no output value for the Green function and density of state. Now I want to know if anyone can guide me in this.thanks a lot
 
Can you link to a reference that demonstrates this method ?
Code:
OPEN (,) ! You must open the files before you enter the loop that reads sequential data from the file.
DO
    READ( , ) var ! You must read a value from the file and store it in a variable.

    ! Process the variable, and rest of file

END DO ! You must loop through the process.
CLOSE ! You must not close the file until it has all been read.
 
  • Like
Likes MahdiI84
Thank you for your guidance. Unfortunately, I did not find a reference. This issue (density of states in different types of crystal lattices) is an important topic in solid state physics. But I did not find any coding references for them. So based on my own analysis of the problem, I got some mathematical relations (such as the relations of the outer ring for energy, the inner ring for the wave number, the relation ek, the relation of the Green function and the relation of the density of states). And I did the coding based on that relationship.
 
I modified the coding according to the pattern you suggested. I just do not know what variable to enter in front of Read command. I entered W and KX but the program reported the following error:

A do-variable within a DO body shall not appear in a variable definition context. [W]
 
MahdiI84 said:
But I did not find any coding references for them.
There is insufficient code to guess what you are trying to do. I need a reference to the mathematical process you are using. Can you please find a reference, or write out the mathematics for each step of the process.

What variable is read from the file 'ENERGY.txt'
What variable is read from the file 'EPSILONK.txt'

Please use a code box </> for your code.
You are new to FORTRAN programming.
Maybe you should study programming before taking on such a project.
 
  • Like
Likes MahdiI84
Thank you very much for your help. Yes, I'm still a beginner in Fortran. I read a book about it and watched several hours of instructional videos, but it seems like not enough.
 
I do not want the variable of the file 'ENERGY.txt' and the file 'EPSILONK.txt' to be read. In fact, I want to import data from the energy loop and the wave number loop into these two files.
 
Again, thank you for your time to help me out.
 
  • #10
Consider this code fragment...
Code:
DO w = -2, +2, 0.001        ! Energy loop
    Energy = w + i * eta    ! Energy = ( w, eta )  i = Sqrt( -1 )
    X = REAL( Energy ) 
    Y = IMAG( Energy )
    WRITE( 1, * ) Energy, X, Y
w, eta are REAL,
i is COMPLEX = ( 0, 1)
i * eta will be COMPLEX
So you get;
X = w ! will vary from -2 to +2 in steps of 0.001
Y = eta ! is constant

We need the mathematics before we write the code.
 
  • Like
Likes MahdiI84
  • #11
My purpose in introducing the X and Y variables is to separate the real and imaginary parts of the energy component.If you pay attention to the coding, after the two loops, (energy and ek), the relation related to the Green function is given, which consists of the difference between the data obtained from the energy loop and the ek loop.
 
  • #12
Of course, the question for me is whether the Green function relation is mathematically correct or not? Because as I said, this relationship is the difference between complex data (energy) and real data (ek).
 
  • #13
The Green function is a function of the wave vector, and because of the effect (Tr) on the Green function, we see the sum operation on all values (k). The Green function is inside the loop of k.
20210125_000706.jpg
20210125_000641.jpg
20210125_000613.jpg
 

Similar threads

Replies
16
Views
2K
Replies
4
Views
2K
Replies
4
Views
5K
Replies
12
Views
3K
Replies
2
Views
1K
Replies
6
Views
3K
Replies
7
Views
3K
Replies
16
Views
4K
Back
Top