Loading Initial Structures

Last updated: October 16, 2026

This tutorial creates init_struc_data.pkl from three CIF files and loads the structures as initial structures. The example is an RS search for eight Cu atoms: three structures are loaded and two more are generated randomly, giving five initial structures in total. See Features > Loading Initial Structures for details of the loading checks.

Preparation

Prepare cryspy.in and calc_in/ in a new working directory as in Tutorial > Random Search (RS) > ASE on Your Local PC. Use the same ase_in.py and job_cryspy files in calc_in/. Do not run cryspy yet.

Conversion uses CrySPY Utility’s pos2pkl.py. The commands below assume that pos2pkl.py is on your PATH. See Installation > CrySPY Utility for setup.

Download the following example CIF files into the working directory. Each contains eight Cu atoms.

.
├── Cu8_1.cif
├── Cu8_2.cif
├── Cu8_3.cif
├── calc_in
│   ├── ase_in.py
│   └── job_cryspy
└── cryspy.in

Converting Structure Data

Run the following command in the working directory. Use -s for files containing one structure each, such as CIF files.

pos2pkl.py -s Cu8_1.cif Cu8_2.cif Cu8_3.cif
Composition: Cu8

Converted. The number of structures: 3
Save init_struc_data.pkl

The command creates init_struc_data.pkl in the current directory. IDs are assigned in input order: Cu8_1.cif, Cu8_2.cif, and Cu8_3.cif receive IDs 0, 1, and 2, respectively. See CrySPY Utility > pos2pkl.py for conversion details.

cryspy.in

Configure cryspy.in as follows.

[basic]
algo = RS
calc_code = ASE
tot_struc = 5
nstage = 1
njob = 5
jobcmd = zsh
jobfile = job_cryspy

[structure]
atype = Cu
nat = 8

[ASE]
ase_python = ase_in.py

[option]
load_struc_flag = True
  • atype = Cu and nat = 8 match the atom type and atom count in all three input structures.
  • tot_struc = 5 combines the three loaded structures with two randomly generated structures.
  • load_struc_flag = True enables loading initial structures.
  • Adjust jobcmd for your computing environment.

Placing the Data and Running CrySPY

Before the first cryspy run, place the converted data as follows.

mkdir -p data/pkl_data
cp init_struc_data.pkl data/pkl_data/
cryspy

CrySPY loads three structures and generates two more randomly, then exits after preparing the initial structures. Continue as in a normal RS run by executing cryspy again to start structure optimization.

Checking the Loaded Structures

./data/init_POSCARS contains all five structures: the three loaded structures and the two randomly generated structures.

Structure IDInitial structure
0Loaded from Cu8_1.cif
1Loaded from Cu8_2.cif
2Loaded from Cu8_3.cif
3, 4Generated randomly

./data/pkl_data/init_struc_data.pkl is also updated to contain these five structures. Invalid structure counts, atom types, or compositions raise an error. See Features > Loading Initial Structures > Checks During Loading for details.