Code
nablachem.space
nablachem.space.ApproximateCounter
nablachem.space.ApproximateCounter.score_database(search_space, natoms, sum_formulas, selection=None)
Implements the Kolmogorov-Smirnov statistic comparing the distribution of the database to the expected distribution.
The best score is 0, the worst is 1.
This does not test the distribution of molecules within a given sum formula.
nablachem.space.ExactCounter
nablachem.space.SearchSpace
nablachem.space.SearchSpace.covered_search_space(kind)
staticmethod
Returns the pre-defined chemical spaces from the original publication
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kind |
str
|
Label, either A or B. |
required |
Returns:
Type | Description |
---|---|
SearchSpace
|
The chosen space. |
nablachem.space.SearchSpace.list_cases_bare(natoms, degree_sequences_only=False, pure_sequences_only=False)
Lists all possible stoichiometries for a given number of atoms.
If degree_sequences_only is set to True, only unique degree sequences are returned, i.e. the element names are not considered.
Optimized for performance, so yields tuples. Use list_cases() for a more user-friendly interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
natoms |
int
|
Number of atoms in the molecule. |
required |
degree_sequences_only |
bool
|
Flag to switch to degree sequence enumeration, by default False |
False
|
pure_sequences_only |
bool
|
Skips sequences where atoms of one valence belong to more than one element label. Implies degree_sequences_only. |
False
|
Yields:
Type | Description |
---|---|
Iterator[tuple[str, int, int]] | Iterator[tuple[int, int]]
|
Either tuples of (element, valence, count) or (valence, count). Guaranteed to be sorted by (valence, count). |
nablachem.utils
nablachem.utils.integer_partition(total, maxelements)
Builds all integer partitions of total split into maxelements parts.