perturb

dpdata will disturb the box size and shape and change atom coordinates randomly.

dpdata.System('./POSCAR').perturb(pert_num=3, 
    box_pert_fraction=0.02, 
    atom_pert_fraction=0.01, 
    atom_pert_style='normal')

pert_num

Each frame in the input system will generate pert_num frames.
That means the command will return a system containing frames of input system * pert_num frames.

box_pert_fraction

A relative length that determines the length the box size change in each frame. It is just a fraction and doesn't have unit. Typlicaly, for cubic box with side length a , a will increase or decrease a random value from the intervel [-a*box_pert_fraction, a*box_pert_fraction].

It will also change the shape of the box. That means an orthogonal box will become a non-orthogonal box after perturbing. The angle of inclination of the box is a random variable.
box_pert_fraction is also relating to the probability distribution function of the angle.

See more details about how it will change the box below.

atom_pert_fraction

A relative length that determines the length atom moves in each frame. It is just a fraction and doesn't have unit. Typlicaly, for a cubic box with side length a , the mean value of the distance that atom moves is approximate a*atom_pert_fraction.

atom_pert_style

The probability distribution function used to change atom coordinates.
available options:'uniform' 'normal' 'const'.

uniform means that if the box is a cube with side length a, how far atoms in the cube move is a random vector with max length a*atom_pert_fraction.

normal means the squares of the distance atoms move are subject to a chi-square distribution with 3 degrees of freedom (chi-square distribution can be seen as the sum of squares of normal distributed random variable. This is why we name this option as 'normal'.).
If the box is a cube with side length a, the mean value of the distance atom moves is a*atom_pert_fraction.

const means that if the box is a cube with side length a, the distance atom moves is always a*atom_pert_fraction (For triclinic box, the distances are not equal.)

The direction atoms move and box deformation is random.

See more details about how atoms will move below.

The perturb details


For each frame in the input system,dpdata will repeat the following steps pert_num times. That means the command will return a system containing frames of input system * pert_num frames.

first step: box deform, and atom moves correspondingly

1. generate a perturb matrix for box and atoms


dpdata will generate a perturb matrix

L1=(n1+1n2/2n4/2n2/2n3+1n5/2n4/2n5/2n6+1)

ni,i{1,2,3,4,5,6} are independent variables which are subject to uniform
distrubution on interval
[box_pert_fractionbox_pert_fraction]
.
That is
niU(box_pert_fractionbox_pert_fraction)

2.box deforms


The origin box matrix of this frame is defined as

Bo, usually with lower lower triangular matrix form. That is:

origin_box_matrixBo=(xx00xyyy0xzyzzz)

The box matrix after deformation will be

deformed_box_matrixBd=BoL1

3.atoms relocate in the new box.


The atom coordinates in this frame will change correspondingly.
That is,
for atom with index

j,j{0,1,2,3,...,atom_num1} in the frame with coordinate
rj=(xj,yj,zj)
,
the coordinate after deformation
rjd
will become the matrix multiplication of
rj
and
L1
.
That is:
rjd=rjL1

second step: perturb atoms randomly.

1. generate a random vector
lj
for each atom


For each atom with index

j,j{0,1,2,3,...,atom_num1} in the frame with coordinate
rjd=(xjd,yjd,zjd)
, dpdata will generate a random vector
lj=(ljx,ljy,ljz)
.

The method used to generate

lj is described below.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
if pert_style is 'normal':

ljx,ljy,ljz are independent random variables which are subject to normal distribution with mean
μ=0
and variance
σ2=atom_pert_fraction2/3
.
That is:
ljx,ljy,ljzN(0,atom_pert_fraction2/3)

lj2 is the distance the atom moves, and it satisfies the following equation
lj22=ljx2+ljy2+ljz2
.
3lj22/atom_pert_fraction2
will be object to the chi-square distribution with 3 degrees of freedom. That is:
3lj22atom_pert_fraction2χ(3)

The expectation value of
lj2
will be atom_pert_fraction .That is:
E(lj2)=atom_pert_fraction

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
if pert_style is 'uniform':

lj will be a vector point to a random point inside a 3D unit sphere and its internal space.

That is:

{ljR3|lj2atom_pert_fraction}.

The point is chosen with equal probability. That means for arbitrary two subsets of the 3D sphere and its internal space

{(x,y,z)|x,y,zR,x2+y2+z2atom_pert_fraction2}, if the 'volume' of the subsets are equal, the probability that the random point is in them are equal.

The following method is used to generate such

lj.

random direction of equal probability

let

x become a 3 dimension standard normal distribution. That is
x=(x1,x2,x3),xi(i{1,2,3}) are independent.

xiN(0,1)

and
lj,unit_surface=x/x2

Now
lj,unit_surface
point to a point located at the surface of the 3D unit sphere.

random point of equal probability

let

u become a random variable which is object to the uniform on interval [0,1]. That is:
uU(0,1)

and define
v
as the 3th root of
u
(because it is 3 dimension), That is:
vu1/3

Then the target vector
lj
is
lj=atom_pert_fractionvlj,unit_surface

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
if pert_style is 'const':

ljatom_pert_fractionlj,unit_surface

The definition of

lj,unit_surface is described in detail above.
and it is obvious that
lj2=atom_pert_fraction

2. atom moves according to
lj


After the

lj generated, the atom coordinates disturbed
rjd,disturbed
will become
rjd,disturbed=rjd+ljBd

Bd is the box matrix after deformatiion, described in first step
rjd
is the coordinate of atom j after deformatiion, described in first step.

the results the method System.perturb() return


At the beginning, dpdata will create an empty system.

perturbed_system = System()

After every single perturbed frame is generated, it will be appended to the perturbed_system.

perturbed_system will contain pert_num * frames of the input system frames.

Bd will be used as the final box matrix in the perturbed frame(that is System.data['cells'][0])
rjd,disturbed
will be used as the final coordinates in the perturbed frame (that is System.data['coords'][0][j])

note: 0 means the index of the frame, j means atom index,

Finally dpdata will return perturbed_system as results.