Objects of this class comprise a set of clusters which can be used to perform a cluster expansion
Clusters pool class
Parameters:
parent_lattice
: ParentLattice objectParent lattice of the system.
npoints
: array of integersThe number of points of the clusters in the pool. Must be of the same
dimension as radii
.
radii
: array of floatThe maximum radii of the clusters in the pool, for each corresponding
number of points in npoints
. If super_cell
is given (see below),
any element of the radii
array can be a negative number. In such a
case, all clusters fitting in the given super_cell
(for the
corresponding number of points in npoints) are generated.
super_cell
: SuperCell objectIf present, radii
is overriden and the pool will consist of all
possible simmetrically distinct clusters in the given super cell.
Periodic boundary conditions of the parent lattice are taken into
account (thus, e.g., if a supercell of side \(a\) of a square
lattice is given, then in the directions of periodicity the clusters
will not be longer than \(a/2\)).
(Note: Experimental feature. The generated multiplicities may not be
valid for clusters larger than half the size of the supercell. Use
radii
to get accurate multiplicities.)
method
: integer (1 or 2)If 1, an elimination method is used to build the clusters pool. If 2, an
incremental method is used instead. Use method 2 only if super_cell
is
None
.
filepath
: string (default: None)Overrides all the above. Used to initialize from file. Path of a json
file containing a serialized ClustersPool object, as generated
by the ClustersPool.serialize()
method.
json_db_filepath
: string (default: None)DEPRECATED, use filepath
instead. Overrides all the above. Used to initialize from file. Path of a json
file containing a serialized ClustersPool object, as generated
by the ClustersPool.serialize()
method.
Examples:
The example below, will generate all possible clusters up to 2 points in the
super cell scell
, while more compact clusters up to a radius of 4.1 and
2.9 for 3 and 4 points, respectively, are generated:
from ase import Atoms
from clusterx.parent_lattice import ParentLattice
from clusterx.super_cell import SuperCell
from clusterx.clusters.clusters_pool import ClustersPool
plat = ParentLattice(
Atoms(cell=np.diag([2,2,5]),positions=[[0,0,0]]),
site_symbols=[["Cu","Al"]],
pbc=(1,1,0)
)
scell = SuperCell(plat,np.array([(6,0,0),(0,6,0),(0,0,1)]))
cp = ClustersPool(plat, npoints=[0,1,2,3,4], radii=[0,0,-1,4.1,2.9], super_cell=scell)
cp.write_clusters_db(db_name="cpool.json")
The example
Methods:
Add other ClustersPool object to this one
The actual ClustersPool object gets modified
self._cpool_scell need be the same for both summands (at the moment not checked by the function)
Return a python-dictionary representation of the clusters pool
Display in screen information about the clusters pools
DEPRECATED: Use print_info() instead.
Displays on screen a table with information concerning the clusters pool.
Parameters:
ecis
: Array of float (optional)Effective cluster interactions. If not None
, the displayed
table contains the ECI values in the last column.
Builds an ASE’s json database object (self._atoms_db). Atoms items in the built database are a representation of the clusters embedded in a supercell appropriate for visualization with ASE’s gui.
Generate pool of clusters
Parameters:
method
: int
0: Fast, default method. 1: Slow, use only for benchmarking purposes.
Return array containing the number of points of each cluster in the pool
Return array containing the radius of each cluster in the pool
Get cluster orbit inside a supercell.
Returns a pool of clusters corresponding to a cluster orbit in the given super cell, the weights of each cluster in the orbit (accounting for the periodic boundary conditions) and the multiplicity of the cluster.
An example is as follows:
orbit = clusters_pool.get_cluster_orbit(scell, cluster_index = 3)
Here, the orbit of the fourth cluster in the pool
(i.e., the cluster clusters_pool[3]
) is computed.
orbit
is a clusters pool object, containing the orbit of the input
cluster in the supercell scell
(given as input parameter). weigths=[w1, w2, ... , wNc]
is an integer numpy array with the same
length as the orbit
, with wi
being the weight of cluster i
in the orbit. mult
is an integer number equal to the multiplicity of the cluster, i.e.,
the number of distinct realizations of the cluster which appear by the application of all
symmetries of the space group of the parent lattice. rmult
is an integer number equal to the reduced multiplicity of the cluster, i.e.,
the number of distinct realizations of the cluster which appear by the application of all
symmetries of the space group of the parent lattice, but only those which correspond to
configurations that can be relized in the supercell. The output verifies the relation \(n_{SC} m_r = \sum_i w_i\), with \(n_{SC}\) the “index” of the supercell (i.e. \(n_{SC}=N_{SC}/N_{pl}\), with \(N_{SC}\) the number of atoms in the supercell and \(N_{pl}\) the number of atoms in the parent lattice), \(m_r\) the reduced multiplicity of the cluster and \(w_i\) the weight of cluster i in the orbit. That is, the statement:
scell.get_index() * rmult == np.sum(weights)
evaluates to True
.
Parameters:
super_cell
: SuperCell objectThe super cell in which the orbit is calculated.
cluster_sites
: Array of integerthe atom indices of the cluster as referred to the SuperCell object
given in super_cell
, or the ClustersPool.get_cpool_scell()
superCell
object (see cluster_index
).
cluster_species
: array of integerDecoration (with species numbers) of the cluster for which the orbit is calculated. The species
numbers serve as index for the site cluster basis functions. Thus, for instance
if in a given site, say, i=12
, the possible species to put are 14
,
15
and 16
(14
for the pristine), then 15
represents the site
basis function with label 1
and 16
the basis function with label 2
.
tol
: floattolerance to determine whether cluster and atom positions are the same.
distances
: 2D array of floatsdistances of all of the atoms with all of the atoms. Can be used to achieve larger efficiency.
no_trans
: Booleanset to True to ignore translations of the parent_lattice inside the SuperCell. Thus a reduced orbit is obtained which only contains the symmetry operations of the parent lattice.
cluster_index
: integerIndex of a cluster in the pool. Overrides super_cell
, and the
orbit is calculated on the supercell of the ClustersPool.get_cpool_scell()
object.
cluster_positions
: list of vectors the atoms positions in cartesian coordinates. cluster_positions[i] = [ix, iy, iz], where ix,iy and iz are float numbers representing the x, y and z cartesian coordinate, respectively, of atom i.
Return cluster sets for cluster selection based on CV
Parameters:
Can take the values “size” and “combinations”. If “size”, a set in the clusters set is determined by two parameters, the maximum number of points and the maximum radius. Thus, a set is formed by all clusters in the pool whose radius and npoints are smaller or equal than the respective maxima for the set. When “combinations” is used, all possible sets up to nclmax number of clusters are returned.
The maximum clusters-set size when strategy=”combinations” is used.
The clusters-set, which is defined by the two parameters - maximum number of points (points) and the maximum radius, [points, radius] -, is included in all combinations, when strategy=”size+combinations” is used.
Return a supercell able to contain all clusters in the pool defined by
the arrays self.get_npoints()
and self.get_radii()
.
Returns the supercell which circumscribes a sphere of diameter at least
as large as the largest cluster radius.
Get arrays of atom indices and atom numbers of the clusters in the pool
Return python list containing the clusters in the pool
Get array of structure objects representing the clusters in the clusters pool
Return array of maximum radii of the clusters in the pool.
The returned float array has the same length and its elements
correspond with those of the array self.get_npoints()
. Thus, the
pool is defined by having all clusters of self.get_npoints()[i]
number of points up to a radius of self.get__max_radii()[i]
Return cluster multiplicities
The multiplicity of a cluster is equal to the number of its symmetrically equivalent realizations of it, or equivalently, the size of its orbit (without considering parent lattice translations).
Return array of number of points of the clusters in the pool.
The returned integer array has the same length and its elements
correspond with those of the array self.get_radii()
. Thus, the
pool is defined by having all clusters of self.get_npoints()[i]
number of points up to a radius of self.get_max_radii()[i]
Return parent lattice for the clusters pool
Return a ClustersPool object formed by a subset of the clusters pool
Parameters:
The indexes of the clusters to build the subpool from.
Return SuperCell instance used for the construction of the clusters pool
Return sorted array of all possible unique radii of clusters in the pool.
Print information about the clusters pools
Prints a table with information concerning the clusters pool.
Parameters:
ecis
: Array of float (optional)Effective cluster interactions. If not None
, the displayed
table contains the ECI values in the last column.
Serialize clusters pool object to json database file
The generated json file is compatible with ASE’s GUI, so you can
visualize the clusters with it. You can also initialize a new
ClustersPool object from this file, for this read the documentation
for the json_db_filepath
attribute of ClustersPool class.
Parameters:
filepath
: string (default: “cpool.json”)Name of the file to save the ClustersPool object.
db_name
: string (default: “cpool.json”)DEPRECATED, use filepath
instead. Name of the json database file.
Sort clusters pool
Write cluster orbit to Atoms JSON database
Parameters:
orbit
: python list (default: None
)list of Cluster
objects. If None
, just the clusters in the ClustersPool
object are written.
super_cell
: SuperCell
object (default: None
)The supercell in which the clusters are supported.
If None
, the SuperCell
object of self
(output of method get_cpool_scell()
) is used.
db_name
: stringName of the json file containing the database