dscribe.descriptors.elementaldistribution 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.

class dscribe.descriptors.elementaldistribution.ElementalDistribution(properties, flatten=True, sparse=True)[source]

Bases: dscribe.descriptors.descriptor.Descriptor

Represents a generic distribution on any given grid for any given properties. Can create both continuos and discrete distributions.

Continuous distributions require a standard deviation and the number of sampling points. You can also specify the minimum and maximum values for the axis. If these are not specified, a limit is selected based automatically on the values with:

min = values.min() - 3*std max = values.max() + 3*std

Discrete distributions are assumed to be integer values, and you only need to specify the values.

Parameters
  • properties (dict) –

    Contains a description of the elemental property for which a distribution is created. Should contain a dictionary of the following form:

    properties={
    “property_name”: {

    “type”: “continuous” “min”: <Distribution minimum value> “max”: <Distribution maximum value> “std”: <Distribution standard deviation> “n”: <Number of discrete samples from distribution> “values”: {

    ”H”: <Value for hydrogen> …

    }

    ”property_name2”: {

    “type”: “discrete” “values”: {

    ”H”: <Value for hydrogen> …

    }

    }

  • flatten (bool) – Whether to flatten out the result.

  • sparse (bool) – Whether the output should be a sparse matrix or a dense numpy array.

create(system)[source]
Parameters

system (ase.Atoms | System) – Input system.

Returns

The concatenated distributions of the

specified properties in a sparse array.

Return type

scipy.sparse.lil_matrix

gaussian_sum(centers, weights, minimum, maximum, std, n)[source]

Calculates a discrete version of a sum of Gaussian distributions.

The calculation is done through the cumulative distribution function that is better at keeping the integral of the probability function constant with coarser grids.

The values are normalized by dividing with the maximum value of a gaussian with the given standard deviation.

Parameters
  • centers (1D np.ndarray) – The means of the gaussians.

  • weights (1D np.ndarray) – The weights for the gaussians.

  • minimum (float) – The minimum grid value

  • maximum (float) – The maximum grid value

  • std (float) – Standard deviation of the gaussian

  • n (int) – Number of grid points

  • settings (dict) – The grid settings. A dictionary containing the following information:

Returns

Value of the gaussian sums on the given grid.

get_axis(property_name)[source]

Used to return the used x-axis for the given property.

Parameters
  • property_name (str) – The property name that was used in the

  • constructor.

Returns

An array of x-axis values.

Return type

np.ndarray

get_element_occurrence(system)[source]

Calculate the count of each atomic element in the given system.

Parameters

system (ase.Atoms) – The atomic system.

Returns

The counts for each element in a list where the index of atomic number x is self.atomic_number_to_index[x]

Return type

1D ndarray

get_number_of_features()[source]

Used to inquire the final number of features that this descriptor will have.

Returns

Number of features for this descriptor.

Return type

int