I was hoping to be able to submit a guide on FMR, but it
will only be the start of one, and then hopefully we can write the rest
together.
This is merely a shot in the dark
from someone who has never seen FMR done with Vampire. It will only help
you get started with the very basics.
Please comment on anything erronous or suboptimal, and please ask about anything that is unclear.
We'll start with a bulk sample and a slowly alternating field for a predictable quasistatic response. (Points 5 to 14 below describe the creation of the attached file "input".)
- Create a folder called FMR.
- Copy the contents of vampire/tests/time-series into your FMR folder. (Co.mat and input)
- Open the file Co.mat and uncomment lines 14 and 16, about the exchange constant and the uniaxial anisotropy constant.
- Change the initial spin direction to be the x-direction,
material[1]:initial-spin-direction=1,0,0
- Now open the file input and add the lines
create:periodic-boundaries-x
create:periodic-boundaries-y
create:periodic-boundaries-z
under the line
create:crystal-structure = sc
to make it a bulk sample.
(There are some problems with not doing this, that become obvious when visualizing the spins. This in "problem 1" below.) - Decrease the system size a bit to make it easier to see what the individual spins are doing, by replacing "7.7" in each "dimensions:system-size-" line with, e.g., 3.54.
- Set the temperature to zero (sim:temperature = 0.0) instead of 1000, to make things simple.
- Change the three lines about the simulation time to
sim:time-steps-increment=100
sim:total-time-steps=1000
sim:time-step=1.0 !ps
which will be appropriate for our rf field.
- Change the strength of the applied field from 0 T to 1 T (sim:applied-field-strength = 1.0 !T).
- Below the two lines about the applied field, add the lines
sim:fmr-field-strength = 0.3!T
sim:fmr-field-frequency = 1.0
sim:fmr-field-unit-vector = 0,1,0
for a 0.3 T rf field at 1.0 GHz along the y-direction, B_{fmr} = 0.3*sin(2*pi*1.0e9*t)*e_y. - Change the program from time-series to fmr (sim:program=fmr).
- Remove some unnecessary output by deleting or out-commenting every line starting with "output:" except for output:magnetisation.
- Add the lines
config:atoms
config:atoms-output-rate=1
to save files for visualizing the spins at each time step.
- I suggest removing/out-commenting the last three lines about what to print to the screen, to keep things simple.
- Now go into the FMR folder via a terminal and run the simulation with, e.g.,
mpirun -np <number of cores to be used> <location of the executable file vampire-parallel>
which could for example look like
mpirun -np 6 ~/vampire/vampire-parallel
if vampire is installed in your home directory and you want to run it with 6 cores in parallel. - To
visualize the spin movement, first run the executable vdc, located in
util/vdc/ in the vampire installation directory. For me this would be
achieved by running the command
~/vampire/util/vdc/vdc - This
generates input files and a "config" file (.ini) for the program
povray. With povray installed you can now simply run the command
povray spins
"spins"
will be interpreted as spins.ini, which contains some
necessary/reasonable options for povray. The above command is in this
case equivalent to
povray -W800 -H600 +A0.3 +KFIO +KFF9 spins.pov
where -W800 sets the width to 800 pixels; -H600 sets the height to 600 pixels; +A0.3 tells povray to do anti-aliasing until the difference between adjacent pixels is less than 0.3; +KFI0 tells povray to start with frame 0; +KFF9 tells povray to end with frame 9; and spins.pov is the input file. - While
povray is running it will display the images it produces, one by one.
These can later be viewed separately or put together into an animation
in a gif file with the command
ffmpeg -i spins%01d.png output.gif
where the number 1 is the number of digits in the png file names. (See the attached file quasistaticAni.gif)
- The
magnetization is stored in the file "output", with m_x in column 1, m_y
in column 2, and m_z in column 3. (I do not know what is displayed in
the fourth column.) (The attached file quasistatic.png shows the results.)
Hopefully
you will now have seen the spins being turned back and forth by the
alternating field. One can see how it is quasistatic by how m_z remains
at zero.
You can now increase the frequency to confirm that you get a dynamic response, try e.g.
sim:fmr-field-frequency = 10.0
with
sim:time-steps-increment=10
(The attached files dynamic.png and dynamicAni.gif show the results.)
Note: It seems that one should delete the old output files before running a new simulation in the same folder. So just run
rm spins*; rm atoms*; rm crystal*; rm output
:::: Problem number 1 -- out-of-phase sublattices in non bulk systems ::::
The
reason we looked at a bulk system is because it otherwise divides into
sublattices in a way that I cannot explain nor get rid of. Remove the
periodic boundary condition in the z-direction and you will see how the
systems divides into 'layers' in which the spins rotate 180 degrees out
of phase. (See the attached images dynamicFilm.png and spins80.png and spins81.png, of which the latter two are consecutive frames.)
This spinning also seems to have little to do with the chosen
parameters for the fmr field. By adding one more monolayer in the
z-direction the spinning can be seen in the magnetisation data, and is
of a frequency much higher than that of the fmr field.
I have
tried raising the temperature, increasing the damping constant, adding
surface roughness, removing crystalline anisotropy, using different
materials, or initializing the spins to point along the applied field.
The only thing that removes this sublattice division is (except for PBC)
to set the exchange to 0, which we will actually do later. (See
the attached images dynamicFilmNoExchange.png and
dynamicFilmNoExchangeAni.gif, and notice how similar they are to the
bulk results. Perhaps it is somehow obvious that they should be the
same.)
There seems to be some net movement as governed by
the alternating field, which can be seen when plotting the
magnetisation. The only difference seems to be that the amplitude is
smaller.
Despite this I have chosen to simulate films, by
removing the PBC in the z-direction, and to look at the magnetisation
only, skipping the visualization and removing the "config:"-lines from the input file.
:::: Performing a frequency sweep ::::
There
may be many ways to do this, but we will make a bash script with a
for-loop that creates a new input file every iteration and creates a
copy of the output file with a name that contains the frequency used.
- When
only caring about how to perform a frequency sweep, and not what the
actual results are, it is easiest to first go into the material file
Co.mat and set the exchange to 0,
material[1]:exchange-matrix[1] = 0
- Open a new file "frequencySweep.sh" in a text editor. (Finished file attached as frequencySweep.sh)
- Here is an example of what you might put inside:
- for i in {5..100..5}
- do
- rm input
- echo "create:crystal-structure = sc" > input
- echo "create:periodic-boundaries-x" >> input
- echo "create:periodic-boundaries-y" >> input
- echo "dimensions:unit-cell-size = 3.54 !A" >> input
- echo "dimensions:system-size-x = 3.54 !nm" >> input
- echo "dimensions:system-size-y = 3.54 !nm" >> input
- echo "dimensions:system-size-z = 3.54 !nm" >> input
- echo "material:file = Co.mat" >> input
- echo "sim:temperature = 0.0" >> input
- echo "sim:time-steps-increment = 1" >> input
- echo "sim:total-time-steps = 100" >> input
- echo "sim:time-step = 1 !ps" >> input
- echo "sim:applied-field-strength=1.0 !T" >> input
- echo "sim:applied-field-unit-vector=1,0,0" >> input
- echo "sim:fmr-field-strength = 0.0001 !T" >> input
- echo "sim:fmr-field-frequency = $i.0" >> input
- echo "sim:fmr-field-unit-vector = 0,1,0" >> input
- echo "sim:program = fmr" >> input
- echo "sim:integrator = llg-heun" >> input
- echo "output:magnetisation" >> input
- echo "frequency = $i.0 GHz"
- mpirun -np 6 ~/vampire/vampire-parallel
- cp output output_${i}GHz
- cp input input_${i}GHz
- done
The loop variable i counts the GHz's.
Line 5 to 24 creates and fills out the new input file.
Line 26 prints to the screen the frequency about to be simulated.
Lines 28 runs the simulation (you may need to change this line).
Finally, lines 30 and 31 copies the input and output files so that they are not overwritten or deleted in the next iteration.
- Before running this you need to use the command
chmod +x frequencySweep.sh
to make it executable. - The frequency sweep is now started with the command
./frequencySweep.sh
You would later need to extract the results from the output files. Plotting the traces one can see that it takes a little bit of time for the oscillations to stabilize. (See the left of attached image frequencySweep.png.)
Taking
the absolute maximum of the component of the magnetization parallel to
the fmr field, max(|m_y|), we see a peak at low frequencies equal to the
amplitude of the fmr field. A peak in max(|m_z|) shows where the
response changes from quasistatic to dynamic. Be sure to exclude the
beginning, where the oscillations haven't stabilized yet, when taking
these maxima values. (See the right plot in the attached figure frequencySweep.png.)
:::: Finding resonance ::::
A
saturated paramagnet should also show resonant behavior at some
frequency, but I have not been able to find it. Therefore, we will
reactivate the exchange and try to deal with the problems this leads to.
- Go into the material file Co.mat and reset the value of the exchange constant,
material[1]:exchange-matrix[1] = 11.2e-21 - Rerun
the frequency sweep and you will see a wild behavior when looking at
the traces, and an 'absorption' vs frequency plot that doesn't make much
sense at all. This wild behavior eventually dies out and turns into
stable oscillations. To see this, increase the number of time steps to
20000 in frequencySweep.sh,
echo "sim:total-time-steps = 20000" >> input - (See the attached image frequencySweepWithExchange.png.)
Zooming
in on the traces even more one can see that there are higher frequency
oscillations superposed onto the "Larmor oscillations". This is probably
the spinning of the sublattices described earlier, which will be
present now that exchange is turned back on. - You
could try changing the material or the static field strength but you
might run into the same problem as me, namely that the peak doesn't seem
to be affected by these things. (The
attached file Fe.mat can be used together with setting the crystal
structure to bcc and the unit cell size to 2.87 Å (and changing the
system size accordingly), to compare these "Cobalt" results with bcc
iron.)
:::: Problem number 2 -- wild initial oscillations ::::
Despite
setting the initial spin direction to be along the static field, there
is a wild initial behavior, meaning the simulations can take very long
and contain a lot of unnecessary data. Setting the exchange to zero
removes this problem, and it seemed both in simulations and my mind that
there would be a resonance at the same frequency. (See
comparison of simulation with exchange and the exact same simulation
except with exchange set to 0, in the attached file
exchangeVsNoExchange.png.) However, I have not found anything resembling resonance with the exchange turned off.
It would be very good if someone could
explain the 'correct' way of avoiding at least most of these initial
wild oscillations, or perhaps how one could tell vampire to not save
data until a set amount of time steps had passed.
:::: Problem number 3 -- Where is the resonance? ::::
With
bcc iron in a 1 T field the resonance should be around 42 GHz according
to the Kittel equation, but in a fine sweep from 1 to 200 GHz with the
exchange turned off, there is nothing resembling a resonance. (See the attached files bccFeZeroExchange_1to100GHz.png and bccFeZeroExchange_100to200GHz.png.)
The only thing I've found resembling a resonance is what was presented in the section "Finding resonance". Furthermore,
in the section before that, where the same frequency sweep was
performed with the exchange turned off, there was no such peak.
I
doubt that the peak from the "Finding resonance" section actually is an
fmr peak because such a peak should be sensitive to the static field
and the material, but it barely moves even when increasing or decreasing
the static field by an order of magnitude or when setting half the
atomic spin moment.
:::: Outlook ::::
This is where I'm at. Stuck with mainly these three problems.
I
hope what is presented above is enough for others to join in, to
experiment and find out how things should be done. Maybe there are a lot
of people doing fmr with Vampire, who can solve all of these problems
by just describing how they do it. Hopefully we will eventually get a
tutorial up on the Vampire website.