1
1
from __future__ import division
2
2
import numpy as np
3
- import fidimag .extensions .common_clib as clib
4
- import fidimag .extensions .clib as atom_clib
5
- import fidimag .common .helper as helper
3
+ import os
4
+ import zipfile
6
5
import fidimag .common .constant as const
7
6
from fidimag .common .vtk import VTK
8
7
9
8
10
9
class MinimiserBase (object ):
11
10
"""
12
-
13
- Base class for minimiser class. No dependency of CVODE
14
-
11
+ Base class for minimiser class. No dependency on CVODE
15
12
"""
16
13
17
14
def __init__ (self , mesh , spin ,
@@ -71,16 +68,14 @@ def run_step(self):
71
68
"""
72
69
pass
73
70
74
-
75
71
def run_step_CLIB (self ):
76
72
"""
77
73
Cython implementation of the step. Normally you would define
78
74
functions called in this method, in the lib/ folder
79
75
"""
80
76
pass
81
77
82
-
83
- def minimise (self , stopping_dm = 1e-2 , max_steps = 2000 ,
78
+ def minimise (self , stopping_dm = 1e-2 , max_steps = 2000 ,
84
79
save_data_steps = 10 , save_m_steps = None , save_vtk_steps = None ,
85
80
log_steps = 1000 ):
86
81
pass
@@ -116,7 +111,8 @@ def save_vtk(self):
116
111
self .VTK .reset_data ()
117
112
118
113
# Here we save both Ms and spins as cell data
119
- self .VTK .save_scalar (self ._magnetisation / const .mu_B , name = 'magnetisation' )
114
+ self .VTK .save_scalar (self ._magnetisation / const .mu_B ,
115
+ name = 'magnetisation' )
120
116
self .VTK .save_vector (self .spin .reshape (- 1 , 3 ), name = 'spins' )
121
117
122
118
self .VTK .write_file (step = self .step )
@@ -134,7 +130,7 @@ def save_m(self, ZIP=False):
134
130
name = '%s_npys/m_%g.npy' % (self .name , self .step )
135
131
np .save (name , self .spin )
136
132
if ZIP :
137
- with zipfile .ZipFile ('%s_m.zip' % self .name , 'a' ) as myzip :
133
+ with zipfile .ZipFile ('%s_m.zip' % self .name , 'a' ) as myzip :
138
134
myzip .write (name )
139
135
try :
140
136
os .remove (name )
0 commit comments