Skip to content

Commit

Permalink
Tutorial makes sense now?
Browse files Browse the repository at this point in the history
  • Loading branch information
bonfus committed Mar 18, 2017
1 parent d43f1b7 commit 6cdec6f
Showing 1 changed file with 32 additions and 21 deletions.
53 changes: 32 additions & 21 deletions docs/Tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ declare your own, fore example like this (Copper in simple cubic lattice)
>>> import numpy
>>> from muesr.core.atoms import Atoms
>>>
>>> atms = Atoms(symbols=['Cu'], scaled_positions=[[0.,0.,0.]], cell=numpy.diag([3.,3.,3.]), pbc=True)
>>> atms = Atoms(symbols=['Fe'], scaled_positions=[[0.,0.,0.]], cell=numpy.diag([3.,3.,3.]), pbc=True)
>>>
>>> mysample.cell = atms
Expand Down Expand Up @@ -85,17 +85,27 @@ can be specified as

.. code-block:: python
>>> mysample.add_muon([0.1,0,0], cartesian=True)
>>> mysample.add_muon([0.3,0,0], cartesian=True)
If proper symmetry of the sample is present in the sample definition, it
is usually usefull to get symmetry equivalent sites.
You can verify that the two positions are equivalent by printing them with
the command

.. code-block:: python
>>> print(mysample.muons)
If symmetry information are present in the sample definition, it
is usually useful to get symmetry equivalent sites.
This can be done with the utility function :py:func:`~muesr.utilities.muon.muon_find_equiv`.
In our case we did not load any symmetry information so the
following command will raise an error.

.. code-block:: python
>>> from muesr.utilities import muon_find_equiv
>>> muon_find_equiv(mysample)
[...]
SymmetryError: Symmetry is not defined.
Defining a magnetic structure
++++++++++++++++++++++++++++++
Expand All @@ -115,22 +125,22 @@ A quick way to do that is using the helper function :py:func:`~muesr.utilities.m
You will be asked the propagation vector and the Fourier coefficients
for the specified atomic symbol. By default the Fourier components are
specified in **Cartesian** coordinates. You can use the keyword argument
`inputConvention` to change this behaviour.
`inputConvention` to change this behavior.
Here's an example::

>>> mago_add(a)
Propagation vector (w.r.t. conv. rec. cell): 0 0 0
Magnetic moments in bohr magnetons and cartesian coordinates.
Which atom? (enter for all)Cu
Which atom? (enter for all)Fe
Lattice vectors:
a 5.000000000000000 0.000000000000000 0.000000000000000
b 0.000000000000000 5.000000000000000 0.000000000000000
c 0.000000000000000 0.000000000000000 5.000000000000000
a 3.000000000000000 0.000000000000000 0.000000000000000
b 0.000000000000000 3.000000000000000 0.000000000000000
c 0.000000000000000 0.000000000000000 3.000000000000000
Atomic positions (fractional):
1 Cu 0.00000000000000 0.00000000000000 0.00000000000000 63.546
FC for atom 1 Cu (3 real, [3 imag]): 0 0 1
1 Fe 0.00000000000000 0.00000000000000 0.00000000000000 63.546
FC for atom 1 Fe (3 real, [3 imag]): 0 0 1
The same can be achieved in a more pythonic way like this:
The same can be achieved without interactive input like this:

.. code-block:: python
Expand Down Expand Up @@ -173,18 +183,18 @@ with the following command ::
A detailed description of the possible calculatros is given in the
:py:func:`~muesr.engines.clfc.locfield` documentation.

Let's go strainght to the local field evaluation which is obtained by
Let's go straight to the local field evaluation which is obtained by
running the command: ::

>>> results = locfield(mysample, 'sum', [30, 30, 30] , 100)

Let's review this command in details. The first argument is just the
sample object that we considered till now.
The second argument tells the code to simpli sum all magnetic moments
in a supercell generated by the expansion of the unitc cell 30x30x30
The second argument tells the code to sum all magnetic moments
in a supercell generated by the expansion of the unit cell 30x30x30
times along the lattice vectors (third argument of the function).
The fourth argument is the radius of the Lorentz sphere considered.
All magnetic moments outside the Lorentx sphere are ignored.
All magnetic moments outside the Lorentz sphere are ignored.
The muon is automatically placed in the center of the supercell.

.. note::
Expand All @@ -197,16 +207,17 @@ However if you print the results you'll see something which looks like
a numpy array: ::

>>> print(results)
[array([ 3.00964434e-06, -8.91586975e-20, -7.39755731e+00])]
[array([ -1.83231311e-18, -9.00562374e-19, -3.42108252e+01]),
array([ -1.83231311e-18, -9.00562374e-19, -3.42108252e+01])]
the numbers shown here are the total field for the magnetic structure
discussed above. To access the various componenets you do: ::
discussed above. To access the various components you do: ::

>>> results[0].Lorentz
array([ 0. , 0. , 0.02303293])
array([ 0. , 0. , 0.14382354])
>>> results[0].Dipolar
array([ 3.00964434e-06, -8.91586975e-20, -7.42059024e+00])
array([ -1.83231311e-18, -9.00562374e-19, -3.43546487e+01])
>>> results[0].Contact
array([ 0., 0., 0.])
Expand Down

0 comments on commit 6cdec6f

Please sign in to comment.