10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-09 07:33:49 +01:00
QuantumPackage/src/tools/rotate_mos.irp.f

28 lines
730 B
Fortran
Raw Normal View History

2019-05-09 23:58:36 +02:00
program rotate_mos
2019-06-15 00:28:29 +02:00
implicit none
BEGIN_DOC
! Rotates molecular orbitals i and j by combining them as
! $1/\sqrt{2} ( \phi_i + \phi_j )$ and
! $1/\sqrt{2} ( \phi_i - \phi_j )$.
END_DOC
integer :: iorb,jorb
integer :: i,j
double precision :: dsqrt2_inv
double precision, allocatable :: mo_coef_tmp(:,:)
2019-05-09 23:58:36 +02:00
2019-06-15 00:28:29 +02:00
read(5,*)iorb,jorb
allocate(mo_coef_tmp(ao_num,mo_num))
mo_coef_tmp = mo_coef
dsqrt2_inv = 1.d0/dsqrt(2.d0)
do i = 1, ao_num
mo_coef(i,iorb) = dsqrt2_inv * ( mo_coef_tmp(i,iorb) + mo_coef_tmp(i,jorb) )
mo_coef(i,jorb) = dsqrt2_inv * ( mo_coef_tmp(i,iorb) - mo_coef_tmp(i,jorb) )
enddo
touch mo_coef
call save_mos
2019-05-09 23:58:36 +02:00
end