@@ -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
0 commit comments