soprano.collection.generate.rattle

Contents

soprano.collection.generate.rattle#

Generator producing structures rattled of a given amount

Functions

rattleGen(struct[, amplitude, n, method])

Generator function to create multiple structures by randomly displacing atoms of a given amount.

soprano.collection.generate.rattle.rattleGen(struct, amplitude=0.01, n=100, method='uniform')[source]#

Generator function to create multiple structures by randomly displacing atoms of a given amount.

Args:
struct (ase.Atoms): the starting structure to randomize
amplitude (float or np.ndarray): the amplitude of the random
displacement. Can be a single float
for all atoms, a 1D numpy array of
length N (N being the number of
atoms, one value each) or a 2D numpy
array of shape (N,3) (one value for
each dimension).
These values are used as interval for
uniform random numbers and as stdev
for normal random numbers
n (int): maximum number of structures to generate. If set to None will
generate infinite structures
method (str): must be either ‘uniform’ or ‘normal’. In the first case
the rattling will be a uniform random number between
+amplitude and -amplitude. In the second case it will be
a gaussian random number with +amplitude standard
deviation.
Returns:
rattleGenerator (generator): an iterator that yields copies of the
base structure with randomly displaced
atoms.