Additional Python components

BaseOptimizer

BaseOptimizer serves as base for all optimizers.

class icet.fitting.base_optimizer.BaseOptimizer(fit_data, fit_method, standardize=True, seed=42)

BaseOptimizer class.

Serves as base class for all Optimizers solving Ax = y.

Parameters:
  • fit_data (tuple of NumPy (N, M) array and NumPy (N) array) – the first element of the tuple represents the fit matrix A whereas the second element represents the vector of target values y; here N (=rows of A, elements of y) equals the number of target values and M (=columns of A) equals the number of parameters
  • fit_method (string) – method to be used for training; possible choice are “least-squares”, “lasso”, “elasticnet”, “bayesian-ridge”, “ardr”
  • standardize (bool) – whether or not to standardize the fit matrix before fitting
  • seed (int) – seed for pseudo random number generator
compute_rmse(A, y)

Compute the root mean square error using the A, y, and the vector of fitted parameters x corresponding to ||Ax-y||_2.

Parameters:
  • A (NumPy (N, M) array) – fit matrix where N (=rows of A, elements of y) equals the number of target values and M (=columns of A) equals the number of parameters (=elements of x)
  • y (NumPy (N) array) – vector of target values
Returns:

root mean squared error

Return type:

float

fit_method

string – fit method.

get_contributions(A)

Compute the average contribution to the predicted values from each element of the parameter vector.

Parameters:A (NumPy (N, M) array) – fit matrix where N (=rows of A, elements of y) equals the number of target values and M (=columns of A) equals the number of parameters
Returns:average contribution for each row of A from each parameter
Return type:NumPy (N, M) array
number_of_nonzero_parameters

int – number of non-zero parameters

number_of_parameters

int – number of parameters (=columns in A matrix).

number_of_target_values

int – number of target values (=rows in A matrix).

parameters

NumPy array – copy of parameter vector.

predict(A)

Predict data given an input matrix A, i.e., Ax, where x is the vector of the fitted parameters.

Parameters:A (NumPy (N, M) array or NumPy (M, )) – fit matrix where N (=rows of A, elements of y) equals the number of target values and M (=columns of A) equals the number of parameters
Returns:vector of predicted values
Return type:NumPy (N) array, or float if single row is inputed
seed

int – seed used to initialize pseudo random number generator.

standardize

bool – whether or not to standardize the fit matrix before fitting.

summary

dict – Comprehensive information about the optimizer.

Geometry

icet.tools.geometry.add_vacuum_in_non_pbc(atoms)

Add vacuum in non-periodic directions.

Parameters:atoms (ASE Atoms object) – input structure
Returns:output structure
Return type:ASE Atoms object
icet.tools.geometry.find_lattice_site_by_position(atoms, position, tol=0.0001)

Tries to construct a lattice site equivalent from position in reference to the atoms object.

atoms : ASE Atoms object position : x,y,z coordinate

icet.tools.geometry.find_permutation(target, permutated)

Returns the permutation vector that takes permutated to target

Parameters:
  • target (some container) – container should allow .index and the
  • elements should contain objects (containers) –
  • __eq__ method (with) –
  • permutated (some container) – container should allow .index and the
  • elements should contain objects
  • __eq__ method
icet.tools.geometry.fractional_to_cartesian(atoms, frac_positions)

Turns fractional positions into cartesian positions.

icet.tools.geometry.get_fractional_positions_from_ase_neighbor_list(atoms, neighbor_list)

Returns the fractional positions in structure from the neighbors in the neighbor list.

Parameters:
  • atoms (ASE Atoms object) –
  • neighbor_list (ASE NeighborList object) –
icet.tools.geometry.get_fractional_positions_from_neighbor_list(structure, neighbor_list)

Returns the fractional positions in structure from the neighbors in the neighbor list.

icet.tools.geometry.get_permutation(container, permutation)

Return the permuted version of container.

icet.tools.geometry.get_position_from_lattice_site(atoms, lattice_site)

Gets the corresponding position from the lattice site.

Parameters:
  • atoms (ASE atoms object) –
  • lattice_site (icet LatticeSite object) –
icet.tools.geometry.get_primitive_structure(atoms, no_idealize=True)

Determines primitive structure using spglib.

Parameters:atoms (ASE Atoms object) – input structure
Returns:output structure
Return type:ASE Atoms object
icet.tools.geometry.get_scaled_positions(positions, cell, wrap=True, pbc=[True, True, True])

Get positions in reduced (scaled) coordinates.

If wrap is True, positions outside the unit cell will be wrapped into the cell in the directions with periodic boundary conditions such that the scaled coordinates are between zero and one.

LocalOrbitListGenerator

class icet.core.local_orbit_list_generator.LocalOrbitListGenerator
clear()
generate_full_orbit_list()
generate_local_orbit_list()
get_prim_to_supercell_map()
get_unique_offsets_count()
get_unique_primcell_offsets()

ManyBodyNeighborList

class icet.core.many_body_neighbor_list.ManyBodyNeighborList
build()
calculate_intersection()

NeighborList

icet.core.neighbor_list.get_neighbor_lists(atoms, cutoffs=None)

Returns list of icet neighbor lists from a configuration and cutoffs.

Parameters:
  • atoms (ASE Atoms object / icet Structure object (bi-optional)) – atomic configuration
  • cutoffs – positive floats indicating the cutoffs for the various clusters
Returns:

Return type:

list of NeighborList objects

Orbit

class icet.core.orbit.Orbit
add_equivalent_sites()
allowed_permutations

Get the list of equivalent permutations for this orbit.

If this orbit is a triplet and the permutation [0,2,1] exists this means that The lattice sites [s1, s2, s3] are equivalent to [s1, s3, s2] This will have the effect that for a ternary CE the cluster functions (0,1,0) will not be considered since it is equivalent to (0,0,1).

equivalent_sites

List of equivalent Lattice Sites

get_all_possible_mc_vector_permutations()

Similar to get all permutations but needs to be filtered through the number of allowed elements.

Parameters:
  • allowed_components (list of int) – The allowed components for the lattice sites, allowed_components[i] correspond to the lattice site self.representative_sites[i].
  • all_mc_vectors (returns) –
get_allowed_sites_permutations()
get_equivalent_sites()
get_equivalent_sites_permutations()
get_mc_vectors()

Return the mc vectors for this orbit given the allowed components. The mc vectors are returned as a list of tuples

Parameters:allowed_components (list of int) – The allowed components for the lattice sites, allowed_components[i] correspond to the number of allowed compoments at lattice site orbit.representative_sites[i].
get_representative_cluster()

The representative cluster represents the geometrical version of what this orbit is.

get_representative_sites()
get_sites_with_permutation()

Return the permuted to representative sites of equivalent_sites[index].

order

Returns the order of the orbit. The order is the same as the number of bodies in the representative cluster or the number of lattice sites per element in equivalent_sites.

permutations_to_representative

Get the list of permutations. Where permutations_to_representative[i] takes self.equivalent_sites[i] to the same order as self.representative_sites.

This can be used if you for example want to count elements and are interested in difference between ABB, BAB, BBA and so on. If you count the lattice sites that are permuted according to these permutations then you will get the correct counts.

permuted_sites

Get the equivalent sites but permuted to representative site.

radius

Returns the radius of the representative cluster.

representative_cluster

The representative cluster represents the geometrical version of what this orbit is.

representative_sites

The representative sites is a list of lattice sites that are uniquely picked out for this orbit which can be used to represent and distinguish between orbits.

sort()

Sort the equivalent sites list.

OrbitList

icet.core.orbit_list.create_orbit_list(structure, cutoffs, verbosity=0)

Build an orbit list.

Parameters:
  • structure (icet Structure or ASE Atoms object (bioptional)) – input configuration used to initialize mbnl and permutation matrix
  • cutoffs (list of float) – cutoff radii for each order
  • verbosity (int) – verbosity level
Returns:

Return type:

OrbitList object

PermutationMap

icet.core.permutation_map.permutation_matrix_from_atoms(atoms, cutoff, find_prim=True, verbosity=0)

Set up a list of permutation maps from an atoms object.

Parameters:
  • atoms (ASE Atoms object) – input structure
  • cutoff (float) – cutoff radius
  • find_primitive (boolean) – if True the symmetries of the primitive structure will be employed
  • verbosity (int) – level of verbosity
Returns:

the tuple comprises the permutation matrix, the primitive structure, and the neighbor list

Return type:

matrix, icet Structure object, NeighborList object

Structure