-
Notifications
You must be signed in to change notification settings - Fork 1
Tutorial 14
USPEX is a software tool that can predict the crystal structure of materials that havenโt been discovered yet. It uses evolutionary algorithms and interfaces with VASP to explore stable and metastable configurations.
While USPEX is our primary tool at the moment, there are several other structure-prediction frameworks available, each offering different optimization strategies or machine-learning enhancements. Some examples include:
-
XtalOpt (Zurek Lab) - Evolutionary Algorithm
-
Global optimization of atomic structure enhanced by machine learning (Phys. Rev. B) - Evolutionary Algorithm and Bayesian Optimization
-
CrySPY (Python-based CSP framework) - Evolutionary Algorithm and Bayesian Optimization
USPEX depends on other tools to function, especially VASP. Make sure youโve completed Tutorial 8 first.
USPEX and other tools need to be available in your environment every time you log in. This is handled by your ~/.bashrc file. If you donโt have it, create both:
~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATHAdd this to the end of your ~/.bashrc:
#### ------------- USPEX v.10.5.0 ------------- ####
export MCRROOT=/leeburton-data/
export PATH=/leeburton-data/application/archive/:$PATH
export USPEXPATH=/leeburton-data/application/archive/src
### ------------------------------------------ ###tmuxmkdir uspex
cd uspexUSPEX -c 01Inside the Submission/ folder, replace the existing job script template with:
myrun_content = '''#!/bin/sh -l
#
# filename: slurm_script
#SBATCH -p leeburton-pool
#SBATCH --account=power-leeburton-users_v2
#SBATCH -J {}
#SBATCH --time=04:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=24
#SBATCH --mem=120GB
{}
'''Find and replace:
% commandExecutable
mpirun vasp_std > log
% EndExecutablewith:
% commandExecutable
module load intel/rocky8-oneAPI-2023; module load vasp/rocky8-intel-6.4.1; mpirun vasp_std > output
% EndExecutable#!/bin/sh
while [ ! -f ./USPEX_IS_DONE ] ; do
date >> log
USPEX -r >> log
sleep 300
doneThis script automatically reactivates USPEX after each VASP job and exits cleanly when done.
โ Run it with:
./EX01-3D_Si_vasp.sh๐ Then detach safely with Ctrl+b, then d.
Use this pymatgen script to compare USPEX results with known structures:
from pymatgen.core import Structure
from pymatgen.analysis.structure_matcher import StructureMatcher
from pymatgen.io.vasp import Poscar
poscar = Poscar.from_file('/path/to/final.vasp')
structure2 = Structure.from_file('/path/to/reference.cif')
matcher = StructureMatcher(ltol=0.2, stol=0.3, angle_tol=5)
are_same = matcher.fit(poscar.structure, structure2)
print(are_same)
print("The structures are the same." if are_same else "The structures are different.")Copy the required POTCARs into Specific/ and rename them:
POTCAR_Si, POTCAR_O, etc.
Find them here:
/leeburton-data/shared/VASP/
Use PBE POTCARs for most cases.
Example for SiOโ:
% atomType
Si O
% EndAtomType
% numSpecies
8 16
% EndNumSpeciesSpecify 4 VASP runs:
% abinitioCode
1 1 1 1
% ENDabinitEnsure 4 matching INCAR files: INCAR_1 โ INCAR_4.
-
Specific/: Contains POTCARs and INCARs -
Seed/: Optional. Add known structures here to "seed" the simulation -
Submission/: Contains job submission settings
USPEX : calculationMethod (USPEX, VCNEB, META)
300 : calculationType (dim / molecule / varcomp)
1 : AutoFrac-
calculationType= 3D, no molecule, fixed composition -
AutoFrac= On โ adjusts evolution operators dynamically
20 : populationSize
30 : initialPopSize
25 : numGenerations
8 : stopCritThis results in ~510 structures ร 4 VASP runs = 2000+ jobs!
0.50 : fracGene
0.30 : fracRand
0.20 : fracAtomsMut
0.00 : fracLatMut
0.00 : fracPerm Leave as-is unless you're tuning behavior.
% KresolStart
0.13 0.11 0.09 0.07
% Kresolend4 values = 4 VASP runs. Must decrease in spacing.
Executable:
% commandExecutable
module load intel/rocky8-oneAPI-2023; module load vasp/rocky8-intel-6.4.1; mpirun vasp_std > output
% EndExecutableRun Location:
1 : whichCluster (1 = local)
10 : numParallelCalcsINCAR_1
PREC = LOW
EDIFF = 2e-3
IBRION = 2
ISIF = 4
NSW = 85
ISMEAR = 1 ; SIGMA = 0.10
POTIM = 0.020
ISTART = 0
EDIFFG = -2e-1
LCHARG = FALSE
LWAVE = FALSE
NPAR=4
INCAR_2
PREC = Normal
EDIFF = 1e-3
IBRION = 1
ISIF = 4
NSW = 85
ISMEAR = 1 ; SIGMA = 0.09
POTIM = 0.25
LCHARG = FALSE
LWAVE = FALSE
EDIFFG = 1e-2
NPAR=4
INCAR_3
PREC = Normal
ENCUT = 400.0
EDIFF = 1e-5
IBRION = 2
ISIF = 3
NSW = 100
ISMEAR = 1 ; SIGMA = 0.060
POTIM = 0.020
ISTART = 0
LCHARG = FALSE
LWAVE = FALSE
NPAR=4
INCAR_4
PREC = Normal
ENCUT = 450.0
EDIFF = 3e-6
IBRION = 2
ISIF = 3
NSW = 100
ISMEAR = 1 ; SIGMA = 0.060
POTIM = 0.020
ISTART = 0
LCHARG = FALSE
LWAVE = FALSE
NPAR=4
BMD has a script to generate consistent USPEX folders:
๐ /bmd/shared/python_func/create_directories_and_edit_input.py
python create_directories_and_edit_input.py <input_file> <uspex_template_dir> <multiplier>-
<input_file>= list of chemical formulas -
<uspex_template_dir>= USPEX template directory -
<multiplier>= multiply formula stoichiometry for larger supercells
๐งช Example:
Al2O3
SiO2
TiO2
๐ With multiplier 4, Al2O3 becomes 8 Al and 12 O.
๐ Congratulations! You are ready for Tutorial 15!