Skip to content

angus-gentles/iso-Eg-optimisation

Repository files navigation

iso-Eg-optimisation

Bayesian optimisation workflow for fitting Hubbard-U parameters to ternary alloy band-gap targets (and tracking auxiliary metrics such as effective mass and short-band agreement).

What This Repository Does

The main driver, process_ternary.py, does the following:

  1. Selects one ternary system (InGaAs, InGaSb, InAsSb, or GaAsSb).
  2. Uses data_int.hdf5 as a discrete U-parameter grid for the two binaries in that ternary.
  3. Proposes a new grid point with Bayesian optimisation.
  4. Builds orbital-resolved U values and writes them into QE input files under intermediate/<ternary>/....
  5. Reads resulting QE XML outputs to compute:
    • band-gap mismatch loss (loss1),
    • binary short-band deviation (loss0, via delta_*),
    • optional effective-mass metrics (meff_*).
  6. Appends results to data_<ternary>.hdf5.

Key Files

  • process_ternary.py: Main orchestration script.
  • run_test.sh: Slurm launcher example.
  • data_int.hdf5: Precomputed U-grid data used for Bayesian search bounds and lookup.
  • binary.hse.data.hdf5: Binary HSE reference eigenvalues used in find_delta.
  • cube_donati_<ternary>.csv: Experimental/reference Eg points for each ternary.
  • intermediate/<ternary>/<composition>/...: QE inputs/outputs for each composition point.
  • local/: Helper modules called by process_ternary.py.

Main Local Modules Used

process_ternary.py directly imports and uses:

  • local/U_standard_main.py
    • Convert between nested U dictionaries and flattened forms.
  • local/make_U.py
    • Interpolate/assemble U values and inject them into .in files.
  • local/bandgaps_alloy_bands.py
    • Parse QE XML files and extract Eg values.
  • local/do_loss.py
    • Compute sorted pointwise Eg differences and weighted L2 loss.
  • local/bayes_class.py
    • Wrapper around bayes_opt for parameter suggestion/registration.
  • local/meff.py
    • Parse XML eigenvalues and estimate effective mass.

Requirements

Typical Python dependencies:

  • numpy
  • h5py
  • bayesian-optimization (imported as bayes_opt)

Runtime/external dependencies:

  • Quantum ESPRESSO (pw.x) available in PATH.
  • MPI launcher (mpirun).
  • Cluster environment scripts used in this project:
    • ~/tools/setup_data_qe7.3.1.sh
    • setup_conda.sh

Quick Start

1. Activate environment

Example (adapt to your cluster setup):

source ~/tools/setup_data_qe7.3.1.sh
source setup_conda.sh
conda activate alloy_bayes

2. Run locally

./process_ternary.py InGaAs

3. Run via Slurm

sbatch run_test.sh

Command-Line Usage

python process_ternary.py [TERNARY]
  • TERNARY options: InGaAs, InGaSb, InAsSb, GaAsSb
  • Default if omitted: InGaAs

Current Execution Mode Note

At the moment, ternary_proc() calls iteration_test(...), which does not launch QE runs (local/run_all.sh is commented there). It assumes output files already exist under intermediate/<ternary>/... and only evaluates/parses them.

If you want full run-and-evaluate behavior, switch to iteration(...) in ternary_proc().

Inputs and Outputs

Inputs (required)

  • cube_donati_<ternary>.csv
  • data_int.hdf5
  • binary.hse.data.hdf5
  • Prepared intermediate/<ternary>/... folder structure and QE files

Generated/updated outputs

  • data_<ternary>.hdf5
    • Group lambda/<binary>/index
    • Group lambda/<binary>/delta
    • Group Eg/<material> with attrs (Eg_exp, x, y)
    • Group ell/ell1 (loss1) and ell/ell0 (loss0)
  • intermediate/<ternary>/data_Eg.csv
  • intermediate/<ternary>/intermediate.csv

Troubleshooting

  • Missing XML parsing data:
    • Ensure QE XML exists in tmp/ or fallback .save/data-file-schema.xml paths.
  • MPI/Slurm launch failures:
    • Verify partition/QoS/time settings in run_test.sh.
    • Confirm SLURM_NPROCS is set and consistent with allocation.
  • Empty or unexpected HDF5 output:
    • Check that composition directories and input templates exist under intermediate/<ternary>/.
    • Confirm placeholder replacement by local/make_U.py is occurring.
  • pseudopotential directory is incorrect for the user's system
    • change the directory in the QE input files and re-tar them

Repository Notes

  • .gitignore excludes many generated files (*.csv, *.txt, intermediate directories, cache directories, etc.).
  • Several helper and analysis scripts are present (loss/, U_valley/, conversion utilities), but the core optimisation entry point is process_ternary.py.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors