From a58b5a8fcedc54a7a5db43195fbfa8233a42a0aa Mon Sep 17 00:00:00 2001 From: Qiming Sun Date: Tue, 29 Oct 2024 18:46:36 -0700 Subject: [PATCH 1/4] Add CHANGELOG --- .github/workflows/publish.yml | 4 ++-- CHANGELOG | 22 ++++++++++++++++++++++ NOTICE | 4 ++++ setup.py | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6b8a1a4..d1133c4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ jobs: release-pypi-x86-64: runs-on: ubuntu-latest env: - img: quay.io/pypa/manylinux2014_x86_64:2024-05-06-7d57077 + img: quay.io/pypa/manylinux2014_x86_64:latest steps: - uses: actions/checkout@v4 - name: Build wheels @@ -44,7 +44,7 @@ jobs: release-pypi-aarch64: runs-on: ubuntu-latest env: - img: quay.io/pypa/manylinux2014_aarch64:2023-03-12-25fd859 + img: quay.io/pypa/manylinux2014_aarch64:latest steps: - name: Checkout uses: actions/checkout@v4 diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..4a62455 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,22 @@ +PySCF-Forge 1.0.1 (2024-10-31) +------------------------------ +* New features + - PySCF-TrexIO interface + + +PySCF-Forge 1.0.0 (2024-05-31) +------------------------------ +* PyPI wheels with initial features + - CMS-PDFT (Multiconfiguration Pair-Density Functional Theory) energy and analytical nuclear gradients + - LPDFT energy and analytical nuclear gradients + - MC-PDFT energy and analytical nuclear gradients + - MS-PDFT energy and analytical nuclear gradients + - XMS-PDFT method + - Non-adiabatic couplings between states using MS-PDFT method + - MCDCFT (Multiconfiguration Density-Coherence Functional Theory) method + - MCDCFT dipole moment + - MC-PDFT dipole moment and transition dipole moment + - MC-PDFT energy decomposition analysis + - LRDF (Long-Range Density Fitting) for energy and analytical nuclear gradients and Hessian + - Spin-flip TDA using multi-collinear functionals + - M3SOSCF (Markovian Multiagent Monte-Carlo second order SCF) method diff --git a/NOTICE b/NOTICE index 2cf4bae..ad1ddfa 100644 --- a/NOTICE +++ b/NOTICE @@ -6,3 +6,7 @@ Dayou Zhang (University of Minnesota) Aleksandr Lykhin (University of Chicago) Thais R Scott (University of Chicago) Matthew R Hennefarth (University of Chicago) +Linus Dittmer +Hao Li +Bhavnesh Jangid +Shirong Wang diff --git a/setup.py b/setup.py index db3d797..a4c9c1f 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ SO_EXTENSIONS = { } DEPENDENCIES = ['pyscf', 'numpy'] -VERSION = '1.0.0' +VERSION = '1.0.1' ####################################################################### # Unless not working, nothing below needs to be changed. From 09b056bc4594f3615a4831a9af52dcbae195cdbe Mon Sep 17 00:00:00 2001 From: Matthew R Hermes Date: Wed, 30 Oct 2024 10:42:00 -0500 Subject: [PATCH 2/4] Update CHANGELOG Corrections to MC-PDFT availabilities and method names (they should all have hyphens). MS-PDFT is not a method by itself; rather, it is an abstraction of the steps that lie in common between CMS-PDFT and XMS-PDFT (and several other methods not currently implemented). Dipoles are currently only available for MC-PDFT and CMS-PDFT, and transition dipoles only for the latter. --- CHANGELOG | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4a62455..2835c98 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,15 +7,14 @@ PySCF-Forge 1.0.1 (2024-10-31) PySCF-Forge 1.0.0 (2024-05-31) ------------------------------ * PyPI wheels with initial features - - CMS-PDFT (Multiconfiguration Pair-Density Functional Theory) energy and analytical nuclear gradients - - LPDFT energy and analytical nuclear gradients + - CMS-PDFT (Compressed Multiconfiguration Pair-Density Functional Theory) energy and analytical nuclear gradients + - L-PDFT (Linearized PDFT) energy and analytical nuclear gradients - MC-PDFT energy and analytical nuclear gradients - - MS-PDFT energy and analytical nuclear gradients - - XMS-PDFT method - - Non-adiabatic couplings between states using MS-PDFT method - - MCDCFT (Multiconfiguration Density-Coherence Functional Theory) method - - MCDCFT dipole moment - - MC-PDFT dipole moment and transition dipole moment + - XMS-PDFT energy + - Non-adiabatic couplings between states using CMS-PDFT method + - MC-DCFT (Multiconfiguration Density-Coherence Functional Theory) method + - MC-PDFT and CMS-PDFT dipole moment + - CMS-PDFT transition dipole moment - MC-PDFT energy decomposition analysis - LRDF (Long-Range Density Fitting) for energy and analytical nuclear gradients and Hessian - Spin-flip TDA using multi-collinear functionals From 845af0713c85d97251ffaba2654410a08bec5c7d Mon Sep 17 00:00:00 2001 From: Qiming Sun Date: Wed, 30 Oct 2024 08:46:00 -0700 Subject: [PATCH 3/4] Update README, including an instruction about how to add new features --- README.md | 114 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 103 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 98e69f9..93c8cb1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,17 @@ pyscf-forge can be installed using the command pip install pyscf-forge ``` This command adds features in pyscf-forge to the PySCF package. They can be used -as if they were natively developed within PySCF. +as if they were natively developed within PySCF. For example, +``` +from pyscf import gto, mcpdft +mol = gto.M( + atom = 'O 0 0 0; O 0 0 1.2', + basis = 'ccpvdz', + spin = 2) +mf = mol.RHF().run () +# Calling the MC-PDFT method provided by the pyscf-forge modules +mc = mcpdft.CASCI(mf, 'tPBE', 6, 8).run() +``` To access the newest features of pyscf-forge, you can install them from git repository by running the command @@ -15,24 +25,106 @@ repository by running the command pip install git+https://github.com/pyscf/pyscf-forge ``` -If you are developing new features and would like to modify the code in -pyscf-forge, editable installation is better suited. After cloning the library -to your local repository, there are two possible ways to enable the editable -installation: +## Configuring the Development Environment +If you are developing new features or modifying the code in `pyscf-forge`, an editable installation is recommended. +By configuring the package in editable mode, you can modify existing modules and add new features to `pyscf-forge`. +After cloning the library to your local repository, there are two ways to enable the editable installation: -1. You can install the package using the pip command +### Method 1. Using pip for editable installation +Install the package with the following pip command: ``` pip install --no-deps -e /path/to/pyscf-forge ``` -This method will add a `.pth` file in `~/.local/lib/python3.*/site-packages/` +This command creates a `.pth` file in `~/.local/lib/python3.*/site-packages/` or other Python runtime paths. It is recommended to use this method with Python virtual environment. -2. Setting an environment variable +### Method 2. Setting an environment variable +Define the `PYSCF_EXT_PATH` environment variable to point to your local `pyscf-forge` directory: ``` export PYSCF_EXT_PATH=/path/to/pyscf-forge ``` -The PySCF package can read the `PYSCF_EXT_PATH` environment and load the modules -within this package at runtime. For more details of `PYSCF_EXT_PATH` environment -and the extensions management, please see the PySCF installation manual +The PySCF package can read the `PYSCF_EXT_PATH` environment and load modules +from this path at runtime. For more details of `PYSCF_EXT_PATH` environment +and the extensions management, refer to the PySCF installation manual https://pyscf.org/install.html#extension-modules + +## Adding New Features: An Example +Suppose you need to create a module in `pyscf-forge` that provides a plane-wave basis for crystalline computation with periodic boundary conditions (PBC). +You can follow these steps to add the module: + +1. Install `pyscf-forge` in editable installation mode. + +2. Create a folder named `pyscf-forge/pyscf/pw`. +Thanks to the editable installation mode, this folder can be readily imported as a regular `pyscf` module. +``` +>>> from pyscf import pw +>>> print(pw) + + +>>> print(pw.__path__) +_NamespacePath(['/home/ubuntu/pyscf-forge/pyscf/pw']) +``` + +3. Add Python code files to the `pyscf-forge/pyscf/pw` directory. +This process is similar to developing new methods in the main `pyscf` repository. +For example, you can add the following Python files into the `pyscf-forge/pyscf/pw` folder: +``` +pyscf-forge +├── ... +└── pyscf + ├── ... + └── pw + ├── __init__.py + ├── dft + │   ├── __init__.py + │   ├── krks.py + │   └── kuks.py + └── scf + ├── __init__.py + ├── krhf.py + └── kuhf.py +``` + +4. There may exist scenarios that the directory you plan to create already exists within `pyscf`. +For example, if you want to add a new method, like `pp_rpa.py`, to the `pyscf/tdscf` folder, +this could conflict with the existing `pyscf.tdscf` module in the pyscf core repository. +Adding features to existing modules requires more complex configuration. + +To import the `pp_rpa` module from the `pyscf-forge` repository, you will need to make certain modifications in the `__init__.py` file of the `pyscf` core module +(in this demonstration, this file is located at `/home/ubuntu/.local/lib/python3.10/site-packages/pyscf/tdscf/__init__.py`). +Add the following line of code to modify the `__path__` attribute of the `pyscf.tdscf` module: +``` +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +``` + +This command extends the search path of the `tdscf` module, resulting in the `__path__` attribute being set to: +``` +['/home/ubuntu/.local/lib/python3.10/site-packages/pyscf/tdscf', + '/home/ubuntu/pyscf-forge/pyscf/tdscf'] +``` +This configuration allows Python to locate and load the new `pp_rpa.py` module from the extended directory in `pyscf-forge`. + +Note that the `pyscf` core `tdscf` folder already contains an `__init__.py` file. +To avoid overwriting the existing `__init__.py` file in `pyscf` during the installation of `pyscf-forge`, +you should not add an `__init__.py` file in the `pyscf-forge/pyscf/tdscf` directory. + +The structure of the core packages and the components of `pyscf-forge` can be organized as follows: +``` +pyscf +├── ... +└── pyscf + ├── ... + └── tdscf + ├── __init__.py // modify the __path__ attribute in pyscf core module + ├── rhf.py + ├── rks.py + └── ... + +pyscf-forge +├── ... +└── pyscf + ├── ... + └── tdscf // no __init__.py file in pyscf-forge + └── pp_rpa.py +``` From 4c36c86e14b25e8c6fd9859998eb713820ec5f5e Mon Sep 17 00:00:00 2001 From: Qiming Sun Date: Wed, 30 Oct 2024 08:57:04 -0700 Subject: [PATCH 4/4] update README.md --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 93c8cb1..e3d6b2c 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ pyscf-forge └── kuhf.py ``` -4. There may exist scenarios that the directory you plan to create already exists within `pyscf`. +### Path Conflicts +There may exist scenarios that the directory you plan to create already exists within `pyscf`. For example, if you want to add a new method, like `pp_rpa.py`, to the `pyscf/tdscf` folder, this could conflict with the existing `pyscf.tdscf` module in the pyscf core repository. Adding features to existing modules requires more complex configuration. @@ -128,3 +129,9 @@ pyscf-forge └── tdscf // no __init__.py file in pyscf-forge └── pp_rpa.py ``` + +When installing the `pyscf-forge` wheels using `pip install` in the normal +installation mode, the `pp_rpa.py` file will be added to the `pyscf/tdscf` +folder, integrating seamlessly as part of the regular `pyscf` module. +After this standard installation, there is no need to adjust the `__path__` +attribute, as all features and modules are located within the same directory.