Skip to content

Commit

Permalink
Add some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Jan 9, 2025
1 parent e23238d commit 826b815
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def update(self, specific=""): # noqa: ARG002
self.moments = self._get_default_moments()

def update_type_help(self):
"""Update the type field help text w.r.t the current model state."""
if self.electronic_type == "insulator" or self.type == "tot_magnetization":
self.type_help = self._TYPE_HELP_TEMPLATE.format(
content="""
Expand All @@ -92,6 +93,9 @@ def update_type_help(self):
)

def update_default_starting_magnetization(self):
"""Update the default starting magnetization based on the structure and
pseudopotential family.
"""
if not self.has_structure:
# TODO this guard shouldn't be here! It IS here only because in the present
# implementation, an update is called on app start. This breaks lazy loading
Expand All @@ -115,6 +119,7 @@ def _update_default_moments(self):
}

def _to_moment(self, symbol: str, family: PseudoPotentialFamily) -> float:
"""Convert the default magnetization to an initial magnetic moment."""
magnetization = (
self._default_starting_magnetization.get(symbol, 0.1)
if self._DEFAULT_MOMENTS.get(symbol, {}).get("magmom")
Expand Down

0 comments on commit 826b815

Please sign in to comment.