Skip to content

Commit f6da484

Browse files
committed
Updated finite temperature
1 parent ed7f09a commit f6da484

File tree

10 files changed

+147
-18
lines changed

10 files changed

+147
-18
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
simid bccFe100
2+
ncell 10 10 10 System size
3+
BC P P P Boundary conditions (0=vacuum, P=periodic)
4+
cell 1.00000 0.00000 0.00000
5+
0.00000 1.00000 0.00000
6+
0.00000 0.00000 1.00000
7+
Sym 1 Symmetry of lattice (0 for no, 1 for cubic, 2 for 2d cubic, 3 for hexagonal)
8+
9+
posfile ./posfile
10+
momfile ./momfile
11+
exchange ./jfile
12+
13+
SDEalgh 1 SDE solver: 1=midpoint, 2=heun, 3=heun3, 4=Heun_proper, 5=Depondt
14+
Initmag 1 Initial config of moments (1=random, 2=cone, 3=spec., 4=file)
15+
#restartfile ./restart.bccFe100.out
16+
Mensemble 5
17+
18+
ip_mode M Initial phase parameters
19+
ip_temp TEMP --
20+
ip_mcNstep 10000 --
21+
22+
!!mode H S=SD, M=MC
23+
!!temp TEMP Measurement phase parameters
24+
!!mcNstep 20000
25+
mode S S=SD, M=MC
26+
temp TEMP Measurement phase parameters
27+
Nstep 20000
28+
damping 0.1
29+
timestep 1.0e-16
30+
31+
do_avrg Y Measure averages
32+
33+
do_cumu Y
34+
cumu_step 50
35+
cumu_buff 10
36+
37+
do_tottraj N Measure moments
38+
tottraj_step 1000
39+
40+
plotenergy 1
41+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1 1 0.5 0.5 0.5 1.33767484769984
2+
1 1 1.0 0.0 0.0 0.75703576545650
3+
1 1 1.0 1.0 0.0 -0.05975437643846
4+
1 1 1.5 0.5 0.5 -0.08819834160658
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1 1 2.23 1.0 0.0 0.0 2.0
2+
2 1 2.23 1.0 0.0 0.0 2.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1 1 0.000000 0.000000 0.000000
2+
2 1 0.500000 0.500000 0.500000
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Sweeps the bccFe over many temps
2+
3+
1) ./runme.sh
4+
2) ./printM.sh
5+
3) gnuplot plot.gnu
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set xlabel "Temperature (K)"
2+
set xrange [0:1600]
3+
set yrange [0:1.1]
4+
p "thermal.norm.dat" u 1:2 w lp ti "Magnetization"
5+
rep "thermal.norm.dat" u 1:3 w lp ti "Binder cumulant"
6+
rep "thermal.norm.dat" u 1:4 w lp ti "Susceptibility"
7+
rep "thermal.norm.dat" u 1:5 w lp ti "Specific heat"
8+
pause(-1)
9+
set term png
10+
set output "bccfe.png"
11+
rep
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import numpy as np
2+
import matplotlib.pyplot as pp
3+
import matplotlib.colors as colors
4+
import matplotlib as mpl
5+
from matplotlib.collections import LineCollection
6+
pp.style.use('default')
7+
pp.rc("figure", facecolor="white")
8+
9+
# Load the normalized phase diagram
10+
mt=np.genfromtxt("thermal.norm.dat")
11+
na=mt.shape
12+
#print(na)
13+
14+
#Plot phase diagram
15+
fig_mt = pp.figure()
16+
ax1 = fig_mt.add_subplot(111)
17+
#ax1.set_title("Adiabatic magnon spectrum")
18+
ax1.set_xlabel('Temperature (K)')
19+
ax1.set_ylabel('Normalized observable')
20+
#ax1.set_xticks([])
21+
#for x in range(1,na[1]-1):
22+
# ax1.plot(mt[:,0],mt[:,x])
23+
ax1.plot(mt[:,0],mt[:,1],label='M')
24+
ax1.plot(mt[:,0],mt[:,2],label='U4')
25+
ax1.plot(mt[:,0],mt[:,3],label='Xi')
26+
ax1.plot(mt[:,0],mt[:,4],label='Cv')
27+
ax1.axis('tight')
28+
ax1.legend()
29+
pp.show()
30+
fig_mt.savefig('mt.png', format='png', dpi=200)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/bash
2+
m_max=`tail -n1 T*/cumulants.*.out | grep E | awk '{ print $2 }' | sort -gr | head -1 `
3+
cv_max=`tail -n1 T*/cumulants.*.out | grep E | awk '{ print $7 }' | sort -gr | head -1 `
4+
#cv_max=1
5+
x_max=`tail -n1 T*/cumulants.*.out | grep E | awk '{ print $6 }' | sort -gr | head -1 `
6+
echo "# Temp. Mavg UBinder Susc. Cv" > thermal.dat
7+
echo "# Temp. Mavg UBinder Susc. Cv" > thermal.norm.dat
8+
for Temp in 100 200 300 400 500 600 700 800 900 950 1000 1100 1200 1300 1400 1500 1600
9+
do
10+
tail -1 T$Temp/cumulants.*.out | awk '{ printf "%6i %f %f %f %f\n", temp, $2,$5,$6,$7 }' temp=$Temp >> thermal.dat
11+
tail -1 T$Temp/cumulants.*.out | awk '{ printf "%6i %f %f %f %f\n", temp, $2/m_max,$5,$6/x_max,$7/cv_max }' m_max=$m_max x_max=$x_max cv_max=$cv_max temp=$Temp >> thermal.norm.dat
12+
done
13+
exit
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/bash
2+
for Temp in 100 200 300 400 500 600 700 800 900 950 1000 1100 1200 1300 1400 1500 1600
3+
do
4+
mkdir T$Temp/ 2>/dev/null
5+
echo "Temp: " $Temp
6+
cp Base/* T$Temp/
7+
cd T$Temp/
8+
sed -i "s/TEMP/$Temp/g" inpsd.dat
9+
if [ $Temp -ne 100 ]
10+
then
11+
sed -i "s/#restart/restart/" inpsd.dat
12+
cp ../restart.bccFe100.out .
13+
fi
14+
${SD_BINARY} > out.log
15+
cp restart.bccFe100.out ../
16+
cd ..
17+
done
18+
exit

content/finitetemp/finitetemp.rst

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ An accessible article for those interested in spin chains and statistics can be
2828

2929
Thermalization
3030
--------------
31-
In this exercise the thermalization rates in spin simulations will be investigated.
31+
In this exercise the thermalization rates in spin simulations will be investigated.
32+
The input files can be found in the directory ``finitetemp/SimpleCubic``.
3233

33-
As mentioned in the lecture, thermalising the system before performing measurements is crucial for ensuring relevant results.
34+
Thermalising the system before performing measurements is crucial for ensuring relevant results.
3435
Here we will investigate this for a simple cubic model system.
3536

3637
The initial ``inpsd.dat`` file looks as follows
@@ -54,40 +55,42 @@ i.e. including nearest and next-nearest neighbours on the cubic lattice. Notice
5455

5556
* Change the sign of the next-nearest neighbour and redo the study. Is the magnetization a good measurable for determining the thermalization now?
5657

57-
Phase diagrams
58-
--------------
59-
Obtaining the M vs T relationship is probably the most common use case for Monte Carlo simulations on spin systems.
60-
In this exercise you can compare the MC functionalities of UppASD with a the ALPS package.
6158

62-
The system in question is here the 2d square lattice with NN exchange couplings.
63-
To compare with other model implementations this example uses the ``aunits Y`` flag which sets the temperature unit to the exchange strength ``J`` instead of Kelvin.
59+
Phase diagram for bcc Fe
60+
^^^^^^^^^^^^^^^^^^^^^^^^
61+
62+
Atomistic spin dynamics simulations with Langevin dynamics can be used to investigate
63+
the thermal properties of materials. In this exercise you will investigate how the
64+
magnetic order parameter, the heat capacity, the susceptibility depends on temperature.
65+
Input files and scripts for bcc Fe can be found in ``examples/PhaseDiagrams/bccFe-Tsweep``.
6466

6567
The ``inpsd.dat`` will here look as follows (to start with). Note the **TEMP** entries for initial and measurement temperatures.
6668

67-
.. literalinclude:: SquareLattice/Base/inpsd.dat
69+
.. literalinclude:: bccFe-Tsweep/Base/inpsd.dat
6870

6971
and the ``posfile`` and ``momfile``, and ``jfile`` files looks as
7072

71-
.. literalinclude:: SquareLattice/Base/posfile
72-
.. literalinclude:: SquareLattice/Base/momfile
73-
.. literalinclude:: SquareLattice/Base/jfile
74-
75-
Again, note that with ``aunits Y`` the exchange interaction in ``jfile`` is not defined in ``mRy`` but in the dimensionless energy scale of ``J`` (which is not Joule either).
73+
.. literalinclude:: /Base/posfile
74+
.. literalinclude:: bccFe-Tsweep/Base/momfile
75+
.. literalinclude:: bccFe-Tsweep/Base/jfile
7676

7777
In order to obtain the full M(T) curve, several simulations are needed at consecutive temperatures.
7878
This is preferably scripted, like in this example where we use a simple ``bash`` script ``runme.sh``
7979

80-
.. literalinclude:: SquareLattice/runme.sh
80+
.. literalinclude:: bccFe-Tsweep/runme.sh
8181

8282
Here you either need to replace the ``${SD_BINARY}`` expression, or export the location of your UppASD binary as the environment variable with the same name.
8383
You also need to use the same directory structure as intended, i.e. put the input files in a directory called `Base` and the ``runme.sh``
8484
script in the directory below.
8585

86-
* Run the script and plot the resulting M(T) curve.
86+
* Run the sweep over temperature with the ``runme.sh`` script. What kind of simulations is run?
87+
88+
* Examine the results by using the printM.sh and the plot.gnu scripts. The latter is a script for Gnuplot.
89+
90+
* Change the inpsd.dat so that you can the temperature sweep as a Monte Carlo simulation, instead of an ASD simulation. Compare the results with each other, and with Fig. 2 of [Skubic2008]_.
8791

88-
* Compare with the reference data in the :download:`sc_64_ALPS.dat <SquareLattice/sc_64_ALPS.dat>` file
92+
* Run additional simulations for different cell sizes. Use the Binder cumulant crossing approach to determine the critical temperature.
8993

90-
* Are the simulation parameters "good enough" or are more thermalization/sampling steps needed to obtain an accurate M(T) curve?
9194

9295

9396
Minimization

0 commit comments

Comments
 (0)