QC2 – Advanced Quantum Chemistry Methods
QC2 – Advanced Quantum Chemistry Methods#
This is the guide to the practical course for QC2.
!> This is your module to write your very own SCF program.
module scf_main
!> Include standard Fortran environment for IO
use iso_fortran_env, only : output_unit, error_unit
! ------------------------------------------------------------------------
!> library functions provided by your lab assistents:
!> interface to LAPACK's double precision symmetric eigenvalue solver (dspev)
! examples:
! call solve_spev(mat, eigval, eigvec)
use linear_algebra, only : solve_spev
!> expansion of slater-functions into contracted gaussians,
! coefficients and primitive exponents are taken from R.F. Stewart, JCP, 1970
! example:
! call expand_slater(zeta, alpha, coeff)
use slater, only : expand_slater
!> calculates one-electron integrals and two-electron integrals over
! spherical gaussians (s-functions). One-electron quanities supported
! are overlap, kinetic energy and nuclear attraction integrals.
! Two-electron integrals are provided in chemist notation.
! examples:
! call oneint(xyz, chrg, r_a, r_b, alp, bet, ca, ca, s, t, v)
! call twoint(r_a, r_b, r_c, r_d, alp, bet, gam, del, ca, cb, cc, cd, g)
use integrals, only : oneint, twoint
!> prints a matrix quantity to screen
! examples:
! call write_vector(vec, name='vector')
! call write_matrix(mat, name='matrix')
! call write_matrix(mat, name='packed matrix')
use print_matrix, only : write_vector, write_matrix
!> other tools that may help you jump ahead with I/O-heavy tasks
! example:
! call read_line(input, line)
use io_tools, only : read_line
!> Always declare everything explicitly
implicit none
!> All subroutines within this module are not exported, except for scf_prog
! which is the entry point to your program
private
public :: scf_prog
!> Selecting double precision real number
integer, parameter :: wp = selected_real_kind(15)
contains
!> This is the entry point to your program, do not modify the dummy arguments
! without adjusting the call in lib/prog.f90
subroutine scf_prog(input)
!> Always declare everything explicitly
implicit none
!> IO unit bound to the input file
integer, intent(in) :: input
!> System specific data
!> Number of atoms
integer :: nat
!> Number of electrons
integer :: nel
!> Atom coordinates of the system, all distances in bohr
real(wp), allocatable :: xyz(:,:)
!> Nuclear charges
real(wp), allocatable :: chrg(:)
!> Number of basis functions
integer :: nbf
!> Slater exponents of basis functions
real(wp),allocatable :: zeta(:)
!> Hartree-Fock energy
real(wp) :: escf
! declarations may not be complete, so you have to add your own soon.
! Create a program that reads the input and prints out final results.
! And, please, indent your code.
! Write the self-consistent field procedure in a subroutine.
write(output_unit, '(a)') 'Here could start a Hartree-Fock calculation'
end subroutine scf_prog
end module scf_main
- Working on Linux
- Introduction to Fortran
- General Principles
- Compiling and Running a Program
- The Fortran package manager
- Introducing Variables
- Performing Simple Computing Tasks
- Accuracy of Numbers
- Logical Constructs
- Repeating Tasks
- Fields and Arrays of Data
- Functions and Subroutines
- Character Constants and Variables
- Interacting with Files
- Application
- Derived Types
- Introduction to Quantum Chemistry