dscribe.utils package

Submodules

dscribe.utils.geometry module

Copyright 2019 DScribe developers

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

dscribe.utils.geometry.get_adjacency_list(adjacency_matrix)[source]

Used to transform an adjacency matrix into an adjacency list. The adjacency list provides much faster access to the neighbours of a node.

Parameters

adjacency_matrix (scipy.sparse.spmatrix) – The adjacency matrix from which the adjacency list is constructed from. Any of the scipy sparse matrix classes.

Returns

A list of neighbouring indices. The list of neighbouring indices for atom at index i is given by accessing the ith element of this list.

Return type

list

dscribe.utils.geometry.get_adjacency_matrix(radius, pos1, pos2=None, output_type='coo_matrix')[source]

Calculates a sparse adjacency matrix by only considering distances within a certain cutoff. Uses a k-d tree to reach O(n log(N)) time complexity.

Parameters
  • radius (float) – The cutoff radius within which distances are calculated. Distances outside this radius are not included.

  • pos1 (np.ndarray) – A list of N-dimensional positions.

  • pos2 (np.ndarray) – A list of N-dimensional positions. If not provided, is assumed to be the same as pos1.

  • output_type (str) – Which container to use for output data. Options: “dok_matrix”, “coo_matrix”, “dict”, or “ndarray”. Default: “dok_matrix”.

Returns

Symmetric sparse 2D matrix containing the pairwise distances.

Return type

dok_matrix | np.array | coo_matrix | dict

dscribe.utils.geometry.get_extended_system(system, radial_cutoff, centers=None, return_cell_indices=False)[source]

Used to create a periodically extended system. If centers are not specified, simply takes returns the original system multiplied by an integer amount of times in each direction to cover the radial cutoff. If centers are provided, returns the exact atoms that are within the given radial cutoff from the given centers.

Parameters
  • original_system (ase.Atoms) – The original periodic system to duplicate.

  • radial_cutoff (float) – The radial cutoff to use in constructing the extended system.

  • centers (np.ndarray) – Array of xyz-coordinates from which the distance is calculated. If provided, these centers are used to calculate the exact distance and only atoms within the radial cutoff from these centers are returned.

  • return_cell_indices (boolean) – Whether to return an array of cell indices for each atom in the extended system.

Returns

If return_cell_indices is False, returns the new extended system. Else returns a tuple containing the new extended system as the first entry and the index of the periodically repeated cell for each atom as the second entry.

Return type

ase.Atoms | tuple

dscribe.utils.species module

Copyright 2019 DScribe developers

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

dscribe.utils.species.get_atomic_numbers(species)[source]

Given a list of chemical species either as a atomic numbers or chemical symbols, return the correponding list of ordered atomic numbers with duplicates removed.

Parameters

species (iterable of ints or strings) –

Returns

list of atomic numbers as an integer array.

Return type

np.ndarray

dscribe.utils.species.symbols_to_numbers(symbols)[source]

Transforms a set of chemical symbols into the corresponding atomic numbers.

Parameters

symbols (iterable) – List of chemical symbols.

Returns

Atomic numbers as an array of integers.

Return type

np.ndarray

dscribe.utils.stats module

Copyright 2019 DScribe developers

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

dscribe.utils.stats.system_stats(system_iterator)[source]
Parameters

system_stats (iterable containing ASE.Atoms or System) – The atomic systems for which to gather statistics.

Returns

A dictionary of different statistics for the system. The dictionary will contain:

n_atoms_max: The maximum number of atoms in a system. max_atomic_number: The highest atomic number min_atomic_number: The lowest atomic number atomic_numbers: List of present atomic numbers element_symbols: List of present atomic symbols min_distance: Minimum distance in the system

Return type

Dict

Module contents

Copyright 2019 DScribe developers

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.