A repository used to perform experiments for the work on CasNet.
This project uses a conda environment and uv for fast package management.
-
Install Miniconda: If you don't have it, download and install Miniconda from the official website.
-
Clone the repository:
git clone https://github.com/marquetand/casnet.git cd casnet git submodule init git submodule update -
Create conda environment: Create and activate the
casnetenvironment. This command also installsuv,cmake, andopenblasfrom theconda-forgechannel.conda create -n casnet python=3.13 -c conda-forge uv cmake openblas conda activate casnet
-
Install dependencies: Use
uvto install the required packages.uv pip install -r requirements.txt
-
Install custom PySCF fork: This project requires a specific fork of PySCF which is included as a submodule.
cd pyscf uv pip install -e . cd ..
-
Set Environment Variables:
source env.sh # (after setting variables in env.sh file)
(Watch out: We're our own fork a of PySCF that returns macro, micro & inner iterations of the CASSCF object)
Create an account at wandb.ai. To enable logging on Ubuntu, run wandb login in your terminal and paste your API key when prompted. This automatically saves your credentials to ~/.netrc.
The training script defaults to the project name casnet. You can specify a different project using the --wandb_project argument:
python train_model.py ... --wandb_project <project_name>
First, generate the start and end geometries:
python data/geometries/create_fulvene_endpoints.py
Then, generate the interpolated scan:
python data/geometries/generate_geom_scan.py --start_geom geometries/fulvene_equilibrium.xyz --end_geom geometries/fulvene_distorted.xyz --output_folder geometries/geom_scan_200/ --n_steps 200
python data/casscf/pyscf/run_casscf_calculations.py --geometry_folder geometries/geom_scan_200/ --output_folder pyscf/geom_scan_200_sto_6g/ --basis sto_6g
python data/check_casscf_calculations.py --output_folder pyscf/geom_scan_200_sto_6g/
python data/db/save_casscf_calculations_to_db.py --geometry_folder geometries/geom_scan_200/ --output_folder pyscf/geom_scan_200_sto_6g/
check data/splits/ to see example of split generating scripts, e.g.
python data/splits/generate_geom_scan_split.py --name geom_scan_200 --n_samples 200
There are also other scripts in the folder.
python data/db/convert_to_phisnet_db.py --ase_db data_storage/geom_scan_200_sto_6g.db --phisnet_db data_storage/geom_scan_200_sto_6g_phisnet.db
python train_model.py --db_name geom_scan_200_sto_6g.db --split_name geom_scan_200.npz --property mo_coeffs_adjusted --model_name gs200_sto_6g_MO
python train_model.py --db_name geom_scan_200_sto_6g.db --split_name geom_scan_200.npz --property F --model_name gs200_sto_6g_F
Add a configuration in phisnet_fork/configurations/ folder (e.g. named 'test_conf.txt') and then type:
python phisnet_fork/train.py @phisnet_fork/configurations/test_conf.txt
python evaluation/compute_model_loss.py --db_name geom_scan_200_sto_6g.db --split_name geom_scan_200.npz --mo_model gs200_sto_6g_MO --F_model gs200_sto_6g_F --phisnet_model gs200_sto_6g_phisnet
python evaluation/pyscf/compute_SCF_iterations.py --geometry_folder geometries/geom_scan_200/ --split_name geom_scan_200.npz --mode ML-MO --model gs200_sto_6g_MO --basis sto_6g
python evaluation/compute_CASCI_energy_errors.py --geometry_folder geometries/geom_scan_200/ --split_name geom_scan_200.npz --mode ML-MO --model gs200_sto_6g_MO --basis sto_6g
python evaluation/pyscf/compute_SCF_iterations.py --geometry_folder geometries/geom_scan_200/ --split_name geom_scan_200.npz --mode ML-F --model gs200_sto_6g_F --basis sto_6g
python evaluation/compute_CASCI_energy_errors.py --geometry_folder geometries/geom_scan_200/ --split_name geom_scan_200.npz --mode ML-F --model gs200_sto_6g_F --basis sto_6g
python evaluation/pyscf/compute_SCF_iterations.py --geometry_folder geometries/geom_scan_200/ --split_name geom_scan_200.npz --mode PhiSNet --model gs200_sto_6g_phisnet --basis sto_6g
python evaluation/compute_CASCI_energy_errors.py --geometry_folder geometries/geom_scan_200/ --split_name geom_scan_200.npz --mode PhiSNet --model gs200_sto_6g_phisnet --basis sto_6g
python evaluation/compute_CASCI_energy_errors.py --geometry_folder geometries/geom_scan_200/ --split_name geom_scan_200.npz --mode ML-MO --model gs200_sto_6g_F --basis sto_6g
python evaluation/paper_figures/plot_orbitals.py
(check this file for setting geometry & orbital model & MO indices)