Skip to content

Commit e89e3dd

Browse files
committed
Added 2D square lattice example.
1 parent 138477b commit e89e3dd

8 files changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
simid scHeis64
2+
ncell 64 64 1
3+
BC P P 0 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+
aunits Y
10+
posfile ./posfile
11+
exchange ./jfile
12+
momfile ./momfile
13+
do_prnstruct 1
14+
15+
Mensemble 1
16+
Initmag 3 (1=random, 2=cone, 3=spec., 4=file)
17+
18+
ip_mode M Initial phase parameters
19+
ip_temp TEMP --
20+
ip_mcNstep 5000 --
21+
22+
mode M S=SD, M=MC
23+
temp TEMP Measurement phase parameters
24+
mcNstep 5000 --
25+
26+
do_avrg Y Measure averages
27+
plotenergy 1
28+
do_cumu Y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 1 1.0 0.0 0.0 0.5000
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 1 1.00000 0.0 0.0 1.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 1 0.0 0.0 0.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/csh -f
2+
foreach Temp (0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0)
3+
echo $Temp | sed ' s/K//' > tmp
4+
cat tmp >> Tlist
5+
cat T$Temp/cumulants.scHeis64.out | tail -1 | awk '{print $2}' > tmp1
6+
cat T$Temp/cumulants.scHeis64.out | tail -1 | awk '{print $5}' > tmp2
7+
cat tmp1 >> Mlist
8+
cat tmp2 >> Ulist
9+
end
10+
11+
paste Tlist Mlist Ulist > magnetization.dat
12+
rm Tlist Mlist Ulist tmp tmp1 tmp2
13+
exit
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
for Temp in 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
4+
do
5+
mkdir T$Temp/
6+
echo "Temp: " $Temp
7+
cp Base/* T$Temp/
8+
cd T$Temp/
9+
gsed -i "s/TEMP/$Temp/g" inpsd.dat
10+
${SD_BINARY} > out.log
11+
cd ..
12+
done
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Temperature (J) Magnetization
2+
0.01000000 0.99162215
3+
0.06000000 0.95483038
4+
0.11000000 0.92026908
5+
0.16000000 0.88392499
6+
0.21000000 0.83767839
7+
0.26000000 0.80447273
8+
0.31000000 0.75743914
9+
0.36000000 0.71563720
10+
0.41000000 0.66379796
11+
0.46000000 0.60234222
12+
0.51000000 0.55313209
13+
0.56000000 0.47708797
14+
0.61000000 0.34753675
15+
0.66000000 0.21652653
16+
0.71000000 0.12810921
17+
0.76000000 0.09693399
18+
0.81000000 0.07360353
19+
0.86000000 0.06022234
20+
0.91000000 0.05290496
21+
0.96000000 0.04736220
22+
1.01000000 0.04230193
23+
1.06000000 0.03953494
24+
1.11000000 0.03636440
25+
1.16000000 0.03424181
26+
1.21000000 0.03237245
27+
1.26000000 0.03086418
28+
1.31000000 0.02957311
29+
1.36000000 0.02842018
30+
1.41000000 0.02759275
31+
1.46000000 0.02657334
32+
1.51000000 0.02610488
33+
1.56000000 0.02525342
34+
1.61000000 0.02479467
35+
1.66000000 0.02425726
36+
1.71000000 0.02366309
37+
1.76000000 0.02337222
38+
1.81000000 0.02274532
39+
1.86000000 0.02252159
40+
1.91000000 0.02217737
41+
1.96000000 0.02185710
42+
2.01000000 0.02166938

content/finitetemp/finitetemp.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,36 @@ i.e. including nearest and next-nearest neighbours on the cubic lattice. Notice
5656

5757
Phase diagrams
5858
--------------
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.
61+
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.
64+
65+
The ``inpsd.dat`` will here look as follows (to start with). Note the **TEMP** entries for initial and measurement temperatures.
66+
67+
.. literalinclude:: SquareLattice/Base/inpsd.dat
68+
69+
and the ``posfile`` and ``momfile``, and ``jfile`` files looks as
70+
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`` (not Joule either).
76+
77+
In order to obtain the full M(T) curve, several simulations are needed at consecutive temperatures.
78+
This is preferably scripted, like in this example where we use a simple ``bash`` script ``runme.sh``
79+
80+
.. literalinclude:: SquareLattice/runme.sh
81+
82+
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.
83+
84+
* Run the script and plot the resulting M(T) curve.
85+
86+
* Compare with the reference data in the :download:`sc_64_ALPS.dat <SquareLattice/sc_64_ALPS.dat>` file
87+
88+
* Are the simulation parameters "good enough" or are more thermalization/sampling steps needed to obtain an accurate M(T) curve?
5989

6090

6191
Minimization

0 commit comments

Comments
 (0)