Disorder variable

In this example, disorder variable which was introduced to measure the disorder of a system is explored. We start by importing the necessary modules. We will use crystal_structures to create the necessary crystal structures.

import pyscal.core as pc
import pyscal.crystal_structures as pcs
import matplotlib.pyplot as plt
import numpy as np

First an fcc structure with a lattice constant of 4.00 is created.

fcc_atoms, fcc_box = pcs.make_crystal('fcc', lattice_constant=4, repetitions=[4,4,4])

The created atoms and box are assigned to a System object.

fcc = pc.System()
fcc.atoms = fcc_atoms
fcc.box = fcc_box

The next step is find the neighbors, and the calculate the Steinhardt parameter based on which we could calculate the disorder variable.

fcc.find_neighbors(method='cutoff', cutoff='adaptive')

Once the neighbors are found, we can calculate the Steinhardt parameter value. In this example \(q=6\) will be used.

fcc.calculate_q(6)

Finally, disorder parameter can be calculated.

fcc.calculate_disorder()

The calculated disorder value can be accessed for each atom using the disorder variable.

atoms = fcc.atoms
disorder = [atom.disorder for atom in atoms]
np.mean(disorder)
-1.041556887034408e-16

As expected, for a perfect fcc structure, we can see that the disorder is zero. The variation of disorder variable on a distorted lattice can be explored now. We will once again use the noise keyword along with make_crystal() to create a distorted lattice.

fcc_atoms_d1, fcc_box_d1 = pcs.make_crystal('fcc', lattice_constant=4, repetitions=[4,4,4], noise=0.01)
fcc_d1 = pc.System()
fcc_d1.atoms = fcc_atoms_d1
fcc_d1.box = fcc_box_d1

Once again, find neighbors and then calculate disorder

fcc_d1.find_neighbors(method='cutoff', cutoff='adaptive')
fcc_d1.calculate_q(6)
fcc_d1.calculate_disorder()

Check the value of disorder

atoms_d1 = fcc_d1.atoms
disorder = [atom.disorder for atom in atoms_d1]
np.mean(disorder)
0.013889967380485688

The value of average disorder for the system has increased with noise. Finally trying with a high amount of noise.

fcc_atoms_d2, fcc_box_d2 = pcs.make_crystal('fcc', lattice_constant=4, repetitions=[4,4,4], noise=0.1)
fcc_d2 = pc.System()
fcc_d2.atoms = fcc_atoms_d2
fcc_d2.box = fcc_box_d2
fcc_d2.find_neighbors(method='cutoff', cutoff='adaptive')
fcc_d2.calculate_q(6)
fcc_d2.calculate_disorder()
atoms_d2 = fcc_d2.atoms
disorder = [atom.disorder for atom in atoms_d2]
np.mean(disorder)
1.8469165876016702

The value of disorder parameter shows an increase with the amount of lattice distortion. An averaged version of disorder parameter, averaged over the neighbors for each atom can also be calculated as shown below.

fcc_d2.calculate_disorder(averaged=True)
atoms_d2 = fcc_d2.atoms
disorder = [atom.avg_disorder for atom in atoms_d2]
np.mean(disorder)
1.850630088115515

The disorder parameter can also be calculated for values of Steinhardt parameter other than 6. For example,

fcc_d2.find_neighbors(method='cutoff', cutoff='adaptive')
fcc_d2.calculate_q([4, 6])
fcc_d2.calculate_disorder(q=4, averaged=True)
atoms_d2 = fcc_d2.atoms
disorder = [atom.disorder for atom in atoms_d2]
np.mean(disorder)
1.880741277448693

\(q=4\), for example, can be useful when measuring disorder in bcc crystals