Skip to content

Commit 5f20d17

Browse files
author
davidcorteso
committed
Updated base class
1 parent b9dc03a commit 5f20d17

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

fidimag/common/minimiser_base.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
from __future__ import division
22
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
65
import fidimag.common.constant as const
76
from fidimag.common.vtk import VTK
87

98

109
class MinimiserBase(object):
1110
"""
12-
13-
Base class for minimiser class. No dependency of CVODE
14-
11+
Base class for minimiser class. No dependency on CVODE
1512
"""
1613

1714
def __init__(self, mesh, spin,
@@ -71,16 +68,14 @@ def run_step(self):
7168
"""
7269
pass
7370

74-
7571
def run_step_CLIB(self):
7672
"""
7773
Cython implementation of the step. Normally you would define
7874
functions called in this method, in the lib/ folder
7975
"""
8076
pass
8177

82-
83-
def minimise(self, stopping_dm=1e-2, max_steps=2000,
78+
def minimise(self, stopping_dm=1e-2, max_steps=2000,
8479
save_data_steps=10, save_m_steps=None, save_vtk_steps=None,
8580
log_steps=1000):
8681
pass
@@ -116,7 +111,8 @@ def save_vtk(self):
116111
self.VTK.reset_data()
117112

118113
# 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')
120116
self.VTK.save_vector(self.spin.reshape(-1, 3), name='spins')
121117

122118
self.VTK.write_file(step=self.step)
@@ -134,7 +130,7 @@ def save_m(self, ZIP=False):
134130
name = '%s_npys/m_%g.npy' % (self.name, self.step)
135131
np.save(name, self.spin)
136132
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:
138134
myzip.write(name)
139135
try:
140136
os.remove(name)

0 commit comments

Comments
 (0)