BaseRealWithUnits

class ase2sprkkr.common.grammar_types.basic.BaseRealWithUnits(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', min=None, max=None, nan=None, *args)[source]

The base class for float value, which can have units append. The value is converted automatically to the base units.

Class hierarchy

Inheritance diagram of ase2sprkkr.common.grammar_types.basic.BaseRealWithUnits


Constructor

Parameters:
  • prefix (str | None)

  • postfix (str | None)

  • format (str)

  • after_format (str | None)

  • default_value (Any)

  • condition (Callable[[Any], bool | str] | None)

  • after_convert (Callable[[Any], Any] | None)

  • min (int | None)

  • max (int | None)

__init__(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', min=None, max=None, nan=None, *args)
Parameters:
  • prefix (str | None)

  • postfix (str | None)

  • format (str)

  • after_format (str | None)

  • default_value (Any)

  • condition (Callable[[Any], bool | str] | None)

  • after_convert (Callable[[Any], Any] | None)

  • min (int | None)

  • max (int | None)

grammar_cache = {}

The grammar for units is cached

property unit_strings[source]
_grammar_units(units)[source]
_grammar(param_name)[source]
convert(value)[source]
_validate(value, why='set')[source]
_string(value)[source]
grammar_name()[source]
numpy_type

alias of float

allowed_types = (<class 'numpy.float64'>, <class 'float'>)
datatype_name = 'baserealwithunits'