computationalmodelling / fidimag

Finite DIfference microMAGnetic code, based on Python, Cython and C
http://computationalmodelling.github.io/fidimag/
Other
60 stars 24 forks source link

Periodic hexagonal atomistic lattice creation fails #129

Open rpep opened 5 years ago

rpep commented 5 years ago
nx = 22
ny = 21
nz = 1

a = 2.5

unit_length = 1e-10
mesh = fidimag.atomistic.HexagonalMesh(nx=nx, ny=ny, 
                                                                        alignment='square',
                                                                        radius=a/2.0, unit_length=unit_length,
                                                                        periodicity=(True, False))

Returns:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-18-7a2772fa88e0> in <module>
     28 
     29 mesh = fidimag.atomistic.HexagonalMesh(nx=nx, ny=ny, alignment='square',
---> 30                                        radius=a/2.0, unit_length=unit_length, periodicity=(True, False))

~/git/fidimag/fidimag/atomistic/hexagonal_mesh.py in __init__(self, radius, nx, ny, periodicity, unit_length, alignment, shells)
    176         self.unit_length = unit_length
    177 
--> 178         self.vertices, self.hexagons = self.init_grid()
    179 
    180     def init_coordinates(self):

~/git/fidimag/fidimag/atomistic/hexagonal_mesh.py in init_grid(self)
    303                 # let the False statements just in case)
    304                 if W is not (False or -1):  # can't replace by if W because 0 == False
--> 305                     hexagon.append(hexagons[W][0])  # our NW (2) is west's NE (0)
    306                 else:
    307                     vertices.append(corners[2])

IndexError: list index out of range