-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcxtallite.pxd
66 lines (44 loc) · 1.38 KB
/
cxtallite.pxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import cython
import math, random, os
import numpy as np
cimport numpy as np
#############################
# SETUP FOR TYPE DEFINITION #
#############################
np.import_array()
cdef extern from "numpy/npy_math.h":
double NPY_INFINITY
# Determine the right dtype for arrays of indices at compile time.
IF UNAME_MACHINE[-2:] == '64':
ctypedef np.int64_t INTP_t
ELSE:
ctypedef np.int32_t INTP_t
ctypedef np.float64_t DTYPE_t
cdef inline DTYPE_t DTYPE_sgn(DTYPE_t a): return 1.0 if a >= 0.0 else -1.0
cdef inline DTYPE_t DTYPE_abs(DTYPE_t a): return a if a>=0 else -a
######################
# MODULE DECLARATION #
######################
cdef class Quaternion:
cdef public double w,x,y,z
cdef class Rodrigues:
cdef public np.ndarray v
cdef Quaternion __q
cdef class Eulers:
cdef public double phi1, PHI, phi2
cdef Quaternion __q
cdef class OrientationMatrix:
cdef public np.ndarray g
cdef public np.ndarray r
cdef Quaternion __q
cdef Quaternion __getq(self)
cdef class Xtallite:
cdef public np.ndarray eulers, pt, dv, stress, strain
cdef public str lattice
cdef Quaternion __q
cdef Quaternion getDq(self, Quaternion q0, Quaternion q1, str lattice)
cdef class Aggregate:
cdef list xtals
cdef INTP_t texture
cdef INTP_t gid
cdef Quaternion __findAverageQ(self)