kohn_sham_dataset
Computing Kohn-Sham data for a dataset.
It can be run as a script using the mldft_ks command. This file implements the functions for single or multiprocessing a whole dataset or a subset of it. The configuration can be found in configs/datagen/config.yaml. Possible options are:
- n_molecules: Number of molecules to compute, -1 for all molecules. 
- start_idx: Index of the first molecule to compute (not using the actual index but indices from 0 to num_molecules). 
- num_processes: Number of processes to use for multiprocessing. 
- num_threads_per_process: Number of threads to use per process. 
- verify_files: Whether to verify the files after computation. 
- kohn_sham: - basis: Basis set to use for the molecule. 
- xc: Exchange correlation functional. 
- initialization: The initial guess method. 
 
Example usage in a terminal:
mldft_ks n_molecules=10
mldft_ks dataset=qm9 verify_files=true
mldft_ks dataset=qmugs_first_bin kohn_sham.basis=sto-3g kohn_sham.xc=lda
- check_config(cfg: DictConfig, path: Path) None[source]
- Check if the configuration is the same as the one in the file if it exists. 
- compute_kohn_sham_dataset(cfg: DictConfig) None[source]
- Run the Kohn-Sham computations on a subset of the dataset. - Parameters:
- cfg – Hydra configuration object. 
- Raises:
- AssertionError – If more molecules are requested than available or if n_molecules is smaller than -1. 
 
- main(cfg: DictConfig) None[source]
- Hydra entry point for the Kohn-Sham computation on the whole dataset. Sets up the hydra specific logging and then calls the compute_kohn_sham_dataset function. - Parameters:
- cfg – Hydra configuration object. 
 
- run_ksdft_and_handle_exceptions(molecule: Mole, xc: str, init_guess: str, grid_level: int, prune_method: Callable | None | str, density_fit_basis: str | None, density_fit_threshold: int | None, convergence_tolerance: float | None, output_file: Path, use_perturbation: bool = False, perturbation_cfg: DictConfig | None = None)[source]
- Run the Kohn-Sham iteration and handle exceptions as parallel process. - Parameters:
- molecule – PySCF molecule object. 
- xc – Exchange correlation functional. 
- init_guess – The initial guess method. 
- grid_level – The grid level to use for the integration grid used in the xc-functional. 
- prune_method – The method to prune the grid. 
- density_fit_basis – The basis set to use for the density fitting. 
- density_fit_threshold – The threshold of number of atoms to enable density fitting. 
- convergence_tolerance – The convergence tolerance for the Kohn-Sham iteration. 
- output_file – Path to the output file. 
- use_perturbation – Whether to use perturbation in the effective potential. 
- perturbation_cfg – Settings for the perturbation.