soprano.collection.generate.rattle#
Generator producing structures rattled of a given amount
Functions
|
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 randomizeamplitude (float or np.ndarray): the amplitude of the randomdisplacement. Can be a single floatfor all atoms, a 1D numpy array oflength N (N being the number ofatoms, one value each) or a 2D numpyarray of shape (N,3) (one value foreach dimension).These values are used as interval foruniform random numbers and as stdevfor normal random numbersn (int): maximum number of structures to generate. If set to None willgenerate infinite structuresmethod (str): must be either ‘uniform’ or ‘normal’. In the first casethe rattling will be a uniform random number between+amplitude and -amplitude. In the second case it will bea gaussian random number with +amplitude standarddeviation.Returns:rattleGenerator (generator): an iterator that yields copies of thebase structure with randomly displacedatoms.