Skip to content

Commit

Permalink
checks for system dynamic and system energy is added
Browse files Browse the repository at this point in the history
  • Loading branch information
kzqureshi committed Jan 23, 2024
1 parent 41d36ac commit 9aaeb9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion oommfc/drivers/mindriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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 "iteration"
8 changes: 7 additions & 1 deletion oommfc/drivers/timedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ 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 9aaeb9b

Please sign in to comment.