Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions content/finitetemp/SimpleCubic/inpsd.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
simid simpcube
ncell 10 10 10 System size
BC P P P Boundary conditions (0=vacuum, P=periodic)
cell 1.00000 0.00000 0.00000
0.00000 1.00000 0.00000
0.00000 0.00000 1.00000
Sym 1 Symmetry of lattice (0 for no, 1 for cubic, 2 for 2d cubic, 3 for hexagonal)
do_prnstruct 1

posfile ./posfile
momfile ./momfile
exchange ./jfile

Initmag 3 Initial config of moments (1=random, 2=cone, 3=spec., 4=file)

ip_mode N
ip_mcanneal 1
5000 300.0 1.00e-16 0.95

mode S
Temp 300.00 K Temperature of the system
hfield 0.00000 0.00000 0.00000 Static H field

damping 0.01 Damping parameter (gamma)
nstep 10000 Number of time-steps
timestep 1.000e-16 s The time step-size for the SDE-solver

plotenergy 1 Sample energies
do_avrg Y Measure averages
do_cumu Y Sample cumulative averages
do_spintemp Y Measure spin temperature
2 changes: 2 additions & 0 deletions content/finitetemp/SimpleCubic/jfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 1 1.0 0.0 0.0 0.80000000000000
1 1 1.0 1.0 0.0 0.50000000000000
1 change: 1 addition & 0 deletions content/finitetemp/SimpleCubic/momfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 1.00 0.0 0.0 1.0
1 change: 1 addition & 0 deletions content/finitetemp/SimpleCubic/posfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 0.000000 0.000000 0.000000
35 changes: 35 additions & 0 deletions content/finitetemp/SingleSpin/inpsd.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
simid SingleSP
ncell 1 1 1 System size
BC 0 0 0 Boundary conditions (0=vacuum,P=periodic)
cell 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000
0.00000 0.00000 0.00000
Sym 0 Symmetry of lattice (0 for no, 1 for cubic, 2 for 2d cubic, 3 for hexagonal)
do_prnstruct 2 Print lattice structure (0=no, 1=yes, 2=coordinates only)

posfile ./posfile
exchange ./jfile
momfile ./momfile
anisotropy ./kfile

Mensemble 1 Number of samples in ensemble averaging
Initmag 3 (1=random, 2=cone, 3=spec., 4=file)

ip_mode N Initial phase parameters

mode S S=SD, M=MC
temp 5.00 Measurement phase parameters
damping 0.50000 --
Nstep 150000 --
timestep 1.000e-15 --

do_avrg Y Measure averages
avrg_step 100

do_tottraj Y Measure moments
tottraj_step 10000
tottraj_buff 10 time step, buffer size

do_cumu Y

real_time_measure Y
1 change: 1 addition & 0 deletions content/finitetemp/SingleSpin/jfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 0.0 0.0 1.0 0.0000
1 change: 1 addition & 0 deletions content/finitetemp/SingleSpin/kfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 -0.100 0.0 0.0 0.0 1.0 0.0
1 change: 1 addition & 0 deletions content/finitetemp/SingleSpin/momfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 1.00000 0.00000 0.0000 1.0000
1 change: 1 addition & 0 deletions content/finitetemp/SingleSpin/posfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 0.0 0.0 0.0
28 changes: 28 additions & 0 deletions content/finitetemp/SquareLattice/Base/inpsd.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
simid scHeis64
ncell 64 64 1
BC P P 0 Boundary conditions (0=vacuum,P=periodic)
cell 1.00000 0.00000 0.00000
0.00000 1.00000 0.00000
0.00000 0.00000 1.00000
Sym 1 Symmetry of lattice (0 for no, 1 for cubic, 2 for 2d cubic, 3 for hexagonal)

aunits Y
posfile ./posfile
exchange ./jfile
momfile ./momfile
do_prnstruct 1

Mensemble 1
Initmag 3 (1=random, 2=cone, 3=spec., 4=file)

ip_mode M Initial phase parameters
ip_temp TEMP --
ip_mcNstep 5000 --

mode M S=SD, M=MC
temp TEMP Measurement phase parameters
mcNstep 5000 --

do_avrg Y Measure averages
plotenergy 1
do_cumu Y
1 change: 1 addition & 0 deletions content/finitetemp/SquareLattice/Base/jfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 1.0 0.0 0.0 0.5000
1 change: 1 addition & 0 deletions content/finitetemp/SquareLattice/Base/momfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 1.00000 0.0 0.0 1.0
1 change: 1 addition & 0 deletions content/finitetemp/SquareLattice/Base/posfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 0.0 0.0 0.0
13 changes: 13 additions & 0 deletions content/finitetemp/SquareLattice/printM.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /bin/csh -f
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)
echo $Temp | sed ' s/K//' > tmp
cat tmp >> Tlist
cat T$Temp/cumulants.scHeis64.out | tail -1 | awk '{print $2}' > tmp1
cat T$Temp/cumulants.scHeis64.out | tail -1 | awk '{print $5}' > tmp2
cat tmp1 >> Mlist
cat tmp2 >> Ulist
end

paste Tlist Mlist Ulist > magnetization.dat
rm Tlist Mlist Ulist tmp tmp1 tmp2
exit
12 changes: 12 additions & 0 deletions content/finitetemp/SquareLattice/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

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
do
mkdir T$Temp/
echo "Temp: " $Temp
cp Base/* T$Temp/
cd T$Temp/
gsed -i "s/TEMP/$Temp/g" inpsd.dat
${SD_BINARY} > out.log
cd ..
done
42 changes: 42 additions & 0 deletions content/finitetemp/SquareLattice/sc_64_ALPS.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Temperature (J) Magnetization
0.01000000 0.99162215
0.06000000 0.95483038
0.11000000 0.92026908
0.16000000 0.88392499
0.21000000 0.83767839
0.26000000 0.80447273
0.31000000 0.75743914
0.36000000 0.71563720
0.41000000 0.66379796
0.46000000 0.60234222
0.51000000 0.55313209
0.56000000 0.47708797
0.61000000 0.34753675
0.66000000 0.21652653
0.71000000 0.12810921
0.76000000 0.09693399
0.81000000 0.07360353
0.86000000 0.06022234
0.91000000 0.05290496
0.96000000 0.04736220
1.01000000 0.04230193
1.06000000 0.03953494
1.11000000 0.03636440
1.16000000 0.03424181
1.21000000 0.03237245
1.26000000 0.03086418
1.31000000 0.02957311
1.36000000 0.02842018
1.41000000 0.02759275
1.46000000 0.02657334
1.51000000 0.02610488
1.56000000 0.02525342
1.61000000 0.02479467
1.66000000 0.02425726
1.71000000 0.02366309
1.76000000 0.02337222
1.81000000 0.02274532
1.86000000 0.02252159
1.91000000 0.02217737
1.96000000 0.02185710
2.01000000 0.02166938
90 changes: 90 additions & 0 deletions content/finitetemp/finitetemp.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,92 @@
Finite temperatures
===================


Statistics
----------
In this exercise we will investigate how statistics affect simulated measurables.

A single spin with an uniaxial anisotropy has a bi-stable, Ising like, magnetic state. At finite temperatures the stability of the magnetic state is not finite
but follows an exponential (Arrhenius) relaxation behaviour. As seen in the lecture, ensemble averaging can be crucial for the analysis of such systems.

* Investigate the amount of statistics that is needed to say something relevant about the life time of the magnetic state of the system.

* Does the need of statistics change with system parameters? (temperature, anisotropy, external field)

* Extra: Can you fit the relaxation behaviour to an `Arrhenius function <https://en.wikipedia.org/wiki/Arrhenius_equation>`_?

You can do a similar analysis for a finite 1d-chain by either modifying the single spin example, or
starting from the `SimpleSystems/HeisChain <https://github.com/UppASD/UppASD/tree/master/examples/SimpleSystems/HeisChain>`_ example.

* Is there a difference by performing ensemble averaging compared to just increasing the system size?

* Does the exchange interaction magnitude affect the stability of the spin chains?

An accessible article for those interested in spin chains and statistics can be found here: `A. Vindigni Inorganica Chimica Acta, 361 3731 (2008) <https://www.sciencedirect.com/science/article/abs/pii/S0020169308001588>`_.



Thermalization
--------------
In this exercise the thermalization rates in spin simulations will be investigated.

As mentioned in the lecture, thermalising the system before performing measurements is crucial for ensuring relevant results.
Here we will investigate this for a simple cubic model system.

The initial ``inpsd.dat`` file looks as follows

.. literalinclude:: SimpleCubic/inpsd.dat

and the almost trivial ``posfile`` and ``momfile`` are written as

.. literalinclude:: SimpleCubic/posfile
.. literalinclude:: SimpleCubic/momfile

The ``jfile``, that will be changed during the exercise initially can look like

.. literalinclude:: SimpleCubic/jfile

i.e. including nearest and next-nearest neighbours on the cubic lattice. Notice that since ``sym 1`` is given in ``inpsd.dat``, the ``jfile`` can be kept to a minimum of two lines.

* Starting with the inputs as defined above, vary the simulation method and damping (where applicable) to investigate the thermalization rate of the system.

* Is the thermalization faster when going from low to high temperatures or vice versa? Anything particular happening around Tc?

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

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

The system in question is here the 2d square lattice with NN exchange couplings.
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.

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

.. literalinclude:: SquareLattice/Base/inpsd.dat

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

.. literalinclude:: SquareLattice/Base/posfile
.. literalinclude:: SquareLattice/Base/momfile
.. literalinclude:: SquareLattice/Base/jfile

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).

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

.. literalinclude:: SquareLattice/runme.sh

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.

* Run the script and plot the resulting M(T) curve.

* Compare with the reference data in the :download:`sc_64_ALPS.dat <SquareLattice/sc_64_ALPS.dat>` file

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


Minimization
------------