9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-30 15:15:38 +01:00

done some cleaning in the casscf and added a detailed example of Multi state CASSCF
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
eginer 2024-02-15 19:32:15 +01:00
parent c58bf2aa8f
commit 22c99a0484
3 changed files with 85 additions and 6 deletions

View File

@ -4,13 +4,15 @@ casscf
|CASSCF| program with the CIPSI algorithm. |CASSCF| program with the CIPSI algorithm.
Example of inputs
----------------- Example of inputs for GROUND STATE calculations
-----------------------------------------------
NOTICE :: FOR EXCITED STATES CALCULATIONS SEE THE FILE "example_casscf_multistate.sh"
a) Small active space : standard CASSCF a) Small active space : standard CASSCF
--------------------------------------- ---------------------------------------
Let's do O2 (triplet) in aug-cc-pvdz with the following geometry (xyz format, Bohr units) Let's do O2 (triplet) in aug-cc-pvdz with the following geometry (xyz format, Bohr units)
3 2
O 0.0000000000 0.0000000000 -1.1408000000 O 0.0000000000 0.0000000000 -1.1408000000
O 0.0000000000 0.0000000000 1.1408000000 O 0.0000000000 0.0000000000 1.1408000000
@ -45,3 +47,4 @@ qp set casscf_cipsi small_active_space False
qp run casscf | tee ${EZFIO_FILE}.casscf_large.out qp run casscf | tee ${EZFIO_FILE}.casscf_large.out
# you should find around -149.9046 # you should find around -149.9046

View File

@ -54,14 +54,24 @@ subroutine run
call write_time(6) call write_time(6)
call write_int(6,iteration,'CAS-SCF iteration = ') call write_int(6,iteration,'CAS-SCF iteration = ')
call write_double(6,energy,'CAS-SCF energy = ') call write_double(6,energy,'State-average CAS-SCF energy = ')
! if(n_states == 1)then ! if(n_states == 1)then
! call ezfio_get_casscf_cipsi_energy_pt2(E_PT2) ! call ezfio_get_casscf_cipsi_energy_pt2(E_PT2)
! call ezfio_get_casscf_cipsi_energy(PT2) ! call ezfio_get_casscf_cipsi_energy(PT2)
double precision :: delta_E_istate, e_av
e_av = 0.d0
do istate=1,N_states do istate=1,N_states
call write_double(6,E_PT2(istate),'E + PT2 energy = ') e_av += state_average_weight(istate) * Ev(istate)
call write_double(6,PT2(istate),' PT2 = ') if(istate.gt.1)then
delta_E_istate = E_PT2(istate) - E_PT2(1)
write(*,'(A6,I2,A18,F16.10)')'state ',istate,' Delta E+PT2 = ',delta_E_istate
endif
write(*,'(A6,I2,A18,F16.10)')'state ',istate,' E + PT2 energy = ',E_PT2(istate)
write(*,'(A6,I2,A18,F16.10)')'state ',istate,' PT2 energy = ',PT2(istate)
! call write_double(6,E_PT2(istate),'E + PT2 energy = ')
! call write_double(6,PT2(istate),' PT2 = ')
enddo enddo
call write_double(6,e_av,'State-average CAS-SCF energy bis = ')
call write_double(6,pt2_max,' PT2_MAX = ') call write_double(6,pt2_max,' PT2_MAX = ')
! endif ! endif

View File

@ -0,0 +1,66 @@
# This is an example for MULTI STATE CALCULATION STATE AVERAGE CASSCF
# We will compute 3 states on the O2 molecule
# The Ground state and 2 degenerate excited states
# Please follow carefully the tuto :)
##### PREPARING THE EZFIO
# Set the path to your QP2 directory
QP_ROOT=my_fancy_path
source ${QP_ROOT}/quantum_package.rc
# Create the EZFIO folder
qp create_ezfio -b aug-cc-pvdz O2.xyz -m 3 -a -o O2_avdz_multi_state
# Start with ROHF orbitals
qp run scf
# Freeze the 1s orbitals of the two oxygen
qp set_frozen_core
##### PREPARING THE ORBITALS WITH NATURAL ORBITALS OF A CIS
# Tell that you want 3 states in your WF
qp set determinants n_states 3
# Run a CIS wave function to start your calculation
qp run cis | tee ${EZFIO_FILE}.cis_3_states.out
# Save the STATE AVERAGE natural orbitals for having a balanced description
# This will also order the orbitals according to their occupation number
# Which makes the active space selection easyer !
qp run save_natorb | tee ${EZFIO_FILE}.natorb_3states.out
##### PREPARING A CIS GUESS WITHIN THE ACTIVE SPACE
# Set an active space which has the most of important excitations
# and that maintains symmetry : the ACTIVE ORBITALS are from """6 to 13"""
# YOU FIRST FREEZE THE VIRTUALS THAT ARE NOT IN THE ACTIVE SPACE
# !!!!! WE SET TO "-D" for DELETED !!!!
qp set_mo_class -c "[1-5]" -a "[6-13]" -d "[14-46]"
# You create a guess of CIS type WITHIN THE ACTIVE SPACE
qp run cis | tee ${EZFIO_FILE}.cis_3_states_active_space.out
# You tell to read the WFT stored (i.e. the guess we just created)
qp set determinants read_wf True
##### DOING THE CASSCF
### SETTING PROPERLY THE ACTIVE SPACE FOR CASSCF
# You set the active space WITH THE VIRTUAL ORBITALS !!!
# !!!!! NOW WE SET TO "-v" for VIRTUALS !!!!!
qp set_mo_class -c "[1-5]" -a "[6-13]" -v "[14-46]"
# You tell that it is a small actice space so the CIPSI can take all Slater determinants
qp set casscf_cipsi small_active_space True
# You specify the output file
output=${EZFIO_FILE}.casscf_3states.out
# You run the CASSCF calculation
qp run casscf | tee ${output}
# Some grep in order to get some numbers useful to check convergence
# State average energy
grep "State-average CAS-SCF energy =" $output | cut -d "=" -f 2 > data_e_average
# Delta E anticipated for State-average energy, only usefull to check convergence
grep "Predicted energy improvement =" $output | cut -d "=" -f 2 > data_improve
# Ground state energy
grep "state 1 E + PT2 energy" $output | cut -d "=" -f 2 > data_1
# First excited state energy
grep "state 2 E + PT2 energy" $output | cut -d "=" -f 2 > data_2
# First excitation energy
grep "state 2 Delta E+PT2" $output | cut -d "=" -f 2 > data_delta_E2
# Second excited state energy
grep "state 3 E + PT2 energy" $output | cut -d "=" -f 2 > data_3
# Second excitation energy
grep "state 3 Delta E+PT2" $output | cut -d "=" -f 2 > data_delta_E3