Subsections of CrySPY document
Subsections of Version Information
Version 1.5.0
Important change
Composition constraints in EA-vc
- Added
min_compandmax_compto specify lower and upper bounds on each atom type’s composition fraction. These constraints can be combined with charge neutrality. - Features > Composition Constraints
Input file
- Moved plotting parameters from the [EA] section to the new [visual] section.
- Deprecated
cgen. Useplot_min_genandplot_max_gento select generations to display, andref_gento specify the reference generation. - Renamed the reference energies for formation energy calculations from
end_pointtoref_energies.end_pointis still accepted for backward compatibility. - Removed
targetandtimeout_mol. - Input File > [EA] Section, Input File > [visual] Section, Input File > [structure] Section
Common
- Updated the minimum requirements to Python 3.10 and PyXtal 1.0.7.
- Removed support for using random and evolutionary structure generation as a standalone library.
Added
Subcommand
- cryspy-print: Display the contents or a summary of a pickle file. For
rslt_data.pkl, row selection, composition filtering, and regeneration of text result files are also supported. - cryspy-extract-struc: Extract structures from structure data and save them as CIF files or display their information.
- Integrated these commands into CrySPY as replacements for CrySPY Utility’s
print_pkl.pyandextract_struc.py.
Plotting and replotting
- Added support for RS and EA energy plots in
cryspy-Eplot. - Added separate controls for the displayed generation range and the reference generation in EA and EA-vc.
- Added
axis_orderto change element positions and support for displaying the allowed composition range in EA-vc. - Added
cryspy-Eplot -cto check the allowed composition range specified in the input before starting a search. - Added
terminalsto plot convex hulls with compound terminals. - Commands > cryspy-Eplot, Input File > [visual] Section
Input parameters
seed: Specify the random number generator seed. Input File > [option] Sectionmax_parent_attempts: Limit the number of parent-selection attempts per offspring in EA. The default is 50. Input File > [EA] Section
Niggli reduction
- Niggli reduction is now applied to structures generated by crossover.
- Search Algorithms > EA > Crossover
Result and figure output
- Added
rslt_outto control whencryspy_rsltandcryspy_rslt_energy_ascare written. The default isalways. - Added
energy_output_intervalto control the output interval for EA energy plots and EA-vc convex hull plots and hull-distance files. The default is 1 (every generation); 0 disables automatic output. - EA-vc convex hulls and hull distances are still calculated every generation, regardless of the output interval.
- Input File > [option] Section
Charge neutrality condition
- Improved the calculation of atom-count combinations that satisfy charge neutrality.
- Added support for multivalent species, for example,
charge = (2 3) -2. - Added
cn_modeto select enumeration or sampling of atom-count combinations. Inautomode, the method is selected based onmax_cn_grid_points. - Features > Charge Neutrality Condition
Backup
- Added
backup_intervalto specify the automatic backup interval. - Backup directory names now include the progress number and unit. Manual backups also include
manual. - Features > Backup
Changed
Default values in EA-vc
- Changed
add_maxandelim_maxfrom 3 to 5.subs_maxremains 3. - Changed the defaults of
show_maxandbottom_marginin the [visual] section toNoneand 0.04, respectively. - Input File > [EA] Section, Input File > [visual] Section
Loading initial structures
- Added stricter validation of data loaded with
load_struc_flag = True. Structure IDs, structure counts, atom types, and atom counts are checked. EA-vc also checks composition constraints and charge neutrality. - If fewer structures than required are loaded, the remaining structures are generated randomly.
- Features > Loading Initial Structures
Fixed
- Fixed an infinite loop in EA parent selection when the same parent was repeatedly selected while attempting to choose two distinct parents.
- Fixed roulette selection probabilities when all candidates have the same fitness.
- Fixed EA-vc elite reselection after changes to atom-count bounds, composition constraints, or
n_elite. Elites are now reselected from past results. - Fixed errors when structures excluded from convex hull calculations were considered as elites or parent candidates in EA-vc.
- Fixed a missing random number generator argument in the atom-addition step of crossover that affected reproducibility.
- Fixed cases where
lock_cryspywas left behind after input errors in interactive mode.
Version 1.4.3
Fixed
- Elimintion in EA-vc: fixed a bug that let the atom count go below the minimum.
- Substitution in EA-vc: fixed a bug where the atom count went negative mid-run.
Version 1.4.2
Important change
- EA-vc now supports VASP and QE
- Tutorial > Variable-composition evolutionary algorithm (EA-vc) > VASP (Fe-Al)
- Tutorial > Variable-composition evolutionary algorithm (EA-vc) > QE (Fe-Al)
Added
- Added support for check_opt in ASE
- Subcommand(see also:Features > Skip calculations)
- cryspy-skip
- cryspy-calc-convex-hull
Changed
Job file auto-rewriting
- The sed command at the end of the job file is now automatically appended by CrySPY
- Feature > Job file auto-rewriting
Priority order of structure optimization input file names
x is the stage number.
x_ase_in.pyase_in.py_xase_in.py
In previous versions, the second style ase_in.py_x was used.
Fixed
- Fixed a bug in mindist check after structure optimization (when structure data could not be obtained correctly)
Version 1.4.1
Important change
EA-vc
- The number of atoms operated on in addition, elimination, and substitution can now be changed. The number is randomly selected up to 3 by default (in 1.4.0, it was always 1).
Added
Charge neutral condition
- It is now possible to impose a charge neutrality condition during structure generation in EA-vc.
Subcommand
- cryspy-Eplot: (CrySPY > Features > Energy plot )
Version 1.4.0
Important change
New algorithm: EA-vc
- Currently, only the ASE interface is supported. Support for VASP and others is planned. CrySPY > Interface
- CrySPY > Tutorial > Variable-composition evolutionary algorithm (EA-vc)
- CrySPY > Search algorithms > Variable-composition evolutionary algorithm (EA-vc)
Interactive mode
- RS, EA, and EA-vc can be run from the Jupyter environment.
- Only the ASE interface is supported.
- CrySPY > Tutorial > Interactive mode (Jupyter Notebook)
- CrySPY > Features > Interactive mode
EA
tot_strucis no longer used in EA. The number of structures in the first generation is now determined byn_pop.
Interatomic distance check after structrue optimization
- Added
check_mindist_optto the [option] section incryspy.in. - Default:
check_mindist_opt = True. - After structure relaxation, a check is performed to ensure that the minimum interatomic distance constraint is satisfied.
Common
- The
natotparameter incryspy.inhas been removed. - Ctrl_ext has been removed.
Fixed
- Fixed a bug related to using
TSas thescorein BO. - Several other minor fixes.
Version 1.3.0
Important change
Common
- working directory name
work000000 –> work0 - We used to pickle data by grouping several data into tuples, but we changed it to pickle each item individually.
For example, rs_id_data.pkl –> id_queueing.pkl and id_running.pkl
BO
- Using cal_fingerprint program is obsolete. dscribe is required instead.
fppathandfp_rminin cryspy.in are obsolete.
- Changed the Bayesian optimization library from COMBO to PHYSBO
- See Installation > CrySPY > CrySPY 1.3.0 or later
Fixed
soiap
- support for recent pymatgen
Added
Random structure generation and structure generation by EA are now available as libraries.(removed in version 1.5.0)
for developer
- We stopped using global variables (rin), now uses dataclass for input data.
- Many of the input variables were lists, but we changed them to tuples.
Version 1.2.5
Bug fix
- simple bug fix
Version 1.2.4
Bug fix
- ASE interface:
e.args[0]–>str(e.args[0]) - ext mode: noprint
- njob ( see also FAQ > Can I change njob in the middle of the simulation )
EA
- default value of
cls_lat:equal–>random
EA-vc
- test version of variable composition EA (EA-vc). only binary system for now.
Version 1.2.3
MPI
- Bug fix
- In using MPI,
-poption is required:
See also
Version 1.2.2
Enthalpy
You can use enthalpy instead of energy for VASP and QE.
See also
Version 1.2.1
ASE interface
Bug fixed for multiple stages.
Version 1.2.0
ASE interface
ASE interface is now available.
See also
Adoption of logging
CrySPY logs are output to both the screen and files (log_cryspy and err_cryspy).
See also
Version 1.1.1
Bug fix for spg_error
In random structure generation, when a structure cannot be generated for a certain space group, the space group number is recorded in the variable sgp_error, and the number is skipped thereafter, but a bug was found in which the number was registered incorrectly in rare cases. Therefore, this spg_error function has been removed.
Version 1.1.0
Parallelization with MPI
Random structure generation using MPI has been available.
See also
- Tutorial > Random structure generation with MPI
- Features > Structure generation with MPI parallelization
LAQA
Updated score formula to take into account the stress term (T. Yamashita and H. Sekine, Sci. Technol. Adv. Mater. Meth. 2, 84 (2022).).
See also
Backup
Files are copied to the directory named by the date and time in “backup” directory.
See features/backup in detail.
Version 1.0.0
Install and run
CrySPY is now available in PyPI. You can install by
The executable script, cryspy is automatically installed in your PATH.
To run CrySPY, just type cryspy:
CrySPY stops once before going to next selection (BO, LAQA) or next generation (EA). For example, EA case:
[old version]
- cryspy run
- check jobs (finish current generation?)
- structure generation by EA automatically starts
[CrySPY 1.0.0]
- cryspy run
- check jobs (finish current generation?)
- stop
- cryspy run
- auto backup
- structure generation by EA automatically starts
Auto and manual backup
Automatically backup:
- before going to next selection or next generation
- structure generation
To manually back up:
See features/backup in detail.
Clean
See features/clean in detail.
Directory tree
Changed the directory tree.
- genstruc/RS –> RS/
- genstruc/EA –> EA/
- genstruc/struc_util.py –> util/
- utility.py –> util/
IO
- Fixed standard output file and standard error file:
log_cryspyanderr_cryspy cryspy.outis obsoleted
Moved to CrySPY Utility
With the change in installation method, examples and cal_fingerprint have been moved to the CrySPY Utility.
COMBO
The python library COMBO is now optional in CrySPY. If you do not use Bayesian optimizaion, you do not need to install it.
New calc_code
- ext: Deprecated in version 1.4.0.
cryspy.in
fppath
New input variable for cal_fingerprint. See Instllation/cryspy/cryspy_1.0
fwpath
New input variable for find_wy. See Instllation/requirements/find_wy
mindist
mindistcan be omitted incryspy.inmindist_eais obsoleted- added
mindist_mol_bsandmindist_mol_bs_factorincryspy.in
Version 0.10.3 or earlier
- [2022 May 17] version 0.10.3 released
- Bug fixed: LAMMPS IO.
- [2022 January 24] version 0.10.2 released
- Added nrot: maximum number of times to rotate molecules in mol_bs
- [2021 September 30] version 0.10.1 released
- Fixed the problem of numpy.random.seed in multiprocessing
- [2021 July 25] version 0.10.0 released
- Support PyXtal 0.2.9 or later
- LAQA can be used with QE
- Upper and lower limits of energy for EA and BO
- [2021 July 13] paper published
- Our paper on CrySPY software has been published in STAM:Methods
- [2021 March 18] version 0.9.2 released
- Support pymatgen v2022.
- [2021 February 7] version 0.9.0 released
- Interfaced with OpenMX
- Employ PyXtal library to generate initial structures
- If you use PyXtal (default), find_wy program is not required
- LAQA can be used with soiap
- Change the name: [lattice] section –> [structure] section
- Several input variables move to [structure] section
- natot: [basic] –> [structure]
- atype: [basic] –> [structure]
- nat: [basic] –> [structure]
- maxcnt: [option] –> [structure]
- symprec: [option] –> [structure]
- spgnum: [option] –> [structure]
- New features
- Molecular crystal structure generation
- Scale volume
- [2020 March 19] paper published
- Our paper on adjusting the descriptor for CSP Bayesian optimization has been published in Physical Review Materials
- [2020 February 16] version 0.8.0 released
- Migrate to Python 3
- CrySPY logo created
- Change several variable names and data formats
- Change style of output for energy: eV/cell –> eV/atom
- IDs of working directories corresponds to structure IDs
- New features
- recalculation
- manual select in BO
- [2018 December 5] version 0.7.0 released
- New features
- Evolutionary algorithm
- New features
- [2018 August 20] version 0.6.4 released
- [2018 July 2] version 0.6.3 released
- [2018 June 26] Version 0.6.2 released
- [2018 March 1] Version 0.6.1 released
- [2018 January 9] paper published
- Our paper on CrySPY has been published in Physical Review Materials
Installation
Note
You need (CrySPY + Python environment + structure optimizer) in your workstation, super computer, etc.
System Requirements
CrySPY
CrySPY Utility
Subsections of Installation
Python
Last updated: October 17, 2026
Python
CrySPY 1.5.0 or Later
- Python >= 3.10
Installing csp-cryspy with pip automatically installs required libraries such as PyXtal, pymatgen, and ASE. See Installation > CrySPY 1.3.0 or Later for details.
CrySPY 1.3.0 – 1.4.3
- Python >= 3.9
If you install csp-cryspy with pip, necessary libraries such as PyXtal, pymatgen, and ASE will be installed automatically. Go to Installation > CrySPY for detail.
2025 June 17, Tested and confirmed to work in the following environments (as installed via pip install csp-cryspy)
- python 3.13.5
- CrySPY 1.4.0
- numpy 1.26.4 (with physbo) and 2.3.0(without physbo. physbo requires numpy < 2.0)
- pandas 2.3.0
- pymatgen 2025.6.14
- pyxtal 1.0.9
- scipy 1.15.3
Quick Install
When using BO
CrySPY 1.1.0 – 1.2.5
If you install csp-cryspy with pip, necessary libraries such as PyXtal will be installed automatically. Go to Installation > CrySPY. Manual installation of COMBO is required when using Bayesian optimization.
CrySPY 1.0.0
Info
[2023 April 22] How to instlal PyXtal (pyshtools) on arm64 MacOS is figured out. See Arm64 on MacOS (without Rosseta 2)
[2023 March 15]
On MacOS, it is difficult to install PyXtal in the arm64 environment, so it is recommended to use the x86_64 environment with Rosetta 2.
CrySPY 0.10.0 – 0.10.3
Tested with Homebrew Python 3.8.x and 3.9.x on Mac and Python 3.8.x on Linux.
CrySPY 0.9.2
Tested with Homebrew Python 3.8.x and 3.9.x on Mac and Python 3.8.x on Linux.
Info
[2021 July 15] If you use PyXtal >= 0.2.9, update CrySPY to the version 0.10.0 or later.
Info
[2021 March 18] There is a breaking change in pymatgen 2022.x.x. CrySPY 0.9.2 and PyXtal 0.2.2 support this change in pymatgen.
Info
[2021 Feb. 5]
PyXtal depends on numba, but numba does not support Python 3.9.
So you should use Python 3.8.x for a while.
[2021 March 18]
Currently numba supports Python 3.9.x.
Info
[2021 Feb. 7]
PyXtal requires SciPy, but the latest version of SciPy (v1.6.0) might include a bug for deepcopy.
You should use SciPy v1.5.4 for a while.
[2021 March 18]
This bug has been fixed in SciPy v1.6.1.
CrySPY 0.9.0 – 0.9.1
- Python 3.8.x
- COMBO
- pymatgen (<= 2021.x.x)
- PyXtal 0.1.6 - 0.2.1
CrySPY 0.8.0 or Earlier
See the old document which is included CrySPY itself.
CrySPY 1.3.0 or Later
Last updated: July 9, 2026
CrySPY
pip
Please note that the name is csp-cryspy on PyPI, not cryspy.
The main command, cryspy, is automatically installed in your PATH. You can check by
From version 1.4.1, several additional subcommand are also installed.
Editable Mode
If you want to modify and use the CrySPY source code,
it is convenient to install CrySPY in editable mode
using the -e option of pip.
Since the GitHub main branch may contain development code
that differs from the official release,
download the source archive of the desired release
from the release page.
After extracting the archive, run:
PHYSBO and DScribe (Optional)
If you use Bayesian optimization, PHYSBO and DScribe are required.
Info
cal_fingerprint program and COMBO are obsolete.
mpi4py (Optional)
When performing random structure generation with MPI parallelization, mpi4py is required.
Jupyter and nglview (Optional)
For analysis on a local PC or in interactive mode, Jupyter is required. If you want to visualize crystal structures using nglview in interactive mode, install nglview by pip.
CrySPY 1.0.0 -- 1.2.5
CrySPY
pip
CrySPY 1.0.0 or later can be installed by pip.
The executable script, cryspy, is automatically installed in your PATH. You can check by
Editable Mode
If you want to change the source code of CrySPY, you can use pip’s editable mode (-e option).
Instead of git clone, you can download the compressed file from the release page
cal_fingerprint (Optional)
cal_fingerprint is a program to calculate structure descriptors and is required if algo is BO. From CrySPY 1.0.0, the cal_fingerprint program is included in CrySPY utility. See Instllation/CrySPY_utility/Compile cal_fingerprint for compilation.
Put the executable file of cal_fingerprint in your PATH. Or, specify the path of the executable file in cryspy.in as follows:
Arm64 on MacOS (Without Rosseta 2)
Info
In PyXtal, starting from version 0.6.3, pyshtools is no longer mandatory. Therefore, you can ignore the information written below if you are using a recent version of PyXtal.
- Install miniforge3 (We do not know how to install pyshtools with homebrew python.)
- Install pymatgen, pyshtools by conda (recent versions of pyshtools are available in conda-forge)
- Install CrySPY
Structure Optimizer
Structure Optimizer
At least one optimizer is required.
CrySPY 0.10.3 or Earlier
Installation of CrySPY is very simple. Just download it!
Download
You can put the source code of CrySPY in an arbitrary directory.
For example, let us put the source code in ~/CrySPY_root/CrySPY-x.x.x (x.x.x means the version).
Use git or download the compressed file.
Git
ZIP or tar.gz File
Download the source as a zip or tar.gz file from .
Then put the source like ~/CrySPY_root/CrySPY-x.x.x
Directory Tree
Directory tree in ~/CrySPY_root/CrySPY-x.x.x/:
Info
Main script is cryspy.py.
Setup (Optional)
find_wy (Optional)
When you use find_wy, put the executable file of find_wy in ~/CrySPY_root/CrySPY-x.x.x/CrySPY/find_wy/, so that the executable file path is ~/CrySPY_root/CrySPY-x.x.x/CrySPY/find_wy/find_wy.
Compile cal_fingerprint (Optional)
When you use Bayesian optimization, compile cal_fingerpirnt program which calculates structure descriptors.
Make sure that the executable file of cal_fingerprint exists in ~/CrySPY_root/CrySPY-x.x.x/CrySPY/f-fingerprint/.
find_wy (Optional)
CrySPY have utilized find_wy to generate a random structure for a given space group (symmetry). However, CrySPY employs PyXtal library for structure generation as default since version 0.9.0. You can skip to install find_wy in CrySPY 0.9.0 or later, but you may use find_wy. For CrySPY 0.8.x or earlier, find_wy is required to generate a random structure for a given space group.
Info
You can skip to install find_wy in CrySPY 0.9.0 or later.
Installation of find_wy
m_tspace
First you need compile m_tspace for find_wy. Check these sites to compile it.
Download the source code of m_tspace in an arbitrary directory. For example:
Additional two files are required to compile m_tspace.
Download the following files in ~/local/m_tspace from TSPASE:
Edit the makefile and run the make command.
If you use ifort, you had better delete -check all option and use -O2 option.
If you used gfortran, you might face the following problem:
Then change the source file of tsp98.f like this (line 9925):
Before:
After:
If you succeed in compiling, you get m_tsp.a.
find_wy
Check these sites to compile find_wy:
Download the source code of find_wy in an arbitrary directory. For example:
Edit make.inc and set the path to the m_tsp.a that you just prepared.
You can delete -check all option and use -O2 option.
Then run the make command.
When you get the executable file of find_wy, run the following command for test:
If there is no problem, POS_WY_SKEL_ALL.json file is generated.
Executable File of find_wy
CrySPY 1.0.0 or Later
Put the executable file of find_wy in your PATH. Or, specify the path of the executable file in cryspy.in as follows:
CrySPY 0.10.3 or Earlier
When you use find_wy, put the executable file of find_wy in ~/CrySPY_root/CrySPY-x.x.x/CrySPY/find_wy/, so that the executable file path is ~/CrySPY_root/CrySPY-x.x.x/CrySPY/find_wy/find_wy.
CrySPY Utility (Optional)
Setting up Python environment in your local PC is useful to analyze CrySPY results. Utility tools (jupyter notebook and python scripts) are available for analysis and visualization. Input examples are also included in CrySPY utility.
Info
See also cryspy_utility
You need several Python libraries such as
Download CrySPY Utility
Git
ZIP
Go to CrySPY utility and click green Code button, then choose Download ZIP.
Command
Main Command
- cryspy
Subcommand
- cryspy-Eplot (since v1.4.1)
- cryspy-calc-convex-hull (since v1.4.2)
- cryspy-skip (since v1.4.2)
- cryspy-print (since v1.5.0)
- cryspy-extract-struc (since v1.5.0)
Subsections of Command
cryspy-Eplot
Last updated: October 16, 2026
cryspy-Eplot Command
Starting from CrySPY version 1.4.1, the cryspy-Eplot command is installed.
In EA-vc, a convex hull plot is automatically generated and saved at the end of each generation by default. Use energy_output_interval in the [option] section to change the output interval or disable automatic output (see Input File > [option] Section).
If you wish to modify the plotting parameters afterward, you can regenerate the plot using the cryspy-Eplot command.
For the input parameters that can be changed, see the following page.
Usage and Options
Run the following command in the directory containing cryspy.in.
| Option | Description |
|---|---|
-c, --composition-window | Save a plot of the composition range specified in cryspy.in. See Checking the Composition Range for details. |
Energy Plots (RS, EA)
- CrySPY > Tutorial > Random Search (RS) > Analysis and Visualization
- CrySPY > Tutorial > Evolutionary Algorithm (EA) > Analysis and Visualization
Convex Hull Plots (EA-vc)
Standard Plots (Binary and Ternary Systems)
Replotting Specific Generations
An example using the convex hull from generation 3 and displaying structures from generation 2.
Plotting with Composition Constraints
Examples of binary and ternary plots with composition constraints. The blue region represents the allowed composition range.
Checking the Composition Range (-c)
From version 1.5.0, the allowed composition range can be plotted using the -c option when composition constraints are specified.
For EA-vc with min_comp or max_comp specified, the following command plots the allowed composition range defined in the current cryspy.in.
No search-result data is required, so the constraints can be checked before starting a search.
For standard binary and ternary systems, the plot is saved as ./data/convex_hull/composition_window_input.<fig_format>.
fig_format defaults to svg and can be changed to png or pdf in the [visual] section.
The species arrangement is specified by axis_order in the same section.
The input in the filename indicates that the plot is based on the input at execution time, independently of the generation number.
Examples for binary and ternary systems are shown below.
These plots represent the continuous composition region determined by min_comp and max_comp.
They do not account for integer atom-count constraints from ll_nat and ul_nat or charge neutrality from charge.
For input examples and an explanation of the plots, see Composition Constraints.
When -c is specified, the command outputs the composition-window plot and exits.
To replot the energy or convex hull of search results, run cryspy-Eplot without -c.
Changing Axis Arrangement
Change axis_order in the [visual] section of cryspy.in, then run cryspy-Eplot to redraw the plot with a different arrangement of species.
For details, see Tutorial > EA-vc > Analysis and Visualization and Input File > [visual] Section.
For binary systems, assign l (left) and r (right) in the order of atype.
The examples below use axis_order = lr (left) and axis_order = rl (right).
For ternary systems, assign t (top), l (left), and r (right) in the order of atype.
The examples below use axis_order = tlr (left) and axis_order = ltr (right).
Convex Hulls with Compound Terminals (terminals)
Specify two or three compound compositions with terminals in the [visual] section of cryspy.in to plot a convex hull using those compositions as references.
This uses pymatgen’s CompoundPhaseDiagram.
Depending on the reference compositions, a ternary system can also be plotted as a pseudo-ternary system, or a quaternary system as a pseudo-ternary system. Here, we show an example of plotting a ternary system as a pseudo-binary system.
This setting is for post-analysis with cryspy-Eplot and does not affect convex-hull calculations or natural selection during the search.
The following example uses a ternary Li–Al–O search through generation 30 with a charge neutrality condition imposed. The [structure] section is configured as follows.
Compositions satisfying this charge neutrality condition lie on the line connecting Li2O and Al2O3 in the ternary composition diagram. Using these compound compositions as references therefore allows the convex hull to be plotted as a pseudo-binary Li2O–Al2O3 system. See Features > Charge Neutrality Condition for details on imposing charge neutrality.
The left figure shows the ternary convex hull referenced to the elements; the right figure shows the pseudo-binary convex hull referenced to Li2O and Al2O3.
To obtain the right figure, configure the [visual] section as follows and run cryspy-Eplot.
The output filename includes _terminals_Li2O-Al2O3 to identify the reference compound compositions. In this example, the plot is saved in the default SVG format as ./data/convex_hull/conv_hull_gen_30_terminals_Li2O-Al2O3.svg.
With two compound compositions, omitting terminal_axis_order uses the default lr: Li2O is placed on the left and Al2O3 on the right, following the order in terminals.
Each specified compound composition must have an entry in the phase-diagram data used for plotting.
See Input File > [visual] Section for parameter details.
cryspy-calc-convex-hull
Last updated: October 16, 2026
cryspy-calc-convex-hull Command
Recalculate the EA-vc convex hull and each structure’s hull distance using results up to a specified generation.
Use this after excluding incorrect structures with cryspy-skip or changing the energy cutoffs with emin_ea and emax_ea.
Run the command in the CrySPY calculation directory, specifying a generation number.
This example uses results from generations 1 through 10 to recalculate the convex hull and hull distances at generation 10.
It updates that generation’s data in pd_data.pkl and hdist_data.pkl and writes a hull-distance table. A convex hull plot is also generated for binary and ternary systems.
See Features > Skip Calculations for the detailed procedure.
cryspy-skip
Last updated: October 16, 2026
cryspy-skip Command
Cancel results already recorded in rslt_data.pkl and mark the specified structures as skipped.
Use this when incorrect electronic states or similar problems have produced abnormal energies.
Run the command in the CrySPY calculation directory, specifying one or more structure IDs.
This example invalidates the optimized structures and energies for IDs 198 and 157 and sets their Opt values to skip.
For EA and EA-vc, these structures are also removed from the elite data if present.
For EA-vc, recalculate the convex hull with cryspy-calc-convex-hull as needed.
See Features > Skip Calculations for the detailed procedure and how to skip calculations while they are running.
cryspy-print
Last updated: October 16, 2026
cryspy-print Command
From v1.5.0, cryspy-print lets you inspect pickle files under data/pkl_data/.
It replaces CrySPY Utility’s print_pkl.py, displaying contents or a summary according to the file type.
For rslt_data.pkl, it also supports sorting by energy, selecting rows, filtering by composition, and regenerating result files.
Usage and Options
The input file can be specified with a relative or absolute path. Gzip-compressed files are also supported.
The file type is determined by its filename, so keep names such as rslt_data.pkl unchanged.
| Argument or option | Description |
|---|---|
infile | Pickle file to display. Gzip-compressed files, such as rslt_data.pkl.gz, are also accepted. |
--no-sort | Display rslt_data.pkl in its stored row order without sorting. |
--head N | Display the first N rows after filtering and sorting. N must be a positive integer. |
--tail N | Display the last N rows after filtering and sorting. N must be a positive integer. |
--all | Display all rows after filtering and sorting. |
-c N [N ...], --composition N [N ...] | Filter EA-vc results in rslt_data.pkl by composition ratio, specified in atype order. |
--write | Regenerate ./data/cryspy_rslt and ./data/cryspy_rslt_energy_asc from rslt_data.pkl. |
-h, --help | Show help. |
--no-sort, --head, --tail, --all, --composition, and --write are options for rslt_data.pkl.
--head, --tail, and --all cannot be combined. --write cannot be combined with display options.
Supported Files and Output
| File | Output |
|---|---|
input_data.pkl | Input settings grouped by section. Fields whose value is None are omitted. |
init_struc_data.pkl, opt_struc_data.pkl, struc_step_data.pkl, elite_struc.pkl, init_dscrpt_data.pkl, opt_dscrpt_data.pkl | Number of stored entries (Number of structures). Structure IDs are not listed. |
rslt_data.pkl | Results table, sorted by energy in ascending order by default. |
hdist_data.pkl | Latest generation and its number of structures. Prints No hull distance data if empty. |
pd_data.pkl | Latest generation and its numbers of stable entries and all entries. Prints No phase diagram data if empty. |
cn_comb_data.pkl | Charge-neutrality settings and the number of charge-neutral combinations. Reports when cn_comb is None. |
The contents of the following files are pretty-printed.
- Common:
id_queueing.pkl,id_running.pkl,energy_step_data.pkl,force_step_data.pkl,stress_step_data.pkl,kpt_data.pkl,rng_state_data.pkl - EA:
gen.pkl,ea_info.pkl,ea_origin.pkl,elite_fitness.pkl - EA-vc:
nat_data.pkl - BO:
n_selection.pkl,id_select_hist.pkl,bo_mean.pkl,bo_var.pkl,bo_score.pkl - LAQA:
tot_step_select.pkl,laqa_energy.pkl,laqa_bias.pkl,laqa_score.pkl,laqa_step.pkl,laqa_struc.pkl
An unsupported filename causes an error.
Examples
Checking Structure Counts, Input Settings, and Fitness
Output for a file containing ten entries:
opt_struc_data.pkl and elite_struc.pkl also display the structure count.
To inspect individual structures, use the -p option of cryspy-extract-struc.
input_data.pkl displays settings grouped into sections such as [basic] and [structure].
elite_fitness.pkl displays a dictionary of structure IDs and fitness values.
Displaying Results
Results are sorted in ascending order of Ef_eV_atom if that column exists, or E_eV_atom otherwise.
All rows are displayed if there are at most 100 rows. For larger tables, the command displays the count and sort order, followed by the first 100 rows.
These display the first ten rows, last five rows, or all rows of the table sorted by energy in ascending order.
Use --no-sort to keep the stored row order. It can be combined with row selection.
Filtering EA-vc Results by Composition
This selects structures with a composition ratio of 1:2 in atype order and displays the first ten rows in ascending energy order.
Atom counts such as (1, 2) and (2, 4) match the same ratio.
Specify one non-negative integer per element, with at least one positive value.
This option requires EA-vc results with a Num_atom column. A message is displayed if no structures match.
For an example with output, see Tutorial > EA-vc > Check Results > Checking Results for a Specific Composition.
Inspecting Gzip-Compressed Files
The file is read without decompression beforehand. Other supported files can also be supplied in gzip-compressed form.
Regenerating Result Files
Run the following in the calculation directory containing cryspy.in.
This regenerates the following files, overwriting existing files.
./data/cryspy_rslt: Results in their stored row order../data/cryspy_rslt_energy_asc: Results sorted byEf_eV_atomin ascending order, orE_eV_atomif the former column is absent.
Files are written to data/ under the directory where the command is run. This directory must exist.
The operation is also recorded in log_cryspy.
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.
Tutorial
Info
Table of Contents
Subsections of Tutorial
Random Search (RS)
Info
ASE is easy to start for beginners because when you install CrySPY, ASE is also automatically installed. Although not highly accurate, ASE provides very lightweight and fast interatomic potentials, making it suitable for testing on a laptop or other low-spec machines.
Preparation of Input Files
Follow one of the instructions below, then proceed to the section on running CrySPY.
Running CrySPY
Subsections of Random Search (RS)
ASE on Your Local PC
Last updated: October 16, 2026
ASE provides interfaces to different codes. ASE also includes Pure Python EMT calculator, which is suitable for testing CrySPY because of its fast and easy structure optimization.
In this tutorial, we try to use CrySPY in your local PC (Mac or Linux). The target system is Cu 8 atoms.
Assumption
Here, we assume the following conditions:
- CrySPY 1.2.0 or later in your local PC
- CrySPY job filename:
job_cryspy - ase input filename:
ase_in.py
Input Files
Move to your working directory, and copy the example files by one of the following methods.
- Download from CrySPY_utility/examples/ase_Cu8_RS
- Copy from CrySPY utility that you installed
cryspy.in
cryspy.in is the input file of CrySPY.
In [basic] section, jobcmd = zsh can be changed to jobcmd = sh or jobcmd = bash in accordance with your environment.
CrySPY runs zsh job_cryspy as a background job internally.
[ASE] section is required when you use ASE.
You can name the following files whatever you want:
jobfile:job_cryspyase_python:ase_in.py
The other input variables are discussed later.
calc_in Directory
The job file and input files for ASE are prepared in this directory.
Job File
The name of the job file must match the value of jobfile in cryspy.in.
The example of job file (here, job_cryspy) is shown below.
You can specify the input (ase_in.py) file names,
but it must match the values of ase_python in cryspy.in.
You must add sed -i -e ‘3 s/^.*$/done/’ stat_job at the end of the file in CrySPY.
Starting from version 1.4.2, CrySPY automatically appends the following line to the end of the job file. (See also: Features > Job file auto-rewriting)
Note
For versions older than 1.4.2, the last line of the job file must be written as sed -i -e '3s/^sub.*/done/' stat_job. If you use a job file with this sed command in version 1.4.2 or later, it will simply be executed twice, which does not cause any problems.
The meaning of the above sed command is to change the part starting with “sub” in the third line of the file stat_job to “done”.
Tip
(Detail: Features > Job file auto-rewriting)
In the job file of CrySPY, the string CrySPY_ID is automatically replaced with the structure ID.
When you use a job scheduler such as PBS and SLURM, it is useful to set the structure ID to the job name.
For example, in the PBS system, #PBS -N Si_CrySPY_ID in ID 10 is replaced with #PBS -N Si_10.
Note that starting with a number will result in an error.
You should add a prefix like Si_.
Input for ASE
Input files corresponding to the number of stages (nstage in cryspy.in) are required.
Prepare the input file names by adding x_ as a prefix or _x as a suffix, where x is the stage number.
CrySPY searches for input files in the following order of priority:
x_ase_in.pyase_in.py_xase_in.py
If you use the same input for all stages, you can omit x_ or _x.
In this ASE tutorial, since nstage = 1 is used, only one ASE input file, ase_in.py, is needed. You can omit x_ or _x.
An example of ase_in.py is shown below (for details on how to use ASE, refer to the official documentation).
Unlike VASP and QE, the ASE input (python script) is more flexible. CrySPY has three rules:
- Energy is output in units of eV/cell to
log.totefile. CrySPY reads the last line of it. - Optimized structure is output to
CONTCARfile in the VASP format. - The result of the optimization convergence check should be written as either
doneornot_yetin a file namedout_check_opt. CrySPY reads the last line of this file.
Running CrySPY
Go to Running CrySPY
soiap on Your Local PC
Info
The information written here is slightly outdated, so please refer to the latest tutorial: Tutorial > Random Search (RS) > ASE on your local PC. The content on this page should still work without any issues.
Last updated: October 16, 2026
soiap is Structure Optimization with InterAtomic Potential. It is suitable for testing CrySPY because of its fast structure optimization. See instructions to install soiap.
In this tutorial, we try to use CrySPY in your local PC (Mac or Linux). The target system is Si 8 atoms.
Assumption
Here, we assume the following conditions:
- (only version 0.10.3 or earlier) CrySPY main script:
~/CrySPY_root/CrySPY-0.9.0/cryspy.py - CrySPY job filename:
job_cryspy - soiap executable file:
~/local/soiap-0.3.0/src/soiap - soiap input filename:
soiap.in - soiap output filename:
soiap.out - soiap input structure filename:
initial.cif
Input Files
Move to your working directory, and copy input example files by one of the following methods.
- Download from Cryspy_utility/examples/soiap_Si8_RS
- Copy from CrySPY utility that you installed
- (only version 0.10.3 or earlier)
cp -r ~/CrySPY_root/CrySPY-0.9.0/example/v0.9.0/soiap_RS_Si8 .
cryspy.in
cryspy.in is the input file of CrySPY.
In [basic] section, jobcmd = zsh can be changed to jobcmd = sh or jobcmd = bash in accordance with your environment.
CrySPY runs zsh job_cryspy as a background job internally.
[soiap] section is required when you use soiap.
You can name the following files whatever you want:
jobfilesoiap_infilesoiap_outfilesoiap_cif
The other input variables are discussed later.
calc_in Directory
The job file and input files for soiap are prepared in this directory.
Job File
The name of the job file must match the value of jobfile in cryspy.in.
The example of job file (here, job_cryspy) is shown below.
Change /path/to/soiap into right path suitable for your environment.
You can specify the input (soiap.in) and output (soiap.out) file names,
but they must match the values of soiap_infile and soiap_outfile in cryspy.in.
The job file is written in the same way as the one you usually use except for the last line.
You must add sed -i -e '3 s/^.*$/done/' stat_job at the end of the file in CrySPY.
Note
sed -i -e '3 s/^.*$/done/' stat_job is required at the end of the job file.
Tip
In the job file of CrySPY, the string “CrySPY_ID” is automatically replaced with the structure ID.
When you use a job scheduler such as PBS and SLURM, it is useful to set the structure ID to the job name.
For example, in the PBS system, #PBS -N Si_CrySPY_ID in ID 10 is replaced with #PBS -N Si_10.
Note that starting with a number will result in an error.
You should add a prefix like Si_.
Input for soiap
Input files based on the number of stages (nstage in cryspy.in) are required.
Name the input file(s) with a suffix _x.
Here x means the stage number.
We are using nstage = 1, so we need only soiap.in_1.
soiap.in_1 is listed below.
The input structure file is specified at the first line.
Use the same name as the value of soiap_cif in cryspy.in.
Running CrySPY
Go to Running CrySPY
VASP
Last updated: October 16, 2026
In this tutorial, we try to use CrySPY in a PC cluster with a job scheduler system such as PBS. Here we employ VASP. The target system is Na8Cl8, 16 atoms.
Assumption
Here, we assume the following conditions:
- CrySPY 1.2.0 or later in your PC cluster
- CrySPY job command:
qsub - CrySPY job filename:
job_cryspy - executable file, vasp_std in your PC cluster
Input Files
Move to your working directory, and copy the example files by one of the following methods.
- Download from Cryspy_utility/examples/vasp_Na8Cl8_RS
- Copy from CrySPY utility that you installed
cryspy.in
cryspy.in is the input file of CrySPY.
In [basic] section, jobcmd = qsub can be changed in accordance with your environment.
CrySPY runs qsub job_cryspy as a background job internally in this setting.
You can name the following file whatever you want:
jobfile
We adopt a stage-based system for structure optimization calculations.
Here, we use nstage = 2.
For example, users can configure the following settings.
In the first stage, only the ionic positions are relaxed, fixing the cell shape, with low k-point grid density.
Next, the ionic positions and cell shape are fully relaxed with high accuracy in the second stage.
[VASP] section is required when you use VASP.
You have to specify k-point grid density (Å^-3) for each stage in kppvol.
Info
See Input file > Kpoint for details of kppvol
The other input variables are discussed later.
calc_in Directory
The job file and input files for VASP are prepared in this directory.
Job File
The name of the job file must match the value of jobfile in cryspy.in.
The example of job file (here, job_cryspy) is shown below.
Change VASPROOT to the appropriate path suitable for your environment.
The job file is written in the same way as the one you usually use except for the last line.
You must add sed -i -e ‘3 s/^.*$/done/’ stat_job at the end of the file in CrySPY.
Starting from version 1.4.2, CrySPY automatically appends the following line to the end of the job file. (See also: Features > Job file auto-rewriting)
Note
For versions older than 1.4.2, the last line of the job file must be written as sed -i -e '3s/^sub.*/done/' stat_job. If you use a job file with this sed command in version 1.4.2 or later, it will simply be executed twice, which does not cause any problems.
The meaning of the above sed command is to change the part starting with “sub” in the third line of the file stat_job to “done”.
Tip
(Detail: Features > Job file auto-rewriting)
In the job file of CrySPY, the string CrySPY_ID is automatically replaced with the structure ID.
When you use a job scheduler such as PBS and SLURM, it is useful to set the structure ID to the job name.
For example, in the PBS system, #PBS -N Si_CrySPY_ID in ID 10 is replaced with #PBS -N Si_10.
Note that starting with a number will result in an error.
You should add a prefix like Si_.
Input for VASP
Input files corresponding to the number of stages (nstage in cryspy.in) are required.
Prepare the input file names by adding x_ as a prefix or _x as a suffix, where x is the stage number.
CrySPY searches for input files in the following order of priority:
x_INCARINCAR_xINCAR
If you use the same input for all stages, you can omit x_ or _x.
We are using nstage = 2, so we need 1_INCAR_1 and 2_INCAR.
Here, 1_INCAR is set to fix the cell and relax only the ionic positions, while 2_INCAR is configured to fully relax both the cell and ionic positions.
1_INCAR
2_INCAR
CrySPY automatically generates POSCAR and KPOINTS files.
You have to prepare POTCAR file yourself.
The POTCAR included in this example file is empty, so please be aware of that.
Warning
POTCAR in this example is empty. We cannot distribute it.
Running CrySPY
Go to Running CrySPY
QE
Last updated: October 16, 2026
In this tutorial, we try to use CrySPY in a machine with a job scheduler system such as PBS. Here we employ QUANTUM ESPRESSO. (QE). The target system is Si 8 atoms.
Assumption
Here, we assume the following conditions:
- CrySPY job command:
qsub - CrySPY job filename:
job_cryspy - QE executable file:
/usr/local/qe-6.5/bin/pw.x - QE input filename:
pwscf.in - QE output filename:
pwscf.out
Input Files
Move to your working directory, and copy input example files by one of the following methods.
- Download from CrySPY_utility/examples/qe_Si8_RS
- Copy from CrySPY utility that you installed
- (only version 0.10.3 or earlier)
cp -r ~/CrySPY_root/CrySPY-0.9.0/example/v0.9.0/QE_Si8_RS .
cryspy.in
cryspy.in is the input file of CrySPY.
In [basic] section, jobcmd = qsub can be changed in accordance with your environment.
CrySPY runs qsub job_cryspy as a background job internally in this setting.
We adopt a stage-based system for structure optimization calculations.
Here, we use nstage = 2.
For example, users can configure the following settings.
In the first stage, only the ionic positions are relaxed, fixing the cell shape, with low k-point grid density.
Next, the ionic positions and cell shape are fully relaxed with high accuracy in the second stage.
[QE] section is required when you use QE.
You have to specify k-point grid density (Å^-3) for each stage in kppvol.
Info
See Input file > Kpoint for details of kppvol
You can name the following files whatever you want:
jobfileqe_infileqe_outfile
The other input variables are discussed later.
calc_in Directory
The job file and input files for QE are prepared in this directory.
Job File
The name of the job file must match the value of jobfile in cryspy.in.
The example of job file (here, job_cryspy) is shown below.
Change /path/to/pw.x to the appropriate path suitable for your environment.
You can specify the input (pwscf.in) and output (pwscf.out) file names,
but they must match the values of qe_infile and qe_outfile in cryspy.in.
The job file is written in the same way as the one you usually use except for the last line.
You must add sed -i -e ‘3 s/^.*$/done/’ stat_job at the end of the file in CrySPY.
Starting from version 1.4.2, CrySPY automatically appends the following line to the end of the job file. (See also: Features > Job file auto-rewriting)
Note
For versions older than 1.4.2, the last line of the job file must be written as sed -i -e '3s/^sub.*/done/' stat_job. If you use a job file with this sed command in version 1.4.2 or later, it will simply be executed twice, which does not cause any problems.
The meaning of the above sed command is to change the part starting with “sub” in the third line of the file stat_job to “done”.
Tip
(Detail: Features > Job file auto-rewriting)
In the job file of CrySPY, the string “CrySPY_ID” is automatically replaced with the structure ID.
When you use a job scheduler such as PBS and SLURM, it is useful to set the structure ID to the job name.
For example, in the PBS system, #PBS -N Si_CrySPY_ID in ID 10 is replaced with #PBS -N Si_10.
Note that starting with a number will result in an error.
You should add a prefix like Si_.
Input for QE
Input files corresponding to the number of stages (nstage in cryspy.in) are required.
Prepare the input file names by adding x_ as a prefix or _x as a suffix, where x is the stage number.
CrySPY searches for input files in the following order of priority:
x_pwscf.inpwscf.in_xpwscf.in
We are using nstage = 2, so we need 1_pwscf.in and 2_pwscf.in.
Here, 1_pwscf.in is set to fix the cell and relax only the ionic positions, while 2_pwscf.in is configured to fully relax both the cell and ionic positions.
1_pwscf.in
1_pwscf.in
Change pseudo_dir to your suitable directory.
Inputs for structure data and k-point such as ATOMIC_POSITIONS and K_POINTS are automatically appended by CrySPY with pymatgen.
Users do not have to prepare them in x_pwscf.in.
Running CrySPY
Go to Running CrySPY
OpenMX
Coming soon.
LAMMPS
Coming soon.
Check cryspy.in
Last updated: October 16, 2026
See Input File in detail.
Let’s take a look at cryspy.in again.
This may be slightly different depending on calc_code you chose.
[basic] Section
algo: Algorithm. SetRSfor Random Search.calc_code: Structure optimizer. Choose fromVASP,QE,OMX,soiap,LAMMPS,ASEtot_struc: The total number of structures. In this case, 5 random structures are generated at 1st run.nstage: The number of stages. It’s up to you.njob: The number of jobs running at the same time. In this example, CrySPY sets 2 slots for structure optimization, in other words, optimizes every 2 structures.jobcmd: Command for jobs. Usebash,zsh,qsub, and so on.jobfile: File name of the job file.
[structure] Section
atype: Atom type. e.g. for Na8Cl8:atype = Na Cl.nat: The number of atoms corresponding to each atype. e.g. for Na8Cl8:nat = 8 8
Script to Run
Note
For version 1.0.0 or later, skip this page. The executable script is automatically installed.
Assumption
Here, we assume the following condition:
- CrySPY main script:
~/CrySPY_root/CrySPY-0.9.0/cryspy.py
Make Script
Let’s make a convenient shell script to avoid typing long commands over and over again.
Here, we create the script, cryspy (any file name will do).
-u option (unbuffered option) can be omitted.
You can put this script in your $PATH, or just use like bash ./cryspy.
First Run
2025 March 6, updated
Make sure you have the following in your working directory.
- calc_in/
- (cryspy)
- cryspy.in
Then, run CyrSPY!
If you use old version (0.10.3 or earlier):
At the first run, CrySPY goes into structure generation mode. CrySPY stops after 5 structure generation.
If it worked properly, the following output appears on the screen:
Several output files are also generated.
- (
cryspy.out): Short log. only version 0.10.3 or earlier. cryspy.stat: Status file.data/init_POSCARS: Initial struture file in POSCAR format. You can open this file using VESTAdata/pkl_data: Directory to save pickled data.log_cryspy: log.err_cryspy: error and warning.
Let’s take a look at cryspy.stat file.
Structure ID 0 – 4 are queueing because we just generated structures, and have not submitted yet.
Tip
Check the initial structures, if the distances between atoms are too close, you should set the mindist in cryspy.in.
Submit Job
2023 July 10, update
Continue
CrySPY continues the simulation if you have cryspy.stat file.
Tip
Continue if you have crypy.stat
Start from the beginning if you don’t have cryspy.stat
Submit Job
Run CyrSPY again.
Check the screen or log_cryspy file.
And also cryspy.stat file.
CrySPY submitted two jobs for structure ID 0 and 1 as you set njob = 2 in cryspy.in.
Calculations are performed in the work directory.
These directory names correspond to their structure ID.
When the two jobs are done, run CrySPY again.
If you set nstage = 2 (more than 2), new jobs on stage 2 for ID 0 and 1 are submitted.
If you set nstage = 1, CrySPY collects calculation data of ID 0 and 1, then submits next ID’s jobs.
Directories of the finished structure are moved to the fin directory.
Repeat cryspy several times until all 5 structures are done.
You can delete the work directory when the simulation is done if you do not need it.
The auto script (repeat_cryspy) may help you.
Check Results
Last updated: October 16, 2026
Move to data directory. There should be a few more files.
cryspy_rslt: Result file.cryspy_rslt_energy_asc: Result file sorted in energy ascending order.init_POSCARS: Initial struture file in POSCAR format.opt_POSCARS: Optimized structure file in POSCAR format.pkl_data/: Directory to save pickled data.
The results are written to text files, cryspy_rslt and cryspy_rslt_energy_asc (and also saved in pickle data in pkl_data directory).
From v1.5.0, rslt_out in the [option] section controls when cryspy_rslt and cryspy_rslt_energy_asc are written. The default is always. See Input File > [option] Section for details.
Each result appends to cryspy_rslt file in the order in which one finished earlier.
Info
Not ID order in cryspy_rslt
In cryspy_rslt_energy_asc file, the results are sorted in energy ascending order.
Spg_num and Spg_sym show space group information on initial structures.
Spg_num_opt and Spg_sym_opt are those of optimized structures.
The last column Opt indicates whether or not optimization reached required accuracy.
Append Structures
Last updated: October 16, 2026
Of course only 5 structures are not enough to find stable structures. You can append structures whenever you want. Here let’s append more 5 structures.
For Si-Si mindist, the default value of 1.11 Å is used in the first structure generation (see log_cryspy), which is a little too close.
Let us try to set the mindist to 2.0 Å.
Info
For mindist, see also Features > Restriction on interatomic distances.
Edit cryspy.in and change the value of tot_struc into 10, and add mindist_1 = 2.0
Then run cryspy, and check log_cryspy file.
Remember that CrySPY goes into structure generation mode whenever you change the value of tot_struc.
In this mode, CrySPY does not do any other action such as collecting data, submitting jobs, and so on.
Note
Structure generation mode whenever you change the value of tot_struc.
From version 1.0.0, CrySPY automatically backs up when adding structures.
See features/backup.
Repeat cryspy & several times until all appended structures are done.
The auto script (repeat_cryspy) may help you.
Analysis and Visualization
Last updated: February 9, 2026
Energy Plot
Since version 1.4.4, results can be easily visualized using the cryspy-Eplot command as follows:
The file is saved to ./data/energy_plot/energy_RS_{tot_struc}.{fig_fotmat}.
The following input variables can be modified by specifying them in the [visual] section of cryspy.in.
See also CrySPY > Input file > [visual] section.
For more advanced data analysis or figure customization, download the files and use Jupyter Notebook as shown below.
Download Data
It is assumed here that you analyze and visualize CrySPY data on your local PC.
If you use CrySPY on a supercomputer or workstation, download the data to your local machine.
You can delete the work and backup directories if they are not needed, as their file size can be very large.
Jupyter Notebook
Move to the data/ directory in the results you downloaded earlier.
Then, if the CrySPY utility has already been downloaded locally, copy cryspy_analyzer_RS.ipynb.
Alternatively, you can download it directly from GitHub (CrySPY_utility/notebook/).
Launch Jupyter (e.g., VS Code, Jupyter Lab, or Jupyter Notebook),
and simply run the cells in order to obtain a figure like the one shown below.
Evolutionary Algorithm (EA)
Info
- For the basic usage of CrySPY, start by referring to Tutorial > Random Search (RS).
- For details of the algorithm, refer to Search Algorithms > Evolutionary algorithm (EA).
Preparation of Input Files
Follow one of the instructions below, then proceed to the section on running CrySPY.
Running CrySPY
Subsections of Evolutionary Algorithm (EA)
ASE on Your Local PC
Last updated: October 16, 2026
The files used in this tutorial can be downloaded from CrySPY_utility/examples/ase_Cu8Au8_EA. This tutorial demonstrates a test run on a local machine using ASE’s lightweight Pure Python EMT calculator. The target system is Cu8Au8.
cryspy.in
Example of cryspy.in.
- Use
algo = EA. - From v1.5.0,
energy_output_intervalin the [option] section sets the output interval in generations for the energy plot. Default:1(every generation);0disables automatic output. - From v1.5.0,
backup_intervalin the [option] section sets the automatic backup interval in generations. The default is1;0disables automatic backups. See Features > Backup for details. - When using a bash environment, set
jobcmdto bash. - In EA,
tot_strucis not used. The number of structures is determined byn_pop. n_pop=n_crsov+n_perm+n_strain+n_rand- For parameters in the [EA] section, refer to Input file > [EA] section and Search algorithms > Evolutionary algorithm (EA).
calc_in/
The contents under calc_in/ are the same as in Tutorial > Random Search (RS) > ASE in your local PC.
calc_in/ase_in.py_1
calc_in/job_cryspy
Create Next Generation
Last updated: October 16, 2026
First Run
When you run cryspy, the program enters structure generation mode.
It generates the first generation of random structures and then exits.
log
In EA, running cryspy appends the current generation’s information to cryspy.stat.
Optimize Structures
After running cryspy several times and completing the structure optimization for the first generation, the output will appear as shown below.
Create Next Generation
Once all preparations are complete, running cryspy again starts generating the next-generation structures.
By default (backup_interval = 1), an automatic backup is performed immediately before generating these structures.
From v1.5.0, backup_interval in the [option] section can be used to change the interval in generations; 0 disables automatic backups. See Features > Backup for details.
After that, simply running cryspy repeatedly will advance the structure search.
Check Results
Last updated: October 16, 2026
cryspy_rslt
The following is an example of cryspy_rslt after completing calculations up to the third generation.
In EA, generation information (Gen) is also included.
From v1.5.0, rslt_out in the [option] section controls when cryspy_rslt and cryspy_rslt_energy_asc are written. The default is always. See Input File > [option] Section for details.
ea_info
The EA parameters used in each generation are recorded in ea_info.
ea_origin
Information about the structure generation method and parent individuals is output to ea_origin.
Analysis and Visualization
Last updated: October 16, 2026
Automatic Energy Plotting
Since version 1.4.4, the energy plot is automatically generated after each generation finishes by default.
The figure is saved to ./data/energy_plot/energy_EA_gen_{gen}.{fig_fotmat}.
From version 1.5.0, the output interval in generations can be changed with energy_output_interval in the [option] section. The default is 1 (every generation); 0 disables automatic output. See Input File > [option] Section for details.
The following input variables can be set in the [visual] section of cryspy.in.
See also CrySPY > Input file > [visual] section.
Replotting with cryspy-Eplot
If you want to fine-tune the figure and replot it, you can easily do so using the cryspy-Eplot command as follows:
When using the cryspy-Eplot command, the following variables can also be specified in the [visual] section in addition to the standard variables above.
plot_min_genplot_max_genref_gen
For example, to replot the figure at generation 2, write the [visual] section as follows:
Then, run the following command:
In this case, CrySPY overwrites ./data/energy_plot/energy_EA_gen_{gen}.{fig_fotmat}.
You can specify the range of generations to be plotted using plot_min_gen and plot_max_gen.
When plot_min_gen is set to specify a range (even if its value is 1), the output is saved with a different filename such as ./data/energy_plot/energy_EA_gen_{plot_min_gen}-{plot_max_gen}.{fig_fotmat}, instead of the usual one.
For example, to extract only the results of the second generation from the results available at generation 2:
To change which generation the plot goes up to (i.e., the maximum value of the x-axis), specify the generation with ref_gen.
For example, as shown in the image at the top of this page, if three generations have been completed and you want to extract only the results from the second generation, set the [visual] section in cryspy.in as follows:
If ref_gen is specified, the output filename becomes
energy_EA_gen_{plot_min_gen}-{plot_max_gen}_ref_{ref_gen}.{fig_format}.
For more advanced data analysis or figure customization, download the files and use Jupyter Notebook as shown below.
Download Data
It is assumed here that you analyze and visualize CrySPY data on your local PC.
If you use CrySPY on a supercomputer or workstation, download the data to your local machine.
You can delete the work and backup directories if they are not needed, as their file size can be very large.
Jupyter Notebook
Move to the data/ directory in the results you downloaded earlier.
Then, if the CrySPY utility has already been downloaded locally, copy cryspy_analyzer_EA.ipynb.
Alternatively, you can download it directly from GitHub (CrySPY_utility/notebook/).
Launch Jupyter (e.g., VS Code, Jupyter Lab, or Jupyter Notebook),
and simply run the cells in order to obtain a figure like the one shown below.
Variable-Composition Evolutionary Algorithm (EA-vc)
Info
- For the basic usage of CrySPY, start by referring to CrySPY > Tutorial > Random Search (RS).
- For the basic usage of EA, start by referring to CrySPY > Tutorial > Evolutionary algorithm (EA).
- For details of the algorithm, refer to CrySPY > Search algorithms > Variable-composition Evolutionary algorithm (EA-vc).
Info
System requirements
- CrySPY 1.4.0 or later
- For interface compatibility, see CrySPY > Interface.
Preparation of Input Files
Follow one of the instructions below, then proceed to the section on running CrySPY.
To impose a charge neutrality condition, specify charge in the [structure] section of cryspy.in. See Features > Charge neutrality condition for details.
To restrict the composition range explored by the search, specify min_comp and max_comp in the [structure] section of cryspy.in (version 1.5.0 or later). These constraints can also be combined with charge neutrality. See Features > Composition Constraints for details.
Running CrySPY
Subsections of Variable-Composition Evolutionary Algorithm (EA-vc)
ASE on Your Local PC (Cu-Ag-Au)
Last updated: October 16, 2026
The files used in this tutorial can be downloaded from CrySPY_utility/examples/ase_Cu-Ag-Au_EA-vc. This tutorial demonstrates a test run on a local machine using ASE’s lightweight Pure Python EMT calculator. The target system is the ternary Cu-Ag-Au system.
cryspy.in
Example of cryspy.in.
- Use
algo = EA-vc. - From v1.5.0,
energy_output_intervalin the [option] section sets the output interval in generations for the convex-hull plot and hull-distance file. Default:1(every generation);0disables automatic output. - From v1.5.0,
backup_intervalin the [option] section sets the automatic backup interval in generations. The default is1;0disables automatic backups. See Features > Backup for details. - When using a bash environment, set
jobcmdto bash. - In the [structure] section, use
ll_natto specify the minimum number of atoms for each element, andul_natfor the maximum. n_pop=n_crsov+n_perm+n_strain+n_rand+n_add+n_elim+n_subs- The
ref_energies(end_pointin versions 1.4.3 and earlier) field should be set to the energy per atom (eV/atom) for each pure element—Cu, Ag, and Au. When using ASE’s Pure Python EMT calculator, the energies of the pure elements are zero, so enter 0.0 in each case. (For an example using CHGNet, refer to ASE-CHGNet(Cu-Au).) - 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.
calc_in/ase_in.py
calc_in/job_cryspy
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.
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).
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.
These values are then used as input for the cryspy.in file.
cryspy.in
- Use
algo = EA-vc. - From v1.5.0,
energy_output_intervalin the [option] section sets the output interval in generations for the convex-hull plot and hull-distance file. Default:1(every generation);0disables automatic output. - From v1.5.0,
backup_intervalin the [option] section sets the automatic backup interval in generations. The default is1;0disables automatic backups. See Features > Backup for details. - Since MLIPs use the ASE Calculator interface, set
calc_code = ASE. - Change
jobcmdaccording to your computing environment. - In the [structure] section, use
ll_natto specify the minimum number of atoms for each element, andul_natfor the maximum. n_pop=n_crsov+n_perm+n_strain+n_rand+n_add+n_elim+n_subs- In the
ref_energies(end_pointin 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 ofatype. - 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
calc_in/job_cryspy
VASP(Fe-Al)
Last updated: October 16, 2026
EA-vc became compatible with VASP in version 1.4.2.
The files used here can be downloaded from CrySPY_utility/examples/vasp_Fe-Al_EA-vc. This tutorial assumes calculations are performed on a computer cluster with a job scheduler using VASP. The target system is a binary Fe-Al alloy, and calculations are performed assuming ferromagnetism.
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.
Crystal structure data (POSCAR), input files for structure optimization and energy calculation (INCAR), and job scripts (job_cryspy) are provided, so edit them as needed to match your computing environment.
Also, the POTCAR files cannot be distributed, so please prepare them yourself.
In the INCAR file, be sure to use the same cutoff and other values for the single-element calculations as you will use in the final calculations.
Run the jobs (replace the job submission command as appropriate for your environment).
After the calculations are finished, obtain the energy per atom. In this case, since BCC and FCC unit cells each contain one atom, you can use the total energy value directly. Normally, divide the total energy by the number of atoms in the unit cell to obtain the per-atom energy.
cryspy.in
cryspy.in
- Use
algo = EA-vc. - From v1.5.0,
energy_output_intervalin the [option] section sets the output interval in generations for the convex-hull plot and hull-distance file. Default:1(every generation);0disables automatic output. - From v1.5.0,
backup_intervalin the [option] section sets the automatic backup interval in generations. The default is1;0disables automatic backups. See Features > Backup for details. - Change
jobcmdaccording to your computing environment. - In the [structure] section, use
ll_natto specify the minimum number of atoms for each element, andul_natfor the maximum. n_pop=n_crsov+n_perm+n_strain+n_rand+n_add+n_elim+n_subs- In the
ref_energies(end_pointin 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 ofatype. - 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.
For VASP
In the [VASP] section, specify the MAGMOM values for each element corresponding to atype in vasp_MAGMOM.
When CrySPY copies the INCAR file to ./work/xxx/INCAR (where xxx is the structure ID), it appends n*vasp_MAGMOM (n is the number of atoms).
For example, if atype = (‘Fe’, ‘Al’), nat = (5, 3), and vasp_MAGMOM = (4.0 0.0), the following will be appended.
Although not used in this tutorial, INCAR’s LDAUL, LDAUU, and LDAUJ are also supported. In cryspy.in, they are used with the vasp_ prefix as follows:
If the system changes from a binary alloy to a single element, such as nat = (5, 0), CrySPY will append the following to ./work/xxx/INCAR.
No action is taken for elements with an atomic number of zero.
calc_in/
POTCAR
In EA-vc, prepare a separate POTCAR file for each element. The file names should be:
POTCAR_FePOTCAR_Al
Add the element name as written in atype to the end of the file name.
CrySPY prepares ./work/xxx/POTCAR according to the number of atoms in the structure.
For example, if the structure consists only of Fe (nat = (5, 0)), use POTCAR_Fe.
If the structure is Fe-Al (nat = (4, 4)), concatenate POTCAR_Fe and POTCAR_Al to create POTCAR.
job_cryspy
INCAR
1_INCAR
2_INCAR
QE(Fe-Al)
Last updated: October 16, 2026
EA-vc became compatible with QE in version 1.4.2.
The files used here can be downloaded from CrySPY_utility/examples/qe_Fe-Al_EA-vc. This tutorial assumes calculations are performed on a computer cluster with a job scheduler using QE. The target system is a binary Fe-Al alloy, and calculations are performed assuming ferromagnetism.
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.
Input files (pwscf.in) and job scripts (job_cryspy) are provided, so edit them as needed to match your computing environment.
In the pwscf.in file, be sure to use the same cutoff and other values for the single-element calculations as you will use in the final calculations.
Run the jobs (replace the job submission command as appropriate for your environment).
After the calculations are finished, convert the energy per atom to eV units. In this case, since BCC and FCC unit cells each contain one atom, you can use the total energy value directly. Normally, divide the total energy by the number of atoms in the unit cell to obtain the per-atom energy.
cryspy.in
cryspy.in
- Use
algo = EA-vc. - From v1.5.0,
energy_output_intervalin the [option] section sets the output interval in generations for the convex-hull plot and hull-distance file. Default:1(every generation);0disables automatic output. - From v1.5.0,
backup_intervalin the [option] section sets the automatic backup interval in generations. The default is1;0disables automatic backups. See Features > Backup for details. - Change
jobcmdaccording to your computing environment. - In the [structure] section, use
ll_natto specify the minimum number of atoms for each element, andul_natfor the maximum. n_pop=n_crsov+n_perm+n_strain+n_rand+n_add+n_elim+n_subs- In the
ref_energies(end_pointin 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 ofatype. - 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.
For QE
Unlike VASP, support for variable-composition in QE is straightforward.
For binary system searches, always prepare binary system inputs in ./calc_in, and for ternary systems, always prepare ternary system inputs.
However, only nat needs to be changed, so CrySPY automatically rewrites it.
When preparing, write nat with any appropriate number as shown below:
In ./work/xxx/, CrySPY automatically rewrites lines that start with nat (excluding leading whitespace) to:
calc_in/
job_cryspy
pwscf.in
1_pwscf.in
2_pwscf.in
Create Next Generation
Last updated: October 16, 2026
First Run
When you run cryspy, the program enters structure generation mode.
It generates the first generation of random structures and then exits.
It can be confirmed from the output that structures are generated with the number of atoms within the range specified by ll_nat and ul_nat.
The file cryspy.stat shows that the current generation’s information is being added during the EA process.
Optimize Structures
After running cryspy several times and completing the structure optimization for the first generation, the output will appear as shown below.
Convex Hull
At this point, the hull distance data and the convex hull plot have been output to ./data/convex_hull/.
- hull_dist_all_gen_1
Create Next Generation
Once all preparations are complete, running cryspy again starts generating the next-generation structures.
By default (backup_interval = 1), an automatic backup is performed immediately before generating these structures.
From v1.5.0, backup_interval in the [option] section can be used to change the interval in generations; 0 disables automatic backups. See Features > Backup for details.
After that, simply running cryspy repeatedly will advance the structure search.
Check Results
Last updated: October 16, 2026
This section focuses on the differences from the EA method.
cryspy_rslt
Below is an example of a cryspy_rslt file after completing calculations up to the third generation.
In EA-vc, formation energy (Ef_eV_atom) and number of atoms (Num_atom) are also included.
From v1.5.0, rslt_out in the [option] section controls when cryspy_rslt and cryspy_rslt_energy_asc are written. The default is always. See Input File > [option] Section for details.
Checking Results for a Specific Composition
From v1.5.0, the -c (--composition) option of cryspy-print displays only results with a specified composition ratio from rslt_data.pkl.
Specify the ratio in atype order. In this example, atype = Cu Ag Au, so the following command selects structures with no Cu and an Ag:Au ratio of 1:1.
Ratios are reduced before comparison, so IDs 7 and 8 in the table above, with Num_atom values of (0, 4, 4) and (0, 3, 3), both match.
Matching results are displayed in ascending order of formation energy (Ef_eV_atom). --all displays all matching rows; replace it with --head 10 to display only the ten lowest-energy results.
Output for the data in the table above:
nat_data
Information on the number of atoms and composition is also included in nat_data.
hull_dist_all_gen_x
With the default settings, for example, after the third generation is completed, the hull distance data is output to the file ./data/convex_hull/hull_dist_all_gen_3.
The output interval is set with energy_output_interval in the [option] section. The default is 1 (every generation); 0 disables automatic file output. See Input File > [option] Section for details.
conv_hull_gen_x.svg
With the default settings, the convex hull plot at the end of generation 3 is saved as ./data/convex_hull/conv_hull_gen_3.svg.
Automatic output of the convex hull plot follows the same energy_output_interval setting.
Although svg is the default format, it can be changed to pdf or png by modifying the fig_format in the input file.
Analysis and Visualization
Last updated: October 16, 2026
Automatic Convex Hull Plotting
In EA-vc simulations of binary and ternary systems, a convex hull plot is automatically generated at the end of each generation by default.
The figure is saved to ./data/convex_hull/conv_hull_gen_{gen}.{fig_fotmat}.
From version 1.5.0, the output interval in generations can be changed with energy_output_interval in the [option] section. The default is 1 (every generation); 0 disables automatic output of the convex-hull plot and hull-distance file. The convex hull and hull distances are still calculated every generation. See Input File > [option] Section for details.
Binary System
The above figures show examples after the search up to the third generation.
The following input variables can be set in the [visual] section of cryspy.in.
See also CrySPY > Input file > [visual] section.
Here, vmax is the maximum value of the colorbar for the hull distance, and bottom_margin is the margin between the minimum formation energy and the lower limit of the y-axis.
As shown in the left figure, when axis_order = lr (the default setting),
the convex hull plot is drawn so that atype[0] is on the left and atype[1] is on the right.
The right figure shows the case with axis_order = rl.
That is, when atype = Cu Au, the pure Cu crystal is placed on the right side of the plot,
while the pure Au crystal is placed on the left.
Ternary System
The figures above show the examples for a ternary system.
The following input variables can be set in the [visual] section of cryspy.in.
See also CrySPY > Input file > [visual] section.
Here, show_max specifies the maximum hull distance shown in ternary systems.
In the above example, it is commented out, so the default value None is applied.
When axis_order = tlr (the default setting), atype[0], atype[1], and atype[2] are placed at the top, left, and right vertices, respectively, in the ternary convex hull plot, as shown in the left figure.
Adjust the vertex order accordingly for other permutations such as trl, ltr, etc.
The right figure shows an example with axis_order = ltr.
For atype = Cu Ag Au, Cu is placed at the left vertex, Ag at the top vertex, and Au at the right vertex.
Charge Neutrality Condition
The following convex hull plots show examples with a charge neutrality condition imposed by specifying charge.
See Features > Charge Neutrality Condition for input examples and details on specifying charges.
Binary examples: single-valence (left) and multi-valence (right).
- single-valence:
(Cu, Au) = (+1, -1) - multi-valence:
(Cu, Au) = ((+2, +3), -2)
Ternary examples: single-valence (left) and multi-valence (right).
- single-valence:
(Cu, Ag, Au) = (+1, +2, -1) - multi-valence:
(Cu, Ag, Au) = (+1, (+2, +3), -2)
Composition Constraints
From version 1.5.0, min_comp and max_comp can restrict the composition range explored by the search.
When composition constraints are set, the allowed range is shown as a blue region in the convex hull plot.
See Features > Composition Constraints for input examples and an explanation of the plots.
Examples of search results through generation 3 for binary (left) and ternary (right) systems.
To check the composition range specified in the input without using search results, use the cryspy-Eplot -c option.
Combining Charge Neutrality with Composition Constraints
Composition constraints can also be combined with charge neutrality specified by charge.
In that case, the blue region represents only the composition constraints, and generated structures must also satisfy charge neutrality within that region.
See Features > Composition Constraints for input examples.
Example of ternary search results through generation 3 with both conditions applied.
Replotting with cryspy-Eplot
If you want to fine-tune the figure and replot it, you can easily do so using the cryspy-Eplot command as follows:
Replotting Specific Generations
When using the cryspy-Eplot command, the following variables can also be specified in the [visual] section in addition to the standard variables above.
plot_min_genplot_max_genref_gen
For example, to replot the figure at generation 2, write the [visual] section as follows:
Then, run the following command:
In this case, CrySPY overwrites ./data/convex_hull/conv_hull_gen_{gen}.{fig_fotmat}.
You can specify the range of generations to be plotted using plot_min_gen and plot_max_gen.
When plot_min_gen is set to specify a range (even if its value is 1), the output is saved with a different filename such as ./data/convex_hull/conv_hull_gen_{plot_min_gen}-{plot_max_gen}.{fig_fotmat}, instead of the usual one.
For example, from left to right, the figures above show convex hull plots including only the structures from the first, second, and third generations, respectively.
Note that the convex hull (solid line) in all plots is based on the third generation using ref_gen = 3.
The value of ref_gen must be set to be greater than or equal to plot_max_gen.
As shown in the central figure, to extract only the results of the second generation, specify the following settings in the [visual] section.
If ref_gen is specified, the output filename becomes
conv_hull_gen_{plot_min_gen}-{plot_max_gen}_ref_{ref_gen}.{fig_format}.
Convex Hulls with Compound Terminals
You can also plot a convex hull referenced to compound compositions by specifying terminals in the [visual] section. For an example, see Commands > cryspy-Eplot > Convex Hulls with Compound Terminals.
The following example uses Li–Al–O search results through generation 30 with a charge neutrality condition imposed. The left figure shows the ternary convex hull referenced to the elements; the right figure shows the pseudo-binary convex hull referenced to Li2O and Al2O3.
Download Data
It is assumed here that you analyze and visualize CrySPY data on your local PC.
If you use CrySPY on a supercomputer or workstation, download the data to your local machine.
You can delete the work and backup directories if they are not needed, as their file size can be very large.
Jupyter Notebook
Move to the data/ directory in the results you downloaded earlier.
Then, if the CrySPY utility has already been downloaded locally, copy cryspy_analyzer_EA-vc.ipynb.
Alternatively, you can download it directly from GitHub (CrySPY_utility/notebook/).
The Jupyter notebook file includes the same functions as the CrySPY code, allowing you to freely customize the convex hull plots. Execute the cells in order as appropriate, and choosing one of the following options will produce the same plot as the automatic output.
- Binary system, matplotlib
- Ternary system, matplotlib
In the section
- Interactive plot using Plotly,
interactive plots using Plotly are available for binary, ternary, and quaternary systems.
Bayesian Optimization (BO)
BO
LAQA
Last updated: October 16, 2026
Info
First, see Tutorial > Random Search (RS) for basic usage of CrySPY.
Here, we assume CrySPY 1.1.0 or later.
The example files used here can be downloaded from CrySPY_utility/examples/qe_Si16_LAQA. In this tutorial, only 50 initial structures are generated, but originally, LAQA is designed to select candidates from many more structures.
Input
cryspy.in
Here is an example of cryspy.in.
nstagemust be 1 in LAQA- From v1.5.0,
backup_intervalin the [option] section sets the automatic backup interval in selections. The default is1;0disables automatic backups. See Features > Backup for details. - You have to write
nselect_laqain [LAQA] section.nselect_laqais the number of candidates you select at one time.
If you want to change the value of the weight for LAQA score, edit wf and ws as below.
If omitted, the default values are used (0.1 and 10.0, respectively).
See, Search algorithms > LAQA for the score.
calc_in/pwscf.in_1
nstepcontrols how many steps of structure optimization can proceed in one selection. (NSWfor VASP)
calc_in/job_cryspy
- The job file is the same as the usual way.
Run
Tip
An automatic script is also available. See the bottom of this page.
Just type cryspy for the 1st run.
Check log_cryspy.
50 random structures are generated.
In LAQA, jobs of structure optimization for all structures are submitted once at the beginning.
Note that only 10 steps are proceeded here since we set nstep = 10.
Repeat cryspy command until all of these (10 steps) are completed.
If necessary, you can also submit all jobs at once by increasing the value of njob.
After all the initial optimizations, LAQA is ready is displayed at the end of log_cryspy.
Next cryspy run will make the first selection.
Here, only the number set in nselect_laqa will be selected.
Type cryspy to submit the jobs (next 10 steps).
Then, by repeating this over and over again, the optimization of the structure selected according to the score advances by 10 steps each time. Proceed until several structures are completed, and finish (stop) when you like.
Status
If you want to check the LAQA score during the simulation, you can look at the status file:
- ./data/LAQA_status
Other files for LAQA will be output:
- ./data_LAQA_bias
- ./data_LAQA_energy
- ./data_LAQA_score
- ./data_LAQA_selected_id
- ./data_LAQA_step
Analysis and Visualization
It is assumed here that you analyze and visualize CrySPY data in your local PC.
If you use CrySPY in super computers or workstations, download the data in your local PC.
You can delete the work and backup directory if you do not need it because the file size could be very large.
You may gzip the pkl data to decrease the file size.
Jupyter Notebook
Move to the data/ directory in results you just downloaded.
Then copy cryspy_analyzer_LAQA.ipynb from CrySPY utility.
You can obtain the graph and animation with the notebook. In the gif below, all of the optimizations were completed. This is just for animation. (When all of the optimizations are completed, the computational cost is the same as random search.)
This graph shows the energy as a function of optimization step. The red lines indicate three structures with the lowest energy. The most stable one reached diamond structure. The structures that eventually become stable were selected at an early stage.
Info
If algo = LAQA, the followings are automatically set in the [option] section.
- force_step_flag = True
- stress_step_flag = True
Force and stress data are collected step by step. Energy and structure data are NOT. They are collected for each selection. In other words, in this case, energy and structure data are saved once every 10 steps. If you want to collect energy and structure data step by step, manually set up as follows:
Auto Script
You may find it tedious to run cryspy over and over again. The auto script could help you.
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.
Converting Structure Data
Run the following command in the working directory. Use -s for files containing one structure each, such as CIF files.
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.
atype = Cuandnat = 8match the atom type and atom count in all three input structures.tot_struc = 5combines the three loaded structures with two randomly generated structures.load_struc_flag = Trueenables loading initial structures.- Adjust
jobcmdfor your computing environment.
Placing the Data and Running CrySPY
Before the first cryspy run, place the converted data as follows.
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 ID | Initial structure |
|---|---|
0 | Loaded from Cu8_1.cif |
1 | Loaded from Cu8_2.cif |
2 | Loaded from Cu8_3.cif |
3, 4 | Generated 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.
Molecular Crystal Structure Prediction
Last updated: October 16, 2026
Info
First, see Tutorial > Random Search (RS) for basic usage of CrySPY.
In this section, we give a tutorial on the molecular structure generation part only. On this page, “molecular crystals” refers to crystals generated by placing molecules or groups of atoms as structural units. This also includes cases where single atoms or polyatomic ions are used as units, as in the Li3PS4 example.
Since version 0.9.0, CrySPY has been able to generate random molecular crystal structures using PyXtal.
You need to use a pre-defined molecular by PyXtal’s database (see, https://pyxtal.readthedocs.io/en/latest/Usage.html?highlight=benzene#pyxtal-molecule-pyxtal-molecule)) or create molecule files that define molecular structures.
Pre-Defined Molecule
PyXtal currently supports C60, H2O, CH4, NH3, benzene, naphthalene, anthracene, tetracene, pentacene, coumarin, resorcinol, benzamide, aspirin, ddt, lindane, glycine, glucose, and ROY.
Let us generate molecular crystal structures that consist of 2 benzenes.
Move to your working directory, and copy input example files by one of the following methods.
- Download from CrySPY utility > examples > qe_benzene_2_RS_mol
- Copy from CrySPY utility that you installed
- (only version 0.10.3 or earlier)
cp -r ~/CrySPY_root/CrySPY-0.9.0/example/QE_benzene_2_RS_mol .
Take a look at cryspy.in.
In generating molecular crystal structures, you have to set struc_mode = mol in the [structure] section.
Molecule file(s) and the number of molecule(s) are specified as:
- mol_file = benzene
- nmol = 2
The timeout_mol option was removed in v1.5.0.
Run CrySPY and see the initial structures (./data/init_POSCARS).
User-Defined Molecule
Move to your working directory, and copy input example files for 2 formula units of Li3PS4.
- version 1.0.0 or later
- Copy from CrySPY utility
- version 0.10.3 or earlier
cp -r ~/CrySPY_root/CrySPY-0.9.0/example/QE_Li3PS4_2fu_RS_mol .
Molecule files of Li and PS4 are included. Supported formats in PyXtal are .xyz, .gjf, .g03, .g09, .com, .inp, .out, and pymatgen’s JSON serialized molecules.
Check cryspy.in.
A single atom (Li atom in this case) is treated as a molecule in the molecular crystal structure generation mode. In this example, a random molecular structure is composed of six Li molecules (atoms) and two PS4 molecules specified as:
- mol_file = ./Li.xyz ./PS4.xyz
- nmol = 6 2
In mol_file, set relative path of molecule files from cryspy.in.
Here the molecule files are placed in the same directory.
Run CrySPY and see the initial structures (./data/init_POSCARS).
Volume of Unit Cell
The volume scaling factor can be specified with vol_factor in cryspy.in.
The default is 1.1. Specify a single positive number.
For example, to set the factor to 1.5, write:
Random Structure Generation with MPI
Last updated: October 16, 2026
Info
First, see Tutorial > Random Search (RS) for basic usage of CrySPY.
Info
Requirements:
- CrySPY
1.1.01.2.3 or later - mpi4py
- MPI library (Open MPI, Intel MPI, MPICH, etc.)
Warning
1.1.0 <= CrySPY <=1.2.2 has a bug.
When you use bash (zsh) to run a job with MPI (e.g., jobcmd = zsh, jobfile = job_cryspy),
the MPI job does not run. There is no problem when you use a job scheduler (qsub, sbatch).
It has already fixed in version 1.2.3.
mpi4py
Install mpi4py if it is not already installed.
Input
cryspy.in is the same as normal usage and does not need to be changed.
Here we try structure generation with MPI using the following settings:
All except tot_struc, atype, and nat are irrelevant for structure generation and can be ignored here.
Run
To generate structures with 4 MPI processes, use mpiexec -n with the -p option:
If you submit jobs through a job scheduler, prepare a job script as shown below:
Please edit the location of the executable script cryspy.
Result
CrySPY simply divides the task (number of structures) by the number of processes:
- Rank 0: IDs 0 – 24
- Rank 1: IDs 25 – 49
- Rank 2: IDs 50 – 74
- Rank 3: IDs 75 – 99
CrySPY outputs the log in the order they are generated as follows:
However, the order in init_POSCARS is by structure ID since CrySPY outputs after all structures have been generated.
Note
Except for the random structure generation part, there is no point in using MPI because it is not parallelized.
Interactive Mode (Jupyter Notebook)
Last updated: October 16, 2026
Info
Preparation
When CrySPY is installed, ASE is automatically installed as well. Set up Jupyter to be usable on a workstation or local PC. In this tutorial, Pure Python EMT calculator is used for structure optimization. Note that the accuracy of the EMT potential is poor, as it is intended for demonstration purposes only.
The example notebook also includes code for using the machine learning potential CHGNet. If you want to try CHGNet, make sure to install it in advance using pip.
Input File
Move to your working directory, and copy the example files by one of the following methods.
- Download from CrySPY_utility/examples/interactive
- Copy from CrySPY utility that you installed
Even in interactive mode, cryspy.in is used as the input file.
The calc_in directory is not used in interactive mode.
You can refer to the examples of cryspy.in in the input_examples directory.
Here, the following cryspy.in using EA-vc will be used.
For more details on EA-vc, refer to the EA-vc tutorial.
Notebook
Open cryspy_interactive.ipynb and execute the cells from the top.
Check Current Working Directory
The first cell only checks the files and the contents of cryspy.in.
Import
Ignore the commented-out sections this time and execute the cell that imports the core libraries for CrySPY’s interactive mode.
Initialize CrySPY
This cell corresponds to a standard initial run. It reads cryspy.in and generates the initial structures.
Set Calculator
This cell sets the ASE calculator. Here, ASE’s EMT is used.
Restart CrySPY
Executing this cell starts the optimization of the previously generated initial structures. In interactive mode, structure optimization calculations are performed sequentially, one by one. A progress bar is also displayed during the process.
- njob: The number of structures to be optimized in a single execution. If set to 0, the value specified in
cryspy.inis used. - calculator: Assign the previously set calculator.
- optimizer: Select from
FIRE,BFGS, orLBFGS. Specify as a string. - symmetry: If True, structure optimization is performed while preserving symmetry.
- fmax: The maximum atomic force (eV/Å) used for convergence criteria.
- steps: Maximum optimization steps.
If the njob value is set to a small number, execute this cell multiple times to complete the optimization of all initial structures.
When using EA-vc, the following message will be displayed upon completion.
Executing this cell again will trigger generational turnover. Once the next-generation structures are generated, continue executing this cell repeatedly in the same manner.
Show Results
Running this cell allows you to display files such as cryspy_rslt_energy_asc.
Structure Visualization
You can interactively visualize both the initial and optimized structures.
Changing opt to init in action.get_atoms('opt', cid=0) allows you to check the initial structure.
The cid parameter specifies the structure ID.
Since this utilizes ASE’s functionality, the viewer option supports ngl, ase, and x3d.
To use ngl, you need to install nglview, so make sure to install it via pip in advance.
Energy Plot for RS, EA
For random search (RS) and evolutionary algorithm (EA), an energy graph shown below can be displayed. In the case of EA-vc, direct energy comparison is not possible due to differences in the number of atoms, so the convex hull plot, discussed later, is used instead.
Convex Hull Plot for EA-vc
Interactive Plot Using Plotly
For EA-vc, an interactive convex hull plot using Plotly is available. When CrySPY is installed, Plotly is automatically installed as well. This convex hull plot utilizes pymatgen’s functionality.
- cgen: Which generation’s data to plot up to. If None, data will be plotted up to the latest generation.
- show_unstable: The maximum hull distance value to display on the plot
- ternary_style
- Binary system: ternary_style = ‘2d’
- Ternary system: ternary_style = ‘2d’, ‘3d’
- Quaternary system: ternary_style = ‘3d’
When performing calculations with ternary or quaternary systems instead of binary systems, you can obtain the following interactive plots.
From left to right:
- Ternary system (ternary_style = ‘2d’)
- Ternary system (ternary_style = ‘3d’)
- Quaternary system (ternary_style = ‘3d’)
Binary System Using matplotlib
Running this cell plots the binary convex hull using matplotlib.
- cgen: Which generation’s data to plot up to. If None, data will be plotted up to the latest generation.
- show_max: The maximum formation energy to display on the plot
- label_stable: Whether to display the labels (compositions) of stable structures
- vmax: The maximum hull distance in the color bar
- bottom_margin: Bottom margin of y-axis
Ternary System Using matplotlib
If exploring a ternary system, running this cell will generate a convex hull plot using matplotlib.
- cgen: Which generation’s data to plot up to. If None, data will be plotted up to the latest generation.
- show_max: The maximum formation energy to display on the plot
- label_stable: Whether to display the labels (compositions) of stable structures
- vmax: The maximum hull distance in the color bar
For example, the following plot can be obtained.
Interface
2025 July 12, updated
CrySPY supports multiple structure optimizers:
- First-principles calculation
- VASP
- Quantum Espresso
- OpenMX (CrySPY 0.9.0 or later)
- Interatomic potential
- Other (Machine learning potentials and other models that support ASE)
- ASE (CrySPY 1.2.0 or later)
- Interactive mode(ASE)(CrySPY 1.4.0 or later)
At least one optimizer is required.
Algorithm Compatibility
- 1.4.2: EA-vc supports VASP
| RS | EA | EA-vc | BO | LAQA | |
|---|---|---|---|---|---|
| VASP | ✓ | ✓ | ✓ | ✓ | ✓ |
| Quantum Espresso | ✓ | ✓ | ✓ | ✓ | ✓ |
| OpenMX | ✓ | ✓ | × | ✓ | × |
| soiap | ✓ | ✓ | × | ✓ | ✓ |
| LAMMPS | ✓ | ✓ | × | ✓ | × |
| ASE | ✓ | ✓ | ✓ | ✓ | × |
| Interactive (ASE) | ✓ | ✓ | ✓ | × | × |
Option Compatibility
| energy_step_flag | struc_step_flag | force_step_flag | stress_step_flag | |
|---|---|---|---|---|
| VASP | ✓ | ✓ | ✓ | ✓ |
| Quantum Espresso | ✓ | ✓ | ✓ | ✓ |
| OpenMX | × | × | × | × |
| soiap | ✓ | ✓ | ✓ | ✓ |
| LAMMPS | × | × | × | × |
| ASE | × | × | × | × |
Search Algorithms
Table of Contents
Subsections of Search Algorithms
Random Search (RS)
under construction
Evolutionary Algorithm (EA)
2025 April 2
Background
Evolutionary algorithms (EAs) are metaheuristic methods inspired by the theory of evolution. EA can effectively generate new structures (offspring) by inheriting the local environments of the stable structures (parents) explored so far. Oganov group’s USPEX is a well-known software, and there are others such as XtalOpt. For example, there are previous studies such as the following papers.
- T. S. Bush, C. R. A. Catlow, and P. D. Battle, J. Mater. Chem. 5, 1269 (1995).
- A. R. Oganov and C. W. Glass, J. Chem. Phys. 124, 244704 (2006).
- A. R. Oganov, A. O. Lyakhov, and M. Valle, Acc. Chem. Res. 44, 227 (2011).
- A. O. Lyakhov, A. R. Oganov, H. T. Stokes, and Q. Zhu, Comput. Phys. Commun. 184, 1172 (2013).
Procedure
- Initialize population
- Evaluate fitness
- Natural selection
- Select parents
- Create next generation
- Repeat from step 2: Evaluate fitness
Initialize Population
In the first generation, a set of random structures is generated according to the number specified by n_pop.
tot_struc is not used in EA or EA-vc.
Evaluate Fitness
Currently, energy is the only property that can be used as fitness in CrySPY.
By setting fit_reverse = False, the algorithm is configured to search for the minimum value.
The fit_reverse setting is designed for future cases where fitness may be based on properties other than energy.
Natural Selection
DFT calculations occasionally fail and produce extremely unreasonable energy values.
emax_ea and emin_ea can be used to filter out structures with unreasonably low (or high) energy values:
$$ \mathrm{emin\_ea} \le E \ (\mathrm{eV/atom}) \le \mathrm{emax\_ea} $$
For example, if emin_ea is set, any structure with an energy lower than that value will be ignored.
In natural selection, the current population and elite individuals preserved from previous generations are first ranked based on fitness.
The number of elite individuals used here is specified by n_elite.
Only the top n_fittest individuals among the current population and elite individuals are selected, while all others are eliminated.
During the natural selection process, duplicates are removed using the StructureMatcher class provided by pymatgen, and then the top n_fittest individuals are selected.
n_fittest is often set to about half of n_pop (the population size).
Note that in the current implementation, if n_fittest = 0, all individuals are retained.
The figure below shows an example of the natural selection process when n_fittest = 5.
Select Parents
Two parent selection methods are implemented in CrySPY to select a single parent individual from the candidate parents.
Both methods are designed so that individuals with higher fitness have a higher probability of being selected.
Setting slct_func = TNM enables tournament selection, while slct_func = RLT enables roulette selection.
Tournament selection requires fewer parameters and is easier to use.
Create Next Generation
The next generation consists of offspring produced by evolutionary operations on candidate parents, along with some randomly generated structures. Random structures are added in each generation to maintain diversity and to help escape from local minima.
Evolutionary Operations
Here, we introduce the operations of the fixed-composition EA implemented in CrySPY.
Population Size
The sum of structures from crossover, permutation, strain, and random generation must be equal to n_pop.
n_pop=n_crsov+n_perm+n_strain+n_rand
Subsections of Evolutionary Algorithm (EA)
Crossover
Last updated: October 16, 2026
Overview
Crossover is an evolutionary operation that creates a new structure (offspring) by exchanging sliced regions between two parent structures. This promotes structural diversity and enables the inheritance of locally stable features. It is one of the main operators used to explore low-energy configurations in structure search.
How It Works
- Select two distinct individuals from the candidate parents
- Perform a random translation
- Randomly select a lattice vector
- Slice the parents near the center
- Swap the sliced halves
- Select the offspring with more atoms
- Adjust the number of atoms near the border
- Perform a minimum interatomic distance check
- Niggli reduction
4. Slice the Parents near the Center
The slice point is placed near the center and slightly varied each time.
If any of the subsequent steps fail, the process may be restarted from step 4.
However, the number of retries is limited to maxcnt_ea, and if this limit is exceeded, the parent selection step is repeated.
5. Swap the Sliced Halves
When crs_lat is set to random, the lattice vectors of one of the two parent structures are randomly selected.
When crs_lat is set to equal, the average of the lattice vectors of the two parent structures is used.
The default is random.
6. Select the Offspring with More Atoms
Swapping the sliced parts of the parent structures results in two structures with different numbers of atoms. Temporarily, we select the structure with more atoms.
However, if the composition differs too much from the target, the process restarts from step 4 (Slice the parents near the center).
The tolerance for the difference in the number of atoms is set by nat_diff_tole.
The default value of nat_diff_tole is 4, which allows a tolerance of ±4 atoms per element.
In the figure above, the number of blue atoms is -1 and the number of green atoms is +2 relative to the original composition.
7. Adjust the Number of Atoms near the Border
Deletion
When adjusting the number of atoms, the process starts with atom deletion.
The number of green atoms is excessive and needs to be reduced.
As illustrated in the figure below, atoms that do not satisfy the minimum interatomic distance defined by mindist are preferentially removed.
As shown below, if atoms that violate the minimum interatomic distance remain after the deletion process, the procedure is restarted from step 4 (Slice the parents near the center).
If there are no atoms violating the minimum interatomic distance but atoms still need to be deleted, atoms are removed in order of increasing distance from the border, as shown in the figure below. Note that, in addition to the central slicing point, positions with internal coordinates of 0 are also considered borders.
Addition
When atoms are lacking, the missing atoms are added near the border. The internal coordinate along the selected axis is determined as shown below. Here, mean refers to either the slice point or 0.
The remaining two components of the coordinate are determined randomly. Atoms are added until the target number is reached, while checking for violations of the minimum interatomic distance.
9. Niggli Reduction
After adjusting the atom counts and checking the minimum interatomic distances, Niggli reduction is applied to the offspring before saving it.
This uses pymatgen’s Structure.get_reduced_structure(reduction_algo="niggli").
Permutation
Last updated: July 7, 2026
Overview
Permutation is an evolutionary operation that generates new structures (offspring) by modifying the atomic arrangement within a single structure. It enables the exploration of alternative configurations without changing the lattice or the overall composition.
How It Works
The positions of atoms of different elements are swapped.
The number of swaps can be specified by ntimes, which is set to 1 by default.
After performing ntimes swaps, the operation is retried if the resulting structure is identical to the parent.
Finally, the minimum interatomic distances are checked.
Strain
Overview
Strain is an evolutionary operation that generates a new structure (offspring) by applying a small random distortion to the lattice of a parent structure. It helps to explore nearby regions of the configuration space while preserving atomic connectivity and composition. This operator is useful for fine-tuning structural candidates and escaping local minima.
How It Works
The lattice vectors are $ \mathbf{a} $ transformed to $ \mathbf{a}' $ by applying a strain matrix, as follows:
$$ \mathbf{a}' = \begin{pmatrix} 1 + \eta_1 & \frac{1}{2} \eta_6 & \frac{1}{2} \eta_5 \\ \frac{1}{2} \eta_6 & 1 + \eta_2 & \frac{1}{2} \eta_4 \\ \frac{1}{2} \eta_5 & \frac{1}{2} \eta_4 & 1 + \eta_3 \end{pmatrix} \mathbf{a}. $$Here, $ \eta_i $ are given by a Gaussinan distribution $ \mathcal{N}\left( 0, \ \sigma_{\mathrm{st}}^2 \right) $.
$ \sigma_{\mathrm{st}} $ is specified by the input parameter sigma_st (by default, sigma_st = 0.5).
As shown in the figure below, the lattice is deformed and then rescaled to restore the original volume.
Finally, the minimum interatomic distance constraint is checked.
Tournament Selection
Overview
Tournament selection is a method used to choose parent individuals from the candidate parents based on their fitness.
It is designed to balance selection pressure and diversity in the population.
The figure below shows an example with n_fittest = 10 and t_size = 3.
How It Works
- A fixed number of individuals (
t_size) are randomly selected from the candidate parents. - Among them, the individual with the highest fitness (i.e., lowest energy) is chosen as the parent.
- This process is repeated until the required number of parents is selected.
Advantages
- Simple and efficient
- Requires only one parameter (
t_size) - Can control selection pressure by adjusting
t_size
Notes
- The default value of
t_sizeis 3. - If
t_sizeis small, diversity is promoted. - If
t_sizeis large, selection pressure increases, favoring the fittest individuals. - Unlike roulette selection, tournament selection never chooses the bottom (
t_size- 1 ) individuals from the candidate parents.
Roulette Selection
Overview
Roulette selection is a probabilistic method used to select parent individuals from the candidate parents based on their fitness. In roulette selection, each individual’s chance of being selected is proportional to its fitness.
How It Works
- When
fit_reverseis set toFalse(default), corresponding to minimization mode where energy is used as fitness, the fitness values of the candidate parents are multiplied by –1. - The fitness values $ f_i $ are linearly scaled into $ f'_i $ using the following equation, where $ a $ and $ b $ are parameters specified by
a_rltandb_rlt, respectively (with the condition that $ a > b $). $$ f_i' = \frac{a - b}{f_{\mathrm{max}} - f_{\mathrm{min}}} f_i + \frac{b f_{\mathrm{max}} - a f_{\mathrm{min}}}{f_{\mathrm{max}} - f_{\mathrm{min}}} $$ - The scaled fitness values $ f_i’ $ are converted into selection probabilities using the following equation: $$ p_i = \frac{f_i’}{\sum_k f_k’} $$ Each probability $ p_i $ represents the likelihood of selecting the $ i $-th individual.
- Parent individuals are then selected one by one according to the probabilities $ p_i $ using roulette wheel sampling, until the required number of parents is obtained.
Advantages
- All individuals have a non-zero chance of being selected
- Selection pressure can be adjusted by scaling the fitness values
Notes
- By default,
a_rlt = 10.0andb_rlt = 1.0 - Proper scaling of fitness values is important to ensure meaningful selection pressure.The figure below shows examples of $ p_i $ when $ a $ is relatively small (left) and relatively large (right). If $ a $ is too small, the selection pressure becomes weak, making it more difficult to favor individuals with higher fitness.
Variable-Composition Evolutionary Algorithm (EA-vc)
2025 July 7, updated
Overview
Since CrySPY 1.4.0, a variable-composition EA (EA-vc) has been available as an extension of the fixed-composition EA. Refer to the following page for the supported interfaces (Interface). Although the overall flow is similar to the fixed-composition EA, EA-vc differs in how fitness is evaluated and how offspring are generated in order to handle varying compositions. Here, we describe the parts that have been modified from the original EA.
From version 1.4.1, it is possible to generate structures under the charge neutrality condition.
Procedure
- Initialize population
- Evaluate fitness
- Natural selection
- Select parents
- Create next generation
- Repeat from step 2: Evaluate fitness
Initialize Population
In the first generation, a set of random structures is generated according to the number specified by n_pop.
tot_struc is not used in EA or EA-vc.
In EA-vc, the number of atoms for each atom type is randomly determined within a user-defined range.
The minimum (ll_nat) and maximum (ul_nat) number of atoms per type can be specified in cryspy.in as shown below.
Evaluate Fitness
The convex hull computed from formation energies is used to evaluate the phase stability of different compositions, since directly comparing total energies of structures with different numbers of atoms is not meaningful. Information on formation energy, the convex hull, and phase diagrams can be found online. For example, see Materials Project Documentation. In EA-vc, the fitness is defined as the energy above hull (also referred to as hull distance).
Formation Energy
Formation energy is calculated based on the reference energies (in eV/atom) of stable pure elements, which are specified as ref_energies in cryspy.in.
For example, in the case of the Cu–Au binary system, the ref_energies should contain the per-atom energies (in eV/atom) of fcc-Cu and fcc-Au, in that order.
Note that even if a structure with the same composition as ref_energies is found during the structure search and has a total energy lower than the corresponding ref_energies value, the formation energy is still currently calculated based on the original ref_energies values defined in cryspy.in.
Convex Hull
The energy difference between a given structure’s formation energy and the convex hull is called the energy above hull, also known as the hull distance. This value indicates how much higher the formation energy of a structure is compared to the most stable combination of phases at the same composition. Structures with a hull distance of zero are on the convex hull and are thus thermodynamically stable.
Unlike in the fixed-composition EA, EA-vc filters structures based on their per-atom energy when computing the convex hull, using the condition: $$ \mathrm{emin\_ea} \le E \le \mathrm{emax\_ea} $$ Note that this filtering is based only on the total energy per atom, not on the formation energy.
To compute the convex hull, CrySPY uses the PhaseDiagram class provided by the pymatgen library.
Unlike in the case of formation energy, if a structure with the same composition as a pure element has a total energy lower than the corresponding ref_energies value, that structure is used as the reference for computing the convex hull and hull distance.
Natural Selection
As shown in the figure below, EA-vc can produce multiple stable structures (i.e., with a hull distance of 0).
In such cases, multiple individuals share the top rank in terms of hull distance.
If the number of elite structures specified by n_elite is smaller than the number of equally ranked individuals, the selection becomes non-deterministic.
Currently, CrySPY randomly selects n_elite individuals from those with a hull distance less than 0.001 eV/atom.
If the number of individuals with a hull distance less than 0.001 eV/atom is smaller than n_elite, elite structures are selected in the usual way, based on fitness ranking.
When selecting elite individuals as well, duplicate structures are removed using the StructureMatcher class provided by the pymatgen library.
Elite individuals are selected based on the best structures from previous generations. However, because hull distance can vary from one generation to the next, the values for elite individuals are recalculated using the current convex hull before natural selection is applied.
As described in the Convex Hull section, emin_ea and emax_ea are not used for natural selection in EA-vc.
Select Parents
The method for selecting parents is the same as in the fixed-composition EA.
Create Next Generation
Evolutionary Operations
The crossover (vc) operation is slightly different from that in the fixed-composition EA, while permutation and strain are the same. EA-vc introduces several new operations to enable compositional variation.
Population Size
The sum of structures from crossover, permutation, strain, addition, elimination, substitution, and random generation must be equal to n_pop.
n_pop=n_crsov+n_perm+n_strain+n_add+n_elim+n_subs+n_rand
Subsections of Variable-Composition Evolutionary Algorithm (EA-vc)
Crossover (vc)
Last updated: October 16, 2026
The variable-composition crossover is almost the same as the fixed-composition version, but it differs in that the adjustment of the number of atoms is minimized.
In step 6 of the fixed-composition crossover, the difference in the number of atoms in each atom type is calculated directly.
In contrast, in crossover (vc), the difference is calculated based on the allowed range defined by ll_nat and ul_nat.
For example:
If this difference in the number of atoms (nat_diff in the example above) exceeds the allowed tolerance (nat_diff_tole), the operation is retried.
Otherwise, the number of atoms is adjusted to fall within the range defined by ll_nat and ul_nat.
Addition
2025 July 7, updated
An atom type whose current count does not exceed the limit specified by ul_nat is randomly selected, and one atom of that type is added at a random position.
From version 1.4.1, the functionality to add multiple atoms has been implemented. The number of atoms to be added is randomly selected from natural numbers up to add_max.
The default value is add_max = 5.
- Add one atom and check whether it satisfies the minimum interatomic distance specified by
mindist. - If the distance condition is not satisfied, the atom is placed again at a different random position. This process is repeated up to
maxcnt_eatimes. - (since version 1.4.1) Repeat until the randomly determined number of atoms (up to
add_max) have been added. - If no valid offspring is obtained, the volume is expanded by 10%, and the same procedure is retried up to
maxcnt_eatimes. - If that also fails, the volume is expanded up to 20% and the structure generation is attempted again. If it still fails, the parent is replaced.
Elimination
2025 July 7, updated
An atom type whose current count is above the lower limit specified by ll_nat is randomly selected, and one atom of that type is removed.
From version 1.4.1, the functionality to remove multiple atoms has been implemented.
The number of atoms to be removed is randomly selected from natural numbers up to elim_max.
The default value is elim_max = 5.
Substitution
2025 July 7, updated
Substitution is an operation in which two different atom types are randomly selected and their positions are substituted.
From version 1.4.1, the functionality to substitute multiple atoms has been implemented. The number of atoms to be substituted is randomly selected from natural numbers up to subs_max.
The default value is subs_max = 3.
- The number of atoms after the substitution is restricted so that it does not fall below the minimum (
ll_nat) and does not exceed the maximum (ul_nat) number of atoms. - Finally, the minimum interatomic distance specified by
mindistis checked, and if there are no issues, the structure is accepted as an offspring.
Bayesian Optimization (BO)
under construction
One of the selection-type algorithms.
Reference
LAQA
One of the selection-type algorithms.
Score $ L $
$$ L = -E + w_F \frac{F^2}{2\Delta F} + w_S S. $$| Symbol | Note |
|---|---|
| $$ E $$ | Energy (eV/atom) |
| $$ w_F $$ | Weight of the force term. Default: $ w_F = 0.1$ |
| $$ F $$ | Averaged norm of the atomic force (eV/Å) |
| $$ \Delta F $$ | Absolute difference of $ F $ from the previous step. $ \Delta F = 1$ for the first step. $ \Delta F = 10^{-6}$ if $ \Delta F \le 10^{-6} $. |
| $$ w_S $$ | Weight of the stress term. Default: $ w_S = 10.0$ |
| $$ S $$ | Average of the absolute values of the components of the stress tensor (eV/Å^3). |
Reference
Structure Generation
CrySPY currently has three random structure generation modes: crystal (default), mol, and mol_bs.
PyXtal (or find_wy) is used for the structure generation.
Table of Contents
Subsections of Structure Generation
struc_mode = crystal
under construction
struc_mode = mol
under construction
struc_mode = mol_bs
CrySPY uses pyxtal in normal molecular crystal structure generation mode (struc_mode = mol). The molecules are arranged to fit a point group at a selected Wykoff position in the space group to keep the symmetry. (Sometimes it takes a long time to generate.)
In mol_bs mode (bs means break symmetry), dummy atoms are placed in Wykoff positions as in ordinary crystals, and then the dummy atoms are replaced by molecules without considering symmetry and rotated randomly. The structure generation is relatively fast.
under construction
Features
Table of Contents
Subsections of Features
Logging
2023 July 10
CrySPY 1.2.0 adopts logging library of Python.
CrySPY logs are output to both the screen and files(log_cryspy and err_cryspy).
- log –> screen and
log_cryspy - error and warning –> screen and
err_cryspy
Here is the example:
If you do not want output in the console, run cryspy with the -n option as follows:
Backup
Last updated: July 15, 2026
CrySPY provides a simple backup function. The following files and directories are backed up.
cryspy.incryspy.statlog_cryspyerr_cryspydebug_cryspycryspy_interactive.ipynbcalc_in/data/
Note that work/ is not included in the backup.
- (v1.5.0 or later) The progress number and unit are appended to the backup directory name. For a manual backup,
manualis also appended. The automatic backup interval can be specified usingbackup_interval. - (v1.1.0 or later) The files and directories listed above are copied to a directory named by date and time. Previous backups are not automatically deleted.
- (v1.0.0) Only one generation is backed up, and older backups are deleted.
Backup Directory Names (v1.5.0 or Later)
In v1.5.0 or later, the progress number and unit at the time of backup are appended to the backup directory name.
Backups are stored under backup/.
The date and time are placed at the beginning of the directory name using the following formats.
- Automatic backup:
YYYYMMDD_HHMMSS_<progress_number>_<unit> - Manual backup:
YYYYMMDD_HHMMSS_manual_<progress_number>_<unit>
The progress units are as follows.
- RS:
struc- The progress number is the number of structures with registered results.
- BO and LAQA:
select- The progress number is the current selection number.
- EA and EA-vc:
gen- The progress number is the current generation number.
Examples of backup directory names are shown below.
- Automatic backup after completing generation 5 in EA:
backup/20260715_143052_5_gen/ - Automatic backup after completing selection 3 in BO:
backup/20260715_143052_3_select/ - Manual backup in generation 5 in EA:
backup/20260715_154210_manual_5_gen/ - Manual backup in selection 3 in BO:
backup/20260715_154210_manual_3_select/ - Manual backup after registering results for 100 structures in RS:
backup/20260715_154210_manual_100_struc/
If a manual backup is performed when the progress number and unit cannot be obtained, such as before initialization, the directory name is YYYYMMDD_HHMMSS_manual.
Automatic Backup
In v1.5.0 or later, the automatic backup interval can be specified using backup_interval in the [option] section of cryspy.in.
For example, to set the automatic backup interval to 5, write:
The following values can be specified for backup_interval.
0: Disable automatic backups.- Positive integer: Perform automatic backups at the specified interval.
The default value and interval unit for each algorithm are as follows.
- RS
- The default is
0. - Automatic backups using
backup_intervalare not performed. - Divide calculations using
tot_strucand perform a manual backup after completion.
- The default is
- BO and LAQA
- The default is
1. - Automatic backups are performed in units of selections.
- An automatic backup is performed immediately before proceeding to the next selection.
- The default is
- EA and EA-vc
- The default is
1. - Automatic backups are performed in units of generations.
- An automatic backup is performed immediately before generating the next-generation structures.
- The default is
When appending structures, a backup is performed before the structures are appended, independently of the periodic backups controlled by backup_interval.
Manual Backup
To perform a manual backup, run cryspy with the -b or --backup option.
This command performs only the backup without running the normal calculation process.
Clean
2024 Dec. 22 updated
CrySPY has a simple clean (just move files) function. It is useful when you want to start over from the beginning. The following files are cleaned up:
- cryspy.stat
- log_cryspy
- err_cryspy
- lock_cryspy
- data/*
- work/*
- tmp_gen_struc/*
To clean up, run cryspy with -c or --clean option as:
Files other than calc_in/* and cryspy.in are moved to trash and grouped into a directory named by date and time.
If you do not need them, you can delete them manually.
Loading Initial Structures
Last updated: October 16, 2026
Prepared structures can be used as the initial structures for a search.
Setting load_struc_flag = True in the [option] section of cryspy.in loads ./data/pkl_data/init_struc_data.pkl on the first run. The default is False.
If fewer structures are loaded than required, the remaining structures are generated randomly.
Usage
See Tutorial > Loading Initial Structures for an example that converts three CIF files and loads the resulting data.
CrySPY Utility’s pos2pkl.py can convert structure files to init_struc_data.pkl.
Checks During Loading
The following conditions are checked when loading. If a condition is not satisfied, an error is raised and initialization stops.
- The data in
init_struc_data.pklmust be a dictionary. - Structure IDs must be consecutive integers starting from
0: for example,0,1, and2for three structures. - Each structure must be a pymatgen
Structureobject. - The number of structures must not exceed the limit below.
| Algorithm | Maximum number of structures |
|---|---|
| EA, EA-vc | n_pop |
| RS, BO, LAQA | tot_struc |
See Data Format > Initial and Optimized Structure Data for format details.
Atom Types, Atom Counts, and Composition Checks
In RS, BO, LAQA, and EA, the atom types and the number of atoms of each type must match atype and nat. Structures with different atom counts cannot be used, even if their composition ratios are the same.
In EA-vc, the following conditions are checked.
| Item | Condition |
|---|---|
| Atom types | Only atom types listed in atype are present. |
| Atom counts | Each atom count is within the bounds specified by ll_nat and ul_nat, and the structure contains at least one atom in total. |
| Composition constraints | Any composition range specified by min_comp or max_comp is satisfied. |
| Charge neutrality | If charge is specified, neutrality can be achieved with a combination of the specified oxidation states. |
See Composition Constraints and Charge Neutrality Condition for details.
The loading checks do not enforce mindist, space-group constraints, or cell-volume constraints.
Filling Missing Structures
If fewer structures are loaded than tot_struc or n_pop, the remaining structures are generated randomly.
Additional structures receive consecutive IDs following the last loaded ID.
The loaded and additional structures are saved together to ./data/pkl_data/init_struc_data.pkl and ./data/init_POSCARS.
Restriction on Interatomic Distances
2024 April 23, updated
You can restrict the interatomic distance in structure generation. Here is an example of [structure] section in the input file to limit minimum interatomic distance for a A-B binary system.
This means that minimum interatomic distances of A-A, A-B, and B-B are limited to 2.0, 1.8, and 1.5 Å, respectively. Structures with interatomic distances shorter than these values are automatically eliminated.
For ternary systems, you will need mindist_1, mindist_2, and mindist_3.
Mindist matrix must be a symmetric matrix.
Since CrySPY version 1.4.0, the minimum interatomic distance check is also performed after structure relaxation.
This feature was introduced because, with machine learning potentials, structures with nearly overlapping atoms can sometimes be obtained.
You can disable this feature by adding the following line to cryspy.in (it is enabled by default):
Example: Na8Cl8
Without mindist
cryspy.in
log_cryspy
In the default settings of PyXtal, atoms can sometimes be too close to each other, as shown in the figure above, so it is recommended to set the mindist parameter. That would help simplify DFT calculations.
With mindist
cryspy.in
log_cryspy
In cases like ionic crystals, it is advisable to set up the configuration in such a way that cations and anions are kept apart from each other.
Job File Auto-Rewriting
2025 July 10, updated
In CrySPY job files, the string CrySPY_ID is automatically replaced with the structure ID.
When using job schedulers like PBS or SLURM, it is convenient to use the structure ID in the job name.
For example, in PBS, #PBS -N Si_CrySPY_ID becomes #PBS -N Si_15.
In most cases, job names cannot start with numbers, so it’s good to start with letters like Si_.
Also, since version 1.4.2, it is no longer necessary to write the following command at the end. CrySPY automatically appends it.
For example, if you prepare a job file like this in ./calc_in/job_cryspy (where job_cryspy is the file name specified by jobfile in cryspy.in):
For example, if the ID is 15, CrySPY rewrites ./work/15/job_cryspy as follows.
The CrySPY_ID in the 5th line is replaced with 15, and the sed command is appended at the end.
Structure Generation with MPI Parallelization
Oct. 21 2023, update
Random structure generation using MPI has been available since version 1.1.0 ( using CrySPY >= 1.2.3 is better). You need to install mpi4py in your Python environment for MPI parallelization. Of course, an MPI library such as Open MPI, Intel MPI, and MPICH is required for your workstation.
Info
Requirements:
- CrySPY
1.1.01.2.3 or later - mpi4py
- MPI library (Open MPI, Intel MPI, MPICH, etc.)
Warning
1.1.0 <= CrySPY <=1.2.2 has a bug.
When you use bash (zsh) to run a job with MPI (e.g., jobcmd = zsh, jobfile = job_cryspy),
the MPI job does not run. There is no problem when you use a job scheduler (qsub, sbatch).
It has already fixed in version 1.2.3.
The figure below shows the relationship between elapsed time and the number of processes for 1000 structures of Si8 with the following setting:
The structure generation is taking a long time because of a slightly stricter setting like mindset_1 = 2.2.
The structure generation was performed 10 times for each number of processes.
Run
Info
Enthalpy
2023/10/18
Info
Requirements:
- CrySPY 1.2.2 or later
- VASP or QE
When performing CSP at high pressure, enthalpy results can be collected instead of total energy. Not yet compatible with softwares other than VASP and QE.
E_eV_atom in cryspy_rslt and cryspy_rslt_energy_asc turns into enthalpy (eV/atom). Here is the example of CSP results under 40 GPa pressure for Sr4O4.
CsCl-type structure (ID 5) is more stable than NaCl-type (ID 6).
VASP
CrySPY reads energy (enthalpy) from a OSZICAR file.
This automatically changes to enthalpy when PSTRESS is set in INCAR_x as follows:
You do not have to do anything in cryspy.in.
energy_step_flag is also supported for enthalpy.
Example: CrySPY utility > examples > qe_Sr4O4_RS_pv_term
QE
Add pv_term = True in the QE section of cryspy.in to use enthalpy:
Don’t forget to write press in the QE input:
Warning
In QE, energy_step_flag is not supported yet for enthalpy.
Interactive Mode
2025 March 6
Info
An interactive mode using Jupyter Notebook has been made available to ensure ease of use, even for those unfamiliar with PC clusters or supercomputers. Since the structure optimization calculations are designed for ASE, compatible machine learning potentials can be used.
For detailed usage, please refer to Tutorial > Interactice mode(Jupyter Notebook).
Energy Plot
Last updated: October 16, 2026
Automatic Energy Plot
In EA and in binary or ternary EA-vc searches, plots are automatically generated at the end of each generation by default.
| Algorithm | Plot | Output file |
|---|---|---|
| EA | Energy plot | ./data/energy_plot/energy_EA_gen_{gen}.{fig_format} |
| EA-vc (binary or ternary) | Convex hull plot | ./data/convex_hull/conv_hull_gen_{gen}.{fig_format} |
The left figure shows an EA energy plot, and the right figure shows an EA-vc convex hull plot. Both examples are from the end of generation 3.
Here, gen is the generation number and fig_format is the image format (svg by default).
Plot appearance, including the marker size and image format, can be configured in the [visual] section of cryspy.in.
See Input File > [visual] Section for details.
For EA and EA-vc, the output interval can be changed with energy_output_interval in the [option] section.
The default value is 1 (every generation); 0 disables automatic output of the energy plot in EA and the convex-hull plot and hull-distance file in EA-vc.
The convex hull and hull distances in EA-vc are still calculated every generation.
See Input File > [option] Section.
For example plots and input settings, see Tutorial > EA > Analysis and Visualization and Tutorial > EA-vc > Analysis and Visualization.
cryspy-Eplot Command
The cryspy-Eplot command visualizes search results and adjusts plots. Its main capabilities are:
- Plot energies for RS/EA and convex hulls for EA-vc.
- Replot with changes to marker size, axis limits and arrangement, image format, and other display settings.
- Specify the generation range to plot and the reference generation in EA/EA-vc.
- Plot the allowed region defined by composition constraints.
- Specify reference compound compositions to plot convex hulls as pseudo-binary or pseudo-ternary systems.
For usage and examples, see Commands > cryspy-Eplot.
Charge Neutrality Condition
Last updated: October 16, 2026
Single-Valence Species
From version 1.4.1, it is possible to impose a charge neutrality condition during structure generation in EA-vc. This can be applied to both random structure generation and structure generation by evolutionary operations.
In cryspy.in, the charge corresponding to each atype is specified as charge.
The example below assumes a Li–Ca–Cl-like combination of charges, assigning hypothetical charges of +1, +2, and −1 to Cu, Ag, and Au, respectively. Cu–Ag–Au is used as a substitute so that the charge neutrality condition can be tested easily with ASE’s lightweight Pure Python EMT calculator, as in the ASE tutorial.
Example of cryspy.in:
For example, in this case, only structures that satisfy the charge neutrality condition, such as (Cu, Ag, Au) = (4, 0, 4) or (Cu, Ag, Au) = (4, 2, 8), will be generated.
Note that if add_max or elim_max is too small as shown below, there may be no combinations of atom numbers that satisfy the charge neutrality condition when adding or removing atoms, making structure generation impossible.
For example, in the above case, if add_max = 1, there are no combinations of atom numbers that satisfy the charge neutrality condition. If add_max = 2, (Cu, Ag, Au) = (1, 0, 1), that is, adding one Cu and one Au atom, satisfies the charge neutrality condition because (+1) + (-1) = 0. If add_max = 3, there are combinations such as (Cu, Ag, Au) = (1, 0, 1) and (0, 1, 2).
The default values of add_max, elim_max, and subs_max are 5, 5, and 3, respectively.
Multi-Valence Species
From version 1.5.0, CrySPY supports elements with multiple possible oxidation states.
Multiple oxidation states can be specified in charge by enclosing them in parentheses or square brackets.
As in the single-valence example, Cu–Au is used as a substitute for a Fe–O-like system so that the charge neutrality condition can be tested easily with ASE’s lightweight Pure Python EMT calculator. Cu is assigned hypothetical charges of +2 or +3, and Au is assigned a hypothetical charge of −2.
Example cryspy.in:
For example, when the numbers of atoms are (Cu, Au) = (1, 1), charge neutrality is satisfied by assigning Cu a charge of +2. When (Cu, Au) = (2, 3), charge neutrality is satisfied by assigning both Cu atoms a charge of +3.
Even when multiple oxidation states are specified, the element is treated as a single atomic species in atype.
Therefore, ll_nat and ul_nat specify the lower and upper limits for the total number of atoms of that element, rather than the number of atoms for each oxidation state.
In addition, the generated structures do not distinguish between species such as Cu²⁺ and Cu³⁺. When checking charge neutrality, CrySPY simply determines whether the composition can be neutralized using any combination of the specified oxidation states.
Enumeration and Sampling of Atom-Count Combinations
From v1.5.0, cn_mode in the [structure] section controls how charge-neutral atom-count combinations are determined for random structure generation. This option is used only when charge is specified.
cn_mode | Behavior |
|---|---|
auto | Default. Uses enumerate if the number of combinations to examine exhaustively is at most max_cn_grid_points; otherwise, uses sample. |
enumerate | Enumerates charge-neutral atom-count combinations in advance and randomly selects from them. Raises an error if the number of combinations examined exhaustively exceeds the limit. |
sample | Generates charge-neutral atom-count combinations as needed without enumerating all combinations in advance. |
During enumeration, the charge-neutrality equation is used to eliminate one atom-count variable. All possible integer combinations of the remaining variables are examined exhaustively. For each combination, the eliminated variable is calculated and checked to ensure that its value is an integer within the atom-count bounds. max_cn_grid_points limits the number of combinations in this exhaustive search. The default is 200000000.
For example, with charge = 1 2 -1 and atom counts from 0 to 10 for each of Cu, Ag, and Au, the Ag atom-count variable is eliminated. Cu and Au each have 11 possible atom counts. For each combination, the Ag atom count is calculated as (Au atom count − Cu atom count) / 2, giving 11 × 11 = 121 combinations to examine exhaustively. For multi-valence species, the count is calculated similarly after internally expanding each oxidation state into a separate species.
For many atom types or wide atom-count ranges, sampling can reduce the computational cost and memory use associated with enumeration.
In enumerate mode, the enumerated atom-count combinations are selected with equal probability. In sample mode, the selection probabilities are not necessarily uniform.
Combining Charge Neutrality with Composition Constraints
From version 1.5.0, min_comp and max_comp can restrict the composition range in addition to imposing charge neutrality.
The example below adds composition constraints to the single-valence Cu–Ag–Au example, using the same hypothetical charges of +1, +2, and −1, respectively.
With these charges, neutrality requires the number of Cu atoms plus twice the number of Ag atoms to equal the number of Au atoms. The composition constraints additionally require the fractions of Cu, Ag, and Au to lie within 0.0–0.3, 0.1–0.4, and 0.4–0.7, respectively, including the boundaries.
For example, a structure with atom counts (Cu, Ag, Au) = (4, 0, 4) is charge neutral, but it is excluded by these composition constraints because its Ag fraction is zero. In contrast, (Cu, Ag, Au) = (1, 2, 5) has a total charge of 1 × (+1) + 2 × (+2) + 5 × (−1) = 0, and its composition (0.125, 0.25, 0.625) is also within the allowed range.
The left figure shows the allowed composition region, and the right figure shows search results through generation 3 with both conditions applied.
The blue region represents only the composition constraints. In this example, charge-neutral compositions lie on a line in the ternary diagram. The search is restricted to compositions where this line overlaps the blue region and the atom-count constraints are also satisfied. For details on composition constraints and their plots, see Composition Constraints.
Composition Constraints
Last updated: October 16, 2026
From version 1.5.0, the composition range explored by EA-vc can be restricted.
Specify min_comp and max_comp in the [structure] section of cryspy.in.
These constraints apply to both random structure generation and structure generation by evolutionary operations.
Composition constraints can be used for binary and ternary systems, as well as systems with four or more components.
Plots of the allowed composition region and search results are available for binary and ternary systems.
Settings
The composition fraction of each atomic species is its number of atoms divided by the total number of atoms in the cell, and ranges from 0 to 1. For example, atom counts of (Cu, Au) = (2, 6) give a composition of (Cu, Au) = (0.25, 0.75).
min_comp specifies the lower composition bounds, and max_comp specifies the upper bounds.
Both must have the same number of entries as atype, in the same order. The boundaries are included in the allowed range.
- If only
min_compis specified,max_compis set to1.0for every species. - If only
max_compis specified,min_compis set to0.0for every species. - If both are omitted, no composition constraints are imposed.
While ll_nat and ul_nat restrict the number of atoms of each species, min_comp and max_comp restrict their fractions.
When these settings are combined, only combinations of atom counts satisfying all conditions are explored.
For a list of input variables, see Input File > [structure] Section.
Binary Example
Example of the [structure] section in cryspy.in:
Here, the Cu fraction is restricted to at most 0.6, and the Au fraction to at most 0.5. Since the two fractions sum to 1, the Au upper bound of 0.5 gives a Cu lower bound of 0.5, while the Cu upper bound of 0.6 gives an Au lower bound of 0.4. Therefore, only structures with a Cu fraction of 0.5–0.6 and an Au fraction of 0.4–0.5 are generated. For example, atom counts of (Cu, Au) = (4, 4), (3, 2), and (6, 4) satisfy the conditions, whereas (2, 6), (6, 2), and structures containing only Cu or only Au do not.
Changing min_comp and max_comp to the following values gives the same allowed composition range:
On the first run of CrySPY, the allowed composition range is plotted automatically and saved as ./data/convex_hull/composition_window_1.svg.
The 1 in the filename is the generation number to which these composition constraints apply.
The file extension follows fig_format in the [visual] section, which defaults to svg.
The figure below corresponds to the first input example.
In binary composition-window plots, the species are arranged along the horizontal axis according to axis_order in the [visual] section to match the convex-hull plot.
In this figure, the horizontal axis represents the Au fraction.
The lower blue band corresponds to the Cu constraint, and the upper orange band to the Au constraint. The range satisfying both is shown with darker colors and dashed lines.
In this example, the allowed Au fraction is 0.4–0.5.
The following figure shows search results through generation 3 using these composition constraints.
The horizontal axis represents the Au fraction, and the blue region indicates the allowed range of 0.4–0.5.
Ternary Example
Example of the [structure] section in cryspy.in:
Input 1 is active in this example.
To use input 2 or input 3, comment out the min_comp and max_comp lines for input 1 and remove the leading # from both lines of the desired input.
The composition fractions always sum to 1.
The allowed region in a ternary diagram therefore consists of compositions satisfying the lower and upper bounds of every species.
As in the binary example, the plot is saved automatically as ./data/convex_hull/composition_window_1.<fig_format> on the first run.
The three figures below were drawn for the respective inputs using cryspy-Eplot -c.
In each figure, Cu is at the top vertex, Ag at the lower left, and Au at the lower right. Dashed lines mark the specified composition bounds.
From left to right, the figures correspond to input 1, input 2, and input 3.
Input 1
The Cu fraction is restricted to 0.0–0.6, Ag to 0.2–0.5, and Au to 0.2–0.7. The blue region represents compositions satisfying all these conditions. For example, atom counts of (Cu, Ag, Au) = (3, 2, 5) give a composition of (0.3, 0.2, 0.5), which satisfies the constraints.
Input 2
The Cu fraction is restricted to 0.4–0.6, and the Ag and Au fractions are each restricted to 0.2–0.4. The allowed region is a triangle with vertices at (Cu, Ag, Au) = (0.6, 0.2, 0.2), (0.4, 0.4, 0.2), and (0.4, 0.2, 0.4). For example, atom counts of (Cu, Ag, Au) = (4, 3, 3) give a composition of (0.4, 0.3, 0.3), which satisfies the constraints.
Input 3
Both Cu bounds are set to 0.6, while Ag is restricted to 0.2–0.5 and Au to 0.2–0.7.
Since the Cu fraction is fixed at 0.6, the Ag and Au fractions must sum to 0.4.
Their lower bounds are both 0.2, so the only allowed composition is (Cu, Ag, Au) = (0.6, 0.2, 0.2), shown as a blue point.
The atom counts are still variable.
For example, structures with atom counts of (Cu, Ag, Au) = (3, 1, 1) and (6, 2, 2) have the same composition and both satisfy ll_nat and ul_nat.
Search Results
The following figure shows search results through generation 3 using the composition constraints of input 1. The blue region indicates the allowed composition range.
Combining Composition Constraints with Charge Neutrality
charge can be used together with composition constraints.
Generated structures must then satisfy the atom-count constraints, composition constraints, and charge neutrality condition.
As in the charge neutrality example, Cu, Ag, and Au are assigned hypothetical charges of +1, +2, and −1, respectively. The Cu fraction is restricted to 0.0–0.3, Ag to 0.1–0.4, and Au to 0.4–0.7. For example, atom counts of (Cu, Ag, Au) = (1, 2, 5) give a composition of (0.125, 0.25, 0.625), which satisfies the composition constraints. The total charge is also 1 × (+1) + 2 × (+2) + 5 × (−1) = 0, satisfying charge neutrality.
The left figure shows the allowed composition range, and the right figure shows search results through generation 3 with both composition constraints and charge neutrality applied.
The blue region represents the composition constraints only; it does not include the charge neutrality condition. Generated structures are restricted to compositions within this region that also satisfy charge neutrality.
Checking the Allowed Composition Range
For binary and ternary systems, the first run of CrySPY with composition constraints automatically saves a plot as ./data/convex_hull/composition_window_1.<fig_format>.
The number in the filename indicates the generation to which the composition constraints apply.
If min_comp or max_comp is changed during a search, the new constraints apply to parent filtering and structure generation at the next generational change.
The plot is saved when CrySPY is run again after the input change, without waiting for the generational change. Its filename uses the current generation number plus one.
For example, changing the constraints during generation 3 and running CrySPY again produces ./data/convex_hull/composition_window_4.<fig_format>. The new constraints are applied when generating generation 4.
Changing axis_order or fig_format also saves a plot using the next generation number.
Plots are not saved every generation if these settings remain unchanged.
To check the allowed composition region without starting a search, run the following command in the directory containing cryspy.in:
The plot is saved as ./data/convex_hull/composition_window_input.<fig_format>.
fig_format and axis_order can be specified in the [visual] section.
For details, see cryspy-Eplot and Input File > [visual] Section.
This plot represents the continuous composition region determined by min_comp and max_comp.
It does not account for integer atom-count constraints from ll_nat and ul_nat or charge neutrality from charge. Compositions that can actually be generated may therefore occupy only part of the plotted region.
Notes
For each species, min_comp must be less than or equal to max_comp.
There must also be a combination of fractions summing to 1, so the sum of min_comp must not exceed 1, and the sum of max_comp must be at least 1.
Even if a continuous composition region exists, structures cannot be generated if no integer atom-count combination within ll_nat and ul_nat satisfies the constraints.
When using charge, make sure that combinations satisfying charge neutrality also exist.
If composition constraints are changed during a search, parent and elite candidates for the next generation are filtered using the updated atom-count and composition constraints. If the constraints are so restrictive that all candidates are excluded, the search cannot continue.
Skip Calculations
2025 July 15
Skip During Calculation
When electronic states in DFT calculations fail to converge or when you want to stop calculations for obviously unstable structures, you can skip them using the following procedure:
- Stop the job using
qdelor similar command - Change the 3rd line of
./work/xxx/stat_jobtoskip - Run CrySPY as usual
This will discard the structure and proceed to the next calculation.
Skip After Recording in cryspy_rslt (rslt_data.pkl)
CrySPY version 1.4.2 or later
When calculations finish with incorrect electronic states, the energy may be output excessively low and recorded in rslt_data. For example, in the following result, the energy of ID 198 is too low:
cryspy_rslt_energy_asc
To cancel this data and skip it, use the command automatically installed from version 1.4.2:
If you want to skip multiple structures, input multiple IDs:
This will update the data.
For EA or EA-vc
In the case of EA or EA-vc, the structure to be skipped may be registered as an elite structure. Using the cryspy-skip command removes the structures to be skipped from the data stored in elite_struc.pkl and elite_fitness.pkl.
Recalculating Convex Hull for EA-vc
In the case of EA-vc, the energy of the structure to be skipped may affect the convex hull calculation. Therefore, after skipping, recalculate the convex hull using the following command:
The 10 in the above input represents the generation, and it recalculates and plots the convex hull at generation 10.
Input File
Description of the input file, cryspy.in.
Table of Contents
Subsections of Input File
File Format
CrySPY uses the configparser module to read input file, cryspy.in .
cryspy.in consists of sections, led by a [section] header and followed by name = value or name : value entries.
Section names and values are case sensitive, but names are not.
Lines beginning with # or ; are ignored and may be used to provide comments.
Accepted bool values are 1, yes, true, and on, which cause this method to return True,
and 0, no, false, and off, which cause it to return False.
These string values for bool are checked in a case-insensitive manner.
Some values are given in a space-separated manner.
Info
See configparser in detail.
Note
section name: case sensitive
name: case insensitive
value: case sensitive except for bool
[basic] Section
2025 March 6 updated
| Name | Value | Default | Description |
|---|---|---|---|
algo | RS, EA, EA-vc, BO, LAQA | Algorithm | |
calc_code | VASP, QE, OMX, soiap, LAMMPS, ASE | Caluculation code for structure optimization | |
tot_struc | int | The total number of structures. Not used in the case of EA or EA-vc. | |
nstage | int | The number of stages | |
njob | int | The number of jobs running at the same time. | |
jobcmd | str | Command to submit jobs such as qsub and sbatch. | |
jobfile | str | File name of the job file. |
[structure] Section
Last updated: October 16, 2026
| Name | Value | Default | Description |
|---|---|---|---|
struc_mode | crystal, mol, mol_bs | crystal | Structure generation mode |
atype | atomic symbol [atomic symbol …] | Atom type. e.g. atype = Na Cl. | |
nat | int [int …] | The number of atoms corresponding to each atype. e.g. nat = 8 8. Not used in EA-vc. | |
mindist (mindist_?) | float [float …] | None | Constraint on minimum interatomic distance [Å]. See Features > Restriction on Interatomic Distances for details. |
mindist_factor | float | 1.0 | Scaling factor for mindist. |
vol_factor | float | 1.1 | Volume scaling factor. |
vol_mu | float | None | Mean of the normal distribution used to sample the cell volume [ų]. If specified, vol_sigma is also required. |
vol_sigma | float | None | Standard deviation of the normal distribution for the cell volume [ų], used together with vol_mu. |
symprec | float | 0.01 | Precision for symmetry finding. |
spgnum | all, space group number, 0 | all | Constraint on space group. If all, 1–230. If 0, random structure without space group information (no symmetry). |
use_find_wy | bool | False | Structure generation with find_wy. |
if algo is EA-vc
| Name | Value | Default | Description |
|---|---|---|---|
ll_nat | int [int …] | Lower limit of nat. e.g. ll_nat = 0 0. | |
ul_nat | int [int …] | Upper limit of nat. e.g. ul_nat = 8 8. | |
charge | int or grouped ints | None | Charge of each atom type used to impose charge neutrality, specified in the same order as atype. For example, charge = 1 -1 for NaCl. Since version 1.5.0, multiple oxidation states can be grouped in parentheses or square brackets. For example, charge = (2 3) -2 for atype = Fe O. See Charge Neutrality Condition for details. |
cn_mode | auto, enumerate, sample | auto | (since version 1.5.0) Used only when charge is specified. Mode for calculating atom-count combinations that satisfy the charge-neutrality condition. |
max_cn_grid_points | int | 200_000_000 | (since version 1.5.0) Used only when charge is specified. Maximum number of combinations examined exhaustively with cn_mode = auto or enumerate after eliminating one atom-count variable using the charge-neutrality equation. If this value is exceeded, auto switches to sampling, while enumerate raises an error. See Charge Neutrality Condition for details, including how combinations are counted for multi-valence species. |
min_comp | float [float …] | None | (since version 1.5.0) Used to impose composition constraints. Specifies the lower bound of the normalized composition (from 0 to 1) for each atom type. Specify one value per atom type in the same order as atype. If only max_comp is specified, min_comp is set to 0.0 for every atom type. |
max_comp | float [float …] | None | (since version 1.5.0) Used to impose composition constraints. Specifies the upper bound of the normalized composition (from 0 to 1) for each atom type. Specify one value per atom type in the same order as atype. If only min_comp is specified, max_comp is set to 1.0 for every atom type. |
if struc_mode is mol or mol_bs
Molecular crystal structure generation (struc_mode = mol or mol_bs) is not supported in EA or EA-vc.
| Name | Value | Default | Description |
|---|---|---|---|
mol_file | str [str …] | Path of molecule files or molecule names. | |
nmol | int [int …] | The number of molecules. | |
timeout_mol | float | None | (removed in version 1.5.0) Time out for molecular structure generation. |
rot_mol | random, random_mol, random_wyckoff | random_wyckoff | Only used in mol_bs. Mode for rotation of molecules. |
nrot | int | 20 | Only used in mol_bs. Maximum number of trials to rotate molecules. |
mindist_mol_bs (mindist_mol_bs_?) | float [float …] | None | Only used in mol_bs. Constraint on minimum intermolecular distance [Å]. |
mindist_mol_bs_factor | float | 1.0 | Only used in mol_bs. Scaling factor for mindist_mol_bs. |
if use_find_wy is True or spgnum = 0
| Name | Value | Default | Description |
|---|---|---|---|
fwpath | str | None | Only used with find_wy. Path of find_wy. If None, fwpath is automatically searched in your $PATH. |
minlen | float | Only used with find_wy or spgnum = 0. Minimum length of lattice vector [Å]. | |
maxlen | float | Only used with find_wy or spgnum = 0. Maximum length of lattice vector [Å]. | |
dangle | float | Only used with find_wy or spgnum = 0. Delta angle for alpha, beta, and gamma in degree unit. | |
maxcnt | int | 50 | Only used with find_wy or spgnum = 0. Maximum number of trials to determine atom positions. |
[VASP] Section
Last updated: October 12, 2026
[VASP] section is required only if you use VASP (calc_code = VASP)
| Name | Value | Default | Description |
|---|---|---|---|
kppvol | int [int …] | Target k-point grid density for each stage (number of k-points per Å⁻³ of reciprocal-space volume). | |
force_gamma | bool | False | If true, force gamma-centered mesh. |
vasp_MAGMOM | float [float …] | None | Used only for EA-vc. MAGMOM values for each element. |
vasp_LDAUL | int [int …] | None | Used only for EA-vc. LDAUL values for each element. |
vasp_LDAUU | float [float …] | None | Used only for EA-vc. LDAUU values for each element. |
vasp_LDAUJ | float [float …] | None | Used only for EA-vc. LDAUJ values for each element. |
kppvol and Force Gamma
[QE] Section
[QE] section is required only if you use QE (calc_code = QE)
| Name | Value | Default | Description |
|---|---|---|---|
kppvol | int [int …] | Target k-point grid density for each stage (number of k-points per Å⁻³ of reciprocal-space volume). | |
qe_infile | str | File name of QE input file. | |
qe_outfile | str | File name of QE output file. | |
pv_term | bool | False | If true, read enthalpy instead of total energy. |
kppvol
pv_term
[OMX] Section
[OMX] section is required only if you use OpenMX (calc_code = OMX)
| Name | Value | Default | Description |
|---|---|---|---|
kppvol | int [int …] | Target k-point grid density for each stage (number of k-points per Å⁻³ of reciprocal-space volume). | |
OMX_infile | str | File name of OpenMX input file. | |
OMX_outfile | str | File name of OpenMX output file. | |
ValenceElectrons | str float float [str float float …] | The number of initial charges for up and down spin states. |
kppvol
ValenceElectrons
e.g. in NaCl: ValenceElectrons = Na 4.5 4.5 Cl 3.5 3.5.
[soiap] Section
[soiap] section is required only if you use soiap (calc_code = soiap)
| Name | Value | Default | Description |
|---|---|---|---|
soiap_infile | str | File name of soiap input file. | |
soiap_outfile | str | File name of soiap output file. | |
soiap_cif | str | File name of soiap CIF-formatted initial structure. |
[LAMMPS] Section
[LAMMPS] section is required only if you use LAMMPS (calc_code = LAMMPS)
| Name | Value | Default | Description |
|---|---|---|---|
lammps_infile | str | File name of LAMMPS input file. | |
lammps_outfile | str | File name of LAMMPS output file. | |
lammps_potential | str [str …], None | None | Potential. |
lammps_data | str | File name of LAMMPS data file. |
[ASE] Section
[ASE] section is required only if you use ASE (calc_code = ASE)
| Name | Value | Default | Description |
|---|---|---|---|
ase_python | str | File name of ASE input file. |
[EA] Section
Last updated: October 12, 2026
- The
[EA]section is required when using EA or EA-vc, or whenappend_struc_ea = Trueis specified in the[option]section. - See also CrySPY > Search algorithms > EA
EA
| Name | Value | Default | Description |
|---|---|---|---|
n_pop | int | Population (see also Population Size) | |
n_crsov | int | Number of offspring created by crossover | |
n_perm | int | Number of offspring created by permutation | |
n_strain | int | Number of offspring created by strain | |
n_rand | int | Number of structures created randomly | |
n_elite | int | Number of elite individuals (see also Natural Selection) | |
fit_reverse | bool | False | If False, minimal search (see also Evaluate Fitness) |
n_fittest | int | 0 | Number of individuals that remain natural selection. If set to 0, all individuals are retained. |
slct_func | TNM, RLT | Function to select parents | |
t_size | int | 3 | Tournament size. Used only used slct_func = TNM. (see also Tournament Selection) |
a_rlt | float | 10.0 | Parameter for linear scaling. Used only with slct_func = RLT. (see also Roulette Selection) |
b_rlt | float | 1.0 | Parameter for linear scaling. Used only with slct_func = RLT. (see also Roulette Selection) |
crs_lat | equal, random | random | How to mix lattice vectors (see also crossover > 5. Swap the sliced halves) |
nat_diff_tole | int | 4 | Tolerance for difference in the number of atoms in crossover. (see also crossover > 6. Select the offspring with more atoms) |
ntimes | int | 1 | Number of times in permutation. |
sigma_st | float | 0.5 | Standard deviation for strain. |
maxcnt_ea | int | 50 | Maximum number of trials in EA. |
max_parent_attempts | int | 50 | (since version 1.5.0) Maximum number of parent-selection attempts per offspring in EA. The initial parent selection is included. |
maxgen_ea | int | 0 | Maximum generation. If set to 0, no upper limit is applied. |
emax_ea | float | None | Energy upper limit (eV/atom) for natural selection. |
emin_ea | float | None | Energy lower limit (eV/atom) for natural selection. |
EA-vc
- EA-vc requires the following additional variables on top of the standard EA.
- Note that in EA-vc,
emax_eaandemin_eaare used not in natural selection but when computing the convex hull. - See also CrySPY > Search algorithms > EA-vc
- See also CrySPY > Tutorial > EA-vc > Analysis and visualization for the convex hull plot.
| Name | Value | Default | Description |
|---|---|---|---|
n_add | int | Number of offspring created by addition. | |
add_max | int | 5 | (since version 1.4.1) Maximum number of atoms to add in addition |
n_elim | int | Number of offspring created by elimination. | |
elim_max | int | 5 | (since version 1.4.1) Maximum number of atoms to eliminate in elimination |
n_subs | int | Number of offspring created by substitution. | |
subs_max | int | 3 | (since version 1.4.1) Maximum number of atoms to substitute in substitution |
ref_energies | float [float …] | (since version 1.5.0) Reference energies for formation energy calculation [eV/atom]. Specify one value per atom type in the same order as atype, separated by spaces without parentheses or commas. The number of values must match the number of atom types in atype. | |
end_point | float [float …] | (deprecated since version 1.5.0) Kept for backward compatibility. Use ref_energies instead. Uses the same units and input format as ref_energies. | |
emax_ea | float | None | Energy upper limit (eV/atom) for computing the convex hull. |
emin_ea | float | None | Energy lower limit (eV/atom) for computing the convex hull. |
- The following variables have been moved to the [visual] section since version 1.5.0.
cgenwas deprecated in version 1.5.0.- The default values below apply to versions 1.4.3 and earlier. For version 1.5.0 and later, see the [visual] section.
| Name | Value | Default | Description |
|---|---|---|---|
cgen | int | None | (in versions 1.4.1–1.4.3) Which generation’s data to plot up to. If None, data will be plotted up to the latest generation. |
show_max | float | 0.2 | When plotting the convex hull, the maximum value of the y-axis (for binary systems) or the maximum hull distance (for ternary systems) is set by show_max. |
label_stable | bool | True | Whether to show stable compositions when plotting the convex hull. |
vmax | float | 0.2 | Maximum value of the colorbar representing hull distance. |
bottom_margin | float | 0.02 | Bottom margin of the y-axis for binary convex hull plot. |
fig_format | str | svg | Figure format for convex hull plot: svg, png, or pdf. |
[BO] Section
Last updated: October 12, 2026
[BO] section is required only if you use BO (algo = BO)
| Name | Value | Default | Description |
|---|---|---|---|
nselect_bo | int | The number of structures to be selected at once. | |
score | TS, EI, PI | Acquisition function. | |
num_rand_basis | int | 0 | If 0, Gaussian process. The number of basis function. |
cdev | float | 0.001 | Cutoff of deviation for standardization. |
dscrpt | FP | Structure descriptor. | |
max_select_bo | int | 0 | Maximum number of selection. |
manual_select_bo | int [int …] | None | Structure IDs to be selected manually. |
emax_bo | float | None | Upper limit of energy in BO. |
emin_bo | float | None | Lower limit of energy in BO. |
if dscrpt is FP
CrySPY 1.3.0 or later
fppath and fp_rmin are obsolete.
| Name | Value | Default | Description |
|---|---|---|---|
fp_rmax | float | 8.0 | Only used with dscrpt = FP. Maximum cutoff of r in fingerprint. |
fp_npoints | int | 20 | Only used with dscrpt = FP. Number of discretized points for each pair in fingerprint. |
fp_sigma | float | 0.7 | Only used with dscrpt = FP. Sigma parameter [Å] in Gaussian smearing function. |
CrySPY 1.2.5 or earlyer
| Name | Value | Default | Description |
|---|---|---|---|
fppath | str | None | Only used with dscrpt = FP. Path of cal_fingerprint. If None, fwpath is automatically searched in your $PATH. |
fp_rmin | float | 0.5 | Only used with dscrpt = FP. Minimum cutoff of r in fingerprint. |
fp_rmax | float | 5.0 | Only used with dscrpt = FP. Maximum cutoff of r in fingerprint. |
fp_npoints | int | 20 | Only used with dscrpt = FP. Number of discretized points for each pair in fingerprint. |
fp_sigma | float | 1.0 | Only used with dscrpt = FP. Sigma parameter [Å] in Gaussian smearing function. |
[LAQA] Section
[LAQA] section is required only if you use LAQA (algo = LAQA)
| Name | Value | Default | Description |
|---|---|---|---|
nselect_laqa | int | The number of structures to be selected at once. | |
wf | float | 0.1 | Weight of the force term. |
ws | float | 10.0 | Weight of the stress term. |
Info
See also Search algorithms > LAQA
Info
If algo = LAQA, the followings are automatically set in the [option] section.
- force_step_flag = True
- stress_step_flag = True
Force and stress data are collected step by step.
By default, energy and structure data are collected and saved for each selection, at the end of each structure’s optimization run.
The number of optimization steps per selection is specified in the calculation code’s input settings, such as nstep in QE or NSW in VASP. The tutorial uses 10 steps per selection.
To also collect and save energy and structure data at every step, add the following settings:
[visual] Section
Last updated: October 12, 2026
The [visual] section is available since version 1.5.0.
Common
Common variables for RS, EA, EA-vc.
See also
- CrySPY > Tutorial > Random Search (RS) > Analysis and visualization
- CrySPY > Tutorial > Evolutionary Algorithm (EA) > Analysis and visualization
- CrySPY > Tutorial > Variable-composition evolutionary algorithm (EA-vc) > Analysis and visualization
Name Value Default Description ymaxfloat 0.2 Maximum value of the y-axis in the energy plots of RS, EA, and EA-vc (binary systems). markersizeint 10 Size of markers in all energy plots. fig_formatstr svgFigure formats: svg,png, orpdf.
EA
See also CrySPY > Tutorial > Evolutionary Algorithm (EA) > Analysis and visualization.
| Name | Value | Default | Description |
|---|---|---|---|
ref_gen | int | None | [post-analysis only] Reference generation for plotting. When specified, the plot is generated as of the end of this generation. If not specified, the latest generation is used. Must satisfy plot_max_gen <= ref_gen. |
plot_min_gen | int | None | [post-analysis only] Minimum generation for plotting. If not specified (i.e., None), the value is treated as 1. |
plot_max_gen | int | None | [post-analysis only] Maximum generation for plotting. If omitted, plotting extends through ref_gen when specified; otherwise, it extends through the latest generation. |
EA-vc
See also CrySPY > Tutorial > Variable-composition evolutionary algorithm (EA-vc) > Analysis and visualization for the convex hull plot.
| Name | Value | Default | Description |
|---|---|---|---|
show_max | float | None | Maximum hull distance shown in ternary systems. |
label_stable | bool | True | Whether or not to show stable compositions in the plot. |
vmax | float | 0.2 | Maximum value of the colorbar for the hull distance. |
bottom_margin | float | 0.04 | Bottom margin of the y-axis in binary systems. |
axis_order | str | None | Specifies the axis order: lr or rl in binary systems, and permutations of tlr (lrt, rtl, …) in ternary systems. When terminals is used, specify the axis order with terminal_axis_order. |
ref_gen | int | None | [post-analysis only] Reference generation for plotting. When specified, the plot is generated as of the end of this generation. If not specified, the latest generation is used. Must satisfy plot_max_gen <= ref_gen. |
plot_min_gen | int | None | [post-analysis only] Minimum generation for plotting. If not specified (i.e., None), the value is treated as 1. |
plot_max_gen | int | None | [post-analysis only] Maximum generation for plotting. If omitted, plotting extends through ref_gen when specified; otherwise, it extends through the latest generation. |
show_comp_window | bool | True | Whether to show the allowed composition range on the convex hull plot. |
ref_gen_comp | int | None | [post-analysis only] Generation from which min_comp and max_comp are taken for the composition-window overlay. If omitted, ref_gen is used when specified; otherwise, the latest generation is used. |
terminals | str str [str] | None | [post-analysis only] Two or three terminal compositions that define the compound phase diagram in cryspy-Eplot (e.g., Li2O Al2O3). Each terminal composition must have an entry in the phase-diagram data. |
terminal_axis_order | str | None | [post-analysis only] Axis order used with terminals. Each letter gives the position of the corresponding terminal in the order specified by terminals (t: top, l: left, r: right). Use lr or rl for two terminals, or a permutation of tlr (lrt, rtl, …) for three terminals. If omitted, lr is used for two terminals and tlr for three. |
[option] Section
Last updated: October 16, 2026
For the calculation codes supported by each *_step_flag, see Interface > Option compatibility.
| Name | Value | Default | Description |
|---|---|---|---|
rslt_out | always, cycle, off | always | (since version 1.5.0) Specifies when cryspy_rslt and cryspy_rslt_energy_asc are written.always: Write whenever a structure’s result is recorded.cycle: Write at the end of each generation in EA/EA-vc or each selection in BO/LAQA (no output in RS).off: Do not write these text files.Result pickle data is saved for all settings. |
check_mindist_opt | bool | True | If True, a mindist constraint is checked after structure relaxation. |
stop_chkpt | int | 0 | CrySPY stops at a specified check point. |
load_struc_flag | bool | False | If True, load initial structures from ./data/pkl_data/init_struc_data.pkl. Structure IDs must be consecutive integers starting from 0. The maximum number of loaded structures is n_pop for EA/EA-vc and tot_struc otherwise. Exceeding this limit raises an error; any shortfall is filled by random structure generation. See Features > Loading Initial Structures for details. |
stop_next_struc | bool | False | If True, CrySPY does not submit jobs for next structures, but jobs for next stage are submitted. |
backup_interval | int | RS: 0 Other: 1 | (since version 1.5.0) Interval between automatic backups in generations for EA/EA-vc or selections for BO/LAQA. Set to 0 to disable automatic backups. |
energy_output_interval | int | 1 | (since version 1.5.0) Interval in generations for outputting the energy plot in EA and the convex-hull plot and hull-distance file in EA-vc. Set to 0 to disable these automatic outputs. The convex hull and hull distances in EA-vc are still calculated every generation. |
recalc | int [int …] | None | Specify structure IDs if you want to recalculate or continue optimization. |
append_struc_ea | bool | False | If True, append structures by EA. |
energy_step_flag | bool | False | If True, save energy_step_data in ./data/pkl_data/energy_step_data.pkl. In QE, pv_term = True cannot be used together with energy_step_flag = True. |
struc_step_flag | bool | False | If True, save struc_step_data in ./data/pkl_data/struc_step_data.pkl. |
force_step_flag | bool | False | If True, save force_step_data in ./data/pkl_data/force_step_data.pkl. |
stress_step_flag | bool | False | If True, save stress_step_data in ./data/pkl_data/stress_step_data.pkl. |
seed | int | None | (since version 1.5.0) Seed for the random number generator. Must be an integer between 0 and 2**32 - 1. |
Kpoint
2024 April 22
CrySPY automatically generates the k-point setting using the pymatgen.io.vasp.Kpoints.automatic_density_by_vol function from pymatgen.
An example in cryspy.in with nstage = 2 is as follows:
- stage 1: kppvol = 40
- stage 2: kppvol = 120
kppvol means a grid density per Å${}^{-3} $ of reciprocal cell.
VASP: gamma centered meshes are used for hexagonal cells and face-centered cells; otherwise, Monkhorst-Pack grids are employed.
QE and OMX: only a k-mesh is provided, no offset.
What Is the Appropriate Value for kppvol?
Here are the guidelines. We use VESTA for visualizing crystal structures.
Primitive Cell of Diamond Si
a = b = c = 3.836 Å
| kppvol | k-mesh |
|---|---|
| 0 | [1, 1, 1] |
| 20 | [4, 4, 4] |
| 40 | [6, 6, 6] |
| 60 | [7, 7, 7] |
| 80 | [7, 7, 7] |
| 100 | [8, 8, 8] |
| 120 | [9, 9, 9] |
| 140 | [9, 9, 9] |
| 160 | [9, 9, 9] |
| 180 | [10, 10, 10] |
| 200 | [10, 10, 10] |
| 400 | [13, 13, 13] |
| 600 | [15, 15, 15] |
| 800 | [17, 17, 17] |
Conventional Cell of Diamond Si
a = b = c = 5.431 Å
| kppvol | k-mesh |
|---|---|
| 0 | [1, 1, 1] |
| 20 | [3, 3, 3] |
| 40 | [3, 3, 3] |
| 60 | [4, 4, 4] |
| 80 | [4, 4 ,4] |
| 100 | [5, 5, 5] |
| 120 | [5, 5, 5] |
| 140 | [6, 6, 6] |
| 160 | [6, 6, 6] |
| 180 | [6, 6, 6] |
| 200 | [6, 6, 6] |
| 400 | [8, 8, 8] |
| 600 | [9, 9, 9] |
| 800 | [10, 10, 10] |
Nd2Fe14B
a = b = 8.804 Å
c = 12.205 Å
| kppvol | k-mesh |
|---|---|
| 0 | [1, 1, 1] |
| 20 | [1, 1, 1] |
| 40 | [2, 2, 1] |
| 60 | [2, 2, 2] |
| 80 | [3, 3 ,2] |
| 100 | [3, 3, 2] |
| 120 | [3, 3, 2] |
| 140 | [3, 3, 2] |
| 160 | [3, 3, 2] |
| 180 | [4, 4, 2] |
| 200 | [4, 4, 3] |
| 400 | [5, 5, 3] |
| 600 | [6, 6, 4] |
| 800 | [6, 6, 4] |
Data Format
All pickle data are stored in the ./data/pkl_data/ directory.
A Jupyter notebook for analyzing the pkl data (pkl_data.ipynb) is also provided.
Table of Contents
Subsections of Data Format
Common Data
Table of Contents
Subsections of Common Data
Initial and Optimized Structure Data
Initial and optimized structure data are saved in init_struc_data.pkl and opt_struc_data.pkl, respectively. pymatgen library is required to analyze these data files.
Data Format
- type: dict
- key: structure ID
- value: structure data
- string form
- {0: Structure Summary …,
1: Structure Summary …,
…}
- {0: Structure Summary …,
- structure data format
How to Access
Result Data
Common result data such as space group, energies, etc. are saved in rslt_data.pkl. pandas library is required to analyze this data file.
Data Format
- type: pandas.core.frame.DataFrame
- row lable: structure ID
- string form
- see blow
How to Access
Random Search (RS)
Table of Contents
Evolutionary Algorithm (EA)
Table of Contents
Bayesian Optimization (BO)
Table of Contents
LAQA
Table of Contents
Optional Data
Table of Contents
Subsections of Optional Data
Energy Step Data
Energy step data is saved in energy_step_data.pkl if you set energy_step_flag = True in [option] section of cryspy.in. NumPy library is required to analyze this data file.
Warning
energy_step_flag = True is currently available only with VASP, QE, and soiap.
Info
In soiap, energy_step_data is collected only if loopa == 1.
This is because other data (struc, force, and stress) are output only when loopa == 1.
See, https://github.com/nbsato/soiap/blob/master/doc/instructions.md
Data Format
- type: dict
- key: structure ID
- value: list of energy step data in each stage
- string form
- {0: [array([-3.4439912 , -3.55040935, -3.66697038, ..]), array([-4.0613393 , -4.05445631, -4.06159641, …]), …],
1: [array([-2.68209823, -2.69012487, -2.68364907, ..]), array([-2.79140967, -2.79183827, -2.79206508, …]), …],
…}
- {0: [array([-3.4439912 , -3.55040935, -3.66697038, ..]), array([-4.0613393 , -4.05445631, -4.06159641, …]), …],
- unit of energy
- eV/atom
How to Access
Structure Step Data
Structure step data is saved in struc_step_data.pkl if you set struc_step_flag = True in [option] section of cryspy.in. pymatgen library is required to analyze this data file.
Warning
struc_step_flag = True is currently available only with VASP, QE, and soiap.
Info
struc_step_data includes initial structures.
For example, struc_step_data[cid][0][0] is the initial structure of ID = cid.
Data Format
- type: dict
- key: structure ID
- value: list of structure step data in each stage
- string form
- {0: [[Structure Summary …, Structure Summary, …], […], …],
1: [[Structure Summary …, Structure Summary, …], […], …],
…}
- {0: [[Structure Summary …, Structure Summary, …], […], …],
- structure data format
How to Access
Force Step Data
Force step data is saved in force_step_data.pkl if you set force_step_flag = True in [option] section of cryspy.in. NumPy library is required to analyze this data file.
Warning
force_step_flag = True is currently available only with VASP, QE, and soiap.
Data Format
- type: dict
- key: structure ID
- value: list of force step data in each stage
- string form
- {0: [array([[ 0.26314927, -0.26314927, -0. ], […], …[…]]), array([[…], …, […]]), …],
1: [array([[ 0. , 0. , 0. ], […], …[…]]), array([[…], …, […]]), …],
…}
- {0: [array([[ 0.26314927, -0.26314927, -0. ], […], …[…]]), array([[…], …, […]]), …],
- unit of force
- eV/Å
How to Access
Stress Step Data
Stress step data is saved in stress_step_data.pkl if you set stress_step_flag = True in [option] section of cryspy.in. NumPy library is required to analyze this data file.
Warning
stress_step_flag = True is currently available only with VASP, QE, and soiap.
Data Format
- type: dict
- key: structure ID
- value: list of stress step data in each stage
- string form
- {0: [array([[-0.16770062, 0. , 0. ], […], […]]), array([[…], ]…], […]]), …],
1: [array([[ 0.39260083, -0. , -0. ], […], […]]), array([[…], […], […]]), …],
…}
- {0: [array([[-0.16770062, 0. , 0. ], […], […]]), array([[…], ]…], […]]), …],
- unit of stress
- eV/(Å**3)
How to Access
CrySPY Utility
See Installation/CrySPY Utility to download.
Examples
Various examples are available in CrySPY_utility/examples (GitHub).
Scripts
You can find useful scripts in CrySPY_utility/script (GitHub).
Subsections of CrySPY Utility
repeat_cryspy
Link: CrySPY_utility/script/repeat_cryspy
You may find it tedious to run cryspy over and over again. The automated script could help you.
This automated script runs cryspy every 5 minutes by default.
The time interval can be adjusted by editing the following part of the script.
Usage
- copy repeat_cryspy to the working directory
- (optional) edit the time interval in repeat_cryspy
- run the script
You can use the nohup command to keep the job running even after logging out.
extract_struc.py (legacy)
Last updated: October 16, 2026
Info
In CrySPY v1.5.0 and later, these features are available through Commands > cryspy-extract-struc. This page describes the standalone utility script.
Link: CrySPY_utility/script/extract_struc.py
Script to extract structures from init_struc_data.pkl or opt_struc_data.pkl.
This script can print stucture information and output cif files.
One can specify structure ID(s) using -i option.
Top k structures (the k most stable structures) can be extracted using -t option.
-a option is for outputting all the structures.
(note that many cif files will be output.)
Symmetrized cif files can be generated with -s option.
When outputting a symmetrized CIF file, you can also specify a tolerance with --tolerance.
Structure information is printed with -p.
If you use -p option, cif files are not output.
You can also read a gzipped file (e.g., opt_struc_data.pkl.gz).
Update History
- 2024 April 16: –tolerance option, gzip
- 2023 July 21: –print option
Usage
or if you put the script in your PATH, you can omit python3
Examples
The -p option can be used in combination with any option except for -s option.
Structure ID
7.cif, 10.cif, and 12.cif are output.
For symmetrized cif,
2024 April 16
With the tolerance parameter (default 0.01)
Top k Structures
Info
rslt_data.pkl is required in the same directory as the input.
Let us suppose
- ./data/pkl_data/opt_struc_data.pkl
- ./data/pkl_data/rslt_data.pkl
and cryspy_rslt_energy_asc file is as follows:
Top k(=3) structures can be extracted with:
In this example, rlst_data.pkl must be in ./data/pkl_data/.
9.cif, 16.cif, and 97.cif are output.
The rank can be included in cif file names with -r option:
1_9.cif, 2_16.cif, and 3_97.cif are output.
For symmetrized cif:
All the Structures
You should make a directory.
For symmetrized cif,
Gzipped Files
2024 April 16
Gzipped files (end with .gz) can be read:
print_pkl.py (legacy)
Last updated: October 16, 2026
Info
In CrySPY v1.5.0 and later, use Commands > cryspy-print to inspect pickle files. This page describes the standalone utility script. Some output differs from the command version.
When you want to quickly check the pickled files under data/pkl_data/, using print_pkl.py is convenient.
Usage
or if you put the script in your PATH, you can omit python3
Example
pos2pkl.py
2023 July 23 update
Script to convert structre data into init_struc_data.pkl. The default input format is init_POSCARS. Single structure data such as POSCAR and cif files can be optionally converted. Output is init_struc_data.pkl. Structure data can be added to an already existing init_struc_data.pkl. The structure ID is not taken into account and is newly assigned. If the number of atoms is different, an error is generated.
init_struc_data.pkl can be loaded at the start of the simulation in CrySPY.
You can remove and sort species with -f option. Note that without this option, pymatgen will sort the species in electronegativity order!
Usage
Examples
init_POSCARS –> init_struc_data.pkl
It can be used to convert init_POSCARS generated by CrySPY to init_struc_data.pkl in another machine such as a supercomputer. Multiple input files can be converted.
If you put the pos2pkl.py in your PATH, you can omit python3.
Multiple inputs:
If init_struc_data.pkl already exists in the current directory and you want to append to it:
POSCAR or cif –> init_struc_data.pkl
Single structure data such as POSCAR and cif files can also be converted. -s/--single option is required.
init_POSCARS, POSCAR –> init_struc_data.pkl
Warning
The following is wrong. The init_POSCARS is also treated as a single structure.
Filter (Remove and Sort)
Here we consider a cif file with the composition of Sr8 Co8 O20 X4,
including 4 dummy atoms (X4).
-f/--filter option can be used to remove and sort species.
Specify the same as atype in cryspy.in.
With extract_struc.py you can see how it was registered in init_struc_data.pkl.
-f option can allow you to sort.
kpt_check.py
kpt_check.py can check a k-point mesh with a given kppvol.
This script supports POSCAR, CONTCAR, and init_struc_data.pkl.
pymatgen library is required.
After generating initial structures, you can try to see how much the value of kppvol should be.
Usage
or if you put the script in your PATH, you can omit python3
Example
POSCAR with a Given kppvol
Write KPOINTS File
You can generate a KPOINTS file using -w option.
Check K-Point Meshes for init_struc_data.pkl
In checking k-point meshes for init_struc_data.pkl, first five structures are automatically checked in the default setting.
You can change the number of structures using -n option.
FAQ
Table of Contents
Subsections of FAQ
Can I Change njob in the Middle of the Simulation?
2024 May 7
Can I Change njob in the Middle of the Simulation?
Yes, you can change whenever you want.
Below is an example of how the behavior changes when you reduce njob.
Warning
In CriSPY version 1.2.3 and earlier, there is a bug, so it is recommended to avoid reducing njobs.
Currently, with njob = 4, jobs for structures with IDs 0, 1, 2, and 3 are running.
Let’s say we chage njob from 4 to 2.
We reduced njob to 2, so we checked IDs 0, 1 and ignored IDs 2, 3.
Once the jobs for IDs 1 and 2 are finished, we will then proceed to check the next two jobs (IDs 2 and 3).




























