Final fix of hexpoints + some ipynb demo.

Former-commit-id: cf3c5256aef489e0ac813182593a23bce2d6c3d8
This commit is contained in:
Marek Nečada 2017-02-05 22:38:58 +02:00
parent af4eb887c4
commit d76a036c33
3 changed files with 7 additions and 4 deletions

View File

@ -4,3 +4,4 @@ __version__ = get_distribution('qpms').version
from qpms_c import *
from .qpms_p import *
from .lattices import *
from .hexpoints import *

View File

@ -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

View File

@ -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'],