diff --git a/qpms/__init__.py b/qpms/__init__.py index f202b6a..c2d880c 100644 --- a/qpms/__init__.py +++ b/qpms/__init__.py @@ -4,3 +4,4 @@ __version__ = get_distribution('qpms').version from qpms_c import * from .qpms_p import * from .lattices import * +from .hexpoints import * diff --git a/qpms/hex.py b/qpms/hexpoints.py similarity index 93% rename from qpms/hex.py rename to qpms/hexpoints.py index 75af9ce..7a04db5 100644 --- a/qpms/hex.py +++ b/qpms/hexpoints.py @@ -1,12 +1,12 @@ import math import numpy as np +nx = None _s3 = math.sqrt(3) -_e6 = np.array([[math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6),0] if v3d else [math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6)] for i in range(6)]) -_f6 = np.array([[-math.sin(2*math.pi*i/6),math.cos(2*math.pi*i/6),0] if v3d else [math.sin(2*math.pi*i/6),-math.cos(2*math.pi*i/6)] for i in range(6)]) - + def generate_trianglepoints(maxlayer, include_origin = False, v3d = True, circular = True, sixthindices = False, mirrorindices = False): + _e6 = np.array([[math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6),0] if v3d else [math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6)] for i in range(6)]) points = np.empty((3*maxlayer*(maxlayer+1)+(1 if include_origin else 0), 3 if v3d else 2)) point_i = 0 if (include_origin): @@ -72,6 +72,8 @@ def generate_trianglepoints(maxlayer, include_origin = False, v3d = True, circul 'nmi' : nmi if mirrorindices else None} def generate_trianglepoints_hexcomplement(maxlayer, v3d = True, circular = True, thirdindices = False, mirrorindices=False): + _e6 = np.array([[math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6),0] if v3d else [math.cos(2*math.pi*i/6),math.sin(2*math.pi*i/6)] for i in range(6)]) + _f6 = np.array([[-math.sin(2*math.pi*i/6),math.cos(2*math.pi*i/6),0] if v3d else [math.sin(2*math.pi*i/6),-math.cos(2*math.pi*i/6)] for i in range(6)]) points = np.empty((3*maxlayer*maxlayer, 3 if v3d else 2)) point_i = 0 # 3 * layer ** 2 is the basis index for a layer, a layer contains 3 * (2*layer + 1) points diff --git a/setup.py b/setup.py index ab8e9b5..b5ae396 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ qpms_c = Extension('qpms_c', sources = ['qpms/qpms_c.pyx']) setup(name='qpms', - version = "0.1.7", + version = "0.1.8", packages=['qpms'], # setup_requires=['setuptools_cython'], install_requires=['cython>=0.21','quaternion','spherical_functions','py_gmm'],