@@ -4,8 +4,8 @@ np.import_array()
44
55
66cdef extern from " clib.h" :
7-
8- void gauss_random_vec_with_init (double * x, int n)
7+ void initial_random( int seed)
8+ void gauss_random_vec (double * x, int n)
99
1010 double skyrmion_number(double * spin, double * charge,
1111 int nx, int ny, int nz, int * ngbs)
@@ -70,6 +70,8 @@ cdef extern from "clib.h":
7070 double * alpha, int * pins, double * a_J, double beta, double gamma, int n)
7171
7272 # used for sllg
73+ void llg_rhs_dw_c(double * m, double * h, double * dm, double * T, double * alpha, double * mu_s_inv, int * pins, double * eta, int n, double gamma, double dt)
74+
7375 ctypedef struct ode_solver:
7476 pass
7577
@@ -88,15 +90,6 @@ cdef extern from "clib.h":
8890 double * h, double * m, double * T,
8991 double * alpha, double * mu_s_inv, int * pins)
9092
91- def random_number (np.ndarray[double , ndim = 1 , mode = " c" ] v):
92- cdef int n = len (v)
93-
94-
95- print n
96-
97- gauss_random_vec_with_init(& v[0 ], n)
98-
99-
10093
10194def compute_skyrmion_number (np.ndarray[double , ndim = 1 , mode = " c" ] spin,
10295 np.ndarray[double , ndim = 1 , mode = " c" ] charge,
@@ -273,6 +266,26 @@ def normalise_spin(np.ndarray[double, ndim=1, mode="c"] spin, n):
273266 normalise(& spin[0 ], n)
274267
275268
269+ def init_random (seed ):
270+ initial_random(seed);
271+
272+ def random_number_array (np.ndarray[double , ndim = 1 , mode = " c" ] v):
273+
274+ cdef int n = len (v)
275+
276+ gauss_random_vec(& v[0 ], n)
277+
278+
279+ def compute_llg_rhs_dw (np.ndarray[double , ndim = 1 , mode = " c" ] dm,
280+ np.ndarray[double , ndim = 1 , mode = " c" ] spin,
281+ np.ndarray[double , ndim = 1 , mode = " c" ] field,
282+ np.ndarray[double , ndim = 1 , mode = " c" ] T,
283+ np.ndarray[double , ndim = 1 , mode = " c" ] alpha,
284+ np.ndarray[double , ndim = 1 , mode = " c" ] mu_s_inv,
285+ np.ndarray[double , ndim = 1 , mode = " c" ] eta,
286+ np.ndarray[int , ndim = 1 , mode = " c" ] pin, n , gamma , dt ):
287+ llg_rhs_dw_c(& spin[0 ], & field[0 ], & dm[0 ], & T[0 ], & alpha[0 ], & mu_s_inv[0 ], & pin[0 ], & eta[0 ], n, gamma, dt)
288+
276289
277290cdef class RK2S(object ):
278291 cdef ode_solver * _c_plan
0 commit comments