Centrosymmetry Parameter#

The centrosymmetry parameter (CSP) measures how much the local environment around an atom deviates from perfect centrosymmetry. It is commonly used to identify:

  • Defects (dislocations, vacancies)

  • Surface atoms

  • Stacking faults

For a perfect crystal, CSP = 0. Higher values indicate greater distortion.

import pyscal
from pyscal.structures import make_crystal
import numpy as np

Basic Usage#

centrosymmetry finds neighbors internally, so you don’t need to call find_neighbors first.

The nmax parameter specifies how many nearest neighbors to use (default: 12 for FCC/HCP, 8 for BCC).

# Perfect FCC crystal
fcc = make_crystal("fcc", lattice_constant=3.6, repetitions=(4, 4, 4))
csp = pyscal.centrosymmetry(fcc, nmax=12)

print(f"CSP for perfect FCC: mean = {csp.mean():.6f}, max = {csp.max():.6f}")
print(f"(Should be ~0 for a perfect crystal)")
CSP for perfect FCC: mean = 0.000000, max = 0.000000
(Should be ~0 for a perfect crystal)

Comparing Structures#

fcc = make_crystal("fcc", lattice_constant=3.6, repetitions=(4, 4, 4))
bcc = make_crystal("bcc", lattice_constant=2.87, repetitions=(4, 4, 4))

csp_fcc = pyscal.centrosymmetry(fcc, nmax=12)
csp_bcc = pyscal.centrosymmetry(bcc, nmax=8)

print(f"FCC (nmax=12): CSP mean = {csp_fcc.mean():.6f}")
print(f"BCC (nmax=8):  CSP mean = {csp_bcc.mean():.6f}")
FCC (nmax=12): CSP mean = 0.000000
BCC (nmax=8):  CSP mean = 0.000000

Stored Results#

Results are stored in atoms.arrays["pyscal_centrosymmetry"].

print(f"Stored key: {[k for k in fcc.arrays if 'centrosymmetry' in k]}")
print(f"Per-atom values (first 5): {fcc.arrays['pyscal_centrosymmetry'][:5]}")
Stored key: ['pyscal_centrosymmetry']
Per-atom values (first 5): [1.47911420e-29 4.93038066e-30 4.93038066e-30 4.93038066e-30
 1.00579765e-29]