Skip to content

Commit

Permalink
checking the system for dynamics and energy presence
Browse files Browse the repository at this point in the history
  • Loading branch information
kzqureshi committed Jan 23, 2024
1 parent 97e27a0 commit a546490
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mumax3c/drivers/mindriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ class MinDriver(Driver):

def _checkargs(self, **kwargs):
pass # no kwargs should be checked

def check_system(self, system):
"""Checks the system has energy in it"""
if len(system.energy)==0:
raise AttributeError("System's energy is not defined")

@property
def _x(self):
return "t" # TODO correct iteration
8 changes: 7 additions & 1 deletion mumax3c/drivers/relaxdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ class RelaxDriver(Driver):

def _checkargs(self, **kwargs):
pass # no kwargs should be checked

def check_system(self, system):
"""Checks the system has dynamics in it"""
if len(system.dynamics)==0:
raise AttributeError("System's dynamics is not defined")
if len(system.energy)==0:
raise AttributeError("System's energy is not defined")

@property
def _x(self):
return "t" # TODO correct iteration
9 changes: 8 additions & 1 deletion mumax3c/drivers/timedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ def _checkargs(self, **kwargs):
if n <= 0:
msg = f"Cannot drive with {n=}."
raise ValueError(msg)


def check_system(self, system):
"""Checks the system has dynamics in it"""
if len(system.dynamics)==0:
raise AttributeError("System's dynamics is not defined")
if len(system.energy)==0:
raise AttributeError("System's energy is not defined")

@property
def _x(self):
return "t"

0 comments on commit a546490

Please sign in to comment.