From 57b47807fa1b7265345d877ca4902e87f39935ba Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 21 Apr 2022 14:25:29 +0200 Subject: [PATCH] Added CIS_read --- src/cis_read/EZFIO.cfg | 7 +++ src/cis_read/NEED | 3 ++ src/cis_read/README.rst | 5 +++ src/cis_read/cis_read.irp.f | 88 +++++++++++++++++++++++++++++++++++++ src/cis_read/h_apply.irp.f | 14 ++++++ 5 files changed, 117 insertions(+) create mode 100644 src/cis_read/EZFIO.cfg create mode 100644 src/cis_read/NEED create mode 100644 src/cis_read/README.rst create mode 100644 src/cis_read/cis_read.irp.f create mode 100644 src/cis_read/h_apply.irp.f diff --git a/src/cis_read/EZFIO.cfg b/src/cis_read/EZFIO.cfg new file mode 100644 index 00000000..955d1bef --- /dev/null +++ b/src/cis_read/EZFIO.cfg @@ -0,0 +1,7 @@ +[energy] +type: double precision +doc: Variational |CIS| energy +interface: ezfio +size: (determinants.n_states) + + diff --git a/src/cis_read/NEED b/src/cis_read/NEED new file mode 100644 index 00000000..42992ac6 --- /dev/null +++ b/src/cis_read/NEED @@ -0,0 +1,3 @@ +selectors_full +generators_full +davidson_undressed diff --git a/src/cis_read/README.rst b/src/cis_read/README.rst new file mode 100644 index 00000000..31648636 --- /dev/null +++ b/src/cis_read/README.rst @@ -0,0 +1,5 @@ +=== +cis_read +=== + +Reads the input WF and performs all singles on top of it. diff --git a/src/cis_read/cis_read.irp.f b/src/cis_read/cis_read.irp.f new file mode 100644 index 00000000..055b5e15 --- /dev/null +++ b/src/cis_read/cis_read.irp.f @@ -0,0 +1,88 @@ +program cis + implicit none + BEGIN_DOC +! +! Configuration Interaction with Single excitations. +! +! This program takes a reference Slater determinant of ROHF-like +! occupancy, and performs all single excitations on top of it. +! Disregarding spatial symmetry, it computes the `n_states` lowest +! eigenstates of that CI matrix. (see :option:`determinants n_states`) +! +! This program can be useful in many cases: +! +! +! 1. Ground state calculation +! +! To be sure to have the lowest |SCF| solution, perform an :ref:`scf` +! (see the :ref:`module_hartree_fock` module), then a :ref:`cis`, save the +! natural orbitals (see :ref:`save_natorb`) and re-run an :ref:`scf` +! optimization from this |MO| guess. +! +! +! 2. Excited states calculations +! +! The lowest excited states are much likely to be dominated by +! single-excitations. Therefore, running a :ref:`cis` will save the +! `n_states` lowest states within the |CIS| space in the |EZFIO| +! directory, which can afterwards be used as guess wave functions for +! a further multi-state |FCI| calculation if :option:`determinants +! read_wf` is set to |true| before running the :ref:`fci` executable. +! +! +! If :option:`determinants s2_eig` is set to |true|, the |CIS| +! will only retain states having the expected |S^2| value (see +! :option:`determinants expected_s2`). Otherwise, the |CIS| will take +! the lowest :option:`determinants n_states`, whatever multiplicity +! they are. +! +! .. note:: +! +! To discard some orbitals, use the :ref:`qp_set_mo_class` +! command to specify: +! +! * *core* orbitals which will be always doubly occupied +! +! * *act* orbitals where an electron can be either excited from or to +! +! * *del* orbitals which will be never occupied +! + END_DOC + read_wf = .True. + TOUCH read_wf + call run +end + +subroutine run + implicit none + integer :: i + + + if(pseudo_sym)then + call H_apply_cis_sym + else + call H_apply_cis + endif + print*,'' + print *, 'N_det = ', N_det + print*,'******************************' + print *, 'Energies of the states:' + do i = 1,N_states + print *, i, CI_energy(i) + enddo + if (N_states > 1) then + print*,'' + print*,'******************************************************' + print*,'Excitation energies (au) (eV)' + do i = 2, N_states + print*, i ,CI_energy(i) - CI_energy(1), (CI_energy(i) - CI_energy(1))/0.0367502d0 + enddo + print*,'' + endif + + call ezfio_set_cis_energy(CI_energy) + psi_coef = ci_eigenvectors + SOFT_TOUCH psi_coef + call save_wavefunction_truncated(save_threshold) + +end diff --git a/src/cis_read/h_apply.irp.f b/src/cis_read/h_apply.irp.f new file mode 100644 index 00000000..14389bed --- /dev/null +++ b/src/cis_read/h_apply.irp.f @@ -0,0 +1,14 @@ +! Generates subroutine H_apply_cis +! -------------------------------- + +BEGIN_SHELL [ /usr/bin/env python3 ] +from generate_h_apply import H_apply +H = H_apply("cis",do_double_exc=False) +print(H) + +H = H_apply("cis_sym",do_double_exc=False) +H.filter_only_connected_to_hf() +print(H) + +END_SHELL +