Skip to content

Commit

Permalink
Added reference output (and minor improvements to example)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonfus committed Feb 13, 2017
1 parent c24f89d commit 104ec0e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 9 deletions.
Binary file added examples/MnSi/reference/DipolarTensor.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/MnSi/reference/Histogram.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/MnSi/reference/TotalFields.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions examples/MnSi/reference/run_example.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Using internal LFC library
Create sample...done!
Load CIF filedone!
Calculate dipolar tensor for equivalent sites...


Frac. muon position: 0.500 0.500 0.500
Dipolar Tensor: 0.000 -0.044 -0.044
-0.044 -0.000 -0.044
-0.044 -0.044 -0.000


Frac. muon position: 0.000 0.500 0.000
Dipolar Tensor: 0.000 -0.044 0.044
-0.044 -0.000 0.044
0.044 0.044 0.000


Frac. muon position: 0.500 0.000 0.000
Dipolar Tensor: -0.000 0.044 -0.044
0.044 0.000 0.044
-0.044 0.044 -0.000


Frac. muon position: 0.000 0.000 0.500
Dipolar Tensor: 0.000 0.044 0.044
0.044 -0.000 -0.044
0.044 -0.044 -0.000

32 changes: 23 additions & 9 deletions examples/MnSi/run_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,26 @@
"""


print("Create sample...", end='')
s = Sample()
print("done!")

print("Load CIF file", end='')
load_cif(s, 'MnSi.cif')
print("done!")

s.add_muon([0.53,0.53,0.53])
print("Calculate dipolar tensor for equivalent sites...\n")

# this is a general position along the 111,
# just to identify the form of the dipolar tensor for the sites
# along the 111
s.add_muon([0.5,0.5,0.5])

# we find the remainig eq muon sites
muon_find_equiv(s)

# apply an arbitrary small field to select magnetic atoms.
# the abslute value is not used, but it must be different from 0.
APP_FCs = 0.001*np.array([[0,0,1],
[0,0,1],
[0,0,1],
Expand All @@ -46,10 +57,11 @@
s.mm.k = np.array([0,0,0])
s.mm.fc = APP_FCs

# Calculate the dipolar tensor. Result is in Ang^-3
dts = dipten(s, [30,30,30],50) # supercell size set to 30 unit cells,
# a 50 Ang sphere si certainly contained.


# Print the muon site for all the 4 equivalent site.
for i, pos in enumerate(s.muons):
print(("\nFrac. muon position: {:2.3f} {:2.3f} {:2.3f}\n" + \
"Dipolar Tensor: {:2.3f} {:2.3f} {:2.3f}\n" + \
Expand All @@ -60,6 +72,7 @@
)


# We will now identify the position of the muon site using the TF data
# remove all defined positions for the search
muon_reset(s)

Expand Down Expand Up @@ -91,12 +104,13 @@

ax.plot(positions, values_for_plot)
ax.set_ylim([-0.7,0.7])
plt.show()
ax.set_xlabel("Position along the 111 (frac. unit)")
ax.set_ylabel("Dip. Tens. elements [emu/mol]")
plt.savefig("DipolarTensor.png")




print_cell(s)
scaled_pos = s.cell.get_scaled_positions()
pos_Mn1 = scaled_pos[0]
pos_Mn2 = scaled_pos[1]
Expand Down Expand Up @@ -186,7 +200,7 @@ def uv(vec):


# Two subplots, unpack the axes array immediately
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True, figsize=(10,5))

ax1.set_title('right-handed')
ax2.set_title('left-handed')
Expand All @@ -200,7 +214,7 @@ def uv(vec):
ax1.set_xlabel('angles [deg]')
ax2.set_xlabel('angles [deg]')

plt.show()
plt.savefig("TotalFields.png")


# Repeat with much more angles
Expand All @@ -216,7 +230,7 @@ def uv(vec):
r_LH[i].ACont = -0.066

# Two subplots, unpack the axes array immediately
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True, figsize=(10,5))

ax1.set_title('right-handed')
ax2.set_title('left-handed')
Expand Down Expand Up @@ -244,4 +258,4 @@ def uv(vec):
ax1.set_xlabel('B[T]')
ax2.set_xlabel('B[T]')

plt.show()
plt.savefig("Histogram.png")

0 comments on commit 104ec0e

Please sign in to comment.