Skip to content

Commit f2396ff

Browse files
author
davidcorteso
committed
Added documentation to meshes
1 parent 34e8012 commit f2396ff

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

fidimag/atomistic/exchange.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def my_exchange(pos):
7676
will not call array elements to compute the neighbours contribution but
7777
it will only use a constant, thus it should be faster
7878
79+
* If option 3. is pecified for the J parameter, this class will call the
80+
full exchange calculation function from the C library
81+
7982
"""
8083

8184
def __init__(self, J, name='Exchange'):

fidimag/atomistic/hexagonal_mesh.py

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def __init__(self, radius, nx, ny,
5757
height = sqrt(3) * radius
5858
width = 2 * radius.
5959
60+
radius ::
61+
6062
The radius is for an incircle inside the hexagon, thus the distance
6163
between two lattice sites at the same y coordinate, is just 2 * radius,
6264
which can be seen as the triangular lattice constant.
@@ -68,15 +70,41 @@ def __init__(self, radius, nx, ny,
6870
distance, in terms of dx = 2 * radius, can be easily calculated as
6971
2 * dx / sqrt(3), since the hexagon height is: (3 / 4) * height
7072
73+
alignment ::
74+
75+
The alignment of the hexagons can be set to 'diagonal' or 'square'. In
76+
both cases the matrix with the neighbours indexes will have the same
77+
order for every row (see definition of shells)
78+
79+
periodicity ::
80+
7181
By default, the mesh is not periodic along any axis, so the periodicity
7282
is set to (False, False). Passing a tuple with any combination of
7383
entries set to True will enable periodicity along the given axes.
84+
Periodic boundaries are not defined when using a 'square' alignment.
7485
75-
The alignment of the hexagons can be set to 'diagonal' or 'square' In
76-
both cases the matrix with the neighbours indexes will have the same
77-
order for every row (lattice site):
86+
unit_length ::
87+
88+
The scale unit for the lattice distances. Default is 1.0 but it is
89+
commonly used a nm = 1e-9
90+
91+
shells ::
92+
93+
An integer specifying the number of shells of neighbours to be computed
94+
and stored in the *ngbs array. By default, a value of 1 indicates
95+
only nearest neighbours. The *ngbs array has the structure:
96+
97+
[ [ ngbs_1st_shell_0 negbs_2nd_shell_0 ... ], --> ngbs of spin 0
98+
[ ngbs_1st_shell_1 negbs_2nd_shell_1 ... ], --> ngbs of spin 1
99+
...
100+
[ ngbs_1st_shell_n negbs_2nd_shell_n ... ] --> ngbs of spin n
101+
]
102+
103+
where ngbs_1st_shell_i are the nearest neighbours of the i-th spin in
104+
the order:
105+
[ left right top_right bottom_left top_left bottom_right ]
78106
79-
| left right top_right bottom_left top_left bottom_right |
107+
For the other shells see the *_ngbs_Xth_shell methods from this class
80108
81109
"""
82110

@@ -315,7 +343,7 @@ def index(self, i, j):
315343
i = 0 # to the left
316344
if self.periodicity[1]:
317345
if self.alignment == 'square':
318-
raise Exception('PBCs Not well'
346+
raise Exception('PBCs not well '
319347
'defined for a square arrangement')
320348
# if j == -1:
321349
# i += int(self.ny / 2)
@@ -386,6 +414,9 @@ def hexagon_corners(self, x, y, radius):
386414
0) for theta in angle_rad]
387415

388416
# -------------------------------------------------------------------------
417+
# Functions that return the number of neighbours at the n-th shell at
418+
# a lattice site with position indexes (i, j). For example,
419+
# the function _ngbs_first_shell returns the nearest neighbours
389420

390421
def _ngbs_first_shell(self, i, j):
391422

fidimag/common/cuboid_mesh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, dx=1, dy=1, dz=1, nx=1, ny=1, nz=1, x0=0, y0=0, z0=0,
5454
5555
"""
5656

57-
# total number of neighbours per lattice site
57+
# Total number of neighbours per lattice site
5858
# (only nearest ngbs for now)
5959
self.n_ngbs = 6
6060

0 commit comments

Comments
 (0)