SectionString

class ase2sprkkr.potentials.custom_potential_section.SectionString(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='')[source]

The grammar_type of a custom section - i.e. string, that ends with a section separator.

This grammar_type as used as a value type for the custom section.

Class hierarchy

Inheritance diagram of ase2sprkkr.potentials.custom_potential_section.SectionString

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)

__init__(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='')

Create the object.

Parameters:
  • prefix (str | None) – The string, that will be printed before the value

  • postfix (str | None) – The string, that will be printed after the value

  • format (str) – The (python) format string, that will be used for outputing the value. The format is passed as format argument to str.format routine.

  • after_format (str | None) – In some cases, the additional formating is required after converting to the string and adding postfix/prefix.

  • default_value (Any) – The default value of the options of this type. None means no default value.

  • condition (Callable[[Any], bool | str] | None) – Function, that check the validity of the value. It should return True for a valid value, and False or string for invalid. The string is interpreted as an error message that explains the invalidity of the value.

  • after_convert (Callable[[Any], Any] | None) – Function, that - if it is given - is applied to the (entered or parsed) value. The function is applied on the result of the convert method

delimiter_pattern = '(?:[ \t\r]*(?:\n[ \t\r]*)*)*\n[*][*][*][*][*][*][*][*][*][*][*]*(?:[ \t\r]*(?:\n[ \t\r]*))*\n'
grammar_of_delimiter = Suppress:(*******************************************************************************<newline>)
Parameters:

name (str | None)

Return type:

ParserElement

_grammar = EndOfSection[source]
Parameters:

name (str | None)

Return type:

ParserElement

grammar_name()[source]

Human readable expression of the grammar. By default, this is what is set by grammar.setName, however, sometimes is desirable to set even shorter string

write(f, value)[source]

Output the value to the stream (in the propper format).

I = <SectionString>