#!/bin/bash

#dipoles of the first intermediate state
cp dipoles_AA_complex_sph_harmonic fort.142
cp dipoles_AB_complex_sph_harmonic fort.143

#dipoles of the second intermediate state
cp dipoles_AA_complex_sph_harmonic fort.242
cp dipoles_AB_complex_sph_harmonic fort.243

cat > inp << EOF
&TWOPHOTONINP
lab_frame_p1 = 1                !lab frame polarization of the first photon
lab_frame_p2 = 0                !lab frame polarization of the second photon (applies if lab_frame_E_p2(1:3) = 0.0_idp)
lab_frame_E_p2 = 1.0d0,0.0d0,0.0d0 !direction of the E-field vector of the 2nd photon: if this vector is non-zero it overrides the value lab_frame_p2. If it is zero then lab_frame_p2 applies.
ionization_potential = 0.1d0
no_intermediate_states = 1
index_initial_state = 1,1       !indices of the intermediate bound states from the input dipole files.
index_final_state = 1           !index of the final cationic state
                                !excitation amplitudes for the first intermediate state:
amplitudes( 1,1) = 0.0d0 !-1
amplitudes( 2,1) = 1.0d0 !0
amplitudes( 3,1) = 0.0d0 !1

amplitudes( 1,2) = 0.0d0 !-1
amplitudes( 2,2) = 0.5d0 !0
amplitudes( 3,2) = 0.0d0 !1
&END

                                 !dipoles for the first intermediate state:
&dipelminp
  lu_pw_dipoles= 142,143,143,
  nset_pw_dipoles= 1,1,1,
  point_group='C2',
  format_pw_dipoles = 'FORMATTED'
&end
                                 !dipoles for the second intermediate state,etc.:
&dipelminp
  lu_pw_dipoles= 242,243,243,
  nset_pw_dipoles= 1,1,1,
  point_group='C2',
  format_pw_dipoles = 'FORMATTED'
&end
EOF

./two_photon < inp > test_two_photon
