-
Notifications
You must be signed in to change notification settings - Fork 1
/
lltorque.go
34 lines (28 loc) · 875 Bytes
/
lltorque.go
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
package cuda
import (
"unsafe"
"github.com/mumax/3/data"
)
// Landau-Lifshitz torque divided by gamma0:
// - 1/(1+α²) [ m x B + α m x (m x B) ]
// torque in Tesla
// m normalized
// B in Tesla
// see lltorque.cu
func LLTorque(torque, m, B *data.Slice, alpha LUTPtr, regions *Bytes) {
N := torque.Len()
cfg := make1DConf(N)
k_lltorque_async(torque.DevPtr(X), torque.DevPtr(Y), torque.DevPtr(Z),
m.DevPtr(X), m.DevPtr(Y), m.DevPtr(Z),
B.DevPtr(X), B.DevPtr(Y), B.DevPtr(Z),
unsafe.Pointer(alpha), regions.Ptr, N, cfg)
}
// Landau-Lifshitz torque with precession disabled.
// Used by engine.Relax().
func LLNoPrecess(torque, m, B *data.Slice) {
N := torque.Len()
cfg := make1DConf(N)
k_llnoprecess_async(torque.DevPtr(X), torque.DevPtr(Y), torque.DevPtr(Z),
m.DevPtr(X), m.DevPtr(Y), m.DevPtr(Z),
B.DevPtr(X), B.DevPtr(Y), B.DevPtr(Z), N, cfg)
}