atlas.core.database package

Submodules

atlas.core.database.diversity_metrics module

Contains functions used to compute completeness metrics on the database.

class atlas.core.database.diversity_metrics.TestVendiScore(methodName='runTest')

Bases: TestCase

Unit tests for the Vendi Score computation.

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_identical_modes()

Test Scenario 2: All items are identical.

test_orthogonal_modes()

Test Scenario 1: Completely distinct items (Identity Matrix).

test_shape_and_color_overlap()

Test Scenario 4: Partial overlap (Shape & Color logic from paper).

test_two_distinct_groups()

Test Scenario 3: 4 items, 2 identical groups of 2.

atlas.core.database.diversity_metrics.compute_heuristic_sigma(feature_matrix, sample_size=10000, seed=420)

Computes the median pairwise Euclidean distance of a subsample of the dataset. This is the standard heuristic for choosing the RBF kernel bandwidth (sigma).

atlas.core.database.diversity_metrics.cosine_distance(v1, v2)

Calculates the cosine distance between two real-valued vectors. Returns a value between 0 (identical) and 1 (orthogonal for non-negative vectors).

atlas.core.database.diversity_metrics.get_circles_metric_db(dataset: list[~ase.atoms.Atoms], distance_threshold: float, descriptor_settings: dict, distance_function=<function cosine_distance>, use_custom_features: bool = True, save_descriptors: bool = False, load_descriptors: bool = False, descriptors_path: str = 'descriptors.npy', mace_model_path: str = None, descriptor_type: str = 'soap')

Computes the Circles Metric for the database.

#Circles(S; d, t) := max |C| s.t. d(x, y) > t, ∀x ≠ y ∈ C

atlas.core.database.diversity_metrics.get_feature_matrix_with_custom_features(dataset, feature_matrix_X)
atlas.core.database.diversity_metrics.get_vendi_score(feature_matrix_X: ndarray, sigma: float | None = None, k: int = 1) float

Lower time complexity than the alternative O(n^3) implementation above, but requires that the embeddings are available, and that the embedding dimension d is significantly smaller than n (d << n). This is usually the case when using MLIPs, and for large datasets.

atlas.core.database.diversity_metrics.get_vendi_score_db_rbf(dataset: list[Atoms], descriptor_type: str = 'soap', descriptor_settings: dict = None, mace_model_path: str = None, save_descriptors: bool = False, load_descriptors: bool = False, descriptors_path: str = 'descriptors.npy', sigma=None, k=1)

Computes the Vendi Score for a dataset of n structures using RBF kernel.

atlas.core.database.diversity_metrics.get_vendi_score_db_simple(dataset: list[Atoms], descriptor_type: str = 'soap', descriptor_settings: dict = None, mace_model_path: str = None, use_custom_features: bool = True, save_descriptors: bool = False, load_descriptors: bool = False, descriptors_path: str = 'descriptors.npy')

Computes the Vendi Score for a dataset of n structures.

atlas.core.database.diversity_metrics.get_vendi_score_subsampling(feature_matrix, subset_size=10000, n_iterations=4, sigma=0.1624, k=1)
atlas.core.database.diversity_metrics.load_and_save_descriptors(dataset, descriptor_type, descriptor_settings, mace_model_path, save_descriptors, load_descriptors, descriptors_path, overwrite=False)
atlas.core.database.diversity_metrics.tanimoto_distance(struct_1_descriptors, struct_2_descriptors)

Computes the Tanimoto distance.

Also known as Jaccard distance.

Module contents

Collection of utilities for structure database management and creation.