cryspy-extract-struc
Last updated: October 16, 2026
cryspy-extract-struc Command
From v1.5.0, cryspy-extract-struc extracts structures from init_struc_data.pkl or opt_struc_data.pkl and saves them as CIF files.
This command integrates CrySPY Utility’s extract_struc.py into CrySPY. It can also print structure information without writing files.
Usage and Options
The input file can be specified with a relative or absolute path. CIF files are saved in the directory where the command is run.
Specify exactly one of -i, -a, or -t; these options cannot be combined.
| Argument or option | Description |
|---|---|
infile | A structure-data pickle file, such as init_struc_data.pkl or opt_struc_data.pkl. Gzip-compressed files are also supported. |
-i INDEX [INDEX ...], --index INDEX [INDEX ...] | Structure IDs to extract. Multiple IDs can be specified. |
-a, --all_id | Extract all structures in the input file. |
-t TOP, --top TOP | Extract the specified number of structures in ascending order of E_eV_atom in rslt_data.pkl. |
-p, --print | Print structure information without writing CIF files. |
-r, --rank | Use with -t to prefix output filenames with the rank. |
-s, --symmetrized | Write CIF files with symmetry information. |
--tolerance TOLERANCE | Tolerance for symmetry detection with -s. The default is 0.01. |
-h, --help | Show help. |
Examples
Extracting by Structure ID
Structures with IDs 0 and 1 are saved as 0.cif and 1.cif in the current directory. Missing IDs are skipped with a warning.
Printing Structure Information
With -p, structure IDs and structure information are printed without creating CIF files.
Extracting the Lowest-Energy Structures
This extracts the three lowest-energy structures. rslt_data.pkl must be in the same directory as the input file.
Output filenames are {ID}.cif.
Adding -r produces filenames of the form {rank}_{ID}.cif. Ranks start from 1.
Extracting All Structures
All initial structures are saved as {ID}.cif.
Writing Symmetry Information
With -s, output CIF files include symmetry information such as the space group. --tolerance is optional.
Adding symmetry information may change the cell representation and the number of atoms.
Extracting from Gzip-Compressed Files
Gzip-compressed structure data can be read directly without decompression. Options such as -a, -t, -p, and -s can be used in the same way.
When using -t, place rslt_data.pkl in the same directory as the compressed input file.