AtomicSystem.explore_ff_database#
- AtomicSystem.explore_ff_database(visible_rows=20)#
Interactive Forcefield Explorer using the prompt_toolkit UI pattern.
Launches an interactive terminal user interface (TUI) that allows the user to browse and select force field parameters for each element and atom type present in the system. The explorer reads a force field database from an TOML files and presents matching parameter sets for user selection via keyboard navigation.
- Parameters:
- ff_database_dirstr, optional
Path to the directory containing the force field database. The file must contain a sheet named ‘list’ with force field parameters. Defaults to get_ff_db_path() (global constant).
- visible_rowsint, optional
Number of rows visible in the interactive table. Default is 20.
- Returns:
- None
The method updates the system’s force field parameters in-place via successive calls to set_ff_from_database() as each selection is made.
- Raises:
- FileNotFoundError
If the database file does not exist.
- ValueError
If required sheets are missing from the database.
Notes
- The interactive UI provides:
-Up/Down arrows: Navigate through parameter options -Enter/Space: Select the highlighted parameter -Ctrl+C/Escape/q: Cancel selection and skip element -p: Open the reference DOI in a web browser
The function filters the database for parameters matching each element present in the system (self.elements). For each unique element, the user is presented with a list of available parameter sets to choose from.
Examples
>>> system = AtomicSystem(...) >>> system.explore_ff_database() Assigned: H -> clayff.h* Assigned: O -> clayff.o_star
>>> # Using custom database >>> system.explore_ff_database('/path/to/database')