From 081d7bbba413d11df6bd257d559dd9d1d8ceb4df Mon Sep 17 00:00:00 2001 From: Xiaojie Wu Date: Fri, 30 Aug 2024 12:19:40 -0700 Subject: [PATCH] Bugfix: save density when spin unrestricted (#205) * customize radii * fixed a bug when saving electron density with spin unrestricted --- gpu4pyscf/drivers/dft_driver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gpu4pyscf/drivers/dft_driver.py b/gpu4pyscf/drivers/dft_driver.py index a72b1ab1..c69663cd 100644 --- a/gpu4pyscf/drivers/dft_driver.py +++ b/gpu4pyscf/drivers/dft_driver.py @@ -190,7 +190,8 @@ def run_dft(mol_name, config, charge=None, spin=0): if save_density and xc.lower() != 'hf': weights = mf.grids.weights coords = mf.grids.coords - rho = mf._numint.get_rho(mf.mol, dm, mf.grids) + dm0 = dm[0] + dm[1] if dm.ndim == 3 else dm + rho = mf._numint.get_rho(mf.mol, dm0, mf.grids) if isinstance(weights, cupy.ndarray): weights = weights.get() if isinstance(coords, cupy.ndarray): coords = coords.get()