Input File

class InputFile(program: str, text_input: str = '', string_leafs: bool = False)

Class representing a key and block based text input file as used in the Amsterdam Modeling Suite.

class EntryCategory(value)

Enum representing the category of an entry in an InputFile.

Values:
  • Block: the entry is a block containing keys and other blocks

  • Key: the entry is a key with a value

class EntryType(value)

Enum representing the type of an entry in an InputFile.

Values:
  • FixedBlock: the entry is a block containing defined keys and other blocks

  • FreeBlock: the entry is a free block that is read as a list of strings representing the lines

  • EngineBlock: the entry is a free block that ends with “EndEngine”

  • InputBlock: the entry is a free block that ends with “EndInput”

  • StringKey: the entry is a key of type string

  • MultipleChoiceKey: the entry is a multiple-choice key

  • LogicalKey: the entry is a key of type logical

  • IntegerKey: the entry is a key of type integer

  • IntegerListKey: the entry is a key of type integer_list

  • RealKey: the entry is a key of type float

  • RealListKey: the entry is a key of type float_list

get(query: str)Union[int, float, bool, str, List[int], List[float], List[str]]

Returns the value of a key or free block. The return type depends on the type of the accessed key.

get_category(query: str)EntryCategory

Returns the category of an entry as defined in the JSON definition for the program.

get_entries_in_order(query: str)List[str]

Returns the entries of an ordered fixed block in the order they occurred in the input.

get_freeblock(query: str)List[str]

Returns the contents of a free block as a list of lines.

get_header(query: str)str

Returns the header of a block as a string. If a block does not have a header, an empty string is returned.

get_int(query: str)int

Returns the value of an integer key.

get_int_list(query: str)List[int]

Returns the value of an integer_list key.

get_json()str

Returns the JSON representation of the input file as a string.

get_logical(query: str)bool

Returns the value of a logical key.

get_real(query: str)float

Returns the value of a float key.

get_real_list(query: str)List[float]

Returns the value of a float_list key.

get_string(query: str)str

Returns the value of a string or multiple choice key.

get_system_blocks_as_mols()Dict[str, scm.plams.mol.molecule.Molecule]

Returns a dictionary of mapping the System blocks in the input to plams.Molecule instances.

The keys in the dictionary are the names of the systems from the headers of the blocks, e.g.:

System initial
    ...
End

would be returned as dict[“initial”]. The main system without a name in the header will have the empty string as key.

get_type(query: str)EntryType

Returns the type of an entry as defined in the JSON definition for the program.

is_defined(query: str)bool

Checks if an entry is defined in the JSON definition for the program.

is_ordered(query: str)bool

Checks if a fixed block is declared order sensitive in the JSON definition for the program.

is_present(query: str)bool

Checks if an entry is present in the input.

is_unique(query: str)bool

Check whether an entry is declared unique or recurring in the keywords definition file.

number_of_entries(query: str)int

Returns the number of occurrances of a non-unique entry.

property program

The name of the program that this instance is reading input for.

read(text_input: str, string_leafs: bool = False)None

Read more text input for the program. This is faster than constructing a new InputFile from scratch, as it will not reread the JSON definitions.

class InputError

Error thrown for issues with the input reading, e.g. reading non-existing keywords.