May 10, 2015 - static int niter = 50; static float h=0.001; void rk4(int ,float [][niter][npart] ); float func(int ,int ,float [3][niter][npart],int). ; void sum(float [3][niter][npartΒ ...
24 Hour Competition
The Classical Heisenberg Model Magnetism in 1-D lattice Using RK4 & RK45 Methods
Studentβs Name: Sami Mukhiemer Sameh Othman Ikerma Asmar Date: 9-10th May 2015
Abstract magnetism is intrinsically a quantum phenomenon one common model is the classical Heisenberg model, at this report the solution of dynamic equation was solved by using RK4 for one dimensional lattice and for N=100 lattice points and periodic boundary conditions was chosen, and also the graph for the magnetization and energy was plotted as a function of time, and the main energy was calculated.
Introduction The Heisenberg model is a statistical mechanical model used in the phase transitions of magnetic systems, in which the spins of the magnetic systems are treated quantum mechanically. Model are not only able to explain the measured properties but also provided some general understanding of higher dimensional magnatics system , we will see that the time dependent spinβspin correlation decreases when the system is heated up, resulting in a decrease of the spindiffusion speed. The presence of the magnetic field contributes to the order, and therefore produces an increase of the spindiffusion speed .
Partition function The energy of the magnetic spin system defined as the following E=-π½π½ βππ ππ=1 ππππ ππππ+1 where S is the spin of the particle and J is a measure the strength between of the interaction between the two spins ,for simplicity the first neighbor approximation was used in order to get a very nice formula the following tricks was used as the following 1. Assume that ππππ ππππ+1 = ππππ = ππ1 + ππ2 + ππ3 + β― 2. But ππ1 =s1s2,ππ2 = π π 2 π π 3 , so ππππ = π π 1 π π 2 π π 2 π π 3 π π 3 β¦ β¦ . π π ππ π π ππ π π ππ+1
So our energy becomes ππ
ππ
ππ=1
ππ=1
πΈπΈ = βπ½π½ οΏ½ ππππ β π½π½π½π½ ππππ π‘π‘βππππππ πππ π ππππ ππππππππππππππππ ππππππππππ πΈπΈ = βπ½π½ οΏ½ ππππ
So the partition function of the system becomes as the following ππ
ππ
ππ = βππππ=1 ππ βπ½π½ βππ=1 πΈπΈππ so Z becomes ππ = βππππ=1 ππ βπ½π½π½π½ βππ=1 ππππ
In view of quantum mechanics ππ βππππ ππππππππ π‘π‘π‘π‘π‘π‘ π£π£π£π£π£π£π£π£π£π£π£π£ + 1 ππππ β 1 so the solution will be very niceππ = (2cosh(π½π½π½π½))ππβ1 , as the spin goes to infinity the classical region were reached, but the Heisenberg model was considered and at this model ππ βππππ π‘π‘βππ π£π£π£π£π£π£π£π£π£π£π£π£ ππππππππππππππ β 1 ππππππ 1 so at this point the analytic solution dose not exists.
Magnetic interactions - seek to align spins relative to one another. - spins become effectively "randomized" when thermal energy is greater than the strength of the interaction. Energy of interaction J: J > 0 the interaction is called ferromagnetic (aligned spins) J < 0 the interaction is called antiferromagnetic (antialigned spins) J = 0 the spins are noninteracting
And the dynamic of the spin for the Heisenberg model expressed as follows π½π½(ππππ Γ (ππππβ1 + ππππ+1 )) the Runge-Kutta algorithm RK4 was used to solve the previous dynamic equation .
ππππ ππππ
=
Runge-Kutta Algorithm The most often used is the classical fourth-order Runge-Kutta formula, which has a certain sleekness of organization about it: k1 = hf(xn, yn) k2 = hf(xn + h 2 , yn + k1 2 ) k3 = hf(xn + h 2 , yn + k2 2 ) k4 = hf(xn + h, yn + k3) yn+1 = yn + k1 /6 + k2/ 3 + k3 /3 + k4 /6 + O(h5). The fourth-order Runge-Kutta method requires four evaluations of the righthand side per step h. Runge-Kutta-Fehlberg Method (RKF45) One way to guarantee accuracy in the solution of an I.V.P. is to solve the problem twice using step sizes h and h/2 and compare answers at the mesh points corresponding to the larger step size. But this requires a significant amount of computation for the smaller step size and must be repeated if it is determined that the agreement is not good enough. The Runge-Kutta-Fehlberg method (denoted RKF45) is one way to try to resolve this problem. It has a procedure to determine if the proper step size h is being used. At each step, two different approximations for the solution are made and compared. If the two answers are in close agreement, the approximation is accepted. If the two answers do not agree to a specified accuracy, the step size is reduced. If the answers agree to more significant digits than required, the step size is increased. Each step requires the use of the following six values: k1 = h f (tk , yk ), k2 = h f (tk +( 1/ 4) h, yk +( 1/ 4) k1) k3 = h f( tk + (3/ 8) h, yk + (3 /32) k1 + (9/ 32) k2 ),
k4 = h f( tk + (12 /13) h, yk +( 1932/ 2197) k1 β (7200/2197)k2 + (7296/2197)k3) , k5 = h f( tk + h, yk + 439 216 k1 β 8k2 + 3680 513 k3 β 845 4104 k4 , k6 = h (f tk + 1/ 2 h, yk β (8/27) k1 + 2k2 β 3544 /2565 k3 + 1859 4104 k4 β 11/40 k5 ). The two method was used and the total magnetization and energy of spin was calculated , c language was used and RK4 Algorithm was built to calculate one dimensional spin and then to calculate the three dimensional spin . then RK45 algorithm was built by using Matlab and the three dimensional spin energy and magnetization was calculated
Solution of the problem 1. One dimensional spin and one dimensional lattice In this part we use C-language and RK4 algorithm, and the magnetization and energy was calculated and the graph was plotted by using Microsoft Excel and the following results was gotten
Energy of time 0 -20
0
20
40
60
80
100
120
-40 -60 -80 -100 -120 -140 -160
Fig.1: energy verses time for one dimensional spins As the time goes the system go to more stable system so the energy increases with time.
2. Three dimensional spin and one dimensional lattice In this part c-language was used and RK4 algorithm was built and the magnetization and energy was calculated and the graph was built by using Microsoft Excel, and Matlab program was used and RK45 algorithm was built and the following results was gotten
Figure2: the matlab plot of magnetization verses time The previous results were expected because the values of the spins were random and black one was the sum of all magnetization in three dimensions.
Fig3. Energy of spins verses time And also the values of the energy were expected also because also random values of the spins so of course random values of the energy were expected. The following results were gotten by using C-language and RK4 algorithm
All spins up(1) but one down(-1)
48.0012
Magentaization
48.001 48.0008 48.0006 48.0004 48.0002 48 47.9998 0
10
20
30
40
50
60
Time
Fig.4: The total magnetization when all spins up but one only down
As seen from the graph the magnetization an first time does not change but as time goes on the magnetization increases with time to go to more stable state
Energy Vs time for random spin -46.95 0
10
20
30
40
50
60
-47 -47.05 -47.1 -47.15 -47.2 -47.25
Fig.5: the change in total energy of the system verses time As seen the time goes on the energy decreases and this is expected because the system got more stable so the energy was decreased
magnatizantion Vs time 43.450695 43.45069 43.450685 43.45068 43.450675 43.45067 43.450665 43.45066 0
10
20
30
40
50
60
Fig.6: the change in the total magnetization verses time The initial values of spins here also were random and as the time go the magnetization decreases with time as seen. It gone to more stable states and we expected that the energy increases with time as gotten by Matlab code
All up and one down 160 140
Energy
120 100 80 60 40 20 0 0
10
20
30
40
Time
Fig.7: when all were up and one down
50
60
No changes in the energy occur when all the spins were up and one down nothing change because the system reach the steady state very fast than a random systems
Conclusion: We studied the classical spin system in 1D & 3D for 1-D lattice. we obtained the Magnetization and Energy as function of Time using RK4 and RK45. And we found that using RK45 was more precise than RK4, using Matlab and C language. When we start from a random spin, the system is in chaos and has a higher energy but with time it become more stable and the energy decrease. But for the system were all the spin is up but one of them is down the system is almost stable and the change in energy is small.
Appendix 1 RK4 code by using c-language #include #include #include static int npart =50; static int niter = 50; static float h=0.001; void rk4(int ,float [][niter][npart] ); float func(int ,int ,float [3][niter][npart],int) ; void sum(float [3][niter][npart]); int main() { int seed = time(NULL); srand(seed); int l,k; int i=0,j; FILE *www; www = fopen("ttt.txt","a"); float spin[3][50][50]={0.0}; for(k=0;k