Skip to content

A dedicated Python script for making smeared C-K edge spectra from the hdf5 dataset of eigenvalues and dynamical structure factors

License

Notifications You must be signed in to change notification settings

nmdl-mizo/ck_edge_maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-K edge maker

DOI

A dedicated Python script for making smeared C-K edge spectra from the hdf5 dataset of eigenvalues and dynamical structure factors

Overview

  • Some functions for making Gaussiean smeared spectra database from the hdf5 dataset of eigenvalues and dynamical structure factors
  • Commandline interface ck_edge_maker
  • Dataset class for Pytorch Geometric ck_edge_maker.dataset.CK

Reference

The hdf5 dataset of eigenvalues and dynamical structure factors will be available along with a data paper

[1] Shibata, K., Kikumasa, K., Kiyohara, S., T. Mizoguchi, "Simulated carbon K edge spectral database of organic molecules" Sci Data 9, 214 (2022).

Install

Clone this repository and run pip install:

$ git clone https://github.com/nmdl-mizo/ck_edge_maker.git
$ cd ck_edge_maker
$ pip intall .

or directry run pip install:

$ pip install git+https://github.com/nmdl-mizo/ck_edge_maker

If you use the dataset class for PyTorch Geometric, include extras_require pyg:

$ pip install "ck_edge_maker[pyg] @ git+https://github.com/nmdl-mizo/ck_edge_maker"

To uninstall, use pip:

$ pip uninstall ck-edge-maker

Usage

Calculate C-K edge spectra with Gaussian smearing from hdf5 spectral dataset

  • positional arguments:

    • {site,mol} calculation task, site or mol
    • input path to the input database hdf5 file
    • output path to the output hdf5 file
  • optional arguments:

    • -h, --help show this help message and exit
    • --sigma SIGMA Gaussian smearing parameter in eV. default 0.3 eV
    • --margin MARGIN margin in eV for sampling energy range. ignored when both min and max is specified. default 3.0 eV
    • --res RES resolution in eV for sampling energy range, default 0.1 eV
    • --min MIN minimum energy in eV for sampling energy range
    • --max MAX maximum energy in eV for sampling energy range
    • --sum calculate sum of dynamic structure factors for molecular spectra if specified. calculate weighted average if not specified. only valid when task = mol
    • --nototal do not include total spectra if specified
    • -f, --forceoverwrite Overwrite output file if specified

Examples

Calculate and save C-K edge spectra with Gaussian smearing

First, prepare the hdf5 dataset of eigenvalues and dynamical structure factors. The following is an example where the dataset is stored in the current directory with the name "site_eigen_dsf.hdf5".

# Create a hdf5 of molecular spectral dataset named "mol_spectra_0.5eV.hdf5" with 0.5eV Gaussian smearing, 0.1eV sampling step, and 5eV margin
ck_edge_maker mol site_eigen_dsf.hdf5 mol_spectra_0.5eV.hdf5 -f --sigma 0.5 --res 0.1 --margin 5
# Create a hdf5 of site specific spectral dataset named "site_spectra_0.5eV.hdf5" with 0.5eV Gaussian smearing, 0.1eV sampling step, and 5eV margin
ck_edge_maker site site_eigen_dsf.hdf5 site_spectra_0.5eV.hdf5 -f --sigma 0.5 --res 0.1 --margin 5

Dataset class for Pytorch Goemetric

The dataset class for Pytorch Geometric is also available from ver.1.1.0.

  1. Install ck_edge_maker with pyg extras_require
    pip install ck_edge_maker[pyg]
  2. Prepare site specific spectral dataset and place it in "dataset/raw" directory.
  3. Import CK class
    from ck_edge_maker.dataset import CK
    dataset = CK(
      root="dataset",
      energies=(288, 310, 256),
      directional=True
    )

Requirements

  • python (=>3)
  • h5py
  • numpy
  • tqdm

extras_require [pyg]

  • scipy
  • torch
  • torch_geometric

Author

  • kiyou
  • Mizoguchi Lab.

Licence

The source code is licensed MIT.

About

A dedicated Python script for making smeared C-K edge spectra from the hdf5 dataset of eigenvalues and dynamical structure factors

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published