-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrelax.go
58 lines (49 loc) · 974 Bytes
/
relax.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package vinamax
import (
//"fmt"
"log"
"math"
)
func Relax() {
backuptol := Errortolerance
backuptime := T
backupdt := Dt
gammaoveralpha = gamma0 / (1. + (Alpha * Alpha))
relax = true
if Demag {
calculatedemag()
}
rk23step(Universe.lijst)
Errortolerance = 1e-1
for maxtauwitht > 5e-8 {
if Demag {
calculatedemag()
}
rk23step(Universe.lijst)
if maxtauwitht > Errortolerance {
undobadstep(Universe.lijst)
if BrownianRotation {
undobadstep_u_anis(Universe.lijst)
}
if Dt == Mindt {
log.Fatal("mindt is too small for your specified error tolerance")
}
}
Dt = 0.95 * Dt * math.Pow(Errortolerance/maxtauwitht, (1./float64(order)))
if Dt < Mindt {
Dt = Mindt
}
if Dt > Maxdt {
Dt = Maxdt
}
//fmt.Println(maxtauwitht,"\t",Errortolerance)
if maxtauwitht < Errortolerance/4 {
Errortolerance /= 1.4142
}
T = backuptime
}
Errortolerance = backuptol
T = backuptime
Dt = backupdt
relax = false
}