Skip to content

Commit

Permalink
Merge pull request #86 from ubermag/dynamic_check
Browse files Browse the repository at this point in the history
check system for dynamics and energy is added
  • Loading branch information
lang-m authored Jan 24, 2024
2 parents fc4c5b0 + 0e5eb66 commit 538b906
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions micromagneticmodel/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def _schedule_commands(self, system, runner):
def _read_data(self, system):
"""Update system with simulation output (magnetisation and scalar data)."""

@abc.abstractmethod
def _check_system(self, system):
"""Check if the system contains all required information."""

def drive(
self,
system,
Expand Down Expand Up @@ -123,7 +127,7 @@ def drive(
# This method is implemented in the derived driver class. It raises
# exception if any of the arguments are not valid.
self.drive_kwargs_setup(kwargs)

self._check_system(system)
workingdir = self._setup_working_directory(
system=system, dirname=dirname, mode="drive", append=append
)
Expand Down Expand Up @@ -233,7 +237,7 @@ def schedule(
# This method is implemented in the derived driver class. It raises
# exception if any of the arguments are not valid.
self.schedule_kwargs_setup(kwargs)

self._check_system(system)
workingdir = self._setup_working_directory(
system=system, dirname=dirname, mode="drive", append=append
)
Expand Down
3 changes: 3 additions & 0 deletions micromagneticmodel/tests/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def schedule_kwargs_setup(self, schedule_kwargs):
def drive_kwargs_setup(self, drive_kwargs):
pass

def _check_system(self, system):
pass

def _write_input_files(self, system, **kwargs):
with open(f"{system.name}.input", "wt", encoding="utf-8") as f:
f.write(str(-1)) # factor -1 used to invert magnetisation direction in call
Expand Down

0 comments on commit 538b906

Please sign in to comment.