Disorder variable#

In this example, disorder which was introduced to measure the disorder of a system is explored. We start by importing the necessary modules.

from pyscal3 import System
import numpy as np

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

fcc = System.create.lattice.fcc(lattice_constant=4, repetitions=[4,4,4])

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.

fccq = fcc.calculate.steinhardt_parameter(6)

Finally, disorder parameter can be calculated.

fcc.calculate.disorder()

The calculated disorder value can be accessed easily with tab completion

np.mean(fcc.atoms.steinhardt.disorder.norm)
-9.555435146838914e-17

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.

fcc_d1 = System.create.lattice.fcc(lattice_constant=4, repetitions=[4,4,4], noise=0.1)

Once again, find neighbors and then calculate disorder

fcc_d1.find.neighbors(method='cutoff', cutoff='adaptive')
fcc_d1.calculate.steinhardt_parameter(6)
fcc_d1.calculate.disorder()

Check the value of disorder

np.mean(fcc_d1.atoms.steinhardt.disorder.norm)
0.1542023349456909

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_d1.calculate.disorder(averaged=True)
np.mean(fcc_d1.atoms.steinhardt.disorder.average)
0.15040016202879125

Once again, we can visualise the system

fcc_d1.show.continuous_property(fcc_d1.atoms.steinhardt.disorder.average)