From 39a06a137dc1fc6c656acc36d08e72efcd3c004d Mon Sep 17 00:00:00 2001 From: Loris Burth Date: Tue, 25 Mar 2025 13:38:10 +0100 Subject: [PATCH] fixed geom and printcRG0W0 --- PyDuck.py | 11 +++++++---- cap_data/H2 | 2 ++ cap_data/N2 | 3 ++- cap_data/N2X | 2 +- mol/CO.xyz | 4 ++-- mol/COX.xyz | 6 +++--- mol/N2.xyz | 4 ++-- mol/N2X.xyz | 4 ++-- src/GW/print_cRG0W0.f90 | 2 +- src/utils/complex_DIIS_extrapolation.f90 | 7 +++++++ 10 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 cap_data/H2 diff --git a/PyDuck.py b/PyDuck.py index 6160cc7..8bb9276 100755 --- a/PyDuck.py +++ b/PyDuck.py @@ -207,11 +207,15 @@ if args.use_cap: f.close() num_atoms = int(lines[0].strip()) atoms = [line.strip() for line in lines[2:2+num_atoms]] + if unit == 'Bohr': + bohr_coordinates = 'true' + else: + bohr_coordinates = 'false' sys_dict = { "molecule": "inline", "geometry": "\n".join(atoms), # XYZ format as a string "basis_file": create_psi4_basis(basis_dict), - "bohr_coordinates": unit == 'Bohr' + "bohr_coordinates": bohr_coordinates } cap_system = pyopencap.System(sys_dict) if not(cap_system.check_overlap_mat(ovlp, "pyscf")): @@ -223,10 +227,9 @@ if args.use_cap: "cap_z": onset_z, "Radial_precision": "16", "angular_points": "590", - "thresh": 10} + "thresh": 15} pc = pyopencap.CAP(cap_system, cap_dict, norb) - # Get AO and convert from eV to Hartree - cap_ao = pc.get_ao_cap(ordering="pyscf")/27.211386245981 + cap_ao = pc.get_ao_cap(ordering="pyscf") def write_matrix_to_file(matrix, size, file, cutoff=1e-15): diff --git a/cap_data/H2 b/cap_data/H2 new file mode 100644 index 0000000..bedbe31 --- /dev/null +++ b/cap_data/H2 @@ -0,0 +1,2 @@ +onset_x onset_y onset_z eta_opt +2.76 2.76 4.88 0.0015 diff --git a/cap_data/N2 b/cap_data/N2 index 2caa419..bedbe31 100644 --- a/cap_data/N2 +++ b/cap_data/N2 @@ -1 +1,2 @@ -2.76 2.76 4.88 +onset_x onset_y onset_z eta_opt +2.76 2.76 4.88 0.0015 diff --git a/cap_data/N2X b/cap_data/N2X index 71cb9c5..bedbe31 100644 --- a/cap_data/N2X +++ b/cap_data/N2X @@ -1,2 +1,2 @@ onset_x onset_y onset_z eta_opt -2.76 2.76 4.88 0.0015 +2.76 2.76 4.88 0.0015 diff --git a/mol/CO.xyz b/mol/CO.xyz index 8c32150..9173a74 100644 --- a/mol/CO.xyz +++ b/mol/CO.xyz @@ -1,4 +1,4 @@ 2 -C 0.0000 0.0000 0.0000 -O 0.0000 0.0000 1.1335 +C 0.0000 0.0000 -0.5639970709977953 +O 0.0000 0.0000 0.5639970709977953 diff --git a/mol/COX.xyz b/mol/COX.xyz index 0571bda..2e95012 100644 --- a/mol/COX.xyz +++ b/mol/COX.xyz @@ -1,5 +1,5 @@ 3 -C 0.0000 0.0000 0.0000 -O 0.0000 0.0000 1.1335 -X 0.0000 0.0000 0.56675 +C 0.0000 0.0000 -0.5639970709977953 +O 0.0000 0.0000 0.5639970709977953 +X 0.0000 0.0000 0.0000 diff --git a/mol/N2.xyz b/mol/N2.xyz index fb38cec..cc1d5fb 100644 --- a/mol/N2.xyz +++ b/mol/N2.xyz @@ -1,4 +1,4 @@ 2 -N 0.0000 0.0000 -0.5475132 -N 0.0000 0.0000 0.5475132 +N 0.0000 0.0000 -0.5487567673341279 +N 0.0000 0.0000 0.5487567673341279 diff --git a/mol/N2X.xyz b/mol/N2X.xyz index 5a6ac60..85e95e4 100644 --- a/mol/N2X.xyz +++ b/mol/N2X.xyz @@ -1,5 +1,5 @@ 3 -N 0.0000 0.0000 -0.5475132 -N 0.0000 0.0000 0.5475132 +N 0.0000 0.0000 -0.5487567673341279 +N 0.0000 0.0000 0.5487567673341279 X 0.0000 0.0000 0.000000 diff --git a/src/GW/print_cRG0W0.f90 b/src/GW/print_cRG0W0.f90 index 7c92b39..1f5d420 100644 --- a/src/GW/print_cRG0W0.f90 +++ b/src/GW/print_cRG0W0.f90 @@ -27,7 +27,7 @@ subroutine print_cRG0W0(nBas,nO,eHF,ENuc,ERHF,Re_SigC,Im_SigC,Re_Z,Im_Z,Re_eGW,I index_homo = maxloc(Re_eGW(1:nO),1) Re_eHOMO = Re_eGW(index_homo) Im_eHOMO = Im_eGW(index_homo) - index_lumo = minloc(Re_eGW(nO+1:nBas),1) + index_lumo = minloc(Re_eGW(nO+1:nBas),1) + nO Re_eLUMO = Re_eGW(index_lumo) Im_eLUMO = Im_eGW(index_lumo) Re_Gap = Re_eLUMO-Re_eHOMO diff --git a/src/utils/complex_DIIS_extrapolation.f90 b/src/utils/complex_DIIS_extrapolation.f90 index cb2fb0b..37ccc9b 100644 --- a/src/utils/complex_DIIS_extrapolation.f90 +++ b/src/utils/complex_DIIS_extrapolation.f90 @@ -47,6 +47,13 @@ subroutine complex_DIIS_extrapolation(rcond,n_err,n_e,n_diis,error,e,error_in,e_ ! Solve linear system call complex_linear_solve(n_diis+1,A,b,w,rcond) +! Check condition number + if (rcond < 1.0d-10) then + write(*,*) "!!! DIIS system ill-conditioned: rcond = ", rcond, " - Skipping DIIS update !!!" + else + ! Perform extrapolation only if the system is well-conditioned + e_inout(:) = matmul(w(1:n_diis),transpose(e(:,1:n_diis))) + end if ! Extrapolate