MLIP(Cu-Au)

Last updated: October 16, 2026

Info
  • A machine learning interatomic potential (MLIP) with an ASE Calculator interface must be installed.
  • This tutorial uses CHGNet as an example.

The files used in this tutorial can be downloaded from CrySPY_utility/examples/chgnet_Cu-Au_EA-vc. In this tutorial, we assume that a computing cluster with a job scheduler is used together with the machine learning interatomic potential (MLIP) CHGNet. By changing the Calculator, you can use a variety of MLIPs. The calculation can also be performed on a local PC, so if you prefer this, please modify the input settings accordingly. The target system is the binary Cu-Au system.

Pre-Calculation

In EA-vc, the per-atom energies of each elemental phase must be used as the reference in the ref_energies (end_point in versions 1.4.3 and earlier) setting of cryspy.in, so they need to be calculated beforehand. There should be two directories inside the example.

Au_fcc
├── POSCAR
├── chgnet_in.py
└── job_cryspy
Cu_fcc
├── POSCAR
├── chgnet_in.py
└── job_cryspy

Each directory contains a crystal structure file (POSCAR), a Python script (chgnet_in.py) to perform structure relaxation and calculate energy, and a job script (job_cryspy). Please modify these files according to your computing environment.

Submit the job (replace the job submission command as appropriate for your system).

cd Au_fcc
qsub job_cryspy
cd ../Cu_fcc
qsub job_cryspy
cd ..

When the calculations finish successfully, a file named ref_energies will be created in each directory, containing the energy per atom (eV/atom) after structure relaxation.

cat Au_fcc/ref_energies
-3.2357187271118164
cat Cu_fcc/ref_energies
-4.083529472351074

These values are then used as input for the cryspy.in file.

cryspy.in

[basic]
algo = EA-vc
calc_code = ASE
nstage = 1
njob = 20
jobcmd = qsub
jobfile = job_cryspy

[structure]
atype = Cu Au
ll_nat = 0 0
ul_nat = 8 8

[ASE]
ase_python = chgnet_in.py

[EA]
n_pop = 20
n_crsov = 5
n_perm = 2
n_strain = 2
n_rand = 2
n_add = 3
n_elim = 3
n_subs = 3
n_elite = 2
n_fittest = 10
slct_func = TNM
t_size = 2
maxgen_ea = 0
ref_energies = -4.08352709  -3.23571777

[option]
rslt_out = always
energy_output_interval = 1
backup_interval = 1
  • Use algo = EA-vc.
  • From v1.5.0, energy_output_interval in the [option] section sets the output interval in generations for the convex-hull plot and hull-distance file. Default: 1 (every generation); 0 disables automatic output.
  • From v1.5.0, backup_interval in the [option] section sets the automatic backup interval in generations. The default is 1; 0 disables automatic backups. See Features > Backup for details.
  • Since MLIPs use the ASE Calculator interface, set calc_code = ASE.
  • Change jobcmd according to your computing environment.
  • In the [structure] section, use ll_nat to specify the minimum number of atoms for each element, and ul_nat for the maximum.
  • n_pop = n_crsov + n_perm + n_strain + n_rand + n_add + n_elim + n_subs
  • In the ref_energies (end_point in versions 1.4.3 and earlier), enter the per-atom energies (in eV/atom) of each pure element—Cu and Au. Use the values obtained from the pre-calculations, and make sure the order follows that of atype.
  • For the parameters in the [EA] section, refer to CrySPY > Input file > [EA] Section and CrySPY > Search algorithms > Variable-composition evolutionary algorithm (EA-vc).
  • Refer also to CrySPY > Tutorial > Variable-composition evolutionary algorithm (EA-VC) > Analysis and Visualization for the parameters of the automatically generated convex hull plot.

calc_in/

The contents under calc_in/ are the same as those in Tutorial > Random Search (RS) > ASE on your local PC, with minor modifications for CHGNet. Be sure to adjust paths such as the Python executable in the job script to match your computing environment. Be sure to adjust the Python executable path in the job script.

calc_in/chgnet_in.py

# ---------- import
from ase.constraints import FixSymmetry
from ase.filters import FrechetCellFilter
from ase.io import read, write
from ase.optimize import FIRE, BFGS, LBFGS
from chgnet.model import CHGNetCalculator

# ---------- input structure
# CrySPY outputs 'POSCAR' as an input file in work/xxxxxx directory
atoms = read('POSCAR')

# ---------- set up
atoms.calc = CHGNetCalculator()
atoms.set_constraint([FixSymmetry(atoms)])
cell_filter = FrechetCellFilter(atoms)
opt = BFGS(cell_filter, trajectory='opt.traj')

# ---------- run
converged = opt.run(fmax=0.01, steps=2000)

# ---------- rule in ASE interface
# output file for energy: 'log.tote' in eV/cell
#                         CrySPY reads the last line of 'log.tote' file
# outimized structure: 'CONTCAR' file in vasp format
# check_opt: 'out_check_opt' file ('done' or 'not yet')
#                         CrySPY reads the last line of 'out_check_opt' file

# ------ energy
e = cell_filter.atoms.get_total_energy()    # eV/cell
with open('log.tote', mode='w') as f:
    f.write(str(e))

# ------ struc
opt_atoms = cell_filter.atoms.copy()
opt_atoms.set_constraint(None)    # remove constraint for pymatgen
write('CONTCAR', opt_atoms, format='vasp', direct=True)

# ------ check_opt
with open('out_check_opt', mode='w') as f:
    if converged:
        f.write('done\n')
    else:
        f.write('not yet\n')

calc_in/job_cryspy

#!/bin/sh
#$ -cwd
#$ -V -S /bin/bash
####$ -V -S /bin/zsh
#$ -N CuAu_CrySPY_ID
#$ -pe smp 2

# ---------- OpenMP
export OMP_NUM_THREADS=2

# ---------- ASE
/usr/local/Python-3.10.13/bin/python3 chgnet_in.py > out.log