Load PIPs
Functions
Detects and parses molecule information from a string or list of strings. |
|
Retrieves the dynamically loaded monomial and polynomial functions for a given molecule. |
|
Parses a comma-separated string into a list of strings. |
|
Parses a molecule string into its constituent atom counts and symmetry label. |
- molpipx.load_pip.detect_molecule(input_data)[source]
Detects and parses molecule information from a string or list of strings.
Serves as a wrapper around
parse_molecule.- Parameters:
input_data (str or list) – A single molecule string (e.g., “A2B”) or a list
strings. (of molecule)
- Returns:
If input is a string, returns the result of
parse_molecule. If input is a list, returns a list of such results.- Return type:
tuple or list
- molpipx.load_pip.get_functions(molecule_type: str, degree: str) tuple[source]
Retrieves the dynamically loaded monomial and polynomial functions for a given molecule.
Loads the corresponding Python modules from the msa_files directory based on the molecule type and polynomial degree. It specifically looks for f_monomials and f_polynomials within those modules.
- Parameters:
molecule_type (str) – The type of the molecule (e.g., “A2B”).
degree (str) – The degree of the polynomial expansion.
- Returns:
A tuple containing two callables:
(f_monomials, f_polynomials).- Return type:
tuple
- molpipx.load_pip.list_of_strings(arg)[source]
Parses a comma-separated string into a list of strings.
Used primarily as a helper for command-line argument parsing to convert inputs like “A2B,A3” into
['A2B', 'A3'].- Parameters:
arg (str) – A comma-separated string.
- Returns:
A list of substrings split by comma.
- Return type:
list
- molpipx.load_pip.parse_molecule(molecule: str)[source]
Parses a molecule string into its constituent atom counts and symmetry label.
Analyzes a string (e.g., ‘A2B’) to count atoms of types A, B, C, D, E. It verifies the order and returns a dictionary of counts along with a formatted symmetry string (e.g., ‘2_1’).
- Parameters:
molecule (str) – A string representing the molecule (e.g., “A2B”).
- Returns:
A dictionary of atom counts (e.g., {‘A’: 2, ‘B’: 1, …}) and a string representing the molecule’s numerical symmetry (e.g., “2_1”).
- Return type:
tuple