Migrating from pyscal 3#
pyscal 4 has a new interface. Scripts written for pyscal 3 need small changes to run. This page lists the differences and shows how to translate a typical script.
What changed#
ASE
AtomsreplacesSystem. pyscal no longer has its ownSystemandAtomsclasses. Every function takes an ASEAtomsobject as its first argument. Structures are read withase.io.reador built withase.buildorpyscal.structures.Functions replace methods.
sys.find.neighbors(...)becomespyscal.find_neighbors(atoms, ...), andsys.calculate.steinhardt_parameter(...)becomespyscal.steinhardt_parameter(atoms, ...).Results are stored on the
Atomsobject. Per-atom results are inatoms.arrays["pyscal_<name>"], other results inatoms.info["pyscal_<name>"]. The functions also return them.New descriptors. Wigner \(W_l\), Minkowski structure metrics, Ackland–Jones classification, coordination numbers, angular and bond length distributions, deformation descriptors, Wigner–Seitz defect analysis and ACE descriptors are new in pyscal 4.
A script in both versions#
pyscal 3:
from pyscal3 import System
sys = System("conf.dump")
sys.find.neighbors(method="cutoff", cutoff=3)
sys.calculate.steinhardt_parameter([4, 6])
sys.find.solids()
solid = sys.atoms.solid
pyscal 4:
import pyscal
from ase.io import read
atoms = read("conf.dump", format="lammps-dump-text")
pyscal.find_neighbors(atoms, method="cutoff", cutoff=3)
pyscal.steinhardt_parameter(atoms, l=[4, 6])
pyscal.find_solids(atoms)
solid = atoms.arrays["pyscal_solid"]
Results that changed#
Some results differ from pyscal 3 because errors were corrected. The changelog lists them. The most visible ones:
radial_distribution_functionreturns a normalised \(g(r)\), which tends to 1 at large distances.short_range_ordercomputes the Warren–Cowley parameter \(\alpha_{AB} = 1 - p_{AB} / c_B\).SANN neighbor lists include the correct number of atoms.
W_lvalues do not depend on the orientation of the crystal.
To keep using pyscal 3, install pyscal3<4.