From 209d95eec6e1fe1765924fe0d65dbbc5e024367a Mon Sep 17 00:00:00 2001 From: David Bowler Date: Wed, 18 May 2022 16:05:36 +0100 Subject: [PATCH 01/45] Initial implementation of surface dipole Added calculation of surface dipole to density_module.f90, along with call from get_H_on_atomfns and small change to grid_index to allow grid point positions to be a target. This does not yet include energy or force/stress calculations. --- src/H_matrix_module.f90 | 4 +- src/density_module.f90 | 265 ++++++++++++++++++++++++++++++++++++++ src/grid_index.module.f90 | 6 +- 3 files changed, 272 insertions(+), 3 deletions(-) diff --git a/src/H_matrix_module.f90 b/src/H_matrix_module.f90 index 81f387b86..1a8a857e5 100644 --- a/src/H_matrix_module.f90 +++ b/src/H_matrix_module.f90 @@ -571,7 +571,8 @@ subroutine get_h_on_atomfns(output_level, fixed_potential, & use block_module, only: n_blocks, n_pts_in_block use primary_module, only: domain use set_blipgrid_module, only: naba_atoms_of_blocks - use density_module, only: density_pcc, density_atom + use density_module, only: density_pcc, density_atom, & + flag_surface_dipole_correction, get_surface_dipole use GenComms, only: gsum, inode, ionode, cq_abort use energy, only: hartree_energy_total_rho, & xc_energy, & @@ -751,6 +752,7 @@ subroutine get_h_on_atomfns(output_level, fixed_potential, & end if ! (flag_pcc_global) call gsum(delta_E_xc) delta_E_xc = delta_E_xc * grid_point_volume + if(flag_surface_dipole_correction) call get_surface_dipole(h_potential, rho_tot, size) ! ! ! Make total potential diff --git a/src/density_module.f90 b/src/density_module.f90 index 8beb9b563..1d6ac2737 100644 --- a/src/density_module.f90 +++ b/src/density_module.f90 @@ -71,6 +71,10 @@ !! Removed flag_no_atomic_densities !! 2020/01/03 09:32 dave !! Moved flag_DumpChargeDensity from H_matrix_module +!! 2022/05/18 13:31 dave +!! Adding in routines for dipole correction in slabs with surface charges +!! from L. Bengtsson PRB 59, 12301 (1999) and J. Neugebauer and M. Scheffler, +!! PRB 46, 16067 (1992) !! SOURCE module density_module @@ -126,6 +130,15 @@ module density_module ! Dump charge density or not (this should also be used for dumping hilbert_make_blk.dat etc.) logical :: flag_DumpChargeDensity + + ! Surface dipole correction + logical :: flag_surface_dipole_correction, flag_dipole_internal + integer :: surface_normal ! x=1, y=2, z=3 to select arrays + real(double) :: surface_dipole_density, sdde ! \int a rho_av(a) da + real(double) :: surface_dipole_energy_elec ! Eq 13 in Bengtsson + real(double) :: surface_dipole_energy_ion ! Eq 13 in Bengtsson + real(double) :: dipole_correction_location ! Where is the correction ? z_m in Bengtsson + !!*** contains @@ -866,6 +879,258 @@ subroutine get_electronic_density(denout, electrons, atom_fns, & end subroutine get_electronic_density !!*** + ! ----------------------------------------------------------- + ! Subroutine get_surface_dipole + ! ----------------------------------------------------------- + + !!****f* density_module/get_surface_dipole * + !! + !! NAME + !! get_surface_dipole + !! USAGE + !! + !! PURPOSE + !! Calculate surface dipole correction following PRB 46 16067 (1992) + !! and PRB 59 12,301 (1999) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2018/05/24 + !! MODIFICATION HISTORY + !! 2022/05/18 13:52 dave + !! Added to density_module + !! SOURCE + !! + subroutine get_surface_dipole(h_potential, rho_tot, size) + + use datatypes + use numbers + use global_module, only: ni_in_cell, x_atom_cell, y_atom_cell, z_atom_cell + use dimens, only: grid_point_volume, n_grid_x, n_grid_y, n_grid_z, & + r_super_x, r_super_y, r_super_z, x_grid, y_grid, z_grid + use block_module, only: n_pts_in_block, in_block_x,in_block_y,in_block_z + use primary_module, only: domain + use GenComms, only: gsum, inode, ionode + use pseudopotential_common, only: pseudopotential + use grid_index, only: grid_point_x, grid_point_y, grid_point_z + use species_module, only: species, charge + use io_module, only: io_assign, io_close + + implicit none + + ! Passed variables + integer :: size + real(double), dimension(size) :: h_potential, rho_tot + + ! Local variables + integer :: m, n, nb, point, ptx, pty, ptz, min_dens_loc, zero_start, zero_end + integer :: n_grid_norm, n_grid_plane, atom, gridpos, lun + integer, dimension(:), pointer :: grid_point_norm + real(double) :: r_super_norm, r_super_area, grid_spacing_norm + real(double) :: min_dens, beta, shift, locpot + real(double), dimension(:), pointer :: atom_cell_norm + real(double), dimension(:), allocatable :: density_average ! Average density in x/y/z + real(double), dimension(:), allocatable :: planar_average + + ! Set up appropriate parameters in direction of surface normal + select case(surface_normal) + case(1) ! X + n_grid_norm = n_grid_x + n_grid_plane = n_grid_y * n_grid_z + r_super_norm = r_super_x + r_super_area = r_super_y * r_super_z + grid_spacing_norm = x_grid*r_super_x + grid_point_norm => grid_point_x + atom_cell_norm => x_atom_cell + case(2) ! Y + n_grid_norm = n_grid_y + n_grid_plane = n_grid_x * n_grid_z + r_super_norm = r_super_y + r_super_area = r_super_x * r_super_z + grid_spacing_norm = y_grid*r_super_y + grid_point_norm => grid_point_y + atom_cell_norm => y_atom_cell + case(3) ! Z + n_grid_norm = n_grid_z + n_grid_plane = n_grid_y * n_grid_x + r_super_norm = r_super_z + r_super_area = r_super_y * r_super_x + grid_spacing_norm = z_grid*r_super_z + grid_point_norm => grid_point_z + atom_cell_norm => z_atom_cell + end select + ! Calculate average density along surface normal + allocate(density_average(n_grid_norm)) + density_average = zero + ! Sum over grid + m = 0 + do nb = 1, domain%groups_on_node + point = 0 + do ptz = 1, in_block_z + do pty = 1, in_block_y + do ptx = 1, in_block_x + point = point+1 + density_average(grid_point_norm(m+point)) = & + density_average(grid_point_norm(m+point)) + rho_tot(m+point) + end do + end do + end do + m = m + n_pts_in_block + end do ! nb + call gsum(density_average,n_grid_norm) + density_average = density_average/real(n_grid_plane,double) + ! Find the mid-vacuum point + min_dens = 1e30_double + do point=1,n_grid_norm + if(abs(density_average(point))1e-5_double.AND. & + abs(density_average(point-1))<1e-5_double) then ! We've reached the end of the empty portion + zero_end = point - 1 + exit + end if + end do + if(zero_end==0) then + if(abs(density_average(1))>1e-5_double.AND. & + abs(density_average(n_grid_norm))<1e-5_double) then ! We've reached the end of the empty portion + zero_end = n_grid_norm + end if + end if + do point= n_grid_norm-1, 1, -1 + if(abs(density_average(point))>1e-5_double.AND. & + abs(density_average(point+1))<1e-5_double) then ! We're starting the empty portion + zero_start = point + exit + end if + end do + if(zero_start==n_grid_norm+1) then + if(abs(density_average(n_grid_norm))>1e-5_double.AND. & + abs(density_average(1))<1e-5_double) then ! We're starting the empty portion + zero_start = 1 + end if + end if + if(zero_end>0.AND.zero_startn_grid_norm) min_dens_loc = min_dens_loc - n_grid_norm + write(io_lun,fmt='(4x,"Empty portion bounded by ",2i6)') zero_start, zero_end + write(io_lun,fmt='(4x,"Placing potential discontinuity mid-vacuum at grid point ",i6)') min_dens_loc + if(abs(density_average(min_dens_loc))>1e-5_double) write(io_lun,*) 'Possible error: large density: ', & + min_dens_loc, density_average(min_dens_loc) + else + write(io_lun,fmt='(4x,"Placing potential discontinuity at grid point ",i6)') min_dens_loc + end if + ! Select this for Bengtsson + !min_dens_loc = 1 + ! Store location of dipole correction + dipole_correction_location = real(min_dens_loc-1,double)*grid_spacing_norm + ! Calculate surface dipole density + surface_dipole_density = zero + sdde = zero + do point=min_dens_loc,n_grid_norm + surface_dipole_density = surface_dipole_density + & + density_average(point)*real(point-1,double) ! Apply grid point spacing outside + end do + do point=1,min_dens_loc-1 + surface_dipole_density = surface_dipole_density + & + density_average(point)*real(point-1 + n_grid_norm,double) + end do + ! Apply grid-point spacing twice: once for integral, once to convert point to x + surface_dipole_density = surface_dipole_density * grid_spacing_norm * grid_spacing_norm + ! Add ionic contribution - for now do for all atoms but could do just on partition and sum + do atom = 1, ni_in_cell + surface_dipole_density = surface_dipole_density - & + atom_cell_norm(atom)*charge(species(atom))/r_super_area + end do + sdde = surface_dipole_density + ! Add ionic contribution - for now do for all atoms but could do just on partition and sum + do atom = 1, ni_in_cell + if(atom_cell_norm(atom)>dipole_correction_location) then + surface_dipole_density = surface_dipole_density - & + atom_cell_norm(atom)*charge(species(atom))/r_super_area + else + surface_dipole_density = surface_dipole_density - & + (atom_cell_norm(atom)+r_super_norm)*charge(species(atom))/r_super_area + end if + end do + ! Energy correction + surface_dipole_energy_elec = zero + surface_dipole_energy_ion = zero + allocate(planar_average(n_grid_norm)) + planar_average = zero + ! Apply the correction + m = 0 + do nb = 1, domain%groups_on_node + point = 0 + do ptz = 1, in_block_z + do pty = 1, in_block_y + do ptx = 1, in_block_x + point = point+1 + gridpos = grid_point_norm(m+point) + beta = real(gridpos-1,double)/real(n_grid_norm,double) + shift = one + if((min_dens_loc - gridpos)>0) shift = zero + ! Neugebauer & Scheffler + locpot = fourpi*surface_dipole_density*(beta - shift) + ! Bengtsson + ! locpot = fourpi*surface_dipole_density*(beta - half) + h_potential(m+point) = h_potential(m+point) + locpot + surface_dipole_energy_elec = & + surface_dipole_energy_elec + & + density_average(gridpos)*locpot + planar_average(gridpos) = planar_average(gridpos) + & + pseudopotential(m+point) + h_potential(m+point) + end do + end do + end do + m = m + n_pts_in_block + end do + surface_dipole_energy_elec = surface_dipole_energy_elec*grid_point_volume + call gsum(surface_dipole_energy_elec) + ! Atomic contribution + do atom = 1, ni_in_cell + shift = one + beta = atom_cell_norm(atom)/r_super_norm + if((dipole_correction_location - atom_cell_norm(atom))>0) shift = zero + surface_dipole_energy_ion = surface_dipole_energy_ion - & + charge(species(atom))* fourpi*surface_dipole_density*(beta - shift) + end do + if(inode==ionode) then + call io_assign(lun) + open(lun,file="AveragedPotential.dat") + end if + call gsum(planar_average,n_grid_norm) + planar_average = planar_average/real(n_grid_plane,double) + if(inode==ionode) then + do n=1,n_grid_norm + write(lun,*) n,planar_average(n), density_average(n) + end do + end if + if(inode==ionode) then + call io_close(lun) + end if + deallocate(planar_average) + deallocate(density_average) + return + end subroutine get_surface_dipole + !!*** + ! ----------------------------------------------------------- ! Subroutine get_band_density ! ----------------------------------------------------------- diff --git a/src/grid_index.module.f90 b/src/grid_index.module.f90 index 39ab93cba..aebef1193 100644 --- a/src/grid_index.module.f90 +++ b/src/grid_index.module.f90 @@ -27,6 +27,8 @@ !! Pared down to eight arrays; these will go when ffts are rewritten !! 2006/11/02 10:25 dave !! Added setgrid as subroutine +!! 2022/05/18 14:04 dave +!! Made grid_point_x/y/z targets for pointers in surface dipole correction !! SOURCE !! module grid_index @@ -34,8 +36,8 @@ module grid_index implicit none save - integer, allocatable, dimension(:) :: grid_point_x, grid_point_y, grid_point_z, grid_point_block, & - grid_point_position + integer, allocatable, dimension(:), target :: grid_point_x, grid_point_y, grid_point_z + integer, allocatable, dimension(:) :: grid_point_block, grid_point_position integer, allocatable, dimension(:) :: ind_block_x, ind_block_y, ind_block_z !(mx_nbonn) From 60f9cb874d91773cacc469fff22e62f2b1070917 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Thu, 19 May 2022 12:08:50 +0100 Subject: [PATCH 02/45] Add input parameters and correct small error Input parameters now read, and small error corrected: the formula given by Bengtsson does not include an explicit shift to place the discontinuity in the vacuum, though it is implied (and should be there!). --- src/density_module.f90 | 27 ++++++++++----------------- src/initial_read_module.f90 | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/density_module.f90 b/src/density_module.f90 index 1d6ac2737..f0abe443f 100644 --- a/src/density_module.f90 +++ b/src/density_module.f90 @@ -132,7 +132,7 @@ module density_module logical :: flag_DumpChargeDensity ! Surface dipole correction - logical :: flag_surface_dipole_correction, flag_dipole_internal + logical :: flag_surface_dipole_correction, flag_output_average_potential integer :: surface_normal ! x=1, y=2, z=3 to select arrays real(double) :: surface_dipole_density, sdde ! \int a rho_av(a) da real(double) :: surface_dipole_energy_elec ! Eq 13 in Bengtsson @@ -998,7 +998,6 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) ! identify the on-set of the slab; this should really be controlled by the user zero_start = n_grid_norm+1 zero_end = 0 - write(*,*) 'Start: ',min_dens_loc do point=2,n_grid_norm ! If there is a vacuum gap on the low-z side of the slab, find it if(abs(density_average(point))>1e-5_double.AND. & abs(density_average(point-1))<1e-5_double) then ! We've reached the end of the empty portion @@ -1029,15 +1028,15 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) if(zero_endn_grid_norm) min_dens_loc = min_dens_loc - n_grid_norm - write(io_lun,fmt='(4x,"Empty portion bounded by ",2i6)') zero_start, zero_end - write(io_lun,fmt='(4x,"Placing potential discontinuity mid-vacuum at grid point ",i6)') min_dens_loc + if(iprint_SC>2) then + write(io_lun,fmt='(4x,"Empty portion bounded by ",2i6)') zero_start, zero_end + write(io_lun,fmt='(4x,"Placing potential discontinuity mid-vacuum at grid point ",i6)') min_dens_loc + end if if(abs(density_average(min_dens_loc))>1e-5_double) write(io_lun,*) 'Possible error: large density: ', & min_dens_loc, density_average(min_dens_loc) else - write(io_lun,fmt='(4x,"Placing potential discontinuity at grid point ",i6)') min_dens_loc + if(iprint_SC>2) write(io_lun,fmt='(4x,"Placing potential discontinuity at grid point ",i6)') min_dens_loc end if - ! Select this for Bengtsson - !min_dens_loc = 1 ! Store location of dipole correction dipole_correction_location = real(min_dens_loc-1,double)*grid_spacing_norm ! Calculate surface dipole density @@ -1086,10 +1085,8 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) beta = real(gridpos-1,double)/real(n_grid_norm,double) shift = one if((min_dens_loc - gridpos)>0) shift = zero - ! Neugebauer & Scheffler + ! Neugebauer & Scheffler Eq. 14 and Bengtsson Eq. 7 adapted locpot = fourpi*surface_dipole_density*(beta - shift) - ! Bengtsson - ! locpot = fourpi*surface_dipole_density*(beta - half) h_potential(m+point) = h_potential(m+point) + locpot surface_dipole_energy_elec = & surface_dipole_energy_elec + & @@ -1111,18 +1108,14 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) surface_dipole_energy_ion = surface_dipole_energy_ion - & charge(species(atom))* fourpi*surface_dipole_density*(beta - shift) end do - if(inode==ionode) then - call io_assign(lun) - open(lun,file="AveragedPotential.dat") - end if call gsum(planar_average,n_grid_norm) planar_average = planar_average/real(n_grid_plane,double) - if(inode==ionode) then + if(flag_output_average_potential.and.(inode==ionode)) then + call io_assign(lun) + open(lun,file="AveragedPotential.dat") do n=1,n_grid_norm write(lun,*) n,planar_average(n), density_average(n) end do - end if - if(inode==ionode) then call io_close(lun) end if deallocate(planar_average) diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index 1ca31a48a..88057a2a5 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -746,6 +746,8 @@ end subroutine read_and_write !! Keywords for equilibration !! 2020/01/07 tsuyoshi !! Default setting of MakeInitialChargeFromK has been changed + !! 2022/05/19 11:54 dave + !! Add input parameters for surface dipole correction !! TODO !! SOURCE !! @@ -837,6 +839,7 @@ subroutine read_input(start, start_L, titles, vary_mu,& atomch_output, flag_Kerker, flag_wdmetric, minitersSC, & flag_newresidual, flag_newresid_abs, n_dumpSCF use density_module, only: flag_InitialAtomicSpin, flag_DumpChargeDensity + use density_module, only: flag_surface_dipole_correction, surface_normal, flag_output_average_potential use S_matrix_module, only: InvSTolerance, InvSMaxSteps,& InvSDeltaOmegaTolerance use blip, only: blip_info, init_blip_flag, alpha, beta @@ -1546,6 +1549,19 @@ subroutine read_input(start, start_L, titles, vary_mu,& ! number of electrons. If the error of electron number (per total electron number) ! is larger than the following value, we use atomic charge density. (in update_H) threshold_resetCD = fdf_double('SC.Threshold.Reset',0.1_double) + flag_surface_dipole_correction = fdf_boolean('SC.SurfaceDipoleCorrection',.false.) + flag_output_average_potential = fdf_boolean('SC.OutputAveragePotential',.false.) + ! Leave this for average potential output without correction + tmp = fdf_string(1,'SC.SurfaceNormal','z') + if(leqi(tmp,'x')) then + surface_normal = 1 + else if(leqi(tmp,'y')) then + surface_normal = 2 + else if(leqi(tmp,'z')) then + surface_normal = 3 + else + call cq_abort('Unrecognised surface normal direction specified: '//tmp) + end if tmp = fdf_string(4,'AtomMove.CGLineMin','safe') if(leqi(tmp,'safe')) then cg_line_min = safe From 9a68f8d7d227c9e15e4ca666ffbd31db8c9ec269 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Thu, 19 May 2022 14:43:09 +0100 Subject: [PATCH 03/45] Added energy terms --- src/energy_module.f90 | 63 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/src/energy_module.f90 b/src/energy_module.f90 index 4107689e9..0655dcbbf 100644 --- a/src/energy_module.f90 +++ b/src/energy_module.f90 @@ -44,6 +44,8 @@ !! stores the value of hartree_energy_drho made from the input charge density when we have check_DFT T !! 2021/07/30 12:15 dave !! Remove check_DFT +!! 2022/05/19 14:25 dave +!! Add surface dipole correction !! SOURCE !! module energy @@ -140,6 +142,8 @@ module energy !! 2021/07/28 10:55 dave !! Change behaviour to print Harris etc always, and DFT only if !! printDFT = T + !! 2022/05/19 14:25 dave + !! Add surface dipole correction energy terms !! SOURCE !! subroutine get_energy(total_energy, printDFT, level) @@ -163,6 +167,8 @@ subroutine get_energy(total_energy, printDFT, level) flag_neutral_atom_projector use DFT_D2, only: disp_energy use density_module, only: electron_number + use density_module, only: electron_number, flag_surface_dipole_correction, & + surface_dipole_energy_elec, surface_dipole_energy_ion implicit none @@ -251,6 +257,18 @@ subroutine get_energy(total_energy, printDFT, level) ! Add contribution from exact-exchange (EXX) !if (flag_exx) total_energy = total_energy + exx_energy + ! For Harris-Foulkes, we need dipole correction energy of rho_i - rho_e + if(flag_surface_dipole_correction) then + ! This option is currently not read but would allow Neugebauer & Scheffler Eq. 9 rather than Bengtsson Eq. 13 + !if(flag_dipole_internal) then + total_energy = total_energy + & + half*(surface_dipole_energy_ion-surface_dipole_energy_elec) + !else + ! total_energy = total_energy + & + ! surface_dipole_energy_ion ! Electronic comes from Tr[KH] + !end if + end if + ! Write out data if (inode == ionode) then if(print_Harris) then @@ -290,6 +308,10 @@ subroutine get_energy(total_energy, printDFT, level) en_conv*cdft_energy, en_units(energy_units) if (flag_dft_d2) write (io_lun,17) en_conv*disp_energy, en_units(energy_units) + if (flag_surface_dipole_correction) & + write(io_lun,'(10x,"Surface Dipole Correction Energy : ",f25.15," ",a2)') en_conv * & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & + en_units(energy_units) end if if (abs(entropy) >= RD_ERR) then @@ -350,6 +372,19 @@ subroutine get_energy(total_energy, printDFT, level) end if if (flag_perform_cdft) total_energy2 = total_energy2 + cdft_energy if (flag_dft_d2) total_energy2 = total_energy2 + disp_energy + ! For DFT, we need dipole correction energy of rho_i + rho_e + if(flag_surface_dipole_correction) then + !if(flag_dipole_internal) then + total_energy2 = total_energy2 + & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec) + !else + ! total_energy2 = total_energy2 + & + ! surface_dipole_energy_ion+surface_dipole_energy_elec + !end if + end if + if (inode == ionode) then + write(io_lun,13) en_conv*total_energy2, en_units(energy_units) + end if if (inode == ionode) then write(io_lun,13) en_conv*total_energy2, en_units(energy_units) @@ -440,6 +475,8 @@ end subroutine get_energy !! Activated "electrons_tot2" calculation !! 2019/12/03 08:09 dave !! Removed broken code for electrons via Tr[KS] + !! 2022/05/19 14:32 dave + !! Add surface dipole correction energy !! SOURCE !! subroutine final_energy(level) @@ -462,7 +499,8 @@ subroutine final_energy(level) flag_vdWDFT, & flag_exx, exx_alpha, flag_neutral_atom use DFT_D2, only: disp_energy - use density_module, only: electron_number + use density_module, only: electron_number, flag_surface_dipole_correction, & + surface_dipole_energy_elec, surface_dipole_energy_ion use pseudopotential_common, only: core_correction, & flag_neutral_atom_projector @@ -550,6 +588,16 @@ subroutine final_energy(level) ! Add contribution from dispersion (DFT-D2) if (flag_dft_d2) total_energy1 = total_energy1 + disp_energy + ! For Harris-Foulkes, we need dipole correction energy of rho_i - rho_e + if(flag_surface_dipole_correction) then + !if(flag_dipole_internal) then + total_energy1 = total_energy1 + & + half*(surface_dipole_energy_ion-surface_dipole_energy_elec) + !else + ! total_energy1 = total_energy1 + & + ! surface_dipole_energy_ion + !end if + end if !Write out data !... ! @@ -610,6 +658,10 @@ subroutine final_energy(level) write (io_lun,17) en_conv*disp_energy,en_units(energy_units) if (flag_perform_cdft) & write (io_lun,18) en_conv*cdft_energy,en_units(energy_units) + if (flag_surface_dipole_correction) & + write(io_lun,'(10x," | Surface Dipole Energy = ",f25.15," ",a2)') en_conv * & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & + en_units(energy_units) write (io_lun, 2) end if end if @@ -683,6 +735,15 @@ subroutine final_energy(level) end if if (flag_perform_cdft) total_energy2 = total_energy2 + cdft_energy if (flag_dft_d2) total_energy2 = total_energy2 + disp_energy + if(flag_surface_dipole_correction) then + !if(flag_dipole_internal) then + total_energy2 = total_energy2 + & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec) + !else + ! total_energy2 = total_energy2 + & + ! surface_dipole_energy_ion+surface_dipole_energy_elec + !end if + end if ! One-electron energy one_electron_energy = local_ps_energy + & From 3ace86cd88e8e37c7d34cbc1c0ad7a5995d93c36 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 6 Jun 2022 11:17:30 +0100 Subject: [PATCH 04/45] Finalising surface dipole correction --- src/density_module.f90 | 82 +++++++++++-------------------------- src/energy_module.f90 | 41 ++++++++++--------- src/force_module.f90 | 44 +++++++++++++++++--- src/initial_read_module.f90 | 18 ++++++-- 4 files changed, 98 insertions(+), 87 deletions(-) diff --git a/src/density_module.f90 b/src/density_module.f90 index f0abe443f..a94c6cf85 100644 --- a/src/density_module.f90 +++ b/src/density_module.f90 @@ -133,7 +133,8 @@ module density_module ! Surface dipole correction logical :: flag_surface_dipole_correction, flag_output_average_potential - integer :: surface_normal ! x=1, y=2, z=3 to select arrays + integer :: surface_normal ! x=1, y=2, z=3 to select arrays + integer :: discontinuity_location ! User parameter real(double) :: surface_dipole_density, sdde ! \int a rho_av(a) da real(double) :: surface_dipole_energy_elec ! Eq 13 in Bengtsson real(double) :: surface_dipole_energy_ion ! Eq 13 in Bengtsson @@ -965,6 +966,7 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) atom_cell_norm => z_atom_cell end select ! Calculate average density along surface normal + ! Note that we find the density by summing over all processes (below) allocate(density_average(n_grid_norm)) density_average = zero ! Sum over grid @@ -984,58 +986,24 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) end do ! nb call gsum(density_average,n_grid_norm) density_average = density_average/real(n_grid_plane,double) - ! Find the mid-vacuum point - min_dens = 1e30_double - do point=1,n_grid_norm - if(abs(density_average(point))1e-5_double.AND. & - abs(density_average(point-1))<1e-5_double) then ! We've reached the end of the empty portion - zero_end = point - 1 - exit - end if - end do - if(zero_end==0) then - if(abs(density_average(1))>1e-5_double.AND. & - abs(density_average(n_grid_norm))<1e-5_double) then ! We've reached the end of the empty portion - zero_end = n_grid_norm - end if - end if - do point= n_grid_norm-1, 1, -1 - if(abs(density_average(point))>1e-5_double.AND. & - abs(density_average(point+1))<1e-5_double) then ! We're starting the empty portion - zero_start = point - exit - end if - end do - if(zero_start==n_grid_norm+1) then - if(abs(density_average(n_grid_norm))>1e-5_double.AND. & - abs(density_average(1))<1e-5_double) then ! We're starting the empty portion - zero_start = 1 - end if - end if - if(zero_end>0.AND.zero_startn_grid_norm) min_dens_loc = min_dens_loc - n_grid_norm - if(iprint_SC>2) then - write(io_lun,fmt='(4x,"Empty portion bounded by ",2i6)') zero_start, zero_end - write(io_lun,fmt='(4x,"Placing potential discontinuity mid-vacuum at grid point ",i6)') min_dens_loc - end if - if(abs(density_average(min_dens_loc))>1e-5_double) write(io_lun,*) 'Possible error: large density: ', & - min_dens_loc, density_average(min_dens_loc) + ! Find the mid-vacuum point: this should be set by the user, otherwise + ! default to the point of lowest average density + if(discontinuity_location==0) then + min_dens = 1e30_double + do point=1,n_grid_norm + if(abs(density_average(point))2) & + write(io_lun,fmt='(4x,"Placing discontinuity at grid point ",i5,& + &" where density is ",f12.5)') min_dens_loc, min_dens else - if(iprint_SC>2) write(io_lun,fmt='(4x,"Placing potential discontinuity at grid point ",i6)') min_dens_loc + min_dens_loc = discontinuity_location + min_dens = abs(density_average(min_dens_loc)) + if(min_dens>1e-5 .and. inode==ionode) & + write(io_lun,fmt='(8x,"Warning! Possibly large density at discontinuity point: ",f12.5)') min_dens end if ! Store location of dipole correction dipole_correction_location = real(min_dens_loc-1,double)*grid_spacing_norm @@ -1052,11 +1020,6 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) end do ! Apply grid-point spacing twice: once for integral, once to convert point to x surface_dipole_density = surface_dipole_density * grid_spacing_norm * grid_spacing_norm - ! Add ionic contribution - for now do for all atoms but could do just on partition and sum - do atom = 1, ni_in_cell - surface_dipole_density = surface_dipole_density - & - atom_cell_norm(atom)*charge(species(atom))/r_super_area - end do sdde = surface_dipole_density ! Add ionic contribution - for now do for all atoms but could do just on partition and sum do atom = 1, ni_in_cell @@ -1090,7 +1053,7 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) h_potential(m+point) = h_potential(m+point) + locpot surface_dipole_energy_elec = & surface_dipole_energy_elec + & - density_average(gridpos)*locpot + rho_tot(m+point)*locpot planar_average(gridpos) = planar_average(gridpos) + & pseudopotential(m+point) + h_potential(m+point) end do @@ -1108,6 +1071,9 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) surface_dipole_energy_ion = surface_dipole_energy_ion - & charge(species(atom))* fourpi*surface_dipole_density*(beta - shift) end do + if(inode==ionode.AND.iprint_SC>3) & + write(io_lun,fmt='(8x,"Dipole energy for electrons and ions: ",2f12.5)') & + surface_dipole_energy_elec, surface_dipole_energy_ion call gsum(planar_average,n_grid_norm) planar_average = planar_average/real(n_grid_plane,double) if(flag_output_average_potential.and.(inode==ionode)) then diff --git a/src/energy_module.f90 b/src/energy_module.f90 index 0655dcbbf..5af86e659 100644 --- a/src/energy_module.f90 +++ b/src/energy_module.f90 @@ -261,11 +261,11 @@ subroutine get_energy(total_energy, printDFT, level) if(flag_surface_dipole_correction) then ! This option is currently not read but would allow Neugebauer & Scheffler Eq. 9 rather than Bengtsson Eq. 13 !if(flag_dipole_internal) then - total_energy = total_energy + & - half*(surface_dipole_energy_ion-surface_dipole_energy_elec) - !else ! total_energy = total_energy + & - ! surface_dipole_energy_ion ! Electronic comes from Tr[KH] + ! half*(surface_dipole_energy_ion-surface_dipole_energy_elec) + !else + total_energy = total_energy + & + surface_dipole_energy_ion ! Electronic comes from Tr[KH] !end if end if @@ -310,8 +310,9 @@ subroutine get_energy(total_energy, printDFT, level) if (flag_dft_d2) write (io_lun,17) en_conv*disp_energy, en_units(energy_units) if (flag_surface_dipole_correction) & write(io_lun,'(10x,"Surface Dipole Correction Energy : ",f25.15," ",a2)') en_conv * & - half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & - en_units(energy_units) + surface_dipole_energy_ion, en_units(energy_units) + !half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & + !en_units(energy_units) end if if (abs(entropy) >= RD_ERR) then @@ -375,11 +376,11 @@ subroutine get_energy(total_energy, printDFT, level) ! For DFT, we need dipole correction energy of rho_i + rho_e if(flag_surface_dipole_correction) then !if(flag_dipole_internal) then - total_energy2 = total_energy2 + & - half*(surface_dipole_energy_ion+surface_dipole_energy_elec) + !total_energy2 = total_energy2 + & + ! half*(surface_dipole_energy_ion+surface_dipole_energy_elec) !else - ! total_energy2 = total_energy2 + & - ! surface_dipole_energy_ion+surface_dipole_energy_elec + total_energy2 = total_energy2 + & + surface_dipole_energy_ion+surface_dipole_energy_elec !end if end if if (inode == ionode) then @@ -591,11 +592,11 @@ subroutine final_energy(level) ! For Harris-Foulkes, we need dipole correction energy of rho_i - rho_e if(flag_surface_dipole_correction) then !if(flag_dipole_internal) then - total_energy1 = total_energy1 + & - half*(surface_dipole_energy_ion-surface_dipole_energy_elec) + !total_energy1 = total_energy1 + & + ! half*(surface_dipole_energy_ion-surface_dipole_energy_elec) !else - ! total_energy1 = total_energy1 + & - ! surface_dipole_energy_ion + total_energy1 = total_energy1 + & + surface_dipole_energy_ion !end if end if !Write out data @@ -660,8 +661,8 @@ subroutine final_energy(level) write (io_lun,18) en_conv*cdft_energy,en_units(energy_units) if (flag_surface_dipole_correction) & write(io_lun,'(10x," | Surface Dipole Energy = ",f25.15," ",a2)') en_conv * & - half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & - en_units(energy_units) + surface_dipole_energy_ion, en_units(energy_units) + !half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & write (io_lun, 2) end if end if @@ -737,11 +738,11 @@ subroutine final_energy(level) if (flag_dft_d2) total_energy2 = total_energy2 + disp_energy if(flag_surface_dipole_correction) then !if(flag_dipole_internal) then - total_energy2 = total_energy2 + & - half*(surface_dipole_energy_ion+surface_dipole_energy_elec) + !total_energy2 = total_energy2 + & + ! half*(surface_dipole_energy_ion+surface_dipole_energy_elec) !else - ! total_energy2 = total_energy2 + & - ! surface_dipole_energy_ion+surface_dipole_energy_elec + total_energy2 = total_energy2 + & + surface_dipole_energy_ion+surface_dipole_energy_elec !end if end if diff --git a/src/force_module.f90 b/src/force_module.f90 index ea53a61ec..cfbdeeb52 100644 --- a/src/force_module.f90 +++ b/src/force_module.f90 @@ -244,11 +244,15 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & flag_neutral_atom, flag_stress, & rcellx, rcelly, rcellz, & flag_atomic_stress, non_atomic_stress, & - flag_heat_flux, cell_constraint_flag + flag_heat_flux, cell_constraint_flag, & + atom_coord, species_glob use density_module, only: get_electronic_density, density, & - build_Becke_weight_forces + build_Becke_weight_forces, & + flag_surface_dipole_correction, & + surface_dipole_density, surface_normal, surface_dipole_energy_elec, & + surface_dipole_energy_ion use functions_on_grid, only: atomfns, H_on_atomfns - use dimens, only: n_my_grid_points + use dimens, only: n_my_grid_points, r_super_x, r_super_y, r_super_z use matrix_data, only: Hrange use mult_module, only: matK, matKatomf, SF_to_AtomF_transform use maxima_module, only: maxngrid @@ -260,6 +264,7 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & use hartree_module, only: Hartree_stress use XC, ONLY: XC_GGA_stress use input_module, only: leqi + use species_module, only: charge implicit none @@ -272,7 +277,8 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & ! Local variables integer :: i, j, ii, stat, max_atom, max_compt, ispin, & direction, dir1, dir2 - real(double) :: max_force, volume, scale + real(double) :: max_force, volume, scale, r_super_norm + real(double), dimension(3) :: dipole_correction_force type(cq_timer) :: tmr_l_tmp1 type(cq_timer) :: backtrace_timer integer :: backtrace_level @@ -373,6 +379,9 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & GPV_stress(dir1,dir1) = (hartree_energy_total_rho + & local_ps_energy - core_correction) ! core contains 1/V term end if + if(flag_surface_dipole_correction) then + GPV_stress(dir1,dir1) = GPV_stress(dir1,dir1) + surface_dipole_energy_elec + end if if(flag_self_consistent) then XC_stress(dir1,dir1) = xc_energy + & spin_factor*XC_GGA_stress(dir1,dir1) @@ -507,8 +516,28 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & en_units(energy_units), d_units(dist_units) write (io_lun, fmt='(18x," Atom X Y Z")') end if - ! Calculate forces and write out + select case(surface_normal) + case(1) ! X + r_super_norm = r_super_x + case(2) ! Y + r_super_norm = r_super_y + case(3) ! Z + r_super_norm = r_super_z + end select do i = 1, ni_in_cell + if(flag_surface_dipole_correction) then + dipole_correction_force = zero + dipole_correction_force(surface_normal) = charge(species_glob(i)) * fourpi * & + surface_dipole_density / r_super_norm + ! Mathematically, we need something like this term for the stress, except + ! that I don't think that stress can be defined sensibly when there is a vacuum + ! gap as there should be along the surface normal! I have left this here for + ! information, but I don't think that it should be included. DRB 2022/06/06 + ! + !dipole_correction_stress(surface_normal) = & + ! dipole_correction_stress(surface_normal) + & + ! atom_coord(surface_normal,i) * dipole_correction_force(surface_normal) + end if do j = 1, 3 ! Force components that are always needed tot_force(j,i) = HF_force(j,i) + HF_NL_force(j,i) + & @@ -533,6 +562,8 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & tot_force(j,i) = tot_force(j,i) + disp_force(j,i) if(flag_neutral_atom_projector) & tot_force(j,i) = tot_force(j,i) + NA_force(j,i) + if(flag_surface_dipole_correction) & + tot_force(j,i) = tot_force(j,i) + dipole_correction_force(j) ! Zero force on fixed atoms if (.not. flag_move_atom(j,i)) then tot_force(j,i) = zero @@ -560,6 +591,8 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & else write(io_lun, 106) (for_conv * ion_interaction_force(j,i), j = 1, 3) end if + if(flag_surface_dipole_correction) & + write(io_lun, fmt='("Force dipole : ",3f15.10)') (for_conv * dipole_correction_force(j), j = 1, 3) if (flag_pcc_global) write(io_lun, 108) (for_conv * pcc_force(j,i), j = 1, 3) if (flag_dft_d2) write (io_lun, 109) (for_conv * disp_force(j,i), j = 1, 3) if (flag_perform_cdft) write (io_lun, fmt='("Force cDFT : ",3f15.10)') & @@ -602,7 +635,6 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & if (flag_neutral_atom_projector) then stress(dir1,dir2) = stress(dir1,dir2) + NA_stress(dir1,dir2) end if - end do end do else diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index 88057a2a5..e0fa12e43 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -839,7 +839,7 @@ subroutine read_input(start, start_L, titles, vary_mu,& atomch_output, flag_Kerker, flag_wdmetric, minitersSC, & flag_newresidual, flag_newresid_abs, n_dumpSCF use density_module, only: flag_InitialAtomicSpin, flag_DumpChargeDensity - use density_module, only: flag_surface_dipole_correction, surface_normal, flag_output_average_potential + use density_module, only: flag_surface_dipole_correction, surface_normal, flag_output_average_potential, discontinuity_location use S_matrix_module, only: InvSTolerance, InvSMaxSteps,& InvSDeltaOmegaTolerance use blip, only: blip_info, init_blip_flag, alpha, beta @@ -1551,7 +1551,7 @@ subroutine read_input(start, start_L, titles, vary_mu,& threshold_resetCD = fdf_double('SC.Threshold.Reset',0.1_double) flag_surface_dipole_correction = fdf_boolean('SC.SurfaceDipoleCorrection',.false.) flag_output_average_potential = fdf_boolean('SC.OutputAveragePotential',.false.) - ! Leave this for average potential output without correction + if(flag_surface_dipole_correction) discontinuity_location = fdf_integer('SC.DiscontinuityLocation',0) tmp = fdf_string(1,'SC.SurfaceNormal','z') if(leqi(tmp,'x')) then surface_normal = 1 @@ -2543,6 +2543,9 @@ subroutine write_info(titles, mu, vary_mu, read_phi, & use datestamp, only: datestr, commentver use pseudopotential_common, only: flag_neutral_atom_projector, maxL_neutral_atom_projector, & numN_neutral_atom_projector + use density_module, only: flag_surface_dipole_correction, surface_normal, & + discontinuity_location + implicit none @@ -2629,7 +2632,16 @@ subroutine write_info(titles, mu, vary_mu, read_phi, & maxval(numN_neutral_atom_projector),maxL_neutral_atom_projector end if end if - + if(flag_surface_dipole_correction) then + write(io_lun,fmt='(/10x,"Applying surface dipole correction along axis ",i2)') surface_normal + if(discontinuity_location==0) then + write(io_lun,fmt='(10x,"No location for discontinuity specified! & + &It will be placed at point of lowest density")') + else + write(io_lun,fmt='(10x,"User-specified location for discontinuity: ",i5)') & + discontinuity_location + end if + end if if(read_phi) then write(io_lun,262) do n=1, n_species From 27fff5f69f9c646f6075ca54bcf736737034da00 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Wed, 8 Jan 2025 15:57:11 +0900 Subject: [PATCH 05/45] remove a bug in writing cube files remove a bug in writing cube files --- tools/PostProcessing/read_module.f90 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/PostProcessing/read_module.f90 b/tools/PostProcessing/read_module.f90 index c94289303..2e381d2e0 100644 --- a/tools/PostProcessing/read_module.f90 +++ b/tools/PostProcessing/read_module.f90 @@ -349,6 +349,7 @@ end subroutine read_input subroutine read_block_input use datatypes + use numbers, ONLY: very_small use local, ONLY: nblockx, nblocky, nblockz, block_store, nprocs, block_size_x, block_size_y, block_size_z, & grid_x, grid_y, grid_z, nptsx, nptsy, nptsz, stm_z_min, stm_z_max, stm_x_min, stm_x_max, & stm_y_min, stm_y_max, nxmin, nymin, nzmin, gpv @@ -380,13 +381,13 @@ subroutine read_block_input ! Cell volume volume = BohrToAng*BohrToAng*BohrToAng*r_super_x*r_super_y*r_super_z ! Number of points in the area that the user has specified - nptsx = floor(BohrToAng*(stm_x_max - stm_x_min)/grid_x) - nptsy = floor(BohrToAng*(stm_y_max - stm_y_min)/grid_y) - nptsz = floor(BohrToAng*(stm_z_max - stm_z_min)/grid_z) + nptsx = floor(BohrToAng*(stm_x_max - stm_x_min)/grid_x+very_small) + nptsy = floor(BohrToAng*(stm_y_max - stm_y_min)/grid_y+very_small) + nptsz = floor(BohrToAng*(stm_z_max - stm_z_min)/grid_z+very_small) write(*,fmt='(4x,"Points in user-specified area: ",3i5)') nptsx,nptsy,nptsz gpv = volume/real(nptsx*nptsy*nptsz,double) ! Work out starting grid points in user area - nxmin = floor(BohrToAng*stm_x_min/grid_x) + nxmin = floor(BohrToAng*stm_x_min/grid_x) ! + very_small? (2025.Jan.8 TM) if(stm_x_min - grid_x*real(nxmin,double)>1e-3) nxmin = nxmin + 1 nymin = floor(BohrToAng*stm_y_min/grid_y) if(stm_y_min - grid_y*real(nymin,double)>1e-3) nymin = nymin + 1 From 3624b7ba01bc0d892fcee2278c05ed2917d9819d Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Thu, 9 Jan 2025 11:50:42 +0900 Subject: [PATCH 06/45] added XC_LibXC_v7_module.f90 for libxc_7.0.0 added XC_LibXC_v7_module.f90 for libxc_7.0.0 system/system.example.make is also changed --- src/XC_LibXC_v7_module.f90 | 4423 ++++++++++++++++++++++++++++++++ src/system/system.example.make | 6 +- 2 files changed, 4427 insertions(+), 2 deletions(-) create mode 100644 src/XC_LibXC_v7_module.f90 diff --git a/src/XC_LibXC_v7_module.f90 b/src/XC_LibXC_v7_module.f90 new file mode 100644 index 000000000..857c6ea3d --- /dev/null +++ b/src/XC_LibXC_v7_module.f90 @@ -0,0 +1,4423 @@ +! ------------------------------------------------------------------------------ +! $Id$ +! ------------------------------------------------------------------------------ +! Module XC +! ------------------------------------------------------------------------------ +! Code area 3: Operators +! ------------------------------------------------------------------------------ + +!!****h* Conquest/XC +!! PURPOSE +!! Provides the interface to LibXC routines along with the complete Conquest +!! library of XC functionals. This means that any changes to XC_CQ_module.f90 +!! need to be duplicated in this module but it simplifies the overall source +!! code and removes one layer of subroutine calls. See also comments in the +!! header for XC_CQ_module.f90 +!! AUTHOR +!! D. R. Bowler +!! CREATION DATE +!! 2018/02/13 +!! MODIFICATION HISTORY +!! 2018/06/15 12:21 dave +!! Added spin_factor in module use statements +!! 2019/04/09 zamaan +!! Off-diagonal elements of stress tensor added +!! 2021/05/12 tsuyoshi, dave and others +!! Created interface for LibXC v5 +!! Main changes involve XC types and function calls +!! 2021/07/22 14:26 dave +!! Added get_xc_energy routine (and associated) +!! SOURCE +!! +module XC + + use datatypes + use global_module, only: area_ops, io_lun, iprint_ops, spin_factor + use xc_f03_lib_m + + implicit none + + save + + ! Public, general variables + real(double), dimension(3,3), public :: XC_GGA_stress + real(double), public :: s_6 ! For DFT D2 + logical, public :: flag_is_GGA ! Needed for non-SC forces + + ! Numerical flag choosing functional type + integer, public :: flag_functional_type + ! Allow user to specify different functional to pseudopotentials + logical, public :: flag_different_functional + + ! Public methods + public :: get_xc_potential, get_dxc_potential, init_xc, get_xc_energy + + ! LibXC variables + integer :: n_xc_terms + integer, dimension(2) :: i_xc_family + type(xc_f03_func_t), dimension(:), allocatable :: xc_func + type(xc_f03_func_info_t), dimension(:), allocatable :: xc_info + logical :: flag_use_libxc + + ! Conquest functional identifiers + integer, parameter :: functional_lda_pz81 = 1 + integer, parameter :: functional_lda_gth96 = 2 + integer, parameter :: functional_lda_pw92 = 3 ! PRB 45, 13244 (1992) + PRL 45, 566 (1980) + integer, parameter :: functional_xalpha = 4 ! Slater/Dirac exchange only ; no correlation + integer, parameter :: functional_hartree_fock = 10 ! Hartree-Fock exact exchange ; no correlation + + integer, parameter :: functional_gga_pbe96 = 101 ! Standard PBE + integer, parameter :: functional_gga_pbe96_rev98 = 102 ! revPBE (PBE + Zhang-Yang 1998) + integer, parameter :: functional_gga_pbe96_r99 = 103 ! RPBE (PBE + Hammer-Hansen-Norskov 1999) + integer, parameter :: functional_gga_pbe96_wc = 104 ! WC (Wu-Cohen 2006) + + integer, parameter :: functional_hyb_pbe0 = 201 ! PBE0 (hybrid PBE with exx_alpha=0.25) + + ! Conquest output string + character(len=15) :: functional_description +!!***** + +contains + + !!****f* XC_module/init_xc * + !! + !! NAME + !! init_xc + !! USAGE + !! + !! PURPOSE + !! Initialises the exchange-correlation calculations + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2018/02/05 + !! MODIFICATION HISTORY + !! 2018/02/15 11:56 dave + !! Define flag_is_GGA for LibXC + !! SOURCE + !! + subroutine init_xc + + use global_module, ONLY : nspin, flag_dft_d2 + use GenComms, ONLY : inode, ionode, cq_abort, cq_warn + use numbers + + implicit none + + ! Local variables + character(len=80) :: sub_name = "init_xc" + integer :: vmajor, vminor, vmicro, i, j + integer, dimension(2) :: xcpart + character(len=120) :: name, kind, family, ref + type(xc_f03_func_t) :: temp_xc_func + type(xc_f03_func_info_t) :: temp_xc_info + + ! Test for LibXC or CQ + if(flag_functional_type<0) then + flag_is_GGA = .false. + ! -------------------------- + ! LibXC functional specified + ! -------------------------- + flag_use_libxc = .true. + call xc_f03_version(vmajor, vminor, vmicro) + if(inode==ionode.AND.iprint_ops>0) then + if(vmajor>2) then + write(io_lun,'(4x,"LibXC version: ",I2,".",I2,".",I2)') vmajor, vminor, vmicro + else + write(io_lun,'(4x,"LibXC version: ",I2,".",I2)') vmajor, vminor + end if + end if + ! Identify the functional + if(-flag_functional_type<1000) then ! Only exchange OR combined exchange-correlation + n_xc_terms = 1 + xcpart(1) = -flag_functional_type + else ! Separate the two parts + n_xc_terms = 2 + ! Make exchange first, correlation second for consistency + i = floor(-flag_functional_type/1000.0_double) + ! Temporary init to find exchange or correlation + if(nspin==1) then + call xc_f03_func_init(temp_xc_func, i, XC_UNPOLARIZED) + temp_xc_info = xc_f03_func_get_info(temp_xc_func) + else if(nspin==2) then + call xc_f03_func_init(temp_xc_func, i, XC_POLARIZED) + temp_xc_info = xc_f03_func_get_info(temp_xc_func) + end if + select case(xc_f03_func_info_get_kind(temp_xc_info)) + case(XC_EXCHANGE) + xcpart(1) = i + xcpart(2) = -flag_functional_type - xcpart(1)*1000 + case(XC_CORRELATION) + xcpart(2) = i + xcpart(1) = -flag_functional_type - xcpart(2)*1000 + end select + call xc_f03_func_end(temp_xc_func) + end if + ! Now initialise and output + allocate(xc_func(n_xc_terms),xc_info(n_xc_terms)) + do i=1,n_xc_terms + if(nspin==1) then + call xc_f03_func_init(xc_func(i), xcpart(i), XC_UNPOLARIZED) + xc_info(i) = xc_f03_func_get_info(xc_func(i)) + else if(nspin==2) then + call xc_f03_func_init(xc_func(i), xcpart(i), XC_POLARIZED) + xc_info(i) = xc_f03_func_get_info(xc_func(i)) + end if + ! Consistent threshold with Conquest + if(vmajor>2) call xc_f03_func_set_dens_threshold(xc_func(i),RD_ERR) + name = xc_f03_func_info_get_name(xc_info(i)) + i_xc_family(i) = xc_f03_func_info_get_family(xc_info(i)) + if(i_xc_family(i)==XC_FAMILY_GGA) flag_is_GGA = .true. + if(inode==ionode) then + select case(xc_f03_func_info_get_kind(xc_info(i))) + case (XC_EXCHANGE) + write(kind, '(a)') 'an exchange functional' + case (XC_CORRELATION) + write(kind, '(a)') 'a correlation functional' + case (XC_EXCHANGE_CORRELATION) + write(kind, '(a)') 'an exchange-correlation functional' + case (XC_KINETIC) + write(kind, '(a)') 'a kinetic energy functional' + case default + write(kind, '(a)') 'of unknown kind' + end select + + select case (i_xc_family(i)) + case (XC_FAMILY_LDA); + write(family,'(a)') "LDA" + case (XC_FAMILY_GGA); + write(family,'(a)') "GGA" + case (XC_FAMILY_HYB_GGA); + write(family,'(a)') "Hybrid GGA" + case (XC_FAMILY_MGGA); + write(family,'(a)') "MGGA" + case (XC_FAMILY_HYB_MGGA); + write(family,'(a)') "Hybrid MGGA" + case default; + write(family,'(a)') "unknown" + end select + + if(iprint_ops>2) then + if(vmajor>2) then + write(io_lun,'(4x,"The functional ", a, " is ", a, ", it belongs to the ", a, & + & " family and is defined in the reference(s):")') & + trim(name), trim(kind), trim(family) + j = 0 + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) + do while(j >= 0) + write(io_lun, '(4x,a,i1,2a)') '[', j, '] ', trim(ref) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) + end do + else + write(io_lun,'(4x,"The functional ", a, " is ", a, ", and it belongs to the ", a, & + & " family")') & + trim(name), trim(kind), trim(family) + end if + else if(iprint_ops>0) then + write(io_lun,'(4x,"Using the ",a," functional ",a)') trim(family),trim(name) + else + select case(xc_f03_func_info_get_kind(xc_info(i))) + case (XC_EXCHANGE) + write(io_lun,fmt='(/4x,"Using X functional ",a)') trim(name) + case (XC_CORRELATION) + write(io_lun,fmt='(4x,"Using C functional ",a/)') trim(name) + case (XC_EXCHANGE_CORRELATION) + write(io_lun,fmt='(/4x,"Using XC functional ",a/)') trim(name) + case default + write(io_lun,fmt='(/4x,"Using functional ",a/)') trim(name) + end select + end if + end if + end do + else + ! ----------------------------- + ! Conquest functional specified + ! ----------------------------- + flag_use_libxc = .false. + if(nspin==2) then ! Check for spin-compatible functionals + if ( flag_functional_type == functional_lda_pz81 .or. & + flag_functional_type == functional_lda_gth96 ) then + call cq_warn(sub_name, "Functional not compatible with spin; reverting to LDA-PW92 ",flag_functional_type) + flag_functional_type = functional_lda_pw92 + end if + end if + select case(flag_functional_type) + case (functional_lda_pz81) + functional_description = 'LDA PZ81' + if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") + case (functional_lda_gth96) + functional_description = 'LDA GTH96' + if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") + case (functional_lda_pw92) + functional_description = 'LSDA PW92' + if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") + case (functional_gga_pbe96) + functional_description = 'GGA PBE96' + if(flag_dft_d2) s_6 = 0.75_double + case (functional_gga_pbe96_rev98) ! This is PBE with the parameter correction + functional_description = 'GGA revPBE98' ! in Zhang & Yang, PRL 80:4, 890 (1998) + if(flag_dft_d2) s_6 = 1.25_double + case (functional_gga_pbe96_r99) ! This is PBE with the functional form redefinition + functional_description = 'GGA RPBE99' ! in Hammer et al., PRB 59:11, 7413-7421 (1999) + if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") + case (functional_gga_pbe96_wc) ! Wu-Cohen nonempirical GGA functional + functional_description = 'GGA WC' ! in Wu and Cohen, PRB 73. 235116, (2006) + if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") + case (functional_hyb_pbe0) ! This is PB0E with the functional form redefinition + functional_description = 'hyb PBE0' + if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") + case default + functional_description = 'LSDA PW92' + if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") + end select + if(inode==ionode) write(io_lun,'(/4x, "The functional used will be ", a15/)') functional_description + ! This is a temporary, Conquest-specific test - we will + ! need to keep an eye on this and potentially introduce + ! tests against functional name + if(flag_functional_type>100) then + flag_is_GGA = .true. + else + flag_is_GGA = .false. + end if + + end if ! if selecting LibXC or CQ + end subroutine init_xc + !!*** + + !!****f* XC_module/write_xc_refs * + !! + !! NAME + !! write_xc_refs + !! USAGE + !! + !! PURPOSE + !! Write XC references + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2020/05/26 + !! MODIFICATION HISTORY + !! + !! SOURCE + !! + subroutine write_xc_refs + + implicit none + + integer :: i, j + character(len=120) :: ref + + write(io_lun,fmt='(4x,"XC references from LibXC:")') + do j=1,n_xc_terms + i = 0 + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) + do while(i >= 0) + write(io_lun, '(6x,a)') trim(ref) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) + end do + end do + return + end subroutine write_xc_refs + !!*** + + !!****f* XC/get_xc_potential * + !! + !! NAME + !! get_xc_potential + !! USAGE + !! + !! PURPOSE + !! Interface to LibXC and CQ routines + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2018/02/13 + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_xc_potential(density, xc_potential, xc_epsilon, & + xc_energy, size, &!x_epsilon, c_epsilon, & + x_energy) + + use datatypes + use numbers + use global_module, only: exx_niter, exx_siter, exx_alpha, nspin + + implicit none + + ! Passed variables + integer :: size + real(double) :: xc_energy + real(double), dimension(size,nspin) :: density + real(double), dimension(size,nspin) :: xc_potential + real(double), dimension(size) :: xc_epsilon + ! optional + !real(double), dimension(:), optional :: x_epsilon, c_epsilon + real(double), optional :: x_energy + + ! Local variables + real(double) :: loc_x_energy, exx_tmp + + XC_GGA_stress = zero + if(flag_use_libxc) then + call get_libxc_potential(density=density, size=size,& + xc_potential =xc_potential, & + xc_epsilon =xc_epsilon, & + xc_energy =xc_energy, & + x_energy =loc_x_energy ) + else + select case(flag_functional_type) + case (functional_lda_pz81) + ! NOT SPIN POLARISED + call get_xc_potential_LDA_PZ81(density=density(:,1), size=size, & + xc_potential=xc_potential(:,1), & + xc_epsilon =xc_epsilon, & + xc_energy =xc_energy, & + x_energy =loc_x_energy ) + ! + ! + case (functional_lda_gth96) + ! NOT SPIN POLARISED + call get_GTH_xc_potential(density(:,1), xc_potential(:,1), & + xc_epsilon, xc_energy, size) + ! not possible to decompose the xc energy... + loc_x_energy = zero + ! + ! + case (functional_lda_pw92) + call get_xc_potential_LSDA_PW92(density=density, size=size,& + xc_potential =xc_potential, & + xc_epsilon =xc_epsilon, & + xc_energy_total =xc_energy, & + x_energy_total =loc_x_energy ) + ! + ! + case (functional_gga_pbe96) + call get_xc_potential_GGA_PBE(density=density, grid_size=size, & + xc_potential=xc_potential, & + xc_epsilon =xc_epsilon, & + xc_energy =xc_energy, & + x_energy =loc_x_energy ) + ! + ! + case (functional_gga_pbe96_rev98) + call get_xc_potential_GGA_PBE(density=density, grid_size=size, & + xc_potential=xc_potential, & + xc_epsilon =xc_epsilon, & + xc_energy =xc_energy, & + x_energy =loc_x_energy, & + flavour=functional_gga_pbe96_rev98 ) + ! + ! + case (functional_gga_pbe96_r99) + call get_xc_potential_GGA_PBE(density=density, grid_size=size, & + xc_potential=xc_potential, & + xc_epsilon =xc_epsilon, & + xc_energy =xc_energy, & + x_energy =loc_x_energy, & + flavour=functional_gga_pbe96_r99 ) + ! + ! + case (functional_gga_pbe96_wc) + call get_xc_potential_GGA_PBE(density=density, grid_size=size, & + xc_potential=xc_potential, & + xc_epsilon =xc_epsilon, & + xc_energy =xc_energy, & + x_energy =loc_x_energy, & + flavour=functional_gga_pbe96_wc ) + ! + ! + case (functional_hyb_pbe0) + ! + if ( exx_niter <= exx_siter ) then + exx_tmp = one + else + exx_tmp = one - exx_alpha + end if + ! + call get_xc_potential_hyb_PBE0(density=density, grid_size=size, & + xc_potential=xc_potential, & + xc_epsilon =xc_epsilon, & + exx_a =exx_tmp, & + xc_energy =xc_energy, & + x_energy =loc_x_energy, & + flavour=functional_gga_pbe96 ) + ! + ! + case (functional_hartree_fock) + ! **** + ! not optimal but experimental + if (exx_niter <= exx_siter) then + ! for the first call of get_H_matrix using Hartree-Fock method + ! to get something not to much stupid ; use pure exchange functional + ! in near futur such as Xalpha + call get_xc_potential_LSDA_PW92(density=density, size=size,& + xc_potential =xc_potential, & + xc_epsilon =xc_epsilon, & + xc_energy_total =xc_energy, & + x_energy_total =loc_x_energy ) + else + xc_epsilon = zero + xc_energy = zero + xc_epsilon = zero + xc_potential = zero + loc_x_energy = zero + end if + ! + ! + case default + call get_xc_potential_LSDA_PW92(density, xc_potential, & + xc_epsilon, xc_energy, size) + ! + ! + end select + end if + if(present(x_energy)) x_energy = loc_x_energy + return + end subroutine get_xc_potential + !!*** + + !!****f* XC/get_dxc_potential * + !! + !! NAME + !! get_dxc_potential + !! USAGE + !! + !! PURPOSE + !! Interface to LibXC or CQ routines + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2018/02/13 + !! MODIFICATION HISTORY + !! 2018/02/14 11:00 dave + !! Bug fix: introduced test for presence of density_out (only used for GGA, PCC) + !! 2018/02/15 10:46 dave + !! Added branch based on presence of density_out to call to libxc_dpotential + !! SOURCE + !! + subroutine get_dxc_potential(density, dxc_potential, nsize, density_out) + + use GenComms, only: cq_abort + implicit none + + ! Passed variables + integer :: nsize + real(double), dimension(:,:) :: density + real(double), dimension(:,:,:) :: dxc_potential + real(double), dimension(:,:), optional :: density_out + + if(flag_is_GGA) then + if(.NOT.present(density_out)) call cq_abort("Error: get_dxc_potential called without density_out for GGA") + end if + if(flag_use_libxc) then + if(present(density_out)) then + call get_libxc_dpotential(density, dxc_potential,nsize,density_out) + else + call get_libxc_dpotential(density, dxc_potential,nsize) + end if + else + select case (flag_functional_type) + case (functional_lda_pz81) + ! NON SPIN POLARISED CALCULATION ONLY + ! + call get_dxc_potential_LDA_PZ81(density(:,1), dxc_potential(:,1,1), nsize) + ! + case (functional_lda_gth96) + ! NON SPIN POLARISED CALCULATION ONLY + call get_GTH_dxc_potential(density(:,1), dxc_potential(:,1,1), nsize) + ! + case (functional_lda_pw92) + call get_dxc_potential_LSDA_PW92(density, dxc_potential, nsize) + ! + case (functional_gga_pbe96) ! Original PBE + ! NON SPIN POLARISED CALCULATION ONLY + call get_dxc_potential_GGA_PBE(density = density(:,1), & + density_out = density_out(:,1), & + dxc_potential = dxc_potential(:,1,1), & + size = nsize) + ! + case (functional_gga_pbe96_rev98) + ! PBE with kappa of PRL 80, 890 (1998) + call get_dxc_potential_GGA_PBE(density(:,1), & + density_out(:,1), & + dxc_potential(:,1,1), nsize, & + functional_gga_pbe96_rev98) + case (functional_gga_pbe96_r99) + ! PBE with form of PRB 59, 7413 (1999) + ! NON SPIN POLARISED CALCULATION ONLY + call get_dxc_potential_GGA_PBE(density(:,1), & + density_out(:,1), & + dxc_potential(:,1,1), nsize, & + functional_gga_pbe96_r99) + ! + case default + call get_dxc_potential_LDA_PZ81(density(:,1), dxc_potential(:,1,1), nsize) + ! + end select + end if + end subroutine get_dxc_potential + !!*** + + !!****f* XC_module/get_libxc_potential * + !! + !! NAME + !! get_libxc_potential + !! USAGE + !! + !! PURPOSE + !! Calculates the exchange-correlation potential + !! on the grid using LibXC + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2018/02/05 + !! MODIFICATION HISTORY + !! 2018/02/15 11:56 dave + !! Bug fix: only scale sigma and build_gradient if we have a GGA functional + !! Changed to use flag_is_GGA + !! 2021/05/17 10:45 dave + !! Tidying and small changes (mainly using stride for vsigma and vrho indexing) + !! SOURCE + !! + subroutine get_libxc_potential(density, xc_potential, xc_epsilon, xc_energy, size, x_energy) + + use datatypes + use numbers + use GenComms, only: gsum + use GenBlas, only: dot + use dimens, only: grid_point_volume, n_my_grid_points + use global_module, only : nspin, io_lun, flag_full_stress, flag_stress + use fft_module, only: fft3, recip_vector + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), intent(out) :: xc_energy + real(double), dimension(:,:), intent(in) :: density + real(double), dimension(:,:), intent(out) :: xc_potential + real(double), dimension(:), intent(out) :: xc_epsilon + ! optional + real(double), intent(out), optional :: x_energy + + ! local variables + real(double), dimension(:), allocatable :: sigma, eps, vrho, vsigma, temp ! Temporary variables + complex(double), dimension(:,:), allocatable :: ng + real(double), dimension(:), allocatable :: alt_dens + real(double), dimension(:,:,:), allocatable :: grad_density + real(double) :: rho_tot + integer :: stat, i, spin, nxc, j + logical :: flag_exchange_e = .false. + + flag_exchange_e = PRESENT(x_energy) + ! Storage space for individual components + allocate(vrho(n_my_grid_points*nspin),eps(n_my_grid_points),alt_dens(n_my_grid_points*nspin)) + ! For GGA, create sigma (\nabla n dot \nabla n) from gradient + if(flag_is_GGA) then + if(nspin>1) then + allocate(vsigma(n_my_grid_points*3),sigma(n_my_grid_points*3)) + else + allocate(vsigma(n_my_grid_points),sigma(n_my_grid_points)) + endif + ! If GGA, we need to find and adapt gradient + allocate(grad_density(size,3,nspin),temp(size),ng(size,3),STAT=stat) + sigma = zero + grad_density = zero + do spin = 1, nspin + call build_gradient(density(:,spin), grad_density(:,:,spin), size) + end do + ! Build modulus - NB LibXC uses spin, point for density ! + if(nspin>1) then + ! This is ugly, but there's not really a better way + do i=1,n_my_grid_points + ! \nabla n_alpha dot \nabla n_alpha + sigma(1+(i-1)*3) = & + grad_density(i,1,1)*grad_density(i,1,1) + & + grad_density(i,2,1)*grad_density(i,2,1) + & + grad_density(i,3,1)*grad_density(i,3,1) + ! \nabla n_alpha dot \nabla n_beta + sigma(2+(i-1)*3) = & + grad_density(i,1,1)*grad_density(i,1,2) + & + grad_density(i,2,1)*grad_density(i,2,2) + & + grad_density(i,3,1)*grad_density(i,3,2) + ! \nabla n_beta dot \nabla n_beta + sigma(3+(i-1)*3) = & + grad_density(i,1,2)*grad_density(i,1,2) + & + grad_density(i,2,2)*grad_density(i,2,2) + & + grad_density(i,3,2)*grad_density(i,3,2) + end do + else + sigma(1:n_my_grid_points) = & + grad_density(1:n_my_grid_points,1,1)*grad_density(1:n_my_grid_points,1,1) + & + grad_density(1:n_my_grid_points,2,1)*grad_density(1:n_my_grid_points,2,1) + & + grad_density(1:n_my_grid_points,3,1)*grad_density(1:n_my_grid_points,3,1) + end if + end if + xc_epsilon = zero + xc_potential = zero + XC_GGA_stress = zero + ! If we have spin, re-order density to have spin index first + ! Otherwise scale + if(nspin>1) then + do i = 1, n_my_grid_points + do spin=1,nspin + alt_dens(spin + (i-1)*nspin) = density(i,spin) + end do + end do + else + ! Scaling for spin; sigma needs four because it is nabla n .dot. nabla n + alt_dens(1:n_my_grid_points) = two*density(1:n_my_grid_points,1) + if(flag_is_GGA) then + sigma(:) = four*sigma(:) + grad_density(:,:,1) = two*grad_density(:,:,1) + end if + end if + ! Create XC energy and potential + do nxc = 1,n_xc_terms + vrho = zero + eps = zero + if(nspin>1) then + select case( i_xc_family(nxc) ) + case(XC_FAMILY_LDA) + call xc_f03_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + alt_dens, eps, vrho ) + case(XC_FAMILY_GGA) + call xc_f03_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + alt_dens, sigma, eps, vrho, vsigma ) + end select + + ! d e_xc/d n + ! Awkward indexing because LibXC does spin first then grid point + do spin=1,nspin + xc_potential(1:n_my_grid_points,spin) = xc_potential(1:n_my_grid_points,spin) + & + vrho(spin:nspin*n_my_grid_points+spin-2:nspin) + end do + + if(flag_is_GGA) then + ! Calculate the second term, from d (n eps_xc) / d sigma + ng = zero + ! FFT d n Exc/d sigma \nabla n to reciprocal space + ! spin up + temp = zero + do i=1,3 + ! d eps / d sigma(up.up) grad rho(up) + d eps / d sigma(up.down) grad rho(down) + ! Note the stride here which comes from LibXC putting the spin index first + temp(1:n_my_grid_points) = two*vsigma(1:3*n_my_grid_points-2:3)*grad_density(1:n_my_grid_points,i,1) + & + vsigma(2:3*n_my_grid_points-1:3)*grad_density(1:n_my_grid_points,i,2) + ! For non-orthogonal stresses, introduce another loop and dot with grad_density(:,j) + if (flag_stress) then + if (flag_full_stress) then + do j=1,3 ! zamaan - I think this is what the comment above means? + XC_GGA_stress(i,j) = XC_GGA_stress(i,j) - & + dot(n_my_grid_points,temp(:),1,grad_density(:,j,1),1) + end do + else + XC_GGA_stress(i,i) = XC_GGA_stress(i,i) - & + dot(n_my_grid_points,temp(:),1,grad_density(:,i,1),1) + end if + end if + call fft3(temp, ng(:,i), size, -1) + end do + ! Dot product with iG to get the second term in reciprocal space + ! Accumulate in ng(:,1) as it won't be used again + ng(:,1) = minus_i * ( ng(:,1)*recip_vector(:,1) + & + ng(:,2)*recip_vector(:,2) + ng(:,3)*recip_vector(:,3)) + ! Use temp for the second term in real space + temp = zero + call fft3(temp(:), ng(:,1), size, +1) + xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & + temp(1:n_my_grid_points) + ! spin down + temp = zero + ng = zero + do i=1,3 + ! d eps / d sigma(down.down) grad rho(down) + d eps / d sigma(up.down) grad rho(up) + ! Again, note stride + temp(1:n_my_grid_points) = vsigma(2:3*n_my_grid_points-1:3)*grad_density(1:n_my_grid_points,i,1) + & + two*vsigma(3:3*n_my_grid_points:3)*grad_density(1:n_my_grid_points,i,2) + ! For non-orthogonal stresses, introduce another loop and dot with grad_density(:,j) + if (flag_stress) then + if (flag_full_stress) then + do j=1,3 + XC_GGA_stress(i,j) = XC_GGA_stress(i,j) - & + dot(n_my_grid_points,temp(:),1,grad_density(:,j,2),1) + end do + else + XC_GGA_stress(i,i) = XC_GGA_stress(i,i) - & + dot(n_my_grid_points,temp(:),1,grad_density(:,i,2),1) + end if + end if + call fft3(temp, ng(:,i), size, -1) + end do + ! Dot product with iG to get the second term in reciprocal space + ! Accumulate in ng(:,1) as it won't be used again + ng(:,1) = minus_i * ( ng(:,1)*recip_vector(:,1) + & + ng(:,2)*recip_vector(:,2) + ng(:,3)*recip_vector(:,3)) + ! Use vsigma for the second term in real space + temp = zero + call fft3(temp(:), ng(:,1), size, +1) + xc_potential(1:n_my_grid_points,2) = xc_potential(1:n_my_grid_points,2) + & + temp(1:n_my_grid_points) + end if ! flag_is_GGA + + else ! No spin + select case (i_xc_family(nxc)) + case(XC_FAMILY_LDA) + call xc_f03_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + alt_dens, eps, vrho ) + case(XC_FAMILY_GGA) + call xc_f03_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + alt_dens, sigma, eps, vrho, vsigma ) + end select + + ! d e_xc/d n + xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & + vrho(1:n_my_grid_points) + + if(flag_is_GGA) then + ! Calculate the second term in the potential, from d (n eps_xc) / d sigma + ng = zero + ! FFT d n Exc/d sigma \nabla n to reciprocal space + temp = zero + do i=1,3 + temp(1:n_my_grid_points) = vsigma(1:n_my_grid_points)*grad_density(1:n_my_grid_points,i,1) + ! For non-orthogonal stresses, introduce another loop and dot with grad_density(:,j) + if (flag_stress) then + if (flag_full_stress) then + do j=1,3 + XC_GGA_stress(i,j) = XC_GGA_stress(i,j) - & + dot(n_my_grid_points,temp(:),1,grad_density(:,j,1),1) + end do + else + XC_GGA_stress(i,i) = XC_GGA_stress(i,i) - & + dot(n_my_grid_points,temp(:),1,grad_density(:,i,1),1) + end if + end if + call fft3(temp, ng(:,i), size, -1) + end do + ! Dot product with iG to get the second term in reciprocal space + ! Accumulate in ng(:,1) as it won't be used again + ng(:,1) = two * minus_i * ( ng(:,1)*recip_vector(:,1) + & + ng(:,2)*recip_vector(:,2) + ng(:,3)*recip_vector(:,3)) + ! Use vsigma for the second term in real space + !vsigma = zero + !call fft3(vsigma(:), ng(:,1), size, +1) + !xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & + ! vsigma(1:n_my_grid_points) + ! Actually I think temp is fine + temp = zero + call fft3(temp(:), ng(:,1), size, +1) + xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & + temp(1:n_my_grid_points) + end if ! flag_is_GGA + + end if ! nspin + + xc_epsilon(1:n_my_grid_points) = xc_epsilon(1:n_my_grid_points) + eps(1:n_my_grid_points) + + if(nxc==1) then + if(flag_exchange_e) then + x_energy = zero + do i=1,n_my_grid_points + rho_tot = density(i,1) + density(i,nspin) + x_energy = x_energy + eps(i)*rho_tot + end do + end if + end if + end do ! nxc = n_xc_terms + + deallocate(vrho,eps,alt_dens) + if(flag_is_GGA)then + deallocate(grad_density,sigma,vsigma,ng,temp) + if (flag_stress) then + XC_GGA_stress = XC_GGA_stress*grid_point_volume + call gsum(XC_GGA_stress,3,3) + end if + end if + ! Sum to get energy + xc_energy = zero + do i=1,n_my_grid_points + rho_tot = density(i,1) + density(i,nspin) + xc_energy = xc_energy + xc_epsilon(i)*rho_tot + end do + call gsum(xc_energy) + ! and 'integrate' the energy over the volume of the grid point + xc_energy = xc_energy * grid_point_volume + if(flag_exchange_e) then + call gsum(x_energy) + x_energy = x_energy * grid_point_volume + end if + return + end subroutine get_libxc_potential + !!*** + + !!****f* XC_module/get_libxc_dpotential * + !! + !! NAME + !! get_libxc_dpotential + !! USAGE + !! + !! PURPOSE + !! Calculates the derivative of the exchange-correlation potential + !! on the grid using LibXC + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2018/02/15 + !! MODIFICATION HISTORY + !! 2018/02/16 10:11 dave + !! Moved calculation of dxc inside case + !! Non-spin GGA implementation started + !! 2018/02/23 15:09 dave + !! Bug fix: moved scaling of diff_rho inside GGA if loop + !! 2021/05/20 11:52 dave + !! Tidying select clause + !! SOURCE + !! + subroutine get_libxc_dpotential(density, dxc_potential, size, density_out) + + use datatypes + use numbers + use GenComms, only: gsum + use GenBlas, only: dot + use dimens, only: grid_point_volume, n_my_grid_points + use global_module, only : nspin, io_lun + use fft_module, only: fft3, recip_vector + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), dimension(:,:), intent(in) :: density + real(double), dimension(:,:,:), intent(out) :: dxc_potential + real(double), dimension(:,:), intent(in), optional :: density_out + + ! Local variables + real(double) :: tmp_factor + real(double), dimension(:), allocatable :: alt_dens, sigma,vrho,vsigma, & + v2rho2, v2rhosigma, v2sigma2, diff_rho + real(double), dimension(:,:), allocatable :: tmp3 + real(double), dimension(:,:,:), allocatable :: grad_density + complex(double), dimension(:), allocatable :: tmp1 + complex(double), dimension(:,:), allocatable :: ng, tmp2 + integer :: stat, i, spin, n, j + + ! Initialise - allocate and zero + if(nspin>1) then + allocate(alt_dens(n_my_grid_points*3),vrho(n_my_grid_points*3)) + else + allocate(alt_dens(n_my_grid_points),vrho(n_my_grid_points)) + end if + alt_dens = zero + if(flag_is_GGA) then + allocate(diff_rho(size)) + if(nspin>1) then + allocate(sigma(n_my_grid_points*3),& + vsigma(n_my_grid_points*3), v2rho2(n_my_grid_points*3), & + v2rhosigma(n_my_grid_points*6), v2sigma2(n_my_grid_points*6)) + allocate(tmp1(size),tmp2(size,3),tmp3(size,3)) + else + allocate(sigma(n_my_grid_points), & + vsigma(n_my_grid_points), v2rho2(n_my_grid_points), & + v2rhosigma(n_my_grid_points), v2sigma2(n_my_grid_points)) + allocate(tmp1(size),tmp2(size,3),tmp3(size,3)) + endif + ! If GGA, we need to find and adapt gradient + allocate(grad_density(size,3,nspin),ng(size,3),STAT=stat) + sigma = zero + grad_density = zero + diff_rho = zero + do spin = 1, nspin + call build_gradient(density(:,spin), grad_density(:,:,spin), size) + end do + ! Build modulus - NB LibXC uses spin, point for density ! + if(nspin>1) then + ! This is ugly, but there's not really a better way + do i=1,n_my_grid_points + ! \nabla n_alpha dot \nabla n_alpha + sigma(1+(i-1)*3) = & + grad_density(i,1,1)*grad_density(i,1,1) + & + grad_density(i,2,1)*grad_density(i,2,1) + & + grad_density(i,3,1)*grad_density(i,3,1) + ! \nabla n_alpha dot \nabla n_beta + sigma(2+(i-1)*3) = & + grad_density(i,1,1)*grad_density(i,1,2) + & + grad_density(i,2,1)*grad_density(i,2,2) + & + grad_density(i,3,1)*grad_density(i,3,2) + ! \nabla n_beta dot \nabla n_beta + sigma(3+(i-1)*3) = & + grad_density(i,1,2)*grad_density(i,1,2) + & + grad_density(i,2,2)*grad_density(i,2,2) + & + grad_density(i,3,2)*grad_density(i,3,2) + end do + else + sigma(1:n_my_grid_points) = & + grad_density(1:n_my_grid_points,1,1)*grad_density(1:n_my_grid_points,1,1) + & + grad_density(1:n_my_grid_points,2,1)*grad_density(1:n_my_grid_points,2,1) + & + grad_density(1:n_my_grid_points,3,1)*grad_density(1:n_my_grid_points,3,1) + diff_rho(1:n_my_grid_points) = & + density(1:n_my_grid_points,1) - density_out(1:n_my_grid_points,1) + end if + end if + dxc_potential = zero + ! Re-order density (spin) or scale (no spin) + if(nspin>1) then + do i = 1, n_my_grid_points + do spin=1,nspin + alt_dens(spin + (i-1)*nspin) = density(i,spin) + end do + end do + else + ! Scaling for spin; sigma needs four because it is nabla n .dot. nabla n + alt_dens(1:n_my_grid_points) = two*density(1:n_my_grid_points,1) + if(flag_is_GGA) then + diff_rho(1:n_my_grid_points) = two*diff_rho(1:n_my_grid_points) + sigma(:) = four*sigma(:) + grad_density(:,:,1) = two*grad_density(:,:,1) + end if + end if + ! Loop over terms and calculate potential + do j = 1,n_xc_terms + vrho = zero + if(nspin>1) then ! NB no spin-polarised GGA NSC forces + select case (i_xc_family(j)) + case(XC_FAMILY_LDA) + call xc_f03_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) + dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(:n_my_grid_points,1,1) +vrho(1:3*n_my_grid_points-2:3) + dxc_potential(1:n_my_grid_points,1,2) = dxc_potential(:n_my_grid_points,1,2) +vrho(2:3*n_my_grid_points-1:3) + dxc_potential(1:n_my_grid_points,2,1) = dxc_potential(:n_my_grid_points,2,1) +vrho(2:3*n_my_grid_points-1:3) + dxc_potential(1:n_my_grid_points,2,2) = dxc_potential(:n_my_grid_points,2,2) +vrho(3:3*n_my_grid_points:3) + end select + else + select case (i_xc_family(j)) + case(XC_FAMILY_LDA) + call xc_f03_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) + dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) + & + vrho(1:n_my_grid_points) + case(XC_FAMILY_GGA) + call xc_f03_gga_vxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,vrho,& + vsigma) + call xc_f03_gga_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,& + v2rho2,v2rhosigma,v2sigma2) + end select + + if(flag_is_GGA) then ! NB refer to JCTC 5, 1499 (2009) for L1-4 and details + ! Add term L1 (in paper) to potential + dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) + & + diff_rho(1:n_my_grid_points) * v2rho2(1:n_my_grid_points) + ! Create \sum_l' delta n_l' e_{l,l'} + ! Fourier transform the difference of densities + tmp1(:)=cmplx(zero,zero,double_cplx) + call fft3(diff_rho, tmp1, size, -1) + + do i=1,3 + ! Product by reciprocal vector stored for later use + tmp2(1:size,i) = -minus_i*recip_vector(1:size,i)*tmp1(1:size) + end do + + ! Fourier transform the vector back to the grid + call fft3(tmp3(:,1), tmp2(:,1), size, 1) + call fft3(tmp3(:,2), tmp2(:,2), size, 1) + call fft3(tmp3(:,3), tmp2(:,3), size, 1) + + ! Add term L2 to potential (L2 in paper - confusingly this is L3 in CQ code below) + ! NB the 1/|grad_density| factor cancels with dsigma/dg + do i=1,3 + dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) + & + two * tmp3(1:n_my_grid_points,i) * v2rhosigma(1:n_my_grid_points) * & + grad_density(1:n_my_grid_points,i,1) + end do + + ! Build the term M from paper (in CQ routines below, this is called L4) + do n=1, n_my_grid_points + !if(sigma(n) > RD_ERR) then + tmp_factor =(tmp3(n,1) * grad_density(n,1,1) & + + tmp3(n,2) * grad_density(n,2,1) & + + tmp3(n,3) * grad_density(n,3,1)) & + * (four*v2sigma2(n)) + !* (four*sigma(n)*v2sigma2(n))& + !+ two*vsigma(n)) !/ (sigma(n)) + !else + ! tmp_factor = zero + !end if + ! Reuse tmp3 + do i=1,3 + tmp3(n,i) = tmp_factor * grad_density(n,i,1) & + + two*vsigma(n) * tmp3(n,i) + end do + end do + + ! Terms L3 and L4 (using M) in paper + ! (In CQ GGA routines below, these are referred to as L2, L5 and L4) + do i=1,3 + tmp3(1:n_my_grid_points,i) = tmp3(1:n_my_grid_points,i) + & + two * diff_rho(1:n_my_grid_points) * v2rhosigma(1:n_my_grid_points) * & + grad_density(1:n_my_grid_points,i,1) + end do + + ! This process of FFT, scale by iG and FFT back avoids convolution + tmp2(:,:) = cmplx(zero,zero,double_cplx) ! 25Oct2007 TM + call fft3(tmp3(:,1), tmp2(:,1), size, -1) + call fft3(tmp3(:,2), tmp2(:,2), size, -1) + call fft3(tmp3(:,3), tmp2(:,3), size, -1) + + do n=1, size + tmp1(n) = -minus_i & + *(recip_vector(n,1)*tmp2(n,1) & + + recip_vector(n,2)*tmp2(n,2) & + + recip_vector(n,3)*tmp2(n,3)) + end do + + ! Use first component of tmp3 to store final vector + call fft3(tmp3(:,1), tmp1, size, 1) + + dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) - tmp3(1:n_my_grid_points,1) + end if ! flag_is_GGA + end if ! nspin + end do + deallocate(vrho,alt_dens) + if(flag_is_GGA) then + deallocate(diff_rho,sigma,vsigma,v2rho2,v2rhosigma,v2sigma2,tmp1,tmp2,tmp3) + deallocate(grad_density,ng) + end if + return + end subroutine get_libxc_dpotential + !!*** + + !!****f* XC_module/get_libxc_energy * + !! + !! NAME + !! get_libxc_energy + !! USAGE + !! + !! PURPOSE + !! Calculates the exchange-correlation energy + !! on the grid using LibXC + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2021/07/22 + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_libxc_energy(density, xc_energy, size) + + use datatypes + use numbers + use GenComms, only: gsum + use GenBlas, only: dot + use dimens, only: grid_point_volume, n_my_grid_points + use global_module, only : nspin, io_lun, flag_full_stress, flag_stress + use fft_module, only: fft3, recip_vector + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), intent(out) :: xc_energy + real(double), dimension(:,:), intent(in) :: density + + ! local variables + real(double), dimension(:), allocatable :: sigma, eps ! Temporary variables + real(double), dimension(:), allocatable :: alt_dens, xc_epsilon + real(double), dimension(:,:,:), allocatable :: grad_density + real(double) :: rho_tot + integer :: stat, i, spin, nxc, j + + ! Storage space for individual components + allocate(eps(n_my_grid_points),alt_dens(n_my_grid_points*nspin)) + ! For GGA, create sigma (\nabla n dot \nabla n) from gradient + if(flag_is_GGA) then + if(nspin>1) then + allocate(sigma(n_my_grid_points*3)) + else + allocate(sigma(n_my_grid_points)) + endif + ! If GGA, we need to find and adapt gradient + allocate(grad_density(size,3,nspin),STAT=stat) + sigma = zero + grad_density = zero + do spin = 1, nspin + call build_gradient(density(:,spin), grad_density(:,:,spin), size) + end do + ! Build modulus - NB LibXC uses spin, point for density ! + if(nspin>1) then + ! This is ugly, but there's not really a better way + do i=1,n_my_grid_points + ! \nabla n_alpha dot \nabla n_alpha + sigma(1+(i-1)*3) = & + grad_density(i,1,1)*grad_density(i,1,1) + & + grad_density(i,2,1)*grad_density(i,2,1) + & + grad_density(i,3,1)*grad_density(i,3,1) + ! \nabla n_alpha dot \nabla n_beta + sigma(2+(i-1)*3) = & + grad_density(i,1,1)*grad_density(i,1,2) + & + grad_density(i,2,1)*grad_density(i,2,2) + & + grad_density(i,3,1)*grad_density(i,3,2) + ! \nabla n_beta dot \nabla n_beta + sigma(3+(i-1)*3) = & + grad_density(i,1,2)*grad_density(i,1,2) + & + grad_density(i,2,2)*grad_density(i,2,2) + & + grad_density(i,3,2)*grad_density(i,3,2) + end do + else + sigma(1:n_my_grid_points) = & + grad_density(1:n_my_grid_points,1,1)*grad_density(1:n_my_grid_points,1,1) + & + grad_density(1:n_my_grid_points,2,1)*grad_density(1:n_my_grid_points,2,1) + & + grad_density(1:n_my_grid_points,3,1)*grad_density(1:n_my_grid_points,3,1) + end if + end if + ! If we have spin, re-order density to have spin index first + ! Otherwise scale + if(nspin>1) then + do i = 1, n_my_grid_points + do spin=1,nspin + alt_dens(spin + (i-1)*nspin) = density(i,spin) + end do + end do + else + ! Scaling for spin; sigma needs four because it is nabla n .dot. nabla n + alt_dens(1:n_my_grid_points) = two*density(1:n_my_grid_points,1) + if(flag_is_GGA) then + sigma(:) = four*sigma(:) + grad_density(:,:,1) = two*grad_density(:,:,1) + end if + end if + ! Create XC energy + allocate(xc_epsilon(n_my_grid_points)) + xc_epsilon = zero + do nxc = 1,n_xc_terms + eps = zero + select case( i_xc_family(nxc) ) + case(XC_FAMILY_LDA) + call xc_f03_lda_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, eps ) + case(XC_FAMILY_GGA) + call xc_f03_gga_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, sigma, eps ) + end select + xc_epsilon(1:n_my_grid_points) = xc_epsilon(1:n_my_grid_points) + eps(1:n_my_grid_points) + end do ! nxc = n_xc_terms + ! Sum to get energy + xc_energy = zero + do i=1,n_my_grid_points + rho_tot = density(i,1) + density(i,nspin) + xc_energy = xc_energy + xc_epsilon(i)*rho_tot + end do + call gsum(xc_energy) + ! and 'integrate' the energy over the volume of the grid point + xc_energy = xc_energy * grid_point_volume + + deallocate(eps,alt_dens,xc_epsilon) + if(flag_is_GGA)then + deallocate(grad_density,sigma) + end if + return + end subroutine get_libxc_energy + !!*** + + ! ********************************** + ! Conquest XC routines go below here + ! ********************************** + + !!****f* XC_module/get_xc_potential_LDA_PZ81 * + !! + !! NAME + !! get_xc_potential_LDA_PZ81 + !! USAGE + !! + !! PURPOSE + !! Calculates the exchange-correlation potential + !! on the grid within LDA using the Ceperley-Alder + !! interpolation formula. It also calculates the + !! total exchange-correlation energy. + !! + !! Note that this is the Perdew-Zunger parameterisation of the + !! Ceperley-Alder results for a homogeneous electron gas, as + !! described in Phys. Rev. B 23, 5048 (1981), with Ceperley-Alder in + !! Phys. Rev. Lett. 45, 566 (1980) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! E.H.Hernandez + !! CREATION DATE + !! 02/03/95 + !! MODIFICATION HISTORY + !! 01/11/2005 Antonio + !! Bibliography: + !! Exchange energy: It can be found in: + !! Phys. Rev. B 45, 13244 (1992) + !! **See Eq. 26 + !! Correlation energy: The correlation functional is PZ-81 + !! Phys. Rev. B 23, 5048 (1981) + !! **See Appendix C, and specially Table XII, + !! Eq. C1 for the xc hole (rs), + !! Eqs. C3 & C4, for rs > 1 and + !! Eqs. C5 & C6, for rs < 1 + !! 17/05/2001 dave + !! Converted to F90, added ROBODoc header, shortened call + !! 08/06/2001 dave + !! Changed to use gsum from GenComms and added RCS Id and Log tags + !! 21/06/2001 dave + !! Included in H_matrix_module + !! 08:00, 2003/03/12 dave + !! Added calculation of correction term to band energy + !! 11:49, 30/09/2003 drb + !! Added comments to make separate testing of X and C easier + !! 2008/03/03 18:32 dave + !! Removed dsqrt + !! 2011/12/12 L.Tong + !! Removed third, it is now defined in numbers module + !! 2012/04/03 L.Tong + !! - Added optional parameters x_epsilon and c_epsilon for output of + !! the exchange and correlation parts of xc_epsilon respectively. + !! 2014/09/24 L.Truflandier + !! - Added optional x_energy for output + !! 2018/02/13 11:03 dave + !! Renamed (added _LDA_PZ81) as part of refactoring + !! 2018/06/11 17:38 dave + !! Bug fix for bug #91 - factor of spin_factor required for non-spin polarised + !! SOURCE + !! + subroutine get_xc_potential_LDA_PZ81(density, xc_potential, xc_epsilon, & + xc_energy, size, x_epsilon, c_epsilon, & + x_energy) + + use datatypes + use numbers + use GenComms, only: gsum + use dimens, only: grid_point_volume, n_my_grid_points + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), intent(out) :: xc_energy + real(double), dimension(:), intent(in) :: density + real(double), dimension(:), intent(out) :: xc_potential, xc_epsilon + ! optional + real(double), dimension(:), intent(out), optional :: x_epsilon, c_epsilon + real(double), intent(out), optional :: x_energy + + ! Local variables + integer :: n + real(double) :: denominator, e_correlation, e_exchange, ln_rs, & + numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & + v_correlation, v_exchange + real(double), parameter :: alpha = -0.45817_double + real(double), parameter :: beta_1 = 1.0529_double + real(double), parameter :: beta_2 = 0.3334_double + real(double), parameter :: gamma = -0.1423_double + real(double), parameter :: p = 0.0311_double + real(double), parameter :: q = -0.048_double + real(double), parameter :: r = 0.0020_double + real(double), parameter :: s = -0.0116_double + + xc_energy = zero + if (present(x_epsilon)) x_epsilon = zero + if (present(c_epsilon)) c_epsilon = zero + if (present(x_energy)) x_energy = zero + + do n = 1, n_my_grid_points ! loop over grid pts and store potl on each + rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + if (rho > RD_ERR) then ! Find radius of hole + rcp_rs = ( four_thirds * pi * rho )**(third) + else + rcp_rs = zero + end if + e_exchange = alpha * rcp_rs + if (present(x_epsilon)) x_epsilon(n) = e_exchange + v_exchange = four_thirds * e_exchange + if (rcp_rs>zero) then + rs = one/rcp_rs + else + rs = zero + end if + sq_rs = sqrt(rs) + if (rs>=one) then + denominator = one / (one + beta_1 * sq_rs + beta_2 * rs) + numerator = one + seven_sixths * beta_1 * sq_rs + & + four_thirds * beta_2 * rs + e_correlation = gamma * denominator + v_correlation = gamma * numerator * denominator * denominator + else if ((rsRD_ERR)) then + ln_rs = log(rs) + rs_ln_rs = rs * ln_rs + e_correlation = p * ln_rs + q + r * rs_ln_rs + s * rs + v_correlation = e_correlation - & + third * (p + s * rs + r * (rs_ln_rs + rs)) + else + e_correlation = zero + v_correlation = zero + end if + if (present(c_epsilon)) c_epsilon(n) = e_correlation + if (present(x_energy)) x_energy = x_energy + e_exchange * spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + ! Both X and C + xc_energy = xc_energy + (e_exchange + e_correlation) * spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + xc_potential(n) = v_exchange + v_correlation + xc_epsilon(n) = e_exchange + e_correlation + ! These two for testing + ! Just C + !xc_energy = xc_energy+e_correlation*density(n) + !xc_potential(n) = v_correlation + !xc_epsilon(n) = e_correlation + ! Just X + !xc_energy = xc_energy+e_exchange*density(n) + !xc_potential(n) = v_exchange + !xc_epsilon(n) = e_exchange + end do ! do n_my_grid_points + call gsum(xc_energy) + if (present(x_energy)) call gsum(x_energy) + ! and 'integrate' the energy over the volume of the grid point + xc_energy = xc_energy * grid_point_volume + if (present(x_energy)) x_energy = x_energy * grid_point_volume + + return + end subroutine get_xc_potential_LDA_PZ81 + !!*** + + + !!****f* XC_module/get_GTH_xc_potential * + !! + !! NAME + !! get_xc_potential + !! USAGE + !! + !! PURPOSE + !! Calculates the exchange-correlation potential + !! on the grid within LDA using the Ceperley-Alder + !! interpolation formula. It also calculates the + !! total exchange-correlation energy. + !! + !! Note that this is the Goedecker/Teter/Hutter formula which + !! involves only ratios of polynomials, and is rather easy to + !! differentiate. See PRB 54, 1703 (1996) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! D.R.Bowler + !! CREATION DATE + !! 14:45, 25/03/2003 + !! MODIFICATION HISTORY + !! 2011/12/12 L.Tong + !! Removed third, it is now defined in numbers module + !! 2018/06/11 17:39 dave + !! Bug fix for bug #91 adding factor of spin_factor to account for lack of spin + !! SOURCE + !! + subroutine get_GTH_xc_potential(density, xc_potential, xc_epsilon, & + xc_energy, size) + + use datatypes + use numbers + use global_module, only: io_lun + use GenComms, only: cq_abort, gsum + use dimens, only: grid_point_volume, n_my_grid_points + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), intent(out) :: xc_energy + real(double), dimension(:), intent(in) :: density + real(double), dimension(:), intent(out) :: xc_potential, xc_epsilon + + ! Local variables + integer n + real(double) :: denominator, e_correlation, e_exchange, ln_rs, & + numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & + v_correlation, v_exchange, drs_dRho, t1, t2, dt1, & + dt2 + real(double), parameter :: a0=0.4581652932831429_double + real(double), parameter :: a1=2.217058676663745_double + real(double), parameter :: a2=0.7405551735357053_double + real(double), parameter :: a3=0.01968227878617998_double + real(double), parameter :: b1=1.000000000000000_double + real(double), parameter :: b2=4.504130959426697_double + real(double), parameter :: b3=1.110667363742916_double + real(double), parameter :: b4=0.02359291751427506_double + + xc_energy = zero + do n = 1, n_my_grid_points ! loop over grid pts and store potl on each + rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + if (rho > RD_ERR) then ! Find radius of hole + rcp_rs = ( four*third * pi * rho )**(third) + rs = one/rcp_rs + !if (rs < 0.01_double) write (io_lun, *) 'rs out of range ', n + else + rcp_rs = zero + rs = zero + !write (io_lun, *) 'rho out of range ', n + end if + if (rs > zero) then + drs_dRho = -rs / (3.0 * rho) + t1 = a0 + rs*(a1 + rs * (a2 + rs * a3)) + t2 = rs * (b1 + rs * (b2 + rs * (b3 + rs * b4))) + dt1 = a1 + rs * (2.0 * a2 + rs * 3.0 * a3) + dt2 = b1 + rs * (2.0 * b2 + rs * (3.0 * b3 + rs * 4.0 * b4)) + xc_energy = xc_energy - (t1/t2)*rho + xc_potential(n) = & + -(t1/t2) + rho*drs_dRho * (-dt1 / t2 + t1 * dt2 / (t2 * t2)) + xc_epsilon(n) = -t1/t2 ! 2010.Oct.30 TM + else + xc_potential(n) = zero + end if + end do ! do n_my_grid_points + call gsum(xc_energy) + ! and 'integrate' the energy over the volume of the grid point + xc_energy = xc_energy * grid_point_volume + return + end subroutine get_GTH_xc_potential + !!*** + + !!****f* XC_module/Vxc_of_r_LSDA_PW92 * + !! PURPOSE + !! Calculates the exchange-correlation energy density and + !! potential as a function of rho(r) (evaluated at single grid + !! point r). + !! + !! The LDA Functional is given in Perdew and Wang, PRB 45, 13244 + !! (1992) + !! USAGE + !! To calculate Vx and Vc + !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x, eps_c, Vx, Vc) + !! To calculate Vx or Vc only + !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, Vx=Vx) + !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_c=eps_c, Vx=Vc) + !! To calculate eps_x and/or eps_c without Vx and Vc + !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x) + !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_c=eps_c) + !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, eps_c=eps_c) + !! INPUTS + !! integer nspin : 1 = spin nonpolarised, 2 = spin polarised + !! real(double) rho_r(1:nspin) : value of spin dependent density at r + !! OUTPUT + !! (All are optional) + !! real(double) eps_x : value of exchange energy density at r + !! real(double) eps_c : value of correlation energy density at r + !! real(double) Vx(1:nspin) : value of exchange potential at r + !! real(double) Vc(1:nspin) : value of correlation potential at r + !! AUTHOR + !! L.Tong + !! CREATION DATE + !! 2012/04/25 + !! MODIFICATION HISTORY + !! 2012/05/27 L.Tong + !! - I found that with rounding error, even if rho_r(2) is just tiny + !! bit negative, and rho_r(1) positive, this will make rho_tot + !! still positive and above RD_ERR, and hence pass the zero rho + !! test, but zeta = (rho(1) - rho(2)) / rho_tot will now be + !! greater than one. This makes one - zeta < 0 and hence (one - + !! zeta)**third undefined. Therefore to fix this I added a + !! constraint that zeta must be in between -one and one. + !! - Used separate subroutine PW92_G for G(rs) + !! SOURCE + !! + subroutine Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x, eps_c, Vx, Vc) + + use datatypes + use numbers + use GenComms, only: cq_abort + + implicit none + + ! passed variables + integer, intent(in) :: nspin + real(double), dimension(:), intent(in) :: rho_r + real(double), optional, intent(out) :: eps_x, eps_c + real(double), dimension(:), optional, intent(out) :: Vx, Vc + ! local variables + real(double) :: rho_tot_r, rs, sq_rs, rcp_rs, rcp_sq_rs, zeta, & + eps_c0, deps_c0_drs, eps_c1, deps_c1_drs, alpha_c, & + dalpha_c_drs, f_function, df_function_dzeta, & + alpha_cDfpp0, dalpha_c_drsDfpp0, deps_c_drs, & + deps_c_dzeta + real(double) :: onePzeta, oneMzeta, onePzeta_1_3, oneMzeta_1_3, & + onePzeta_4_3, oneMzeta_4_3, zeta_3, zeta_4, & + factor_4_3, factor_1_3 + ! parameters used for convinience of calculation + real(double), parameter :: K01 = 1.042123522_double ! 2*(9*pi/4)**(-1/3) + real(double), parameter :: K02 = 1.611991954_double ! (4*pi/3)**(1/3) + real(double), parameter :: K03 = -0.458165293_double ! -3/(2*pi*K01) + + ! check passed parameters + if (present(Vx) .and. (.not. present(eps_x))) & + call cq_abort('Vxc_of_r_LSDA_PW92: Vx and eps_x must present & + &at the same time') + if (present(Vc) .and. (.not. present(eps_c))) & + call cq_abort('Vxc_of_r_LSDA_PW92: Vc and eps_c must present & + &at the same time') + + ! get total density + rho_tot_r = rho_r(1) + rho_r(nspin); + + ! catch the case when density is zero + if (rho_tot_r <= RD_ERR) then + if (present(eps_x)) eps_x = zero + if (present(eps_c)) eps_c = zero + if (present(Vx)) Vx = zero + if (present(Vc)) Vc = zero + return + end if + + ! From this point on-wards rho_tot_r is greater than zero + + ! work out rs, 1/rs + rcp_rs = K02 * (rho_tot_r**third) ! this calculates 1/rs + rs = one / rcp_rs + sq_rs = sqrt(rs) + rcp_sq_rs = sqrt(rcp_rs) + + if (nspin == 2) then ! case for spin polarised + + ! zeta related factors + zeta = (rho_r(1) - rho_r(nspin)) / rho_tot_r + ! zeta must be in between -one and one, we need to make sure + ! of this, rounding errors (when rho_r(spin) are small) can + ! sometimes make zeta go outside this range. + zeta = max(-one, zeta) + zeta = min(one, zeta) + onePzeta = one + zeta + oneMzeta = one - zeta + onePzeta_1_3 = onePzeta**third + oneMzeta_1_3 = oneMzeta**third + onePzeta_4_3 = onePzeta * onePzeta_1_3 + oneMzeta_4_3 = oneMzeta * oneMzeta_1_3 + zeta_3 = zeta**3 + zeta_4 = zeta * zeta_3 + factor_4_3 = onePzeta_4_3 + oneMzeta_4_3 + factor_1_3 = onePzeta_1_3 - oneMzeta_1_3 + + ! Exchange Part + ! eps_x: eq (26) PRB 45, 13244 (1992) + if (present(eps_x)) eps_x = half * K03 * rcp_rs * factor_4_3 + ! Vx (exchange potential) + if (present(Vx)) then + Vx(1) = four_thirds * & + (eps_x + oneMzeta * K03 * rcp_rs * half * factor_1_3) + Vx(2) = four_thirds * & + (eps_x - onePzeta * K03 * rcp_rs * half * factor_1_3) + end if + + ! Correlation Part + + if (present(eps_c)) then + + if (present(Vc)) then + ! Work out eps_c0, and deps_c0/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.031091_double, & + alpha1=0.21370_double, & + beta1=7.5957_double, & + beta2=3.5876_double, & + beta3=1.6382_double, & + beta4=0.49294_double, & + p=one, & + G=eps_c0, & + dG_drs=deps_c0_drs) + ! Work out eps_c1 and deps_c1/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.015545_double, & + alpha1=0.20548_double, & + beta1=14.1189_double, & + beta2=6.1977_double, & + beta3=3.3662_double, & + beta4=0.62517_double, & + p=one, & + G=eps_c1, & + dG_drs=deps_c1_drs) + ! Work out alpha_c, and dalpha_c/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.016887_double, & + alpha1=0.11125_double, & + beta1=10.357_double, & + beta2=3.6231_double, & + beta3=0.88026_double, & + beta4=0.49671_double, & + p=one, & + G=alpha_c, & + dG_drs=dalpha_c_drs) + ! note that the table parameters are for -alpha_c + alpha_c = -alpha_c + dalpha_c_drs = -dalpha_c_drs + else ! calculate eps_c only + ! Work out eps_c0, and deps_c0/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.031091_double, & + alpha1=0.21370_double, & + beta1=7.5957_double, & + beta2=3.5876_double, & + beta3=1.6382_double, & + beta4=0.49294_double, & + p=one, & + G=eps_c0) + ! Work out eps_c1 and deps_c1/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.015545_double, & + alpha1=0.20548_double, & + beta1=14.1189_double, & + beta2=6.1977_double, & + beta3=3.3662_double, & + beta4=0.62517_double, & + p=one, & + G=eps_c1) + ! Work out alpha_c, and dalpha_c/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.016887_double, & + alpha1=0.11125_double, & + beta1=10.357_double, & + beta2=3.6231_double, & + beta3=0.88026_double, & + beta4=0.49671_double, & + p=one, & + G=alpha_c) + ! note that the table parameters are for -alpha_c + alpha_c = -alpha_c + end if + + ! Work out f_function eq.(8) PRB 45, 13244 (1992), + ! and df_function/dzeta + f_function = 1.923661051_double * (factor_4_3 - two) + if (present(Vc)) then + df_function_dzeta = 2.564881401_double * (factor_1_3) + end if + + ! Get eps_c, eq.(8) PRB 45, 13244 (1992) + ! alpha_c / f''(0) + alpha_cDfpp0 = 0.584822340_double * alpha_c + eps_c = eps_c0 + & + f_function * (alpha_cDfpp0 * (one - zeta_4) + & + (eps_c1 - eps_c0) * zeta_4) + + if (present(Vc)) then + ! Get deps_c_drs and deps_c_dzeta + ! dalpha_c_drs / f''(0) + dalpha_c_drsDfpp0 = 0.584822340_double * dalpha_c_drs + ! eq.(A2) of PRB 45, 13244 (1992) + deps_c_drs = & + deps_c0_drs + f_function * & + (zeta_4 * (deps_c1_drs - deps_c0_drs - dalpha_c_drsDfpp0) + & + dalpha_c_drsDfpp0) + ! eq.(A3) of PRB 45, 13244 (1992) + deps_c_dzeta = (four * zeta_3 * f_function + & + df_function_dzeta * zeta_4) * & + (eps_c1 - eps_c0 - alpha_cDfpp0) + & + df_function_dzeta * alpha_cDfpp0 + + ! Get Vc + Vc(1) = eps_c - third * rs * deps_c_drs + oneMzeta * deps_c_dzeta + Vc(2) = eps_c - third * rs * deps_c_drs - onePzeta * deps_c_dzeta + end if + + end if ! present(eps_c) + + else ! case for spin non-polarised + + ! Exchange Part + + ! eps_x: eq (26) PRB 45, 13244 (1992) + if (present(eps_x)) eps_x = K03 * rcp_rs + ! Vx (exchange potential) + if (present(Vx)) Vx(1) = four_thirds * eps_x + + ! Correlation Part + + if (present(eps_c)) then + + if (present(Vc)) then + ! Work out eps_c0, and deps_c0/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.031091_double, & + alpha1=0.21370_double, & + beta1=7.5957_double, & + beta2=3.5876_double, & + beta3=1.6382_double, & + beta4=0.49294_double, & + p=one, & + G=eps_c0, & + dG_drs=deps_c0_drs) + else + ! Work out eps_c0, and deps_c0/drs + ! fitting parameters taken from Table I, + ! Phys. Rev. B 45, 13244 (1992) + call PW92_G(rs, & + A=0.031091_double, & + alpha1=0.21370_double, & + beta1=7.5957_double, & + beta2=3.5876_double, & + beta3=1.6382_double, & + beta4=0.49294_double, & + p=one, & + G=eps_c0) + end if + + ! Get eps_c, eq.(8) PRB 45, 13244 (1992) + eps_c = eps_c0 + + if (present(Vc)) then + ! Get deps_c_drs, eq.(A2) of PRB 45, 13244 (1992) + deps_c_drs = deps_c0_drs + ! Get Vc + Vc(1) = eps_c - third * rs * deps_c_drs + end if + + end if ! present(eps_c) + + end if ! if (nspin == 2) + + return + end subroutine Vxc_of_r_LSDA_PW92 + !!***** + + + !!****f* XC_module/get_xc_potential_LSDA_PW92 * + !! + !! NAME + !! get_xc_potential_LSDA_PW92 + !! USAGE + !! + !! PURPOSE + !! Calculates the spin polarized exchange-correlation + !! potential on the grid within LDA using the Ceperley-Alder + !! interpolation formula. It also calculates the total + !! exchange-correlation energy. + !! + !! Note that this is the Perdew-Wang parameterisation of the + !! Ceperley-Alder results for a homogeneous electron gas, as + !! described in Phys. Rev. B 45, 13244 (1992), with Ceperley-Alder + !! in Phys. Rev. Lett. 45, 566 (1980) INPUTS + !! + !! USES + !! + !! AUTHOR + !! L. Tong + !! CREATION DATE + !! 22/03/2011 + !! MODIFICATION HISTORY + !! 2012/03/14 L.Tong + !! - Changed spin implementation + !! 2012/04/03 L.Tong + !! - Added optional variables to output exchange and correlation + !! part of epsilon separately, if required + !! 2012/04/25 L.Tong + !! - Removed the optional variables for separate exchange and + !! correlation energy densities, these are now covered in + !! subroutine Vxc_of_r_LSDA_PW92 + !! - Moved all the local point-wise calculations of epsilon and + !! potential to subroutine Vxc_of_r_LSDA_PW92, this allows the + !! point-wise calculations to be done in other parts of the + !! program if required---this saves a lot of memory in vdWDFT + !! calculations. + !! 2014/09/24 L.Truflandier + !! - Added optional x_energy_total for output + !! SOURCE + !! + subroutine get_xc_potential_LSDA_PW92(density, xc_potential, & + xc_epsilon, xc_energy_total, & + size, x_energy_total ) + + use datatypes + use numbers + use GenComms, only: cq_abort, gsum + use dimens, only: grid_point_volume, n_my_grid_points + use global_module, only: nspin + + implicit none + + ! Passed variables + ! size of the real space grid + integer, intent(in) :: size + real(double), dimension(:,:), intent(in) :: density + real(double), dimension(:,:), intent(out) :: xc_potential + real(double), dimension(:), intent(out) :: xc_epsilon + real(double), intent(out) :: xc_energy_total + real(double), optional, intent(out) :: x_energy_total + + ! Local variables + integer :: rr, spin + real(double) :: eps_x, eps_c, rho_tot_r + real(double), dimension(nspin) :: rho_r, Vx, Vc + + ! initialisation + if (present(x_energy_total)) x_energy_total = zero + xc_energy_total = zero + + ! loop over grid points on each node + do rr = 1, n_my_grid_points + rho_r(1:nspin) = density(rr,1:nspin) + rho_tot_r = rho_r(1) + rho_r(nspin) + call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, eps_c=eps_c,& + Vx=Vx, Vc=Vc) + + xc_epsilon(rr) = eps_x + eps_c + xc_potential(rr,1:nspin) = Vx(1:nspin) + Vc(1:nspin) + xc_energy_total = xc_energy_total + xc_epsilon(rr) * rho_tot_r + if (present(x_energy_total)) x_energy_total = x_energy_total + eps_x * rho_tot_r + end do + call gsum(xc_energy_total) + if (present(x_energy_total)) call gsum(x_energy_total) + + xc_energy_total = xc_energy_total * grid_point_volume + if (present(x_energy_total)) x_energy_total = x_energy_total * grid_point_volume + + return + end subroutine get_xc_potential_LSDA_PW92 + !!*** + + + !!****f* XC_module/eps_xc_of_r_GGA_PBE + !! PURPOSE + !! Calculates the exchange and correlation energy density and its + !! derivatives for the PBE functional and its variants at any + !! local values of rho(r) and grad rho(r). + !! + !! The exact flavour of the PBE functional is choosen by flavour + !! parameter: + !! + !! flavour = functional_gga_pbe96 + !! use original PBE, PRL 77, 3865 (1996) + !! flavour = functional_gga_pbe96_rev98: + !! use revPBE, PRL 80, 890 (1998) + !! flavour = functional_gga_pbe96_r99: + !! use RPBE, PRB 59, 7413 (1999) + !! flavour = functional_gga_pbe96_wc: + !! use Wu-Cohen, PRB 73, 235116 (2006) + !! USAGE + !! INPUTS + !! integer nspin : nspin = 1 for spin non-polarised, + !! nspin = 2 for spin polarised + !! integer flavour : flavour of PBE GGA to use + !! real(double) rho_r(1:nspin) : value of spin density at some point r + !! real(double) grho_r(3,1:nspin) : vector gradient of spin density at r + !! OUTPUT + !! All outputs are optional + !! real(double) eps_x : value of exchange energy density at r + !! real(double) eps_c : value of correlation energy density at r + !! real(double) drhoEps_x(0:3,1:nspin) : drhoEps_x(0,spin) = + !! d(rho_tot_r * eps_x) / drho(spin) + !! drhoEps_x(1:3,spin) = + !! d(rho_tot_r * eps_x) / dgrho(1:3,spin) + !! real(double) drhoEps_c(0:3,1:nspin) : drhoEps_c(0,spin) = + !! d(rho_tot_r * eps_c) / drho(spin) + !! drhoEps_x(1:3,spin) = + !! d(rho_tot_r * eps_c) / dgrho(1:3,spin) + !! + !! (where rho_tot_r = rho_r(1) + rho_r(nspin)) + !! RETURN VALUE + !! AUTHOR + !! L.Tong + !! CREATION DATE + !! 2012/04/25 + !! MODIFICATION HISTORY + !! 2018/06/15 12:25 dave + !! Removed local spin_factor variable (now use equivalent from global_module) + !! SOURCE + !! + subroutine eps_xc_of_r_GGA_PBE(nspin, flavour, rho_r, grho_r, eps_x,& + eps_c, drhoEps_x, drhoEps_c) + use datatypes + use numbers + use GenComms, only: cq_abort + + implicit none + + ! passed parameters + integer, intent(in) :: nspin + integer, intent(in) :: flavour + real(double), dimension(:), intent(in) :: rho_r + real(double), dimension(:,:), intent(in) :: grho_r + real(double), optional, intent(out) :: eps_x, eps_c + real(double), dimension(0:3,nspin), optional, intent(out) :: & + drhoEps_x, drhoEps_c + ! local variables + integer :: spin, Fx_selector, ii + real(double) :: rho_tot_r, rho_tot_s, mod_grho_tot_r, & + mod_grho_tot_s, eps_x_unif, Fx, grho_tot_s_ii, & + dFx_dgrho + real(double) :: rs, kF, eps_c_unif, ks, zeta, phi, t, A, H + real(double) :: drs_drho, dkF_drho, dphi_drho, dphi_dzeta, & + deps_c_unif_drho, dH_drho, dH_dgrho, dks_drho, & + dA_drho + real(double) :: kappa, mu_kappa, s, s2, kFs, dkFs_drho, F1, F2, & + F3, F4, dFx_drho, ds_drho, ds_dgrho, dt_drho, & + dt_dgrho, dF1_drho, dF2_drho, dF3_drho, dF4_drho, & + dF3_dgrho, dF4_dgrho, Xwc, dXwc_ds, dF1_dgrho + real(double), dimension(1) :: rho_s + real(double), dimension(1:3,1) :: grho_s + real(double), dimension(1:3) :: grho_tot_r + real(double), dimension(1:nspin) :: mod_grho_r, Vx_unif, Vc_unif, & + dzeta_drho + ! constants + ! From PRL 77, 3865 (1996) + real(double), parameter :: mu = 0.2195149727645171_double + real(double), parameter :: beta = 0.066725_double + real(double), parameter :: gamma = 0.031091_double + real(double), parameter :: kappa_ori = 0.804_double + ! From PRL 80, 890 (1998) + real(double), parameter :: kappa_alt = 1.245_double + ! From PRB 73, 235116 (2006) - Wu-Cohen + real(double), parameter :: teneightyone = 0.123456790123_double ! 10/81 + real(double), parameter :: c_wc = 0.00793746933516_double + ! Precalculated constants + real(double), parameter :: mu_kappa_ori = 0.27302_double ! mu/kappa_ori + real(double), parameter :: mu_kappa_alt = 0.17631_double ! mu/kappa_alt + real(double), parameter :: two_mu = 0.4390299455290342_double ! 2 * mu + real(double), parameter :: beta_gamma = 2.146119_double ! beta/gamma + ! minimum value of rho_tot_r and mod_grho_tot_r allowed + real(double), parameter :: min_rho = RD_ERR + real(double), parameter :: min_mod_grho = RD_ERR + ! Fx_selector options + integer, parameter :: Fx_ori = 1 + integer, parameter :: Fx_alt = 2 + integer, parameter :: Fx_wc = 3 ! Wu-Cohen Exchange + + ! check optional outputs + if (present(drhoEps_x) .and. (.not. present(eps_x))) & + call cq_abort('eps_xc_of_r_GGA_PBE: both drhoEps_x and eps_x & + &must be present') + if (present(drhoEps_c) .and. (.not. present(eps_c))) & + call cq_abort('eps_xc_of_r_GGA_PBE: both drhoRps_c and eps_c & + &must be present') + + ! choose between PBE and revPBE parameters + select case (flavour) + case (functional_gga_pbe96) + Fx_selector = Fx_ori + kappa = kappa_ori + mu_kappa = mu_kappa_ori + case (functional_gga_pbe96_rev98) + Fx_selector = Fx_ori + kappa = kappa_alt + mu_kappa = mu_kappa_alt + case (functional_gga_pbe96_r99) + Fx_selector = Fx_alt + kappa = kappa_ori + mu_kappa = mu_kappa_ori + case (functional_gga_pbe96_wc) + Fx_selector = Fx_wc + kappa = kappa_ori + mu_kappa = mu_kappa_ori + case default + call cq_abort('eps_xc_of_r_GGA_PBE: flavour undefined', flavour) + end select + + ! work out total density and its gradient + rho_tot_r = rho_r(1) + rho_r(nspin) + rho_tot_r = max(min_rho, rho_tot_r) + grho_tot_r(1:3) = grho_r(1:3,1) + grho_r(1:3,nspin) + do spin = 1, nspin + mod_grho_r(spin) = & + sqrt(grho_r(1,spin)**2 + grho_r(2,spin)**2 + grho_r(3,spin)**2) + end do + mod_grho_tot_r = & + sqrt(grho_tot_r(1)**2 + grho_tot_r(2)**2 + grho_tot_r(3)**2) + mod_grho_tot_r = max(min_mod_grho, mod_grho_tot_r) + + ! Exchange part + if (present(eps_x)) then + + eps_x = zero + + do spin = 1, nspin + ! rho_s = 2 * rho_r(spin), grho_s = 2 * |grho(spin)| + rho_s(1) = rho_r(spin) + rho_tot_s = max(min_rho, two * rho_s(1)) + mod_grho_tot_s = max(min_mod_grho, two * mod_grho_r(spin)) + kFs = (three * pi**2 * rho_tot_s)**third + s = mod_grho_tot_s / (two * kFs * rho_tot_s) + s2 = s*s + ! choose the Fx flavour + select case (Fx_selector) + case (Fx_ori) + F1 = one + mu_kappa * s2 + Fx = one + kappa - kappa / F1 + case (Fx_alt) + F1 = exp(-mu_kappa * s2) + Fx = one + kappa * (one - F1) + case (Fx_wc) ! Wu-Cohen exchange + Xwc = teneightyone * s2 + (mu - teneightyone) * & + s2 * exp(-s2) + log(one + c_wc * s2*s2) + + F1 = one + Xwc / kappa + Fx = one + kappa - kappa / F1 + + dXwc_ds = two * teneightyone * s + & + (mu - teneightyone) * exp(-s2) * two*s * (one - s2) + & + four * c_wc * s*s2 / (one + c_wc * s2*s2) + end select + + call Vxc_of_r_LSDA_PW92(1, rho_s, eps_x=eps_x_unif, Vx=Vx_unif) + + ! accumulate eps_x in spin components + eps_x = eps_x + rho_tot_s * eps_x_unif * Fx + + ! calculate the derivative of rho_tot_r * eps_x + if (present(drhoEps_x)) then + dkFs_drho = third * kFs / rho_tot_s + ds_drho = s * (-(dkFs_drho / kFs) - one / rho_tot_s) + select case (Fx_selector) + case (Fx_ori) + dFx_drho = two_mu * s * ds_drho / (F1 * F1) + case (Fx_alt) + dFx_drho = two_mu * s * ds_drho * F1 + case (Fx_wc) + dF1_drho = dXwc_ds * ds_drho / kappa + dFx_drho = kappa * dF1_drho / (F1*F1) + + end select + ! get drhoEps_x / drho(spin) + drhoEps_x(0,spin) = Vx_unif(1) * Fx + & + rho_tot_s * eps_x_unif * dFx_drho + ! get drhoEps_x / dgrho(spin) + do ii = 1, 3 + grho_tot_s_ii = two * grho_r(ii,spin) + ds_dgrho = (s / mod_grho_tot_s) * grho_tot_s_ii / mod_grho_tot_s + select case (Fx_selector) + case (Fx_ori) + dFx_dgrho = two_mu * s * ds_dgrho / (F1 * F1) + case (Fx_alt) + dFx_dgrho = two_mu * s * ds_dgrho * F1 + case (Fx_wc) + dF1_dgrho = dXwc_ds * ds_dgrho / kappa + dFx_dgrho = kappa * dF1_dgrho / (F1 * F1) + end select + drhoEps_x(ii,spin) = rho_tot_s * eps_x_unif * dFx_dgrho + end do + end if ! present(drhoEps_x) + end do ! spin + + ! get eps_x + eps_x = half * spin_factor * eps_x / rho_tot_r + + end if ! present(eps_x) + + ! Correlation part + if (present(eps_c)) then + + ! Find local correlation energy and potential + call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_c=eps_c_unif, Vc=Vc_unif) + + ! Find energy denisty for correlation eps_c + rs = (three / (four * pi * rho_tot_r))**third + kF = (three * pi**2 * rho_tot_r)**third + ks = sqrt(four * kF / pi) + + if (nspin == 2) then + + ! zeta related terms + zeta = (rho_r(1) - rho_r(2)) / rho_tot_r + ! bound zeta within -1 and 1 + zeta = max(-one + min_rho, zeta) + zeta = min(one - min_rho, zeta) + phi = half * ((one + zeta)**two_thirds + (one - zeta)**two_thirds) + t = mod_grho_tot_r / (two * phi * ks * rho_tot_r) + F1 = eps_c_unif / gamma / phi**3 + F2 = exp(-F1) + ! add RD_ERR in denominator to avoid div by 0 + A = beta_gamma / (F2 - one + RD_ERR) + F3 = t**2 + A * t**4 + F4 = beta_gamma * F3 / (one + A * F3) + H = gamma * phi**3 * log(one + F4) + ! get eps_c + eps_c = eps_c_unif + H + + ! get drhoEps_c + if (present(drhoEps_c)) then + drs_drho = - (third * rs / rho_tot_r) + dkF_drho = third * kF / rho_tot_r + dks_drho = half * ks * dkF_drho / kF + dzeta_drho(1) = (one - zeta) / rho_tot_r + dzeta_drho(2) = - (one + zeta) / rho_tot_r + dphi_dzeta = half * two_thirds * & + (one / (one + zeta)**third - one / (one - zeta)**third) + do spin = 1, nspin + deps_c_unif_drho = (Vc_unif(spin) - eps_c_unif) / rho_tot_r + dphi_drho = dphi_dzeta * dzeta_drho(spin) + dt_drho = (- t) * (dphi_drho / phi + dks_drho / ks + & + one / rho_tot_r) + ! add RD_ERR to denominator to avoid div by 0 + dF1_drho = F1 * (deps_c_unif_drho / (eps_c_unif + RD_ERR) - & + three * dphi_drho / phi) + dF2_Drho = (- F2) * dF1_drho + ! add RD_ERR to denominator to avoid div by 0 + dA_drho = A * dF2_drho / (one - F2 + RD_ERR) + dF3_drho = (two * t + four * A * t**3) * dt_drho + dA_drho * t**4 + dF4_drho = F4 * (dF3_drho / F3 - & + (dA_drho * F3 + A * DF3_drho) / (one + A * F3)) + dH_drho = three * H * dphi_drho / phi + & + gamma * phi**3 * DF4_drho / (one + F4) + ! get drhoEps_c / drho(spin) + drhoEps_c(0,spin) = Vc_unif(spin) + H + rho_tot_r * dH_drho + do ii = 1, 3 + dt_dgrho = (t / mod_grho_tot_r) * & + grho_tot_r(ii) / mod_grho_tot_r + dF3_dgrho = dt_dgrho * (two * t + four * A * t**3) + dF4_dgrho = F4 * dF3_dgrho * (one / F3 - A / (one + A * F3)) + dH_dgrho = gamma * phi**3 * dF4_dgrho / (one + F4) + drhoEps_c(ii,spin) = rho_tot_r * dH_dgrho + end do + end do ! spin + end if ! present(rhoEps_c) + + else ! spin non-polarised case + + phi = one + t = mod_grho_tot_r / (two * ks * rho_tot_r) + F1 = eps_c_unif / gamma + F2 = exp(-F1) + ! add RD_ERR in denominator to avoid div by 0 + A = beta_gamma / (F2 - one + RD_ERR) + F3 = t**2 + A * t**4 + F4 = beta_gamma * F3 / (one + A * F3) + H = gamma * log(one + F4) + ! get eps_c + eps_c = eps_c_unif + H + + ! get drhoEps_c / drho + if (present(drhoEps_c)) then + drs_drho = - (third * rs / rho_tot_r) + dkF_drho = third * kF / rho_tot_r + dks_drho = half * ks * dkF_drho / kF + deps_c_unif_drho = (Vc_unif(1) - eps_c_unif) / rho_tot_r + dt_drho = (- t) * (dks_drho / ks + one / rho_tot_r) + ! add RD_ERR to denominator to avoid div by 0 + dF1_drho = F1 * (deps_c_unif_drho / (eps_c_unif + RD_ERR)) + dF2_Drho = (- F2) * dF1_drho + ! add RD_ERR to denominator to avoid div by 0 + dA_drho = A * dF2_drho / (one - F2 + RD_ERR) + dF3_drho = (two * t + four * A * t**3) * dt_drho + dA_drho * t**4 + dF4_drho = F4 * (dF3_drho / F3 - & + (dA_drho * F3 + A * DF3_drho) / (one + A * F3)) + + dH_drho = gamma * DF4_drho / (one + F4) + + ! get drhoEps_c / drho(spin) + drhoEps_c(0,1) = Vc_unif(1) + H + rho_tot_r * dH_drho + do ii = 1, 3 + dt_dgrho = (t / mod_grho_tot_r) * grho_tot_r(ii) / mod_grho_tot_r + dF3_dgrho = dt_dgrho * (two * t + four * A * t**3) + dF4_dgrho = F4 * dF3_dgrho * (one / F3 - A / (one + A * F3)) + dH_dgrho = gamma * dF4_dgrho / (one + F4) + drhoEps_c(ii,1) = rho_tot_r * dH_dgrho + end do + end if ! present(drhoEps_c) + + end if ! nspin + + end if ! presnet(eps_c) + + return + end subroutine eps_xc_of_r_GGA_PBE + !!***** + + + !!****f* XC_module/get_xc_potential_GGA_PBE + !! PURPOSE + !! Calculates the exchange-correlation potential + !! on the grid within GGA using three flavours of + !! Perdew-Burke-Ernzerhof. It also calculates the + !! total exchange-correlation energy. + !! + !! flavour not defined + !! use original PBE, PRL 77, 3865 (1996) + !! flavour = functional_gga_pbe96_rev98: + !! use revPBE, PRL 80, 890 (1998) + !! flavour = functional_gga_pbe96_r99: + !! use RPBE, PRB 59, 7413 (1999) + !! + !! USAGE + !! call get_xc_potential_GGA_PBE(density, xc_potential, & + !! xc_epsilon, xc_energy, size,& + !! flavour) + !! INPUTS + !! integer size : size of the real space grid + !! integer flavour : flavour of PBE functional (optional) + !! real(double) density(size,nspin) : spin dependent density + !! OUTPUT + !! real(double) xc_energy : total xc-energy (sum over spin) + !! real(double) xc_epsilon(size) : xc-energy density + !! real(double) xc_potential(size,nspin) : xc-potnetial + !! AUTHOR + !! L.Tong + !! CREATION DATE + !! 2012/04/27 + !! MODIFICATION HISTORY + !! 2014/09/24 L.Truflandier + !! - Added optional x_energy_total for output + !! 2015/05/12 08:30 dave + !! - Added stress term + !! 2017/08/29 jack baker & dave + !! Removed rcellx references (redundant) + !! 2018/06/15 12:25 dave + !! Removed spin_factor from use statement (global to module now) + !! 2019/05/13 10:36 dave + !! Bug fix for generalised stress + !! SOURCE + !! + subroutine get_xc_potential_GGA_PBE(density, xc_potential, & + xc_epsilon, xc_energy, grid_size, & + flavour, x_energy ) + use datatypes + use numbers + use global_module, only: nspin, flag_full_stress, flag_stress + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum, cq_abort + use fft_module, only: fft3, recip_vector + use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl + + implicit none + + ! passed variables + integer, intent(in) :: grid_size + real(double), dimension(:,:), intent(in) :: density + real(double), dimension(:), intent(out) :: xc_epsilon + real(double), dimension(:,:), intent(out) :: xc_potential + real(double), intent(out) :: xc_energy + real(double), optional, intent(out) :: x_energy + integer, optional, intent(in) :: flavour + + ! local variables + integer :: PBE_type + integer :: rr, spin, stat, dir1, dir2 + real(double) :: eps_x, eps_c, rho_tot_r + real(double), dimension(nspin) :: rho_r + real(double), dimension(3,nspin) :: grho_r + real(double), dimension(0:3,nspin) :: drhoEps_x, drhoEps_c + real(double), dimension(:,:,:), allocatable :: grad_density + real(double), dimension(:), allocatable :: second_term + complex(double_cplx), dimension(:,:), allocatable :: rcp_drhoEps_xc + + allocate(grad_density(grid_size,3,nspin), second_term(grid_size), & + rcp_drhoEps_xc(grid_size,3), STAT=stat) + if (stat /= 0) & + call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) + call reg_alloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) + + if (present(flavour)) then + PBE_type = flavour + else + PBE_type = functional_gga_pbe96 + end if + + ! initialisation + if (present(x_energy)) x_energy = zero + grad_density = zero + xc_epsilon = zero + xc_potential = zero + xc_energy = zero + XC_GGA_stress = zero + + ! Build the gradient of the density + do spin = 1, nspin + call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) + end do + + do rr = 1, n_my_grid_points + rho_tot_r = density(rr,1) + density(rr,nspin) + do spin = 1, nspin + rho_r(spin) = density(rr,spin) + grho_r(1:3,spin) = grad_density(rr,1:3,spin) + end do + call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & + eps_x=eps_x, eps_c=eps_c, & + drhoEps_x=drhoEps_x, & + drhoEps_c=drhoEps_c) + xc_epsilon(rr) = eps_x + eps_c + xc_energy = xc_energy + rho_tot_r * xc_epsilon(rr) + if (present(x_energy)) x_energy = x_energy + rho_tot_r * eps_x + ! for potential + do spin = 1, nspin + xc_potential(rr,spin) = drhoEps_x(0,spin) + drhoEps_c(0,spin) + ! note that grad_density(rr,1:3,1:spin) has already been used + ! at this point, so we can savely reuse this slot to store + ! d(rho * eps_xc) / dgrho at rr. + grad_density(rr,1:3,spin) = drhoEps_x(1:3,spin) + drhoEps_c(1:3,spin) + do dir1=1,3 + if (flag_stress) then + if (flag_full_stress) then + do dir2=1,3 + XC_GGA_stress(dir1,dir2) = XC_GGA_stress(dir1,dir2) - & + grho_r(dir1,spin)*grad_density(rr,dir2,spin) + end do + else + XC_GGA_stress(dir1,dir1) = XC_GGA_stress(dir1,dir1) - & + grho_r(dir1,spin)*grad_density(rr,dir1,spin) + end if + end if + end do + end do + end do ! rr + call gsum(xc_energy) + if (present(x_energy)) call gsum(x_energy) + xc_energy = xc_energy * grid_point_volume + if (flag_stress) then + call gsum(XC_GGA_stress,3,3) + XC_GGA_stress = XC_GGA_stress*grid_point_volume + end if + !write(*,*) 'GGA stress term: ',XC_GGA_stress + if (present(x_energy)) x_energy = x_energy * grid_point_volume + + ! add the second term to potential + do spin = 1, nspin + ! initialise for each spin + rcp_drhoEps_xc = zero + second_term = zero + ! FFT drhoEps_xc / dgrho(spin) to reciprocal space + call fft3(grad_density(:,1,spin), rcp_drhoEps_xc(:,1), grid_size, -1) + call fft3(grad_density(:,2,spin), rcp_drhoEps_xc(:,2), grid_size, -1) + call fft3(grad_density(:,3,spin), rcp_drhoEps_xc(:,3), grid_size, -1) + + ! dot product with i * recip_vectors, and store in the first + ! component of rcp_drhoEps_xc (used as temp storage) + rcp_drhoEps_xc(:,1) = & + rcp_drhoEps_xc(:,1) * minus_i * recip_vector(:,1) + & + rcp_drhoEps_xc(:,2) * minus_i * recip_vector(:,2) + & + rcp_drhoEps_xc(:,3) * minus_i * recip_vector(:,3) + + ! FFT back to obtain the convolution + call fft3(second_term(:), rcp_drhoEps_xc(:,1), grid_size, +1) + ! accumulate to potential + do rr = 1, n_my_grid_points + xc_potential(rr,spin) = xc_potential(rr,spin) + second_term(rr) + end do + end do ! spin + + deallocate(grad_density, second_term, rcp_drhoEps_xc, STAT=stat) + if (stat /= 0) & + call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") + call reg_dealloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) + + end subroutine get_xc_potential_GGA_PBE + !!***** + + + !!****f* XC_module/get_xc_potential_hyb_PBE0 + !! PURPOSE + !! + !! Work routine based on get_xc_potential_GGA_PBE. + !! It will be recoded in near futur to handle any hybrid functional. + !! For now just handle one coefficient as in PBE0. + !! USAGE + !! + !! INPUTS + !! + !! integer size : size of the real space grid + !! integer flavour : flavour of PBE functional (optional) + !! real(double) density(size,nspin) : spin dependent density + !! OUTPUT + !! real(double) xc_energy : total xc-energy (sum over spin) + !! real(double) x_energy : exchange energy only (sum over spin) + !! real(double) xc_epsilon(size) : xc-energy density + !! real(double) xc_potential(size,nspin) : xc-potential + !! + !! AUTHOR + !! L.Tong/L.Truflandier + !! CREATION DATE + !! 2014/09/24 + !! MODIFICATION HISTORY + !! 2015/09/03 17:27 dave + !! Added GGA XC stress term + !! 2017/08/29 jack baker & dave + !! Removed rcellx references (redundant) + !! 2018/06/15 12:25 dave + !! Removed spin_factor from use statement (global to module now) + !! SOURCE + !! + subroutine get_xc_potential_hyb_PBE0(density, xc_potential, exx_a, & + xc_epsilon, xc_energy, grid_size, & + flavour, x_energy ) + use datatypes + use numbers + use global_module, only: nspin, flag_full_stress, flag_stress + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum, cq_abort + use fft_module, only: fft3, recip_vector + use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl + + implicit none + + ! passed variables + integer, intent(in) :: grid_size + real(double), dimension(:,:), intent(in) :: density + real(double), dimension(:), intent(out) :: xc_epsilon + real(double), dimension(:,:), intent(out) :: xc_potential + real(double), intent(out) :: xc_energy + real(double), optional, intent(out) :: x_energy + integer, optional, intent(in) :: flavour + real(double), intent(in) :: exx_a + + ! local variables + integer :: PBE_type + integer :: rr, spin, stat, dir1, dir2 + real(double) :: eps_x, eps_c, rho_tot_r + real(double), dimension(nspin) :: rho_r + real(double), dimension(3,nspin) :: grho_r + real(double), dimension(0:3,nspin) :: drhoEps_x, drhoEps_c + real(double), dimension(:,:,:), allocatable :: grad_density + real(double), dimension(:), allocatable :: second_term + complex(double_cplx), dimension(:,:), allocatable :: rcp_drhoEps_xc + + allocate(grad_density(grid_size,3,nspin), second_term(grid_size), & + rcp_drhoEps_xc(grid_size,3), STAT=stat) + if (stat /= 0) & + call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) + call reg_alloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) + + if (present(flavour)) then + PBE_type = flavour + else + PBE_type = functional_gga_pbe96 + end if + + ! setup exx_a + + ! Initialisation + if (present(x_energy)) x_energy = zero + grad_density = zero + xc_epsilon = zero + xc_potential = zero + xc_energy = zero + + ! Build the gradient of the density + do spin = 1, nspin + call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) + end do + + do rr = 1, n_my_grid_points + rho_tot_r = density(rr,1) + density(rr,nspin) + do spin = 1, nspin + rho_r(spin) = density(rr,spin) + grho_r(1:3,spin) = grad_density(rr,1:3,spin) + end do + call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & + eps_x =eps_x, & + eps_c =eps_c, & + drhoEps_x=drhoEps_x, & + drhoEps_c=drhoEps_c) + xc_epsilon(rr) = exx_a * eps_x + eps_c + xc_energy = xc_energy + rho_tot_r * xc_epsilon(rr) + if (present(x_energy)) x_energy = x_energy + exx_a * rho_tot_r * eps_x + ! for potential + do spin = 1, nspin + xc_potential(rr,spin) = exx_a * drhoEps_x(0,spin) + drhoEps_c(0,spin) + ! note that grad_density(rr,1:3,1:spin) has already been used + ! at this point, so we can savely reuse this slot to store + ! d(rho * eps_xc) / dgrho at rr. + grad_density(rr,1:3,spin) = exx_a * drhoEps_x(1:3,spin) + drhoEps_c(1:3,spin) + do dir1=1,3 + if (flag_stress) then + if (flag_full_stress) then + do dir2=1,3 + XC_GGA_stress(dir1,dir2) = XC_GGA_stress(dir1,dir2) - & + grho_r(dir1,spin) * grad_density(rr,dir2,spin) + end do ! dir2 + else + XC_GGA_stress(dir1,dir1) = XC_GGA_stress(dir1,dir1) - & + grho_r(dir1,spin) * grad_density(rr,dir1,spin) + end if + end if + end do ! dir1 + end do ! spin + end do ! rr + call gsum(xc_energy) + if (present(x_energy)) call gsum(x_energy) + xc_energy = xc_energy * grid_point_volume + if (flag_stress) then + call gsum(XC_GGA_stress,3,3) + XC_GGA_stress = XC_GGA_stress*grid_point_volume + end if + if (present(x_energy)) x_energy = x_energy * grid_point_volume + + ! add the second term to potential + do spin = 1, nspin + ! initialise for each spin + rcp_drhoEps_xc = zero + second_term = zero + ! FFT drhoEps_xc / dgrho(spin) to reciprocal space + call fft3(grad_density(:,1,spin), rcp_drhoEps_xc(:,1), grid_size, -1) + call fft3(grad_density(:,2,spin), rcp_drhoEps_xc(:,2), grid_size, -1) + call fft3(grad_density(:,3,spin), rcp_drhoEps_xc(:,3), grid_size, -1) + + ! dot product with i * recip_vectors, and store in the first + ! component of rcp_drhoEps_xc (used as temp storage) + rcp_drhoEps_xc(:,1) = & + rcp_drhoEps_xc(:,1) * minus_i * recip_vector(:,1) + & + rcp_drhoEps_xc(:,2) * minus_i * recip_vector(:,2) + & + rcp_drhoEps_xc(:,3) * minus_i * recip_vector(:,3) + + ! FFT back to obtain the convolution + call fft3(second_term(:), rcp_drhoEps_xc(:,1), grid_size, +1) + ! accumulate to potential + do rr = 1, n_my_grid_points + xc_potential(rr,spin) = xc_potential(rr,spin) + second_term(rr) + end do + end do ! spin + + deallocate(grad_density, second_term, rcp_drhoEps_xc, STAT=stat) + if (stat /= 0) & + call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") + call reg_dealloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) + + return + end subroutine get_xc_potential_hyb_PBE0 + !!***** + + !!****f* XC/get_xc_energy * + !! + !! NAME + !! get_xc_energy + !! USAGE + !! + !! PURPOSE + !! Interface to CQ routines + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2021/07/22 + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_xc_energy(density, xc_energy, size) + + use datatypes + use numbers + use global_module, only: exx_niter, exx_siter, exx_alpha, nspin + + implicit none + + ! Passed variables + integer :: size + real(double) :: xc_energy + real(double), dimension(size,nspin) :: density + + ! Local variables + real(double) :: loc_x_energy, exx_tmp + + if(flag_use_libxc) then + call get_libxc_energy(density, xc_energy, size) + else + select case(flag_functional_type) + case (functional_lda_pz81) + ! NOT SPIN POLARISED + call get_xc_energy_LDA_PZ81(density(:,1), xc_energy, size) + ! + ! + case (functional_lda_gth96) + ! NOT SPIN POLARISED + call get_GTH_xc_energy(density(:,1), xc_energy, size) + ! + ! + case (functional_lda_pw92) + call get_xc_energy_LSDA_PW92(density, xc_energy, size) + ! + ! + case (functional_gga_pbe96) + call get_xc_energy_GGA_PBE(density, xc_energy, size) + ! + ! + case (functional_gga_pbe96_rev98) + call get_xc_energy_GGA_PBE(density, xc_energy, size, functional_gga_pbe96_rev98 ) + ! + ! + case (functional_gga_pbe96_r99) + call get_xc_energy_GGA_PBE(density, xc_energy, size, functional_gga_pbe96_r99 ) + ! + ! + case (functional_gga_pbe96_wc) + call get_xc_energy_GGA_PBE(density, xc_energy, size, functional_gga_pbe96_wc ) + ! + ! + case (functional_hyb_pbe0) + ! + if ( exx_niter <= exx_siter ) then + exx_tmp = one + else + exx_tmp = one - exx_alpha + end if + ! + call get_xc_energy_hyb_PBE0(density, xc_energy, size, exx_tmp, functional_gga_pbe96 ) + ! + ! + case (functional_hartree_fock) + ! **** + ! not optimal but experimental + if (exx_niter <= exx_siter) then + ! for the first call of get_H_matrix using Hartree-Fock method + ! to get something not to much stupid ; use pure exchange functional + ! in near futur such as Xalpha + call get_xc_energy_LSDA_PW92(density, xc_energy, size) + else + xc_energy = zero + end if + ! + ! + case default + call get_xc_energy_LSDA_PW92(density, xc_energy, size) + ! + ! + end select + end if + return + end subroutine get_xc_energy + !!*** + + !!****f* XC_module/get_xc_energy_LDA_PZ81 * + !! + !! NAME + !! get_xc_energy_LDA_PZ81 + !! USAGE + !! + !! PURPOSE + !! Calculates the exchange-correlation energy + !! on the grid within LDA using the Ceperley-Alder + !! interpolation formula. + !! + !! Note that this is the Perdew-Zunger parameterisation of the + !! Ceperley-Alder results for a homogeneous electron gas, as + !! described in Phys. Rev. B 23, 5048 (1981), with Ceperley-Alder in + !! Phys. Rev. Lett. 45, 566 (1980) + !! Exchange energy: It can be found in: + !! Phys. Rev. B 45, 13244 (1992) + !! **See Eq. 26 + !! Correlation energy: The correlation functional is PZ-81 + !! Phys. Rev. B 23, 5048 (1981) + !! **See Appendix C, and specially Table XII, + !! Eq. C1 for the xc hole (rs), + !! Eqs. C3 & C4, for rs > 1 and + !! Eqs. C5 & C6, for rs < 1 + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! E.H.Hernandez/DRB + !! CREATION DATE + !! 02/03/95 and 2021/07/22 + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_xc_energy_LDA_PZ81(density, xc_energy, size) + + use datatypes + use numbers + use GenComms, only: gsum + use dimens, only: grid_point_volume, n_my_grid_points + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), intent(out) :: xc_energy + real(double), dimension(:), intent(in) :: density + + ! Local variables + integer :: n + real(double) :: denominator, e_correlation, e_exchange, ln_rs, & + numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & + v_correlation, v_exchange + real(double), parameter :: alpha = -0.45817_double + real(double), parameter :: beta_1 = 1.0529_double + real(double), parameter :: beta_2 = 0.3334_double + real(double), parameter :: gamma = -0.1423_double + real(double), parameter :: p = 0.0311_double + real(double), parameter :: q = -0.048_double + real(double), parameter :: r = 0.0020_double + real(double), parameter :: s = -0.0116_double + + xc_energy = zero + + do n = 1, n_my_grid_points ! loop over grid pts and store potl on each + rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + if (rho > RD_ERR) then ! Find radius of hole + rcp_rs = ( four_thirds * pi * rho )**(third) + else + rcp_rs = zero + end if + e_exchange = alpha * rcp_rs + if (rcp_rs>zero) then + rs = one/rcp_rs + else + rs = zero + end if + sq_rs = sqrt(rs) + if (rs>=one) then + denominator = one / (one + beta_1 * sq_rs + beta_2 * rs) + numerator = one + seven_sixths * beta_1 * sq_rs + & + four_thirds * beta_2 * rs + e_correlation = gamma * denominator + else if ((rsRD_ERR)) then + ln_rs = log(rs) + rs_ln_rs = rs * ln_rs + e_correlation = p * ln_rs + q + r * rs_ln_rs + s * rs + else + e_correlation = zero + end if + xc_energy = xc_energy + (e_exchange + e_correlation) * spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + end do ! do n_my_grid_points + call gsum(xc_energy) + ! and 'integrate' the energy over the volume of the grid point + xc_energy = xc_energy * grid_point_volume + + return + end subroutine get_xc_energy_LDA_PZ81 + !!*** + + + !!****f* XC_module/get_GTH_xc_energy * + !! + !! NAME + !! get_xc_energy + !! USAGE + !! + !! PURPOSE + !! Calculates the exchange-correlation energy + !! on the grid within LDA using the Ceperley-Alder + !! interpolation formula. It also calculates the + !! total exchange-correlation energy. + !! + !! Note that this is the Goedecker/Teter/Hutter formula which + !! involves only ratios of polynomials, and is rather easy to + !! differentiate. See PRB 54, 1703 (1996) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! D.R.Bowler + !! CREATION DATE + !! 14:45, 25/03/2003 and 2021/07/22 14:51 + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_GTH_xc_energy(density, xc_energy, size) + + use datatypes + use numbers + use global_module, only: io_lun + use GenComms, only: cq_abort, gsum + use dimens, only: grid_point_volume, n_my_grid_points + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), intent(out) :: xc_energy + real(double), dimension(:), intent(in) :: density + + ! Local variables + integer n + real(double) :: denominator, e_correlation, e_exchange, ln_rs, & + numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & + v_correlation, v_exchange, drs_dRho, t1, t2, dt1, & + dt2 + real(double), parameter :: a0=0.4581652932831429_double + real(double), parameter :: a1=2.217058676663745_double + real(double), parameter :: a2=0.7405551735357053_double + real(double), parameter :: a3=0.01968227878617998_double + real(double), parameter :: b1=1.000000000000000_double + real(double), parameter :: b2=4.504130959426697_double + real(double), parameter :: b3=1.110667363742916_double + real(double), parameter :: b4=0.02359291751427506_double + + xc_energy = zero + do n = 1, n_my_grid_points ! loop over grid pts and store potl on each + rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + if (rho > RD_ERR) then ! Find radius of hole + rcp_rs = ( four*third * pi * rho )**(third) + rs = one/rcp_rs + else + rcp_rs = zero + rs = zero + end if + if (rs > zero) then + drs_dRho = -rs / (3.0 * rho) + t1 = a0 + rs*(a1 + rs * (a2 + rs * a3)) + t2 = rs * (b1 + rs * (b2 + rs * (b3 + rs * b4))) + dt1 = a1 + rs * (2.0 * a2 + rs * 3.0 * a3) + dt2 = b1 + rs * (2.0 * b2 + rs * (3.0 * b3 + rs * 4.0 * b4)) + xc_energy = xc_energy - (t1/t2)*rho + end if + end do ! do n_my_grid_points + call gsum(xc_energy) + ! and 'integrate' the energy over the volume of the grid point + xc_energy = xc_energy * grid_point_volume + return + end subroutine get_GTH_xc_energy + !!*** + + !!****f* XC_module/get_xc_energy_LSDA_PW92 * + !! + !! NAME + !! get_xc_energy_LSDA_PW92 + !! USAGE + !! + !! PURPOSE + !! Calculates the spin polarized exchange-correlation + !! energy on the grid within LDA using the Ceperley-Alder + !! interpolation formula. It also calculates the total + !! exchange-correlation energy. + !! + !! Note that this is the Perdew-Wang parameterisation of the + !! Ceperley-Alder results for a homogeneous electron gas, as + !! described in Phys. Rev. B 45, 13244 (1992), with Ceperley-Alder + !! in Phys. Rev. Lett. 45, 566 (1980) INPUTS + !! + !! USES + !! + !! AUTHOR + !! L. Tong and DRB + !! CREATION DATE + !! 22/03/2011 and 2021/07/22 14:52 + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_xc_energy_LSDA_PW92(density, xc_energy_total, size) + + use datatypes + use numbers + use GenComms, only: cq_abort, gsum + use dimens, only: grid_point_volume, n_my_grid_points + use global_module, only: nspin + + implicit none + + ! Passed variables + ! size of the real space grid + integer, intent(in) :: size + real(double), intent(out) :: xc_energy_total + real(double), dimension(:,:), intent(in) :: density + + ! Local variables + integer :: rr, spin + real(double) :: eps_x, eps_c, rho_tot_r + real(double), dimension(nspin) :: rho_r, Vx, Vc + + ! initialisation + xc_energy_total = zero + + ! loop over grid points on each node + do rr = 1, n_my_grid_points + rho_r(1:nspin) = density(rr,1:nspin) + rho_tot_r = rho_r(1) + rho_r(nspin) + call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, eps_c=eps_c,& + Vx=Vx, Vc=Vc) + + xc_energy_total = xc_energy_total + (eps_x + eps_c) * rho_tot_r + end do + call gsum(xc_energy_total) + xc_energy_total = xc_energy_total * grid_point_volume + return + end subroutine get_xc_energy_LSDA_PW92 + !!*** + + !!****f* XC_module/get_xc_energy_GGA_PBE + !! PURPOSE + !! Calculates the exchange-correlation energy + !! on the grid within GGA using three flavours of + !! Perdew-Burke-Ernzerhof. It also calculates the + !! total exchange-correlation energy. + !! + !! flavour not defined + !! use original PBE, PRL 77, 3865 (1996) + !! flavour = functional_gga_pbe96_rev98: + !! use revPBE, PRL 80, 890 (1998) + !! flavour = functional_gga_pbe96_r99: + !! use RPBE, PRB 59, 7413 (1999) + !! + !! USAGE + !! call get_xc_energy_GGA_PBE(density, xc_potential, & + !! xc_epsilon, xc_energy, size,& + !! flavour) + !! INPUTS + !! integer size : size of the real space grid + !! integer flavour : flavour of PBE functional (optional) + !! real(double) density(size,nspin) : spin dependent density + !! OUTPUT + !! real(double) xc_energy : total xc-energy (sum over spin) + !! real(double) xc_epsilon(size) : xc-energy density + !! real(double) xc_potential(size,nspin) : xc-potnetial + !! AUTHOR + !! L.Tong and DRB + !! CREATION DATE + !! 2012/04/27 and 2021/07/22 14:54 dave + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_xc_energy_GGA_PBE(density, xc_energy, grid_size, flavour) + + use datatypes + use numbers + use global_module, only: nspin, flag_stress, flag_full_stress + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum, cq_abort + use fft_module, only: fft3, recip_vector + use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl + + implicit none + + ! passed variables + integer, intent(in) :: grid_size + real(double), dimension(:,:), intent(in) :: density + real(double), intent(out) :: xc_energy + integer, optional, intent(in) :: flavour + + ! local variables + integer :: PBE_type + integer :: rr, spin, stat, dir1, dir2 + real(double) :: eps_x, eps_c, rho_tot_r + real(double), dimension(nspin) :: rho_r + real(double), dimension(3,nspin) :: grho_r + real(double), dimension(:,:,:), allocatable :: grad_density + + allocate(grad_density(grid_size,3,nspin), STAT=stat) + if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) + call reg_alloc_mem(area_ops, grid_size*3*nspin, type_dbl) + + if (present(flavour)) then + PBE_type = flavour + else + PBE_type = functional_gga_pbe96 + end if + + ! initialisation + grad_density = zero + xc_energy = zero + + ! Build the gradient of the density + do spin = 1, nspin + call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) + end do + + do rr = 1, n_my_grid_points + rho_tot_r = density(rr,1) + density(rr,nspin) + do spin = 1, nspin + rho_r(spin) = density(rr,spin) + grho_r(1:3,spin) = grad_density(rr,1:3,spin) + end do + call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & + eps_x=eps_x, eps_c=eps_c) + xc_energy = xc_energy + rho_tot_r * (eps_x + eps_c) + end do ! rr + call gsum(xc_energy) + xc_energy = xc_energy * grid_point_volume + deallocate(grad_density, STAT=stat) + if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") + call reg_dealloc_mem(area_ops, grid_size*3*nspin, type_dbl) + + end subroutine get_xc_energy_GGA_PBE + !!***** + + + !!****f* XC_module/get_xc_energy_hyb_PBE0 + !! PURPOSE + !! + !! Work routine based on get_xc_energy_GGA_PBE. + !! It will be recoded in near futur to handle any hybrid functional. + !! For now just handle one coefficient as in PBE0. + !! USAGE + !! + !! INPUTS + !! + !! integer size : size of the real space grid + !! integer flavour : flavour of PBE functional (optional) + !! real(double) density(size,nspin) : spin dependent density + !! OUTPUT + !! real(double) xc_energy : total xc-energy (sum over spin) + !! + !! AUTHOR + !! L.Tong/L.Truflandier/DRB + !! CREATION DATE + !! 2014/09/24 and 2021/07/22 15:00 dave + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine get_xc_energy_hyb_PBE0(density, xc_energy, grid_size, exx_a, flavour ) + use datatypes + use numbers + use global_module, only: nspin, flag_full_stress, flag_stress + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum, cq_abort + use fft_module, only: fft3, recip_vector + use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl + + implicit none + + ! passed variables + integer, intent(in) :: grid_size + real(double), dimension(:,:), intent(in) :: density + real(double), intent(out) :: xc_energy + integer, optional, intent(in) :: flavour + real(double), intent(in) :: exx_a + + ! local variables + integer :: PBE_type + integer :: rr, spin, stat, dir1, dir2 + real(double) :: eps_x, eps_c, rho_tot_r + real(double), dimension(nspin) :: rho_r + real(double), dimension(3,nspin) :: grho_r + real(double), dimension(:,:,:), allocatable :: grad_density + + allocate(grad_density(grid_size,3,nspin), STAT=stat) + if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) + call reg_alloc_mem(area_ops, grid_size*3*nspin, type_dbl) + + if (present(flavour)) then + PBE_type = flavour + else + PBE_type = functional_gga_pbe96 + end if + + ! setup exx_a + + ! Initialisation + grad_density = zero + xc_energy = zero + + ! Build the gradient of the density + do spin = 1, nspin + call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) + end do + + do rr = 1, n_my_grid_points + rho_tot_r = density(rr,1) + density(rr,nspin) + do spin = 1, nspin + rho_r(spin) = density(rr,spin) + grho_r(1:3,spin) = grad_density(rr,1:3,spin) + end do + call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & + eps_x =eps_x, & + eps_c =eps_c) + xc_energy = xc_energy + rho_tot_r * (exx_a * eps_x + eps_c) + end do ! rr + call gsum(xc_energy) + xc_energy = xc_energy * grid_point_volume + deallocate(grad_density, STAT=stat) + if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") + call reg_dealloc_mem(area_ops, grid_size*3*nspin, type_dbl) + + return + end subroutine get_xc_energy_hyb_PBE0 + !!***** + + !!****f* XC_module/build_gradient * + !! + !! NAME + !! build_gradient + !! USAGE + !! + !! PURPOSE + !! Calculates the gradient of the density, and its modulus + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! A.S. Torralba + !! CREATION DATE + !! 11/11/05 + !! MODIFICATION HISTORY + !! 15:55, 27/04/2007 drb + !! Changed recip_vector, grad_density to (n,3) for speed + !! 2012/04/27 L.Tong + !! - removed function calculating the modulus of the grad_density, + !! since this is now redundant. + !! - renamed grad_density_xyz to grad_density + !! 2017/08/29 jack baker & dave + !! Removed rcellx references (redundant) + !! SOURCE + !! + subroutine build_gradient(density, grad_density, size) + + use datatypes + use numbers + use dimens, only: n_grid_x, n_grid_y, n_grid_z + use fft_module, only: fft3, recip_vector + use GenComms, only: cq_abort + + implicit none + + ! Passed variables + integer, intent(in) :: size + real(double), intent(in), dimension(size) :: density + !ORI real(double), intent(out), dimension(3, size) :: grad_density_xyz + real(double), intent(out), dimension(size,3) :: grad_density + + ! Local variables + ! Density in reciprocal space + complex(double_cplx), allocatable :: rdensity(:) + ! Temporal reciprocal density + complex(double_cplx), allocatable :: rdensity_tmp(:) + integer :: stat + + !local recip_vec_tm + + allocate(rdensity(size), rdensity_tmp(size), STAT=stat) + if(stat /= 0) & + call cq_abort('ERROR in build_gradient : stat,size = ',stat,size) + grad_density = zero ! to remove SIGFPE 2010.Oct.25 TM + rdensity = zero ! to remove SIGFPE 2010.Oct.25 TM + rdensity_tmp = zero ! to remove SIGFPE 2010.Oct.25 TM + + ! Fourier transform the density + call fft3(density, rdensity, size, -1) + + ! Compute the derivative with respect to x + rdensity_tmp = -rdensity * minus_i * recip_vector(:,1)!*rcellx/n_grid_x + call fft3(grad_density(:,1), rdensity_tmp, size, 1) + + ! Compute the derivative with respect to y + rdensity_tmp = -rdensity * minus_i * recip_vector(:,2)!*rcelly/n_grid_y + call fft3(grad_density(:,2), rdensity_tmp, size, 1) + + ! Compute the derivative with respect to z + rdensity_tmp = -rdensity * minus_i * recip_vector(:,3)!*rcellz/n_grid_z + call fft3(grad_density(:,3), rdensity_tmp, size, 1) + + return + end subroutine build_gradient + !!*** + + !!****f* XC_module/get_dxc_potential_LDA_PZ81 * + !! + !! NAME + !! get_dxc_potential_LDA_PZ81 + !! USAGE + !! + !! PURPOSE + !! Calculates the derivative of the exchange-correlation potential + !! on the grid within LDA using the Ceperley-Alder + !! interpolation formula. This is only for non self-consistent + !! calculations (Harris-Foulkes), for the forces. + !! + !! Note that this is the Perdew-Zunger parameterisation of the + !! Ceperley-Alder results for a homogeneous electron gas, as + !! described in Phys. Rev. B 23, 5048 (1981), with Ceperley-Alder + !! in Phys. Rev. Lett. 45, 566 (1980) + !! INPUTS + !! + !! USES + !! + !! AUTHOR + !! D.R.Bowler + !! CREATION DATE + !! 09:36, 2003/03/20 dave + !! MODIFICATION HISTORY + !! 2007/11/16 12:10 dave + !! Bug fix: sign of ninth*(two*s+r)*rs term in dv_correlation was + !! wrong + !! 2008/03/03 18:34 dave + !! Removed dsqrt + !! 2011/12/13 L.Tong + !! Removed third, as it is now defined in numbers module + !! 2018/02/13 11:03 dave + !! Renamed (added _LDA_PZ81) as part of refactoring + !! 2018/06/11 17:40 dave + !! Bug fix for bug #91 adding factor of spin_factor to account for lack of spin + !! SOURCE + !! + subroutine get_dxc_potential_LDA_PZ81(density, dxc_potential, size) + + use datatypes + use numbers + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum + + implicit none + + ! Passed variables + integer size + real(double), dimension(size) :: density, dxc_potential + + ! Local variables + integer :: n + real(double) :: denominator, e_correlation, e_exchange, ln_rs, & + vnumerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & + dv_correlation, dv_exchange, dfirst, dsecond + real(double), parameter :: alpha = -0.45817_double + real(double), parameter :: beta_1 = 1.0529_double + real(double), parameter :: beta_2 = 0.3334_double + real(double), parameter :: gamma = -0.1423_double + real(double), parameter :: p = 0.0311_double + real(double), parameter :: q = -0.048_double + real(double), parameter :: r = 0.0020_double + real(double), parameter :: s = -0.0116_double + real(double), parameter :: ninth = 1.0_double/9.0_double + real(double), parameter :: sixth = 1.0_double/6.0_double + + do n=1,n_my_grid_points ! loop over grid pts and store potl on each + rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + if (rho>RD_ERR) then ! Find radius of hole + rcp_rs = ( four_thirds * pi * rho )**(third) + else + rcp_rs = zero + end if + ! First, the easy part: exchange + e_exchange = alpha * rcp_rs + if(rho>RD_ERR) then + dv_exchange = four*ninth * e_exchange/rho + else + dv_exchange = zero + end if + if (rcp_rs>zero) then + rs = one/rcp_rs + else + rs = zero + end if + sq_rs = sqrt(rs) + if (rs>=one) then + denominator = one / (one + beta_1 * sq_rs + beta_2 * rs) + vnumerator = one + seven_sixths * beta_1 * sq_rs + & + four_thirds * beta_2 * rs + dfirst = (one + beta_1 * sq_rs + beta_2 * rs)*(-seven_thirtysixths*beta_1*sq_rs - four*ninth*beta_2*rs) + dsecond = -two*vnumerator*(-sixth*beta_1*sq_rs-third*beta_2*rs) + if(rho>RD_ERR) then + dv_correlation = gamma * (dfirst+dsecond) * denominator * denominator * denominator / rho + else + dv_correlation = zero + end if + else if ((rsRD_ERR)) then + ln_rs = log(rs) + rs_ln_rs = rs * ln_rs + if(rho>RD_ERR) then + ! DRB 2007/11/16 Changed sign of ninth to PLUS to correct error + dv_correlation = -(third*p+two*ninth*r*rs_ln_rs+ninth*(two*s+r)*rs)/rho + else + dv_correlation = zero + end if + else + dv_correlation = zero + end if + ! Both X and C + dxc_potential(n) = (dv_exchange + dv_correlation) + ! Just C + !dxc_potential(n) = dv_correlation + ! Just X + !dxc_potential(n) = dv_exchange + end do ! do n_my_grid_points + return + end subroutine get_dxc_potential_LDA_PZ81 + !!*** + + + !!****f* force_module/get_GTH_dxc_potential * + !! + !! NAME + !! get_GTH_dxc_potential + !! USAGE + !! + !! PURPOSE + !! Calculates the derivative of the exchange-correlation potential + !! on the grid within LDA using the Ceperley-Alder + !! interpolation formula. This is only for non self-consistent + !! calculations (Harris-Foulkes), for the forces. + !! + !! Note that this is the Goedecker/Teter/Hutter parameterisation - + !! see PRB 54, 1703 (1996) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! D.R.Bowler + !! CREATION DATE + !! 14:54, 25/03/2003 drb + !! MODIFICATION HISTORY + !! 2011/12/13 L.Tong + !! Removed third, it is now defined in numbers module + ! 2018/06/11 17:40 dave + !! Bug fix for bug #91 adding factor of spin_factor to account for lack of spin + !! SOURCE + !! + subroutine get_GTH_dxc_potential(density, dxc_potential, size) + + use datatypes + use numbers + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum + + implicit none + + ! Passed variables + integer size + + real(double) :: density(size), dxc_potential(size) + + ! Local variables + integer :: n + real(double) :: denominator, e_correlation, e_exchange, ln_rs, & + vnumerator, rcp_rs, rho, rs, rs_ln_rs,t1, t2, dt1, & + dt2, d2t1, d2t2, sq_rs, dv_correlation, & + dv_exchange, dfirst, dsecond, drs_dRho, d2rs_dRho2 + real(double), parameter :: a0=0.4581652932831429_double + real(double), parameter :: a1=2.217058676663745_double + real(double), parameter :: a2=0.7405551735357053_double + real(double), parameter :: a3=0.01968227878617998_double + real(double), parameter :: b1=1.000000000000000_double + real(double), parameter :: b2=4.504130959426697_double + real(double), parameter :: b3=1.110667363742916_double + real(double), parameter :: b4=0.02359291751427506_double + + do n=1,n_my_grid_points ! loop over grid pts and store potl on each + rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 + if (rho>RD_ERR) then ! Find radius of hole + rcp_rs = ( 4.0_double*third * pi * rho )**(third) + rs = one/rcp_rs + else + rcp_rs = zero + rs = zero + rho = zero + end if + if(rs>zero) then + drs_dRho = -rs / (3.0_double * rho) + d2rs_dRho2 = 4.0_double * rs / (9.0_double * rho * rho) + t1 = a0 + rs * (a1 + rs * (a2 + rs * a3)) + t2 = rs * (b1 + rs * (b2 + rs * (b3 + rs * b4))) + dt1 = a1 + rs * (2.0_double * a2 + rs * 3.0_double * a3) + dt2 = b1 + rs * (2.0_double * b2 + rs * (3.0_double * b3 + & + rs * 4.0_double * b4)) + d2t1 = 2.0_double * a2 + 6.0_double * a3 * rs + d2t2 = 2.0_double * b2 + rs * (6.0_double * b3 + rs * 12.0_double * b4) + dxc_potential(n) = 2.0_double*drs_dRho * & + (-dt1 / t2 + t1 * dt2 / (t2 * t2)) + & + rho * & + (drs_dRho * drs_dRho * & + (2.0_double * dt1 * dt2 / (t2*t2) - & + d2t1 / t2 - & + 2.0_double * t1 * dt2 * dt2 / & + (t2*t2*t2) + d2t2 * t1/(t2*t2)) + & + d2rs_dRho2*(-dt1 / t2 + t1 * dt2 / (t2 * t2))) + else + dxc_potential(n) = zero + end if + end do ! do n_my_grid_points + return + end subroutine get_GTH_dxc_potential + !!*** + + + !!****f* H_matrix_module/get_dxc_potential_LDA_PW92 * + !! + !! NAME + !! get_dxc_potential_LDA_PW92 + !! USAGE + !! + !! PURPOSE + !! Calculates the derivative of the exchange-correlation potential + !! on the grid within LDA using the Ceperley-Alder + !! interpolation formula. This is only for non self-consistent + !! calculations (Harris-Foulkes), for the forces. + !! + !! Note that this is the Perdew-Wang parameterisation of the + !! Ceperley-Alder results for a homogeneous electron gas, as + !! described in Phys. Rev. B 45, 13244 (1992), with Ceperley-Alder + !! in Phys. Rev. Lett. 45, 566 (1980) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! A.S. Torralba + !! CREATION DATE + !! 30/01/06 + !! MODIFICATION HISTORY + !! 2008/03/03 18:34 dave + !! Removed dsqrt + !! 2011/10/17 L.Tong + !! Corrected (changed) 1 to one in log (1 + 1/denominator) + !! 2011/12/13 L.Tong + ! Removed third, it is now defined in numbers module + !! SOURCE + !! + subroutine get_dxc_potential_LDA_PW92(density, dxc_potential, size, & + eclda, declda_drho, d2eclda_drho2) + + use datatypes + use numbers + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum + + implicit none + + ! Passed variables + integer :: size + + real(double), intent(in) :: density(size) + real(double), intent(inout) :: dxc_potential(size) + real(double), optional :: eclda(size) + real(double), optional :: declda_drho(size) + real(double), optional :: d2eclda_drho2(size) + + ! Local variables + integer n + real(double) :: prefactor, postfactor, denominator, & + e_correlation, e_exchange, & + rcp_rs, rho, rs, sq_rs, & + v_correlation, v_exchange, & + delta_prefactor, delta_postfactor, & + dv_exchange, dv_correlation, & + denominator2, dnumrho_drho, & + dden_drho, rho4_3, & + dprefactor_drho, d2prefactor_drho2, & + dposfactor_drho, d2posfactor_drho2, & + dec_drho, d2ec_drho2 + + + ! From Table I, Phys. Rev. B 45, 13244 (1992), for reference + real(double), parameter :: alpha = 1.0421234_double + real(double), parameter :: alpha1 = 0.21370_double + real(double), parameter :: beta1 = 7.5957_double + real(double), parameter :: beta2 = 3.5876_double + real(double), parameter :: beta3 = 1.6382_double + real(double), parameter :: beta4 = 0.49294_double + real(double), parameter :: A = 0.031091_double + + ! Precalculated constants + real(double), parameter :: k00 = 1.611991954_double ! (4*pi/3)**(1/3) + real(double), parameter :: k01 = -0.458165347_double ! -3/(2*pi*alpha) + real(double), parameter :: k02 = -0.062182_double ! -2*A + real(double), parameter :: k03 = -0.0132882934_double ! -2*A*alpha1 + real(double), parameter :: k04 = 0.4723158174_double ! 2*A*beta1 + real(double), parameter :: k05 = 0.2230841432_double ! 2*A*beta2 + real(double), parameter :: k06 = 0.1018665524_double ! 2*A*beta3 + real(double), parameter :: k07 = 0.03065199508_double ! 2*A*beta4 + real(double), parameter :: k08 = -0.008858862267_double ! 2*k03/3 + real(double), parameter :: k09 = 0.0787193029_double ! k04/6 + real(double), parameter :: k10 = 0.074361381067_double ! k05/3 + real(double), parameter :: k11 = 0.0509332762_double ! k06/2 + real(double), parameter :: k12 = 0.0204346633867_double ! 2*k07/3 + real(double), parameter :: four_ninths = 4.0_double/9.0_double + real(double), parameter :: minus_four_thirds = -4.0_double/3.0_double + real(double), parameter :: k13 = 0.0027477997778_double ! (k08-k03)/k00 + + do n=1,n_my_grid_points ! loop over grid pts and store potl on each + rho = density(n) + + !!!! EXCHANGE + if (rho > RD_ERR) then ! Find radius of hole + rcp_rs = k00 * ( rho**third ) + dv_exchange = four_ninths * k01 * rcp_rs / rho ! 4*e_exchange/(9*rho) + else + rcp_rs = zero + dv_exchange = zero + end if + + e_exchange = k01*rcp_rs + + !!!! CORRELATION + if (rcp_rs > zero) then + rs = one/rcp_rs + else + rs = zero + end if + sq_rs = sqrt(rs) + + prefactor = k02 + k03*rs + denominator = sq_rs * ( k04 + sq_rs * ( k05 + sq_rs * ( k06 + k07 * sq_rs))) + if (denominator > zero) then + postfactor = log (one + one/denominator) + else + postfactor = zero + end if + + ! Return correlation energy if requested + ! NOTE: This "energy" is not the actual integrand, but the integrand divided by rho + if(present(eclda)) then + eclda(n) = prefactor*postfactor + end if + + + ! NOTE: delta_prefactor is actually the derivative of rho*prefactor + ! delta_postfactor is rho times the derivative of postfactor + delta_prefactor = k02 + k08*rs + if (sq_rs > zero) then + denominator2 = ( denominator * ( 1 + denominator ) ) + delta_postfactor = sq_rs * ( k09 + sq_rs*(k10 + sq_rs*( k11 + k12 * sq_rs ))) & + / denominator2 + + dnumrho_drho = -sq_rs *( 7.0*k09/6.0 + sq_rs * ( 4.0*k10/3.0 + sq_rs * ( 3.0*k11/2.0 +sq_rs*5.0*k12/3.0))) + dden_drho = -sq_rs*(k04/6.0 +sq_rs*(third*k05 + sq_rs*(half*k06 + sq_rs*2.0*k07/3.0))) + else + delta_postfactor = 0 + + dnumrho_drho = zero + dden_drho = zero + end if + + if(rho > RD_ERR) then + rho4_3 = rho**minus_four_thirds + dprefactor_drho = k13*rho4_3 + d2prefactor_drho2 = minus_four_thirds*dprefactor_drho/rho + + dposfactor_drho = delta_postfactor/rho + d2posfactor_drho2 = (dnumrho_drho & + - delta_postfactor * ( 1 + 2*denominator) * dden_drho)/(denominator2 * rho *rho) + else + rho4_3 = zero + dprefactor_drho = zero + d2prefactor_drho2 = zero + + dposfactor_drho = zero + d2posfactor_drho2 = zero + end if + + dec_drho = postfactor*dprefactor_drho + prefactor*dposfactor_drho + + ! Return derivative of correlation energy (see note above) if requested + if(present(declda_drho)) then + declda_drho(n) = dec_drho + end if + + + d2ec_drho2 = 2*dposfactor_drho*dprefactor_drho & + + postfactor*d2prefactor_drho2 + prefactor*d2posfactor_drho2 + + ! Return second derivative of correlation energy (see note above) if requested + if(present(d2eclda_drho2)) then + d2eclda_drho2(n) = d2ec_drho2 + end if + + dv_correlation = 2*dec_drho + rho*d2ec_drho2 + + dxc_potential(n) = dv_exchange + dv_correlation + end do ! do n_my_grid_points + + return + end subroutine get_dxc_potential_LDA_PW92 + !!*** + + + !!****f* H_matrix_module/get_dxc_potential_GGA_PBE * + !! + !! NAME + !! get_dxc_potential_GGA_PBE + !! USAGE + !! + !! PURPOSE + !! Calculates the potential needed for the non-self-consistent + !! within GGA using the Perdew-Burke-Ernzerhof. + !! + !! Note that this is the functional described in + !! Phys. Rev. Lett. 77, 3865 (1996) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! A.S. Torralba + !! CREATION DATE + !! 31/01/05 + !! MODIFICATION HISTORY + !! 15:54, 27/04/2007 drb + !! Changed recip_vector, grad_density and tmp2, tmp3 to (n,3) for speed + !! 2008/11/13 ast + !! Added new PBE functional types + !! 2011/12/13 L.Tong + !! Removed third, and eight, they are now defined in numbers module + !! 2017/08/29 jack baker & dave + !! Removed rcellx references (redundant) + !! 2018/06/12 11:11 dave + !! Fixing missing factors of spin_factor for non-spin polarisation (this routine only does zero spin) + !! SOURCE + !! + subroutine get_dxc_potential_GGA_PBE(density, density_out, & + dxc_potential, size, flavour ) + + use datatypes + use numbers + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum + use fft_module, only: fft3, recip_vector +! use energy, only: delta_E_xc + + implicit none + + ! Passed variables + integer size + real(double), intent(in) :: density(size) + real(double), intent(in) :: density_out(size) + real(double), intent(inout) :: dxc_potential(size) + integer, optional, intent(in) :: flavour + + ! Local variables + integer n, i + integer selector + + real(double) :: grad_density(size), grad_density_xyz(size,3) + real(double) :: rho, grad_rho, rho1_3, rho1_6 + real(double) :: e_exchange + real(double) :: xc_energy_lda_total, dxc_potential_lda(size), & + eclda(size), declda_drho(size), d2eclda_drho2(size) + real(double) :: de_dgrad(size) + real(double) :: s, s2, factor0, factor1, denominator0, denominator0_2 + real(double) :: d2e_drho2, d2e_dgrad2(size), d2e_dgrad_drho(size) + real(double) :: dden0_drho, df0f1_drho, ds_grad, dden0_dgrad, ds_dgrad, df1_dgrad + real(double) :: diff_rho(size) + complex(double_cplx) :: tmp1(size), tmp2(size,3) + real(double) :: tmp3(size,3), tmp_factor + + real(double) :: a, a2, t, t2, t3, t4, num1, den1, den1_2, fl + real(double) :: factor_exp, factor_exp2, factor_exp3 + real(double) :: dt_drho, da_drho, dnum1_drho, dden1_drho, dfl_drho, dec_drho + real(double) :: dt_dgrad, dnum1_dgrad, dden1_dgrad, dfl_dgrad + real(double) :: d2t_drho2, d2a_drho2, d2num1_drho2, d2den1_drho2, d2fl_drho2 + real(double) :: d2num1_dgrad2, d2den1_dgrad2, d2fl_dgrad2 + real(double) :: d2t_drho_dgrad, d2num1_drho_dgrad, d2den1_drho_dgrad + real(double) :: d2fl_drho_dgrad + + real(double) :: kappa, mu_kappa + + ! From Phys. Rev. Lett. 77, 3865 (1996) + real(double), parameter :: mu = 0.21951_double + real(double), parameter :: beta = 0.066725_double + real(double), parameter :: gamma = 0.031091_double + real(double), parameter :: kappa_ori = 0.804_double + + ! From Phys. Rev. Lett. 80, 890 (1998) + real(double), parameter :: kappa_alt = 1.245_double + + ! Precalculated constants + real(double), parameter :: mu_kappa_ori = 0.27302_double ! mu/kappa_ori + real(double), parameter :: mu_kappa_alt = 0.17631_double ! mu/kappa_alt + real(double), parameter :: beta_gamma = 2.146119_double ! beta/gamma + real(double), parameter :: beta_X_gamma = 0.002074546_double ! beta*gamma + real(double), parameter :: k01 = 0.16162045967_double ! 1/(2*(3*pi*pi)**(1/3)) + real(double), parameter :: k02 = -0.16212105381_double ! -3*mu*((4*pi/3)**3)/(2*pi*alpha) + ! = mu*k00*k01(LDA_PW92)=mu*k04 + real(double), parameter :: k03 = 1.98468639_double ! ((4/pi)*(3*pi*pi)**(1/3))**(1/2) + real(double), parameter :: k04 = -0.738558852965_double ! -3*((4*pi/3)**3)/(2*pi*alpha) = k00*k01 in LDA_PW92 + real(double), parameter :: k05 = 0.05240415_double ! -2*k01*k02 + real(double), parameter :: eight_thirds = 8.0_double / 3.0_double + + ! Selector options + integer, parameter :: fx_original = 1 ! Used in PBE and revPBE + integer, parameter :: fx_alternative = 2 ! Used in RPBE + + ! Choose between PBE or revPBE parameters + if(PRESENT(flavour)) then + if(flavour==functional_gga_pbe96_rev98) then + kappa=kappa_alt + mu_kappa=mu_kappa_alt + else + kappa=kappa_ori + mu_kappa=mu_kappa_ori + end if + else + kappa=kappa_ori + mu_kappa=mu_kappa_ori + end if + + ! Get the LDA part of the functional + grad_density = spin_factor * density ! Factor of spin_factor to account for lack of spin + call get_dxc_potential_LDA_PW92(grad_density, dxc_potential_lda, size, & + eclda, declda_drho, d2eclda_drho2) + grad_density = zero + ! Build the gradient of the density + call build_gradient(density, grad_density_xyz, size) + grad_density_xyz(:,:) = spin_factor * grad_density_xyz(:,:) + grad_density(:) = sqrt(grad_density_xyz(:,1)**2 + & + grad_density_xyz(:,2)**2 + & + grad_density_xyz(:,3)**2) + + + do n=1,n_my_grid_points ! loop over grid pts and store potl on each + rho = spin_factor * density(n) + grad_rho = grad_density(n) + + diff_rho(n) = spin_factor * (density(n) - density_out(n)) + + !!!! EXCHANGE + + !! Energy factors + + if (rho > RD_ERR) then + rho1_3 = rho ** third + rho1_6 = sqrt (rho1_3) + s = k01 * grad_rho / (rho ** four_thirds) + s2 = s * s + denominator0 = one / (one + mu_kappa * s2) + denominator0_2 = denominator0 * denominator0 + factor0 = k02 * rho1_3 + factor1 = s2 * denominator0 + ! NOTE: This doesn't look like in Phys. Rev. Lett. 77:18, 3865 (1996) + ! because the 1 in Fx, has been multiplied by Ex-LDA and is implicit + ! in xc_energy_lda(n), in the total energy below + e_exchange = factor0 * factor1 + else + s = 0.0_double + s2 = 0.0_double + denominator0 = 0.0_double + denominator0_2 = 0.0_double + factor0 = 0.0_double + factor1 = 0.0_double + e_exchange = zero + end if + + !! Second derivative of Ex wrt rho + if (rho > RD_ERR) then + dden0_drho = mu_kappa * eight_thirds * denominator0_2 * s2 /rho + df0f1_drho = third * e_exchange * (one - eight * denominator0) / rho + d2e_drho2 = four_thirds * (df0f1_drho * (one - two * denominator0) & + - two * e_exchange * dden0_drho) + else + d2e_drho2 = 0.0_double + end if + + !! Second derivative of Ex wrt grad + ds_dgrad = 0.0_double + if(rho > RD_ERR) ds_dgrad = k01 * rho**(-four_thirds) + dden0_dgrad = -two * mu_kappa * denominator0_2 * s * ds_dgrad + + d2e_dgrad2(n) = two * rho * factor0 * ds_dgrad * (ds_dgrad * denominator0_2 & + + two * s * denominator0 * dden0_dgrad) + + !! Second derivative of Ex wrt grad and rho + df1_dgrad = two * s * denominator0_2 * ds_dgrad + + d2e_dgrad_drho(n) = (four_thirds) * factor0 & + * (df1_dgrad * (one - two * denominator0) & + - two * factor1 * dden0_dgrad) + + + !! First derivative wrt gradient + de_dgrad(n) = rho * factor0 * df1_dgrad + + + !!!! CORRELATION + + !! Energy terms + factor_exp = exp(-eclda(n)/gamma) + a = factor_exp - one + if(a > RD_ERR) then + a = beta_gamma / a + else + a = beta_gamma * BIG + end if + a2 = a * a + + if(rho > RD_ERR) then + t = grad_rho/(two*k03*(rho**seven_sixths)) + else + t = 0.0_double + end if + t2 = t * t + t3 = t2 * t + t4 = t2 * t2 + num1 = one + a*t2; + den1 = num1 + a2*t4; + den1_2 = den1*den1; + if(den1 > RD_ERR) then + fl = one + beta_gamma * t2 * num1 / den1; + else + fl = one + end if + + + !! First derivative wrt rho + + if(rho > RD_ERR) then + dt_drho = -seven_sixths*t/rho + else + dt_drho = 0.0_double + end if + !TM 2007_10_18 + ! eclda(n) = 0 -> factor_exp = one -> zero**(-2) !!! + !ORI factor_exp2 = (factor_exp - one)**(-two) + if(abs(factor_exp-one) > RD_ERR) then + factor_exp2 = one/(factor_exp - one) + factor_exp2 = factor_exp2**2 + else + factor_exp2 = 0.0_double + end if + + da_drho = beta_gamma * factor_exp * factor_exp2 * declda_drho(n)/gamma + dnum1_drho = da_drho * t2 + two*a*t*dt_drho + dden1_drho = dnum1_drho + two*a*t4*da_drho + four*a2*t3*dt_drho + if(den1 > RD_ERR) then + dfl_drho = beta_gamma*((two*t*num1*dt_drho + t2*dnum1_drho)/den1 - t2*num1*dden1_drho/den1_2) + else + dfl_drho = 0.0_double + end if + dec_drho = gamma * (log(fl) + rho * dfl_drho / fl) + + !! Second derivative with respect to rho + + if(rho > RD_ERR) then + d2t_drho2 = seven_sixths*(t/(rho*rho) - dt_drho/rho) + else + d2t_drho2 = 0.0_double + end if + factor_exp3 = factor_exp * factor_exp2 + if(abs(factor_exp-one) > RD_ERR) then + d2a_drho2 = (beta_gamma/gamma)*( ( ( (two * factor_exp / (factor_exp - one)) - one )& + * factor_exp3 * declda_drho(n)**2) /gamma & + + factor_exp3 * d2eclda_drho2(n)) + else + d2a_drho2 = zero + end if + + d2num1_drho2 = d2a_drho2*t2 + four*t*da_drho*dt_drho & + + two*a*((dt_drho**2) + t*d2t_drho2) + d2den1_drho2 = d2num1_drho2 + two*((da_drho*t2)**2) & + + two*a*d2a_drho2*t4 & + + 16.0_double*a*t3*da_drho*dt_drho & + + 12.0_double*((a*t*dt_drho)**2) & + + four*a2*t3*d2t_drho2 + if(den1 > RD_ERR) then + d2fl_drho2 = beta_gamma*(two*num1*(dt_drho**2) & + + t*(four*(dnum1_drho*dt_drho & + - num1*dden1_drho*dt_drho/den1) & + + two*num1*d2t_drho2) & + + t2*(d2num1_drho2 & + + two*(num1*((dden1_drho/den1)**2) & + - dnum1_drho*dden1_drho/den1) & + - num1*d2den1_drho2/den1))/den1 + else + d2fl_drho2 = 0.0_double + end if + d2e_drho2 = d2e_drho2 + gamma*(two*dfl_drho/fl - rho*((dfl_drho/fl)**2) + rho*d2fl_drho2/fl); + + + !! First derivative with respect to grad + + if(rho > RD_ERR) then + dt_dgrad = one/(two*k03*(rho**seven_sixths)) + else + dt_dgrad = 0.0_double + end if + dnum1_dgrad = two*a*t*dt_dgrad + dden1_dgrad = two*a*t*dt_dgrad + four*a2*t3*dt_dgrad + if(den1 > RD_ERR) then + dfl_dgrad = two*beta_gamma*t*num1*dt_dgrad/den1 + beta_gamma*t2*dnum1_dgrad/den1 & + - beta_gamma*t2*num1*dden1_dgrad/den1_2 + else + dfl_dgrad = 0.0_double + end if + de_dgrad(n) = de_dgrad(n) + gamma * rho * dfl_dgrad / fl + + + !! Second derivative with respect to grad + + d2num1_dgrad2 = two*a*(dt_dgrad**2) + d2den1_dgrad2 = d2num1_dgrad2 + 12.0*((a*t*dt_dgrad)**2) + if(den1 > RD_ERR) then + d2fl_dgrad2 = beta_gamma*(two*num1*(dt_dgrad**2)/den1 & + + four*t*dnum1_dgrad*dt_dgrad/den1 & + - two*t*num1*dden1_dgrad*dt_dgrad/den1_2 & + + t2*d2num1_dgrad2/den1 & + - t2*dden1_dgrad*dnum1_dgrad/den1_2 & + - two*t*num1*dden1_dgrad*dt_dgrad/den1_2 & + - t2*dnum1_dgrad*dden1_dgrad/den1_2 & + + two*t2*num1*(dden1_dgrad**2)/(den1_2*den1) & + - t2*num1*d2den1_dgrad2/den1_2) + else + d2fl_dgrad2 = zero + end if + d2e_dgrad2(n) = d2e_dgrad2(n) + gamma*rho*(d2fl_dgrad2/fl - (dfl_dgrad**2)/(fl*fl)) + + !! Second derivative with respect to rho and grad + + ! if((grad_rho > RD_ERR ) .or. (rho > RD_ERR)) then ! Changed by TM 19Oct2007 + if((grad_rho > RD_ERR ) .and. (rho > RD_ERR)) then + d2t_drho_dgrad = -seven_sixths*t/(grad_rho*rho) + else + d2t_drho_dgrad = 0.0_double + end if + d2num1_drho_dgrad = two*(t*da_drho*dt_dgrad + a*dt_drho*dt_dgrad + a*t*d2t_drho_dgrad) + d2den1_drho_dgrad = d2num1_drho_dgrad + 8.0*a*t3*da_drho*dt_dgrad + 12.0*a2*t2*dt_drho*dt_dgrad & + + four*a2*t3*d2t_drho_dgrad + if(den1 > RD_ERR) then + d2fl_drho_dgrad = beta_gamma*(two*(dt_drho*dt_dgrad*num1 & + + t*(dnum1_drho*dt_dgrad & + + num1*(d2t_drho_dgrad & + - (dden1_drho*dt_dgrad & + + dt_drho*dden1_dgrad)/den1) & + + dnum1_dgrad*dt_drho & + + t*num1*dden1_drho*dden1_dgrad/den1_2)) & + + t2*(d2num1_drho_dgrad & + - (dnum1_dgrad*dden1_drho & + + dnum1_drho*dden1_dgrad & + + num1*d2den1_drho_dgrad)/den1))/den1 + else + d2fl_drho_dgrad = 0.0_double + end if + d2e_dgrad_drho(n) = d2e_dgrad_drho(n) + gamma*(dfl_dgrad + rho*(d2fl_drho_dgrad - dfl_drho*dfl_dgrad/fl))/fl + + + !! Add term L1 to the potential + dxc_potential(n) = dxc_potential(n) & + + diff_rho(n) * (d2e_drho2 + dxc_potential_lda(n)) + + end do ! do n_my_grid_points + + + ! Fourier transform the difference of densities + tmp1(:)=cmplx(zero,zero,double_cplx) !TM + call fft3(diff_rho, tmp1, size, -1) + + !do n=1, n_my_grid_points ! debugged 25Oct2007 TM + do n=1, size + ! Product by reciprocal vector stored for later use + tmp2(n,1) = -minus_i*recip_vector(n,1)*tmp1(n) + tmp2(n,2) = -minus_i*recip_vector(n,2)*tmp1(n) + tmp2(n,3) = -minus_i*recip_vector(n,3)*tmp1(n) + end do + + ! Fourier transform the vector back to the grid + call fft3(tmp3(:,1), tmp2(:,1), size, 1) + call fft3(tmp3(:,2), tmp2(:,2), size, 1) + call fft3(tmp3(:,3), tmp2(:,3), size, 1) + + ! Add term L3 to potential + do n=1, n_my_grid_points + do i=1,3 + if(grad_density(n) > RD_ERR) then + dxc_potential(n) = dxc_potential(n) + (tmp3(n,i) & + * d2e_dgrad_drho(n) & + * grad_density_xyz(n,i) )/grad_density(n) + end if + end do + end do + + ! Term L4 + do n=1, n_my_grid_points + if(grad_density(n) > RD_ERR) then + tmp_factor =(tmp3(n,1) * grad_density_xyz(n,1) & + + tmp3(n,2) * grad_density_xyz(n,2) & + + tmp3(n,3) * grad_density_xyz(n,3)) & + * (d2e_dgrad2(n) & + - de_dgrad(n)/grad_density(n) ) / (grad_density(n)*grad_density(n)) + else + tmp_factor = zero + end if + ! Reuse tmp3 + do i=1,3 + if(grad_density(n) > RD_ERR) then + tmp3(n,i) = tmp_factor * grad_density_xyz(n,i) & + + de_dgrad(n) * tmp3(n,i)/grad_density(n) + else + tmp3(n,i) = zero + end if + end do + end do + + ! Terms L2 and L5 (using L4) + do n=1, n_my_grid_points + do i=1,3 + if(grad_density(n) > RD_ERR) then + tmp3(n,i) = tmp3(n,i) & + + diff_rho(n) * d2e_dgrad_drho(n)* grad_density_xyz(n,i) & + / grad_density(n) + else + tmp3(n,i) = zero + end if + end do + end do + + tmp2(:,:) = cmplx(zero,zero,double_cplx) ! 25Oct2007 TM + call fft3(tmp3(:,1), tmp2(:,1), size, -1) + call fft3(tmp3(:,2), tmp2(:,2), size, -1) + call fft3(tmp3(:,3), tmp2(:,3), size, -1) + + !do n=1, n_my_grid_points ! debugged 25Oct2007 TM + do n=1, size + ! Product by reciprocal vector stored for later use + tmp1(n) = -minus_i & + *(recip_vector(n,1)*tmp2(n,1) & + + recip_vector(n,2)*tmp2(n,2) & + + recip_vector(n,3)*tmp2(n,3)) + end do + + ! Use first component of tmp3 to store final vector + call fft3(tmp3(:,1), tmp1, size, 1) + + do n=1, n_my_grid_points + dxc_potential(n) = dxc_potential(n) - tmp3(n,1) + end do + + return + end subroutine get_dxc_potential_GGA_PBE + !!*** + + + !!****f* XC_module/get_dxc_potential_LSDA_PW92 + !! PURPOSE + !! Calculates the derivative of the exchange-correlation potential + !! on the grid within LSDA using the Ceperley-Alder interpolation + !! formula. This is only for non self-consistent calcuations + !! (Harris-Foulkes), for the forces. + !! + !! The functional is given by Phys. Rev. B 45, 13244 + !! INPUTS + !! OUTPUT + !! RETURN VALUE + !! AUTHOR + !! L.Tong + !! CREATION DATE + !! 2011/10/18 + !! MODIFICATION HISTORY + !! 2012/03/26 L.Tong + !! - Changed spin implementation + !! - density is now array of (maxngrid,nspin) + !! - dxc_potential_ddensity is now array of + !! - (maxngrid,nspin,nspin), so + !! dxc_potential_ddensity(n,spin1,spin2) corresponds to + !! dVxc(spin1) / drho(spin2) at grid point n. + !! 2018/06/15 12:25 dave + !! Removed spin_factor from use statement (global to module now) + !! SOURCE + !! + subroutine get_dxc_potential_LSDA_PW92(density, & + dxc_potential_ddensity, & + size) + use datatypes + use numbers + use dimens, only: grid_point_volume, n_my_grid_points + use GenComms, only: gsum + use global_module, only: nspin + + implicit none + + ! passed variables + integer :: size + real(double), dimension(:,:) :: density + real(double), dimension(:,:,:) :: dxc_potential_ddensity + + ! local variables + integer :: n, spin, spin_2 + real(double) :: rho_tot, rs, rcp_rs, zeta, sq_rs, e_c0, e_c1, & + malpha_c, f, de_c0_drs, drs_drho_tot, de_c1_drs, & + dmalpha_c_drs, df_dzeta, d2e_c0_drs2, d2e_c1_drs2, & + d2malpha_c_drs2, d2f_dzeta2, de_c_drs, de_c_dzeta, & + d2e_c_drs2, d2e_c_drs_dzeta, d2e_c_dzeta2, factor + real(double), dimension(nspin) :: rho, drs_drho, dzeta_drho + real(double), dimension(nspin,nspin) :: dVx_drho, dVc_drho + + ! tabulated parameters + real(double) :: alpha1, beta1, beta2, beta3, beta4, p, A + + ! precalculated parameters + real(double), parameter :: k00 = 1.611991954_double ! (4*pi/3)**(1/3) + real(double), parameter :: k01 = -0.413566994_double ! -(2/pi)**(1/3)/3**(2/3) + real(double), parameter :: K02 = 1.923661051_double ! 1 / (2**(4/3)-2) + real(double), parameter :: K03 = 0.584822362_double ! 1 / f''(0) + real(double), parameter :: K04 = -0.328248341_double ! -(1/pi)**(1/3)/3**(2/3) + + ! loop over grid points + do n = 1, n_my_grid_points + rho_tot = zero + do spin = 1, nspin + rho(spin) = density(n,spin) + rho_tot = rho_tot + spin_factor * rho(spin) + end do + if (rho_tot > RD_ERR) then + rcp_rs = k00 * rho_tot**third + zeta = (rho(1) - rho(nspin)) / rho_tot + else + rcp_rs = zero + ! limit rho(spin) --> 0+ for all spin gives zeta --> zero + ! (remember rho(spin) >= 0) + zeta = zero + end if + + ! exchange (worked out from Mathematica) + do spin = 1, nspin + if (rho(spin) > RD_ERR) then + ! if spin non-polarised, dVx_drho is calculated to be dVx/drho_tot + ! this is found to be half of dVx_drho(spin=1) + dVx_drho(spin,spin) = & + k01 / (spin_factor * (rho(spin))**two_thirds) + else + dVx_drho(spin,spin) = zero + end if + end do + if (nspin == 2) then + dVx_drho(1,2) = zero ! dVx_drho(1,2) = dVx_up_drho_dn + dVx_drho(2,1) = zero ! dVx_drho(2,1) = dVx_dn_drho_up + end if + + ! correlation + if (rcp_rs > RD_ERR) then + rs = one / rcp_rs + else + ! here rs really should be infty, however, it is a TRICK to + ! set it to zero here, but it gives the correct end results + ! for G(rs), G'(rs) and G''(rs), etc. + rs = zero + end if + sq_rs = sqrt(rs) + + ! drs_drho + if (nspin == 1) then + if (rho_tot > RD_ERR) then + drs_drho_tot = - third * rs / rho_tot + else + drs_drho_tot = zero + end if + else if (nspin == 2) then + do spin = 1, nspin + if (rho(spin) > RD_ERR) then + drs_drho(spin) = - third * rs / rho_tot + dzeta_drho(spin) = ((-one)**(spin+1) - zeta) / rho_tot + else + drs_drho(spin) = zero + dzeta_drho(spin) = zero + end if + end do + end if + + ! e_c0 and de_c0_drs + ! from table 1 of Phys. Rev. B 45, 13244 + call PW92_G(rs, & + A=0.031091_double, & + alpha1=0.21370_double, & + beta1=7.5957_double, & + beta2=3.5876_double, & + beta3=1.6382_double, & + beta4=0.49294_double, & + p=one, & + G=e_c0, & + dG_drs=de_c0_drs, & + d2G_drs2=d2e_c0_drs2) + + ! for spin non-polarised calculations this is enough for + ! de_c_drs and d2e_c_drs2 + de_c_drs = de_c0_drs + d2e_c_drs2 = d2e_c0_drs2 + + if (nspin == 2) then + ! e_c1 and de_c1_drs + ! from table 1 of Phys. Rev. B 45, 13244 + call PW92_G(rs, & + A=0.015545_double, & + alpha1=0.20548_double, & + beta1=14.1189_double, & + beta2=6.1977_double, & + beta3=3.3662_double, & + beta4=0.62517_double, & + p=one, & + G=e_c1, & + dG_drs=de_c1_drs, & + d2G_drs2=d2e_c1_drs2) + ! malpha_c and dmalpha_c_drs + ! from table 1 of Phys. Rev. B 45, 13244 + call PW92_G(rs, & + A=0.016887_double, & + alpha1=0.11125_double, & + beta1=10.357_double, & + beta2=3.6231_double, & + beta3=0.88026_double, & + beta4=0.49671_double, & + p=one, & + G=malpha_c, & + dG_drs=dmalpha_c_drs, & + d2G_drs2=d2malpha_c_drs2) + + ! f and df_dzeta + f = K02 * ((one + zeta)**four_thirds + (one - zeta)**four_thirds - two) + df_dzeta = four_thirds * K02 * ((one + zeta)**one_third - & + (one - zeta)**one_third) + d2f_dzeta2 = one_third * four_thirds * K02 * & + ((one + zeta)**(-two_thirds) + & + (one - zeta)**(-two_thirds)) + + ! first order derivatives + de_c_drs = de_c_drs - de_c0_drs * f * zeta**4 + & + de_c1_drs * f * zeta**4 + & + dmalpha_c_drs * K03 * f * (zeta**4 - one) + de_c_dzeta = four * zeta**3 * f * (e_c1 - e_c0 + K03 * malpha_c) + & + df_dzeta * (zeta**4 * e_c1 - zeta**4 * e_c0 + & + (zeta**4 - one) * K03 * malpha_c) + + ! second order derivatives + ! d2e_c_drs2 + d2e_c_drs2 = d2e_c_drs2 - d2e_c0_drs2 * f * zeta**4 + & + d2e_c1_drs2 * f * zeta**4 + & + d2malpha_c_drs2 * K03 * f * (zeta**4 - one) + + ! d2e_c_drs_dzeta + d2e_c_drs_dzeta = four * zeta**3 * f * & + (de_c1_drs - de_c0_drs + K03 * dmalpha_c_drs) + & + df_dzeta * (zeta**4 * de_c1_drs - & + zeta**4 * de_c0_drs + & + (zeta**4 - one) * K03 * dmalpha_c_drs) + + ! d2e_c_dzeta2 + d2e_c_dzeta2 = & + (twelve * zeta * zeta * f + eight * zeta**3 * df_dzeta) * & + (e_c1 - e_c0 + K03 * malpha_c) + & + d2f_dzeta2 * (zeta**4 * e_c1 - zeta**4 * e_c0 + & + (zeta**4 - one) * K03 * malpha_c) + end if + + ! finally get the derivatives of the correlation potentials + if (nspin == 1) then + ! for spin non-polarised calculations, we need to calculate + ! dVc_drho_tot + dVc_drho(1,1) = (two_thirds * de_c_drs - & + one_third * rs * d2e_c_drs2) * & + drs_drho_tot + else + do spin = 1, nspin + do spin_2 = 1, nspin + factor = zeta + (-one)**spin + dVc_drho(spin,spin_2) = & + (two_thirds * de_c_drs - & + one_third * rs * d2e_c_drs2 - & + factor * d2e_c_drs_dzeta) * & + drs_drho(spin_2) - & + (one_third * rs * d2e_c_drs_dzeta + & + factor * d2e_c_dzeta2) * & + dzeta_drho(spin_2) + end do + end do + end if + + ! collect things together + do spin = 1, nspin + do spin_2 = 1, nspin + dxc_potential_ddensity(n,spin,spin_2) = & + dVx_drho(spin,spin_2) + dVc_drho(spin,spin_2) + end do + end do + + end do ! n = 1, n_my_grid_points + + return + end subroutine get_dxc_potential_LSDA_PW92 + !!***** + + + !!****f* XC_module/PW92_G + !! PURPOSE + !! Calculates the interpolation function G defined in PW92 LSDA + !! paper: + !! Perdew and Wang, Phys. Rev. B, 1992, 45, 13244-13249 + !! USAGE + !! call PW92_G(rs, A, alpha1, beta1, beta2, beta3, beta4, p, + !! G, dG_drs, d2G_drs2) + !! INPUTS + !! real(double) rs : the variable for G(rs) function + !! real(double) A : interpolation parameter + !! real(double) alpha1 : interpolation parameter + !! real(double) beta1 : interpolation parameter + !! real(double) beta2 : interpolation parameter + !! real(double) beta3 : interpolation parameter + !! real(double) beta4 : interpolation parameter + !! real(double) p : interpolation parameter + !! OUTPUT + !! real(double) G : G(rs) + !! real(double) dG_drs : dG/drs (optional) + !! real(double) d2G_drs2 : d^2G/drs^2 (optional) + !! AUTHOR + !! L.Tong + !! CREATION DATE + !! 2013/03/01 + !! MODIFICATION HISTORY + !! SOURCE + !! + subroutine PW92_G(rs, A, alpha1, beta1, beta2, beta3, beta4, p, & + G, dG_drs, d2G_drs2) + use datatypes + use numbers + implicit none + + ! passed parameters + real(double), intent(in) :: rs, A, alpha1, beta1, beta2, beta3, beta4, p + real(double), intent(out) :: G + real(double), intent(out), optional :: dG_drs, d2G_drs2 + ! local variables + real(double) :: sq_rs, Q0, Q1, dQ0_drs, dQ1_drs, d2Q0_drs2, d2Q1_drs2 + + if (abs(rs) <= RD_ERR) then + G = zero + if (present(dG_drs)) dG_drs = zero + if (present(d2G_drs2)) d2G_drs2 = zero + return + end if + + sq_rs = sqrt(rs) + + Q0 = -two * A * (one + alpha1 * rs) + Q1 = two * A * (beta1 * sq_rs + beta2 * rs + & + beta3 * sq_rs**3 + beta4 * rs**(p + one)) + G = Q0 * log(one + one / Q1) + if (present(dG_drs) .or. present(d2G_drs2)) then + dQ0_drs = -two * A * alpha1 + dQ1_drs = A * (beta1 / sq_rs + two * beta2 + & + three * beta3 * sq_rs + four * beta4 * rs) + d2Q1_drs2 = half * A * (-beta1 / (sq_rs**3) + & + three * beta3 / sq_rs + & + eight * beta4) + end if + if (present(dG_drs)) then + dG_drs = dQ0_drs * log(one + one / Q1) - & + (Q0 * dQ1_drs) / (Q1 * (Q1 + one)) + end if + if (present(d2G_drs2)) then + d2G_drs2 = - (two * dQ0_drs * dQ1_drs + Q0 * d2Q1_drs2) / & + (Q1 * (Q1 + one)) + & + dQ1_drs * (two * Q1 + one) * Q0 * dQ1_drs / & + ((Q1 * (Q1 + one))**2) + end if + + return + end subroutine PW92_G + !***** + +end module XC diff --git a/src/system/system.example.make b/src/system/system.example.make index 9f050fc56..f8341d997 100644 --- a/src/system/system.example.make +++ b/src/system/system.example.make @@ -33,8 +33,10 @@ SCALAPACK = -lscalapack # LibXC compatibility # Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) #XC_LIBRARY = LibXC_v4 -XC_LIBRARY = LibXC_v5 -XC_LIB = -lxcf90 -lxc +#XC_LIBRARY = LibXC_v5 +XC_LIBRARY = LibXC_v7 +#XC_LIB = -lxcf90 -lxc +XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/usr/local/include # Set FFT library From 94520a1d15c1be9e36274b583a3118daa3fbcce7 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Tue, 14 Jan 2025 15:27:19 +0900 Subject: [PATCH 07/45] Instead of adding XC_LibXC_v7_module.f90, using f03 interface in *v5_module.f90 Instead of adding XC_LibXC_v7_module.f90, using f03 interface in *v5_module.f90 I have changed XC_LibXC_v5_module.f90, system/system.example.make and tools/BasisGeneration/radial_xc_LibXC_v5_module.f90 Other system.make files should be also changed depending on platforms. --- src/XC_LibXC_v5_module.f90 | 70 +- src/XC_LibXC_v7_module.f90 | 4423 ----------------- src/system/system.example.make | 5 +- .../radial_xc_LibXC_v5_module.f90 | 48 +- 4 files changed, 61 insertions(+), 4485 deletions(-) delete mode 100644 src/XC_LibXC_v7_module.f90 diff --git a/src/XC_LibXC_v5_module.f90 b/src/XC_LibXC_v5_module.f90 index ec61a5553..857c6ea3d 100644 --- a/src/XC_LibXC_v5_module.f90 +++ b/src/XC_LibXC_v5_module.f90 @@ -33,7 +33,7 @@ module XC use datatypes use global_module, only: area_ops, io_lun, iprint_ops, spin_factor - use xc_f90_lib_m + use xc_f03_lib_m implicit none @@ -55,8 +55,8 @@ module XC ! LibXC variables integer :: n_xc_terms integer, dimension(2) :: i_xc_family - type(xc_f90_func_t), dimension(:), allocatable :: xc_func - type(xc_f90_func_info_t), dimension(:), allocatable :: xc_info + type(xc_f03_func_t), dimension(:), allocatable :: xc_func + type(xc_f03_func_info_t), dimension(:), allocatable :: xc_info logical :: flag_use_libxc ! Conquest functional identifiers @@ -113,8 +113,8 @@ subroutine init_xc integer :: vmajor, vminor, vmicro, i, j integer, dimension(2) :: xcpart character(len=120) :: name, kind, family, ref - type(xc_f90_func_t) :: temp_xc_func - type(xc_f90_func_info_t) :: temp_xc_info + type(xc_f03_func_t) :: temp_xc_func + type(xc_f03_func_info_t) :: temp_xc_info ! Test for LibXC or CQ if(flag_functional_type<0) then @@ -123,7 +123,7 @@ subroutine init_xc ! LibXC functional specified ! -------------------------- flag_use_libxc = .true. - call xc_f90_version(vmajor, vminor, vmicro) + call xc_f03_version(vmajor, vminor, vmicro) if(inode==ionode.AND.iprint_ops>0) then if(vmajor>2) then write(io_lun,'(4x,"LibXC version: ",I2,".",I2,".",I2)') vmajor, vminor, vmicro @@ -141,13 +141,13 @@ subroutine init_xc i = floor(-flag_functional_type/1000.0_double) ! Temporary init to find exchange or correlation if(nspin==1) then - call xc_f90_func_init(temp_xc_func, i, XC_UNPOLARIZED) - temp_xc_info = xc_f90_func_get_info(temp_xc_func) + call xc_f03_func_init(temp_xc_func, i, XC_UNPOLARIZED) + temp_xc_info = xc_f03_func_get_info(temp_xc_func) else if(nspin==2) then - call xc_f90_func_init(temp_xc_func, i, XC_POLARIZED) - temp_xc_info = xc_f90_func_get_info(temp_xc_func) + call xc_f03_func_init(temp_xc_func, i, XC_POLARIZED) + temp_xc_info = xc_f03_func_get_info(temp_xc_func) end if - select case(xc_f90_func_info_get_kind(temp_xc_info)) + select case(xc_f03_func_info_get_kind(temp_xc_info)) case(XC_EXCHANGE) xcpart(1) = i xcpart(2) = -flag_functional_type - xcpart(1)*1000 @@ -155,25 +155,25 @@ subroutine init_xc xcpart(2) = i xcpart(1) = -flag_functional_type - xcpart(2)*1000 end select - call xc_f90_func_end(temp_xc_func) + call xc_f03_func_end(temp_xc_func) end if ! Now initialise and output allocate(xc_func(n_xc_terms),xc_info(n_xc_terms)) do i=1,n_xc_terms if(nspin==1) then - call xc_f90_func_init(xc_func(i), xcpart(i), XC_UNPOLARIZED) - xc_info(i) = xc_f90_func_get_info(xc_func(i)) + call xc_f03_func_init(xc_func(i), xcpart(i), XC_UNPOLARIZED) + xc_info(i) = xc_f03_func_get_info(xc_func(i)) else if(nspin==2) then - call xc_f90_func_init(xc_func(i), xcpart(i), XC_POLARIZED) - xc_info(i) = xc_f90_func_get_info(xc_func(i)) + call xc_f03_func_init(xc_func(i), xcpart(i), XC_POLARIZED) + xc_info(i) = xc_f03_func_get_info(xc_func(i)) end if ! Consistent threshold with Conquest - if(vmajor>2) call xc_f90_func_set_dens_threshold(xc_func(i),RD_ERR) - name = xc_f90_func_info_get_name(xc_info(i)) - i_xc_family(i) = xc_f90_func_info_get_family(xc_info(i)) + if(vmajor>2) call xc_f03_func_set_dens_threshold(xc_func(i),RD_ERR) + name = xc_f03_func_info_get_name(xc_info(i)) + i_xc_family(i) = xc_f03_func_info_get_family(xc_info(i)) if(i_xc_family(i)==XC_FAMILY_GGA) flag_is_GGA = .true. if(inode==ionode) then - select case(xc_f90_func_info_get_kind(xc_info(i))) + select case(xc_f03_func_info_get_kind(xc_info(i))) case (XC_EXCHANGE) write(kind, '(a)') 'an exchange functional' case (XC_CORRELATION) @@ -207,10 +207,10 @@ subroutine init_xc & " family and is defined in the reference(s):")') & trim(name), trim(kind), trim(family) j = 0 - ref = xc_f90_func_reference_get_ref(xc_f90_func_info_get_references(xc_info(i),j)) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) do while(j >= 0) write(io_lun, '(4x,a,i1,2a)') '[', j, '] ', trim(ref) - ref = xc_f90_func_reference_get_ref(xc_f90_func_info_get_references(xc_info(i),j)) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) end do else write(io_lun,'(4x,"The functional ", a, " is ", a, ", and it belongs to the ", a, & @@ -220,7 +220,7 @@ subroutine init_xc else if(iprint_ops>0) then write(io_lun,'(4x,"Using the ",a," functional ",a)') trim(family),trim(name) else - select case(xc_f90_func_info_get_kind(xc_info(i))) + select case(xc_f03_func_info_get_kind(xc_info(i))) case (XC_EXCHANGE) write(io_lun,fmt='(/4x,"Using X functional ",a)') trim(name) case (XC_CORRELATION) @@ -318,10 +318,10 @@ subroutine write_xc_refs write(io_lun,fmt='(4x,"XC references from LibXC:")') do j=1,n_xc_terms i = 0 - ref = xc_f90_func_reference_get_ref(xc_f90_func_info_get_references(xc_info(j),i)) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) do while(i >= 0) write(io_lun, '(6x,a)') trim(ref) - ref = xc_f90_func_reference_get_ref(xc_f90_func_info_get_references(xc_info(j),i)) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) end do end do return @@ -700,10 +700,10 @@ subroutine get_libxc_potential(density, xc_potential, xc_epsilon, xc_energy, siz if(nspin>1) then select case( i_xc_family(nxc) ) case(XC_FAMILY_LDA) - call xc_f90_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + call xc_f03_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & alt_dens, eps, vrho ) case(XC_FAMILY_GGA) - call xc_f90_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + call xc_f03_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & alt_dens, sigma, eps, vrho, vsigma ) end select @@ -784,10 +784,10 @@ subroutine get_libxc_potential(density, xc_potential, xc_epsilon, xc_energy, siz else ! No spin select case (i_xc_family(nxc)) case(XC_FAMILY_LDA) - call xc_f90_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + call xc_f03_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & alt_dens, eps, vrho ) case(XC_FAMILY_GGA) - call xc_f90_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & + call xc_f03_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & alt_dens, sigma, eps, vrho, vsigma ) end select @@ -1007,7 +1007,7 @@ subroutine get_libxc_dpotential(density, dxc_potential, size, density_out) if(nspin>1) then ! NB no spin-polarised GGA NSC forces select case (i_xc_family(j)) case(XC_FAMILY_LDA) - call xc_f90_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) + call xc_f03_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(:n_my_grid_points,1,1) +vrho(1:3*n_my_grid_points-2:3) dxc_potential(1:n_my_grid_points,1,2) = dxc_potential(:n_my_grid_points,1,2) +vrho(2:3*n_my_grid_points-1:3) dxc_potential(1:n_my_grid_points,2,1) = dxc_potential(:n_my_grid_points,2,1) +vrho(2:3*n_my_grid_points-1:3) @@ -1016,13 +1016,13 @@ subroutine get_libxc_dpotential(density, dxc_potential, size, density_out) else select case (i_xc_family(j)) case(XC_FAMILY_LDA) - call xc_f90_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) + call xc_f03_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) + & vrho(1:n_my_grid_points) case(XC_FAMILY_GGA) - call xc_f90_gga_vxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,vrho,& + call xc_f03_gga_vxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,vrho,& vsigma) - call xc_f90_gga_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,& + call xc_f03_gga_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,& v2rho2,v2rhosigma,v2sigma2) end select @@ -1219,9 +1219,9 @@ subroutine get_libxc_energy(density, xc_energy, size) eps = zero select case( i_xc_family(nxc) ) case(XC_FAMILY_LDA) - call xc_f90_lda_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, eps ) + call xc_f03_lda_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, eps ) case(XC_FAMILY_GGA) - call xc_f90_gga_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, sigma, eps ) + call xc_f03_gga_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, sigma, eps ) end select xc_epsilon(1:n_my_grid_points) = xc_epsilon(1:n_my_grid_points) + eps(1:n_my_grid_points) end do ! nxc = n_xc_terms diff --git a/src/XC_LibXC_v7_module.f90 b/src/XC_LibXC_v7_module.f90 deleted file mode 100644 index 857c6ea3d..000000000 --- a/src/XC_LibXC_v7_module.f90 +++ /dev/null @@ -1,4423 +0,0 @@ -! ------------------------------------------------------------------------------ -! $Id$ -! ------------------------------------------------------------------------------ -! Module XC -! ------------------------------------------------------------------------------ -! Code area 3: Operators -! ------------------------------------------------------------------------------ - -!!****h* Conquest/XC -!! PURPOSE -!! Provides the interface to LibXC routines along with the complete Conquest -!! library of XC functionals. This means that any changes to XC_CQ_module.f90 -!! need to be duplicated in this module but it simplifies the overall source -!! code and removes one layer of subroutine calls. See also comments in the -!! header for XC_CQ_module.f90 -!! AUTHOR -!! D. R. Bowler -!! CREATION DATE -!! 2018/02/13 -!! MODIFICATION HISTORY -!! 2018/06/15 12:21 dave -!! Added spin_factor in module use statements -!! 2019/04/09 zamaan -!! Off-diagonal elements of stress tensor added -!! 2021/05/12 tsuyoshi, dave and others -!! Created interface for LibXC v5 -!! Main changes involve XC types and function calls -!! 2021/07/22 14:26 dave -!! Added get_xc_energy routine (and associated) -!! SOURCE -!! -module XC - - use datatypes - use global_module, only: area_ops, io_lun, iprint_ops, spin_factor - use xc_f03_lib_m - - implicit none - - save - - ! Public, general variables - real(double), dimension(3,3), public :: XC_GGA_stress - real(double), public :: s_6 ! For DFT D2 - logical, public :: flag_is_GGA ! Needed for non-SC forces - - ! Numerical flag choosing functional type - integer, public :: flag_functional_type - ! Allow user to specify different functional to pseudopotentials - logical, public :: flag_different_functional - - ! Public methods - public :: get_xc_potential, get_dxc_potential, init_xc, get_xc_energy - - ! LibXC variables - integer :: n_xc_terms - integer, dimension(2) :: i_xc_family - type(xc_f03_func_t), dimension(:), allocatable :: xc_func - type(xc_f03_func_info_t), dimension(:), allocatable :: xc_info - logical :: flag_use_libxc - - ! Conquest functional identifiers - integer, parameter :: functional_lda_pz81 = 1 - integer, parameter :: functional_lda_gth96 = 2 - integer, parameter :: functional_lda_pw92 = 3 ! PRB 45, 13244 (1992) + PRL 45, 566 (1980) - integer, parameter :: functional_xalpha = 4 ! Slater/Dirac exchange only ; no correlation - integer, parameter :: functional_hartree_fock = 10 ! Hartree-Fock exact exchange ; no correlation - - integer, parameter :: functional_gga_pbe96 = 101 ! Standard PBE - integer, parameter :: functional_gga_pbe96_rev98 = 102 ! revPBE (PBE + Zhang-Yang 1998) - integer, parameter :: functional_gga_pbe96_r99 = 103 ! RPBE (PBE + Hammer-Hansen-Norskov 1999) - integer, parameter :: functional_gga_pbe96_wc = 104 ! WC (Wu-Cohen 2006) - - integer, parameter :: functional_hyb_pbe0 = 201 ! PBE0 (hybrid PBE with exx_alpha=0.25) - - ! Conquest output string - character(len=15) :: functional_description -!!***** - -contains - - !!****f* XC_module/init_xc * - !! - !! NAME - !! init_xc - !! USAGE - !! - !! PURPOSE - !! Initialises the exchange-correlation calculations - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2018/02/05 - !! MODIFICATION HISTORY - !! 2018/02/15 11:56 dave - !! Define flag_is_GGA for LibXC - !! SOURCE - !! - subroutine init_xc - - use global_module, ONLY : nspin, flag_dft_d2 - use GenComms, ONLY : inode, ionode, cq_abort, cq_warn - use numbers - - implicit none - - ! Local variables - character(len=80) :: sub_name = "init_xc" - integer :: vmajor, vminor, vmicro, i, j - integer, dimension(2) :: xcpart - character(len=120) :: name, kind, family, ref - type(xc_f03_func_t) :: temp_xc_func - type(xc_f03_func_info_t) :: temp_xc_info - - ! Test for LibXC or CQ - if(flag_functional_type<0) then - flag_is_GGA = .false. - ! -------------------------- - ! LibXC functional specified - ! -------------------------- - flag_use_libxc = .true. - call xc_f03_version(vmajor, vminor, vmicro) - if(inode==ionode.AND.iprint_ops>0) then - if(vmajor>2) then - write(io_lun,'(4x,"LibXC version: ",I2,".",I2,".",I2)') vmajor, vminor, vmicro - else - write(io_lun,'(4x,"LibXC version: ",I2,".",I2)') vmajor, vminor - end if - end if - ! Identify the functional - if(-flag_functional_type<1000) then ! Only exchange OR combined exchange-correlation - n_xc_terms = 1 - xcpart(1) = -flag_functional_type - else ! Separate the two parts - n_xc_terms = 2 - ! Make exchange first, correlation second for consistency - i = floor(-flag_functional_type/1000.0_double) - ! Temporary init to find exchange or correlation - if(nspin==1) then - call xc_f03_func_init(temp_xc_func, i, XC_UNPOLARIZED) - temp_xc_info = xc_f03_func_get_info(temp_xc_func) - else if(nspin==2) then - call xc_f03_func_init(temp_xc_func, i, XC_POLARIZED) - temp_xc_info = xc_f03_func_get_info(temp_xc_func) - end if - select case(xc_f03_func_info_get_kind(temp_xc_info)) - case(XC_EXCHANGE) - xcpart(1) = i - xcpart(2) = -flag_functional_type - xcpart(1)*1000 - case(XC_CORRELATION) - xcpart(2) = i - xcpart(1) = -flag_functional_type - xcpart(2)*1000 - end select - call xc_f03_func_end(temp_xc_func) - end if - ! Now initialise and output - allocate(xc_func(n_xc_terms),xc_info(n_xc_terms)) - do i=1,n_xc_terms - if(nspin==1) then - call xc_f03_func_init(xc_func(i), xcpart(i), XC_UNPOLARIZED) - xc_info(i) = xc_f03_func_get_info(xc_func(i)) - else if(nspin==2) then - call xc_f03_func_init(xc_func(i), xcpart(i), XC_POLARIZED) - xc_info(i) = xc_f03_func_get_info(xc_func(i)) - end if - ! Consistent threshold with Conquest - if(vmajor>2) call xc_f03_func_set_dens_threshold(xc_func(i),RD_ERR) - name = xc_f03_func_info_get_name(xc_info(i)) - i_xc_family(i) = xc_f03_func_info_get_family(xc_info(i)) - if(i_xc_family(i)==XC_FAMILY_GGA) flag_is_GGA = .true. - if(inode==ionode) then - select case(xc_f03_func_info_get_kind(xc_info(i))) - case (XC_EXCHANGE) - write(kind, '(a)') 'an exchange functional' - case (XC_CORRELATION) - write(kind, '(a)') 'a correlation functional' - case (XC_EXCHANGE_CORRELATION) - write(kind, '(a)') 'an exchange-correlation functional' - case (XC_KINETIC) - write(kind, '(a)') 'a kinetic energy functional' - case default - write(kind, '(a)') 'of unknown kind' - end select - - select case (i_xc_family(i)) - case (XC_FAMILY_LDA); - write(family,'(a)') "LDA" - case (XC_FAMILY_GGA); - write(family,'(a)') "GGA" - case (XC_FAMILY_HYB_GGA); - write(family,'(a)') "Hybrid GGA" - case (XC_FAMILY_MGGA); - write(family,'(a)') "MGGA" - case (XC_FAMILY_HYB_MGGA); - write(family,'(a)') "Hybrid MGGA" - case default; - write(family,'(a)') "unknown" - end select - - if(iprint_ops>2) then - if(vmajor>2) then - write(io_lun,'(4x,"The functional ", a, " is ", a, ", it belongs to the ", a, & - & " family and is defined in the reference(s):")') & - trim(name), trim(kind), trim(family) - j = 0 - ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) - do while(j >= 0) - write(io_lun, '(4x,a,i1,2a)') '[', j, '] ', trim(ref) - ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) - end do - else - write(io_lun,'(4x,"The functional ", a, " is ", a, ", and it belongs to the ", a, & - & " family")') & - trim(name), trim(kind), trim(family) - end if - else if(iprint_ops>0) then - write(io_lun,'(4x,"Using the ",a," functional ",a)') trim(family),trim(name) - else - select case(xc_f03_func_info_get_kind(xc_info(i))) - case (XC_EXCHANGE) - write(io_lun,fmt='(/4x,"Using X functional ",a)') trim(name) - case (XC_CORRELATION) - write(io_lun,fmt='(4x,"Using C functional ",a/)') trim(name) - case (XC_EXCHANGE_CORRELATION) - write(io_lun,fmt='(/4x,"Using XC functional ",a/)') trim(name) - case default - write(io_lun,fmt='(/4x,"Using functional ",a/)') trim(name) - end select - end if - end if - end do - else - ! ----------------------------- - ! Conquest functional specified - ! ----------------------------- - flag_use_libxc = .false. - if(nspin==2) then ! Check for spin-compatible functionals - if ( flag_functional_type == functional_lda_pz81 .or. & - flag_functional_type == functional_lda_gth96 ) then - call cq_warn(sub_name, "Functional not compatible with spin; reverting to LDA-PW92 ",flag_functional_type) - flag_functional_type = functional_lda_pw92 - end if - end if - select case(flag_functional_type) - case (functional_lda_pz81) - functional_description = 'LDA PZ81' - if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") - case (functional_lda_gth96) - functional_description = 'LDA GTH96' - if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") - case (functional_lda_pw92) - functional_description = 'LSDA PW92' - if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") - case (functional_gga_pbe96) - functional_description = 'GGA PBE96' - if(flag_dft_d2) s_6 = 0.75_double - case (functional_gga_pbe96_rev98) ! This is PBE with the parameter correction - functional_description = 'GGA revPBE98' ! in Zhang & Yang, PRL 80:4, 890 (1998) - if(flag_dft_d2) s_6 = 1.25_double - case (functional_gga_pbe96_r99) ! This is PBE with the functional form redefinition - functional_description = 'GGA RPBE99' ! in Hammer et al., PRB 59:11, 7413-7421 (1999) - if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") - case (functional_gga_pbe96_wc) ! Wu-Cohen nonempirical GGA functional - functional_description = 'GGA WC' ! in Wu and Cohen, PRB 73. 235116, (2006) - if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") - case (functional_hyb_pbe0) ! This is PB0E with the functional form redefinition - functional_description = 'hyb PBE0' - if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") - case default - functional_description = 'LSDA PW92' - if(flag_dft_d2) call cq_abort("DFT-D2 only compatible with PBE and rPBE") - end select - if(inode==ionode) write(io_lun,'(/4x, "The functional used will be ", a15/)') functional_description - ! This is a temporary, Conquest-specific test - we will - ! need to keep an eye on this and potentially introduce - ! tests against functional name - if(flag_functional_type>100) then - flag_is_GGA = .true. - else - flag_is_GGA = .false. - end if - - end if ! if selecting LibXC or CQ - end subroutine init_xc - !!*** - - !!****f* XC_module/write_xc_refs * - !! - !! NAME - !! write_xc_refs - !! USAGE - !! - !! PURPOSE - !! Write XC references - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2020/05/26 - !! MODIFICATION HISTORY - !! - !! SOURCE - !! - subroutine write_xc_refs - - implicit none - - integer :: i, j - character(len=120) :: ref - - write(io_lun,fmt='(4x,"XC references from LibXC:")') - do j=1,n_xc_terms - i = 0 - ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) - do while(i >= 0) - write(io_lun, '(6x,a)') trim(ref) - ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) - end do - end do - return - end subroutine write_xc_refs - !!*** - - !!****f* XC/get_xc_potential * - !! - !! NAME - !! get_xc_potential - !! USAGE - !! - !! PURPOSE - !! Interface to LibXC and CQ routines - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2018/02/13 - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_xc_potential(density, xc_potential, xc_epsilon, & - xc_energy, size, &!x_epsilon, c_epsilon, & - x_energy) - - use datatypes - use numbers - use global_module, only: exx_niter, exx_siter, exx_alpha, nspin - - implicit none - - ! Passed variables - integer :: size - real(double) :: xc_energy - real(double), dimension(size,nspin) :: density - real(double), dimension(size,nspin) :: xc_potential - real(double), dimension(size) :: xc_epsilon - ! optional - !real(double), dimension(:), optional :: x_epsilon, c_epsilon - real(double), optional :: x_energy - - ! Local variables - real(double) :: loc_x_energy, exx_tmp - - XC_GGA_stress = zero - if(flag_use_libxc) then - call get_libxc_potential(density=density, size=size,& - xc_potential =xc_potential, & - xc_epsilon =xc_epsilon, & - xc_energy =xc_energy, & - x_energy =loc_x_energy ) - else - select case(flag_functional_type) - case (functional_lda_pz81) - ! NOT SPIN POLARISED - call get_xc_potential_LDA_PZ81(density=density(:,1), size=size, & - xc_potential=xc_potential(:,1), & - xc_epsilon =xc_epsilon, & - xc_energy =xc_energy, & - x_energy =loc_x_energy ) - ! - ! - case (functional_lda_gth96) - ! NOT SPIN POLARISED - call get_GTH_xc_potential(density(:,1), xc_potential(:,1), & - xc_epsilon, xc_energy, size) - ! not possible to decompose the xc energy... - loc_x_energy = zero - ! - ! - case (functional_lda_pw92) - call get_xc_potential_LSDA_PW92(density=density, size=size,& - xc_potential =xc_potential, & - xc_epsilon =xc_epsilon, & - xc_energy_total =xc_energy, & - x_energy_total =loc_x_energy ) - ! - ! - case (functional_gga_pbe96) - call get_xc_potential_GGA_PBE(density=density, grid_size=size, & - xc_potential=xc_potential, & - xc_epsilon =xc_epsilon, & - xc_energy =xc_energy, & - x_energy =loc_x_energy ) - ! - ! - case (functional_gga_pbe96_rev98) - call get_xc_potential_GGA_PBE(density=density, grid_size=size, & - xc_potential=xc_potential, & - xc_epsilon =xc_epsilon, & - xc_energy =xc_energy, & - x_energy =loc_x_energy, & - flavour=functional_gga_pbe96_rev98 ) - ! - ! - case (functional_gga_pbe96_r99) - call get_xc_potential_GGA_PBE(density=density, grid_size=size, & - xc_potential=xc_potential, & - xc_epsilon =xc_epsilon, & - xc_energy =xc_energy, & - x_energy =loc_x_energy, & - flavour=functional_gga_pbe96_r99 ) - ! - ! - case (functional_gga_pbe96_wc) - call get_xc_potential_GGA_PBE(density=density, grid_size=size, & - xc_potential=xc_potential, & - xc_epsilon =xc_epsilon, & - xc_energy =xc_energy, & - x_energy =loc_x_energy, & - flavour=functional_gga_pbe96_wc ) - ! - ! - case (functional_hyb_pbe0) - ! - if ( exx_niter <= exx_siter ) then - exx_tmp = one - else - exx_tmp = one - exx_alpha - end if - ! - call get_xc_potential_hyb_PBE0(density=density, grid_size=size, & - xc_potential=xc_potential, & - xc_epsilon =xc_epsilon, & - exx_a =exx_tmp, & - xc_energy =xc_energy, & - x_energy =loc_x_energy, & - flavour=functional_gga_pbe96 ) - ! - ! - case (functional_hartree_fock) - ! **** - ! not optimal but experimental - if (exx_niter <= exx_siter) then - ! for the first call of get_H_matrix using Hartree-Fock method - ! to get something not to much stupid ; use pure exchange functional - ! in near futur such as Xalpha - call get_xc_potential_LSDA_PW92(density=density, size=size,& - xc_potential =xc_potential, & - xc_epsilon =xc_epsilon, & - xc_energy_total =xc_energy, & - x_energy_total =loc_x_energy ) - else - xc_epsilon = zero - xc_energy = zero - xc_epsilon = zero - xc_potential = zero - loc_x_energy = zero - end if - ! - ! - case default - call get_xc_potential_LSDA_PW92(density, xc_potential, & - xc_epsilon, xc_energy, size) - ! - ! - end select - end if - if(present(x_energy)) x_energy = loc_x_energy - return - end subroutine get_xc_potential - !!*** - - !!****f* XC/get_dxc_potential * - !! - !! NAME - !! get_dxc_potential - !! USAGE - !! - !! PURPOSE - !! Interface to LibXC or CQ routines - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2018/02/13 - !! MODIFICATION HISTORY - !! 2018/02/14 11:00 dave - !! Bug fix: introduced test for presence of density_out (only used for GGA, PCC) - !! 2018/02/15 10:46 dave - !! Added branch based on presence of density_out to call to libxc_dpotential - !! SOURCE - !! - subroutine get_dxc_potential(density, dxc_potential, nsize, density_out) - - use GenComms, only: cq_abort - implicit none - - ! Passed variables - integer :: nsize - real(double), dimension(:,:) :: density - real(double), dimension(:,:,:) :: dxc_potential - real(double), dimension(:,:), optional :: density_out - - if(flag_is_GGA) then - if(.NOT.present(density_out)) call cq_abort("Error: get_dxc_potential called without density_out for GGA") - end if - if(flag_use_libxc) then - if(present(density_out)) then - call get_libxc_dpotential(density, dxc_potential,nsize,density_out) - else - call get_libxc_dpotential(density, dxc_potential,nsize) - end if - else - select case (flag_functional_type) - case (functional_lda_pz81) - ! NON SPIN POLARISED CALCULATION ONLY - ! - call get_dxc_potential_LDA_PZ81(density(:,1), dxc_potential(:,1,1), nsize) - ! - case (functional_lda_gth96) - ! NON SPIN POLARISED CALCULATION ONLY - call get_GTH_dxc_potential(density(:,1), dxc_potential(:,1,1), nsize) - ! - case (functional_lda_pw92) - call get_dxc_potential_LSDA_PW92(density, dxc_potential, nsize) - ! - case (functional_gga_pbe96) ! Original PBE - ! NON SPIN POLARISED CALCULATION ONLY - call get_dxc_potential_GGA_PBE(density = density(:,1), & - density_out = density_out(:,1), & - dxc_potential = dxc_potential(:,1,1), & - size = nsize) - ! - case (functional_gga_pbe96_rev98) - ! PBE with kappa of PRL 80, 890 (1998) - call get_dxc_potential_GGA_PBE(density(:,1), & - density_out(:,1), & - dxc_potential(:,1,1), nsize, & - functional_gga_pbe96_rev98) - case (functional_gga_pbe96_r99) - ! PBE with form of PRB 59, 7413 (1999) - ! NON SPIN POLARISED CALCULATION ONLY - call get_dxc_potential_GGA_PBE(density(:,1), & - density_out(:,1), & - dxc_potential(:,1,1), nsize, & - functional_gga_pbe96_r99) - ! - case default - call get_dxc_potential_LDA_PZ81(density(:,1), dxc_potential(:,1,1), nsize) - ! - end select - end if - end subroutine get_dxc_potential - !!*** - - !!****f* XC_module/get_libxc_potential * - !! - !! NAME - !! get_libxc_potential - !! USAGE - !! - !! PURPOSE - !! Calculates the exchange-correlation potential - !! on the grid using LibXC - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2018/02/05 - !! MODIFICATION HISTORY - !! 2018/02/15 11:56 dave - !! Bug fix: only scale sigma and build_gradient if we have a GGA functional - !! Changed to use flag_is_GGA - !! 2021/05/17 10:45 dave - !! Tidying and small changes (mainly using stride for vsigma and vrho indexing) - !! SOURCE - !! - subroutine get_libxc_potential(density, xc_potential, xc_epsilon, xc_energy, size, x_energy) - - use datatypes - use numbers - use GenComms, only: gsum - use GenBlas, only: dot - use dimens, only: grid_point_volume, n_my_grid_points - use global_module, only : nspin, io_lun, flag_full_stress, flag_stress - use fft_module, only: fft3, recip_vector - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), intent(out) :: xc_energy - real(double), dimension(:,:), intent(in) :: density - real(double), dimension(:,:), intent(out) :: xc_potential - real(double), dimension(:), intent(out) :: xc_epsilon - ! optional - real(double), intent(out), optional :: x_energy - - ! local variables - real(double), dimension(:), allocatable :: sigma, eps, vrho, vsigma, temp ! Temporary variables - complex(double), dimension(:,:), allocatable :: ng - real(double), dimension(:), allocatable :: alt_dens - real(double), dimension(:,:,:), allocatable :: grad_density - real(double) :: rho_tot - integer :: stat, i, spin, nxc, j - logical :: flag_exchange_e = .false. - - flag_exchange_e = PRESENT(x_energy) - ! Storage space for individual components - allocate(vrho(n_my_grid_points*nspin),eps(n_my_grid_points),alt_dens(n_my_grid_points*nspin)) - ! For GGA, create sigma (\nabla n dot \nabla n) from gradient - if(flag_is_GGA) then - if(nspin>1) then - allocate(vsigma(n_my_grid_points*3),sigma(n_my_grid_points*3)) - else - allocate(vsigma(n_my_grid_points),sigma(n_my_grid_points)) - endif - ! If GGA, we need to find and adapt gradient - allocate(grad_density(size,3,nspin),temp(size),ng(size,3),STAT=stat) - sigma = zero - grad_density = zero - do spin = 1, nspin - call build_gradient(density(:,spin), grad_density(:,:,spin), size) - end do - ! Build modulus - NB LibXC uses spin, point for density ! - if(nspin>1) then - ! This is ugly, but there's not really a better way - do i=1,n_my_grid_points - ! \nabla n_alpha dot \nabla n_alpha - sigma(1+(i-1)*3) = & - grad_density(i,1,1)*grad_density(i,1,1) + & - grad_density(i,2,1)*grad_density(i,2,1) + & - grad_density(i,3,1)*grad_density(i,3,1) - ! \nabla n_alpha dot \nabla n_beta - sigma(2+(i-1)*3) = & - grad_density(i,1,1)*grad_density(i,1,2) + & - grad_density(i,2,1)*grad_density(i,2,2) + & - grad_density(i,3,1)*grad_density(i,3,2) - ! \nabla n_beta dot \nabla n_beta - sigma(3+(i-1)*3) = & - grad_density(i,1,2)*grad_density(i,1,2) + & - grad_density(i,2,2)*grad_density(i,2,2) + & - grad_density(i,3,2)*grad_density(i,3,2) - end do - else - sigma(1:n_my_grid_points) = & - grad_density(1:n_my_grid_points,1,1)*grad_density(1:n_my_grid_points,1,1) + & - grad_density(1:n_my_grid_points,2,1)*grad_density(1:n_my_grid_points,2,1) + & - grad_density(1:n_my_grid_points,3,1)*grad_density(1:n_my_grid_points,3,1) - end if - end if - xc_epsilon = zero - xc_potential = zero - XC_GGA_stress = zero - ! If we have spin, re-order density to have spin index first - ! Otherwise scale - if(nspin>1) then - do i = 1, n_my_grid_points - do spin=1,nspin - alt_dens(spin + (i-1)*nspin) = density(i,spin) - end do - end do - else - ! Scaling for spin; sigma needs four because it is nabla n .dot. nabla n - alt_dens(1:n_my_grid_points) = two*density(1:n_my_grid_points,1) - if(flag_is_GGA) then - sigma(:) = four*sigma(:) - grad_density(:,:,1) = two*grad_density(:,:,1) - end if - end if - ! Create XC energy and potential - do nxc = 1,n_xc_terms - vrho = zero - eps = zero - if(nspin>1) then - select case( i_xc_family(nxc) ) - case(XC_FAMILY_LDA) - call xc_f03_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & - alt_dens, eps, vrho ) - case(XC_FAMILY_GGA) - call xc_f03_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & - alt_dens, sigma, eps, vrho, vsigma ) - end select - - ! d e_xc/d n - ! Awkward indexing because LibXC does spin first then grid point - do spin=1,nspin - xc_potential(1:n_my_grid_points,spin) = xc_potential(1:n_my_grid_points,spin) + & - vrho(spin:nspin*n_my_grid_points+spin-2:nspin) - end do - - if(flag_is_GGA) then - ! Calculate the second term, from d (n eps_xc) / d sigma - ng = zero - ! FFT d n Exc/d sigma \nabla n to reciprocal space - ! spin up - temp = zero - do i=1,3 - ! d eps / d sigma(up.up) grad rho(up) + d eps / d sigma(up.down) grad rho(down) - ! Note the stride here which comes from LibXC putting the spin index first - temp(1:n_my_grid_points) = two*vsigma(1:3*n_my_grid_points-2:3)*grad_density(1:n_my_grid_points,i,1) + & - vsigma(2:3*n_my_grid_points-1:3)*grad_density(1:n_my_grid_points,i,2) - ! For non-orthogonal stresses, introduce another loop and dot with grad_density(:,j) - if (flag_stress) then - if (flag_full_stress) then - do j=1,3 ! zamaan - I think this is what the comment above means? - XC_GGA_stress(i,j) = XC_GGA_stress(i,j) - & - dot(n_my_grid_points,temp(:),1,grad_density(:,j,1),1) - end do - else - XC_GGA_stress(i,i) = XC_GGA_stress(i,i) - & - dot(n_my_grid_points,temp(:),1,grad_density(:,i,1),1) - end if - end if - call fft3(temp, ng(:,i), size, -1) - end do - ! Dot product with iG to get the second term in reciprocal space - ! Accumulate in ng(:,1) as it won't be used again - ng(:,1) = minus_i * ( ng(:,1)*recip_vector(:,1) + & - ng(:,2)*recip_vector(:,2) + ng(:,3)*recip_vector(:,3)) - ! Use temp for the second term in real space - temp = zero - call fft3(temp(:), ng(:,1), size, +1) - xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & - temp(1:n_my_grid_points) - ! spin down - temp = zero - ng = zero - do i=1,3 - ! d eps / d sigma(down.down) grad rho(down) + d eps / d sigma(up.down) grad rho(up) - ! Again, note stride - temp(1:n_my_grid_points) = vsigma(2:3*n_my_grid_points-1:3)*grad_density(1:n_my_grid_points,i,1) + & - two*vsigma(3:3*n_my_grid_points:3)*grad_density(1:n_my_grid_points,i,2) - ! For non-orthogonal stresses, introduce another loop and dot with grad_density(:,j) - if (flag_stress) then - if (flag_full_stress) then - do j=1,3 - XC_GGA_stress(i,j) = XC_GGA_stress(i,j) - & - dot(n_my_grid_points,temp(:),1,grad_density(:,j,2),1) - end do - else - XC_GGA_stress(i,i) = XC_GGA_stress(i,i) - & - dot(n_my_grid_points,temp(:),1,grad_density(:,i,2),1) - end if - end if - call fft3(temp, ng(:,i), size, -1) - end do - ! Dot product with iG to get the second term in reciprocal space - ! Accumulate in ng(:,1) as it won't be used again - ng(:,1) = minus_i * ( ng(:,1)*recip_vector(:,1) + & - ng(:,2)*recip_vector(:,2) + ng(:,3)*recip_vector(:,3)) - ! Use vsigma for the second term in real space - temp = zero - call fft3(temp(:), ng(:,1), size, +1) - xc_potential(1:n_my_grid_points,2) = xc_potential(1:n_my_grid_points,2) + & - temp(1:n_my_grid_points) - end if ! flag_is_GGA - - else ! No spin - select case (i_xc_family(nxc)) - case(XC_FAMILY_LDA) - call xc_f03_lda_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & - alt_dens, eps, vrho ) - case(XC_FAMILY_GGA) - call xc_f03_gga_exc_vxc( xc_func(nxc), int(n_my_grid_points,kind=wide), & - alt_dens, sigma, eps, vrho, vsigma ) - end select - - ! d e_xc/d n - xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & - vrho(1:n_my_grid_points) - - if(flag_is_GGA) then - ! Calculate the second term in the potential, from d (n eps_xc) / d sigma - ng = zero - ! FFT d n Exc/d sigma \nabla n to reciprocal space - temp = zero - do i=1,3 - temp(1:n_my_grid_points) = vsigma(1:n_my_grid_points)*grad_density(1:n_my_grid_points,i,1) - ! For non-orthogonal stresses, introduce another loop and dot with grad_density(:,j) - if (flag_stress) then - if (flag_full_stress) then - do j=1,3 - XC_GGA_stress(i,j) = XC_GGA_stress(i,j) - & - dot(n_my_grid_points,temp(:),1,grad_density(:,j,1),1) - end do - else - XC_GGA_stress(i,i) = XC_GGA_stress(i,i) - & - dot(n_my_grid_points,temp(:),1,grad_density(:,i,1),1) - end if - end if - call fft3(temp, ng(:,i), size, -1) - end do - ! Dot product with iG to get the second term in reciprocal space - ! Accumulate in ng(:,1) as it won't be used again - ng(:,1) = two * minus_i * ( ng(:,1)*recip_vector(:,1) + & - ng(:,2)*recip_vector(:,2) + ng(:,3)*recip_vector(:,3)) - ! Use vsigma for the second term in real space - !vsigma = zero - !call fft3(vsigma(:), ng(:,1), size, +1) - !xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & - ! vsigma(1:n_my_grid_points) - ! Actually I think temp is fine - temp = zero - call fft3(temp(:), ng(:,1), size, +1) - xc_potential(1:n_my_grid_points,1) = xc_potential(1:n_my_grid_points,1) + & - temp(1:n_my_grid_points) - end if ! flag_is_GGA - - end if ! nspin - - xc_epsilon(1:n_my_grid_points) = xc_epsilon(1:n_my_grid_points) + eps(1:n_my_grid_points) - - if(nxc==1) then - if(flag_exchange_e) then - x_energy = zero - do i=1,n_my_grid_points - rho_tot = density(i,1) + density(i,nspin) - x_energy = x_energy + eps(i)*rho_tot - end do - end if - end if - end do ! nxc = n_xc_terms - - deallocate(vrho,eps,alt_dens) - if(flag_is_GGA)then - deallocate(grad_density,sigma,vsigma,ng,temp) - if (flag_stress) then - XC_GGA_stress = XC_GGA_stress*grid_point_volume - call gsum(XC_GGA_stress,3,3) - end if - end if - ! Sum to get energy - xc_energy = zero - do i=1,n_my_grid_points - rho_tot = density(i,1) + density(i,nspin) - xc_energy = xc_energy + xc_epsilon(i)*rho_tot - end do - call gsum(xc_energy) - ! and 'integrate' the energy over the volume of the grid point - xc_energy = xc_energy * grid_point_volume - if(flag_exchange_e) then - call gsum(x_energy) - x_energy = x_energy * grid_point_volume - end if - return - end subroutine get_libxc_potential - !!*** - - !!****f* XC_module/get_libxc_dpotential * - !! - !! NAME - !! get_libxc_dpotential - !! USAGE - !! - !! PURPOSE - !! Calculates the derivative of the exchange-correlation potential - !! on the grid using LibXC - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2018/02/15 - !! MODIFICATION HISTORY - !! 2018/02/16 10:11 dave - !! Moved calculation of dxc inside case - !! Non-spin GGA implementation started - !! 2018/02/23 15:09 dave - !! Bug fix: moved scaling of diff_rho inside GGA if loop - !! 2021/05/20 11:52 dave - !! Tidying select clause - !! SOURCE - !! - subroutine get_libxc_dpotential(density, dxc_potential, size, density_out) - - use datatypes - use numbers - use GenComms, only: gsum - use GenBlas, only: dot - use dimens, only: grid_point_volume, n_my_grid_points - use global_module, only : nspin, io_lun - use fft_module, only: fft3, recip_vector - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), dimension(:,:), intent(in) :: density - real(double), dimension(:,:,:), intent(out) :: dxc_potential - real(double), dimension(:,:), intent(in), optional :: density_out - - ! Local variables - real(double) :: tmp_factor - real(double), dimension(:), allocatable :: alt_dens, sigma,vrho,vsigma, & - v2rho2, v2rhosigma, v2sigma2, diff_rho - real(double), dimension(:,:), allocatable :: tmp3 - real(double), dimension(:,:,:), allocatable :: grad_density - complex(double), dimension(:), allocatable :: tmp1 - complex(double), dimension(:,:), allocatable :: ng, tmp2 - integer :: stat, i, spin, n, j - - ! Initialise - allocate and zero - if(nspin>1) then - allocate(alt_dens(n_my_grid_points*3),vrho(n_my_grid_points*3)) - else - allocate(alt_dens(n_my_grid_points),vrho(n_my_grid_points)) - end if - alt_dens = zero - if(flag_is_GGA) then - allocate(diff_rho(size)) - if(nspin>1) then - allocate(sigma(n_my_grid_points*3),& - vsigma(n_my_grid_points*3), v2rho2(n_my_grid_points*3), & - v2rhosigma(n_my_grid_points*6), v2sigma2(n_my_grid_points*6)) - allocate(tmp1(size),tmp2(size,3),tmp3(size,3)) - else - allocate(sigma(n_my_grid_points), & - vsigma(n_my_grid_points), v2rho2(n_my_grid_points), & - v2rhosigma(n_my_grid_points), v2sigma2(n_my_grid_points)) - allocate(tmp1(size),tmp2(size,3),tmp3(size,3)) - endif - ! If GGA, we need to find and adapt gradient - allocate(grad_density(size,3,nspin),ng(size,3),STAT=stat) - sigma = zero - grad_density = zero - diff_rho = zero - do spin = 1, nspin - call build_gradient(density(:,spin), grad_density(:,:,spin), size) - end do - ! Build modulus - NB LibXC uses spin, point for density ! - if(nspin>1) then - ! This is ugly, but there's not really a better way - do i=1,n_my_grid_points - ! \nabla n_alpha dot \nabla n_alpha - sigma(1+(i-1)*3) = & - grad_density(i,1,1)*grad_density(i,1,1) + & - grad_density(i,2,1)*grad_density(i,2,1) + & - grad_density(i,3,1)*grad_density(i,3,1) - ! \nabla n_alpha dot \nabla n_beta - sigma(2+(i-1)*3) = & - grad_density(i,1,1)*grad_density(i,1,2) + & - grad_density(i,2,1)*grad_density(i,2,2) + & - grad_density(i,3,1)*grad_density(i,3,2) - ! \nabla n_beta dot \nabla n_beta - sigma(3+(i-1)*3) = & - grad_density(i,1,2)*grad_density(i,1,2) + & - grad_density(i,2,2)*grad_density(i,2,2) + & - grad_density(i,3,2)*grad_density(i,3,2) - end do - else - sigma(1:n_my_grid_points) = & - grad_density(1:n_my_grid_points,1,1)*grad_density(1:n_my_grid_points,1,1) + & - grad_density(1:n_my_grid_points,2,1)*grad_density(1:n_my_grid_points,2,1) + & - grad_density(1:n_my_grid_points,3,1)*grad_density(1:n_my_grid_points,3,1) - diff_rho(1:n_my_grid_points) = & - density(1:n_my_grid_points,1) - density_out(1:n_my_grid_points,1) - end if - end if - dxc_potential = zero - ! Re-order density (spin) or scale (no spin) - if(nspin>1) then - do i = 1, n_my_grid_points - do spin=1,nspin - alt_dens(spin + (i-1)*nspin) = density(i,spin) - end do - end do - else - ! Scaling for spin; sigma needs four because it is nabla n .dot. nabla n - alt_dens(1:n_my_grid_points) = two*density(1:n_my_grid_points,1) - if(flag_is_GGA) then - diff_rho(1:n_my_grid_points) = two*diff_rho(1:n_my_grid_points) - sigma(:) = four*sigma(:) - grad_density(:,:,1) = two*grad_density(:,:,1) - end if - end if - ! Loop over terms and calculate potential - do j = 1,n_xc_terms - vrho = zero - if(nspin>1) then ! NB no spin-polarised GGA NSC forces - select case (i_xc_family(j)) - case(XC_FAMILY_LDA) - call xc_f03_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) - dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(:n_my_grid_points,1,1) +vrho(1:3*n_my_grid_points-2:3) - dxc_potential(1:n_my_grid_points,1,2) = dxc_potential(:n_my_grid_points,1,2) +vrho(2:3*n_my_grid_points-1:3) - dxc_potential(1:n_my_grid_points,2,1) = dxc_potential(:n_my_grid_points,2,1) +vrho(2:3*n_my_grid_points-1:3) - dxc_potential(1:n_my_grid_points,2,2) = dxc_potential(:n_my_grid_points,2,2) +vrho(3:3*n_my_grid_points:3) - end select - else - select case (i_xc_family(j)) - case(XC_FAMILY_LDA) - call xc_f03_lda_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,vrho) - dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) + & - vrho(1:n_my_grid_points) - case(XC_FAMILY_GGA) - call xc_f03_gga_vxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,vrho,& - vsigma) - call xc_f03_gga_fxc(xc_func(j),int(n_my_grid_points,kind=wide),alt_dens,sigma,& - v2rho2,v2rhosigma,v2sigma2) - end select - - if(flag_is_GGA) then ! NB refer to JCTC 5, 1499 (2009) for L1-4 and details - ! Add term L1 (in paper) to potential - dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) + & - diff_rho(1:n_my_grid_points) * v2rho2(1:n_my_grid_points) - ! Create \sum_l' delta n_l' e_{l,l'} - ! Fourier transform the difference of densities - tmp1(:)=cmplx(zero,zero,double_cplx) - call fft3(diff_rho, tmp1, size, -1) - - do i=1,3 - ! Product by reciprocal vector stored for later use - tmp2(1:size,i) = -minus_i*recip_vector(1:size,i)*tmp1(1:size) - end do - - ! Fourier transform the vector back to the grid - call fft3(tmp3(:,1), tmp2(:,1), size, 1) - call fft3(tmp3(:,2), tmp2(:,2), size, 1) - call fft3(tmp3(:,3), tmp2(:,3), size, 1) - - ! Add term L2 to potential (L2 in paper - confusingly this is L3 in CQ code below) - ! NB the 1/|grad_density| factor cancels with dsigma/dg - do i=1,3 - dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) + & - two * tmp3(1:n_my_grid_points,i) * v2rhosigma(1:n_my_grid_points) * & - grad_density(1:n_my_grid_points,i,1) - end do - - ! Build the term M from paper (in CQ routines below, this is called L4) - do n=1, n_my_grid_points - !if(sigma(n) > RD_ERR) then - tmp_factor =(tmp3(n,1) * grad_density(n,1,1) & - + tmp3(n,2) * grad_density(n,2,1) & - + tmp3(n,3) * grad_density(n,3,1)) & - * (four*v2sigma2(n)) - !* (four*sigma(n)*v2sigma2(n))& - !+ two*vsigma(n)) !/ (sigma(n)) - !else - ! tmp_factor = zero - !end if - ! Reuse tmp3 - do i=1,3 - tmp3(n,i) = tmp_factor * grad_density(n,i,1) & - + two*vsigma(n) * tmp3(n,i) - end do - end do - - ! Terms L3 and L4 (using M) in paper - ! (In CQ GGA routines below, these are referred to as L2, L5 and L4) - do i=1,3 - tmp3(1:n_my_grid_points,i) = tmp3(1:n_my_grid_points,i) + & - two * diff_rho(1:n_my_grid_points) * v2rhosigma(1:n_my_grid_points) * & - grad_density(1:n_my_grid_points,i,1) - end do - - ! This process of FFT, scale by iG and FFT back avoids convolution - tmp2(:,:) = cmplx(zero,zero,double_cplx) ! 25Oct2007 TM - call fft3(tmp3(:,1), tmp2(:,1), size, -1) - call fft3(tmp3(:,2), tmp2(:,2), size, -1) - call fft3(tmp3(:,3), tmp2(:,3), size, -1) - - do n=1, size - tmp1(n) = -minus_i & - *(recip_vector(n,1)*tmp2(n,1) & - + recip_vector(n,2)*tmp2(n,2) & - + recip_vector(n,3)*tmp2(n,3)) - end do - - ! Use first component of tmp3 to store final vector - call fft3(tmp3(:,1), tmp1, size, 1) - - dxc_potential(1:n_my_grid_points,1,1) = dxc_potential(1:n_my_grid_points,1,1) - tmp3(1:n_my_grid_points,1) - end if ! flag_is_GGA - end if ! nspin - end do - deallocate(vrho,alt_dens) - if(flag_is_GGA) then - deallocate(diff_rho,sigma,vsigma,v2rho2,v2rhosigma,v2sigma2,tmp1,tmp2,tmp3) - deallocate(grad_density,ng) - end if - return - end subroutine get_libxc_dpotential - !!*** - - !!****f* XC_module/get_libxc_energy * - !! - !! NAME - !! get_libxc_energy - !! USAGE - !! - !! PURPOSE - !! Calculates the exchange-correlation energy - !! on the grid using LibXC - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2021/07/22 - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_libxc_energy(density, xc_energy, size) - - use datatypes - use numbers - use GenComms, only: gsum - use GenBlas, only: dot - use dimens, only: grid_point_volume, n_my_grid_points - use global_module, only : nspin, io_lun, flag_full_stress, flag_stress - use fft_module, only: fft3, recip_vector - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), intent(out) :: xc_energy - real(double), dimension(:,:), intent(in) :: density - - ! local variables - real(double), dimension(:), allocatable :: sigma, eps ! Temporary variables - real(double), dimension(:), allocatable :: alt_dens, xc_epsilon - real(double), dimension(:,:,:), allocatable :: grad_density - real(double) :: rho_tot - integer :: stat, i, spin, nxc, j - - ! Storage space for individual components - allocate(eps(n_my_grid_points),alt_dens(n_my_grid_points*nspin)) - ! For GGA, create sigma (\nabla n dot \nabla n) from gradient - if(flag_is_GGA) then - if(nspin>1) then - allocate(sigma(n_my_grid_points*3)) - else - allocate(sigma(n_my_grid_points)) - endif - ! If GGA, we need to find and adapt gradient - allocate(grad_density(size,3,nspin),STAT=stat) - sigma = zero - grad_density = zero - do spin = 1, nspin - call build_gradient(density(:,spin), grad_density(:,:,spin), size) - end do - ! Build modulus - NB LibXC uses spin, point for density ! - if(nspin>1) then - ! This is ugly, but there's not really a better way - do i=1,n_my_grid_points - ! \nabla n_alpha dot \nabla n_alpha - sigma(1+(i-1)*3) = & - grad_density(i,1,1)*grad_density(i,1,1) + & - grad_density(i,2,1)*grad_density(i,2,1) + & - grad_density(i,3,1)*grad_density(i,3,1) - ! \nabla n_alpha dot \nabla n_beta - sigma(2+(i-1)*3) = & - grad_density(i,1,1)*grad_density(i,1,2) + & - grad_density(i,2,1)*grad_density(i,2,2) + & - grad_density(i,3,1)*grad_density(i,3,2) - ! \nabla n_beta dot \nabla n_beta - sigma(3+(i-1)*3) = & - grad_density(i,1,2)*grad_density(i,1,2) + & - grad_density(i,2,2)*grad_density(i,2,2) + & - grad_density(i,3,2)*grad_density(i,3,2) - end do - else - sigma(1:n_my_grid_points) = & - grad_density(1:n_my_grid_points,1,1)*grad_density(1:n_my_grid_points,1,1) + & - grad_density(1:n_my_grid_points,2,1)*grad_density(1:n_my_grid_points,2,1) + & - grad_density(1:n_my_grid_points,3,1)*grad_density(1:n_my_grid_points,3,1) - end if - end if - ! If we have spin, re-order density to have spin index first - ! Otherwise scale - if(nspin>1) then - do i = 1, n_my_grid_points - do spin=1,nspin - alt_dens(spin + (i-1)*nspin) = density(i,spin) - end do - end do - else - ! Scaling for spin; sigma needs four because it is nabla n .dot. nabla n - alt_dens(1:n_my_grid_points) = two*density(1:n_my_grid_points,1) - if(flag_is_GGA) then - sigma(:) = four*sigma(:) - grad_density(:,:,1) = two*grad_density(:,:,1) - end if - end if - ! Create XC energy - allocate(xc_epsilon(n_my_grid_points)) - xc_epsilon = zero - do nxc = 1,n_xc_terms - eps = zero - select case( i_xc_family(nxc) ) - case(XC_FAMILY_LDA) - call xc_f03_lda_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, eps ) - case(XC_FAMILY_GGA) - call xc_f03_gga_exc( xc_func(nxc), int(n_my_grid_points,kind=wide), alt_dens, sigma, eps ) - end select - xc_epsilon(1:n_my_grid_points) = xc_epsilon(1:n_my_grid_points) + eps(1:n_my_grid_points) - end do ! nxc = n_xc_terms - ! Sum to get energy - xc_energy = zero - do i=1,n_my_grid_points - rho_tot = density(i,1) + density(i,nspin) - xc_energy = xc_energy + xc_epsilon(i)*rho_tot - end do - call gsum(xc_energy) - ! and 'integrate' the energy over the volume of the grid point - xc_energy = xc_energy * grid_point_volume - - deallocate(eps,alt_dens,xc_epsilon) - if(flag_is_GGA)then - deallocate(grad_density,sigma) - end if - return - end subroutine get_libxc_energy - !!*** - - ! ********************************** - ! Conquest XC routines go below here - ! ********************************** - - !!****f* XC_module/get_xc_potential_LDA_PZ81 * - !! - !! NAME - !! get_xc_potential_LDA_PZ81 - !! USAGE - !! - !! PURPOSE - !! Calculates the exchange-correlation potential - !! on the grid within LDA using the Ceperley-Alder - !! interpolation formula. It also calculates the - !! total exchange-correlation energy. - !! - !! Note that this is the Perdew-Zunger parameterisation of the - !! Ceperley-Alder results for a homogeneous electron gas, as - !! described in Phys. Rev. B 23, 5048 (1981), with Ceperley-Alder in - !! Phys. Rev. Lett. 45, 566 (1980) - !! INPUTS - !! - !! - !! USES - !! - !! AUTHOR - !! E.H.Hernandez - !! CREATION DATE - !! 02/03/95 - !! MODIFICATION HISTORY - !! 01/11/2005 Antonio - !! Bibliography: - !! Exchange energy: It can be found in: - !! Phys. Rev. B 45, 13244 (1992) - !! **See Eq. 26 - !! Correlation energy: The correlation functional is PZ-81 - !! Phys. Rev. B 23, 5048 (1981) - !! **See Appendix C, and specially Table XII, - !! Eq. C1 for the xc hole (rs), - !! Eqs. C3 & C4, for rs > 1 and - !! Eqs. C5 & C6, for rs < 1 - !! 17/05/2001 dave - !! Converted to F90, added ROBODoc header, shortened call - !! 08/06/2001 dave - !! Changed to use gsum from GenComms and added RCS Id and Log tags - !! 21/06/2001 dave - !! Included in H_matrix_module - !! 08:00, 2003/03/12 dave - !! Added calculation of correction term to band energy - !! 11:49, 30/09/2003 drb - !! Added comments to make separate testing of X and C easier - !! 2008/03/03 18:32 dave - !! Removed dsqrt - !! 2011/12/12 L.Tong - !! Removed third, it is now defined in numbers module - !! 2012/04/03 L.Tong - !! - Added optional parameters x_epsilon and c_epsilon for output of - !! the exchange and correlation parts of xc_epsilon respectively. - !! 2014/09/24 L.Truflandier - !! - Added optional x_energy for output - !! 2018/02/13 11:03 dave - !! Renamed (added _LDA_PZ81) as part of refactoring - !! 2018/06/11 17:38 dave - !! Bug fix for bug #91 - factor of spin_factor required for non-spin polarised - !! SOURCE - !! - subroutine get_xc_potential_LDA_PZ81(density, xc_potential, xc_epsilon, & - xc_energy, size, x_epsilon, c_epsilon, & - x_energy) - - use datatypes - use numbers - use GenComms, only: gsum - use dimens, only: grid_point_volume, n_my_grid_points - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), intent(out) :: xc_energy - real(double), dimension(:), intent(in) :: density - real(double), dimension(:), intent(out) :: xc_potential, xc_epsilon - ! optional - real(double), dimension(:), intent(out), optional :: x_epsilon, c_epsilon - real(double), intent(out), optional :: x_energy - - ! Local variables - integer :: n - real(double) :: denominator, e_correlation, e_exchange, ln_rs, & - numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & - v_correlation, v_exchange - real(double), parameter :: alpha = -0.45817_double - real(double), parameter :: beta_1 = 1.0529_double - real(double), parameter :: beta_2 = 0.3334_double - real(double), parameter :: gamma = -0.1423_double - real(double), parameter :: p = 0.0311_double - real(double), parameter :: q = -0.048_double - real(double), parameter :: r = 0.0020_double - real(double), parameter :: s = -0.0116_double - - xc_energy = zero - if (present(x_epsilon)) x_epsilon = zero - if (present(c_epsilon)) c_epsilon = zero - if (present(x_energy)) x_energy = zero - - do n = 1, n_my_grid_points ! loop over grid pts and store potl on each - rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - if (rho > RD_ERR) then ! Find radius of hole - rcp_rs = ( four_thirds * pi * rho )**(third) - else - rcp_rs = zero - end if - e_exchange = alpha * rcp_rs - if (present(x_epsilon)) x_epsilon(n) = e_exchange - v_exchange = four_thirds * e_exchange - if (rcp_rs>zero) then - rs = one/rcp_rs - else - rs = zero - end if - sq_rs = sqrt(rs) - if (rs>=one) then - denominator = one / (one + beta_1 * sq_rs + beta_2 * rs) - numerator = one + seven_sixths * beta_1 * sq_rs + & - four_thirds * beta_2 * rs - e_correlation = gamma * denominator - v_correlation = gamma * numerator * denominator * denominator - else if ((rsRD_ERR)) then - ln_rs = log(rs) - rs_ln_rs = rs * ln_rs - e_correlation = p * ln_rs + q + r * rs_ln_rs + s * rs - v_correlation = e_correlation - & - third * (p + s * rs + r * (rs_ln_rs + rs)) - else - e_correlation = zero - v_correlation = zero - end if - if (present(c_epsilon)) c_epsilon(n) = e_correlation - if (present(x_energy)) x_energy = x_energy + e_exchange * spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - ! Both X and C - xc_energy = xc_energy + (e_exchange + e_correlation) * spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - xc_potential(n) = v_exchange + v_correlation - xc_epsilon(n) = e_exchange + e_correlation - ! These two for testing - ! Just C - !xc_energy = xc_energy+e_correlation*density(n) - !xc_potential(n) = v_correlation - !xc_epsilon(n) = e_correlation - ! Just X - !xc_energy = xc_energy+e_exchange*density(n) - !xc_potential(n) = v_exchange - !xc_epsilon(n) = e_exchange - end do ! do n_my_grid_points - call gsum(xc_energy) - if (present(x_energy)) call gsum(x_energy) - ! and 'integrate' the energy over the volume of the grid point - xc_energy = xc_energy * grid_point_volume - if (present(x_energy)) x_energy = x_energy * grid_point_volume - - return - end subroutine get_xc_potential_LDA_PZ81 - !!*** - - - !!****f* XC_module/get_GTH_xc_potential * - !! - !! NAME - !! get_xc_potential - !! USAGE - !! - !! PURPOSE - !! Calculates the exchange-correlation potential - !! on the grid within LDA using the Ceperley-Alder - !! interpolation formula. It also calculates the - !! total exchange-correlation energy. - !! - !! Note that this is the Goedecker/Teter/Hutter formula which - !! involves only ratios of polynomials, and is rather easy to - !! differentiate. See PRB 54, 1703 (1996) - !! INPUTS - !! - !! - !! USES - !! - !! AUTHOR - !! D.R.Bowler - !! CREATION DATE - !! 14:45, 25/03/2003 - !! MODIFICATION HISTORY - !! 2011/12/12 L.Tong - !! Removed third, it is now defined in numbers module - !! 2018/06/11 17:39 dave - !! Bug fix for bug #91 adding factor of spin_factor to account for lack of spin - !! SOURCE - !! - subroutine get_GTH_xc_potential(density, xc_potential, xc_epsilon, & - xc_energy, size) - - use datatypes - use numbers - use global_module, only: io_lun - use GenComms, only: cq_abort, gsum - use dimens, only: grid_point_volume, n_my_grid_points - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), intent(out) :: xc_energy - real(double), dimension(:), intent(in) :: density - real(double), dimension(:), intent(out) :: xc_potential, xc_epsilon - - ! Local variables - integer n - real(double) :: denominator, e_correlation, e_exchange, ln_rs, & - numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & - v_correlation, v_exchange, drs_dRho, t1, t2, dt1, & - dt2 - real(double), parameter :: a0=0.4581652932831429_double - real(double), parameter :: a1=2.217058676663745_double - real(double), parameter :: a2=0.7405551735357053_double - real(double), parameter :: a3=0.01968227878617998_double - real(double), parameter :: b1=1.000000000000000_double - real(double), parameter :: b2=4.504130959426697_double - real(double), parameter :: b3=1.110667363742916_double - real(double), parameter :: b4=0.02359291751427506_double - - xc_energy = zero - do n = 1, n_my_grid_points ! loop over grid pts and store potl on each - rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - if (rho > RD_ERR) then ! Find radius of hole - rcp_rs = ( four*third * pi * rho )**(third) - rs = one/rcp_rs - !if (rs < 0.01_double) write (io_lun, *) 'rs out of range ', n - else - rcp_rs = zero - rs = zero - !write (io_lun, *) 'rho out of range ', n - end if - if (rs > zero) then - drs_dRho = -rs / (3.0 * rho) - t1 = a0 + rs*(a1 + rs * (a2 + rs * a3)) - t2 = rs * (b1 + rs * (b2 + rs * (b3 + rs * b4))) - dt1 = a1 + rs * (2.0 * a2 + rs * 3.0 * a3) - dt2 = b1 + rs * (2.0 * b2 + rs * (3.0 * b3 + rs * 4.0 * b4)) - xc_energy = xc_energy - (t1/t2)*rho - xc_potential(n) = & - -(t1/t2) + rho*drs_dRho * (-dt1 / t2 + t1 * dt2 / (t2 * t2)) - xc_epsilon(n) = -t1/t2 ! 2010.Oct.30 TM - else - xc_potential(n) = zero - end if - end do ! do n_my_grid_points - call gsum(xc_energy) - ! and 'integrate' the energy over the volume of the grid point - xc_energy = xc_energy * grid_point_volume - return - end subroutine get_GTH_xc_potential - !!*** - - !!****f* XC_module/Vxc_of_r_LSDA_PW92 * - !! PURPOSE - !! Calculates the exchange-correlation energy density and - !! potential as a function of rho(r) (evaluated at single grid - !! point r). - !! - !! The LDA Functional is given in Perdew and Wang, PRB 45, 13244 - !! (1992) - !! USAGE - !! To calculate Vx and Vc - !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x, eps_c, Vx, Vc) - !! To calculate Vx or Vc only - !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, Vx=Vx) - !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_c=eps_c, Vx=Vc) - !! To calculate eps_x and/or eps_c without Vx and Vc - !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x) - !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_c=eps_c) - !! call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, eps_c=eps_c) - !! INPUTS - !! integer nspin : 1 = spin nonpolarised, 2 = spin polarised - !! real(double) rho_r(1:nspin) : value of spin dependent density at r - !! OUTPUT - !! (All are optional) - !! real(double) eps_x : value of exchange energy density at r - !! real(double) eps_c : value of correlation energy density at r - !! real(double) Vx(1:nspin) : value of exchange potential at r - !! real(double) Vc(1:nspin) : value of correlation potential at r - !! AUTHOR - !! L.Tong - !! CREATION DATE - !! 2012/04/25 - !! MODIFICATION HISTORY - !! 2012/05/27 L.Tong - !! - I found that with rounding error, even if rho_r(2) is just tiny - !! bit negative, and rho_r(1) positive, this will make rho_tot - !! still positive and above RD_ERR, and hence pass the zero rho - !! test, but zeta = (rho(1) - rho(2)) / rho_tot will now be - !! greater than one. This makes one - zeta < 0 and hence (one - - !! zeta)**third undefined. Therefore to fix this I added a - !! constraint that zeta must be in between -one and one. - !! - Used separate subroutine PW92_G for G(rs) - !! SOURCE - !! - subroutine Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x, eps_c, Vx, Vc) - - use datatypes - use numbers - use GenComms, only: cq_abort - - implicit none - - ! passed variables - integer, intent(in) :: nspin - real(double), dimension(:), intent(in) :: rho_r - real(double), optional, intent(out) :: eps_x, eps_c - real(double), dimension(:), optional, intent(out) :: Vx, Vc - ! local variables - real(double) :: rho_tot_r, rs, sq_rs, rcp_rs, rcp_sq_rs, zeta, & - eps_c0, deps_c0_drs, eps_c1, deps_c1_drs, alpha_c, & - dalpha_c_drs, f_function, df_function_dzeta, & - alpha_cDfpp0, dalpha_c_drsDfpp0, deps_c_drs, & - deps_c_dzeta - real(double) :: onePzeta, oneMzeta, onePzeta_1_3, oneMzeta_1_3, & - onePzeta_4_3, oneMzeta_4_3, zeta_3, zeta_4, & - factor_4_3, factor_1_3 - ! parameters used for convinience of calculation - real(double), parameter :: K01 = 1.042123522_double ! 2*(9*pi/4)**(-1/3) - real(double), parameter :: K02 = 1.611991954_double ! (4*pi/3)**(1/3) - real(double), parameter :: K03 = -0.458165293_double ! -3/(2*pi*K01) - - ! check passed parameters - if (present(Vx) .and. (.not. present(eps_x))) & - call cq_abort('Vxc_of_r_LSDA_PW92: Vx and eps_x must present & - &at the same time') - if (present(Vc) .and. (.not. present(eps_c))) & - call cq_abort('Vxc_of_r_LSDA_PW92: Vc and eps_c must present & - &at the same time') - - ! get total density - rho_tot_r = rho_r(1) + rho_r(nspin); - - ! catch the case when density is zero - if (rho_tot_r <= RD_ERR) then - if (present(eps_x)) eps_x = zero - if (present(eps_c)) eps_c = zero - if (present(Vx)) Vx = zero - if (present(Vc)) Vc = zero - return - end if - - ! From this point on-wards rho_tot_r is greater than zero - - ! work out rs, 1/rs - rcp_rs = K02 * (rho_tot_r**third) ! this calculates 1/rs - rs = one / rcp_rs - sq_rs = sqrt(rs) - rcp_sq_rs = sqrt(rcp_rs) - - if (nspin == 2) then ! case for spin polarised - - ! zeta related factors - zeta = (rho_r(1) - rho_r(nspin)) / rho_tot_r - ! zeta must be in between -one and one, we need to make sure - ! of this, rounding errors (when rho_r(spin) are small) can - ! sometimes make zeta go outside this range. - zeta = max(-one, zeta) - zeta = min(one, zeta) - onePzeta = one + zeta - oneMzeta = one - zeta - onePzeta_1_3 = onePzeta**third - oneMzeta_1_3 = oneMzeta**third - onePzeta_4_3 = onePzeta * onePzeta_1_3 - oneMzeta_4_3 = oneMzeta * oneMzeta_1_3 - zeta_3 = zeta**3 - zeta_4 = zeta * zeta_3 - factor_4_3 = onePzeta_4_3 + oneMzeta_4_3 - factor_1_3 = onePzeta_1_3 - oneMzeta_1_3 - - ! Exchange Part - ! eps_x: eq (26) PRB 45, 13244 (1992) - if (present(eps_x)) eps_x = half * K03 * rcp_rs * factor_4_3 - ! Vx (exchange potential) - if (present(Vx)) then - Vx(1) = four_thirds * & - (eps_x + oneMzeta * K03 * rcp_rs * half * factor_1_3) - Vx(2) = four_thirds * & - (eps_x - onePzeta * K03 * rcp_rs * half * factor_1_3) - end if - - ! Correlation Part - - if (present(eps_c)) then - - if (present(Vc)) then - ! Work out eps_c0, and deps_c0/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.031091_double, & - alpha1=0.21370_double, & - beta1=7.5957_double, & - beta2=3.5876_double, & - beta3=1.6382_double, & - beta4=0.49294_double, & - p=one, & - G=eps_c0, & - dG_drs=deps_c0_drs) - ! Work out eps_c1 and deps_c1/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.015545_double, & - alpha1=0.20548_double, & - beta1=14.1189_double, & - beta2=6.1977_double, & - beta3=3.3662_double, & - beta4=0.62517_double, & - p=one, & - G=eps_c1, & - dG_drs=deps_c1_drs) - ! Work out alpha_c, and dalpha_c/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.016887_double, & - alpha1=0.11125_double, & - beta1=10.357_double, & - beta2=3.6231_double, & - beta3=0.88026_double, & - beta4=0.49671_double, & - p=one, & - G=alpha_c, & - dG_drs=dalpha_c_drs) - ! note that the table parameters are for -alpha_c - alpha_c = -alpha_c - dalpha_c_drs = -dalpha_c_drs - else ! calculate eps_c only - ! Work out eps_c0, and deps_c0/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.031091_double, & - alpha1=0.21370_double, & - beta1=7.5957_double, & - beta2=3.5876_double, & - beta3=1.6382_double, & - beta4=0.49294_double, & - p=one, & - G=eps_c0) - ! Work out eps_c1 and deps_c1/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.015545_double, & - alpha1=0.20548_double, & - beta1=14.1189_double, & - beta2=6.1977_double, & - beta3=3.3662_double, & - beta4=0.62517_double, & - p=one, & - G=eps_c1) - ! Work out alpha_c, and dalpha_c/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.016887_double, & - alpha1=0.11125_double, & - beta1=10.357_double, & - beta2=3.6231_double, & - beta3=0.88026_double, & - beta4=0.49671_double, & - p=one, & - G=alpha_c) - ! note that the table parameters are for -alpha_c - alpha_c = -alpha_c - end if - - ! Work out f_function eq.(8) PRB 45, 13244 (1992), - ! and df_function/dzeta - f_function = 1.923661051_double * (factor_4_3 - two) - if (present(Vc)) then - df_function_dzeta = 2.564881401_double * (factor_1_3) - end if - - ! Get eps_c, eq.(8) PRB 45, 13244 (1992) - ! alpha_c / f''(0) - alpha_cDfpp0 = 0.584822340_double * alpha_c - eps_c = eps_c0 + & - f_function * (alpha_cDfpp0 * (one - zeta_4) + & - (eps_c1 - eps_c0) * zeta_4) - - if (present(Vc)) then - ! Get deps_c_drs and deps_c_dzeta - ! dalpha_c_drs / f''(0) - dalpha_c_drsDfpp0 = 0.584822340_double * dalpha_c_drs - ! eq.(A2) of PRB 45, 13244 (1992) - deps_c_drs = & - deps_c0_drs + f_function * & - (zeta_4 * (deps_c1_drs - deps_c0_drs - dalpha_c_drsDfpp0) + & - dalpha_c_drsDfpp0) - ! eq.(A3) of PRB 45, 13244 (1992) - deps_c_dzeta = (four * zeta_3 * f_function + & - df_function_dzeta * zeta_4) * & - (eps_c1 - eps_c0 - alpha_cDfpp0) + & - df_function_dzeta * alpha_cDfpp0 - - ! Get Vc - Vc(1) = eps_c - third * rs * deps_c_drs + oneMzeta * deps_c_dzeta - Vc(2) = eps_c - third * rs * deps_c_drs - onePzeta * deps_c_dzeta - end if - - end if ! present(eps_c) - - else ! case for spin non-polarised - - ! Exchange Part - - ! eps_x: eq (26) PRB 45, 13244 (1992) - if (present(eps_x)) eps_x = K03 * rcp_rs - ! Vx (exchange potential) - if (present(Vx)) Vx(1) = four_thirds * eps_x - - ! Correlation Part - - if (present(eps_c)) then - - if (present(Vc)) then - ! Work out eps_c0, and deps_c0/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.031091_double, & - alpha1=0.21370_double, & - beta1=7.5957_double, & - beta2=3.5876_double, & - beta3=1.6382_double, & - beta4=0.49294_double, & - p=one, & - G=eps_c0, & - dG_drs=deps_c0_drs) - else - ! Work out eps_c0, and deps_c0/drs - ! fitting parameters taken from Table I, - ! Phys. Rev. B 45, 13244 (1992) - call PW92_G(rs, & - A=0.031091_double, & - alpha1=0.21370_double, & - beta1=7.5957_double, & - beta2=3.5876_double, & - beta3=1.6382_double, & - beta4=0.49294_double, & - p=one, & - G=eps_c0) - end if - - ! Get eps_c, eq.(8) PRB 45, 13244 (1992) - eps_c = eps_c0 - - if (present(Vc)) then - ! Get deps_c_drs, eq.(A2) of PRB 45, 13244 (1992) - deps_c_drs = deps_c0_drs - ! Get Vc - Vc(1) = eps_c - third * rs * deps_c_drs - end if - - end if ! present(eps_c) - - end if ! if (nspin == 2) - - return - end subroutine Vxc_of_r_LSDA_PW92 - !!***** - - - !!****f* XC_module/get_xc_potential_LSDA_PW92 * - !! - !! NAME - !! get_xc_potential_LSDA_PW92 - !! USAGE - !! - !! PURPOSE - !! Calculates the spin polarized exchange-correlation - !! potential on the grid within LDA using the Ceperley-Alder - !! interpolation formula. It also calculates the total - !! exchange-correlation energy. - !! - !! Note that this is the Perdew-Wang parameterisation of the - !! Ceperley-Alder results for a homogeneous electron gas, as - !! described in Phys. Rev. B 45, 13244 (1992), with Ceperley-Alder - !! in Phys. Rev. Lett. 45, 566 (1980) INPUTS - !! - !! USES - !! - !! AUTHOR - !! L. Tong - !! CREATION DATE - !! 22/03/2011 - !! MODIFICATION HISTORY - !! 2012/03/14 L.Tong - !! - Changed spin implementation - !! 2012/04/03 L.Tong - !! - Added optional variables to output exchange and correlation - !! part of epsilon separately, if required - !! 2012/04/25 L.Tong - !! - Removed the optional variables for separate exchange and - !! correlation energy densities, these are now covered in - !! subroutine Vxc_of_r_LSDA_PW92 - !! - Moved all the local point-wise calculations of epsilon and - !! potential to subroutine Vxc_of_r_LSDA_PW92, this allows the - !! point-wise calculations to be done in other parts of the - !! program if required---this saves a lot of memory in vdWDFT - !! calculations. - !! 2014/09/24 L.Truflandier - !! - Added optional x_energy_total for output - !! SOURCE - !! - subroutine get_xc_potential_LSDA_PW92(density, xc_potential, & - xc_epsilon, xc_energy_total, & - size, x_energy_total ) - - use datatypes - use numbers - use GenComms, only: cq_abort, gsum - use dimens, only: grid_point_volume, n_my_grid_points - use global_module, only: nspin - - implicit none - - ! Passed variables - ! size of the real space grid - integer, intent(in) :: size - real(double), dimension(:,:), intent(in) :: density - real(double), dimension(:,:), intent(out) :: xc_potential - real(double), dimension(:), intent(out) :: xc_epsilon - real(double), intent(out) :: xc_energy_total - real(double), optional, intent(out) :: x_energy_total - - ! Local variables - integer :: rr, spin - real(double) :: eps_x, eps_c, rho_tot_r - real(double), dimension(nspin) :: rho_r, Vx, Vc - - ! initialisation - if (present(x_energy_total)) x_energy_total = zero - xc_energy_total = zero - - ! loop over grid points on each node - do rr = 1, n_my_grid_points - rho_r(1:nspin) = density(rr,1:nspin) - rho_tot_r = rho_r(1) + rho_r(nspin) - call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, eps_c=eps_c,& - Vx=Vx, Vc=Vc) - - xc_epsilon(rr) = eps_x + eps_c - xc_potential(rr,1:nspin) = Vx(1:nspin) + Vc(1:nspin) - xc_energy_total = xc_energy_total + xc_epsilon(rr) * rho_tot_r - if (present(x_energy_total)) x_energy_total = x_energy_total + eps_x * rho_tot_r - end do - call gsum(xc_energy_total) - if (present(x_energy_total)) call gsum(x_energy_total) - - xc_energy_total = xc_energy_total * grid_point_volume - if (present(x_energy_total)) x_energy_total = x_energy_total * grid_point_volume - - return - end subroutine get_xc_potential_LSDA_PW92 - !!*** - - - !!****f* XC_module/eps_xc_of_r_GGA_PBE - !! PURPOSE - !! Calculates the exchange and correlation energy density and its - !! derivatives for the PBE functional and its variants at any - !! local values of rho(r) and grad rho(r). - !! - !! The exact flavour of the PBE functional is choosen by flavour - !! parameter: - !! - !! flavour = functional_gga_pbe96 - !! use original PBE, PRL 77, 3865 (1996) - !! flavour = functional_gga_pbe96_rev98: - !! use revPBE, PRL 80, 890 (1998) - !! flavour = functional_gga_pbe96_r99: - !! use RPBE, PRB 59, 7413 (1999) - !! flavour = functional_gga_pbe96_wc: - !! use Wu-Cohen, PRB 73, 235116 (2006) - !! USAGE - !! INPUTS - !! integer nspin : nspin = 1 for spin non-polarised, - !! nspin = 2 for spin polarised - !! integer flavour : flavour of PBE GGA to use - !! real(double) rho_r(1:nspin) : value of spin density at some point r - !! real(double) grho_r(3,1:nspin) : vector gradient of spin density at r - !! OUTPUT - !! All outputs are optional - !! real(double) eps_x : value of exchange energy density at r - !! real(double) eps_c : value of correlation energy density at r - !! real(double) drhoEps_x(0:3,1:nspin) : drhoEps_x(0,spin) = - !! d(rho_tot_r * eps_x) / drho(spin) - !! drhoEps_x(1:3,spin) = - !! d(rho_tot_r * eps_x) / dgrho(1:3,spin) - !! real(double) drhoEps_c(0:3,1:nspin) : drhoEps_c(0,spin) = - !! d(rho_tot_r * eps_c) / drho(spin) - !! drhoEps_x(1:3,spin) = - !! d(rho_tot_r * eps_c) / dgrho(1:3,spin) - !! - !! (where rho_tot_r = rho_r(1) + rho_r(nspin)) - !! RETURN VALUE - !! AUTHOR - !! L.Tong - !! CREATION DATE - !! 2012/04/25 - !! MODIFICATION HISTORY - !! 2018/06/15 12:25 dave - !! Removed local spin_factor variable (now use equivalent from global_module) - !! SOURCE - !! - subroutine eps_xc_of_r_GGA_PBE(nspin, flavour, rho_r, grho_r, eps_x,& - eps_c, drhoEps_x, drhoEps_c) - use datatypes - use numbers - use GenComms, only: cq_abort - - implicit none - - ! passed parameters - integer, intent(in) :: nspin - integer, intent(in) :: flavour - real(double), dimension(:), intent(in) :: rho_r - real(double), dimension(:,:), intent(in) :: grho_r - real(double), optional, intent(out) :: eps_x, eps_c - real(double), dimension(0:3,nspin), optional, intent(out) :: & - drhoEps_x, drhoEps_c - ! local variables - integer :: spin, Fx_selector, ii - real(double) :: rho_tot_r, rho_tot_s, mod_grho_tot_r, & - mod_grho_tot_s, eps_x_unif, Fx, grho_tot_s_ii, & - dFx_dgrho - real(double) :: rs, kF, eps_c_unif, ks, zeta, phi, t, A, H - real(double) :: drs_drho, dkF_drho, dphi_drho, dphi_dzeta, & - deps_c_unif_drho, dH_drho, dH_dgrho, dks_drho, & - dA_drho - real(double) :: kappa, mu_kappa, s, s2, kFs, dkFs_drho, F1, F2, & - F3, F4, dFx_drho, ds_drho, ds_dgrho, dt_drho, & - dt_dgrho, dF1_drho, dF2_drho, dF3_drho, dF4_drho, & - dF3_dgrho, dF4_dgrho, Xwc, dXwc_ds, dF1_dgrho - real(double), dimension(1) :: rho_s - real(double), dimension(1:3,1) :: grho_s - real(double), dimension(1:3) :: grho_tot_r - real(double), dimension(1:nspin) :: mod_grho_r, Vx_unif, Vc_unif, & - dzeta_drho - ! constants - ! From PRL 77, 3865 (1996) - real(double), parameter :: mu = 0.2195149727645171_double - real(double), parameter :: beta = 0.066725_double - real(double), parameter :: gamma = 0.031091_double - real(double), parameter :: kappa_ori = 0.804_double - ! From PRL 80, 890 (1998) - real(double), parameter :: kappa_alt = 1.245_double - ! From PRB 73, 235116 (2006) - Wu-Cohen - real(double), parameter :: teneightyone = 0.123456790123_double ! 10/81 - real(double), parameter :: c_wc = 0.00793746933516_double - ! Precalculated constants - real(double), parameter :: mu_kappa_ori = 0.27302_double ! mu/kappa_ori - real(double), parameter :: mu_kappa_alt = 0.17631_double ! mu/kappa_alt - real(double), parameter :: two_mu = 0.4390299455290342_double ! 2 * mu - real(double), parameter :: beta_gamma = 2.146119_double ! beta/gamma - ! minimum value of rho_tot_r and mod_grho_tot_r allowed - real(double), parameter :: min_rho = RD_ERR - real(double), parameter :: min_mod_grho = RD_ERR - ! Fx_selector options - integer, parameter :: Fx_ori = 1 - integer, parameter :: Fx_alt = 2 - integer, parameter :: Fx_wc = 3 ! Wu-Cohen Exchange - - ! check optional outputs - if (present(drhoEps_x) .and. (.not. present(eps_x))) & - call cq_abort('eps_xc_of_r_GGA_PBE: both drhoEps_x and eps_x & - &must be present') - if (present(drhoEps_c) .and. (.not. present(eps_c))) & - call cq_abort('eps_xc_of_r_GGA_PBE: both drhoRps_c and eps_c & - &must be present') - - ! choose between PBE and revPBE parameters - select case (flavour) - case (functional_gga_pbe96) - Fx_selector = Fx_ori - kappa = kappa_ori - mu_kappa = mu_kappa_ori - case (functional_gga_pbe96_rev98) - Fx_selector = Fx_ori - kappa = kappa_alt - mu_kappa = mu_kappa_alt - case (functional_gga_pbe96_r99) - Fx_selector = Fx_alt - kappa = kappa_ori - mu_kappa = mu_kappa_ori - case (functional_gga_pbe96_wc) - Fx_selector = Fx_wc - kappa = kappa_ori - mu_kappa = mu_kappa_ori - case default - call cq_abort('eps_xc_of_r_GGA_PBE: flavour undefined', flavour) - end select - - ! work out total density and its gradient - rho_tot_r = rho_r(1) + rho_r(nspin) - rho_tot_r = max(min_rho, rho_tot_r) - grho_tot_r(1:3) = grho_r(1:3,1) + grho_r(1:3,nspin) - do spin = 1, nspin - mod_grho_r(spin) = & - sqrt(grho_r(1,spin)**2 + grho_r(2,spin)**2 + grho_r(3,spin)**2) - end do - mod_grho_tot_r = & - sqrt(grho_tot_r(1)**2 + grho_tot_r(2)**2 + grho_tot_r(3)**2) - mod_grho_tot_r = max(min_mod_grho, mod_grho_tot_r) - - ! Exchange part - if (present(eps_x)) then - - eps_x = zero - - do spin = 1, nspin - ! rho_s = 2 * rho_r(spin), grho_s = 2 * |grho(spin)| - rho_s(1) = rho_r(spin) - rho_tot_s = max(min_rho, two * rho_s(1)) - mod_grho_tot_s = max(min_mod_grho, two * mod_grho_r(spin)) - kFs = (three * pi**2 * rho_tot_s)**third - s = mod_grho_tot_s / (two * kFs * rho_tot_s) - s2 = s*s - ! choose the Fx flavour - select case (Fx_selector) - case (Fx_ori) - F1 = one + mu_kappa * s2 - Fx = one + kappa - kappa / F1 - case (Fx_alt) - F1 = exp(-mu_kappa * s2) - Fx = one + kappa * (one - F1) - case (Fx_wc) ! Wu-Cohen exchange - Xwc = teneightyone * s2 + (mu - teneightyone) * & - s2 * exp(-s2) + log(one + c_wc * s2*s2) - - F1 = one + Xwc / kappa - Fx = one + kappa - kappa / F1 - - dXwc_ds = two * teneightyone * s + & - (mu - teneightyone) * exp(-s2) * two*s * (one - s2) + & - four * c_wc * s*s2 / (one + c_wc * s2*s2) - end select - - call Vxc_of_r_LSDA_PW92(1, rho_s, eps_x=eps_x_unif, Vx=Vx_unif) - - ! accumulate eps_x in spin components - eps_x = eps_x + rho_tot_s * eps_x_unif * Fx - - ! calculate the derivative of rho_tot_r * eps_x - if (present(drhoEps_x)) then - dkFs_drho = third * kFs / rho_tot_s - ds_drho = s * (-(dkFs_drho / kFs) - one / rho_tot_s) - select case (Fx_selector) - case (Fx_ori) - dFx_drho = two_mu * s * ds_drho / (F1 * F1) - case (Fx_alt) - dFx_drho = two_mu * s * ds_drho * F1 - case (Fx_wc) - dF1_drho = dXwc_ds * ds_drho / kappa - dFx_drho = kappa * dF1_drho / (F1*F1) - - end select - ! get drhoEps_x / drho(spin) - drhoEps_x(0,spin) = Vx_unif(1) * Fx + & - rho_tot_s * eps_x_unif * dFx_drho - ! get drhoEps_x / dgrho(spin) - do ii = 1, 3 - grho_tot_s_ii = two * grho_r(ii,spin) - ds_dgrho = (s / mod_grho_tot_s) * grho_tot_s_ii / mod_grho_tot_s - select case (Fx_selector) - case (Fx_ori) - dFx_dgrho = two_mu * s * ds_dgrho / (F1 * F1) - case (Fx_alt) - dFx_dgrho = two_mu * s * ds_dgrho * F1 - case (Fx_wc) - dF1_dgrho = dXwc_ds * ds_dgrho / kappa - dFx_dgrho = kappa * dF1_dgrho / (F1 * F1) - end select - drhoEps_x(ii,spin) = rho_tot_s * eps_x_unif * dFx_dgrho - end do - end if ! present(drhoEps_x) - end do ! spin - - ! get eps_x - eps_x = half * spin_factor * eps_x / rho_tot_r - - end if ! present(eps_x) - - ! Correlation part - if (present(eps_c)) then - - ! Find local correlation energy and potential - call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_c=eps_c_unif, Vc=Vc_unif) - - ! Find energy denisty for correlation eps_c - rs = (three / (four * pi * rho_tot_r))**third - kF = (three * pi**2 * rho_tot_r)**third - ks = sqrt(four * kF / pi) - - if (nspin == 2) then - - ! zeta related terms - zeta = (rho_r(1) - rho_r(2)) / rho_tot_r - ! bound zeta within -1 and 1 - zeta = max(-one + min_rho, zeta) - zeta = min(one - min_rho, zeta) - phi = half * ((one + zeta)**two_thirds + (one - zeta)**two_thirds) - t = mod_grho_tot_r / (two * phi * ks * rho_tot_r) - F1 = eps_c_unif / gamma / phi**3 - F2 = exp(-F1) - ! add RD_ERR in denominator to avoid div by 0 - A = beta_gamma / (F2 - one + RD_ERR) - F3 = t**2 + A * t**4 - F4 = beta_gamma * F3 / (one + A * F3) - H = gamma * phi**3 * log(one + F4) - ! get eps_c - eps_c = eps_c_unif + H - - ! get drhoEps_c - if (present(drhoEps_c)) then - drs_drho = - (third * rs / rho_tot_r) - dkF_drho = third * kF / rho_tot_r - dks_drho = half * ks * dkF_drho / kF - dzeta_drho(1) = (one - zeta) / rho_tot_r - dzeta_drho(2) = - (one + zeta) / rho_tot_r - dphi_dzeta = half * two_thirds * & - (one / (one + zeta)**third - one / (one - zeta)**third) - do spin = 1, nspin - deps_c_unif_drho = (Vc_unif(spin) - eps_c_unif) / rho_tot_r - dphi_drho = dphi_dzeta * dzeta_drho(spin) - dt_drho = (- t) * (dphi_drho / phi + dks_drho / ks + & - one / rho_tot_r) - ! add RD_ERR to denominator to avoid div by 0 - dF1_drho = F1 * (deps_c_unif_drho / (eps_c_unif + RD_ERR) - & - three * dphi_drho / phi) - dF2_Drho = (- F2) * dF1_drho - ! add RD_ERR to denominator to avoid div by 0 - dA_drho = A * dF2_drho / (one - F2 + RD_ERR) - dF3_drho = (two * t + four * A * t**3) * dt_drho + dA_drho * t**4 - dF4_drho = F4 * (dF3_drho / F3 - & - (dA_drho * F3 + A * DF3_drho) / (one + A * F3)) - dH_drho = three * H * dphi_drho / phi + & - gamma * phi**3 * DF4_drho / (one + F4) - ! get drhoEps_c / drho(spin) - drhoEps_c(0,spin) = Vc_unif(spin) + H + rho_tot_r * dH_drho - do ii = 1, 3 - dt_dgrho = (t / mod_grho_tot_r) * & - grho_tot_r(ii) / mod_grho_tot_r - dF3_dgrho = dt_dgrho * (two * t + four * A * t**3) - dF4_dgrho = F4 * dF3_dgrho * (one / F3 - A / (one + A * F3)) - dH_dgrho = gamma * phi**3 * dF4_dgrho / (one + F4) - drhoEps_c(ii,spin) = rho_tot_r * dH_dgrho - end do - end do ! spin - end if ! present(rhoEps_c) - - else ! spin non-polarised case - - phi = one - t = mod_grho_tot_r / (two * ks * rho_tot_r) - F1 = eps_c_unif / gamma - F2 = exp(-F1) - ! add RD_ERR in denominator to avoid div by 0 - A = beta_gamma / (F2 - one + RD_ERR) - F3 = t**2 + A * t**4 - F4 = beta_gamma * F3 / (one + A * F3) - H = gamma * log(one + F4) - ! get eps_c - eps_c = eps_c_unif + H - - ! get drhoEps_c / drho - if (present(drhoEps_c)) then - drs_drho = - (third * rs / rho_tot_r) - dkF_drho = third * kF / rho_tot_r - dks_drho = half * ks * dkF_drho / kF - deps_c_unif_drho = (Vc_unif(1) - eps_c_unif) / rho_tot_r - dt_drho = (- t) * (dks_drho / ks + one / rho_tot_r) - ! add RD_ERR to denominator to avoid div by 0 - dF1_drho = F1 * (deps_c_unif_drho / (eps_c_unif + RD_ERR)) - dF2_Drho = (- F2) * dF1_drho - ! add RD_ERR to denominator to avoid div by 0 - dA_drho = A * dF2_drho / (one - F2 + RD_ERR) - dF3_drho = (two * t + four * A * t**3) * dt_drho + dA_drho * t**4 - dF4_drho = F4 * (dF3_drho / F3 - & - (dA_drho * F3 + A * DF3_drho) / (one + A * F3)) - - dH_drho = gamma * DF4_drho / (one + F4) - - ! get drhoEps_c / drho(spin) - drhoEps_c(0,1) = Vc_unif(1) + H + rho_tot_r * dH_drho - do ii = 1, 3 - dt_dgrho = (t / mod_grho_tot_r) * grho_tot_r(ii) / mod_grho_tot_r - dF3_dgrho = dt_dgrho * (two * t + four * A * t**3) - dF4_dgrho = F4 * dF3_dgrho * (one / F3 - A / (one + A * F3)) - dH_dgrho = gamma * dF4_dgrho / (one + F4) - drhoEps_c(ii,1) = rho_tot_r * dH_dgrho - end do - end if ! present(drhoEps_c) - - end if ! nspin - - end if ! presnet(eps_c) - - return - end subroutine eps_xc_of_r_GGA_PBE - !!***** - - - !!****f* XC_module/get_xc_potential_GGA_PBE - !! PURPOSE - !! Calculates the exchange-correlation potential - !! on the grid within GGA using three flavours of - !! Perdew-Burke-Ernzerhof. It also calculates the - !! total exchange-correlation energy. - !! - !! flavour not defined - !! use original PBE, PRL 77, 3865 (1996) - !! flavour = functional_gga_pbe96_rev98: - !! use revPBE, PRL 80, 890 (1998) - !! flavour = functional_gga_pbe96_r99: - !! use RPBE, PRB 59, 7413 (1999) - !! - !! USAGE - !! call get_xc_potential_GGA_PBE(density, xc_potential, & - !! xc_epsilon, xc_energy, size,& - !! flavour) - !! INPUTS - !! integer size : size of the real space grid - !! integer flavour : flavour of PBE functional (optional) - !! real(double) density(size,nspin) : spin dependent density - !! OUTPUT - !! real(double) xc_energy : total xc-energy (sum over spin) - !! real(double) xc_epsilon(size) : xc-energy density - !! real(double) xc_potential(size,nspin) : xc-potnetial - !! AUTHOR - !! L.Tong - !! CREATION DATE - !! 2012/04/27 - !! MODIFICATION HISTORY - !! 2014/09/24 L.Truflandier - !! - Added optional x_energy_total for output - !! 2015/05/12 08:30 dave - !! - Added stress term - !! 2017/08/29 jack baker & dave - !! Removed rcellx references (redundant) - !! 2018/06/15 12:25 dave - !! Removed spin_factor from use statement (global to module now) - !! 2019/05/13 10:36 dave - !! Bug fix for generalised stress - !! SOURCE - !! - subroutine get_xc_potential_GGA_PBE(density, xc_potential, & - xc_epsilon, xc_energy, grid_size, & - flavour, x_energy ) - use datatypes - use numbers - use global_module, only: nspin, flag_full_stress, flag_stress - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum, cq_abort - use fft_module, only: fft3, recip_vector - use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl - - implicit none - - ! passed variables - integer, intent(in) :: grid_size - real(double), dimension(:,:), intent(in) :: density - real(double), dimension(:), intent(out) :: xc_epsilon - real(double), dimension(:,:), intent(out) :: xc_potential - real(double), intent(out) :: xc_energy - real(double), optional, intent(out) :: x_energy - integer, optional, intent(in) :: flavour - - ! local variables - integer :: PBE_type - integer :: rr, spin, stat, dir1, dir2 - real(double) :: eps_x, eps_c, rho_tot_r - real(double), dimension(nspin) :: rho_r - real(double), dimension(3,nspin) :: grho_r - real(double), dimension(0:3,nspin) :: drhoEps_x, drhoEps_c - real(double), dimension(:,:,:), allocatable :: grad_density - real(double), dimension(:), allocatable :: second_term - complex(double_cplx), dimension(:,:), allocatable :: rcp_drhoEps_xc - - allocate(grad_density(grid_size,3,nspin), second_term(grid_size), & - rcp_drhoEps_xc(grid_size,3), STAT=stat) - if (stat /= 0) & - call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) - call reg_alloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) - - if (present(flavour)) then - PBE_type = flavour - else - PBE_type = functional_gga_pbe96 - end if - - ! initialisation - if (present(x_energy)) x_energy = zero - grad_density = zero - xc_epsilon = zero - xc_potential = zero - xc_energy = zero - XC_GGA_stress = zero - - ! Build the gradient of the density - do spin = 1, nspin - call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) - end do - - do rr = 1, n_my_grid_points - rho_tot_r = density(rr,1) + density(rr,nspin) - do spin = 1, nspin - rho_r(spin) = density(rr,spin) - grho_r(1:3,spin) = grad_density(rr,1:3,spin) - end do - call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & - eps_x=eps_x, eps_c=eps_c, & - drhoEps_x=drhoEps_x, & - drhoEps_c=drhoEps_c) - xc_epsilon(rr) = eps_x + eps_c - xc_energy = xc_energy + rho_tot_r * xc_epsilon(rr) - if (present(x_energy)) x_energy = x_energy + rho_tot_r * eps_x - ! for potential - do spin = 1, nspin - xc_potential(rr,spin) = drhoEps_x(0,spin) + drhoEps_c(0,spin) - ! note that grad_density(rr,1:3,1:spin) has already been used - ! at this point, so we can savely reuse this slot to store - ! d(rho * eps_xc) / dgrho at rr. - grad_density(rr,1:3,spin) = drhoEps_x(1:3,spin) + drhoEps_c(1:3,spin) - do dir1=1,3 - if (flag_stress) then - if (flag_full_stress) then - do dir2=1,3 - XC_GGA_stress(dir1,dir2) = XC_GGA_stress(dir1,dir2) - & - grho_r(dir1,spin)*grad_density(rr,dir2,spin) - end do - else - XC_GGA_stress(dir1,dir1) = XC_GGA_stress(dir1,dir1) - & - grho_r(dir1,spin)*grad_density(rr,dir1,spin) - end if - end if - end do - end do - end do ! rr - call gsum(xc_energy) - if (present(x_energy)) call gsum(x_energy) - xc_energy = xc_energy * grid_point_volume - if (flag_stress) then - call gsum(XC_GGA_stress,3,3) - XC_GGA_stress = XC_GGA_stress*grid_point_volume - end if - !write(*,*) 'GGA stress term: ',XC_GGA_stress - if (present(x_energy)) x_energy = x_energy * grid_point_volume - - ! add the second term to potential - do spin = 1, nspin - ! initialise for each spin - rcp_drhoEps_xc = zero - second_term = zero - ! FFT drhoEps_xc / dgrho(spin) to reciprocal space - call fft3(grad_density(:,1,spin), rcp_drhoEps_xc(:,1), grid_size, -1) - call fft3(grad_density(:,2,spin), rcp_drhoEps_xc(:,2), grid_size, -1) - call fft3(grad_density(:,3,spin), rcp_drhoEps_xc(:,3), grid_size, -1) - - ! dot product with i * recip_vectors, and store in the first - ! component of rcp_drhoEps_xc (used as temp storage) - rcp_drhoEps_xc(:,1) = & - rcp_drhoEps_xc(:,1) * minus_i * recip_vector(:,1) + & - rcp_drhoEps_xc(:,2) * minus_i * recip_vector(:,2) + & - rcp_drhoEps_xc(:,3) * minus_i * recip_vector(:,3) - - ! FFT back to obtain the convolution - call fft3(second_term(:), rcp_drhoEps_xc(:,1), grid_size, +1) - ! accumulate to potential - do rr = 1, n_my_grid_points - xc_potential(rr,spin) = xc_potential(rr,spin) + second_term(rr) - end do - end do ! spin - - deallocate(grad_density, second_term, rcp_drhoEps_xc, STAT=stat) - if (stat /= 0) & - call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") - call reg_dealloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) - - end subroutine get_xc_potential_GGA_PBE - !!***** - - - !!****f* XC_module/get_xc_potential_hyb_PBE0 - !! PURPOSE - !! - !! Work routine based on get_xc_potential_GGA_PBE. - !! It will be recoded in near futur to handle any hybrid functional. - !! For now just handle one coefficient as in PBE0. - !! USAGE - !! - !! INPUTS - !! - !! integer size : size of the real space grid - !! integer flavour : flavour of PBE functional (optional) - !! real(double) density(size,nspin) : spin dependent density - !! OUTPUT - !! real(double) xc_energy : total xc-energy (sum over spin) - !! real(double) x_energy : exchange energy only (sum over spin) - !! real(double) xc_epsilon(size) : xc-energy density - !! real(double) xc_potential(size,nspin) : xc-potential - !! - !! AUTHOR - !! L.Tong/L.Truflandier - !! CREATION DATE - !! 2014/09/24 - !! MODIFICATION HISTORY - !! 2015/09/03 17:27 dave - !! Added GGA XC stress term - !! 2017/08/29 jack baker & dave - !! Removed rcellx references (redundant) - !! 2018/06/15 12:25 dave - !! Removed spin_factor from use statement (global to module now) - !! SOURCE - !! - subroutine get_xc_potential_hyb_PBE0(density, xc_potential, exx_a, & - xc_epsilon, xc_energy, grid_size, & - flavour, x_energy ) - use datatypes - use numbers - use global_module, only: nspin, flag_full_stress, flag_stress - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum, cq_abort - use fft_module, only: fft3, recip_vector - use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl - - implicit none - - ! passed variables - integer, intent(in) :: grid_size - real(double), dimension(:,:), intent(in) :: density - real(double), dimension(:), intent(out) :: xc_epsilon - real(double), dimension(:,:), intent(out) :: xc_potential - real(double), intent(out) :: xc_energy - real(double), optional, intent(out) :: x_energy - integer, optional, intent(in) :: flavour - real(double), intent(in) :: exx_a - - ! local variables - integer :: PBE_type - integer :: rr, spin, stat, dir1, dir2 - real(double) :: eps_x, eps_c, rho_tot_r - real(double), dimension(nspin) :: rho_r - real(double), dimension(3,nspin) :: grho_r - real(double), dimension(0:3,nspin) :: drhoEps_x, drhoEps_c - real(double), dimension(:,:,:), allocatable :: grad_density - real(double), dimension(:), allocatable :: second_term - complex(double_cplx), dimension(:,:), allocatable :: rcp_drhoEps_xc - - allocate(grad_density(grid_size,3,nspin), second_term(grid_size), & - rcp_drhoEps_xc(grid_size,3), STAT=stat) - if (stat /= 0) & - call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) - call reg_alloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) - - if (present(flavour)) then - PBE_type = flavour - else - PBE_type = functional_gga_pbe96 - end if - - ! setup exx_a - - ! Initialisation - if (present(x_energy)) x_energy = zero - grad_density = zero - xc_epsilon = zero - xc_potential = zero - xc_energy = zero - - ! Build the gradient of the density - do spin = 1, nspin - call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) - end do - - do rr = 1, n_my_grid_points - rho_tot_r = density(rr,1) + density(rr,nspin) - do spin = 1, nspin - rho_r(spin) = density(rr,spin) - grho_r(1:3,spin) = grad_density(rr,1:3,spin) - end do - call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & - eps_x =eps_x, & - eps_c =eps_c, & - drhoEps_x=drhoEps_x, & - drhoEps_c=drhoEps_c) - xc_epsilon(rr) = exx_a * eps_x + eps_c - xc_energy = xc_energy + rho_tot_r * xc_epsilon(rr) - if (present(x_energy)) x_energy = x_energy + exx_a * rho_tot_r * eps_x - ! for potential - do spin = 1, nspin - xc_potential(rr,spin) = exx_a * drhoEps_x(0,spin) + drhoEps_c(0,spin) - ! note that grad_density(rr,1:3,1:spin) has already been used - ! at this point, so we can savely reuse this slot to store - ! d(rho * eps_xc) / dgrho at rr. - grad_density(rr,1:3,spin) = exx_a * drhoEps_x(1:3,spin) + drhoEps_c(1:3,spin) - do dir1=1,3 - if (flag_stress) then - if (flag_full_stress) then - do dir2=1,3 - XC_GGA_stress(dir1,dir2) = XC_GGA_stress(dir1,dir2) - & - grho_r(dir1,spin) * grad_density(rr,dir2,spin) - end do ! dir2 - else - XC_GGA_stress(dir1,dir1) = XC_GGA_stress(dir1,dir1) - & - grho_r(dir1,spin) * grad_density(rr,dir1,spin) - end if - end if - end do ! dir1 - end do ! spin - end do ! rr - call gsum(xc_energy) - if (present(x_energy)) call gsum(x_energy) - xc_energy = xc_energy * grid_point_volume - if (flag_stress) then - call gsum(XC_GGA_stress,3,3) - XC_GGA_stress = XC_GGA_stress*grid_point_volume - end if - if (present(x_energy)) x_energy = x_energy * grid_point_volume - - ! add the second term to potential - do spin = 1, nspin - ! initialise for each spin - rcp_drhoEps_xc = zero - second_term = zero - ! FFT drhoEps_xc / dgrho(spin) to reciprocal space - call fft3(grad_density(:,1,spin), rcp_drhoEps_xc(:,1), grid_size, -1) - call fft3(grad_density(:,2,spin), rcp_drhoEps_xc(:,2), grid_size, -1) - call fft3(grad_density(:,3,spin), rcp_drhoEps_xc(:,3), grid_size, -1) - - ! dot product with i * recip_vectors, and store in the first - ! component of rcp_drhoEps_xc (used as temp storage) - rcp_drhoEps_xc(:,1) = & - rcp_drhoEps_xc(:,1) * minus_i * recip_vector(:,1) + & - rcp_drhoEps_xc(:,2) * minus_i * recip_vector(:,2) + & - rcp_drhoEps_xc(:,3) * minus_i * recip_vector(:,3) - - ! FFT back to obtain the convolution - call fft3(second_term(:), rcp_drhoEps_xc(:,1), grid_size, +1) - ! accumulate to potential - do rr = 1, n_my_grid_points - xc_potential(rr,spin) = xc_potential(rr,spin) + second_term(rr) - end do - end do ! spin - - deallocate(grad_density, second_term, rcp_drhoEps_xc, STAT=stat) - if (stat /= 0) & - call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") - call reg_dealloc_mem(area_ops, grid_size*(1+3*(1+nspin)), type_dbl) - - return - end subroutine get_xc_potential_hyb_PBE0 - !!***** - - !!****f* XC/get_xc_energy * - !! - !! NAME - !! get_xc_energy - !! USAGE - !! - !! PURPOSE - !! Interface to CQ routines - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D. R. Bowler - !! CREATION DATE - !! 2021/07/22 - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_xc_energy(density, xc_energy, size) - - use datatypes - use numbers - use global_module, only: exx_niter, exx_siter, exx_alpha, nspin - - implicit none - - ! Passed variables - integer :: size - real(double) :: xc_energy - real(double), dimension(size,nspin) :: density - - ! Local variables - real(double) :: loc_x_energy, exx_tmp - - if(flag_use_libxc) then - call get_libxc_energy(density, xc_energy, size) - else - select case(flag_functional_type) - case (functional_lda_pz81) - ! NOT SPIN POLARISED - call get_xc_energy_LDA_PZ81(density(:,1), xc_energy, size) - ! - ! - case (functional_lda_gth96) - ! NOT SPIN POLARISED - call get_GTH_xc_energy(density(:,1), xc_energy, size) - ! - ! - case (functional_lda_pw92) - call get_xc_energy_LSDA_PW92(density, xc_energy, size) - ! - ! - case (functional_gga_pbe96) - call get_xc_energy_GGA_PBE(density, xc_energy, size) - ! - ! - case (functional_gga_pbe96_rev98) - call get_xc_energy_GGA_PBE(density, xc_energy, size, functional_gga_pbe96_rev98 ) - ! - ! - case (functional_gga_pbe96_r99) - call get_xc_energy_GGA_PBE(density, xc_energy, size, functional_gga_pbe96_r99 ) - ! - ! - case (functional_gga_pbe96_wc) - call get_xc_energy_GGA_PBE(density, xc_energy, size, functional_gga_pbe96_wc ) - ! - ! - case (functional_hyb_pbe0) - ! - if ( exx_niter <= exx_siter ) then - exx_tmp = one - else - exx_tmp = one - exx_alpha - end if - ! - call get_xc_energy_hyb_PBE0(density, xc_energy, size, exx_tmp, functional_gga_pbe96 ) - ! - ! - case (functional_hartree_fock) - ! **** - ! not optimal but experimental - if (exx_niter <= exx_siter) then - ! for the first call of get_H_matrix using Hartree-Fock method - ! to get something not to much stupid ; use pure exchange functional - ! in near futur such as Xalpha - call get_xc_energy_LSDA_PW92(density, xc_energy, size) - else - xc_energy = zero - end if - ! - ! - case default - call get_xc_energy_LSDA_PW92(density, xc_energy, size) - ! - ! - end select - end if - return - end subroutine get_xc_energy - !!*** - - !!****f* XC_module/get_xc_energy_LDA_PZ81 * - !! - !! NAME - !! get_xc_energy_LDA_PZ81 - !! USAGE - !! - !! PURPOSE - !! Calculates the exchange-correlation energy - !! on the grid within LDA using the Ceperley-Alder - !! interpolation formula. - !! - !! Note that this is the Perdew-Zunger parameterisation of the - !! Ceperley-Alder results for a homogeneous electron gas, as - !! described in Phys. Rev. B 23, 5048 (1981), with Ceperley-Alder in - !! Phys. Rev. Lett. 45, 566 (1980) - !! Exchange energy: It can be found in: - !! Phys. Rev. B 45, 13244 (1992) - !! **See Eq. 26 - !! Correlation energy: The correlation functional is PZ-81 - !! Phys. Rev. B 23, 5048 (1981) - !! **See Appendix C, and specially Table XII, - !! Eq. C1 for the xc hole (rs), - !! Eqs. C3 & C4, for rs > 1 and - !! Eqs. C5 & C6, for rs < 1 - !! INPUTS - !! - !! - !! USES - !! - !! AUTHOR - !! E.H.Hernandez/DRB - !! CREATION DATE - !! 02/03/95 and 2021/07/22 - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_xc_energy_LDA_PZ81(density, xc_energy, size) - - use datatypes - use numbers - use GenComms, only: gsum - use dimens, only: grid_point_volume, n_my_grid_points - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), intent(out) :: xc_energy - real(double), dimension(:), intent(in) :: density - - ! Local variables - integer :: n - real(double) :: denominator, e_correlation, e_exchange, ln_rs, & - numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & - v_correlation, v_exchange - real(double), parameter :: alpha = -0.45817_double - real(double), parameter :: beta_1 = 1.0529_double - real(double), parameter :: beta_2 = 0.3334_double - real(double), parameter :: gamma = -0.1423_double - real(double), parameter :: p = 0.0311_double - real(double), parameter :: q = -0.048_double - real(double), parameter :: r = 0.0020_double - real(double), parameter :: s = -0.0116_double - - xc_energy = zero - - do n = 1, n_my_grid_points ! loop over grid pts and store potl on each - rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - if (rho > RD_ERR) then ! Find radius of hole - rcp_rs = ( four_thirds * pi * rho )**(third) - else - rcp_rs = zero - end if - e_exchange = alpha * rcp_rs - if (rcp_rs>zero) then - rs = one/rcp_rs - else - rs = zero - end if - sq_rs = sqrt(rs) - if (rs>=one) then - denominator = one / (one + beta_1 * sq_rs + beta_2 * rs) - numerator = one + seven_sixths * beta_1 * sq_rs + & - four_thirds * beta_2 * rs - e_correlation = gamma * denominator - else if ((rsRD_ERR)) then - ln_rs = log(rs) - rs_ln_rs = rs * ln_rs - e_correlation = p * ln_rs + q + r * rs_ln_rs + s * rs - else - e_correlation = zero - end if - xc_energy = xc_energy + (e_exchange + e_correlation) * spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - end do ! do n_my_grid_points - call gsum(xc_energy) - ! and 'integrate' the energy over the volume of the grid point - xc_energy = xc_energy * grid_point_volume - - return - end subroutine get_xc_energy_LDA_PZ81 - !!*** - - - !!****f* XC_module/get_GTH_xc_energy * - !! - !! NAME - !! get_xc_energy - !! USAGE - !! - !! PURPOSE - !! Calculates the exchange-correlation energy - !! on the grid within LDA using the Ceperley-Alder - !! interpolation formula. It also calculates the - !! total exchange-correlation energy. - !! - !! Note that this is the Goedecker/Teter/Hutter formula which - !! involves only ratios of polynomials, and is rather easy to - !! differentiate. See PRB 54, 1703 (1996) - !! INPUTS - !! - !! - !! USES - !! - !! AUTHOR - !! D.R.Bowler - !! CREATION DATE - !! 14:45, 25/03/2003 and 2021/07/22 14:51 - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_GTH_xc_energy(density, xc_energy, size) - - use datatypes - use numbers - use global_module, only: io_lun - use GenComms, only: cq_abort, gsum - use dimens, only: grid_point_volume, n_my_grid_points - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), intent(out) :: xc_energy - real(double), dimension(:), intent(in) :: density - - ! Local variables - integer n - real(double) :: denominator, e_correlation, e_exchange, ln_rs, & - numerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & - v_correlation, v_exchange, drs_dRho, t1, t2, dt1, & - dt2 - real(double), parameter :: a0=0.4581652932831429_double - real(double), parameter :: a1=2.217058676663745_double - real(double), parameter :: a2=0.7405551735357053_double - real(double), parameter :: a3=0.01968227878617998_double - real(double), parameter :: b1=1.000000000000000_double - real(double), parameter :: b2=4.504130959426697_double - real(double), parameter :: b3=1.110667363742916_double - real(double), parameter :: b4=0.02359291751427506_double - - xc_energy = zero - do n = 1, n_my_grid_points ! loop over grid pts and store potl on each - rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - if (rho > RD_ERR) then ! Find radius of hole - rcp_rs = ( four*third * pi * rho )**(third) - rs = one/rcp_rs - else - rcp_rs = zero - rs = zero - end if - if (rs > zero) then - drs_dRho = -rs / (3.0 * rho) - t1 = a0 + rs*(a1 + rs * (a2 + rs * a3)) - t2 = rs * (b1 + rs * (b2 + rs * (b3 + rs * b4))) - dt1 = a1 + rs * (2.0 * a2 + rs * 3.0 * a3) - dt2 = b1 + rs * (2.0 * b2 + rs * (3.0 * b3 + rs * 4.0 * b4)) - xc_energy = xc_energy - (t1/t2)*rho - end if - end do ! do n_my_grid_points - call gsum(xc_energy) - ! and 'integrate' the energy over the volume of the grid point - xc_energy = xc_energy * grid_point_volume - return - end subroutine get_GTH_xc_energy - !!*** - - !!****f* XC_module/get_xc_energy_LSDA_PW92 * - !! - !! NAME - !! get_xc_energy_LSDA_PW92 - !! USAGE - !! - !! PURPOSE - !! Calculates the spin polarized exchange-correlation - !! energy on the grid within LDA using the Ceperley-Alder - !! interpolation formula. It also calculates the total - !! exchange-correlation energy. - !! - !! Note that this is the Perdew-Wang parameterisation of the - !! Ceperley-Alder results for a homogeneous electron gas, as - !! described in Phys. Rev. B 45, 13244 (1992), with Ceperley-Alder - !! in Phys. Rev. Lett. 45, 566 (1980) INPUTS - !! - !! USES - !! - !! AUTHOR - !! L. Tong and DRB - !! CREATION DATE - !! 22/03/2011 and 2021/07/22 14:52 - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_xc_energy_LSDA_PW92(density, xc_energy_total, size) - - use datatypes - use numbers - use GenComms, only: cq_abort, gsum - use dimens, only: grid_point_volume, n_my_grid_points - use global_module, only: nspin - - implicit none - - ! Passed variables - ! size of the real space grid - integer, intent(in) :: size - real(double), intent(out) :: xc_energy_total - real(double), dimension(:,:), intent(in) :: density - - ! Local variables - integer :: rr, spin - real(double) :: eps_x, eps_c, rho_tot_r - real(double), dimension(nspin) :: rho_r, Vx, Vc - - ! initialisation - xc_energy_total = zero - - ! loop over grid points on each node - do rr = 1, n_my_grid_points - rho_r(1:nspin) = density(rr,1:nspin) - rho_tot_r = rho_r(1) + rho_r(nspin) - call Vxc_of_r_LSDA_PW92(nspin, rho_r, eps_x=eps_x, eps_c=eps_c,& - Vx=Vx, Vc=Vc) - - xc_energy_total = xc_energy_total + (eps_x + eps_c) * rho_tot_r - end do - call gsum(xc_energy_total) - xc_energy_total = xc_energy_total * grid_point_volume - return - end subroutine get_xc_energy_LSDA_PW92 - !!*** - - !!****f* XC_module/get_xc_energy_GGA_PBE - !! PURPOSE - !! Calculates the exchange-correlation energy - !! on the grid within GGA using three flavours of - !! Perdew-Burke-Ernzerhof. It also calculates the - !! total exchange-correlation energy. - !! - !! flavour not defined - !! use original PBE, PRL 77, 3865 (1996) - !! flavour = functional_gga_pbe96_rev98: - !! use revPBE, PRL 80, 890 (1998) - !! flavour = functional_gga_pbe96_r99: - !! use RPBE, PRB 59, 7413 (1999) - !! - !! USAGE - !! call get_xc_energy_GGA_PBE(density, xc_potential, & - !! xc_epsilon, xc_energy, size,& - !! flavour) - !! INPUTS - !! integer size : size of the real space grid - !! integer flavour : flavour of PBE functional (optional) - !! real(double) density(size,nspin) : spin dependent density - !! OUTPUT - !! real(double) xc_energy : total xc-energy (sum over spin) - !! real(double) xc_epsilon(size) : xc-energy density - !! real(double) xc_potential(size,nspin) : xc-potnetial - !! AUTHOR - !! L.Tong and DRB - !! CREATION DATE - !! 2012/04/27 and 2021/07/22 14:54 dave - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_xc_energy_GGA_PBE(density, xc_energy, grid_size, flavour) - - use datatypes - use numbers - use global_module, only: nspin, flag_stress, flag_full_stress - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum, cq_abort - use fft_module, only: fft3, recip_vector - use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl - - implicit none - - ! passed variables - integer, intent(in) :: grid_size - real(double), dimension(:,:), intent(in) :: density - real(double), intent(out) :: xc_energy - integer, optional, intent(in) :: flavour - - ! local variables - integer :: PBE_type - integer :: rr, spin, stat, dir1, dir2 - real(double) :: eps_x, eps_c, rho_tot_r - real(double), dimension(nspin) :: rho_r - real(double), dimension(3,nspin) :: grho_r - real(double), dimension(:,:,:), allocatable :: grad_density - - allocate(grad_density(grid_size,3,nspin), STAT=stat) - if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) - call reg_alloc_mem(area_ops, grid_size*3*nspin, type_dbl) - - if (present(flavour)) then - PBE_type = flavour - else - PBE_type = functional_gga_pbe96 - end if - - ! initialisation - grad_density = zero - xc_energy = zero - - ! Build the gradient of the density - do spin = 1, nspin - call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) - end do - - do rr = 1, n_my_grid_points - rho_tot_r = density(rr,1) + density(rr,nspin) - do spin = 1, nspin - rho_r(spin) = density(rr,spin) - grho_r(1:3,spin) = grad_density(rr,1:3,spin) - end do - call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & - eps_x=eps_x, eps_c=eps_c) - xc_energy = xc_energy + rho_tot_r * (eps_x + eps_c) - end do ! rr - call gsum(xc_energy) - xc_energy = xc_energy * grid_point_volume - deallocate(grad_density, STAT=stat) - if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") - call reg_dealloc_mem(area_ops, grid_size*3*nspin, type_dbl) - - end subroutine get_xc_energy_GGA_PBE - !!***** - - - !!****f* XC_module/get_xc_energy_hyb_PBE0 - !! PURPOSE - !! - !! Work routine based on get_xc_energy_GGA_PBE. - !! It will be recoded in near futur to handle any hybrid functional. - !! For now just handle one coefficient as in PBE0. - !! USAGE - !! - !! INPUTS - !! - !! integer size : size of the real space grid - !! integer flavour : flavour of PBE functional (optional) - !! real(double) density(size,nspin) : spin dependent density - !! OUTPUT - !! real(double) xc_energy : total xc-energy (sum over spin) - !! - !! AUTHOR - !! L.Tong/L.Truflandier/DRB - !! CREATION DATE - !! 2014/09/24 and 2021/07/22 15:00 dave - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine get_xc_energy_hyb_PBE0(density, xc_energy, grid_size, exx_a, flavour ) - use datatypes - use numbers - use global_module, only: nspin, flag_full_stress, flag_stress - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum, cq_abort - use fft_module, only: fft3, recip_vector - use memory_module, only: reg_alloc_mem, reg_dealloc_mem, type_dbl - - implicit none - - ! passed variables - integer, intent(in) :: grid_size - real(double), dimension(:,:), intent(in) :: density - real(double), intent(out) :: xc_energy - integer, optional, intent(in) :: flavour - real(double), intent(in) :: exx_a - - ! local variables - integer :: PBE_type - integer :: rr, spin, stat, dir1, dir2 - real(double) :: eps_x, eps_c, rho_tot_r - real(double), dimension(nspin) :: rho_r - real(double), dimension(3,nspin) :: grho_r - real(double), dimension(:,:,:), allocatable :: grad_density - - allocate(grad_density(grid_size,3,nspin), STAT=stat) - if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error alloc mem: ", grid_size) - call reg_alloc_mem(area_ops, grid_size*3*nspin, type_dbl) - - if (present(flavour)) then - PBE_type = flavour - else - PBE_type = functional_gga_pbe96 - end if - - ! setup exx_a - - ! Initialisation - grad_density = zero - xc_energy = zero - - ! Build the gradient of the density - do spin = 1, nspin - call build_gradient(density(:,spin), grad_density(:,:,spin), grid_size) - end do - - do rr = 1, n_my_grid_points - rho_tot_r = density(rr,1) + density(rr,nspin) - do spin = 1, nspin - rho_r(spin) = density(rr,spin) - grho_r(1:3,spin) = grad_density(rr,1:3,spin) - end do - call eps_xc_of_r_GGA_PBE(nspin, PBE_type, rho_r, grho_r, & - eps_x =eps_x, & - eps_c =eps_c) - xc_energy = xc_energy + rho_tot_r * (exx_a * eps_x + eps_c) - end do ! rr - call gsum(xc_energy) - xc_energy = xc_energy * grid_point_volume - deallocate(grad_density, STAT=stat) - if (stat /= 0) call cq_abort("get_xc_potential_GGA_PBE: Error dealloc mem") - call reg_dealloc_mem(area_ops, grid_size*3*nspin, type_dbl) - - return - end subroutine get_xc_energy_hyb_PBE0 - !!***** - - !!****f* XC_module/build_gradient * - !! - !! NAME - !! build_gradient - !! USAGE - !! - !! PURPOSE - !! Calculates the gradient of the density, and its modulus - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! A.S. Torralba - !! CREATION DATE - !! 11/11/05 - !! MODIFICATION HISTORY - !! 15:55, 27/04/2007 drb - !! Changed recip_vector, grad_density to (n,3) for speed - !! 2012/04/27 L.Tong - !! - removed function calculating the modulus of the grad_density, - !! since this is now redundant. - !! - renamed grad_density_xyz to grad_density - !! 2017/08/29 jack baker & dave - !! Removed rcellx references (redundant) - !! SOURCE - !! - subroutine build_gradient(density, grad_density, size) - - use datatypes - use numbers - use dimens, only: n_grid_x, n_grid_y, n_grid_z - use fft_module, only: fft3, recip_vector - use GenComms, only: cq_abort - - implicit none - - ! Passed variables - integer, intent(in) :: size - real(double), intent(in), dimension(size) :: density - !ORI real(double), intent(out), dimension(3, size) :: grad_density_xyz - real(double), intent(out), dimension(size,3) :: grad_density - - ! Local variables - ! Density in reciprocal space - complex(double_cplx), allocatable :: rdensity(:) - ! Temporal reciprocal density - complex(double_cplx), allocatable :: rdensity_tmp(:) - integer :: stat - - !local recip_vec_tm - - allocate(rdensity(size), rdensity_tmp(size), STAT=stat) - if(stat /= 0) & - call cq_abort('ERROR in build_gradient : stat,size = ',stat,size) - grad_density = zero ! to remove SIGFPE 2010.Oct.25 TM - rdensity = zero ! to remove SIGFPE 2010.Oct.25 TM - rdensity_tmp = zero ! to remove SIGFPE 2010.Oct.25 TM - - ! Fourier transform the density - call fft3(density, rdensity, size, -1) - - ! Compute the derivative with respect to x - rdensity_tmp = -rdensity * minus_i * recip_vector(:,1)!*rcellx/n_grid_x - call fft3(grad_density(:,1), rdensity_tmp, size, 1) - - ! Compute the derivative with respect to y - rdensity_tmp = -rdensity * minus_i * recip_vector(:,2)!*rcelly/n_grid_y - call fft3(grad_density(:,2), rdensity_tmp, size, 1) - - ! Compute the derivative with respect to z - rdensity_tmp = -rdensity * minus_i * recip_vector(:,3)!*rcellz/n_grid_z - call fft3(grad_density(:,3), rdensity_tmp, size, 1) - - return - end subroutine build_gradient - !!*** - - !!****f* XC_module/get_dxc_potential_LDA_PZ81 * - !! - !! NAME - !! get_dxc_potential_LDA_PZ81 - !! USAGE - !! - !! PURPOSE - !! Calculates the derivative of the exchange-correlation potential - !! on the grid within LDA using the Ceperley-Alder - !! interpolation formula. This is only for non self-consistent - !! calculations (Harris-Foulkes), for the forces. - !! - !! Note that this is the Perdew-Zunger parameterisation of the - !! Ceperley-Alder results for a homogeneous electron gas, as - !! described in Phys. Rev. B 23, 5048 (1981), with Ceperley-Alder - !! in Phys. Rev. Lett. 45, 566 (1980) - !! INPUTS - !! - !! USES - !! - !! AUTHOR - !! D.R.Bowler - !! CREATION DATE - !! 09:36, 2003/03/20 dave - !! MODIFICATION HISTORY - !! 2007/11/16 12:10 dave - !! Bug fix: sign of ninth*(two*s+r)*rs term in dv_correlation was - !! wrong - !! 2008/03/03 18:34 dave - !! Removed dsqrt - !! 2011/12/13 L.Tong - !! Removed third, as it is now defined in numbers module - !! 2018/02/13 11:03 dave - !! Renamed (added _LDA_PZ81) as part of refactoring - !! 2018/06/11 17:40 dave - !! Bug fix for bug #91 adding factor of spin_factor to account for lack of spin - !! SOURCE - !! - subroutine get_dxc_potential_LDA_PZ81(density, dxc_potential, size) - - use datatypes - use numbers - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum - - implicit none - - ! Passed variables - integer size - real(double), dimension(size) :: density, dxc_potential - - ! Local variables - integer :: n - real(double) :: denominator, e_correlation, e_exchange, ln_rs, & - vnumerator, rcp_rs, rho, rs, rs_ln_rs, sq_rs, & - dv_correlation, dv_exchange, dfirst, dsecond - real(double), parameter :: alpha = -0.45817_double - real(double), parameter :: beta_1 = 1.0529_double - real(double), parameter :: beta_2 = 0.3334_double - real(double), parameter :: gamma = -0.1423_double - real(double), parameter :: p = 0.0311_double - real(double), parameter :: q = -0.048_double - real(double), parameter :: r = 0.0020_double - real(double), parameter :: s = -0.0116_double - real(double), parameter :: ninth = 1.0_double/9.0_double - real(double), parameter :: sixth = 1.0_double/6.0_double - - do n=1,n_my_grid_points ! loop over grid pts and store potl on each - rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - if (rho>RD_ERR) then ! Find radius of hole - rcp_rs = ( four_thirds * pi * rho )**(third) - else - rcp_rs = zero - end if - ! First, the easy part: exchange - e_exchange = alpha * rcp_rs - if(rho>RD_ERR) then - dv_exchange = four*ninth * e_exchange/rho - else - dv_exchange = zero - end if - if (rcp_rs>zero) then - rs = one/rcp_rs - else - rs = zero - end if - sq_rs = sqrt(rs) - if (rs>=one) then - denominator = one / (one + beta_1 * sq_rs + beta_2 * rs) - vnumerator = one + seven_sixths * beta_1 * sq_rs + & - four_thirds * beta_2 * rs - dfirst = (one + beta_1 * sq_rs + beta_2 * rs)*(-seven_thirtysixths*beta_1*sq_rs - four*ninth*beta_2*rs) - dsecond = -two*vnumerator*(-sixth*beta_1*sq_rs-third*beta_2*rs) - if(rho>RD_ERR) then - dv_correlation = gamma * (dfirst+dsecond) * denominator * denominator * denominator / rho - else - dv_correlation = zero - end if - else if ((rsRD_ERR)) then - ln_rs = log(rs) - rs_ln_rs = rs * ln_rs - if(rho>RD_ERR) then - ! DRB 2007/11/16 Changed sign of ninth to PLUS to correct error - dv_correlation = -(third*p+two*ninth*r*rs_ln_rs+ninth*(two*s+r)*rs)/rho - else - dv_correlation = zero - end if - else - dv_correlation = zero - end if - ! Both X and C - dxc_potential(n) = (dv_exchange + dv_correlation) - ! Just C - !dxc_potential(n) = dv_correlation - ! Just X - !dxc_potential(n) = dv_exchange - end do ! do n_my_grid_points - return - end subroutine get_dxc_potential_LDA_PZ81 - !!*** - - - !!****f* force_module/get_GTH_dxc_potential * - !! - !! NAME - !! get_GTH_dxc_potential - !! USAGE - !! - !! PURPOSE - !! Calculates the derivative of the exchange-correlation potential - !! on the grid within LDA using the Ceperley-Alder - !! interpolation formula. This is only for non self-consistent - !! calculations (Harris-Foulkes), for the forces. - !! - !! Note that this is the Goedecker/Teter/Hutter parameterisation - - !! see PRB 54, 1703 (1996) - !! INPUTS - !! - !! - !! USES - !! - !! AUTHOR - !! D.R.Bowler - !! CREATION DATE - !! 14:54, 25/03/2003 drb - !! MODIFICATION HISTORY - !! 2011/12/13 L.Tong - !! Removed third, it is now defined in numbers module - ! 2018/06/11 17:40 dave - !! Bug fix for bug #91 adding factor of spin_factor to account for lack of spin - !! SOURCE - !! - subroutine get_GTH_dxc_potential(density, dxc_potential, size) - - use datatypes - use numbers - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum - - implicit none - - ! Passed variables - integer size - - real(double) :: density(size), dxc_potential(size) - - ! Local variables - integer :: n - real(double) :: denominator, e_correlation, e_exchange, ln_rs, & - vnumerator, rcp_rs, rho, rs, rs_ln_rs,t1, t2, dt1, & - dt2, d2t1, d2t2, sq_rs, dv_correlation, & - dv_exchange, dfirst, dsecond, drs_dRho, d2rs_dRho2 - real(double), parameter :: a0=0.4581652932831429_double - real(double), parameter :: a1=2.217058676663745_double - real(double), parameter :: a2=0.7405551735357053_double - real(double), parameter :: a3=0.01968227878617998_double - real(double), parameter :: b1=1.000000000000000_double - real(double), parameter :: b2=4.504130959426697_double - real(double), parameter :: b3=1.110667363742916_double - real(double), parameter :: b4=0.02359291751427506_double - - do n=1,n_my_grid_points ! loop over grid pts and store potl on each - rho = spin_factor * density(n) ! DRB Added to correct for lack of spin 2018/06/11 - if (rho>RD_ERR) then ! Find radius of hole - rcp_rs = ( 4.0_double*third * pi * rho )**(third) - rs = one/rcp_rs - else - rcp_rs = zero - rs = zero - rho = zero - end if - if(rs>zero) then - drs_dRho = -rs / (3.0_double * rho) - d2rs_dRho2 = 4.0_double * rs / (9.0_double * rho * rho) - t1 = a0 + rs * (a1 + rs * (a2 + rs * a3)) - t2 = rs * (b1 + rs * (b2 + rs * (b3 + rs * b4))) - dt1 = a1 + rs * (2.0_double * a2 + rs * 3.0_double * a3) - dt2 = b1 + rs * (2.0_double * b2 + rs * (3.0_double * b3 + & - rs * 4.0_double * b4)) - d2t1 = 2.0_double * a2 + 6.0_double * a3 * rs - d2t2 = 2.0_double * b2 + rs * (6.0_double * b3 + rs * 12.0_double * b4) - dxc_potential(n) = 2.0_double*drs_dRho * & - (-dt1 / t2 + t1 * dt2 / (t2 * t2)) + & - rho * & - (drs_dRho * drs_dRho * & - (2.0_double * dt1 * dt2 / (t2*t2) - & - d2t1 / t2 - & - 2.0_double * t1 * dt2 * dt2 / & - (t2*t2*t2) + d2t2 * t1/(t2*t2)) + & - d2rs_dRho2*(-dt1 / t2 + t1 * dt2 / (t2 * t2))) - else - dxc_potential(n) = zero - end if - end do ! do n_my_grid_points - return - end subroutine get_GTH_dxc_potential - !!*** - - - !!****f* H_matrix_module/get_dxc_potential_LDA_PW92 * - !! - !! NAME - !! get_dxc_potential_LDA_PW92 - !! USAGE - !! - !! PURPOSE - !! Calculates the derivative of the exchange-correlation potential - !! on the grid within LDA using the Ceperley-Alder - !! interpolation formula. This is only for non self-consistent - !! calculations (Harris-Foulkes), for the forces. - !! - !! Note that this is the Perdew-Wang parameterisation of the - !! Ceperley-Alder results for a homogeneous electron gas, as - !! described in Phys. Rev. B 45, 13244 (1992), with Ceperley-Alder - !! in Phys. Rev. Lett. 45, 566 (1980) - !! INPUTS - !! - !! - !! USES - !! - !! AUTHOR - !! A.S. Torralba - !! CREATION DATE - !! 30/01/06 - !! MODIFICATION HISTORY - !! 2008/03/03 18:34 dave - !! Removed dsqrt - !! 2011/10/17 L.Tong - !! Corrected (changed) 1 to one in log (1 + 1/denominator) - !! 2011/12/13 L.Tong - ! Removed third, it is now defined in numbers module - !! SOURCE - !! - subroutine get_dxc_potential_LDA_PW92(density, dxc_potential, size, & - eclda, declda_drho, d2eclda_drho2) - - use datatypes - use numbers - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum - - implicit none - - ! Passed variables - integer :: size - - real(double), intent(in) :: density(size) - real(double), intent(inout) :: dxc_potential(size) - real(double), optional :: eclda(size) - real(double), optional :: declda_drho(size) - real(double), optional :: d2eclda_drho2(size) - - ! Local variables - integer n - real(double) :: prefactor, postfactor, denominator, & - e_correlation, e_exchange, & - rcp_rs, rho, rs, sq_rs, & - v_correlation, v_exchange, & - delta_prefactor, delta_postfactor, & - dv_exchange, dv_correlation, & - denominator2, dnumrho_drho, & - dden_drho, rho4_3, & - dprefactor_drho, d2prefactor_drho2, & - dposfactor_drho, d2posfactor_drho2, & - dec_drho, d2ec_drho2 - - - ! From Table I, Phys. Rev. B 45, 13244 (1992), for reference - real(double), parameter :: alpha = 1.0421234_double - real(double), parameter :: alpha1 = 0.21370_double - real(double), parameter :: beta1 = 7.5957_double - real(double), parameter :: beta2 = 3.5876_double - real(double), parameter :: beta3 = 1.6382_double - real(double), parameter :: beta4 = 0.49294_double - real(double), parameter :: A = 0.031091_double - - ! Precalculated constants - real(double), parameter :: k00 = 1.611991954_double ! (4*pi/3)**(1/3) - real(double), parameter :: k01 = -0.458165347_double ! -3/(2*pi*alpha) - real(double), parameter :: k02 = -0.062182_double ! -2*A - real(double), parameter :: k03 = -0.0132882934_double ! -2*A*alpha1 - real(double), parameter :: k04 = 0.4723158174_double ! 2*A*beta1 - real(double), parameter :: k05 = 0.2230841432_double ! 2*A*beta2 - real(double), parameter :: k06 = 0.1018665524_double ! 2*A*beta3 - real(double), parameter :: k07 = 0.03065199508_double ! 2*A*beta4 - real(double), parameter :: k08 = -0.008858862267_double ! 2*k03/3 - real(double), parameter :: k09 = 0.0787193029_double ! k04/6 - real(double), parameter :: k10 = 0.074361381067_double ! k05/3 - real(double), parameter :: k11 = 0.0509332762_double ! k06/2 - real(double), parameter :: k12 = 0.0204346633867_double ! 2*k07/3 - real(double), parameter :: four_ninths = 4.0_double/9.0_double - real(double), parameter :: minus_four_thirds = -4.0_double/3.0_double - real(double), parameter :: k13 = 0.0027477997778_double ! (k08-k03)/k00 - - do n=1,n_my_grid_points ! loop over grid pts and store potl on each - rho = density(n) - - !!!! EXCHANGE - if (rho > RD_ERR) then ! Find radius of hole - rcp_rs = k00 * ( rho**third ) - dv_exchange = four_ninths * k01 * rcp_rs / rho ! 4*e_exchange/(9*rho) - else - rcp_rs = zero - dv_exchange = zero - end if - - e_exchange = k01*rcp_rs - - !!!! CORRELATION - if (rcp_rs > zero) then - rs = one/rcp_rs - else - rs = zero - end if - sq_rs = sqrt(rs) - - prefactor = k02 + k03*rs - denominator = sq_rs * ( k04 + sq_rs * ( k05 + sq_rs * ( k06 + k07 * sq_rs))) - if (denominator > zero) then - postfactor = log (one + one/denominator) - else - postfactor = zero - end if - - ! Return correlation energy if requested - ! NOTE: This "energy" is not the actual integrand, but the integrand divided by rho - if(present(eclda)) then - eclda(n) = prefactor*postfactor - end if - - - ! NOTE: delta_prefactor is actually the derivative of rho*prefactor - ! delta_postfactor is rho times the derivative of postfactor - delta_prefactor = k02 + k08*rs - if (sq_rs > zero) then - denominator2 = ( denominator * ( 1 + denominator ) ) - delta_postfactor = sq_rs * ( k09 + sq_rs*(k10 + sq_rs*( k11 + k12 * sq_rs ))) & - / denominator2 - - dnumrho_drho = -sq_rs *( 7.0*k09/6.0 + sq_rs * ( 4.0*k10/3.0 + sq_rs * ( 3.0*k11/2.0 +sq_rs*5.0*k12/3.0))) - dden_drho = -sq_rs*(k04/6.0 +sq_rs*(third*k05 + sq_rs*(half*k06 + sq_rs*2.0*k07/3.0))) - else - delta_postfactor = 0 - - dnumrho_drho = zero - dden_drho = zero - end if - - if(rho > RD_ERR) then - rho4_3 = rho**minus_four_thirds - dprefactor_drho = k13*rho4_3 - d2prefactor_drho2 = minus_four_thirds*dprefactor_drho/rho - - dposfactor_drho = delta_postfactor/rho - d2posfactor_drho2 = (dnumrho_drho & - - delta_postfactor * ( 1 + 2*denominator) * dden_drho)/(denominator2 * rho *rho) - else - rho4_3 = zero - dprefactor_drho = zero - d2prefactor_drho2 = zero - - dposfactor_drho = zero - d2posfactor_drho2 = zero - end if - - dec_drho = postfactor*dprefactor_drho + prefactor*dposfactor_drho - - ! Return derivative of correlation energy (see note above) if requested - if(present(declda_drho)) then - declda_drho(n) = dec_drho - end if - - - d2ec_drho2 = 2*dposfactor_drho*dprefactor_drho & - + postfactor*d2prefactor_drho2 + prefactor*d2posfactor_drho2 - - ! Return second derivative of correlation energy (see note above) if requested - if(present(d2eclda_drho2)) then - d2eclda_drho2(n) = d2ec_drho2 - end if - - dv_correlation = 2*dec_drho + rho*d2ec_drho2 - - dxc_potential(n) = dv_exchange + dv_correlation - end do ! do n_my_grid_points - - return - end subroutine get_dxc_potential_LDA_PW92 - !!*** - - - !!****f* H_matrix_module/get_dxc_potential_GGA_PBE * - !! - !! NAME - !! get_dxc_potential_GGA_PBE - !! USAGE - !! - !! PURPOSE - !! Calculates the potential needed for the non-self-consistent - !! within GGA using the Perdew-Burke-Ernzerhof. - !! - !! Note that this is the functional described in - !! Phys. Rev. Lett. 77, 3865 (1996) - !! INPUTS - !! - !! - !! USES - !! - !! AUTHOR - !! A.S. Torralba - !! CREATION DATE - !! 31/01/05 - !! MODIFICATION HISTORY - !! 15:54, 27/04/2007 drb - !! Changed recip_vector, grad_density and tmp2, tmp3 to (n,3) for speed - !! 2008/11/13 ast - !! Added new PBE functional types - !! 2011/12/13 L.Tong - !! Removed third, and eight, they are now defined in numbers module - !! 2017/08/29 jack baker & dave - !! Removed rcellx references (redundant) - !! 2018/06/12 11:11 dave - !! Fixing missing factors of spin_factor for non-spin polarisation (this routine only does zero spin) - !! SOURCE - !! - subroutine get_dxc_potential_GGA_PBE(density, density_out, & - dxc_potential, size, flavour ) - - use datatypes - use numbers - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum - use fft_module, only: fft3, recip_vector -! use energy, only: delta_E_xc - - implicit none - - ! Passed variables - integer size - real(double), intent(in) :: density(size) - real(double), intent(in) :: density_out(size) - real(double), intent(inout) :: dxc_potential(size) - integer, optional, intent(in) :: flavour - - ! Local variables - integer n, i - integer selector - - real(double) :: grad_density(size), grad_density_xyz(size,3) - real(double) :: rho, grad_rho, rho1_3, rho1_6 - real(double) :: e_exchange - real(double) :: xc_energy_lda_total, dxc_potential_lda(size), & - eclda(size), declda_drho(size), d2eclda_drho2(size) - real(double) :: de_dgrad(size) - real(double) :: s, s2, factor0, factor1, denominator0, denominator0_2 - real(double) :: d2e_drho2, d2e_dgrad2(size), d2e_dgrad_drho(size) - real(double) :: dden0_drho, df0f1_drho, ds_grad, dden0_dgrad, ds_dgrad, df1_dgrad - real(double) :: diff_rho(size) - complex(double_cplx) :: tmp1(size), tmp2(size,3) - real(double) :: tmp3(size,3), tmp_factor - - real(double) :: a, a2, t, t2, t3, t4, num1, den1, den1_2, fl - real(double) :: factor_exp, factor_exp2, factor_exp3 - real(double) :: dt_drho, da_drho, dnum1_drho, dden1_drho, dfl_drho, dec_drho - real(double) :: dt_dgrad, dnum1_dgrad, dden1_dgrad, dfl_dgrad - real(double) :: d2t_drho2, d2a_drho2, d2num1_drho2, d2den1_drho2, d2fl_drho2 - real(double) :: d2num1_dgrad2, d2den1_dgrad2, d2fl_dgrad2 - real(double) :: d2t_drho_dgrad, d2num1_drho_dgrad, d2den1_drho_dgrad - real(double) :: d2fl_drho_dgrad - - real(double) :: kappa, mu_kappa - - ! From Phys. Rev. Lett. 77, 3865 (1996) - real(double), parameter :: mu = 0.21951_double - real(double), parameter :: beta = 0.066725_double - real(double), parameter :: gamma = 0.031091_double - real(double), parameter :: kappa_ori = 0.804_double - - ! From Phys. Rev. Lett. 80, 890 (1998) - real(double), parameter :: kappa_alt = 1.245_double - - ! Precalculated constants - real(double), parameter :: mu_kappa_ori = 0.27302_double ! mu/kappa_ori - real(double), parameter :: mu_kappa_alt = 0.17631_double ! mu/kappa_alt - real(double), parameter :: beta_gamma = 2.146119_double ! beta/gamma - real(double), parameter :: beta_X_gamma = 0.002074546_double ! beta*gamma - real(double), parameter :: k01 = 0.16162045967_double ! 1/(2*(3*pi*pi)**(1/3)) - real(double), parameter :: k02 = -0.16212105381_double ! -3*mu*((4*pi/3)**3)/(2*pi*alpha) - ! = mu*k00*k01(LDA_PW92)=mu*k04 - real(double), parameter :: k03 = 1.98468639_double ! ((4/pi)*(3*pi*pi)**(1/3))**(1/2) - real(double), parameter :: k04 = -0.738558852965_double ! -3*((4*pi/3)**3)/(2*pi*alpha) = k00*k01 in LDA_PW92 - real(double), parameter :: k05 = 0.05240415_double ! -2*k01*k02 - real(double), parameter :: eight_thirds = 8.0_double / 3.0_double - - ! Selector options - integer, parameter :: fx_original = 1 ! Used in PBE and revPBE - integer, parameter :: fx_alternative = 2 ! Used in RPBE - - ! Choose between PBE or revPBE parameters - if(PRESENT(flavour)) then - if(flavour==functional_gga_pbe96_rev98) then - kappa=kappa_alt - mu_kappa=mu_kappa_alt - else - kappa=kappa_ori - mu_kappa=mu_kappa_ori - end if - else - kappa=kappa_ori - mu_kappa=mu_kappa_ori - end if - - ! Get the LDA part of the functional - grad_density = spin_factor * density ! Factor of spin_factor to account for lack of spin - call get_dxc_potential_LDA_PW92(grad_density, dxc_potential_lda, size, & - eclda, declda_drho, d2eclda_drho2) - grad_density = zero - ! Build the gradient of the density - call build_gradient(density, grad_density_xyz, size) - grad_density_xyz(:,:) = spin_factor * grad_density_xyz(:,:) - grad_density(:) = sqrt(grad_density_xyz(:,1)**2 + & - grad_density_xyz(:,2)**2 + & - grad_density_xyz(:,3)**2) - - - do n=1,n_my_grid_points ! loop over grid pts and store potl on each - rho = spin_factor * density(n) - grad_rho = grad_density(n) - - diff_rho(n) = spin_factor * (density(n) - density_out(n)) - - !!!! EXCHANGE - - !! Energy factors - - if (rho > RD_ERR) then - rho1_3 = rho ** third - rho1_6 = sqrt (rho1_3) - s = k01 * grad_rho / (rho ** four_thirds) - s2 = s * s - denominator0 = one / (one + mu_kappa * s2) - denominator0_2 = denominator0 * denominator0 - factor0 = k02 * rho1_3 - factor1 = s2 * denominator0 - ! NOTE: This doesn't look like in Phys. Rev. Lett. 77:18, 3865 (1996) - ! because the 1 in Fx, has been multiplied by Ex-LDA and is implicit - ! in xc_energy_lda(n), in the total energy below - e_exchange = factor0 * factor1 - else - s = 0.0_double - s2 = 0.0_double - denominator0 = 0.0_double - denominator0_2 = 0.0_double - factor0 = 0.0_double - factor1 = 0.0_double - e_exchange = zero - end if - - !! Second derivative of Ex wrt rho - if (rho > RD_ERR) then - dden0_drho = mu_kappa * eight_thirds * denominator0_2 * s2 /rho - df0f1_drho = third * e_exchange * (one - eight * denominator0) / rho - d2e_drho2 = four_thirds * (df0f1_drho * (one - two * denominator0) & - - two * e_exchange * dden0_drho) - else - d2e_drho2 = 0.0_double - end if - - !! Second derivative of Ex wrt grad - ds_dgrad = 0.0_double - if(rho > RD_ERR) ds_dgrad = k01 * rho**(-four_thirds) - dden0_dgrad = -two * mu_kappa * denominator0_2 * s * ds_dgrad - - d2e_dgrad2(n) = two * rho * factor0 * ds_dgrad * (ds_dgrad * denominator0_2 & - + two * s * denominator0 * dden0_dgrad) - - !! Second derivative of Ex wrt grad and rho - df1_dgrad = two * s * denominator0_2 * ds_dgrad - - d2e_dgrad_drho(n) = (four_thirds) * factor0 & - * (df1_dgrad * (one - two * denominator0) & - - two * factor1 * dden0_dgrad) - - - !! First derivative wrt gradient - de_dgrad(n) = rho * factor0 * df1_dgrad - - - !!!! CORRELATION - - !! Energy terms - factor_exp = exp(-eclda(n)/gamma) - a = factor_exp - one - if(a > RD_ERR) then - a = beta_gamma / a - else - a = beta_gamma * BIG - end if - a2 = a * a - - if(rho > RD_ERR) then - t = grad_rho/(two*k03*(rho**seven_sixths)) - else - t = 0.0_double - end if - t2 = t * t - t3 = t2 * t - t4 = t2 * t2 - num1 = one + a*t2; - den1 = num1 + a2*t4; - den1_2 = den1*den1; - if(den1 > RD_ERR) then - fl = one + beta_gamma * t2 * num1 / den1; - else - fl = one - end if - - - !! First derivative wrt rho - - if(rho > RD_ERR) then - dt_drho = -seven_sixths*t/rho - else - dt_drho = 0.0_double - end if - !TM 2007_10_18 - ! eclda(n) = 0 -> factor_exp = one -> zero**(-2) !!! - !ORI factor_exp2 = (factor_exp - one)**(-two) - if(abs(factor_exp-one) > RD_ERR) then - factor_exp2 = one/(factor_exp - one) - factor_exp2 = factor_exp2**2 - else - factor_exp2 = 0.0_double - end if - - da_drho = beta_gamma * factor_exp * factor_exp2 * declda_drho(n)/gamma - dnum1_drho = da_drho * t2 + two*a*t*dt_drho - dden1_drho = dnum1_drho + two*a*t4*da_drho + four*a2*t3*dt_drho - if(den1 > RD_ERR) then - dfl_drho = beta_gamma*((two*t*num1*dt_drho + t2*dnum1_drho)/den1 - t2*num1*dden1_drho/den1_2) - else - dfl_drho = 0.0_double - end if - dec_drho = gamma * (log(fl) + rho * dfl_drho / fl) - - !! Second derivative with respect to rho - - if(rho > RD_ERR) then - d2t_drho2 = seven_sixths*(t/(rho*rho) - dt_drho/rho) - else - d2t_drho2 = 0.0_double - end if - factor_exp3 = factor_exp * factor_exp2 - if(abs(factor_exp-one) > RD_ERR) then - d2a_drho2 = (beta_gamma/gamma)*( ( ( (two * factor_exp / (factor_exp - one)) - one )& - * factor_exp3 * declda_drho(n)**2) /gamma & - + factor_exp3 * d2eclda_drho2(n)) - else - d2a_drho2 = zero - end if - - d2num1_drho2 = d2a_drho2*t2 + four*t*da_drho*dt_drho & - + two*a*((dt_drho**2) + t*d2t_drho2) - d2den1_drho2 = d2num1_drho2 + two*((da_drho*t2)**2) & - + two*a*d2a_drho2*t4 & - + 16.0_double*a*t3*da_drho*dt_drho & - + 12.0_double*((a*t*dt_drho)**2) & - + four*a2*t3*d2t_drho2 - if(den1 > RD_ERR) then - d2fl_drho2 = beta_gamma*(two*num1*(dt_drho**2) & - + t*(four*(dnum1_drho*dt_drho & - - num1*dden1_drho*dt_drho/den1) & - + two*num1*d2t_drho2) & - + t2*(d2num1_drho2 & - + two*(num1*((dden1_drho/den1)**2) & - - dnum1_drho*dden1_drho/den1) & - - num1*d2den1_drho2/den1))/den1 - else - d2fl_drho2 = 0.0_double - end if - d2e_drho2 = d2e_drho2 + gamma*(two*dfl_drho/fl - rho*((dfl_drho/fl)**2) + rho*d2fl_drho2/fl); - - - !! First derivative with respect to grad - - if(rho > RD_ERR) then - dt_dgrad = one/(two*k03*(rho**seven_sixths)) - else - dt_dgrad = 0.0_double - end if - dnum1_dgrad = two*a*t*dt_dgrad - dden1_dgrad = two*a*t*dt_dgrad + four*a2*t3*dt_dgrad - if(den1 > RD_ERR) then - dfl_dgrad = two*beta_gamma*t*num1*dt_dgrad/den1 + beta_gamma*t2*dnum1_dgrad/den1 & - - beta_gamma*t2*num1*dden1_dgrad/den1_2 - else - dfl_dgrad = 0.0_double - end if - de_dgrad(n) = de_dgrad(n) + gamma * rho * dfl_dgrad / fl - - - !! Second derivative with respect to grad - - d2num1_dgrad2 = two*a*(dt_dgrad**2) - d2den1_dgrad2 = d2num1_dgrad2 + 12.0*((a*t*dt_dgrad)**2) - if(den1 > RD_ERR) then - d2fl_dgrad2 = beta_gamma*(two*num1*(dt_dgrad**2)/den1 & - + four*t*dnum1_dgrad*dt_dgrad/den1 & - - two*t*num1*dden1_dgrad*dt_dgrad/den1_2 & - + t2*d2num1_dgrad2/den1 & - - t2*dden1_dgrad*dnum1_dgrad/den1_2 & - - two*t*num1*dden1_dgrad*dt_dgrad/den1_2 & - - t2*dnum1_dgrad*dden1_dgrad/den1_2 & - + two*t2*num1*(dden1_dgrad**2)/(den1_2*den1) & - - t2*num1*d2den1_dgrad2/den1_2) - else - d2fl_dgrad2 = zero - end if - d2e_dgrad2(n) = d2e_dgrad2(n) + gamma*rho*(d2fl_dgrad2/fl - (dfl_dgrad**2)/(fl*fl)) - - !! Second derivative with respect to rho and grad - - ! if((grad_rho > RD_ERR ) .or. (rho > RD_ERR)) then ! Changed by TM 19Oct2007 - if((grad_rho > RD_ERR ) .and. (rho > RD_ERR)) then - d2t_drho_dgrad = -seven_sixths*t/(grad_rho*rho) - else - d2t_drho_dgrad = 0.0_double - end if - d2num1_drho_dgrad = two*(t*da_drho*dt_dgrad + a*dt_drho*dt_dgrad + a*t*d2t_drho_dgrad) - d2den1_drho_dgrad = d2num1_drho_dgrad + 8.0*a*t3*da_drho*dt_dgrad + 12.0*a2*t2*dt_drho*dt_dgrad & - + four*a2*t3*d2t_drho_dgrad - if(den1 > RD_ERR) then - d2fl_drho_dgrad = beta_gamma*(two*(dt_drho*dt_dgrad*num1 & - + t*(dnum1_drho*dt_dgrad & - + num1*(d2t_drho_dgrad & - - (dden1_drho*dt_dgrad & - + dt_drho*dden1_dgrad)/den1) & - + dnum1_dgrad*dt_drho & - + t*num1*dden1_drho*dden1_dgrad/den1_2)) & - + t2*(d2num1_drho_dgrad & - - (dnum1_dgrad*dden1_drho & - + dnum1_drho*dden1_dgrad & - + num1*d2den1_drho_dgrad)/den1))/den1 - else - d2fl_drho_dgrad = 0.0_double - end if - d2e_dgrad_drho(n) = d2e_dgrad_drho(n) + gamma*(dfl_dgrad + rho*(d2fl_drho_dgrad - dfl_drho*dfl_dgrad/fl))/fl - - - !! Add term L1 to the potential - dxc_potential(n) = dxc_potential(n) & - + diff_rho(n) * (d2e_drho2 + dxc_potential_lda(n)) - - end do ! do n_my_grid_points - - - ! Fourier transform the difference of densities - tmp1(:)=cmplx(zero,zero,double_cplx) !TM - call fft3(diff_rho, tmp1, size, -1) - - !do n=1, n_my_grid_points ! debugged 25Oct2007 TM - do n=1, size - ! Product by reciprocal vector stored for later use - tmp2(n,1) = -minus_i*recip_vector(n,1)*tmp1(n) - tmp2(n,2) = -minus_i*recip_vector(n,2)*tmp1(n) - tmp2(n,3) = -minus_i*recip_vector(n,3)*tmp1(n) - end do - - ! Fourier transform the vector back to the grid - call fft3(tmp3(:,1), tmp2(:,1), size, 1) - call fft3(tmp3(:,2), tmp2(:,2), size, 1) - call fft3(tmp3(:,3), tmp2(:,3), size, 1) - - ! Add term L3 to potential - do n=1, n_my_grid_points - do i=1,3 - if(grad_density(n) > RD_ERR) then - dxc_potential(n) = dxc_potential(n) + (tmp3(n,i) & - * d2e_dgrad_drho(n) & - * grad_density_xyz(n,i) )/grad_density(n) - end if - end do - end do - - ! Term L4 - do n=1, n_my_grid_points - if(grad_density(n) > RD_ERR) then - tmp_factor =(tmp3(n,1) * grad_density_xyz(n,1) & - + tmp3(n,2) * grad_density_xyz(n,2) & - + tmp3(n,3) * grad_density_xyz(n,3)) & - * (d2e_dgrad2(n) & - - de_dgrad(n)/grad_density(n) ) / (grad_density(n)*grad_density(n)) - else - tmp_factor = zero - end if - ! Reuse tmp3 - do i=1,3 - if(grad_density(n) > RD_ERR) then - tmp3(n,i) = tmp_factor * grad_density_xyz(n,i) & - + de_dgrad(n) * tmp3(n,i)/grad_density(n) - else - tmp3(n,i) = zero - end if - end do - end do - - ! Terms L2 and L5 (using L4) - do n=1, n_my_grid_points - do i=1,3 - if(grad_density(n) > RD_ERR) then - tmp3(n,i) = tmp3(n,i) & - + diff_rho(n) * d2e_dgrad_drho(n)* grad_density_xyz(n,i) & - / grad_density(n) - else - tmp3(n,i) = zero - end if - end do - end do - - tmp2(:,:) = cmplx(zero,zero,double_cplx) ! 25Oct2007 TM - call fft3(tmp3(:,1), tmp2(:,1), size, -1) - call fft3(tmp3(:,2), tmp2(:,2), size, -1) - call fft3(tmp3(:,3), tmp2(:,3), size, -1) - - !do n=1, n_my_grid_points ! debugged 25Oct2007 TM - do n=1, size - ! Product by reciprocal vector stored for later use - tmp1(n) = -minus_i & - *(recip_vector(n,1)*tmp2(n,1) & - + recip_vector(n,2)*tmp2(n,2) & - + recip_vector(n,3)*tmp2(n,3)) - end do - - ! Use first component of tmp3 to store final vector - call fft3(tmp3(:,1), tmp1, size, 1) - - do n=1, n_my_grid_points - dxc_potential(n) = dxc_potential(n) - tmp3(n,1) - end do - - return - end subroutine get_dxc_potential_GGA_PBE - !!*** - - - !!****f* XC_module/get_dxc_potential_LSDA_PW92 - !! PURPOSE - !! Calculates the derivative of the exchange-correlation potential - !! on the grid within LSDA using the Ceperley-Alder interpolation - !! formula. This is only for non self-consistent calcuations - !! (Harris-Foulkes), for the forces. - !! - !! The functional is given by Phys. Rev. B 45, 13244 - !! INPUTS - !! OUTPUT - !! RETURN VALUE - !! AUTHOR - !! L.Tong - !! CREATION DATE - !! 2011/10/18 - !! MODIFICATION HISTORY - !! 2012/03/26 L.Tong - !! - Changed spin implementation - !! - density is now array of (maxngrid,nspin) - !! - dxc_potential_ddensity is now array of - !! - (maxngrid,nspin,nspin), so - !! dxc_potential_ddensity(n,spin1,spin2) corresponds to - !! dVxc(spin1) / drho(spin2) at grid point n. - !! 2018/06/15 12:25 dave - !! Removed spin_factor from use statement (global to module now) - !! SOURCE - !! - subroutine get_dxc_potential_LSDA_PW92(density, & - dxc_potential_ddensity, & - size) - use datatypes - use numbers - use dimens, only: grid_point_volume, n_my_grid_points - use GenComms, only: gsum - use global_module, only: nspin - - implicit none - - ! passed variables - integer :: size - real(double), dimension(:,:) :: density - real(double), dimension(:,:,:) :: dxc_potential_ddensity - - ! local variables - integer :: n, spin, spin_2 - real(double) :: rho_tot, rs, rcp_rs, zeta, sq_rs, e_c0, e_c1, & - malpha_c, f, de_c0_drs, drs_drho_tot, de_c1_drs, & - dmalpha_c_drs, df_dzeta, d2e_c0_drs2, d2e_c1_drs2, & - d2malpha_c_drs2, d2f_dzeta2, de_c_drs, de_c_dzeta, & - d2e_c_drs2, d2e_c_drs_dzeta, d2e_c_dzeta2, factor - real(double), dimension(nspin) :: rho, drs_drho, dzeta_drho - real(double), dimension(nspin,nspin) :: dVx_drho, dVc_drho - - ! tabulated parameters - real(double) :: alpha1, beta1, beta2, beta3, beta4, p, A - - ! precalculated parameters - real(double), parameter :: k00 = 1.611991954_double ! (4*pi/3)**(1/3) - real(double), parameter :: k01 = -0.413566994_double ! -(2/pi)**(1/3)/3**(2/3) - real(double), parameter :: K02 = 1.923661051_double ! 1 / (2**(4/3)-2) - real(double), parameter :: K03 = 0.584822362_double ! 1 / f''(0) - real(double), parameter :: K04 = -0.328248341_double ! -(1/pi)**(1/3)/3**(2/3) - - ! loop over grid points - do n = 1, n_my_grid_points - rho_tot = zero - do spin = 1, nspin - rho(spin) = density(n,spin) - rho_tot = rho_tot + spin_factor * rho(spin) - end do - if (rho_tot > RD_ERR) then - rcp_rs = k00 * rho_tot**third - zeta = (rho(1) - rho(nspin)) / rho_tot - else - rcp_rs = zero - ! limit rho(spin) --> 0+ for all spin gives zeta --> zero - ! (remember rho(spin) >= 0) - zeta = zero - end if - - ! exchange (worked out from Mathematica) - do spin = 1, nspin - if (rho(spin) > RD_ERR) then - ! if spin non-polarised, dVx_drho is calculated to be dVx/drho_tot - ! this is found to be half of dVx_drho(spin=1) - dVx_drho(spin,spin) = & - k01 / (spin_factor * (rho(spin))**two_thirds) - else - dVx_drho(spin,spin) = zero - end if - end do - if (nspin == 2) then - dVx_drho(1,2) = zero ! dVx_drho(1,2) = dVx_up_drho_dn - dVx_drho(2,1) = zero ! dVx_drho(2,1) = dVx_dn_drho_up - end if - - ! correlation - if (rcp_rs > RD_ERR) then - rs = one / rcp_rs - else - ! here rs really should be infty, however, it is a TRICK to - ! set it to zero here, but it gives the correct end results - ! for G(rs), G'(rs) and G''(rs), etc. - rs = zero - end if - sq_rs = sqrt(rs) - - ! drs_drho - if (nspin == 1) then - if (rho_tot > RD_ERR) then - drs_drho_tot = - third * rs / rho_tot - else - drs_drho_tot = zero - end if - else if (nspin == 2) then - do spin = 1, nspin - if (rho(spin) > RD_ERR) then - drs_drho(spin) = - third * rs / rho_tot - dzeta_drho(spin) = ((-one)**(spin+1) - zeta) / rho_tot - else - drs_drho(spin) = zero - dzeta_drho(spin) = zero - end if - end do - end if - - ! e_c0 and de_c0_drs - ! from table 1 of Phys. Rev. B 45, 13244 - call PW92_G(rs, & - A=0.031091_double, & - alpha1=0.21370_double, & - beta1=7.5957_double, & - beta2=3.5876_double, & - beta3=1.6382_double, & - beta4=0.49294_double, & - p=one, & - G=e_c0, & - dG_drs=de_c0_drs, & - d2G_drs2=d2e_c0_drs2) - - ! for spin non-polarised calculations this is enough for - ! de_c_drs and d2e_c_drs2 - de_c_drs = de_c0_drs - d2e_c_drs2 = d2e_c0_drs2 - - if (nspin == 2) then - ! e_c1 and de_c1_drs - ! from table 1 of Phys. Rev. B 45, 13244 - call PW92_G(rs, & - A=0.015545_double, & - alpha1=0.20548_double, & - beta1=14.1189_double, & - beta2=6.1977_double, & - beta3=3.3662_double, & - beta4=0.62517_double, & - p=one, & - G=e_c1, & - dG_drs=de_c1_drs, & - d2G_drs2=d2e_c1_drs2) - ! malpha_c and dmalpha_c_drs - ! from table 1 of Phys. Rev. B 45, 13244 - call PW92_G(rs, & - A=0.016887_double, & - alpha1=0.11125_double, & - beta1=10.357_double, & - beta2=3.6231_double, & - beta3=0.88026_double, & - beta4=0.49671_double, & - p=one, & - G=malpha_c, & - dG_drs=dmalpha_c_drs, & - d2G_drs2=d2malpha_c_drs2) - - ! f and df_dzeta - f = K02 * ((one + zeta)**four_thirds + (one - zeta)**four_thirds - two) - df_dzeta = four_thirds * K02 * ((one + zeta)**one_third - & - (one - zeta)**one_third) - d2f_dzeta2 = one_third * four_thirds * K02 * & - ((one + zeta)**(-two_thirds) + & - (one - zeta)**(-two_thirds)) - - ! first order derivatives - de_c_drs = de_c_drs - de_c0_drs * f * zeta**4 + & - de_c1_drs * f * zeta**4 + & - dmalpha_c_drs * K03 * f * (zeta**4 - one) - de_c_dzeta = four * zeta**3 * f * (e_c1 - e_c0 + K03 * malpha_c) + & - df_dzeta * (zeta**4 * e_c1 - zeta**4 * e_c0 + & - (zeta**4 - one) * K03 * malpha_c) - - ! second order derivatives - ! d2e_c_drs2 - d2e_c_drs2 = d2e_c_drs2 - d2e_c0_drs2 * f * zeta**4 + & - d2e_c1_drs2 * f * zeta**4 + & - d2malpha_c_drs2 * K03 * f * (zeta**4 - one) - - ! d2e_c_drs_dzeta - d2e_c_drs_dzeta = four * zeta**3 * f * & - (de_c1_drs - de_c0_drs + K03 * dmalpha_c_drs) + & - df_dzeta * (zeta**4 * de_c1_drs - & - zeta**4 * de_c0_drs + & - (zeta**4 - one) * K03 * dmalpha_c_drs) - - ! d2e_c_dzeta2 - d2e_c_dzeta2 = & - (twelve * zeta * zeta * f + eight * zeta**3 * df_dzeta) * & - (e_c1 - e_c0 + K03 * malpha_c) + & - d2f_dzeta2 * (zeta**4 * e_c1 - zeta**4 * e_c0 + & - (zeta**4 - one) * K03 * malpha_c) - end if - - ! finally get the derivatives of the correlation potentials - if (nspin == 1) then - ! for spin non-polarised calculations, we need to calculate - ! dVc_drho_tot - dVc_drho(1,1) = (two_thirds * de_c_drs - & - one_third * rs * d2e_c_drs2) * & - drs_drho_tot - else - do spin = 1, nspin - do spin_2 = 1, nspin - factor = zeta + (-one)**spin - dVc_drho(spin,spin_2) = & - (two_thirds * de_c_drs - & - one_third * rs * d2e_c_drs2 - & - factor * d2e_c_drs_dzeta) * & - drs_drho(spin_2) - & - (one_third * rs * d2e_c_drs_dzeta + & - factor * d2e_c_dzeta2) * & - dzeta_drho(spin_2) - end do - end do - end if - - ! collect things together - do spin = 1, nspin - do spin_2 = 1, nspin - dxc_potential_ddensity(n,spin,spin_2) = & - dVx_drho(spin,spin_2) + dVc_drho(spin,spin_2) - end do - end do - - end do ! n = 1, n_my_grid_points - - return - end subroutine get_dxc_potential_LSDA_PW92 - !!***** - - - !!****f* XC_module/PW92_G - !! PURPOSE - !! Calculates the interpolation function G defined in PW92 LSDA - !! paper: - !! Perdew and Wang, Phys. Rev. B, 1992, 45, 13244-13249 - !! USAGE - !! call PW92_G(rs, A, alpha1, beta1, beta2, beta3, beta4, p, - !! G, dG_drs, d2G_drs2) - !! INPUTS - !! real(double) rs : the variable for G(rs) function - !! real(double) A : interpolation parameter - !! real(double) alpha1 : interpolation parameter - !! real(double) beta1 : interpolation parameter - !! real(double) beta2 : interpolation parameter - !! real(double) beta3 : interpolation parameter - !! real(double) beta4 : interpolation parameter - !! real(double) p : interpolation parameter - !! OUTPUT - !! real(double) G : G(rs) - !! real(double) dG_drs : dG/drs (optional) - !! real(double) d2G_drs2 : d^2G/drs^2 (optional) - !! AUTHOR - !! L.Tong - !! CREATION DATE - !! 2013/03/01 - !! MODIFICATION HISTORY - !! SOURCE - !! - subroutine PW92_G(rs, A, alpha1, beta1, beta2, beta3, beta4, p, & - G, dG_drs, d2G_drs2) - use datatypes - use numbers - implicit none - - ! passed parameters - real(double), intent(in) :: rs, A, alpha1, beta1, beta2, beta3, beta4, p - real(double), intent(out) :: G - real(double), intent(out), optional :: dG_drs, d2G_drs2 - ! local variables - real(double) :: sq_rs, Q0, Q1, dQ0_drs, dQ1_drs, d2Q0_drs2, d2Q1_drs2 - - if (abs(rs) <= RD_ERR) then - G = zero - if (present(dG_drs)) dG_drs = zero - if (present(d2G_drs2)) d2G_drs2 = zero - return - end if - - sq_rs = sqrt(rs) - - Q0 = -two * A * (one + alpha1 * rs) - Q1 = two * A * (beta1 * sq_rs + beta2 * rs + & - beta3 * sq_rs**3 + beta4 * rs**(p + one)) - G = Q0 * log(one + one / Q1) - if (present(dG_drs) .or. present(d2G_drs2)) then - dQ0_drs = -two * A * alpha1 - dQ1_drs = A * (beta1 / sq_rs + two * beta2 + & - three * beta3 * sq_rs + four * beta4 * rs) - d2Q1_drs2 = half * A * (-beta1 / (sq_rs**3) + & - three * beta3 / sq_rs + & - eight * beta4) - end if - if (present(dG_drs)) then - dG_drs = dQ0_drs * log(one + one / Q1) - & - (Q0 * dQ1_drs) / (Q1 * (Q1 + one)) - end if - if (present(d2G_drs2)) then - d2G_drs2 = - (two * dQ0_drs * dQ1_drs + Q0 * d2Q1_drs2) / & - (Q1 * (Q1 + one)) + & - dQ1_drs * (two * Q1 + one) * Q0 * dQ1_drs / & - ((Q1 * (Q1 + one))**2) - end if - - return - end subroutine PW92_G - !***** - -end module XC diff --git a/src/system/system.example.make b/src/system/system.example.make index f8341d997..db63ddd04 100644 --- a/src/system/system.example.make +++ b/src/system/system.example.make @@ -31,10 +31,9 @@ SCALAPACK = -lscalapack #XC_COMPFLAGS = # LibXC compatibility -# Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) +# Choose LibXC version: v4 (deprecated) or v5/6/7 (v5, v6 and v7 have the same interface) #XC_LIBRARY = LibXC_v4 -#XC_LIBRARY = LibXC_v5 -XC_LIBRARY = LibXC_v7 +XC_LIBRARY = LibXC_v5 #XC_LIB = -lxcf90 -lxc XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/usr/local/include diff --git a/tools/BasisGeneration/radial_xc_LibXC_v5_module.f90 b/tools/BasisGeneration/radial_xc_LibXC_v5_module.f90 index 0a8694caa..06e51c7be 100644 --- a/tools/BasisGeneration/radial_xc_LibXC_v5_module.f90 +++ b/tools/BasisGeneration/radial_xc_LibXC_v5_module.f90 @@ -1,7 +1,7 @@ ! Contains routines to evaluate XC energy and potential for radial charge distributions module radial_xc - use xc_f90_lib_m + use xc_f03_lib_m implicit none @@ -25,8 +25,8 @@ module radial_xc ! LibXC variables integer :: n_xc_terms integer, dimension(2) :: i_xc_family - type(xc_f90_func_t), dimension(2) :: xc_func - type(xc_f90_func_info_t), dimension(2) :: xc_info + type(xc_f03_func_t), dimension(2) :: xc_func + type(xc_f03_func_info_t), dimension(2) :: xc_info logical :: flag_use_libxc contains @@ -43,8 +43,8 @@ subroutine init_xc integer :: vmajor, vminor, vmicro, i, j integer, dimension(2) :: xcpart character(len=120) :: name, kind, family, ref - type(xc_f90_func_t) :: temp_xc_func - type(xc_f90_func_info_t) :: temp_xc_info + type(xc_f03_func_t) :: temp_xc_func + type(xc_f03_func_info_t) :: temp_xc_info ! Test for LibXC or CQ if(flag_functional_type<0) then @@ -52,7 +52,7 @@ subroutine init_xc ! LibXC functional specified ! -------------------------- flag_use_libxc = .true. - call xc_f90_version(vmajor, vminor, vmicro) + call xc_f03_version(vmajor, vminor, vmicro) if(inode==ionode.AND.iprint>0) then if(vmajor>2) then write(*,'("LibXC version: ",I1,".",I1,".",I1)') vmajor, vminor, vmicro @@ -70,13 +70,13 @@ subroutine init_xc i = floor(-flag_functional_type/1000.0_double) ! Temporary init to find exchange or correlation if(nspin==1) then - call xc_f90_func_init(temp_xc_func, i, XC_UNPOLARIZED) - temp_xc_info = xc_f90_func_get_info(temp_xc_func) + call xc_f03_func_init(temp_xc_func, i, XC_UNPOLARIZED) + temp_xc_info = xc_f03_func_get_info(temp_xc_func) else if(nspin==2) then - call xc_f90_func_init(temp_xc_func, i, XC_POLARIZED) - temp_xc_info = xc_f90_func_get_info(temp_xc_func) + call xc_f03_func_init(temp_xc_func, i, XC_POLARIZED) + temp_xc_info = xc_f03_func_get_info(temp_xc_func) end if - select case(xc_f90_func_info_get_kind(temp_xc_info)) + select case(xc_f03_func_info_get_kind(temp_xc_info)) case(XC_EXCHANGE) xcpart(1) = i xcpart(2) = -flag_functional_type - xcpart(1)*1000 @@ -84,23 +84,23 @@ subroutine init_xc xcpart(2) = i xcpart(1) = -flag_functional_type - xcpart(2)*1000 end select - call xc_f90_func_end(temp_xc_func) + call xc_f03_func_end(temp_xc_func) end if ! Now initialise and output do i=1,n_xc_terms if(nspin==1) then - call xc_f90_func_init(xc_func(i), xcpart(i), XC_UNPOLARIZED) - xc_info(i) = xc_f90_func_get_info(xc_func(i)) + call xc_f03_func_init(xc_func(i), xcpart(i), XC_UNPOLARIZED) + xc_info(i) = xc_f03_func_get_info(xc_func(i)) else if(nspin==2) then - call xc_f90_func_init(xc_func(i), xcpart(i), XC_POLARIZED) - xc_info(i) = xc_f90_func_get_info(xc_func(i)) + call xc_f03_func_init(xc_func(i), xcpart(i), XC_POLARIZED) + xc_info(i) = xc_f03_func_get_info(xc_func(i)) end if ! Consistent threshold with Conquest - !if(vmajor>2) call xc_f90_func_set_dens_threshold(xc_func(i),RD_ERR) - name = xc_f90_func_info_get_name(xc_info(i)) - i_xc_family(i) = xc_f90_func_info_get_family(xc_info(i)) + !if(vmajor>2) call xc_f03_func_set_dens_threshold(xc_func(i),RD_ERR) + name = xc_f03_func_info_get_name(xc_info(i)) + i_xc_family(i) = xc_f03_func_info_get_family(xc_info(i)) if(inode==ionode) then - select case(xc_f90_func_info_get_kind(xc_info(i))) + select case(xc_f03_func_info_get_kind(xc_info(i))) case (XC_EXCHANGE) write(kind, '(a)') 'an exchange functional' case (XC_CORRELATION) @@ -134,10 +134,10 @@ subroutine init_xc " family and is defined in the reference(s):")') & trim(name), trim(kind), trim(family) j = 0 - ref = xc_f90_func_reference_get_ref(xc_f90_func_info_get_references(xc_info(i),j)) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) do while(j >= 0) write(*, '(a,i1,2a)') '[', j, '] ', trim(ref) - ref = xc_f90_func_reference_get_ref(xc_f90_func_info_get_references(xc_info(i),j)) + ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(i),j)) end do else write(*,'("The functional ", a, " is ", a, ", and it belongs to the ", a, & @@ -237,10 +237,10 @@ subroutine get_vxc(n_tot,rr,rho,vxc,exc) ! Call routine select case (i_xc_family(n)) case(XC_FAMILY_LDA) - call xc_f90_lda_exc_vxc(xc_func(n),int(n_tot,kind=wide),loc_rho(1),exc_array(1),vrho(1)) + call xc_f03_lda_exc_vxc(xc_func(n),int(n_tot,kind=wide),loc_rho(1),exc_array(1),vrho(1)) vxc = vxc + vrho case(XC_FAMILY_GGA) - call xc_f90_gga_exc_vxc(xc_func(n),int(n_tot,kind=wide),loc_rho(1),sigma(1),exc_array(1),vrho(1),vsigma(1)) + call xc_f03_gga_exc_vxc(xc_func(n),int(n_tot,kind=wide),loc_rho(1),sigma(1),exc_array(1),vrho(1),vsigma(1)) vxc = vxc + vrho d2term = zero vsigma = vsigma*two*drho_dr From 57e93d77eb96ff632100b8b1752e39cc688153b8 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Tue, 14 Jan 2025 15:41:08 +0900 Subject: [PATCH 08/45] Modified system/system.gha.make Modified system/system.gha.make for git to use f03. --- src/system/system.gha.make | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/system.gha.make b/src/system/system.gha.make index 525251972..fd44bb17f 100644 --- a/src/system/system.gha.make +++ b/src/system/system.gha.make @@ -6,7 +6,8 @@ LINKFLAGS=-fopenmp -L/usr/lib -L/usr/lib/x86_64-linux-gnu BLAS= -llapack -lblas # LibXC compatibility (LibXC below) or Conquest XC library XC_LIBRARY = LibXC_v5 -XC_LIB = -lxcf90 -lxc +#XC_LIB = -lxcf90 -lxc +XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/usr/include # Set FFT library FFT_LIB=-lfftw3 From 5a536fbc1c7f40a6c4774b9f08c2af48e003f474 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 20 Jan 2025 17:11:01 +0900 Subject: [PATCH 09/45] Updates to cell constraints and how they are applied Specifically related to constraining ratios e.g. c/a --- src/force_module.f90 | 26 +++++++++++++++++++++++++- src/initial_read_module.f90 | 8 ++++---- src/move_atoms.module.f90 | 20 +++++++++++++++++--- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/force_module.f90 b/src/force_module.f90 index 1a0534099..ef752c71b 100644 --- a/src/force_module.f90 +++ b/src/force_module.f90 @@ -225,6 +225,8 @@ module force_module !! Add printint forces/stress in ASE output !! 2023/01/10 18:41 lionel !! Secure ASE printing when using ordern + !! 2025/01/20 17:07 dave + !! Add constraints on stress when constraining cell optimisation !! SOURCE !! subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & @@ -288,7 +290,7 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & ! Local variables integer :: i, j, ii, stat, max_atom, max_compt, ispin, & direction, dir1, dir2, counter - real(double) :: max_force, volume, scale, g0 + real(double) :: max_force, volume, scale, g0, scaleC type(cq_timer) :: tmr_l_tmp1 type(cq_timer) :: backtrace_timer integer :: backtrace_level @@ -740,6 +742,28 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & else if (leqi(cell_constraint_flag, 'b c') .or. leqi(cell_constraint_flag, 'c b')) then stress(2,2) = zero stress(3,3) = zero + ! These ensure that the stresses maintain the desired ratio while keeping the average fixed + else if (leqi(cell_constraint_flag,'a/b') .or. leqi(cell_constraint_flag,'b/a')) then + call print_stress(trim(prefix)//" Orig stress: ", stress, -2, write_ase) ! Force output + ! Desired ratio + scaleC = rcelly/rcellx + ! Average x-y stress + stress(1,1) = (stress(1,1) + stress(2,2))/(one + scaleC) + stress(2,2) = scaleC*stress(1,1) + else if (leqi(cell_constraint_flag,'a/c') .or. leqi(cell_constraint_flag,'c/a')) then + call print_stress(trim(prefix)//" Orig stress: ", stress, -2, write_ase) ! Force output + ! Desired ratio + scaleC = rcellz/rcellx + ! Average x-z stress + stress(1,1) = (stress(1,1) + stress(3,3))/(one + scaleC) + stress(3,3) = scaleC*stress(1,1) + else if (leqi(cell_constraint_flag,'c/b') .or. leqi(cell_constraint_flag,'b/c')) then + call print_stress(trim(prefix)//" Orig stress: ", stress, -2, write_ase) ! Force output + ! Desired ratio + scaleC = rcelly/rcellz + ! Average y-z stress + stress(3,3) = (stress(3,3) + stress(2,2))/(one + scaleC) + stress(2,2) = scaleC*stress(3,3) end if ! Output if (inode == ionode.AND.iprint_MD + min_layer>2) then diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index 38b367936..dc3db8d17 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -1632,10 +1632,10 @@ subroutine read_input(start, start_L, titles, vary_mu,& optcell_method = fdf_integer('AtomMove.OptCellMethod', 1) cell_constraint_flag = fdf_string(20,'AtomMove.OptCell.Constraint','none') ! Warn user if applying constraints with OptCellMethod 3 - if(optcell_method==3.and.(.not.leqi(cell_constraint_flag,'none'))) then - call cq_warn(sub_name,"Cell constraints NOT applied for OptCellMethod 3") - cell_constraint_flag = 'none' - end if + !if(optcell_method==3.and.(.not.leqi(cell_constraint_flag,'none'))) then + ! call cq_warn(sub_name,"Cell constraints NOT applied for OptCellMethod 3") + ! cell_constraint_flag = 'none' + !end if cell_en_tol = fdf_double('AtomMove.OptCell.EnTol',0.00001_double) ! It makes sense to use GPa here so I'm changing the default to 0.1GPa cell_stress_tol = fdf_double('AtomMove.StressTolerance',0.1_double) !005_double) diff --git a/src/move_atoms.module.f90 b/src/move_atoms.module.f90 index fabc9cb9c..764104b1d 100644 --- a/src/move_atoms.module.f90 +++ b/src/move_atoms.module.f90 @@ -5183,12 +5183,15 @@ end subroutine update_pos_and_matrices !! CREATION DATE !! 2019/02/08 !! MODIFICATION HISTORY - !! + !! 2025/01/20 13:45 dave + !! Added conditions for fixed cell side ratios (average stresses) !! SOURCE subroutine propagate_vector(force, config, config_new, cell_ref, k) use GenComms, only: inode, ionode - use global_module, only: iprint_MD, ni_in_cell, id_glob + use global_module, only: iprint_MD, ni_in_cell, id_glob, cell_constraint_flag + use numbers, only: half + use input_module, only: leqi implicit none @@ -5210,7 +5213,18 @@ subroutine propagate_vector(force, config, config_new, cell_ref, k) do j=1,3 config_new(j,i) = config(j,i) + k*force(j,i) end do - end do + end do + ! To maintain cell ratios the strains must be equal, so we average them (the most general way) + if (leqi(cell_constraint_flag, 'a/b') .OR. leqi(cell_constraint_flag, 'b/a')) then + config_new(1,ni_in_cell+1) = half*(config_new(1,ni_in_cell+1) + config_new(2,ni_in_cell+1)) + config_new(2,ni_in_cell+1) = config_new(1,ni_in_cell+1) + else if (leqi(cell_constraint_flag, 'a/c') .OR. leqi(cell_constraint_flag, 'c/a')) then + config_new(1,ni_in_cell+1) = half*(config_new(1,ni_in_cell+1) + config_new(3,ni_in_cell+1)) + config_new(3,ni_in_cell+1) = config_new(1,ni_in_cell+1) + else if (leqi(cell_constraint_flag, 'c/b') .OR. leqi(cell_constraint_flag, 'b/c')) then + config_new(3,ni_in_cell+1) = half*(config_new(3,ni_in_cell+1) + config_new(2,ni_in_cell+1)) + config_new(2,ni_in_cell+1) = config_new(3,ni_in_cell+1) + end if end subroutine propagate_vector !!*** From ac5aeed01aae56f7e42507f4dbb7f71dbc969f79 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Tue, 21 Jan 2025 11:22:15 +0900 Subject: [PATCH 10/45] Updated documentation for constrained cell optimisation --- docs/input_tags.rst | 17 +++++++++-------- docs/strucrelax.rst | 14 +++++++++++++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/docs/input_tags.rst b/docs/input_tags.rst index b3180c33c..62479fd57 100644 --- a/docs/input_tags.rst +++ b/docs/input_tags.rst @@ -951,25 +951,26 @@ AtomMove.OptCell.Constraint (*string*) *Fixing a single cell dimension:* - a: Fix the x-dimension of the simulation box + ``a``: Fix the x-dimension of the simulation cell - b: Fix the y-dimension of the simulation box + ``b``: Fix the y-dimension of the simulation cell - c: Fix the z-dimension of the simulation box + ``c``: Fix the z-dimension of the simulation cell *Fixing multiple cell dimensions:* - any combination of the above separated by a space character. e.g: "a b" fixes - both the x and y dimensions of the simulation box + + Any combination of the above separated by a space character. e.g: ``a b`` fixes + both the x- and y-dimensions of the simulation cell. *Fixing Ratios:* - Any combination of a, b or c separated by a "/" character. e.g "c/a" fixes - the initial ratio of the z-dimension to the x-direction. + Any combination of a, b or c separated by a "/" character, e.g ``c/a`` fixes + the initial ratio of the z-dimension to the x-dimension. *Global scaling factor:* - volume: minimize the total energy by scaling each simulation box dimension by + ``volume``: minimize the total energy by scaling each simulation cell dimension by the same global scaling factor. Search directions are set by the mean stress. AtomMove.TestSpecificForce (*integer*) diff --git a/docs/strucrelax.rst b/docs/strucrelax.rst index 2f0832f47..3b89d843e 100644 --- a/docs/strucrelax.rst +++ b/docs/strucrelax.rst @@ -123,6 +123,15 @@ coordinates* (``AtomMove.OptCellMethod 1``) using the following input: Note that stress is in GPa and enthalpy is in Ha by default. +It is possible to apply constraints to the cell when optimising it, using the +flag ``AtomMove.OptCell.Constraint``. The constraint takes three different possible +forms: fixing one or two of the cell lengths (e.g. ``AtomMove.OptCell.Constraint a`` or +``AtomMove.OptCell.Constraint a b``); fixing the ratio between two cell lengths +(e.g. ``AtomMove.OptCell.Constraint c/a``); and varying only the volume but not the +cell shape (``AtomMove.OptCell.Constraint volume``). Fixing the ratio between two +cell lengths does not determine the minimisation fully: we choose to maintain the +*average* stress in the two directions as well as the ratio. + Go to :ref:`top `. .. _sr_both: @@ -147,7 +156,10 @@ allows *orthorhombic* unit cells). This can be done by setting AtomMove.EnthalpyTolerance 1E-5 AtomMove.StressTolerance 0.1 -Note that stress is in GPa and enthalpy is in Ha by default. +Note that stress is in GPa and enthalpy is in Ha by default. It is possible +to apply constraints to the simulation cell as described above, but this will +require extra care from the user to ensure that the simulation proceeds as +desired. The enthalpy will generally converge much more rapidly than the force and stress, and that it may be necessary to tighten ``minE.SCTolerance`` From aa6ce9f8c4293bb985c1ee2b1693450493f33b1e Mon Sep 17 00:00:00 2001 From: Augustin Lu Date: Fri, 24 Jan 2025 19:36:41 +0900 Subject: [PATCH 11/45] Modify -lxcf90 by -lxcf03 to link with libXC --- docs/installing.rst | 2 +- src/system/system.ubuntu.make | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/installing.rst b/docs/installing.rst index 82cb3da92..20e43d5a9 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -192,7 +192,7 @@ Prepare makefile # Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) # XC_LIBRARY = LibXC_v4 XC_LIBRARY = LibXC_v5 - XC_LIB = -lxcf90 -lxc + XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I\${HOME}/local/include -I/usr/local/include # Set FFT library diff --git a/src/system/system.ubuntu.make b/src/system/system.ubuntu.make index 66e1f1006..2fa3db924 100644 --- a/src/system/system.ubuntu.make +++ b/src/system/system.ubuntu.make @@ -25,7 +25,7 @@ SCALAPACK = -lscalapack-openmpi # Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) # XC_LIBRARY = LibXC_v4 XC_LIBRARY = LibXC_v5 -XC_LIB = -lxcf90 -lxc +XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I${HOME}/local/include -I/usr/local/include # Set FFT library From 6c97680cfae7dc6e870336edd32d403d383be142 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Thu, 6 Feb 2025 02:24:06 +0900 Subject: [PATCH 12/45] Introduced new files to use ELPA Introduced DiagModule.f90, ELPAModule.f90, ELPAModuleDUMMY.f90, energy.obj and initial_read_module.f90 to use ELPA. system/system.make needs to be also changed. --- src/DiagModule.f90 | 17 +++- src/ELPAModule.f90 | 153 ++++++++++++++++++++++++++++++++++++ src/ELPAModuleDUMMY.f90 | 60 ++++++++++++++ src/energy.obj | 1 + src/initial_read_module.f90 | 37 +++++++++ 5 files changed, 266 insertions(+), 2 deletions(-) create mode 100644 src/ELPAModule.f90 create mode 100644 src/ELPAModuleDUMMY.f90 diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index 9f272c3a9..61913ae1e 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -517,6 +517,7 @@ subroutine FindEvals(electrons) use density_module, ONLY: get_band_density use io_module, ONLY: write_eigenvalues, write_eigenvalues_format_ase use pao_format, ONLY: pao + use ELPA_module, ONLY: use_elpa,init_ELPA, end_ELPA implicit none @@ -551,6 +552,9 @@ subroutine FindEvals(electrons) ! Initialise - start BLACS, sort out matrices, allocate memory call initDiag + if(use_elpa) then + call init_ELPA(matrix_size_padH, row_size, col_size, desca, info ) + endif scale = one / real(N_procs_in_pg(pgid), double) @@ -971,6 +975,8 @@ subroutine FindEvals(electrons) end if ! global call endDiag + if(use_elpa) call end_ELPA(info) + min_layer = min_layer + 1 return @@ -1050,6 +1056,7 @@ subroutine initDiag use GenComms, only: my_barrier, cq_abort, myid use memory_module, only: type_dbl, type_int, type_cplx, & reg_alloc_mem, reg_dealloc_mem + use ELPA_module, only: end_ELPA implicit none @@ -4232,6 +4239,7 @@ subroutine distrib_and_diag(spin,index_kpoint,mode,flag_store_w,kpassed) block_size_r, block_size_c, blocks_r, blocks_c, procid, pgroup,& nkpoints_max, pgid, N_kpoints_in_pg, pg_kpoints, N_procs_in_pg, proc_groups use GenComms, only: cq_warn + use ELPA_module, only: use_elpa,ELPA_zhegv implicit none @@ -4298,13 +4306,18 @@ subroutine distrib_and_diag(spin,index_kpoint,mode,flag_store_w,kpassed) ! Call the diagonalisation routine for generalised problem ! H.psi = E.S.psi - - call pzhegvx(1, mode, 'A', 'U', matrix_size_padH, SCHmat(:,:,spin), & + if( use_elpa ) then + call ELPA_zhegv(mode, matrix_size_padH, row_size, col_size, & + SCHmat(:,:,spin), SCSmat(:,:,spin), local_evals(:,spin), z(:,:,spin), info ) + else + call pzhegvx(1, mode, 'A', 'U', matrix_size_padH, SCHmat(:,:,spin), & 1, 1, desca, SCSmat(:,:,spin), 1, 1, descb, & vl, vu, il, iu, abstol, m, mz, local_evals(:,spin), & orfac, z(:,:,spin), 1, 1, descz, work, lwork, & rwork, lrwork, iwork, liwork, ifail, iclustr, & gap, info) + endif + if (info /= 0) then if(info==2.OR.info==4) then ! These are safe to continue if(.NOT.flag_info_greater_zero) then diff --git a/src/ELPAModule.f90 b/src/ELPAModule.f90 new file mode 100644 index 000000000..23ced1b59 --- /dev/null +++ b/src/ELPAModule.f90 @@ -0,0 +1,153 @@ +module ELPA_module + use datatypes + use mpi +!!$ use omp +!TMP use elpa + use GenComms, ONLY: cq_abort, myid + implicit none + + logical :: use_elpa = .false. ! always true in this module + character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 + character(len=16) :: elpa_kernel = "GENERIC" + character(len=8) :: elpa_API = "20241105" + integer :: merow, mecol + +!TMP class(elpa_t), pointer :: elp + + private + public :: use_elpa, elpa_solver, elpa_kernel, elpa_API + public :: init_ELPA, end_ELPA, ELPA_zhegv + +contains + subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) + implicit none + + integer, intent(in) :: matrix_size, row_size, col_size + integer, intent(in) :: desc(9) + integer, intent(out) :: info + + integer :: context, block_size_r, block_size_c + integer :: numrows, numcols, merow, mecol ! numrows= proc_rows, numcols=proc_cols + + context = desc(2) + block_size_r = desc(5) + block_size_c = desc(6) + + if( block_size_r /= block_size_c ) then ! restriction for ELPA + call cq_abort("Diag.BlockSizeR and Diag.BlockSizeC not same !", & + block_size_r, block_size_c ) + end if + + !To get the information of blacs grid + call blacs_gridinfo( context, numrows, numcols, merow, mecol ) + + if( mod(numcols,numrows) /= 0 ) then ! restriction for ELPA + call cq_abort("Diag.ProcRows is not a factor of Diag.ProcCols !",numrows,numcols) + end if + + if( matrix_size <= block_size_r*numrows ) then ! restriction for ELPA + call cq_abort("Diag.BlockSizeR should be less than or equal to", (matrix_size-1)/proc_rows ) + end if + if( matrix_size <= block_size_c*numcols ) then ! restriction for ELPA + call cq_abort("Diag.BlockSizeC should be less than or rqual to", (matrix_size-1)/proc_cols ) + end if + + info = elpa_init(elpa_API) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: ELPA API version not supported") + + elp => elpa_allocate(info) + + call elp%set( "na", matrix_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter na") + call elp%set( "nev", matrix_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter nev") + call elp%set( "local_nrows", row_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter local_nrows") + call elp%set( "local_ncols", col_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter local_ncols") + call elp%set( "nblk", block_size_r, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter nblk") + call elp%set( "mpi_comm_parent", MPI_COMM_WORLD, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter mpi_comm_parent") + call elp%set( "process_row", merow, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter process_row") + call elp%set( "process_col", mecol, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter process_col") + call elp%set( "blacs_context", context, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter blacs_cotext") + + select case( elpa_solver ) + case("ELPA1") + call elp%set( "solver", ELPA_SOLVER_1STAGE, info ) ! ELPA1 + case("ELPA2") + call elp%set( "solver", ELPA_SOLVER_2STAGE, info ) ! ELPA2 + + select case( elpa_kernel ) + case("GENERIC") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC, info ) + case("GENERIC_SIMPLE") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC_SIMPLE, info ) + case("SSE_ASSEMBLY") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_ASSEMBLY, info ) + case("SSE_BLOCK1") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_BLOCK1, info ) + case("SSE_BLOCK2") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_BLOCK2, info ) + case("AVX_BLOCK1") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX_BLOCK1, info ) + case("AVX_BLOCK2") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX_BLOCK2, info ) + case("AVX2_BLOCK1") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX2_BLOCK1, info ) + case("AVX2_BLOCK2") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX2_BLOCK2, info ) + case default + call cq_abort("Invalid Diag.ELPA2Kernal " // trim(elpa_kernel) ) + end select + case default + call cq_abort("Invalid Diag.ELPASolver " // trim(elpa_solver) ) + end select + +!!$ call elp%set( "omp_threads", omp_get_max_threads(), info ) + + info = elp%setup() + if( info /= ELPA_OK ) call cq_abort("something wrong in ELPA !") + end subroutine init_ELPA + + subroutine end_ELPA( info ) + implicit none + + integer, intent(out) :: info + + call elpa_deallocate( elp, info ) + if( info /= ELPA_OK ) call cq_abort("end_ELPA: deallocation error") + call elpa_uninit( info ) + if( info /= ELPA_OK ) call cq_abort("end_ELPA: uninit error") + return + end subroutine end_ELPA + + subroutine ELPA_zhegv( mode, matrix_size, row_size, col_size, & + Hmat, Smat, Wvec, Zmat, info ) + implicit none + + character(len=1), intent(in) :: mode + integer, intent(in) :: matrix_size, row_size, col_size + complex(double_cplx), intent(inout) :: Hmat(row_size,col_size) + complex(double_cplx), intent(inout) :: Smat(row_size,col_size) + real(double), intent(out) :: Wvec(matrix_size) + complex(double_cplx), intent(out) :: Zmat(row_size,col_size) + integer, intent(out) :: info + integer :: i, j + + if( mode =='N' ) then + call elp%generalized_eigenvalues( & + Hmat, Smat, Wvec, .false., info ) + end if + if( mode =='V' ) then + call elp%generalized_eigenvectors( & + Hmat, Smat, Wvec, Zmat, .false., info ) + end if + + end subroutine ELPA_zhegv + +end module ELPA_module diff --git a/src/ELPAModuleDUMMY.f90 b/src/ELPAModuleDUMMY.f90 new file mode 100644 index 000000000..6a28af0be --- /dev/null +++ b/src/ELPAModuleDUMMY.f90 @@ -0,0 +1,60 @@ +module ELPA_module + use datatypes + use mpi + use GenComms, ONLY: cq_abort, myid + implicit none + + logical :: use_elpa = .false. ! always true in this module + character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 + character(len=16) :: elpa_kernel = "GENERIC" + character(len=8) :: elpa_API = "20241105" + integer :: merow, mecol + + private + public :: use_elpa, elpa_solver, elpa_kernel, elpa_API + public :: init_ELPA, end_ELPA, ELPA_zhegv + +contains + subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) + implicit none + + integer, intent(in) :: matrix_size, row_size, col_size + integer, intent(in) :: desc(9) + integer, intent(out) :: info + + if(use_elpa) then + call cq_abort("initi_ELPA: init_ELPA is called though ELPA_module is not compiled") + else + call cq_abort("initi_ELPA: init_ELPA is called even though use_elpa is false") + endif + + return + end subroutine init_ELPA + + subroutine end_ELPA( info ) + implicit none + integer, intent(out) :: info + + call cq_abort("end_ELPA: end_ELPA should not be called") + + return + end subroutine end_ELPA + + subroutine ELPA_zhegv( mode, matrix_size, row_size, col_size, & + Hmat, Smat, Wvec, Zmat, info ) + implicit none + + character(len=1), intent(in) :: mode + integer, intent(in) :: matrix_size, row_size, col_size + complex(double_cplx), intent(inout) :: Hmat(row_size,col_size) + complex(double_cplx), intent(inout) :: Smat(row_size,col_size) + real(double), intent(out) :: Wvec(matrix_size) + complex(double_cplx), intent(out) :: Zmat(row_size,col_size) + integer, intent(out) :: info + + call cq_abort("ELPA_zhev: CONQUEST should be compiled with ELPA") + + return + end subroutine ELPA_zhegv + +end module ELPA_module diff --git a/src/energy.obj b/src/energy.obj index 9f162d503..91a0f4279 100644 --- a/src/energy.obj +++ b/src/energy.obj @@ -7,6 +7,7 @@ ENERGY_OBJS = H_matrix_module.o \ PosTan_module.o \ DMMinModule.o \ DiagModule${DIAG_DUMMY}.o \ + ELPAModule${ELPA_DUMMY}.o \ ScalapackFormat.o \ blip_minimisation.module.o \ blip_gradient.module.o \ diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index dc3db8d17..f39bed499 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -3064,6 +3064,7 @@ subroutine readDiagInfo type_dbl use species_module, only: nsf_species use units, only: en_conv, en_units, energy_units + use ELPA_module, only: use_elpa, elpa_solver, elpa_kernel, elpa_API implicit none @@ -3212,6 +3213,42 @@ subroutine readDiagInfo write(io_lun,2) block_size_r, block_size_c write(io_lun,3) proc_rows, proc_cols end if + + !Using ELPA or not + use_elpa = fdf_boolean('Diag.UseELPA',.false.) + + if( use_elpa ) then + elpa_API = fdf_string(8,'Diag.ELPA_API','20241105') + elpa_solver = fdf_string(16,'Diag.ELPASolver','ELPA1') + select case( elpa_solver ) + case ("ELPA1") + elpa_kernel = "NONE" + + case ("ELPA2") + elpa_kernel = fdf_string(16,'Diag.ELPA2Kernel','GENERIC') + + select case( elpa_kernel ) + case("GENERIC") + case("GENERIC_SIMPLE") + case("SSE_ASSEMBLY") + case("SSE_BLOCK1") + case("SSE_BLOCK2") + case("AVX_BLOCK1") + case("AVX_BLOCK2") + case("AVX2_BLOCK1") + case("AVX2_BLOCK2") + case default + call cq_abort("Invalid Diag.ELPA2Kernal " // elpa_kernel ) + end select + + case default + call cq_abort("Invalid Diag.ELPASolver " // elpa_solver ) + end select + else + elpa_solver = "NONE" + elpa_kernel = "NONE" + end if + ! Read k-point mesh type mp_mesh = fdf_boolean('Diag.MPMesh',.false.) if(.NOT.mp_mesh) then From 02aaae8fbf39a15b0b08f730c9634bf2a1a80013 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Thu, 6 Feb 2025 19:21:44 +0900 Subject: [PATCH 13/45] modified ELPAModule.f90 --- src/ELPAModule.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ELPAModule.f90 b/src/ELPAModule.f90 index 23ced1b59..23f2231a9 100644 --- a/src/ELPAModule.f90 +++ b/src/ELPAModule.f90 @@ -2,7 +2,7 @@ module ELPA_module use datatypes use mpi !!$ use omp -!TMP use elpa + use elpa use GenComms, ONLY: cq_abort, myid implicit none @@ -12,7 +12,7 @@ module ELPA_module character(len=8) :: elpa_API = "20241105" integer :: merow, mecol -!TMP class(elpa_t), pointer :: elp + class(elpa_t), pointer :: elp private public :: use_elpa, elpa_solver, elpa_kernel, elpa_API From 80a1506e1b7667fd311368c61a629e5c0e27cc9c Mon Sep 17 00:00:00 2001 From: ayakon Date: Thu, 6 Feb 2025 20:30:56 +0900 Subject: [PATCH 14/45] pDOS with MSSFs (still there would be some bug) modified: DiagModule.f90 modified: initial_read_module.f90 --- src/DiagModule.f90 | 207 ++++++++++++++++++++++++++++-------- src/initial_read_module.f90 | 1 + 2 files changed, 164 insertions(+), 44 deletions(-) diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index 9f272c3a9..ebfa45dce 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -276,6 +276,7 @@ module DiagModule ! These two flags are used to perform specific calculations in buildK ! (projected DOS and Resta polarisation respectively) logical :: flag_pDOS_buildK = .false. + logical :: flag_WFatomf_buildK = .false. logical :: flag_pol_buildS = .false. !logical :: diagon ! Do we diagonalise or use O(N) ? @@ -502,10 +503,11 @@ subroutine FindEvals(electrons) nkpoints_max, pgid, N_procs_in_pg, & N_kpoints_in_pg use mult_module, only: matH, matS, matK, matM12, SF_to_AtomF_transform, & - matrix_scale, matrix_product_trace, allocate_temp_matrix, free_temp_matrix - use matrix_data, only: Hrange, Srange, aHa_range + matrix_scale, matrix_product, matrix_product_trace, allocate_temp_matrix, free_temp_matrix, & !!! 2025.02.03 nakata + matSFcoeff_tran, mult, sCaTr_sSs_aSs !!! 2025.02.03 nakata + use matrix_data, only: Hrange, Srange, aHa_range, aSs_range !!! 2025.02.03 nakata use primary_module, only: bundle - use species_module, only: species, nsf_species, species_label, n_species + use species_module, only: species, nsf_species, natomf_species, species_label, n_species !!! 2025.02.03 nakata use memory_module, only: type_dbl, type_int, type_cplx, & reg_alloc_mem, reg_dealloc_mem use energy, only: entropy @@ -529,13 +531,14 @@ subroutine FindEvals(electrons) bandE_total, coeff, setA, setB, Eband real(double), dimension(nspin) :: locc, bandE, entropy_local real(double), external :: dlamch - complex(double_cplx), dimension(:,:), allocatable :: scaledEig + complex(double_cplx), dimension(:,:), allocatable :: scaledEig, expH_atomf !!! 2025.02.03 nakata complex(double_cplx), dimension(:,:,:), allocatable :: expH complex(double_cplx) :: c_n_alpha2, c_n_setA2, c_n_setB2 - integer :: info, stat, il, iu, i, j, m, mz, prim_size, ng, wf_no, & + integer :: info, stat, il, iu, i, j, m, mz, prim_size, prim_size_atomf, ng, wf_no, & !!! 2025.02.03 nakata kp, spin, spin_SF, iacc, iprim, l, band, cdft_group, atom_fns_K, & n_band_min, n_band_max integer :: iatom_spec, Nangmom ! number of orbital angular momentum to be dumped (ex. (s,p,d)=3) + integer :: matStmp !!! 2025.02.03 nakata logical :: flag_keepexcite @@ -548,6 +551,12 @@ subroutine FindEvals(electrons) do i = 1, bundle%n_prim prim_size = prim_size + nsf_species(bundle%species(i)) end do +!!! 2025.02.03 nakata + prim_size_atomf = 0 + do i = 1, bundle%n_prim + prim_size_atomf = prim_size_atomf + natomf_species(bundle%species(i)) + end do +!!! nakata end ! Initialise - start BLACS, sort out matrices, allocate memory call initDiag @@ -597,13 +606,25 @@ subroutine FindEvals(electrons) if (stat /= 0) & call cq_abort('FindEvals: failed to alloc expH', stat) call reg_alloc_mem(area_DM, matrix_size * prim_size * nspin, type_cplx) - if(wf_self_con .and. flag_write_projected_DOS) then - allocate(scaledEig(matrix_size,prim_size), STAT=stat) - if (stat /= 0) & - call cq_abort('FindEvals: failed to alloc scaledEig', stat) - call reg_alloc_mem(area_DM, matrix_size * prim_size * nspin, type_cplx) - scaledEig = zero +!!! 2025.02.03 nakata + if(wf_self_con) then + if (flag_write_projected_DOS) then + allocate(scaledEig(matrix_size,prim_size_atomf), STAT=stat) + if (stat /= 0) & + call cq_abort('FindEvals: failed to alloc scaledEig', stat) + call reg_alloc_mem(area_DM, matrix_size * prim_size_atomf * nspin, type_cplx) + scaledEig = zero + end if + if(atomf.ne.sf) then + ! expH_atomf: eigenvectors in PAO basis + allocate(expH_atomf(matrix_size,prim_size_atomf), STAT=stat) + if (stat /= 0) & + call cq_abort('FindEvals: failed to alloc expH_atomf', stat) + call reg_alloc_mem(area_DM, matrix_size * prim_size_atomf, type_cplx) + expH_atomf = zero + end if end if +!!! 2025.02.03 nakata end !call gcopy(Efermi) !call gcopy(occ,matrix_size,nkp) ! else @@ -797,6 +818,7 @@ subroutine FindEvals(electrons) ! Second diagonalisation - get eigenvectors and build K entropy = zero flag_pDOS_buildK = .false. + flag_WFatomf_buildK = .false. spin_SF = 1 pol_S_size = maxval(ne_spin_in_cell) ! Size for polarisation matrix do spin = 1, nspin @@ -823,26 +845,57 @@ subroutine FindEvals(electrons) Hrange, matK(spin) ! Output wavefunction coefficients if(wf_self_con .and. (flag_out_wf .or. flag_write_projected_DOS)) then - if(i==1) then - call write_wavefn_coeffs(evals(:,kp,spin),expH(:,:,spin),spin,firstcall=1) - else - call write_wavefn_coeffs(evals(:,kp,spin),expH(:,:,spin),spin) - end if + if (atomf.ne.sf) expH_atomf = zero if(flag_write_projected_DOS) then scaledEig = zero flag_pDOS_buildK = .true. - call buildK(Hrange, matK(spin), occ(:,kp,spin), & - kk(:,kp), wtk(kp), expH(:,:,spin),scaledEig,matS(spin_SF)) + if (atomf.ne.sf) then + flag_WFatomf_buildK = .true. + matStmp = allocate_temp_matrix(aSs_range,0,atomf,sf) + ! call matrix_product(matSatomf, matSFcoeff_tran(spin_SF), matStmp, mult(aSa_sCaTr_aSs)) + call matrix_product(matSFcoeff_tran(spin_SF), matS(spin_SF), matStmp, mult(sCaTr_sSs_aSs)) + call buildK(Hrange, matK(spin), occ(:,kp,spin), & + kk(:,kp), wtk(kp), expH(:,:,spin), & + scaledEig, matStmp, & + Eig_atomf=expH_atomf, matSFcoeffTran=matSFcoeff_tran(spin_SF)) + flag_WFatomf_buildK = .false. + else + call buildK(Hrange, matK(spin), occ(:,kp,spin), & + kk(:,kp), wtk(kp), expH(:,:,spin), & + scaledEig, matS(spin_SF)) + endif flag_pDOS_buildK = .false. if(i==1) then call write_wavefn_coeffs(evals(:,kp,spin),scaledEig,spin,tag="Sij",firstcall=1) else call write_wavefn_coeffs(evals(:,kp,spin),scaledEig,spin,tag="Sij") end if + else if (atomf.ne.sf) then + write(io_lun,*) "test0 before calling buildK for WFs" ! 2025.02.03 nakata + flag_WFatomf_buildK = .true. + call buildK(Hrange, matK(spin), occ(:,kp,spin), & + kk(:,kp), wtk(kp), expH(:,:,spin), & + Eig_atomf=expH_atomf, matSFcoeffTran=matSFcoeff_tran(spin_SF)) + flag_WFatomf_buildK = .false. + write(io_lun,*) "test0 after calling buildK for WFs" ! 2025.02.03 nakata else call buildK(Hrange, matK(spin), occ(:,kp,spin), & kk(:,kp), wtk(kp), expH(:,:,spin)) end if + ! write WFs + if (atomf.ne.sf) then ! MSSFs + if(i==1) then + call write_wavefn_coeffs(evals(:,kp,spin),expH_atomf,spin,firstcall=1) + else + call write_wavefn_coeffs(evals(:,kp,spin),expH_atomf,spin) + end if + else ! primitive PAOs + if(i==1) then + call write_wavefn_coeffs(evals(:,kp,spin),expH(:,:,spin),spin,firstcall=1) + else + call write_wavefn_coeffs(evals(:,kp,spin),expH(:,:,spin),spin) + end if + endif else if(flag_do_pol_calc) then ! Set up polarisation calculation for this spin channel @@ -895,8 +948,10 @@ subroutine FindEvals(electrons) end do ! j = 1, matrix_size ! Now build data_M12_ij (=-\sum_n eps^n c^n_i c^n_j - ! hence scaling occs by eps allows reuse of buildK) + write(io_lun,*) "test 100.0" !!! 2025.02.03 nakata call buildK(Srange, matM12(spin), occ(:,kp,spin), & kk(:,kp), wtk(kp), expH(:,:,spin)) + write(io_lun,*) "test 100.1" !!! 2025.02.03 nakata end if ! End if (i <= N_kpoints_in_pg(ng)) then end do ! End do ng = 1, proc_groups end do ! End do i = 1, nkpoints_max @@ -969,6 +1024,13 @@ subroutine FindEvals(electrons) if (stat /= 0) call cq_abort('FindEvals: failed to deallocacte scaledEig', stat) call reg_dealloc_mem(area_DM, matrix_size * prim_size, type_cplx) end if +!!! 2025.02.03 nakata + if(wf_self_con .and. (atomf.ne.sf)) then + deallocate(expH_atomf, STAT=stat) + if (stat /= 0) call cq_abort('FindEvals: failed to deallocacte expH_atomf', stat) + call reg_dealloc_mem(area_DM, matrix_size * prim_size_atomf, type_cplx) + end if +!!! 2025.02.03 nakata end ! global call endDiag min_layer = min_layer + 1 @@ -3257,7 +3319,7 @@ end function MP_entropy !! Introduce flag_pol_build_S to select polarisation calculation !! SOURCE !! - subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) + subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, Eig_atomf, matSFcoeffTran) !use maxima_module, only: mx_nponn, mx_at_prim use numbers @@ -3272,13 +3334,14 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) use global_module, only: numprocs, iprint_DM, id_glob, & ni_in_cell, x_atom_cell, y_atom_cell, & z_atom_cell, max_wf, min_layer, flag_do_pol_calc, mat_polX_re, mat_polX_im, & - i_pol_dir_st, i_pol_dir_end, wf_self_con, flag_write_projected_DOS, ne_spin_in_cell + i_pol_dir_st, i_pol_dir_end, wf_self_con, flag_write_projected_DOS, ne_spin_in_cell, & + sf, atomf !!! 2025.02.03 nakata use mpi use GenBlas, only: dot use GenComms, only: myid use mult_module, only: store_matrix_value_pos, matrix_pos, matK, return_matrix_value_pos use matrix_data, only: mat, halo - use species_module, only: nsf_species + use species_module, only: nsf_species, natomf_species !!! 2025.02.03 nakata implicit none @@ -3291,6 +3354,11 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) ! For pDOS complex(double_cplx), optional, dimension(:,:) :: overlapEig integer, optional :: matSij +!!! 2025.02.03 nakata + ! For WFs with MSSFs + complex(double_cplx), optional, dimension(:,:) :: Eig_atomf + integer, optional :: matSFcoeffTran +!!! 2025.02.03 nakata end ! Local variables type(Krecv_data), dimension(:), allocatable :: recv_info @@ -3303,14 +3371,14 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) integer :: len, send_size, recv_size, send_proc, recv_proc, nsf1, & sendtag, recvtag integer :: req1, req2, ierr, atom, inter, prim, wheremat, row_sup,& - col_sup + col_sup, col_atomf !!! 2025.02.03 nakata integer, dimension(:,:), allocatable :: ints, atom_list, & send_prim, send_info, send_orbs, send_off integer, dimension(:), allocatable :: current_loc_atoms, & LocalAtom, num_send, norb_send, send_FSC, recv_to_FSC, & - mapchunk, prim_orbs + mapchunk, prim_orbs, prim_orbs_atomf !!! 2025.02.03 nakata integer, dimension(MPI_STATUS_SIZE) :: mpi_stat - real(double) :: phase, rfac, ifac, rcc, icc, rsum, exp_X_value_real, exp_X_value_imag, Siajb + real(double) :: phase, rfac, ifac, rcc, icc, rsum, exp_X_value_real, exp_X_value_imag, Siajb, SFcoeffTran_iajb !!! 2025.02.03 nakata complex(double_cplx) :: zsum, exp_X_value complex(double_cplx), dimension(:,:), allocatable :: RecvBuffer, & SendBuffer @@ -3411,7 +3479,7 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) write(io_lun,fmt='(10x,i6,a,3i6)') myid,' Maxima: ',maxloc, maxint, maxsend ! Allocate recv_info allocate(send_info(numprocs,maxsend),send_orbs(numprocs,maxsend),send_off(numprocs,maxsend), & - prim_orbs(bundle%mx_iprim),STAT=stat) + prim_orbs(bundle%mx_iprim),prim_orbs_atomf(bundle%mx_iprim),STAT=stat) !!! 2025.02.03 nakata if(stat/=0) call cq_abort('buildK: Error allocating send_info !',stat) send_info = 0 send_orbs = 0 @@ -3422,6 +3490,14 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) prim_orbs(j) = orb_count orb_count = orb_count + nsf_species(bundle%species(j)) end do +!!! 2025.02.03 nakata + prim_orbs_atomf = 0 + orb_count = 0 + do j=1,bundle%n_prim + prim_orbs_atomf(j) = orb_count + orb_count = orb_count + natomf_species(bundle%species(j)) + end do +!!! 2025.02.03 nakata end allocate(recv_info(numprocs),STAT=stat) if(stat/=0) call cq_abort('buildK: Error allocating recv_info !',stat) do i=1,numprocs @@ -3504,8 +3580,12 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) if(myid==0.AND.iprint_DM + min_layer>=4) write(io_lun,fmt='(10x,a,f8.4)') 'Occ is ',occs(i) end if end do +!!! 2025.02.03 nakata if(wf_self_con .and. flag_write_projected_DOS) len = matrix_size + if(wf_self_con .and. flag_WFatomf_buildK) len = matrix_size +!!! 2025.02.03 nakata end len_occ = len + write(io_lun,*) "matrix_size, len, len_occ=", matrix_size, len, len_occ !!! 2025.02.03 nakata if(iprint_DM+min_layer>3.AND.myid==0) & write(io_lun,fmt='(10x,a,2i6)') 'buildK: Stage three len:',len, matA if(flag_do_pol_calc.AND.flag_pol_buildS) then @@ -3588,7 +3668,10 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) end do if(iprint_DM + min_layer>=4.AND.myid==0) & write(io_lun,fmt='(10x,a)') 'filling buffer' - if(.not.(wf_self_con .and. flag_write_projected_DOS)) then +!!! 2025.02.03 nakata +! if(.not.(wf_self_con .and. flag_write_projected_DOS)) then + if(.not.(flag_pDOS_buildK .or. flag_WFatomf_buildK)) then +!!! 2025.02.03 nakata end do j=1,len_occ ! This is a loop over eigenstates RecvBuffer(j,1:recv_info(recv_proc+1)%orbs) = RecvBuffer(j,1:recv_info(recv_proc+1)%orbs)*occ_correction*occs(j) end do @@ -3639,20 +3722,52 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) polSloc(1:pol_S_size,1:pol_S_size,dir),pol_S_size) end do end if - ! projected DOS - if(flag_pDOS_buildK .and. wf_self_con .and. flag_write_projected_DOS) then - whereMat = matrix_pos(matSij, prim, jatom, col_sup, row_sup) - Siajb = return_matrix_value_pos(matSij,whereMat) - ! 1:len_occ gives bands; we want c_jb^n * S_iajb - overlapEig(1:len_occ,prim_orbs(prim)+col_sup) = & - overlapEig(1:len_occ,prim_orbs(prim)+col_sup) + & - Siajb*RecvBuffer(1:len_occ,orb_count+row_sup)*cmplx(rfac,ifac,double_cplx) - end if +!!! 2025.02.03 nakata pDOS-MSSF +! ! projected DOS +! if(flag_pDOS_buildK .and. wf_self_con .and. flag_write_projected_DOS) then +! whereMat = matrix_pos(matSij, prim, jatom, col_sup, row_sup) +! Siajb = return_matrix_value_pos(matSij,whereMat) +! ! 1:len_occ gives bands; we want c_jb^n * S_iajb +! overlapEig(1:len_occ,prim_orbs(prim)+col_sup) = & +! overlapEig(1:len_occ,prim_orbs(prim)+col_sup) + & +! Siajb*RecvBuffer(1:len_occ,orb_count+row_sup)*cmplx(rfac,ifac,double_cplx) +! end if +!!! 2025.02.03 nakata end ! Build K or M3 whereMat = matrix_pos(matA, prim, jatom, col_sup, row_sup) zsum = dot(len_occ,localEig(1:len_occ,prim_orbs(prim)+col_sup),1,RecvBuffer(1:len_occ,orb_count+row_sup),1) call store_matrix_value_pos(matA,whereMat,real(zsum*cmplx(rfac,ifac,double_cplx),double)) end do ! col_sup=nsf +!!! 2025.02.03 nakata pDOS-MSSF + ! projected DOS in atomf basis + if(wf_self_con) then + do col_atomf = 1,natomf_species(bundle%species(prim)) + ! c (WF coefficients) in PAO basis + if (flag_WFatomf_buildK .and. (atomf.ne.sf)) then + write(io_lun,*) 'sub:buildK test1' + write(io_lun,'(A,4I3,F20.15)') 'prim, jatom, col_atomf, row_sup', prim, jatom, col_atomf, row_sup + whereMat = matrix_pos(matSFcoeffTran, prim, jatom, col_atomf, row_sup) + write(io_lun,*) 'sub:buildK test1.1' + SFcoeffTran_iajb = return_matrix_value_pos(matSFcoeffTran,whereMat) + write(io_lun,'(A,4I3,F20.15)') 'prim, jatom, col_atomf, row_sup, SFcoeffTran_iajb', prim, jatom, col_atomf, row_sup, SFcoeffTran_iajb + ! 1:len_occ gives bands; we want c_ia(pao)^n = c_jb^n(sf) * SFcoeffTran_iajb(pao,sf) + Eig_atomf(1:len_occ,prim_orbs_atomf(prim)+col_atomf) = & + Eig_atomf(1:len_occ,prim_orbs_atomf(prim)+col_atomf) + & + SFcoeffTran_iajb*RecvBuffer(1:len_occ,orb_count+row_sup)*cmplx(rfac,ifac,double_cplx) + write(io_lun,*) 'sub:buildK test1.2' + endif + ! c*S for pDOS + if (flag_pDOS_buildK .and. flag_write_projected_DOS) then + whereMat = matrix_pos(matSij, prim, jatom, col_atomf, row_sup) + Siajb = return_matrix_value_pos(matSij,whereMat) + ! 1:len_occ gives bands; we want d_ia^n = c_jb^n(sf) * S_iajb(pao,sf) + overlapEig(1:len_occ,prim_orbs_atomf(prim)+col_atomf) = & + overlapEig(1:len_occ,prim_orbs_atomf(prim)+col_atomf) + & + Siajb*RecvBuffer(1:len_occ,orb_count+row_sup)*cmplx(rfac,ifac,double_cplx) + endif + end do ! col_atomf=natomf + end if +!!! 2025.02.03 nakata end end do ! row_sup=nsf end do ! inter=recv_info%ints ! Careful - we only want to increment after ALL interactions done @@ -3685,7 +3800,7 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij) recv_info(i)%dx,recv_info(i)%dy,recv_info(i)%dz,STAT=stat) if(stat/=0) call cq_abort('buildK: Error deallocating recvinfo !',i,stat) end do - deallocate(prim_orbs,send_off,send_orbs,send_info,STAT=stat) + deallocate(prim_orbs_atomf,prim_orbs,send_off,send_orbs,send_info,STAT=stat) !!! 2025.02.03 nakata if(stat/=0) call cq_abort('buildK: Error allocating send_info !',stat) deallocate(recv_info,STAT=stat) if(stat/=0) call cq_abort('buildK: Error allocating recv_info !',stat) @@ -4003,6 +4118,10 @@ end subroutine buildK !! Added support for writing out specific bands !! 2023/05/10 08:24 dave !! Reworked for post-processing requirements and added binary output option + !! 2025/02/03 17:30 nakata + !! Changed nsf_species to natomf_species + !! to write out WFs in PAO-basis rather than SF-basis. + !! WFs with PAO-basis is treatable in PostProcess for both PAOs and MSSFs. !! SOURCE !! subroutine write_wavefn_coeffs(eval, evec, spin, tag, firstcall) @@ -4065,10 +4184,10 @@ subroutine write_wavefn_coeffs(eval, evec, spin, tag, firstcall) acc = 0 do atom=1,bundle%n_prim write(lun) bundle%ig_prim(atom) - do isf1 = 1,nsf_species(bundle%species(atom)) + do isf1 = 1,natomf_species(bundle%species(atom)) write(lun) evec(wf_no,acc+isf1) end do - acc = acc + nsf_species(bundle%species(atom)) + acc = acc + natomf_species(bundle%species(atom)) end do end do ! iwf else @@ -4078,10 +4197,10 @@ subroutine write_wavefn_coeffs(eval, evec, spin, tag, firstcall) acc = 0 do atom=1,bundle%n_prim write(lun) bundle%ig_prim(atom) - do isf1 = 1,nsf_species(bundle%species(atom)) + do isf1 = 1,natomf_species(bundle%species(atom)) write(lun) evec(iwf,acc+isf1) end do - acc = acc + nsf_species(bundle%species(atom)) + acc = acc + natomf_species(bundle%species(atom)) end do end if end do ! iwf @@ -4100,10 +4219,10 @@ subroutine write_wavefn_coeffs(eval, evec, spin, tag, firstcall) acc = 0 do atom=1,bundle%n_prim write(lun,*) bundle%ig_prim(atom) - do isf1 = 1,nsf_species(bundle%species(atom)) + do isf1 = 1,natomf_species(bundle%species(atom)) write(lun,*) evec(wf_no,acc+isf1) end do - acc = acc + nsf_species(bundle%species(atom)) + acc = acc + natomf_species(bundle%species(atom)) end do end do ! iwf else @@ -4113,10 +4232,10 @@ subroutine write_wavefn_coeffs(eval, evec, spin, tag, firstcall) acc = 0 do atom=1,bundle%n_prim write(lun,*) bundle%ig_prim(atom) - do isf1 = 1,nsf_species(bundle%species(atom)) + do isf1 = 1,natomf_species(bundle%species(atom)) write(lun,*) evec(iwf,acc+isf1) end do - acc = acc + nsf_species(bundle%species(atom)) + acc = acc + natomf_species(bundle%species(atom)) end do end if end do ! iwf diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index dc3db8d17..a339a1d28 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -1765,6 +1765,7 @@ subroutine read_input(start, start_L, titles, vary_mu,& if(flag_diagonalisation) then flag_write_projected_DOS = fdf_boolean('IO.write_proj_DOS',.false.) if(flag_write_projected_DOS) then + flag_out_wf = .true. !!! 2025.02.03 nakata E_wf_min = fdf_double('IO.min_wf_E',-BIG) E_wf_max = fdf_double('IO.max_wf_E',BIG) end if From 1b991b7116fc0d9a28e323419b6e3cdd0450f203 Mon Sep 17 00:00:00 2001 From: ayakon Date: Thu, 6 Feb 2025 20:34:44 +0900 Subject: [PATCH 15/45] pDOS with MSSFs (in PostProcessing) --- tools/PostProcessing/pseudo_tm_info.f90 | 7 +++++++ tools/PostProcessing/read_module.f90 | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/PostProcessing/pseudo_tm_info.f90 b/tools/PostProcessing/pseudo_tm_info.f90 index 5ff6bea62..1dee95a7a 100644 --- a/tools/PostProcessing/pseudo_tm_info.f90 +++ b/tools/PostProcessing/pseudo_tm_info.f90 @@ -151,6 +151,9 @@ module pseudo_tm_info !! Add IF with pseudo_type for calling init_rad when ghost atoms are used !! 2019/12/09 20:16 dave !! Changes to read valence charge from pseudopotential file and test spin-polarised charge + !! 2025/02/04 17:00 nakata + !! nsf_species is set to npao_species anyway, even when MSSFs are used, + !! because evec_coeff was changed to be in the (pao, wf) format from the (sf, wf) format. !! SOURCE !! subroutine setup_pseudo_info @@ -206,8 +209,12 @@ subroutine setup_pseudo_info call read_ion_ascii_tmp(pseudo(ispecies),pao(ispecies)) npao_species(ispecies) = pao(ispecies)%count +!!! 2025.02.03 nakata ! Set NSF if not set by user if(nsf_species(ispecies)==0) nsf_species(ispecies) = pao(ispecies)%count + ! Set NSF to NPAO anyway (even if NSF is set by user for MSSFs) + nsf_species(ispecies) = pao(ispecies)%count +!!! 2025.02.03 nakata end maxnsf = max(maxnsf,nsf_species(ispecies)) ! Find radius for atom functions do l=0,pao(ispecies)%greatest_angmom diff --git a/tools/PostProcessing/read_module.f90 b/tools/PostProcessing/read_module.f90 index 2e381d2e0..c0e03c5b7 100644 --- a/tools/PostProcessing/read_module.f90 +++ b/tools/PostProcessing/read_module.f90 @@ -118,7 +118,8 @@ subroutine read_input i_job = 2 else if(leqi(job,'ban')) then i_job = 3 - if(flag_Multisite) call cq_abort("Not yet compatible with multi-site support functions") +!!! nakata 2025.02.03 comment out +! if(flag_Multisite) call cq_abort("Not yet compatible with multi-site support functions") else if(leqi(job,'ter').or.leqi(job,'th')) then i_job = 4 if(flag_Multisite) call cq_abort("Not yet compatible with multi-site support functions") From 051d8b7e121240f1b3c9669182c4910b2dfb4e7b Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Thu, 6 Feb 2025 22:48:12 +0900 Subject: [PATCH 16/45] Some bugs (ex. type of elpa_API) are removed. Some bugs are removed as well as "system.example.make" has been changed. --- src/ELPAModule.f90 | 14 ++++++++------ src/ELPAModuleDUMMY.f90 | 4 ++-- src/initial_read_module.f90 | 2 +- src/system/system.example.make | 10 ++++++++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/ELPAModule.f90 b/src/ELPAModule.f90 index 23f2231a9..2f4e15ef3 100644 --- a/src/ELPAModule.f90 +++ b/src/ELPAModule.f90 @@ -3,14 +3,15 @@ module ELPA_module use mpi !!$ use omp use elpa - use GenComms, ONLY: cq_abort, myid + use GenComms, ONLY: cq_abort, cq_warn, myid implicit none - logical :: use_elpa = .false. ! always true in this module + logical :: use_elpa = .false. ! whether we use ELPA or not character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 character(len=16) :: elpa_kernel = "GENERIC" - character(len=8) :: elpa_API = "20241105" + integer :: elpa_API = 20241105 integer :: merow, mecol + character(len=12) :: subname = "init_ELPA: " class(elpa_t), pointer :: elp @@ -42,17 +43,18 @@ subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) call blacs_gridinfo( context, numrows, numcols, merow, mecol ) if( mod(numcols,numrows) /= 0 ) then ! restriction for ELPA - call cq_abort("Diag.ProcRows is not a factor of Diag.ProcCols !",numrows,numcols) + call cq_warn(subname,"Diag.ProcRows is not a factor of Diag.ProcCols !",numrows,numcols) end if if( matrix_size <= block_size_r*numrows ) then ! restriction for ELPA - call cq_abort("Diag.BlockSizeR should be less than or equal to", (matrix_size-1)/proc_rows ) + call cq_abort("Diag.BlockSizeR should be less than or equal to", (matrix_size-1)/numrows ) end if if( matrix_size <= block_size_c*numcols ) then ! restriction for ELPA - call cq_abort("Diag.BlockSizeC should be less than or rqual to", (matrix_size-1)/proc_cols ) + call cq_abort("Diag.BlockSizeC should be less than or rqual to", (matrix_size-1)/numcols ) end if info = elpa_init(elpa_API) + !info = elpa_init(20181113) if( info /= ELPA_OK ) call cq_abort("ELPA_Init: ELPA API version not supported") elp => elpa_allocate(info) diff --git a/src/ELPAModuleDUMMY.f90 b/src/ELPAModuleDUMMY.f90 index 6a28af0be..723b421c4 100644 --- a/src/ELPAModuleDUMMY.f90 +++ b/src/ELPAModuleDUMMY.f90 @@ -4,10 +4,10 @@ module ELPA_module use GenComms, ONLY: cq_abort, myid implicit none - logical :: use_elpa = .false. ! always true in this module + logical :: use_elpa = .false. ! This should be false for ELPAModuleDummy character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 character(len=16) :: elpa_kernel = "GENERIC" - character(len=8) :: elpa_API = "20241105" + integer :: elpa_API = 20241105 integer :: merow, mecol private diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index f39bed499..5743d9832 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -3218,7 +3218,7 @@ subroutine readDiagInfo use_elpa = fdf_boolean('Diag.UseELPA',.false.) if( use_elpa ) then - elpa_API = fdf_string(8,'Diag.ELPA_API','20241105') + elpa_API = fdf_integer('Diag.ELPA_API',20181113) elpa_solver = fdf_string(16,'Diag.ELPASolver','ELPA1') select case( elpa_solver ) case ("ELPA1") diff --git a/src/system/system.example.make b/src/system/system.example.make index db63ddd04..b317edf83 100644 --- a/src/system/system.example.make +++ b/src/system/system.example.make @@ -42,11 +42,15 @@ XC_COMPFLAGS = -I/usr/local/include FFT_LIB=-lfftw3 FFT_OBJ=fft_fftw3.o -LIBS= $(FFT_LIB) $(XC_LIB) $(SCALAPACK) $(BLAS) +# Set ELPA library +ELPA_LIB = -L/home/app/FREESOFT/elpa/2019.11.001/lib -lelpa +ELPA_INC = -I/home/app/FREESOFT/elpa/2019.11.001/include/elpa-2019.11.001/modules + +LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) $(SCALAPACK) $(BLAS) # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -O3 $(OMPFLAGS) $(XC_COMPFLAGS) +COMPFLAGS= -O3 $(OMPFLAGS) $(XC_COMPFLAGS) $(ELPA_INC) # Linking flags LINKFLAGS= -L/usr/local/lib $(OMPFLAGS) @@ -55,3 +59,5 @@ LINKFLAGS= -L/usr/local/lib $(OMPFLAGS) MULT_KERN = default # Use dummy DiagModule or not DIAG_DUMMY = +# Use dummy ELPAModule or not +ELPA_DUMMY = From 075a65c0904e7bc8784a1a5ca8cccb91195c2955 Mon Sep 17 00:00:00 2001 From: ayakon Date: Fri, 7 Feb 2025 00:26:52 +0900 Subject: [PATCH 17/45] pDOS with MSSFs: introducing aSs_in_sSs_range etc. --- src/DiagModule.f90 | 26 +++++++++++++++++++------- src/dimens_module.f90 | 15 ++++++++++++++- src/matrix_data_module.f90 | 14 ++++++++++++-- src/mult_module.f90 | 38 +++++++++++++++++++++++++++++++++++--- 4 files changed, 80 insertions(+), 13 deletions(-) diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index ebfa45dce..94b1cae57 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -503,9 +503,9 @@ subroutine FindEvals(electrons) nkpoints_max, pgid, N_procs_in_pg, & N_kpoints_in_pg use mult_module, only: matH, matS, matK, matM12, SF_to_AtomF_transform, & - matrix_scale, matrix_product, matrix_product_trace, allocate_temp_matrix, free_temp_matrix, & !!! 2025.02.03 nakata + matrix_scale, matrix_product, matrix_product_trace, matrix_sum, allocate_temp_matrix, free_temp_matrix, & !!! 2025.02.03 nakata matSFcoeff_tran, mult, sCaTr_sSs_aSs !!! 2025.02.03 nakata - use matrix_data, only: Hrange, Srange, aHa_range, aSs_range !!! 2025.02.03 nakata + use matrix_data, only: Hrange, Srange, aHa_range, aSs_range, aSs_in_sSs_range !!! 2025.02.03 nakata use primary_module, only: bundle use species_module, only: species, nsf_species, natomf_species, species_label, n_species !!! 2025.02.03 nakata use memory_module, only: type_dbl, type_int, type_cplx, & @@ -538,7 +538,7 @@ subroutine FindEvals(electrons) kp, spin, spin_SF, iacc, iprim, l, band, cdft_group, atom_fns_K, & n_band_min, n_band_max integer :: iatom_spec, Nangmom ! number of orbital angular momentum to be dumped (ex. (s,p,d)=3) - integer :: matStmp !!! 2025.02.03 nakata + integer :: matStmp, matStmp0, matSFcoeffTran_tmp !!! 2025.02.03 nakata logical :: flag_keepexcite @@ -851,13 +851,21 @@ subroutine FindEvals(electrons) flag_pDOS_buildK = .true. if (atomf.ne.sf) then flag_WFatomf_buildK = .true. - matStmp = allocate_temp_matrix(aSs_range,0,atomf,sf) + matStmp0 = allocate_temp_matrix(aSs_range,0,atomf,sf) ! call matrix_product(matSatomf, matSFcoeff_tran(spin_SF), matStmp, mult(aSa_sCaTr_aSs)) - call matrix_product(matSFcoeff_tran(spin_SF), matS(spin_SF), matStmp, mult(sCaTr_sSs_aSs)) + call matrix_product(matSFcoeff_tran(spin_SF), matS(spin_SF), matStmp0, mult(sCaTr_sSs_aSs)) + ! change matSFcoeff_tran and matStmp from aSs_range to sSs_range + matStmp = allocate_temp_matrix(aSs_in_sSs_range,0,atomf,sf) + call matrix_sum(zero,matStmp,one,matStmp0) + matSFcoeffTran_tmp = allocate_temp_matrix(aSs_in_sSs_range,0,atomf,sf) + call matrix_sum(zero,matSFcoeffTran_tmp,one,matSFcoeff_tran(spin_SF)) call buildK(Hrange, matK(spin), occ(:,kp,spin), & kk(:,kp), wtk(kp), expH(:,:,spin), & scaledEig, matStmp, & - Eig_atomf=expH_atomf, matSFcoeffTran=matSFcoeff_tran(spin_SF)) + Eig_atomf=expH_atomf, matSFcoeffTran=matSFcoeffTran_tmp) + call free_temp_matrix(matSFcoeffTran_tmp) + call free_temp_matrix(matStmp) + call free_temp_matrix(matStmp0) flag_WFatomf_buildK = .false. else call buildK(Hrange, matK(spin), occ(:,kp,spin), & @@ -873,9 +881,13 @@ subroutine FindEvals(electrons) else if (atomf.ne.sf) then write(io_lun,*) "test0 before calling buildK for WFs" ! 2025.02.03 nakata flag_WFatomf_buildK = .true. + ! change matSFcoeff_tran from aSs_range to sSs_range + matSFcoeffTran_tmp = allocate_temp_matrix(aSs_in_sSs_range,0,atomf,sf) + call matrix_sum(zero,matSFcoeffTran_tmp,one,matSFcoeff_tran(spin_SF)) call buildK(Hrange, matK(spin), occ(:,kp,spin), & kk(:,kp), wtk(kp), expH(:,:,spin), & - Eig_atomf=expH_atomf, matSFcoeffTran=matSFcoeff_tran(spin_SF)) + Eig_atomf=expH_atomf, matSFcoeffTran=matSFcoeffTran_tmp) + call free_temp_matrix(matSFcoeffTran_tmp) flag_WFatomf_buildK = .false. write(io_lun,*) "test0 after calling buildK for WFs" ! 2025.02.03 nakata else diff --git a/src/dimens_module.f90 b/src/dimens_module.f90 index 467488d91..ad89da916 100644 --- a/src/dimens_module.f90 +++ b/src/dimens_module.f90 @@ -235,10 +235,19 @@ subroutine set_dimensions(inode, ionode,HNL_fac,non_local, n_species, non_local_ if(flag_neutral_atom_projector) then aNArange = 31 NAarange = 32 - mx_matrices_tmp = mx_matrices ! = 30 +!!! 2025.02.03 nakata +! mx_matrices_tmp = mx_matrices ! = 30 + mx_matrices_tmp = 32 +!!! 2025.02.03 nakata end else mx_matrices_tmp = 30 end if +!!! 2025.02.03 nakata + aSs_in_sSs_range = mx_matrices_tmp + 1 + sSa_in_sSs_range = mx_matrices_tmp + 2 + mx_matrices_tmp = mx_matrices_tmp + 2 + if (mx_matrices_tmp > mx_matrices) call cq_abort('ERROR : mx_matrices_tmp is larger than mx_matrices',mx_matrices_tmp) +!!! 2025.02.03 nakata end endif !n_my_grid_points = n_pts_in_block * n_blocks @@ -371,6 +380,8 @@ subroutine set_dimensions(inode, ionode,HNL_fac,non_local, n_species, non_local_ rcut(SFcoeffTr_range) = 0.001_double endif if (abs(r_LD)1) then do n=1,mx_matrices_tmp diff --git a/src/matrix_data_module.f90 b/src/matrix_data_module.f90 index aaa3f3507..a9a29e029 100644 --- a/src/matrix_data_module.f90 +++ b/src/matrix_data_module.f90 @@ -62,6 +62,8 @@ !! which are no longer used !! 2017/12/05 10:20 dave (with TM and NW (Mizuho)) !! Adding new matrix indices (aNA and NAa) for atom function - NA projectors +!! 2025/02/06 14:30 nakata +!! aSs_in_sSs_range, aSs_in_sSs_matind were added for pDOS with MSSFs !! SOURCE !! module matrix_data @@ -73,7 +75,10 @@ module matrix_data save ! This will need to change if the above parameters are changed - integer, parameter :: mx_matrices = 32 +!!! 2025.02.03 nakata +! integer, parameter :: mx_matrices = 32 + integer, parameter :: mx_matrices = 34 +!!! 2025.02.03 nakata end ! Store ALL indices in a large array type(matrix), allocatable, dimension(:,:), target :: mat @@ -86,7 +91,8 @@ module matrix_data SLSmatind, Tmatind, TTrmatind, TSmatind, THmatind, TLmatind, Xmatind, SXmatind integer, dimension(:), pointer :: aSa_matind, aHa_matind, STr_matind, HTr_matind, & aSs_matind, aHs_matind, sSa_matind, sHa_matind, & - SFcoeff_matind, SFcoeffTr_matind, LD_matind + SFcoeff_matind, SFcoeffTr_matind, LD_matind, & + aSs_in_sSs_matind, sSa_in_sSs_matind !!! 2025.02.03 nakata integer, dimension(:), pointer :: aNAmatind, NAamatind ! Parameters for the different matrix ranges @@ -126,6 +132,10 @@ module matrix_data ! Ranges for NA projectors set later also (dimens.module.f90) integer :: aNArange ! 31 integer :: NAarange ! 32 +!!! 2025.02.03 nakata + integer :: aSs_in_sSs_range ! 33 for S(atomf,sf) but with the range of Srange (= r_sf + r_sf, not r_atomf + r_sf) + integer :: sSa_in_sSs_range ! 34 for S(sf,atomf) but with the range of Srange (= r_sf + r_sf, not r_atomf + r_sf) +!!! 2025.02.03 nakata end integer :: max_range ! Indexes matrix with largest range diff --git a/src/mult_module.f90 b/src/mult_module.f90 index 784960228..e515b158a 100644 --- a/src/mult_module.f90 +++ b/src/mult_module.f90 @@ -100,6 +100,8 @@ !! Adding multiplications for NA projectors !! 2018/11/13 17:30 nakata !! Changed matS, matT, matTtran, matKE, matNL and matNA to be spin_SF dependent +!! 2025/02/06 14:00 nakata +!! Added aSs_in_sSs_trans, aSs_in_sSs_pairind, sSa_in_sSs_trans, sSa_in_sSs_pairind for pDOS with MSSFs !! SOURCE !! module mult_module @@ -176,15 +178,22 @@ module mult_module integer :: SFcoeff_trans ! 10 integer :: aNA_trans ! 11 integer :: aNAa_trans ! 12 + integer :: aSs_in_sSs_trans ! 13 ! 2025.02.04 nakata + integer :: sSa_in_sSs_trans ! 14 ! 2025.02.04 nakata - integer(integ), parameter :: mx_trans = 12 +!!! 2025.02.03 nakata +! integer(integ), parameter :: mx_trans = 12 + integer(integ), parameter :: mx_trans = 14 +!!! 2025.02.03 nakata end type(pair_data), allocatable, dimension(:,:) :: pairs integer, dimension(:), pointer :: Spairind, Lpairind, Tpairind, & APpairind, LSpairind, LHpairind, & LSLpairind, & aSs_pairind, aHs_pairind, SFcoeff_pairind, & - aNApairind, aNAapairind + aNApairind, aNAapairind, & + aSs_in_sSs_pairind , & !!! 2025.02.03 nakata + sSa_in_sSs_pairind !!! 2025.02.03 nakata type(matrix_trans), dimension(mx_matrices), target :: ltrans type(trans_remote) :: gtrans(mx_trans) @@ -354,6 +363,8 @@ subroutine immi(parts, prim, gcs, myid, partial) SFcoeff_trans = 10 aNA_trans = 11 aNAa_trans = 12 + aSs_in_sSs_trans = 13 !!! 2025.02.03 nakata + sSa_in_sSs_trans = 14 !!! 2025.02.03 nakata else aNA_NAa_aHa = 23 aHa_aNA_aNA = 24 @@ -478,6 +489,18 @@ subroutine immi(parts, prim, gcs, myid, partial) call matrix_ini(parts, prim, gcs, mat(1:prim%groups_on_node,SFcoeffTr_range), & SFcoeffTr_matind, rcut(SFcoeffTr_range), myid-1, & halo(SFcoeffTr_range), ltrans(SFcoeffTr_range)) +!!! 2025.02.03 nakata + mat(1:prim%groups_on_node,aSs_in_sSs_range)%sf1_type = atomf + mat(1:prim%groups_on_node,aSs_in_sSs_range)%sf2_type = sf + call matrix_ini(parts, prim, gcs, mat(1:prim%groups_on_node,aSs_in_sSs_range), & + aSs_in_sSs_matind, rcut(aSs_in_sSs_range), myid-1, & + halo(aSs_in_sSs_range), ltrans(aSs_in_sSs_range)) + mat(1:prim%groups_on_node,sSa_in_sSs_range)%sf1_type = sf + mat(1:prim%groups_on_node,sSa_in_sSs_range)%sf2_type = atomf + call matrix_ini(parts, prim, gcs, mat(1:prim%groups_on_node,sSa_in_sSs_range), & + sSa_in_sSs_matind, rcut(sSa_in_sSs_range), myid-1, & + halo(sSa_in_sSs_range), ltrans(sSa_in_sSs_range)) +!!! if (flag_LFD) then mat(1:prim%groups_on_node,LD_range)%sf1_type = atomf mat(1:prim%groups_on_node,LD_range)%sf2_type = atomf @@ -551,6 +574,14 @@ subroutine immi(parts, prim, gcs, myid, partial) myid-1, halo(aHa_range), halo(aHa_range), ltrans(aHa_range), & gtrans(aNAa_trans), pairs(:,aNAa_trans), aNAapairind) end if +!!! 2025.02.03 nakata + call trans_ini(parts, prim, gcs, mat(1:prim%groups_on_node,aSs_in_sSs_range), & + myid-1, halo(aSs_in_sSs_range), halo(sSa_in_sSs_range), ltrans(aSs_in_sSs_range), & + gtrans(aSs_in_sSs_trans), pairs(:, aSs_in_sSs_trans), aSs_in_sSs_pairind) + call trans_ini(parts, prim, gcs, mat(1:prim%groups_on_node,sSa_in_sSs_range), & + myid-1, halo(sSa_in_sSs_range), halo(aSs_in_sSs_range), ltrans(sSa_in_sSs_range), & + gtrans(sSa_in_sSs_trans), pairs(:, sSa_in_sSs_trans), sSa_in_sSs_pairind) +!!! 2025.02.03 nakata end ! NA projectors else if(flag_neutral_atom_projector) then call trans_ini(parts, prim, gcs, mat(1:prim%groups_on_node,aNArange), & @@ -1359,7 +1390,7 @@ subroutine fmmi(prim) deallocate(pairs) deallocate(Spairind, Lpairind, APpairind, LSpairind, LHpairind, & LSLpairind, Tpairind) - if (atomf.ne.sf) deallocate(aSs_pairind, aHs_pairind, SFcoeff_pairind) + if (atomf.ne.sf) deallocate(aSs_pairind, aHs_pairind, SFcoeff_pairind, aSs_in_sSs_pairind) if(flag_neutral_atom_projector) then deallocate(aNApairind) if(atomf.ne.sf) deallocate(aNAapairind) @@ -1397,6 +1428,7 @@ subroutine fmmi(prim) call end_ops(prim,SFcoeff_range,SFcoeff_matind,SFcoeff_trans) call end_ops(prim,SFcoeffTr_range,SFcoeffTr_matind) if (flag_LFD) call end_ops(prim,LD_range,LD_matind) + call end_ops(prim,aSs_in_sSs_range,aSs_in_sSs_matind,aSs_in_sSs_trans) endif if( flag_neutral_atom_projector ) then call end_ops(prim,aNArange, aNAmatind,aNA_trans) From 24fa73134c20ade7448f3b762072a198b199a433 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Fri, 7 Feb 2025 00:42:20 +0900 Subject: [PATCH 18/45] system.*.make have been updated for ELPA --- src/system/system.archer2.make | 12 ++++++++++-- src/system/system.cosma.make | 13 ++++++++++--- src/system/system.example.make | 8 +++++--- src/system/system.gha.make | 11 +++++++++-- src/system/system.kathleen.make | 14 ++++++++++++-- src/system/system.mac.make | 13 +++++++++++-- src/system/system.myriad.make | 12 ++++++++++-- src/system/system.ubuntu.make | 15 ++++++++++++--- src/system/system.young.make | 12 ++++++++++-- 9 files changed, 89 insertions(+), 21 deletions(-) diff --git a/src/system/system.archer2.make b/src/system/system.archer2.make index e7bfd6fdd..65446e687 100644 --- a/src/system/system.archer2.make +++ b/src/system/system.archer2.make @@ -41,11 +41,17 @@ XC_COMPFLAGS = FFT_LIB=-L$(FFTW_ROOT)/lib -lfftw3 FFT_OBJ=fft_fftw3.o -LIBS= $(FFT_LIB) $(XC_LIB) $(BLAS) +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = + +LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) $(BLAS) # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -O3 -fallow-argument-mismatch -fopenmp $(XC_COMPFLAGS) +COMPFLAGS= -O3 -fallow-argument-mismatch -fopenmp $(XC_COMPFLAGS) $(ELPA_INC) # Linking flags LINKFLAGS= -fopenmp -L$(LIBSCI_BASE_DIR)/gnu/9.1/x86_64/lib -lsci_gnu_mpi -lsci_gnu @@ -55,3 +61,5 @@ LINKFLAGS= -fopenmp -L$(LIBSCI_BASE_DIR)/gnu/9.1/x86_64/lib -lsci_gnu_mpi -lsci MULT_KERN = ompGemm_m # Use dummy DiagModule or not DIAG_DUMMY = +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY diff --git a/src/system/system.cosma.make b/src/system/system.cosma.make index 965007117..847264e4a 100644 --- a/src/system/system.cosma.make +++ b/src/system/system.cosma.make @@ -15,7 +15,7 @@ ARFLAGS= # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -g -fopenmp -O3 $(XC_COMPFLAGS) -I${MKLROOT}/include/intel64/lp64 -I"${MKLROOT}/include" -fno-omit-frame-pointer -xHost +COMPFLAGS= -g -fopenmp -O3 $(XC_COMPFLAGS) $(ELPA_INC) -I${MKLROOT}/include/intel64/lp64 -I"${MKLROOT}/include" -fno-omit-frame-pointer -xHost COMPFLAGS_F77= $(COMPFLAGS) # LibXC compatibility (LibXC below) or Conquest XC library @@ -29,12 +29,19 @@ XC_COMPFLAGS = FFT_LIB=-lmkl_rt FFT_OBJ=fft_fftw3.o +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = + # Full library call; remove scalapack if using dummy diag module -LIBS= $(FFT_LIB) $(XC_LIB) +LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) # Matrix multiplication kernel type MULT_KERN = default # Use dummy DiagModule or not DIAG_DUMMY = - +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY diff --git a/src/system/system.example.make b/src/system/system.example.make index b317edf83..5dc76b5dc 100644 --- a/src/system/system.example.make +++ b/src/system/system.example.make @@ -43,8 +43,10 @@ FFT_LIB=-lfftw3 FFT_OBJ=fft_fftw3.o # Set ELPA library -ELPA_LIB = -L/home/app/FREESOFT/elpa/2019.11.001/lib -lelpa -ELPA_INC = -I/home/app/FREESOFT/elpa/2019.11.001/include/elpa-2019.11.001/modules +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) $(SCALAPACK) $(BLAS) @@ -60,4 +62,4 @@ MULT_KERN = default # Use dummy DiagModule or not DIAG_DUMMY = # Use dummy ELPAModule or not -ELPA_DUMMY = +ELPA_DUMMY =DUMMY diff --git a/src/system/system.gha.make b/src/system/system.gha.make index fd44bb17f..523187d7e 100644 --- a/src/system/system.gha.make +++ b/src/system/system.gha.make @@ -12,10 +12,17 @@ XC_COMPFLAGS = -I/usr/include # Set FFT library FFT_LIB=-lfftw3 FFT_OBJ=fft_fftw3.o +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = # Use dummy DiagModule or not DIAG_DUMMY = +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY # Full library call; remove scalapack if using dummy diag module -LIBS= $(XC_LIB) -lscalapack-openmpi $(BLAS) $(FFT_LIB) +LIBS= $(ELPA_LIB) $(XC_LIB) -lscalapack-openmpi $(BLAS) $(FFT_LIB) # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -O3 -fopenmp $(XC_COMPFLAGS) -fallow-argument-mismatch +COMPFLAGS= -O3 -fopenmp $(XC_COMPFLAGS) $(ELPA_INC) -fallow-argument-mismatch diff --git a/src/system/system.kathleen.make b/src/system/system.kathleen.make index 97fdffcf1..c863740b2 100644 --- a/src/system/system.kathleen.make +++ b/src/system/system.kathleen.make @@ -38,14 +38,20 @@ XC_COMPFLAGS = -I/usr/local/include FFT_LIB=-lmkl_rt FFT_OBJ=fft_fftw3.o +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = + # Full library call; remove scalapack if using dummy diag module # If using OpenMPI, use -lscalapack-openmpi instead. #LIBS= $(FFT_LIB) $(XC_LIB) -lscalapack $(BLAS) -LIBS= $(FFT_LIB) $(XC_LIB) +LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -xAVX -O3 -g $(OMPFLAGS) $(XC_COMPFLAGS) -I"${MKLROOT}/include" +COMPFLAGS= -xAVX -O3 -g $(OMPFLAGS) $(XC_COMPFLAGS) $(ELPA_INC) -I"${MKLROOT}/include" # Linking flags LINKFLAGS= -L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_cdft_core -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -liomp5 -lpthread -ldl $(OMPFLAGS) $(XC_LIB) @@ -54,3 +60,7 @@ LINKFLAGS= -L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_cdft_core -lmkl_i MULT_KERN = ompGemm # Use dummy DiagModule or not DIAG_DUMMY = + +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY + diff --git a/src/system/system.mac.make b/src/system/system.mac.make index 99a0e1434..915e72c35 100644 --- a/src/system/system.mac.make +++ b/src/system/system.mac.make @@ -41,11 +41,17 @@ XC_COMPFLAGS = -I/opt/homebrew/Cellar/libxc/6.2.2/include FFT_LIB=-lfftw3 FFT_OBJ=fft_fftw3.o -LIBS= $(FFT_LIB) $(XC_LIB) $(SCALAPACK) $(BLAS) +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = + +LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) $(SCALAPACK) $(BLAS) # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -fallow-argument-mismatch -O3 $(OMPFLAGS) $(XC_COMPFLAGS) -I/opt/homebrew/Cellar/openblas/0.3.27/include -I/opt/homebrew/Cellar/lapack/3.12.0/include -I/opt/homebrew/Cellar/fftw/3.3.10_1/include +COMPFLAGS= -fallow-argument-mismatch -O3 $(OMPFLAGS) $(XC_COMPFLAGS) $(ELPA_INC) -I/opt/homebrew/Cellar/openblas/0.3.27/include -I/opt/homebrew/Cellar/lapack/3.12.0/include -I/opt/homebrew/Cellar/fftw/3.3.10_1/include # Linking flags LINKFLAGS= $(OMPFLAGS) -L/opt/homebrew/Cellar/openblas/0.3.27/lib -L/opt/homebrew/Cellar/lapack/3.12.0/lib -L/opt/homebrew/Cellar/fftw/3.3.10_1/lib -L/opt/homebrew/Cellar/libxc/6.2.2/lib -L/opt/homebrew/Cellar/scalapack/2.2.0_1/lib @@ -54,3 +60,6 @@ LINKFLAGS= $(OMPFLAGS) -L/opt/homebrew/Cellar/openblas/0.3.27/lib -L/opt/homebre MULT_KERN = default # Use dummy DiagModule or not DIAG_DUMMY = +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY + diff --git a/src/system/system.myriad.make b/src/system/system.myriad.make index 74ddec687..73441f34e 100644 --- a/src/system/system.myriad.make +++ b/src/system/system.myriad.make @@ -36,17 +36,23 @@ XC_COMPFLAGS = -I/usr/local/include # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -O3 -g $(OMPFLAGS) $(XC_COMPFLAGS) -I"${MKLROOT}/include" +COMPFLAGS= -O3 -g $(OMPFLAGS) $(XC_COMPFLAGS) $(ELPA_INC) -I"${MKLROOT}/include" COMPFLAGS_F77= $(COMPFLAGS) # Set FFT library FFT_LIB=-lmkl_rt FFT_OBJ=fft_fftw3.o +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = + # Full library call; remove scalapack if using dummy diag module # If using OpenMPI, use -lscalapack-openmpi instead. #LIBS= $(FFT_LIB) $(XC_LIB) -lscalapack $(BLAS) -LIBS= $(FFT_LIB) $(XC_LIB) +LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) # Linking flags LINKFLAGS= -L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_cdft_core -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -liomp5 -lpthread -ldl $(OMPFLAGS) $(XC_LIB) @@ -60,4 +66,6 @@ DIAG_DUMMY = # Set this to "OMP_DUMMY = DUMMY" if compiling without openmp # Set this to "OMP_DUMMY = " if compiling with openmp OMP_DUMMY = +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY diff --git a/src/system/system.ubuntu.make b/src/system/system.ubuntu.make index 2fa3db924..ca71a5e86 100644 --- a/src/system/system.ubuntu.make +++ b/src/system/system.ubuntu.make @@ -32,11 +32,17 @@ XC_COMPFLAGS = -I${HOME}/local/include -I/usr/local/include FFT_LIB=-lfftw3 FFT_OBJ=fft_fftw3.o -LIBS= $(FFT_LIB) $(XC_LIB) $(SCALAPACK) $(BLAS) +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = + +LIBS= $(FFT_LIB) $(ELPA_LIB) $(XC_LIB) $(SCALAPACK) $(BLAS) # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -O3 $(OMPFLAGS) $(XC_COMPFLAGS) -fallow-argument-mismatch +COMPFLAGS= -O3 $(OMPFLAGS) $(XC_COMPFLAGS) $(ELPA_INC) -fallow-argument-mismatch # Linking flags LINKFLAGS= -L${HOME}/local/lib -L/usr/local/lib $(OMPFLAGS) @@ -44,4 +50,7 @@ LINKFLAGS= -L${HOME}/local/lib -L/usr/local/lib $(OMPFLAGS) # Matrix multiplication kernel type MULT_KERN = default # Use dummy DiagModule or not -DIAG_DUMMY = \ No newline at end of file +DIAG_DUMMY = +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY + diff --git a/src/system/system.young.make b/src/system/system.young.make index 01032276e..d210bb5b9 100644 --- a/src/system/system.young.make +++ b/src/system/system.young.make @@ -22,18 +22,26 @@ XC_COMPFLAGS = -I/shared/ucl/apps/libxc/4.2.3/intel-2018/include FFT_LIB=-lmkl_rt FFT_OBJ=fft_fftw3.o +# Set ELPA library +#ELPA_LIB = -L/**/lib -lelpa +#ELPA_INC = -I/**/modules/ +ELPA_LIB = +ELPA_INC = + # Linking flags LINKFLAGS= -L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_cdft_core -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -liomp5 -lpthread -ldl $(OMPFLAGS) $(XC_LIB) # Compilation flags # NB for gcc10 you need to add -fallow-argument-mismatch -COMPFLAGS= -g -O2 $(OMPFLAGS) $(XC_COMPFLAGS) -I"${MKLROOT}/include" +COMPFLAGS= -g -O2 $(OMPFLAGS) $(XC_COMPFLAGS) $(ELPA_INC) -I"${MKLROOT}/include" # Matrix multiplication kernel type MULT_KERN = ompGemm_m # Use dummy DiagModule or not DIAG_DUMMY = +# Use dummy ELPAModule or not +ELPA_DUMMY =DUMMY # Full library call; remove scalapack if using dummy diag module -LIBS= $(FFT_LIB) $(XC_LIB) +LIBS= $(FFT_LIB) $(ELBA_LIB) $(XC_LIB) From d961c169c2c0b6ecd95304a01f56c77a381cb1fe Mon Sep 17 00:00:00 2001 From: David Bowler Date: Thu, 6 Feb 2025 15:57:20 +0000 Subject: [PATCH 19/45] Tidy up unnecessary variables --- src/dimens_module.f90 | 7 ++----- src/matrix_data_module.f90 | 3 +-- src/mult_module.f90 | 25 +++---------------------- 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/dimens_module.f90 b/src/dimens_module.f90 index ad89da916..a296ea04a 100644 --- a/src/dimens_module.f90 +++ b/src/dimens_module.f90 @@ -244,8 +244,7 @@ subroutine set_dimensions(inode, ionode,HNL_fac,non_local, n_species, non_local_ end if !!! 2025.02.03 nakata aSs_in_sSs_range = mx_matrices_tmp + 1 - sSa_in_sSs_range = mx_matrices_tmp + 2 - mx_matrices_tmp = mx_matrices_tmp + 2 + mx_matrices_tmp = mx_matrices_tmp + 1 if (mx_matrices_tmp > mx_matrices) call cq_abort('ERROR : mx_matrices_tmp is larger than mx_matrices',mx_matrices_tmp) !!! 2025.02.03 nakata end endif @@ -380,8 +379,7 @@ subroutine set_dimensions(inode, ionode,HNL_fac,non_local, n_species, non_local_ rcut(SFcoeffTr_range) = 0.001_double endif if (abs(r_LD)1) then do n=1,mx_matrices_tmp diff --git a/src/matrix_data_module.f90 b/src/matrix_data_module.f90 index a9a29e029..ec9b67665 100644 --- a/src/matrix_data_module.f90 +++ b/src/matrix_data_module.f90 @@ -92,7 +92,7 @@ module matrix_data integer, dimension(:), pointer :: aSa_matind, aHa_matind, STr_matind, HTr_matind, & aSs_matind, aHs_matind, sSa_matind, sHa_matind, & SFcoeff_matind, SFcoeffTr_matind, LD_matind, & - aSs_in_sSs_matind, sSa_in_sSs_matind !!! 2025.02.03 nakata + aSs_in_sSs_matind !!! 2025.02.03 nakata integer, dimension(:), pointer :: aNAmatind, NAamatind ! Parameters for the different matrix ranges @@ -134,7 +134,6 @@ module matrix_data integer :: NAarange ! 32 !!! 2025.02.03 nakata integer :: aSs_in_sSs_range ! 33 for S(atomf,sf) but with the range of Srange (= r_sf + r_sf, not r_atomf + r_sf) - integer :: sSa_in_sSs_range ! 34 for S(sf,atomf) but with the range of Srange (= r_sf + r_sf, not r_atomf + r_sf) !!! 2025.02.03 nakata end integer :: max_range ! Indexes matrix with largest range diff --git a/src/mult_module.f90 b/src/mult_module.f90 index e515b158a..335174561 100644 --- a/src/mult_module.f90 +++ b/src/mult_module.f90 @@ -178,8 +178,6 @@ module mult_module integer :: SFcoeff_trans ! 10 integer :: aNA_trans ! 11 integer :: aNAa_trans ! 12 - integer :: aSs_in_sSs_trans ! 13 ! 2025.02.04 nakata - integer :: sSa_in_sSs_trans ! 14 ! 2025.02.04 nakata !!! 2025.02.03 nakata ! integer(integ), parameter :: mx_trans = 12 @@ -191,9 +189,7 @@ module mult_module APpairind, LSpairind, LHpairind, & LSLpairind, & aSs_pairind, aHs_pairind, SFcoeff_pairind, & - aNApairind, aNAapairind, & - aSs_in_sSs_pairind , & !!! 2025.02.03 nakata - sSa_in_sSs_pairind !!! 2025.02.03 nakata + aNApairind, aNAapairind type(matrix_trans), dimension(mx_matrices), target :: ltrans type(trans_remote) :: gtrans(mx_trans) @@ -363,8 +359,6 @@ subroutine immi(parts, prim, gcs, myid, partial) SFcoeff_trans = 10 aNA_trans = 11 aNAa_trans = 12 - aSs_in_sSs_trans = 13 !!! 2025.02.03 nakata - sSa_in_sSs_trans = 14 !!! 2025.02.03 nakata else aNA_NAa_aHa = 23 aHa_aNA_aNA = 24 @@ -495,11 +489,6 @@ subroutine immi(parts, prim, gcs, myid, partial) call matrix_ini(parts, prim, gcs, mat(1:prim%groups_on_node,aSs_in_sSs_range), & aSs_in_sSs_matind, rcut(aSs_in_sSs_range), myid-1, & halo(aSs_in_sSs_range), ltrans(aSs_in_sSs_range)) - mat(1:prim%groups_on_node,sSa_in_sSs_range)%sf1_type = sf - mat(1:prim%groups_on_node,sSa_in_sSs_range)%sf2_type = atomf - call matrix_ini(parts, prim, gcs, mat(1:prim%groups_on_node,sSa_in_sSs_range), & - sSa_in_sSs_matind, rcut(sSa_in_sSs_range), myid-1, & - halo(sSa_in_sSs_range), ltrans(sSa_in_sSs_range)) !!! if (flag_LFD) then mat(1:prim%groups_on_node,LD_range)%sf1_type = atomf @@ -574,14 +563,6 @@ subroutine immi(parts, prim, gcs, myid, partial) myid-1, halo(aHa_range), halo(aHa_range), ltrans(aHa_range), & gtrans(aNAa_trans), pairs(:,aNAa_trans), aNAapairind) end if -!!! 2025.02.03 nakata - call trans_ini(parts, prim, gcs, mat(1:prim%groups_on_node,aSs_in_sSs_range), & - myid-1, halo(aSs_in_sSs_range), halo(sSa_in_sSs_range), ltrans(aSs_in_sSs_range), & - gtrans(aSs_in_sSs_trans), pairs(:, aSs_in_sSs_trans), aSs_in_sSs_pairind) - call trans_ini(parts, prim, gcs, mat(1:prim%groups_on_node,sSa_in_sSs_range), & - myid-1, halo(sSa_in_sSs_range), halo(aSs_in_sSs_range), ltrans(sSa_in_sSs_range), & - gtrans(sSa_in_sSs_trans), pairs(:, sSa_in_sSs_trans), sSa_in_sSs_pairind) -!!! 2025.02.03 nakata end ! NA projectors else if(flag_neutral_atom_projector) then call trans_ini(parts, prim, gcs, mat(1:prim%groups_on_node,aNArange), & @@ -1390,7 +1371,7 @@ subroutine fmmi(prim) deallocate(pairs) deallocate(Spairind, Lpairind, APpairind, LSpairind, LHpairind, & LSLpairind, Tpairind) - if (atomf.ne.sf) deallocate(aSs_pairind, aHs_pairind, SFcoeff_pairind, aSs_in_sSs_pairind) + if (atomf.ne.sf) deallocate(aSs_pairind, aHs_pairind, SFcoeff_pairind) if(flag_neutral_atom_projector) then deallocate(aNApairind) if(atomf.ne.sf) deallocate(aNAapairind) @@ -1428,7 +1409,7 @@ subroutine fmmi(prim) call end_ops(prim,SFcoeff_range,SFcoeff_matind,SFcoeff_trans) call end_ops(prim,SFcoeffTr_range,SFcoeffTr_matind) if (flag_LFD) call end_ops(prim,LD_range,LD_matind) - call end_ops(prim,aSs_in_sSs_range,aSs_in_sSs_matind,aSs_in_sSs_trans) + call end_ops(prim,aSs_in_sSs_range,aSs_in_sSs_matind) endif if( flag_neutral_atom_projector ) then call end_ops(prim,aNArange, aNAmatind,aNA_trans) From 8fa1eebb8ba51a431087ce72fda393f3f00a7181 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Fri, 7 Feb 2025 09:43:33 +0000 Subject: [PATCH 20/45] Tidying code Changed select to if, added ELPA dummy flag and tidied indentation --- src/DiagModule.f90 | 29 ++-- src/ELPAModule.f90 | 276 ++++++++++++++++++------------------ src/ELPAModuleDUMMY.f90 | 91 ++++++------ src/initial_read_module.f90 | 40 +++--- 4 files changed, 220 insertions(+), 216 deletions(-) diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index 61913ae1e..f3863226b 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -517,7 +517,7 @@ subroutine FindEvals(electrons) use density_module, ONLY: get_band_density use io_module, ONLY: write_eigenvalues, write_eigenvalues_format_ase use pao_format, ONLY: pao - use ELPA_module, ONLY: use_elpa,init_ELPA, end_ELPA + use ELPA_module, ONLY: flag_use_elpa, init_ELPA, end_ELPA implicit none @@ -552,8 +552,8 @@ subroutine FindEvals(electrons) ! Initialise - start BLACS, sort out matrices, allocate memory call initDiag - if(use_elpa) then - call init_ELPA(matrix_size_padH, row_size, col_size, desca, info ) + if(flag_use_elpa) then + call init_ELPA(matrix_size_padH, row_size, col_size, desca, info ) endif scale = one / real(N_procs_in_pg(pgid), double) @@ -975,7 +975,7 @@ subroutine FindEvals(electrons) end if ! global call endDiag - if(use_elpa) call end_ELPA(info) + if(flag_use_elpa) call end_ELPA(info) min_layer = min_layer + 1 return @@ -1056,7 +1056,6 @@ subroutine initDiag use GenComms, only: my_barrier, cq_abort, myid use memory_module, only: type_dbl, type_int, type_cplx, & reg_alloc_mem, reg_dealloc_mem - use ELPA_module, only: end_ELPA implicit none @@ -4239,7 +4238,7 @@ subroutine distrib_and_diag(spin,index_kpoint,mode,flag_store_w,kpassed) block_size_r, block_size_c, blocks_r, blocks_c, procid, pgroup,& nkpoints_max, pgid, N_kpoints_in_pg, pg_kpoints, N_procs_in_pg, proc_groups use GenComms, only: cq_warn - use ELPA_module, only: use_elpa,ELPA_zhegv + use ELPA_module, only: flag_use_elpa, ELPA_zhegv implicit none @@ -4306,16 +4305,16 @@ subroutine distrib_and_diag(spin,index_kpoint,mode,flag_store_w,kpassed) ! Call the diagonalisation routine for generalised problem ! H.psi = E.S.psi - if( use_elpa ) then - call ELPA_zhegv(mode, matrix_size_padH, row_size, col_size, & - SCHmat(:,:,spin), SCSmat(:,:,spin), local_evals(:,spin), z(:,:,spin), info ) + if( flag_use_elpa ) then + call ELPA_zhegv(mode, matrix_size_padH, row_size, col_size, & + SCHmat(:,:,spin), SCSmat(:,:,spin), local_evals(:,spin), z(:,:,spin), info ) else - call pzhegvx(1, mode, 'A', 'U', matrix_size_padH, SCHmat(:,:,spin), & - 1, 1, desca, SCSmat(:,:,spin), 1, 1, descb, & - vl, vu, il, iu, abstol, m, mz, local_evals(:,spin), & - orfac, z(:,:,spin), 1, 1, descz, work, lwork, & - rwork, lrwork, iwork, liwork, ifail, iclustr, & - gap, info) + call pzhegvx(1, mode, 'A', 'U', matrix_size_padH, SCHmat(:,:,spin), & + 1, 1, desca, SCSmat(:,:,spin), 1, 1, descb, & + vl, vu, il, iu, abstol, m, mz, local_evals(:,spin), & + orfac, z(:,:,spin), 1, 1, descz, work, lwork, & + rwork, lrwork, iwork, liwork, ifail, iclustr, & + gap, info) endif if (info /= 0) then diff --git a/src/ELPAModule.f90 b/src/ELPAModule.f90 index 2f4e15ef3..f500eda1a 100644 --- a/src/ELPAModule.f90 +++ b/src/ELPAModule.f90 @@ -1,155 +1,161 @@ module ELPA_module - use datatypes - use mpi + + use datatypes + use mpi !!$ use omp - use elpa - use GenComms, ONLY: cq_abort, cq_warn, myid - implicit none + use elpa + use GenComms, ONLY: cq_abort, cq_warn, myid + + implicit none - logical :: use_elpa = .false. ! whether we use ELPA or not - character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 - character(len=16) :: elpa_kernel = "GENERIC" - integer :: elpa_API = 20241105 - integer :: merow, mecol - character(len=12) :: subname = "init_ELPA: " + logical :: flag_elpa_dummy = .false. ! A marker to show ELPA in compilation + logical :: flag_use_elpa = .false. ! whether we use ELPA or not + character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 + character(len=16) :: elpa_kernel = "GENERIC" + integer :: elpa_API = 20241105 + integer :: merow, mecol - class(elpa_t), pointer :: elp + class(elpa_t), pointer :: elp - private - public :: use_elpa, elpa_solver, elpa_kernel, elpa_API - public :: init_ELPA, end_ELPA, ELPA_zhegv + private + public :: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy + public :: init_ELPA, end_ELPA, ELPA_zhegv contains - subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) - implicit none - integer, intent(in) :: matrix_size, row_size, col_size - integer, intent(in) :: desc(9) - integer, intent(out) :: info + subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) + + implicit none - integer :: context, block_size_r, block_size_c - integer :: numrows, numcols, merow, mecol ! numrows= proc_rows, numcols=proc_cols + integer, intent(in) :: matrix_size, row_size, col_size + integer, intent(in) :: desc(9) + integer, intent(out) :: info - context = desc(2) - block_size_r = desc(5) - block_size_c = desc(6) + integer :: context, block_size_r, block_size_c + integer :: numrows, numcols, merow, mecol ! numrows= proc_rows, numcols=proc_cols + character(len=12) :: subname = "init_ELPA: " - if( block_size_r /= block_size_c ) then ! restriction for ELPA - call cq_abort("Diag.BlockSizeR and Diag.BlockSizeC not same !", & + context = desc(2) + block_size_r = desc(5) + block_size_c = desc(6) + + if( block_size_r /= block_size_c ) then ! restriction for ELPA + call cq_abort("Diag.BlockSizeR and Diag.BlockSizeC not same !", & block_size_r, block_size_c ) - end if - - !To get the information of blacs grid - call blacs_gridinfo( context, numrows, numcols, merow, mecol ) - - if( mod(numcols,numrows) /= 0 ) then ! restriction for ELPA - call cq_warn(subname,"Diag.ProcRows is not a factor of Diag.ProcCols !",numrows,numcols) - end if - - if( matrix_size <= block_size_r*numrows ) then ! restriction for ELPA - call cq_abort("Diag.BlockSizeR should be less than or equal to", (matrix_size-1)/numrows ) - end if - if( matrix_size <= block_size_c*numcols ) then ! restriction for ELPA - call cq_abort("Diag.BlockSizeC should be less than or rqual to", (matrix_size-1)/numcols ) - end if - - info = elpa_init(elpa_API) - !info = elpa_init(20181113) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: ELPA API version not supported") - - elp => elpa_allocate(info) - - call elp%set( "na", matrix_size, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter na") - call elp%set( "nev", matrix_size, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter nev") - call elp%set( "local_nrows", row_size, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter local_nrows") - call elp%set( "local_ncols", col_size, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter local_ncols") - call elp%set( "nblk", block_size_r, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter nblk") - call elp%set( "mpi_comm_parent", MPI_COMM_WORLD, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter mpi_comm_parent") - call elp%set( "process_row", merow, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter process_row") - call elp%set( "process_col", mecol, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter process_col") - call elp%set( "blacs_context", context, info ) - if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter blacs_cotext") - - select case( elpa_solver ) - case("ELPA1") - call elp%set( "solver", ELPA_SOLVER_1STAGE, info ) ! ELPA1 - case("ELPA2") - call elp%set( "solver", ELPA_SOLVER_2STAGE, info ) ! ELPA2 - - select case( elpa_kernel ) - case("GENERIC") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC, info ) - case("GENERIC_SIMPLE") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC_SIMPLE, info ) - case("SSE_ASSEMBLY") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_ASSEMBLY, info ) - case("SSE_BLOCK1") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_BLOCK1, info ) - case("SSE_BLOCK2") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_BLOCK2, info ) - case("AVX_BLOCK1") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX_BLOCK1, info ) - case("AVX_BLOCK2") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX_BLOCK2, info ) - case("AVX2_BLOCK1") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX2_BLOCK1, info ) - case("AVX2_BLOCK2") - call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX2_BLOCK2, info ) - case default - call cq_abort("Invalid Diag.ELPA2Kernal " // trim(elpa_kernel) ) - end select - case default - call cq_abort("Invalid Diag.ELPASolver " // trim(elpa_solver) ) - end select + end if + + !To get the information of blacs grid + call blacs_gridinfo( context, numrows, numcols, merow, mecol ) + + if( mod(numcols,numrows) /= 0 ) then ! restriction for ELPA + call cq_warn(subname,"Diag.ProcRows is not a factor of Diag.ProcCols !",numrows,numcols) + end if + + if( matrix_size <= block_size_r*numrows ) then ! restriction for ELPA + call cq_abort("Diag.BlockSizeR should be less than or equal to", (matrix_size-1)/numrows ) + end if + if( matrix_size <= block_size_c*numcols ) then ! restriction for ELPA + call cq_abort("Diag.BlockSizeC should be less than or rqual to", (matrix_size-1)/numcols ) + end if + + info = elpa_init(elpa_API) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: ELPA API version not supported") + + elp => elpa_allocate(info) + + call elp%set( "na", matrix_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter na") + call elp%set( "nev", matrix_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter nev") + call elp%set( "local_nrows", row_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter local_nrows") + call elp%set( "local_ncols", col_size, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter local_ncols") + call elp%set( "nblk", block_size_r, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter nblk") + call elp%set( "mpi_comm_parent", MPI_COMM_WORLD, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter mpi_comm_parent") + call elp%set( "process_row", merow, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter process_row") + call elp%set( "process_col", mecol, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter process_col") + call elp%set( "blacs_context", context, info ) + if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter blacs_cotext") + + select case( elpa_solver ) + case("ELPA1") + call elp%set( "solver", ELPA_SOLVER_1STAGE, info ) ! ELPA1 + case("ELPA2") + call elp%set( "solver", ELPA_SOLVER_2STAGE, info ) ! ELPA2 + + select case( elpa_kernel ) + case("GENERIC") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC, info ) + case("GENERIC_SIMPLE") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC_SIMPLE, info ) + case("SSE_ASSEMBLY") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_ASSEMBLY, info ) + case("SSE_BLOCK1") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_BLOCK1, info ) + case("SSE_BLOCK2") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_SSE_BLOCK2, info ) + case("AVX_BLOCK1") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX_BLOCK1, info ) + case("AVX_BLOCK2") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX_BLOCK2, info ) + case("AVX2_BLOCK1") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX2_BLOCK1, info ) + case("AVX2_BLOCK2") + call elp%set( "complex_kernel", ELPA_2STAGE_COMPLEX_AVX2_BLOCK2, info ) + case default + call cq_abort("Invalid Diag.ELPA2Kernal " // trim(elpa_kernel) ) + end select + case default + call cq_abort("Invalid Diag.ELPASolver " // trim(elpa_solver) ) + end select !!$ call elp%set( "omp_threads", omp_get_max_threads(), info ) - info = elp%setup() - if( info /= ELPA_OK ) call cq_abort("something wrong in ELPA !") - end subroutine init_ELPA - - subroutine end_ELPA( info ) - implicit none - - integer, intent(out) :: info - - call elpa_deallocate( elp, info ) - if( info /= ELPA_OK ) call cq_abort("end_ELPA: deallocation error") - call elpa_uninit( info ) - if( info /= ELPA_OK ) call cq_abort("end_ELPA: uninit error") - return - end subroutine end_ELPA - - subroutine ELPA_zhegv( mode, matrix_size, row_size, col_size, & - Hmat, Smat, Wvec, Zmat, info ) - implicit none - - character(len=1), intent(in) :: mode - integer, intent(in) :: matrix_size, row_size, col_size - complex(double_cplx), intent(inout) :: Hmat(row_size,col_size) - complex(double_cplx), intent(inout) :: Smat(row_size,col_size) - real(double), intent(out) :: Wvec(matrix_size) - complex(double_cplx), intent(out) :: Zmat(row_size,col_size) - integer, intent(out) :: info - integer :: i, j - - if( mode =='N' ) then - call elp%generalized_eigenvalues( & + info = elp%setup() + if( info /= ELPA_OK ) call cq_abort("something wrong in ELPA !") + end subroutine init_ELPA + + subroutine end_ELPA( info ) + + implicit none + + integer, intent(out) :: info + + call elpa_deallocate( elp, info ) + if( info /= ELPA_OK ) call cq_abort("end_ELPA: deallocation error") + call elpa_uninit( info ) + if( info /= ELPA_OK ) call cq_abort("end_ELPA: uninit error") + return + end subroutine end_ELPA + + subroutine ELPA_zhegv( mode, matrix_size, row_size, col_size, & + Hmat, Smat, Wvec, Zmat, info ) + + implicit none + + character(len=1), intent(in) :: mode + integer, intent(in) :: matrix_size, row_size, col_size + complex(double_cplx), intent(inout) :: Hmat(row_size,col_size) + complex(double_cplx), intent(inout) :: Smat(row_size,col_size) + real(double), intent(out) :: Wvec(matrix_size) + complex(double_cplx), intent(out) :: Zmat(row_size,col_size) + integer, intent(out) :: info + integer :: i, j + + if( mode =='N' ) then + call elp%generalized_eigenvalues( & Hmat, Smat, Wvec, .false., info ) - end if - if( mode =='V' ) then - call elp%generalized_eigenvectors( & + end if + if( mode =='V' ) then + call elp%generalized_eigenvectors( & Hmat, Smat, Wvec, Zmat, .false., info ) - end if + end if - end subroutine ELPA_zhegv + end subroutine ELPA_zhegv end module ELPA_module diff --git a/src/ELPAModuleDUMMY.f90 b/src/ELPAModuleDUMMY.f90 index 723b421c4..ec78acfc6 100644 --- a/src/ELPAModuleDUMMY.f90 +++ b/src/ELPAModuleDUMMY.f90 @@ -1,60 +1,67 @@ module ELPA_module - use datatypes - use mpi - use GenComms, ONLY: cq_abort, myid - implicit none - logical :: use_elpa = .false. ! This should be false for ELPAModuleDummy - character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 - character(len=16) :: elpa_kernel = "GENERIC" - integer :: elpa_API = 20241105 - integer :: merow, mecol + use datatypes + use mpi + use GenComms, ONLY: cq_abort, myid + implicit none - private - public :: use_elpa, elpa_solver, elpa_kernel, elpa_API - public :: init_ELPA, end_ELPA, ELPA_zhegv + logical :: flag_elpa_dummy = .true. ! A marker to show no ELPA in compilation + logical :: flag_use_elpa = .false. ! This should be false for ELPAModuleDummy + character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 + character(len=16) :: elpa_kernel = "GENERIC" + integer :: elpa_API = 20241105 + integer :: merow, mecol + + private + public :: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy + public :: init_ELPA, end_ELPA, ELPA_zhegv contains - subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) - implicit none - integer, intent(in) :: matrix_size, row_size, col_size - integer, intent(in) :: desc(9) - integer, intent(out) :: info + subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) + + implicit none - if(use_elpa) then - call cq_abort("initi_ELPA: init_ELPA is called though ELPA_module is not compiled") - else - call cq_abort("initi_ELPA: init_ELPA is called even though use_elpa is false") - endif + integer, intent(in) :: matrix_size, row_size, col_size + integer, intent(in) :: desc(9) + integer, intent(out) :: info + + if(flag_use_elpa) then + call cq_abort("init_ELPA: init_ELPA is called though ELPA_module is not compiled") + else + call cq_abort("init_ELPA: init_ELPA is called even though use_elpa is false") + endif return - end subroutine init_ELPA + end subroutine init_ELPA + + subroutine end_ELPA( info ) - subroutine end_ELPA( info ) - implicit none - integer, intent(out) :: info + implicit none - call cq_abort("end_ELPA: end_ELPA should not be called") + integer, intent(out) :: info - return - end subroutine end_ELPA + call cq_abort("end_ELPA: end_ELPA should not be called") - subroutine ELPA_zhegv( mode, matrix_size, row_size, col_size, & - Hmat, Smat, Wvec, Zmat, info ) - implicit none + return + end subroutine end_ELPA + + subroutine ELPA_zhegv( mode, matrix_size, row_size, col_size, & + Hmat, Smat, Wvec, Zmat, info ) - character(len=1), intent(in) :: mode - integer, intent(in) :: matrix_size, row_size, col_size - complex(double_cplx), intent(inout) :: Hmat(row_size,col_size) - complex(double_cplx), intent(inout) :: Smat(row_size,col_size) - real(double), intent(out) :: Wvec(matrix_size) - complex(double_cplx), intent(out) :: Zmat(row_size,col_size) - integer, intent(out) :: info + implicit none - call cq_abort("ELPA_zhev: CONQUEST should be compiled with ELPA") + character(len=1), intent(in) :: mode + integer, intent(in) :: matrix_size, row_size, col_size + complex(double_cplx), intent(inout) :: Hmat(row_size,col_size) + complex(double_cplx), intent(inout) :: Smat(row_size,col_size) + real(double), intent(out) :: Wvec(matrix_size) + complex(double_cplx), intent(out) :: Zmat(row_size,col_size) + integer, intent(out) :: info - return - end subroutine ELPA_zhegv + call cq_abort("ELPA_zhev: CONQUEST should be compiled with ELPA") + + return + end subroutine ELPA_zhegv end module ELPA_module diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index 5743d9832..a040e71b8 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -3064,7 +3064,7 @@ subroutine readDiagInfo type_dbl use species_module, only: nsf_species use units, only: en_conv, en_units, energy_units - use ELPA_module, only: use_elpa, elpa_solver, elpa_kernel, elpa_API + use ELPA_module, only: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy implicit none @@ -3215,35 +3215,27 @@ subroutine readDiagInfo end if !Using ELPA or not - use_elpa = fdf_boolean('Diag.UseELPA',.false.) + flag_use_elpa = fdf_boolean('Diag.UseELPA',.false.) - if( use_elpa ) then + if( flag_use_elpa ) then + if(flag_elpa_dummy) call cq_abort("Code compiled without ELPA! Set Diag.UseELPA F") elpa_API = fdf_integer('Diag.ELPA_API',20181113) elpa_solver = fdf_string(16,'Diag.ELPASolver','ELPA1') - select case( elpa_solver ) - case ("ELPA1") + if(leqi(elpa_solver,'ELPA1')) then elpa_kernel = "NONE" - - case ("ELPA2") + else if(leqi(elpa_solver,'ELPA2')) then elpa_kernel = fdf_string(16,'Diag.ELPA2Kernel','GENERIC') - - select case( elpa_kernel ) - case("GENERIC") - case("GENERIC_SIMPLE") - case("SSE_ASSEMBLY") - case("SSE_BLOCK1") - case("SSE_BLOCK2") - case("AVX_BLOCK1") - case("AVX_BLOCK2") - case("AVX2_BLOCK1") - case("AVX2_BLOCK2") - case default - call cq_abort("Invalid Diag.ELPA2Kernal " // elpa_kernel ) - end select - - case default + ! Check for a valid kernel + if(.not.(leqi(elpa_kernel,'GENERIC').OR.leqi(elpa_kernel,"GENERIC_SIMPLE") & + .OR.leqi(elpa_kernel,"SSE_ASSEMBLY").OR.leqi(elpa_kernel,"SSE_BLOCK1") & + .OR.leqi(elpa_kernel,"SSE_BLOCK2").OR.leqi(elpa_kernel,"AVX_BLOCK1") & + .OR.leqi(elpa_kernel,"AVX_BLOCK2").OR.leqi(elpa_kernel,"AVX2_BLOCK1") & + .OR.leqi(elpa_kernel,"AVX2_BLOCK2"))) then + call cq_abort("Invalid Diag.ELPA2Kernel " // elpa_kernel ) + endif + else call cq_abort("Invalid Diag.ELPASolver " // elpa_solver ) - end select + endif else elpa_solver = "NONE" elpa_kernel = "NONE" From 0e102d1fb51b7c06fd335633d60d08303b99e095 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 10 Feb 2025 11:55:32 +0000 Subject: [PATCH 21/45] Allow specification of band numbers Small tweak to the input so that we check for a specified set of bands before looking for an energy range. This allows the user to write out a set of wavefunctions from Conquest using an energy range, and then specify a set of bands in the post-processing --- tools/PostProcessing/read_module.f90 | 34 +++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tools/PostProcessing/read_module.f90 b/tools/PostProcessing/read_module.f90 index 2e381d2e0..6530e176d 100644 --- a/tools/PostProcessing/read_module.f90 +++ b/tools/PostProcessing/read_module.f90 @@ -235,23 +235,25 @@ subroutine read_input E_procwf_max = fdf_double('Process.max_wf_E',E_wf_max) ! Is the range relative to Ef (T) or absolute (F) flag_procwf_range_Ef = fdf_boolean('Process.WFRangeRelative',.true.) - if(abs(E_procwf_max-E_procwf_min)>1e-8_double) then - flag_proc_range = .true. - else - n_bands_process = fdf_integer('Process.noWF',0) - if(n_bands_process>0) then - allocate(band_proc_no(n_bands_process)) - if (fdf_block('WaveFunctionsProcess')) then - if(1+block_end-block_start0) then + allocate(band_proc_no(n_bands_process)) + if (fdf_block('WaveFunctionsProcess')) then + if(1+block_end-block_start1e-8_double) then + flag_proc_range = .true. + else + call cq_abort("Need either a range or a number of bands") end if end if end if ! i_job == 3 or 4 or 5 From 078f82260d4afd522ae1b94130c765a47841be9b Mon Sep 17 00:00:00 2001 From: David Bowler Date: Wed, 12 Feb 2025 09:46:31 +0000 Subject: [PATCH 22/45] Change to overlap matrix used in pDOS for MSSF The PAO-SF overlap matrix is now generated from the PAO-PAO matrix --- src/DiagModule.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index 94b1cae57..056534d4c 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -504,7 +504,7 @@ subroutine FindEvals(electrons) N_kpoints_in_pg use mult_module, only: matH, matS, matK, matM12, SF_to_AtomF_transform, & matrix_scale, matrix_product, matrix_product_trace, matrix_sum, allocate_temp_matrix, free_temp_matrix, & !!! 2025.02.03 nakata - matSFcoeff_tran, mult, sCaTr_sSs_aSs !!! 2025.02.03 nakata + matSFcoeff_tran, mult, sCaTr_sSs_aSs, aSa_sCaTr_aSs, matSatomF !!! 2025.02.03 nakata use matrix_data, only: Hrange, Srange, aHa_range, aSs_range, aSs_in_sSs_range !!! 2025.02.03 nakata use primary_module, only: bundle use species_module, only: species, nsf_species, natomf_species, species_label, n_species !!! 2025.02.03 nakata @@ -852,8 +852,8 @@ subroutine FindEvals(electrons) if (atomf.ne.sf) then flag_WFatomf_buildK = .true. matStmp0 = allocate_temp_matrix(aSs_range,0,atomf,sf) - ! call matrix_product(matSatomf, matSFcoeff_tran(spin_SF), matStmp, mult(aSa_sCaTr_aSs)) - call matrix_product(matSFcoeff_tran(spin_SF), matS(spin_SF), matStmp0, mult(sCaTr_sSs_aSs)) + call matrix_product(matSatomf, matSFcoeff_tran(spin_SF), matStmp0, mult(aSa_sCaTr_aSs)) + !call matrix_product(matSFcoeff_tran(spin_SF), matS(spin_SF), matStmp0, mult(sCaTr_sSs_aSs)) ! change matSFcoeff_tran and matStmp from aSs_range to sSs_range matStmp = allocate_temp_matrix(aSs_in_sSs_range,0,atomf,sf) call matrix_sum(zero,matStmp,one,matStmp0) From 097837f7779a986c756a3ca6fbf03965567ac7b6 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Wed, 12 Feb 2025 13:47:53 +0000 Subject: [PATCH 23/45] Tidying up code Removing debug write statements --- src/DiagModule.f90 | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index 056534d4c..7f7f86b3b 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -502,9 +502,9 @@ subroutine FindEvals(electrons) block_size_c, pg_kpoints, proc_groups, & nkpoints_max, pgid, N_procs_in_pg, & N_kpoints_in_pg - use mult_module, only: matH, matS, matK, matM12, SF_to_AtomF_transform, & + use mult_module, only: matH, matS, matK, matM12, & matrix_scale, matrix_product, matrix_product_trace, matrix_sum, allocate_temp_matrix, free_temp_matrix, & !!! 2025.02.03 nakata - matSFcoeff_tran, mult, sCaTr_sSs_aSs, aSa_sCaTr_aSs, matSatomF !!! 2025.02.03 nakata + matSFcoeff_tran, mult, aSa_sCaTr_aSs, matSatomF !!! 2025.02.03 nakata use matrix_data, only: Hrange, Srange, aHa_range, aSs_range, aSs_in_sSs_range !!! 2025.02.03 nakata use primary_module, only: bundle use species_module, only: species, nsf_species, natomf_species, species_label, n_species !!! 2025.02.03 nakata @@ -853,7 +853,6 @@ subroutine FindEvals(electrons) flag_WFatomf_buildK = .true. matStmp0 = allocate_temp_matrix(aSs_range,0,atomf,sf) call matrix_product(matSatomf, matSFcoeff_tran(spin_SF), matStmp0, mult(aSa_sCaTr_aSs)) - !call matrix_product(matSFcoeff_tran(spin_SF), matS(spin_SF), matStmp0, mult(sCaTr_sSs_aSs)) ! change matSFcoeff_tran and matStmp from aSs_range to sSs_range matStmp = allocate_temp_matrix(aSs_in_sSs_range,0,atomf,sf) call matrix_sum(zero,matStmp,one,matStmp0) @@ -879,7 +878,6 @@ subroutine FindEvals(electrons) call write_wavefn_coeffs(evals(:,kp,spin),scaledEig,spin,tag="Sij") end if else if (atomf.ne.sf) then - write(io_lun,*) "test0 before calling buildK for WFs" ! 2025.02.03 nakata flag_WFatomf_buildK = .true. ! change matSFcoeff_tran from aSs_range to sSs_range matSFcoeffTran_tmp = allocate_temp_matrix(aSs_in_sSs_range,0,atomf,sf) @@ -889,7 +887,6 @@ subroutine FindEvals(electrons) Eig_atomf=expH_atomf, matSFcoeffTran=matSFcoeffTran_tmp) call free_temp_matrix(matSFcoeffTran_tmp) flag_WFatomf_buildK = .false. - write(io_lun,*) "test0 after calling buildK for WFs" ! 2025.02.03 nakata else call buildK(Hrange, matK(spin), occ(:,kp,spin), & kk(:,kp), wtk(kp), expH(:,:,spin)) @@ -960,10 +957,8 @@ subroutine FindEvals(electrons) end do ! j = 1, matrix_size ! Now build data_M12_ij (=-\sum_n eps^n c^n_i c^n_j - ! hence scaling occs by eps allows reuse of buildK) - write(io_lun,*) "test 100.0" !!! 2025.02.03 nakata call buildK(Srange, matM12(spin), occ(:,kp,spin), & kk(:,kp), wtk(kp), expH(:,:,spin)) - write(io_lun,*) "test 100.1" !!! 2025.02.03 nakata end if ! End if (i <= N_kpoints_in_pg(ng)) then end do ! End do ng = 1, proc_groups end do ! End do i = 1, nkpoints_max @@ -3597,7 +3592,6 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, if(wf_self_con .and. flag_WFatomf_buildK) len = matrix_size !!! 2025.02.03 nakata end len_occ = len - write(io_lun,*) "matrix_size, len, len_occ=", matrix_size, len, len_occ !!! 2025.02.03 nakata if(iprint_DM+min_layer>3.AND.myid==0) & write(io_lun,fmt='(10x,a,2i6)') 'buildK: Stage three len:',len, matA if(flag_do_pol_calc.AND.flag_pol_buildS) then @@ -3756,17 +3750,12 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, do col_atomf = 1,natomf_species(bundle%species(prim)) ! c (WF coefficients) in PAO basis if (flag_WFatomf_buildK .and. (atomf.ne.sf)) then - write(io_lun,*) 'sub:buildK test1' - write(io_lun,'(A,4I3,F20.15)') 'prim, jatom, col_atomf, row_sup', prim, jatom, col_atomf, row_sup whereMat = matrix_pos(matSFcoeffTran, prim, jatom, col_atomf, row_sup) - write(io_lun,*) 'sub:buildK test1.1' SFcoeffTran_iajb = return_matrix_value_pos(matSFcoeffTran,whereMat) - write(io_lun,'(A,4I3,F20.15)') 'prim, jatom, col_atomf, row_sup, SFcoeffTran_iajb', prim, jatom, col_atomf, row_sup, SFcoeffTran_iajb ! 1:len_occ gives bands; we want c_ia(pao)^n = c_jb^n(sf) * SFcoeffTran_iajb(pao,sf) Eig_atomf(1:len_occ,prim_orbs_atomf(prim)+col_atomf) = & Eig_atomf(1:len_occ,prim_orbs_atomf(prim)+col_atomf) + & SFcoeffTran_iajb*RecvBuffer(1:len_occ,orb_count+row_sup)*cmplx(rfac,ifac,double_cplx) - write(io_lun,*) 'sub:buildK test1.2' endif ! c*S for pDOS if (flag_pDOS_buildK .and. flag_write_projected_DOS) then From 5a7231a2920f23e2fa81336ea60be41e93cc2eb1 Mon Sep 17 00:00:00 2001 From: ayakon Date: Thu, 13 Feb 2025 20:22:40 +0900 Subject: [PATCH 24/45] Tidying up code Removing comments for debug --- src/DiagModule.f90 | 62 ++++++++----------------- src/dimens_module.f90 | 9 ++-- src/initial_read_module.f90 | 4 +- src/matrix_data_module.f90 | 12 ++--- src/mult_module.f90 | 11 ++--- tools/PostProcessing/pseudo_tm_info.f90 | 5 +- tools/PostProcessing/read_module.f90 | 4 -- 7 files changed, 33 insertions(+), 74 deletions(-) diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index 7f7f86b3b..9055a95ba 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -478,6 +478,8 @@ module DiagModule !! 2023/03/15 08:37 dave !! Removed pDOS output (now done in post-processing) and added calls !! for wavefunction coefficients scaled by overlap matrix (for pDOS) + !! 2025/02/13 17:30 dave and nakata + !! Introduced expH_atomf and flag_WFatomf_buildK for pDOS with MSSFs !! SOURCE !! subroutine FindEvals(electrons) @@ -503,11 +505,11 @@ subroutine FindEvals(electrons) nkpoints_max, pgid, N_procs_in_pg, & N_kpoints_in_pg use mult_module, only: matH, matS, matK, matM12, & - matrix_scale, matrix_product, matrix_product_trace, matrix_sum, allocate_temp_matrix, free_temp_matrix, & !!! 2025.02.03 nakata - matSFcoeff_tran, mult, aSa_sCaTr_aSs, matSatomF !!! 2025.02.03 nakata - use matrix_data, only: Hrange, Srange, aHa_range, aSs_range, aSs_in_sSs_range !!! 2025.02.03 nakata + matrix_scale, matrix_product, matrix_product_trace, matrix_sum, allocate_temp_matrix, free_temp_matrix, & + matSFcoeff_tran, mult, aSa_sCaTr_aSs, matSatomf + use matrix_data, only: Hrange, Srange, aHa_range, aSs_range, aSs_in_sSs_range use primary_module, only: bundle - use species_module, only: species, nsf_species, natomf_species, species_label, n_species !!! 2025.02.03 nakata + use species_module, only: species, nsf_species, natomf_species, species_label, n_species use memory_module, only: type_dbl, type_int, type_cplx, & reg_alloc_mem, reg_dealloc_mem use energy, only: entropy @@ -531,14 +533,14 @@ subroutine FindEvals(electrons) bandE_total, coeff, setA, setB, Eband real(double), dimension(nspin) :: locc, bandE, entropy_local real(double), external :: dlamch - complex(double_cplx), dimension(:,:), allocatable :: scaledEig, expH_atomf !!! 2025.02.03 nakata + complex(double_cplx), dimension(:,:), allocatable :: scaledEig, expH_atomf complex(double_cplx), dimension(:,:,:), allocatable :: expH complex(double_cplx) :: c_n_alpha2, c_n_setA2, c_n_setB2 - integer :: info, stat, il, iu, i, j, m, mz, prim_size, prim_size_atomf, ng, wf_no, & !!! 2025.02.03 nakata + integer :: info, stat, il, iu, i, j, m, mz, prim_size, prim_size_atomf, ng, wf_no, & kp, spin, spin_SF, iacc, iprim, l, band, cdft_group, atom_fns_K, & n_band_min, n_band_max integer :: iatom_spec, Nangmom ! number of orbital angular momentum to be dumped (ex. (s,p,d)=3) - integer :: matStmp, matStmp0, matSFcoeffTran_tmp !!! 2025.02.03 nakata + integer :: matStmp, matStmp0, matSFcoeffTran_tmp logical :: flag_keepexcite @@ -551,12 +553,10 @@ subroutine FindEvals(electrons) do i = 1, bundle%n_prim prim_size = prim_size + nsf_species(bundle%species(i)) end do -!!! 2025.02.03 nakata prim_size_atomf = 0 do i = 1, bundle%n_prim prim_size_atomf = prim_size_atomf + natomf_species(bundle%species(i)) end do -!!! nakata end ! Initialise - start BLACS, sort out matrices, allocate memory call initDiag @@ -606,7 +606,6 @@ subroutine FindEvals(electrons) if (stat /= 0) & call cq_abort('FindEvals: failed to alloc expH', stat) call reg_alloc_mem(area_DM, matrix_size * prim_size * nspin, type_cplx) -!!! 2025.02.03 nakata if(wf_self_con) then if (flag_write_projected_DOS) then allocate(scaledEig(matrix_size,prim_size_atomf), STAT=stat) @@ -624,7 +623,6 @@ subroutine FindEvals(electrons) expH_atomf = zero end if end if -!!! 2025.02.03 nakata end !call gcopy(Efermi) !call gcopy(occ,matrix_size,nkp) ! else @@ -1031,13 +1029,11 @@ subroutine FindEvals(electrons) if (stat /= 0) call cq_abort('FindEvals: failed to deallocacte scaledEig', stat) call reg_dealloc_mem(area_DM, matrix_size * prim_size, type_cplx) end if -!!! 2025.02.03 nakata if(wf_self_con .and. (atomf.ne.sf)) then deallocate(expH_atomf, STAT=stat) if (stat /= 0) call cq_abort('FindEvals: failed to deallocacte expH_atomf', stat) call reg_dealloc_mem(area_DM, matrix_size * prim_size_atomf, type_cplx) end if -!!! 2025.02.03 nakata end ! global call endDiag min_layer = min_layer + 1 @@ -3324,6 +3320,8 @@ end function MP_entropy !! Add possibility to calculate S_{ij}.c^n_j for pDOS calculation post-processing !! 2023/06/08 15:38 dave !! Introduce flag_pol_build_S to select polarisation calculation + !! 2025/02/13 17:30 dave and nakata + !! Introduce flag_WFatomf_buildK and Eig_atomf for pDOS with MSSFs !! SOURCE !! subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, Eig_atomf, matSFcoeffTran) @@ -3342,13 +3340,13 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, ni_in_cell, x_atom_cell, y_atom_cell, & z_atom_cell, max_wf, min_layer, flag_do_pol_calc, mat_polX_re, mat_polX_im, & i_pol_dir_st, i_pol_dir_end, wf_self_con, flag_write_projected_DOS, ne_spin_in_cell, & - sf, atomf !!! 2025.02.03 nakata + sf, atomf use mpi use GenBlas, only: dot use GenComms, only: myid use mult_module, only: store_matrix_value_pos, matrix_pos, matK, return_matrix_value_pos use matrix_data, only: mat, halo - use species_module, only: nsf_species, natomf_species !!! 2025.02.03 nakata + use species_module, only: nsf_species, natomf_species implicit none @@ -3361,11 +3359,9 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, ! For pDOS complex(double_cplx), optional, dimension(:,:) :: overlapEig integer, optional :: matSij -!!! 2025.02.03 nakata ! For WFs with MSSFs complex(double_cplx), optional, dimension(:,:) :: Eig_atomf integer, optional :: matSFcoeffTran -!!! 2025.02.03 nakata end ! Local variables type(Krecv_data), dimension(:), allocatable :: recv_info @@ -3378,14 +3374,14 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, integer :: len, send_size, recv_size, send_proc, recv_proc, nsf1, & sendtag, recvtag integer :: req1, req2, ierr, atom, inter, prim, wheremat, row_sup,& - col_sup, col_atomf !!! 2025.02.03 nakata + col_sup, col_atomf integer, dimension(:,:), allocatable :: ints, atom_list, & send_prim, send_info, send_orbs, send_off integer, dimension(:), allocatable :: current_loc_atoms, & LocalAtom, num_send, norb_send, send_FSC, recv_to_FSC, & - mapchunk, prim_orbs, prim_orbs_atomf !!! 2025.02.03 nakata + mapchunk, prim_orbs, prim_orbs_atomf integer, dimension(MPI_STATUS_SIZE) :: mpi_stat - real(double) :: phase, rfac, ifac, rcc, icc, rsum, exp_X_value_real, exp_X_value_imag, Siajb, SFcoeffTran_iajb !!! 2025.02.03 nakata + real(double) :: phase, rfac, ifac, rcc, icc, rsum, exp_X_value_real, exp_X_value_imag, Siajb, SFcoeffTran_iajb complex(double_cplx) :: zsum, exp_X_value complex(double_cplx), dimension(:,:), allocatable :: RecvBuffer, & SendBuffer @@ -3486,7 +3482,7 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, write(io_lun,fmt='(10x,i6,a,3i6)') myid,' Maxima: ',maxloc, maxint, maxsend ! Allocate recv_info allocate(send_info(numprocs,maxsend),send_orbs(numprocs,maxsend),send_off(numprocs,maxsend), & - prim_orbs(bundle%mx_iprim),prim_orbs_atomf(bundle%mx_iprim),STAT=stat) !!! 2025.02.03 nakata + prim_orbs(bundle%mx_iprim),prim_orbs_atomf(bundle%mx_iprim),STAT=stat) if(stat/=0) call cq_abort('buildK: Error allocating send_info !',stat) send_info = 0 send_orbs = 0 @@ -3497,14 +3493,12 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, prim_orbs(j) = orb_count orb_count = orb_count + nsf_species(bundle%species(j)) end do -!!! 2025.02.03 nakata prim_orbs_atomf = 0 orb_count = 0 do j=1,bundle%n_prim prim_orbs_atomf(j) = orb_count orb_count = orb_count + natomf_species(bundle%species(j)) end do -!!! 2025.02.03 nakata end allocate(recv_info(numprocs),STAT=stat) if(stat/=0) call cq_abort('buildK: Error allocating recv_info !',stat) do i=1,numprocs @@ -3587,10 +3581,8 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, if(myid==0.AND.iprint_DM + min_layer>=4) write(io_lun,fmt='(10x,a,f8.4)') 'Occ is ',occs(i) end if end do -!!! 2025.02.03 nakata if(wf_self_con .and. flag_write_projected_DOS) len = matrix_size if(wf_self_con .and. flag_WFatomf_buildK) len = matrix_size -!!! 2025.02.03 nakata end len_occ = len if(iprint_DM+min_layer>3.AND.myid==0) & write(io_lun,fmt='(10x,a,2i6)') 'buildK: Stage three len:',len, matA @@ -3674,10 +3666,7 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, end do if(iprint_DM + min_layer>=4.AND.myid==0) & write(io_lun,fmt='(10x,a)') 'filling buffer' -!!! 2025.02.03 nakata -! if(.not.(wf_self_con .and. flag_write_projected_DOS)) then if(.not.(flag_pDOS_buildK .or. flag_WFatomf_buildK)) then -!!! 2025.02.03 nakata end do j=1,len_occ ! This is a loop over eigenstates RecvBuffer(j,1:recv_info(recv_proc+1)%orbs) = RecvBuffer(j,1:recv_info(recv_proc+1)%orbs)*occ_correction*occs(j) end do @@ -3728,23 +3717,11 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, polSloc(1:pol_S_size,1:pol_S_size,dir),pol_S_size) end do end if -!!! 2025.02.03 nakata pDOS-MSSF -! ! projected DOS -! if(flag_pDOS_buildK .and. wf_self_con .and. flag_write_projected_DOS) then -! whereMat = matrix_pos(matSij, prim, jatom, col_sup, row_sup) -! Siajb = return_matrix_value_pos(matSij,whereMat) -! ! 1:len_occ gives bands; we want c_jb^n * S_iajb -! overlapEig(1:len_occ,prim_orbs(prim)+col_sup) = & -! overlapEig(1:len_occ,prim_orbs(prim)+col_sup) + & -! Siajb*RecvBuffer(1:len_occ,orb_count+row_sup)*cmplx(rfac,ifac,double_cplx) -! end if -!!! 2025.02.03 nakata end ! Build K or M3 whereMat = matrix_pos(matA, prim, jatom, col_sup, row_sup) zsum = dot(len_occ,localEig(1:len_occ,prim_orbs(prim)+col_sup),1,RecvBuffer(1:len_occ,orb_count+row_sup),1) call store_matrix_value_pos(matA,whereMat,real(zsum*cmplx(rfac,ifac,double_cplx),double)) end do ! col_sup=nsf -!!! 2025.02.03 nakata pDOS-MSSF ! projected DOS in atomf basis if(wf_self_con) then do col_atomf = 1,natomf_species(bundle%species(prim)) @@ -3767,8 +3744,7 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, Siajb*RecvBuffer(1:len_occ,orb_count+row_sup)*cmplx(rfac,ifac,double_cplx) endif end do ! col_atomf=natomf - end if -!!! 2025.02.03 nakata end + end if ! wf_self_con (projected DOS) end do ! row_sup=nsf end do ! inter=recv_info%ints ! Careful - we only want to increment after ALL interactions done @@ -3801,7 +3777,7 @@ subroutine buildK(range, matA, occs, kps, weight, localEig, overlapEig, matSij, recv_info(i)%dx,recv_info(i)%dy,recv_info(i)%dz,STAT=stat) if(stat/=0) call cq_abort('buildK: Error deallocating recvinfo !',i,stat) end do - deallocate(prim_orbs_atomf,prim_orbs,send_off,send_orbs,send_info,STAT=stat) !!! 2025.02.03 nakata + deallocate(prim_orbs_atomf,prim_orbs,send_off,send_orbs,send_info,STAT=stat) if(stat/=0) call cq_abort('buildK: Error allocating send_info !',stat) deallocate(recv_info,STAT=stat) if(stat/=0) call cq_abort('buildK: Error allocating recv_info !',stat) diff --git a/src/dimens_module.f90 b/src/dimens_module.f90 index a296ea04a..638cfbcba 100644 --- a/src/dimens_module.f90 +++ b/src/dimens_module.f90 @@ -163,6 +163,8 @@ module dimens !! Added checks to round RadiusAtomf and RadiusSupport to safe value (including grid points) !! 2024/07/18 14:18 lionel !! Check consistency of Xrange wrt r_exx read from input +!! 2025/02/03 14:00 nakata +!! Added aSs_in_sSs_range for pDOS with MSSFs !! SOURCE !! subroutine set_dimensions(inode, ionode,HNL_fac,non_local, n_species, non_local_species, core_radius) @@ -235,18 +237,13 @@ subroutine set_dimensions(inode, ionode,HNL_fac,non_local, n_species, non_local_ if(flag_neutral_atom_projector) then aNArange = 31 NAarange = 32 -!!! 2025.02.03 nakata -! mx_matrices_tmp = mx_matrices ! = 30 mx_matrices_tmp = 32 -!!! 2025.02.03 nakata end else mx_matrices_tmp = 30 end if -!!! 2025.02.03 nakata aSs_in_sSs_range = mx_matrices_tmp + 1 mx_matrices_tmp = mx_matrices_tmp + 1 if (mx_matrices_tmp > mx_matrices) call cq_abort('ERROR : mx_matrices_tmp is larger than mx_matrices',mx_matrices_tmp) -!!! 2025.02.03 nakata end endif !n_my_grid_points = n_pts_in_block * n_blocks @@ -379,7 +376,7 @@ subroutine set_dimensions(inode, ionode,HNL_fac,non_local, n_species, non_local_ rcut(SFcoeffTr_range) = 0.001_double endif if (abs(r_LD) Date: Tue, 18 Feb 2025 13:14:45 +0000 Subject: [PATCH 25/45] Fast forward onto develop and finish implementation This had not been kept up-to-date, so needed a fast-forward. Implementation wasn't quite right (difference between the two key papers) but is now complete. Just needs documentation. --- src/H_matrix_module.f90 | 9 ++- src/control.f90 | 3 +- src/density_module.f90 | 106 +++++++++++++++++++++++++++---- src/energy_module.f90 | 120 +++++++++++++++++++----------------- src/force_module.f90 | 9 +-- src/initial_read_module.f90 | 16 +++-- 6 files changed, 177 insertions(+), 86 deletions(-) diff --git a/src/H_matrix_module.f90 b/src/H_matrix_module.f90 index f44f3b880..442d00d69 100644 --- a/src/H_matrix_module.f90 +++ b/src/H_matrix_module.f90 @@ -631,7 +631,8 @@ subroutine get_h_on_atomfns(output_level, fixed_potential, & use primary_module, only: domain use set_blipgrid_module, only: naba_atoms_of_blocks use density_module, only: density_pcc, density_atom, & - flag_surface_dipole_correction, get_surface_dipole + flag_surface_dipole_correction, get_surface_dipole, get_average_potential, & + flag_output_average_potential use GenComms, only: gsum, inode, ionode, cq_abort use energy, only: hartree_energy_total_rho, & xc_energy, & @@ -800,7 +801,11 @@ subroutine get_h_on_atomfns(output_level, fixed_potential, & end if call gsum(delta_E_xc) delta_E_xc = delta_E_xc * grid_point_volume - if(flag_surface_dipole_correction) call get_surface_dipole(h_potential, rho_tot, size) + if(flag_surface_dipole_correction) then + call get_surface_dipole(h_potential, rho_tot, size) + else if (flag_output_average_potential) then + call get_average_potential(h_potential, rho_tot, size) + end if ! ! ! Make total potential diff --git a/src/control.f90 b/src/control.f90 index 36fbd69af..2a3ae7b0e 100644 --- a/src/control.f90 +++ b/src/control.f90 @@ -158,6 +158,7 @@ subroutine control_run(fixed_potential, vary_mu, total_energy) use store_matrix, only: dump_pos_and_matrices use io_module, only: write_extxyz use md_control, only: flag_write_extxyz + use density_module, only: flag_output_average_potential, write_average_potential implicit none @@ -247,7 +248,7 @@ subroutine control_run(fixed_potential, vary_mu, total_energy) !****lat<$ call stop_backtrace(t=backtrace_timer,who='control_run',echo=.true.) !****lat>$ - + if(flag_output_average_potential) call write_average_potential ! Added if, otherwise step numbering is broken on MD restart - zamaan if (.not. leqi(runtype, 'md')) call dump_pos_and_matrices return diff --git a/src/density_module.f90 b/src/density_module.f90 index 2d32561d3..61fd144aa 100644 --- a/src/density_module.f90 +++ b/src/density_module.f90 @@ -105,6 +105,10 @@ module density_module real(double), allocatable, dimension(:,:) :: bwgrid ! total atomcharge, second dim is spin real(double), allocatable, dimension(:,:) :: atomcharge + ! Used to calculate average potential in one direction (surface dipole) + real(double), dimension(:), allocatable :: density_average ! Average density in x/y/z + real(double), dimension(:), allocatable :: planar_average + integer :: n_grid_norm ! Size of arrays logical :: weights_set = .false. real(double), dimension(95) :: atrad @@ -132,7 +136,11 @@ module density_module logical :: flag_DumpChargeDensity ! Surface dipole correction - logical :: flag_surface_dipole_correction, flag_output_average_potential + logical :: flag_surface_dipole_correction + ! Write out average potential (with or without correction) + logical :: flag_output_average_potential + ! True selects Bengtsson (internal potential) + logical :: flag_dipole_internal integer :: surface_normal ! x=1, y=2, z=3 to select arrays integer :: discontinuity_location ! User parameter real(double) :: surface_dipole_density, sdde ! \int a rho_av(a) da @@ -928,7 +936,7 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) r_super_x, r_super_y, r_super_z, x_grid, y_grid, z_grid use block_module, only: n_pts_in_block, in_block_x,in_block_y,in_block_z use primary_module, only: domain - use GenComms, only: gsum, inode, ionode + use GenComms, only: gsum, inode, ionode, cq_warn use pseudopotential_common, only: pseudopotential use grid_index, only: grid_point_x, grid_point_y, grid_point_z use species_module, only: species, charge @@ -942,13 +950,11 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) ! Local variables integer :: m, n, nb, point, ptx, pty, ptz, min_dens_loc, zero_start, zero_end - integer :: n_grid_norm, n_grid_plane, atom, gridpos, lun + integer :: n_grid_plane, atom, gridpos, lun integer, dimension(:), pointer :: grid_point_norm real(double) :: r_super_norm, r_super_area, grid_spacing_norm real(double) :: min_dens, beta, shift, locpot real(double), dimension(:), pointer :: atom_cell_norm - real(double), dimension(:), allocatable :: density_average ! Average density in x/y/z - real(double), dimension(:), allocatable :: planar_average ! Set up appropriate parameters in direction of surface normal select case(surface_normal) @@ -979,8 +985,10 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) end select ! Calculate average density along surface normal ! Note that we find the density by summing over all processes (below) - allocate(density_average(n_grid_norm)) + if(.not.allocated(density_average)) allocate(density_average(n_grid_norm)) + if(.not.allocated(planar_average)) allocate(planar_average(n_grid_norm)) density_average = zero + planar_average = zero ! Sum over grid m = 0 do nb = 1, domain%groups_on_node @@ -1015,7 +1023,7 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) min_dens_loc = discontinuity_location min_dens = abs(density_average(min_dens_loc)) if(min_dens>1e-5 .and. inode==ionode) & - write(io_lun,fmt='(8x,"Warning! Possibly large density at discontinuity point: ",f12.5)') min_dens + call cq_warn("get_surface_dipole","Possibly large density at discontinuity point: ",min_dens) end if ! Store location of dipole correction dipole_correction_location = real(min_dens_loc-1,double)*grid_spacing_norm @@ -1046,8 +1054,6 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) ! Energy correction surface_dipole_energy_elec = zero surface_dipole_energy_ion = zero - allocate(planar_average(n_grid_norm)) - planar_average = zero ! Apply the correction m = 0 do nb = 1, domain%groups_on_node @@ -1088,7 +1094,84 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) surface_dipole_energy_elec, surface_dipole_energy_ion call gsum(planar_average,n_grid_norm) planar_average = planar_average/real(n_grid_plane,double) - if(flag_output_average_potential.and.(inode==ionode)) then + return + end subroutine get_surface_dipole + !!*** + + subroutine get_average_potential(h_potential, rho_tot, size) + + use numbers + use block_module, only: n_pts_in_block, in_block_x,in_block_y,in_block_z + use primary_module, only: domain + use GenComms, only: gsum + use pseudopotential_common, only: pseudopotential + use grid_index, only: grid_point_x, grid_point_y, grid_point_z + use dimens, only: n_grid_x, n_grid_y, n_grid_z + + implicit none + + ! Passed variables + integer :: size + real(double), dimension(size) :: h_potential, rho_tot + + ! Local variables + integer :: lun, n_grid_plane, gridpos + integer :: m, n, nb, point, ptx, pty, ptz + integer, dimension(:), pointer :: grid_point_norm + + select case(surface_normal) + case(1) ! X + n_grid_norm = n_grid_x + n_grid_plane = n_grid_y * n_grid_z + grid_point_norm => grid_point_x + case(2) ! Y + n_grid_norm = n_grid_y + n_grid_plane = n_grid_x * n_grid_z + grid_point_norm => grid_point_y + case(3) ! Z + n_grid_norm = n_grid_z + n_grid_plane = n_grid_y * n_grid_x + grid_point_norm => grid_point_z + end select + if(.not.allocated(density_average)) allocate(density_average(n_grid_norm)) + if(.not.allocated(planar_average)) allocate(planar_average(n_grid_norm)) + density_average = zero + planar_average = zero + m = 0 + do nb = 1, domain%groups_on_node + point = 0 + do ptz = 1, in_block_z + do pty = 1, in_block_y + do ptx = 1, in_block_x + point = point+1 + gridpos = grid_point_norm(m+point) + planar_average(gridpos) = planar_average(gridpos) + & + pseudopotential(m+point) + h_potential(m+point) + density_average(gridpos) = & + density_average(gridpos) + rho_tot(m+point) + end do + end do + end do + m = m + n_pts_in_block + end do + call gsum(planar_average,n_grid_norm) + planar_average = planar_average/real(n_grid_plane,double) + call gsum(density_average,n_grid_norm) + density_average = density_average/real(n_grid_plane,double) + return + end subroutine get_average_potential + + subroutine write_average_potential + + use GenComms, only: inode, ionode + use io_module, only: io_assign, io_close + + implicit none + + ! Local variables + integer :: lun, n + + if((inode==ionode)) then call io_assign(lun) open(lun,file="AveragedPotential.dat") do n=1,n_grid_norm @@ -1099,8 +1182,7 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) deallocate(planar_average) deallocate(density_average) return - end subroutine get_surface_dipole - !!*** + end subroutine write_average_potential ! ----------------------------------------------------------- ! Subroutine get_band_density diff --git a/src/energy_module.f90 b/src/energy_module.f90 index 8444ef888..9936cdf30 100644 --- a/src/energy_module.f90 +++ b/src/energy_module.f90 @@ -172,9 +172,8 @@ subroutine get_energy(total_energy, printDFT, level) flag_neutral_atom, min_layer use pseudopotential_common, only: core_correction, & flag_neutral_atom_projector - use density_module, only: electron_number use density_module, only: electron_number, flag_surface_dipole_correction, & - surface_dipole_energy_elec, surface_dipole_energy_ion + surface_dipole_energy_elec, surface_dipole_energy_ion, flag_dipole_internal implicit none @@ -265,14 +264,14 @@ subroutine get_energy(total_energy, printDFT, level) ! For Harris-Foulkes, we need dipole correction energy of rho_i - rho_e if(flag_surface_dipole_correction) then - ! This option is currently not read but would allow Neugebauer & Scheffler Eq. 9 rather than Bengtsson Eq. 13 - !if(flag_dipole_internal) then - ! total_energy = total_energy + & - ! half*(surface_dipole_energy_ion-surface_dipole_energy_elec) - !else + ! Bengtsson Eq. 13 + if(flag_dipole_internal) then + total_energy = total_energy + & + half*(surface_dipole_energy_ion-surface_dipole_energy_elec) + else ! Neugebauer & Scheffler Eq. 9 total_energy = total_energy + & surface_dipole_energy_ion ! Electronic comes from Tr[KH] - !end if + end if end if ! Write out data @@ -314,11 +313,16 @@ subroutine get_energy(total_energy, printDFT, level) en_conv*cdft_energy, en_units(energy_units) if (flag_dft_d2) write (io_lun,17) en_conv*disp_energy, en_units(energy_units) - if (flag_surface_dipole_correction) & - write(io_lun,'(10x,"Surface Dipole Correction Energy : ",f25.15," ",a2)') en_conv * & - surface_dipole_energy_ion, en_units(energy_units) - !half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & - !en_units(energy_units) + if (flag_surface_dipole_correction) then + if(flag_dipole_internal) then + write(io_lun,'(10x,"Surface Dipole Correction Energy : ",f25.15," ",a2)') en_conv * & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & + en_units(energy_units) + else + write(io_lun,'(10x,"Surface Dipole Correction Energy : ",f25.15," ",a2)') en_conv * & + surface_dipole_energy_ion, en_units(energy_units) + end if + end if end if if (abs(entropy) >= RD_ERR) then @@ -381,18 +385,14 @@ subroutine get_energy(total_energy, printDFT, level) if (flag_dft_d2) total_energy2 = total_energy2 + disp_energy ! For DFT, we need dipole correction energy of rho_i + rho_e if(flag_surface_dipole_correction) then - !if(flag_dipole_internal) then - !total_energy2 = total_energy2 + & - ! half*(surface_dipole_energy_ion+surface_dipole_energy_elec) - !else - total_energy2 = total_energy2 + & - surface_dipole_energy_ion+surface_dipole_energy_elec - !end if - end if - if (inode == ionode) then - write(io_lun,13) en_conv*total_energy2, en_units(energy_units) + if(flag_dipole_internal) then + total_energy2 = total_energy2 + & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec) + else + total_energy2 = total_energy2 + & + surface_dipole_energy_ion+surface_dipole_energy_elec + end if end if - if (inode == ionode .and. iprint_gen + min_layer>=2) then write(io_lun,13) en_conv*total_energy2, en_units(energy_units) end if @@ -514,20 +514,19 @@ subroutine final_energy(nkp,level) flag_fix_spin_population, & io_ase, write_ase, ase_file, & flag_diagonalisation - use DFT_D2, only: disp_energy use density_module, only: electron_number, flag_surface_dipole_correction, & - surface_dipole_energy_elec, surface_dipole_energy_ion + surface_dipole_energy_elec, surface_dipole_energy_ion, flag_dipole_internal use pseudopotential_common, only: core_correction, & - flag_neutral_atom_projector + flag_neutral_atom_projector use species_module, only: n_species use input_module, only: io_close - + implicit none ! Passed variables integer, optional :: level integer, intent(in) :: nkp - + ! Local variables character(len=80) :: sub_name = "final_energy" integer :: spin, spin_SF @@ -545,12 +544,12 @@ subroutine final_energy(nkp,level) integer :: i, stat, counter character(len=80) :: tmp -!****lat<$ + !****lat<$ if ( present(level) ) backtrace_level = level+1 if ( .not. present(level) ) backtrace_level = -10 call start_backtrace(t=backtrace_timer,who='final_energy',& where=area,level=backtrace_level,echo=.true.) -!****lat>$ + !****lat>$ ! Initialise energies nl_energy = zero @@ -570,18 +569,18 @@ subroutine final_energy(nkp,level) if (flag_SpinDependentSF) spin_SF = spin ! 2*Tr[K NL] nl_energy = nl_energy & - + spin_factor*matrix_product_trace(matK(spin), matNL(spin_SF)) + + spin_factor*matrix_product_trace(matK(spin), matNL(spin_SF)) if(flag_neutral_atom_projector) local_ps_energy = local_ps_energy & - + spin_factor*matrix_product_trace(matK(spin), matNA(spin_SF)) + + spin_factor*matrix_product_trace(matK(spin), matNA(spin_SF)) ! 2*Tr[K KE] with KE = - < grad**2 > kinetic_energy = kinetic_energy & - + spin_factor*half*matrix_product_trace(matK(spin), matKE(spin_SF)) + + spin_factor*half*matrix_product_trace(matK(spin), matKE(spin_SF)) ! 2*Tr[K H] band_energy = band_energy & - + spin_factor*matrix_product_trace(matK(spin), matH(spin)) + + spin_factor*matrix_product_trace(matK(spin), matH(spin)) ! -alpha*Tr[K X] exx_energy = exx_energy & - - spin_factor*half*exx_alpha*matrix_product_trace(matK(spin), matX(spin)) + - spin_factor*half*exx_alpha*matrix_product_trace(matK(spin), matX(spin)) end do ! Find total pure DFT energy @@ -609,13 +608,13 @@ subroutine final_energy(nkp,level) ! For Harris-Foulkes, we need dipole correction energy of rho_i - rho_e if(flag_surface_dipole_correction) then - !if(flag_dipole_internal) then - !total_energy1 = total_energy1 + & - ! half*(surface_dipole_energy_ion-surface_dipole_energy_elec) - !else - total_energy1 = total_energy1 + & - surface_dipole_energy_ion - !end if + if(flag_dipole_internal) then + total_energy1 = total_energy1 + & + half*(surface_dipole_energy_ion-surface_dipole_energy_elec) + else + total_energy1 = total_energy1 + & + surface_dipole_energy_ion + end if end if !Write out data !... @@ -704,21 +703,26 @@ subroutine final_energy(nkp,level) write (io_lun,17) en_conv*disp_energy,en_units(energy_units) if (flag_perform_cdft) & write (io_lun,18) en_conv*cdft_energy,en_units(energy_units) - if (flag_surface_dipole_correction) & - write(io_lun,'(10x," | Surface Dipole Energy = ",f25.15," ",a2)') en_conv * & - surface_dipole_energy_ion, en_units(energy_units) - !half*(surface_dipole_energy_ion+surface_dipole_energy_elec), & + if (flag_surface_dipole_correction) then + if(flag_dipole_internal) then + write(io_lun,'(6x,"| Surface Dipole Energy = ",f25.15," ",a2)') en_conv * & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec),en_units(energy_units) + else + write(io_lun,'(6x,"| Surface Dipole Energy = ",f25.15," ",a2)') en_conv * & + surface_dipole_energy_ion, en_units(energy_units) + end if + end if write (io_lun, 2) end if end if - + if ( inode == ionode ) then ! if (abs(entropy) >= RD_ERR) then - + !if (iprint_gen >= 0) & ! write(io_lun,10) en_conv*total_energy1, en_units(energy_units) - + if (flag_check_Diag) then ! select case (SmearingType) @@ -759,7 +763,7 @@ subroutine final_energy(nkp,level) ! &contribution is negligible)")') end if end if - + ! Check on validity of band energy if(flag_neutral_atom) then total_energy2 = hartree_energy_drho + & @@ -782,13 +786,13 @@ subroutine final_energy(nkp,level) if (flag_perform_cdft) total_energy2 = total_energy2 + cdft_energy if (flag_dft_d2) total_energy2 = total_energy2 + disp_energy if(flag_surface_dipole_correction) then - !if(flag_dipole_internal) then - !total_energy2 = total_energy2 + & - ! half*(surface_dipole_energy_ion+surface_dipole_energy_elec) - !else - total_energy2 = total_energy2 + & - surface_dipole_energy_ion+surface_dipole_energy_elec - !end if + if(flag_dipole_internal) then + total_energy2 = total_energy2 + & + half*(surface_dipole_energy_ion+surface_dipole_energy_elec) + else + total_energy2 = total_energy2 + & + surface_dipole_energy_ion+surface_dipole_energy_elec + end if end if ! One-electron energy diff --git a/src/force_module.f90 b/src/force_module.f90 index 067350f7c..6077503fb 100644 --- a/src/force_module.f90 +++ b/src/force_module.f90 @@ -261,8 +261,8 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & rcellx, rcelly, rcellz, flag_mix_L_SC_min, & flag_atomic_stress, non_atomic_stress, & flag_heat_flux, cell_constraint_flag, & - atom_coord, species_glob, min_layer - flag_heat_flux, cell_constraint_flag, min_layer + atom_coord, species_glob, min_layer, & + flag_heat_flux, cell_constraint_flag use density_module, only: get_electronic_density, density, & build_Becke_weight_forces, & flag_surface_dipole_correction, & @@ -295,8 +295,8 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & ! Local variables integer :: i, j, ii, stat, max_atom, max_compt, ispin, & - real(double), dimension(3) :: dipole_correction_force direction, dir1, dir2, counter + real(double), dimension(3) :: dipole_correction_force real(double) :: max_force, volume, scale, g0, scaleC, r_super_norm type(cq_timer) :: tmr_l_tmp1 type(cq_timer) :: backtrace_timer @@ -673,7 +673,8 @@ subroutine force(fixed_potential, vary_mu, n_cg_L_iterations, & write(io_lun, 106) trim(prefix),(for_conv * ion_interaction_force(j,i), j = 1, 3) end if if(flag_surface_dipole_correction) & - write(io_lun, fmt='("Force dipole : ",3f15.10)') (for_conv * dipole_correction_force(j), j = 1, 3) + write(io_lun, fmt='(4x,a,3f15.10)') trim(prefix)//" Force dipole : ", & + (for_conv * dipole_correction_force(j), j = 1, 3) if (flag_pcc_global) write(io_lun, 108) trim(prefix),(for_conv * pcc_force(j,i), j = 1, 3) if (flag_dft_d2) write (io_lun, 109) trim(prefix),(for_conv * disp_force(j,i), j = 1, 3) if (flag_perform_cdft) write (io_lun, fmt='(4x,a,3f15.10)') & diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index 58c9fc595..739a27317 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -901,7 +901,8 @@ subroutine read_input(start, start_L, titles, vary_mu,& atomch_output, flag_Kerker, flag_wdmetric, minitersSC, & flag_newresidual, flag_newresid_abs, n_dumpSCF use density_module, only: flag_InitialAtomicSpin, flag_DumpChargeDensity - use density_module, only: flag_surface_dipole_correction, surface_normal, flag_output_average_potential, discontinuity_location + use density_module, only: flag_surface_dipole_correction, surface_normal, & + flag_output_average_potential, discontinuity_location, flag_dipole_internal use S_matrix_module, only: InvSTolerance, InvSMaxSteps,& InvSDeltaOmegaTolerance use blip, only: blip_info, init_blip_flag, alpha, beta @@ -1688,6 +1689,7 @@ subroutine read_input(start, start_L, titles, vary_mu,& ! number of electrons. If the error of electron number (per total electron number) ! is larger than the following value, we use atomic charge density. (in update_H) threshold_resetCD = fdf_double('SC.Threshold.Reset',0.1_double) + ! Surface dipole correction parameters flag_surface_dipole_correction = fdf_boolean('SC.SurfaceDipoleCorrection',.false.) flag_output_average_potential = fdf_boolean('SC.OutputAveragePotential',.false.) if(flag_surface_dipole_correction) discontinuity_location = fdf_integer('SC.DiscontinuityLocation',0) @@ -1701,6 +1703,9 @@ subroutine read_input(start, start_L, titles, vary_mu,& else call cq_abort('Unrecognised surface normal direction specified: '//tmp) end if + ! Bengtsson PRB 59 12301 1999 is default + flag_dipole_internal = fdf_boolean('SC.SurfaceDipoleInternal',.true.) + ! Line minimisation tmp = fdf_string(4,'AtomMove.CGLineMin','safe') if(leqi(tmp,'safe')) then cg_line_min = safe @@ -2759,9 +2764,9 @@ subroutine write_info(titles, mu, vary_mu, HNL_fac, NODES) n_support_iterations, & n_L_iterations use datestamp, only: datestr, commentver - use pseudopotential_common, only: flag_neutral_atom_projector, maxL_neutral_atom_projector, & use density_module, only: flag_surface_dipole_correction, surface_normal, & discontinuity_location + use pseudopotential_common, only: flag_neutral_atom_projector, maxL_neutral_atom_projector, & numN_neutral_atom_projector, pseudo_type, OLDPS, SIESTA, ABINIT use input_module, only: leqi, chrcap use control, only: MDn_steps @@ -2967,13 +2972,6 @@ subroutine write_info(titles, mu, vary_mu, HNL_fac, NODES) discontinuity_location end if end if - if(read_phi) then - write(io_lun,262) - do n=1, n_species - write(io_lun,212) species_label(n), phi_file(n) - end do - endif - if (.not.vary_mu) then write(io_lun,*) ' mu is constant' write(io_lun,fmt="(/10x,'The Chemical Potential mu is :',f7.4)") mu From 6b9b34012aea7ab0a2d9e2f3a425093bdc59da71 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Thu, 20 Feb 2025 12:20:06 +0000 Subject: [PATCH 26/45] Tidy up dipole correction and add documentation Small changes to tidy up potential and output, and added outline documentation --- docs/groundstate.rst | 28 +++++ docs/references.bib | 20 ++++ src/DiagModule.f90 | 1 - src/density_module.f90 | 228 ++++++++++++++++-------------------- src/initial_read_module.f90 | 8 +- 5 files changed, 155 insertions(+), 130 deletions(-) diff --git a/docs/groundstate.rst b/docs/groundstate.rst index faf796f26..a4f0b0c6c 100644 --- a/docs/groundstate.rst +++ b/docs/groundstate.rst @@ -410,6 +410,34 @@ beyond the valence electrons. Go to :ref:`top `. +.. _gs_surf_dip: + +Surface dipole correction +------------------------- + +If your simulation involves a slab calculation, then unless the slab is +perfectly symmetrical there can be a dipole moment which gives an unphysical +field across the periodic cell even for a neutral system. A correction can be applied, following the +method outlined in :cite:`g-Neugebauer1992,g-Bengtsson1999` (where we use the energy from the +Bengtsson paper, which is correct). This method *only* works for slab +calculations, and calculates a dipole correction potential, placing the +necessary discontinuity in the vacuum. The user can specify the location +of the discontinuity (in *fractional* coordinates), or the code will place it at the point where the +planar averaged density is a minimum (which is a good way to find the +centre of the vacuum). + +:: + + SC.SurfaceDipoleCorrection T/F + SC.SurfaceNormal x, y, or z + SC.DiscontinuityLocation (*real*) + +It is also possible to write out the planar-averaged potential and charge density +(averaged in the plane perpendicular to the surface normal) using the parameter +``SC.OutputAveragePotential T/F``. This generates the file ``AveragedPotential.dat``. + +Go to :ref:`top `. + .. _gs_spin: Spin polarisation diff --git a/docs/references.bib b/docs/references.bib index 31c99bee2..8144fe1c8 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -679,3 +679,23 @@ @article{Boys:1970aa year = {1970}, doi = {10.1080/00268977000101561}, pages = {553}} +@article{Bengtsson1999, + title = {Dipole correction for surface supercell calculations}, + author = {Bengtsson, Lennart}, + journal = {Phys. Rev. B}, + volume = {59}, + issue = {19}, + pages = {12301--12304}, + year = {1999}, + doi = {10.1103/PhysRevB.59.12301} +} +@article{Neugebauer1992, + title = {Adsorbate-substrate and adsorbate-adsorbate interactions of Na and K adlayers on Al(111)}, + author = {Neugebauer, J\"org and Scheffler, Matthias}, + journal = {Phys. Rev. B}, + volume = {46}, + issue = {24}, + pages = {16067--16080}, + year = {1992}, + doi = {10.1103/PhysRevB.46.16067} +} \ No newline at end of file diff --git a/src/DiagModule.f90 b/src/DiagModule.f90 index f3863226b..fccf2dce3 100644 --- a/src/DiagModule.f90 +++ b/src/DiagModule.f90 @@ -514,7 +514,6 @@ subroutine FindEvals(electrons) use functions_on_grid, only: atomfns, & allocate_temp_fn_on_grid, & free_temp_fn_on_grid - use density_module, ONLY: get_band_density use io_module, ONLY: write_eigenvalues, write_eigenvalues_format_ase use pao_format, ONLY: pao use ELPA_module, ONLY: flag_use_elpa, init_ELPA, end_ELPA diff --git a/src/density_module.f90 b/src/density_module.f90 index 61fd144aa..e77dd5c2e 100644 --- a/src/density_module.f90 +++ b/src/density_module.f90 @@ -107,7 +107,7 @@ module density_module real(double), allocatable, dimension(:,:) :: atomcharge ! Used to calculate average potential in one direction (surface dipole) real(double), dimension(:), allocatable :: density_average ! Average density in x/y/z - real(double), dimension(:), allocatable :: planar_average + real(double), dimension(:), allocatable :: planar_average, dipole_potential integer :: n_grid_norm ! Size of arrays logical :: weights_set = .false. @@ -142,8 +142,8 @@ module density_module ! True selects Bengtsson (internal potential) logical :: flag_dipole_internal integer :: surface_normal ! x=1, y=2, z=3 to select arrays - integer :: discontinuity_location ! User parameter - real(double) :: surface_dipole_density, sdde ! \int a rho_av(a) da + real(double) :: discontinuity_location ! User parameter + real(double) :: surface_dipole_density real(double) :: surface_dipole_energy_elec ! Eq 13 in Bengtsson real(double) :: surface_dipole_energy_ion ! Eq 13 in Bengtsson real(double) :: dipole_correction_location ! Where is the correction ? z_m in Bengtsson @@ -953,7 +953,7 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) integer :: n_grid_plane, atom, gridpos, lun integer, dimension(:), pointer :: grid_point_norm real(double) :: r_super_norm, r_super_area, grid_spacing_norm - real(double) :: min_dens, beta, shift, locpot + real(double) :: min_dens, beta, shift, locpot, dcl_frac real(double), dimension(:), pointer :: atom_cell_norm ! Set up appropriate parameters in direction of surface normal @@ -983,13 +983,14 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) grid_point_norm => grid_point_z atom_cell_norm => z_atom_cell end select - ! Calculate average density along surface normal - ! Note that we find the density by summing over all processes (below) + ! Allocate if(.not.allocated(density_average)) allocate(density_average(n_grid_norm)) if(.not.allocated(planar_average)) allocate(planar_average(n_grid_norm)) + if(.not.allocated(dipole_potential)) allocate(dipole_potential(n_grid_norm)) density_average = zero planar_average = zero - ! Sum over grid + dipole_potential = zero + ! Calculate average density along surface normal m = 0 do nb = 1, domain%groups_on_node point = 0 @@ -1008,7 +1009,7 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) density_average = density_average/real(n_grid_plane,double) ! Find the mid-vacuum point: this should be set by the user, otherwise ! default to the point of lowest average density - if(discontinuity_location==0) then + if(discontinuity_location2) & - write(io_lun,fmt='(4x,"Placing discontinuity at grid point ",i5,& - &" where density is ",f12.5)') min_dens_loc, min_dens + write(io_lun,fmt='(4x,"Placing discontinuity at z=",f12.5,& + &" a0 where density is ",f12.5)') dipole_correction_location, min_dens else - min_dens_loc = discontinuity_location + ! discontinuity stored as fractional + min_dens_loc = 1 + floor(discontinuity_location*n_grid_norm) + dipole_correction_location = real(min_dens_loc-1,double)*grid_spacing_norm + ! Location of dipole correction in fractional coordinates + dcl_frac = real(min_dens_loc-1,double)/real(n_grid_norm,double) min_dens = abs(density_average(min_dens_loc)) if(min_dens>1e-5 .and. inode==ionode) & - call cq_warn("get_surface_dipole","Possibly large density at discontinuity point: ",min_dens) + call cq_warn("get_surface_dipole",& + "Possibly large density at discontinuity point: ",min_dens) end if - ! Store location of dipole correction - dipole_correction_location = real(min_dens_loc-1,double)*grid_spacing_norm - ! Calculate surface dipole density + ! Calculate surface dipole density (m in Bengtsson) surface_dipole_density = zero - sdde = zero do point=min_dens_loc,n_grid_norm surface_dipole_density = surface_dipole_density + & density_average(point)*real(point-1,double) ! Apply grid point spacing outside @@ -1040,7 +1046,6 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) end do ! Apply grid-point spacing twice: once for integral, once to convert point to x surface_dipole_density = surface_dipole_density * grid_spacing_norm * grid_spacing_norm - sdde = surface_dipole_density ! Add ionic contribution - for now do for all atoms but could do just on partition and sum do atom = 1, ni_in_cell if(atom_cell_norm(atom)>dipole_correction_location) then @@ -1051,10 +1056,18 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) (atom_cell_norm(atom)+r_super_norm)*charge(species(atom))/r_super_area end if end do - ! Energy correction + ! Calculate dipole correction potential + do point = 1,n_grid_norm + beta = real(point-1,double)/real(n_grid_norm,double) + ! Discontinuity location; in Bengtsson Eq.7 this is 0.5 + shift = dcl_frac + half ! one + if((min_dens_loc - point)>0) shift = dcl_frac - half ! zero + ! Neugebauer & Scheffler Eq. 14 and Bengtsson Eq. 7 adapted + dipole_potential(point) = fourpi*surface_dipole_density*(beta - shift) + end do surface_dipole_energy_elec = zero surface_dipole_energy_ion = zero - ! Apply the correction + ! Apply the dipole correction and calculate electronic energy m = 0 do nb = 1, domain%groups_on_node point = 0 @@ -1063,15 +1076,10 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) do ptx = 1, in_block_x point = point+1 gridpos = grid_point_norm(m+point) - beta = real(gridpos-1,double)/real(n_grid_norm,double) - shift = one - if((min_dens_loc - gridpos)>0) shift = zero - ! Neugebauer & Scheffler Eq. 14 and Bengtsson Eq. 7 adapted - locpot = fourpi*surface_dipole_density*(beta - shift) + locpot = dipole_potential(gridpos) h_potential(m+point) = h_potential(m+point) + locpot surface_dipole_energy_elec = & - surface_dipole_energy_elec + & - rho_tot(m+point)*locpot + surface_dipole_energy_elec + rho_tot(m+point)*locpot planar_average(gridpos) = planar_average(gridpos) + & pseudopotential(m+point) + h_potential(m+point) end do @@ -1079,25 +1087,53 @@ subroutine get_surface_dipole(h_potential, rho_tot, size) end do m = m + n_pts_in_block end do + ! Complete planar average + call gsum(planar_average,n_grid_norm) + planar_average = planar_average/real(n_grid_plane,double) + ! Complete surface dipole energy (electronic) surface_dipole_energy_elec = surface_dipole_energy_elec*grid_point_volume call gsum(surface_dipole_energy_elec) - ! Atomic contribution + ! Ionic contribution to energy do atom = 1, ni_in_cell - shift = one beta = atom_cell_norm(atom)/r_super_norm - if((dipole_correction_location - atom_cell_norm(atom))>0) shift = zero + shift = dcl_frac + half ! one + if((dipole_correction_location - atom_cell_norm(atom))>0) & + shift = dcl_frac - half ! zero surface_dipole_energy_ion = surface_dipole_energy_ion - & charge(species(atom))* fourpi*surface_dipole_density*(beta - shift) end do if(inode==ionode.AND.iprint_SC>3) & write(io_lun,fmt='(8x,"Dipole energy for electrons and ions: ",2f12.5)') & surface_dipole_energy_elec, surface_dipole_energy_ion - call gsum(planar_average,n_grid_norm) - planar_average = planar_average/real(n_grid_plane,double) return end subroutine get_surface_dipole !!*** + ! ----------------------------------------------------------- + ! Subroutine get_average_potential + ! ----------------------------------------------------------- + + !!****f* density_module/get_average_potential * + !! + !! NAME + !! get_average_potential + !! USAGE + !! + !! PURPOSE + !! Calculate average potential (if we're not applying dipole correction) + !! INPUTS + !! + !! + !! USES + !! + !! AUTHOR + !! D. R. Bowler + !! CREATION DATE + !! 2025/02/12 + !! MODIFICATION HISTORY + !! + !! SOURCE + !! subroutine get_average_potential(h_potential, rho_tot, size) use numbers @@ -1160,124 +1196,64 @@ subroutine get_average_potential(h_potential, rho_tot, size) density_average = density_average/real(n_grid_plane,double) return end subroutine get_average_potential - - subroutine write_average_potential - - use GenComms, only: inode, ionode - use io_module, only: io_assign, io_close - - implicit none - - ! Local variables - integer :: lun, n - - if((inode==ionode)) then - call io_assign(lun) - open(lun,file="AveragedPotential.dat") - do n=1,n_grid_norm - write(lun,*) n,planar_average(n), density_average(n) - end do - call io_close(lun) - end if - deallocate(planar_average) - deallocate(density_average) - return - end subroutine write_average_potential + !!*** ! ----------------------------------------------------------- - ! Subroutine get_band_density + ! Subroutine write_average_potential ! ----------------------------------------------------------- - !!****f* density_module/get_band_density * + !!****f* density_module/write_average_potential * !! - !! NAME - !! get_band_density + !! NAME + !! write_average_potential !! USAGE - !! + !! !! PURPOSE - !! Gets electronic density for one band on grid (closely follows - !! get_electronic_density, above) + !! Write average potential !! INPUTS - !! - !! + !! + !! !! USES - !! + !! !! AUTHOR !! D. R. Bowler !! CREATION DATE - !! 2015/06/05 + !! 2025/02/12 !! MODIFICATION HISTORY - !! 2016/07/15 18:30 nakata - !! Renamed sf_H_sf_rem -> atomf_H_atomf_rem - !! 2016/07/20 16:30 nakata - !! Renamed naba_atm -> naba_atoms_of_blocks - !! 2016/08/01 17:30 nakata - !! Introduced atomf instead of sf - !! 2016/08/09 14:00 nakata - !! Renamed support -> atom_fns - !! 2016/09/15 18:00 nakata - !! Renamed matBand -> matBand_atomfns + !! !! SOURCE !! - subroutine get_band_density(denout, spin, atom_fns, atom_fns_K, matBand_atomfns, size) + subroutine write_average_potential - use datatypes - use numbers - use GenBlas, only: scal, rsum - use dimens, only: n_my_grid_points, grid_point_volume - use block_module, only: n_pts_in_block - use set_bucket_module, only: rem_bucket, atomf_H_atomf_rem - use calc_matrix_elements_module, only: act_on_vectors_new - use primary_module, only: domain - use set_blipgrid_module, only: naba_atoms_of_blocks - use GenComms, only: gsum, inode, ionode - use global_module, only: iprint_SC, atomf, ni_in_cell - use functions_on_grid, only: gridfunctions, fn_on_grid + use GenComms, only: inode, ionode + use io_module, only: io_assign, io_close implicit none - ! Passed variables - - integer :: size, spin, matBand_atomfns - integer :: atom_fns, atom_fns_K - real(double), dimension(size) :: denout - ! Local variables - integer :: blk, i_count_alpha, n, n_i, n_point - real(double) :: electrons - - if (inode == ionode .and. iprint_SC >= 2) & - write (io_lun,fmt='(2x,"Entering get_band_density")') + integer :: lun, n - gridfunctions(atom_fns_K)%griddata = zero - call act_on_vectors_new(inode-1, rem_bucket(atomf_H_atomf_rem), & - matBand_atomfns, atom_fns_K, atom_fns) - denout(:) = zero - i_count_alpha = 0 - do blk = 1, domain%groups_on_node - n_point = (blk - 1) * n_pts_in_block - i_count_alpha = (naba_atoms_of_blocks(atomf)%ibegin_blk_orb(blk)-1) * n_pts_in_block - if (naba_atoms_of_blocks(atomf)%no_of_atom(blk) > 0) then !TM 30/Jun/2003 - do n_i = 1, naba_atoms_of_blocks(atomf)%no_of_orb(blk)*n_pts_in_block, n_pts_in_block - do n=1, n_pts_in_block - denout(n_point+n) = & - denout(n_point+n) + & - gridfunctions(atom_fns_K)%griddata(i_count_alpha+n_i+n-1) * & - gridfunctions(atom_fns)%griddata(i_count_alpha+n_i+n-1) - end do + if((inode==ionode)) then + call io_assign(lun) + open(lun,file="AveragedPotential.dat") + if(flag_surface_dipole_correction) then + write(lun,fmt='("# Pt Potential Density V_dipole")') + do n=1,n_grid_norm + write(lun,fmt='(i6,3e14.5)') n,planar_average(n), density_average(n), dipole_potential(n) end do - end if !(naba_atoms_of_blocks(atomf)%no_of_atom(blk) > 0) !TM 30/Jun/2003 - end do ! blk - electrons = grid_point_volume * rsum(n_my_grid_points, denout(:), 1) - call gsum(electrons) - - if (inode == ionode .and. iprint_SC > 1) & - write (io_lun, '(2x,"Electrons: ",f25.15)') & - electrons - call stop_timer(tmr_std_chargescf) - + else + write(lun,fmt='("# Pt Potential Density")') + do n=1,n_grid_norm + write(lun,fmt='(i6,3e14.5)') n,planar_average(n), density_average(n) + end do + end if + call io_close(lun) + end if + deallocate(planar_average) + deallocate(density_average) + if(flag_surface_dipole_correction) deallocate(dipole_potential) return - end subroutine get_band_density + end subroutine write_average_potential !!*** ! ----------------------------------------------------------- diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index 739a27317..a597f7f66 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -1692,7 +1692,9 @@ subroutine read_input(start, start_L, titles, vary_mu,& ! Surface dipole correction parameters flag_surface_dipole_correction = fdf_boolean('SC.SurfaceDipoleCorrection',.false.) flag_output_average_potential = fdf_boolean('SC.OutputAveragePotential',.false.) - if(flag_surface_dipole_correction) discontinuity_location = fdf_integer('SC.DiscontinuityLocation',0) + if(flag_surface_dipole_correction) discontinuity_location = fdf_double('SC.DiscontinuityLocation',-one) + if(discontinuity_location>one) call cq_abort("Discontinuity location must be fractional: ",& + discontinuity_location) tmp = fdf_string(1,'SC.SurfaceNormal','z') if(leqi(tmp,'x')) then surface_normal = 1 @@ -2964,11 +2966,11 @@ subroutine write_info(titles, mu, vary_mu, HNL_fac, NODES) end if if(flag_surface_dipole_correction) then write(io_lun,fmt='(/10x,"Applying surface dipole correction along axis ",i2)') surface_normal - if(discontinuity_location==0) then + if(discontinuity_location Date: Thu, 20 Feb 2025 13:54:13 +0000 Subject: [PATCH 27/45] Added test for surface dipole --- .github/workflows/makefile.yml | 6 + testsuite/README.md | 15 +- .../test_008_surface_dipole/Conquest_input | 25 + testsuite/test_008_surface_dipole/H.ion | 3372 ++++++++++++++ testsuite/test_008_surface_dipole/Longer.in | 7 + testsuite/test_008_surface_dipole/O.ion | 3956 +++++++++++++++++ testsuite/test_check_output.py | 9 + 7 files changed, 7385 insertions(+), 5 deletions(-) create mode 100644 testsuite/test_008_surface_dipole/Conquest_input create mode 100644 testsuite/test_008_surface_dipole/H.ion create mode 100644 testsuite/test_008_surface_dipole/Longer.in create mode 100644 testsuite/test_008_surface_dipole/O.ion diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 309bddbff..187d84955 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -142,6 +142,12 @@ jobs: mpirun -np ${{matrix.np}} ../../bin/Conquest cat Conquest_out + - name: Run test 008 + working-directory: ${{github.workspace}}/testsuite/test_008_surface_dipole + run: | + mpirun -np ${{matrix.np}} ../../bin/Conquest + cat Conquest_out + - name: Check test results working-directory: ${{github.workspace}}/testsuite run: pytest test_check_output.py diff --git a/testsuite/README.md b/testsuite/README.md index 305cc3028..59f75eb82 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -1,10 +1,15 @@ # CONQUEST test suite. -This directory currently contains three end-to-end tests - - - `test_001_bulk_Si_1proc_Diag` - - `test_002_bulk_Si_1proc_OrderN` - - `test_003_bulk_BTO_polarisation` +This directory currently contains eight end-to-end tests + + - `test_001_bulk_Si_1proc_Diag` (tests ground state with diagonalisation) + - `test_002_bulk_Si_1proc_OrderN` (tests ground state with linear scaling) + - `test_003_bulk_BTO_polarisation` (tests polarisation (Resta)) + - `test_004_isol_C2H4_4proc_PBE0CRI` (tests EXX) + - `test_005_isol_C2H4_4proc_PBE0GTO` (tests EXX) + - `test_006_isol_C2H4_4proc_PBE0ERI` (tests EXX) + - `test_007_isol_CH_spinpol_1proc_PBE0CRI` (tests EXX) + - `test_008_surface_dipole` (tests surface dipole implementation) for Conquest, and a simple python pytest script for checking the correctness of the outputs. diff --git a/testsuite/test_008_surface_dipole/Conquest_input b/testsuite/test_008_surface_dipole/Conquest_input new file mode 100644 index 000000000..0544c1f1e --- /dev/null +++ b/testsuite/test_008_surface_dipole/Conquest_input @@ -0,0 +1,25 @@ +AtomMove.TypeOfRun static +Basis.BasisSet PAOs +DM.SolutionMethod diagon +General.NumberOfSpecies 2 +General.PseudopotentialType hamann +Grid.GridCutoff 100 +IO.Coordinates Longer.in +IO.Iprint 0 +IO.Title Water layer +SC.KerkerPreCondition T +SC.MaxIters 250 +SC.SurfaceDipoleCorrection T +SC.OutputAveragePotential T +SC.SurfaceNormal z +minE.SCTolerance 1.000000e-08 +minE.SelfConsistent True +Diag.MPMesh True +Diag.MPMeshX 1 +Diag.MPMeshY 1 +Diag.MPMeshZ 1 + +%block ChemicalSpeciesLabel + 1 15.999 O + 2 1.000 H +%endblock ChemicalSpeciesLabel diff --git a/testsuite/test_008_surface_dipole/H.ion b/testsuite/test_008_surface_dipole/H.ion new file mode 100644 index 000000000..bef34ce5a --- /dev/null +++ b/testsuite/test_008_surface_dipole/H.ion @@ -0,0 +1,3372 @@ + + + Git Branch: develop; tag, hash: v1.3-112-gb89ccfbc + Date generated : 2024/11/18 at 17:07 + + + Hamann code version : v3.3.1 + Hamann input file name: H.in (appended at end of file) + Core radii (bohr) : l=0 1.000 l=1 0.700 + 1 valence shells : 1s + XC functional code : 000101 + Pseudopotential type : ONCVPSP + XC description : GGA PBE96 + + +H basis set with GGA PBE96 functional +n = 1, l = 0, 2 zetas + Radii: 6.73 3.14 +n = 3, l = 1, 1 zetas, perturbative polarisation shell + Radii: 6.73 + + + H pb nrl nc + + +H # Element symbol +H # Label + 1.00 # Atomic number + 1.0000000000 # Valence charge + 1.0100000000 # Mass + 0.0000000000 # Self energy + 1 3 # Lmax for basis, no of orbitals + 1 3 # Lmax for projectors, no of proj +# PAOs:_______________ + 0 1 1 0 1.000000 #orbital l, n, z, is_polarized, population + 673 0.0100108094935117 6.7272639796398339 + 0.00000000000 1.56155243927 + 0.01001080949 1.56134070284 + 0.02002161899 1.56070574813 + 0.03003242848 1.55964885058 + 0.04004323797 1.55817208410 + 0.05005404747 1.55627832243 + 0.06006485696 1.55397122574 + 0.07007566645 1.55125521739 + 0.08008647595 1.54813545528 + 0.09009728544 1.54461779874 + 0.10010809494 1.54070877148 + 0.11011890443 1.53641552108 + 0.12012971392 1.53174577552 + 0.13014052342 1.52670779733 + 0.14015133291 1.52131033591 + 0.15016214240 1.51556257860 + 0.16017295190 1.50947410109 + 0.17018376139 1.50305481772 + 0.18019457088 1.49631493226 + 0.19020538038 1.48926488971 + 0.20021618987 1.48191532958 + 0.21022699936 1.47427704125 + 0.22023780886 1.46636092164 + 0.23024861835 1.45817793578 + 0.24025942784 1.44973908044 + 0.25027023734 1.44105535113 + 0.26028104683 1.43213771273 + 0.27029185632 1.42299707375 + 0.28030266582 1.41364426441 + 0.29031347531 1.40409001844 + 0.30032428481 1.39434495862 + 0.31033509430 1.38441958583 + 0.32034590379 1.37432427155 + 0.33035671329 1.36406925340 + 0.34036752278 1.35366463354 + 0.35037833227 1.34312037965 + 0.36038914177 1.33244632792 + 0.37039995126 1.32165218784 + 0.38041076075 1.31074754827 + 0.39042157025 1.29974188439 + 0.40043237974 1.28864456508 + 0.41044318923 1.27746486027 + 0.42045399873 1.26621194795 + 0.43046480822 1.25489492023 + 0.44047561771 1.24352278834 + 0.45048642721 1.23210448598 + 0.46049723670 1.22064887090 + 0.47050804620 1.20916472442 + 0.48051885569 1.19766074854 + 0.49052966518 1.18614556082 + 0.50054047468 1.17462768654 + 0.51055128417 1.16311554844 + 0.52056209366 1.15161745392 + 0.53057290316 1.14014157977 + 0.54058371265 1.12869595469 + 0.55059452214 1.11728843966 + 0.56060533164 1.10592670649 + 0.57061614113 1.09461821492 + 0.58062695062 1.08337018840 + 0.59063776012 1.07218958916 + 0.60064856961 1.06108309277 + 0.61065937910 1.05005706277 + 0.62067018860 1.03911752576 + 0.63068099809 1.02827014718 + 0.64069180758 1.01752020869 + 0.65070261708 1.00687258704 + 0.66071342657 0.99633173524 + 0.67072423607 0.98590166613 + 0.68073504556 0.97558593897 + 0.69074585505 0.96538764906 + 0.70075666455 0.95530942092 + 0.71076747404 0.94535340509 + 0.72077828353 0.93552127872 + 0.73078909303 0.92581425012 + 0.74079990252 0.91623306723 + 0.75081071201 0.90677803005 + 0.76082152151 0.89744900694 + 0.77083233100 0.88824545454 + 0.78084314049 0.87916644131 + 0.79085394999 0.87021067430 + 0.80086475948 0.86137652880 + 0.81087556897 0.85266208067 + 0.82088637847 0.84406514084 + 0.83089718796 0.83558329159 + 0.84090799745 0.82721392410 + 0.85091880695 0.81895427692 + 0.86092961644 0.81080147467 + 0.87094042594 0.80275256672 + 0.88095123543 0.79480456505 + 0.89096204492 0.78695448110 + 0.90097285442 0.77919936093 + 0.91098366391 0.77153631839 + 0.92099447340 0.76396256567 + 0.93100528290 0.75647544121 + 0.94101609239 0.74907243422 + 0.95102690188 0.74175120587 + 0.96103771138 0.73450960669 + 0.97104852087 0.72734569015 + 0.98105933036 0.72025772222 + 0.99107013986 0.71324418676 + 1.00108094935 0.70630378700 + 1.01109175884 0.69943544499 + 1.02110256834 0.69263827456 + 1.03111337783 0.68591148121 + 1.04112418733 0.67925428455 + 1.05113499682 0.67266591066 + 1.06114580631 0.66614559626 + 1.07115661581 0.65969258660 + 1.08116742530 0.65330613568 + 1.09117823479 0.64698550619 + 1.10118904429 0.64072996939 + 1.11119985378 0.63453880504 + 1.12121066327 0.62841130133 + 1.13122147277 0.62234675477 + 1.14123228226 0.61634447012 + 1.15124309175 0.61040376027 + 1.16125390125 0.60452394621 + 1.17126471074 0.59870435689 + 1.18127552023 0.59294432914 + 1.19128632973 0.58724320761 + 1.20129713922 0.58160034467 + 1.21130794871 0.57601510031 + 1.22131875821 0.57048684208 + 1.23132956770 0.56501494498 + 1.24134037720 0.55959879139 + 1.25135118669 0.55423777098 + 1.26136199618 0.54893128061 + 1.27137280568 0.54367872430 + 1.28138361517 0.53847951308 + 1.29139442466 0.53333306495 + 1.30140523416 0.52823880477 + 1.31141604365 0.52319616422 + 1.32142685314 0.51820458166 + 1.33143766264 0.51326350211 + 1.34144847213 0.50837237712 + 1.35145928162 0.50353066473 + 1.36147009112 0.49873782937 + 1.37148090061 0.49399334179 + 1.38149171010 0.48929667896 + 1.39150251960 0.48464732403 + 1.40151332909 0.48004476625 + 1.41152413859 0.47548850084 + 1.42153494808 0.47097802901 + 1.43154575757 0.46651285778 + 1.44155656707 0.46209250001 + 1.45156737656 0.45771647424 + 1.46157818605 0.45338430468 + 1.47158899555 0.44909552110 + 1.48159980504 0.44484965878 + 1.49161061453 0.44064625844 + 1.50162142403 0.43648486617 + 1.51163223352 0.43236503334 + 1.52164304301 0.42828631657 + 1.53165385251 0.42424827764 + 1.54166466200 0.42025048343 + 1.55167547149 0.41629250585 + 1.56168628099 0.41237392177 + 1.57169709048 0.40849431299 + 1.58170789997 0.40465326614 + 1.59171870947 0.40085037262 + 1.60172951896 0.39708522857 + 1.61174032846 0.39335743478 + 1.62175113795 0.38966659663 + 1.63176194744 0.38601232405 + 1.64177275694 0.38239423145 + 1.65178356643 0.37881193767 + 1.66179437592 0.37526506590 + 1.67180518542 0.37175324364 + 1.68181599491 0.36827610267 + 1.69182680440 0.36483327895 + 1.70183761390 0.36142441257 + 1.71184842339 0.35804914775 + 1.72185923288 0.35470713271 + 1.73187004238 0.35139801969 + 1.74188085187 0.34812146485 + 1.75189166136 0.34487712823 + 1.76190247086 0.34166467372 + 1.77191328035 0.33848376898 + 1.78192408985 0.33533408541 + 1.79193489934 0.33221529810 + 1.80194570883 0.32912708580 + 1.81195651833 0.32606913083 + 1.82196732782 0.32304111908 + 1.83197813731 0.32004273991 + 1.84198894681 0.31707368618 + 1.85199975630 0.31413365413 + 1.86201056579 0.31122234341 + 1.87202137529 0.30833945696 + 1.88203218478 0.30548470102 + 1.89204299427 0.30265778509 + 1.90205380377 0.29985842186 + 1.91206461326 0.29708632718 + 1.92207542275 0.29434122003 + 1.93208623225 0.29162282247 + 1.94209704174 0.28893085961 + 1.95210785123 0.28626505957 + 1.96211866073 0.28362515344 + 1.97212947022 0.28101087524 + 1.98214027972 0.27842196188 + 1.99215108921 0.27585815314 + 2.00216189870 0.27331919163 + 2.01217270820 0.27080482275 + 2.02218351769 0.26831479464 + 2.03219432718 0.26584885818 + 2.04220513668 0.26340676694 + 2.05221594617 0.26098827713 + 2.06222675566 0.25859314761 + 2.07223756516 0.25622113981 + 2.08224837465 0.25387201774 + 2.09225918414 0.25154554793 + 2.10226999364 0.24924149941 + 2.11228080313 0.24695964369 + 2.12229161262 0.24469975471 + 2.13230242212 0.24246160883 + 2.14231323161 0.24024498479 + 2.15232404111 0.23804966368 + 2.16233485060 0.23587542894 + 2.17234566009 0.23372206629 + 2.18235646959 0.23158936372 + 2.19236727908 0.22947711149 + 2.20237808857 0.22738510205 + 2.21238889807 0.22531313008 + 2.22239970756 0.22326099241 + 2.23241051705 0.22122848801 + 2.24242132655 0.21921541799 + 2.25243213604 0.21722158553 + 2.26244294553 0.21524679591 + 2.27245375503 0.21329085645 + 2.28246456452 0.21135357647 + 2.29247537401 0.20943476734 + 2.30248618351 0.20753424237 + 2.31249699300 0.20565181685 + 2.32250780249 0.20378730799 + 2.33251861199 0.20194053494 + 2.34252942148 0.20011131872 + 2.35254023098 0.19829948222 + 2.36255104047 0.19650485021 + 2.37256184996 0.19472724926 + 2.38257265946 0.19296650777 + 2.39258346895 0.19122245592 + 2.40259427844 0.18949492567 + 2.41260508794 0.18778375073 + 2.42261589743 0.18608876655 + 2.43262670692 0.18440981027 + 2.44263751642 0.18274672076 + 2.45264832591 0.18109933855 + 2.46265913540 0.17946750581 + 2.47266994490 0.17785106640 + 2.48268075439 0.17624986576 + 2.49269156388 0.17466375097 + 2.50270237338 0.17309257066 + 2.51271318287 0.17153617507 + 2.52272399236 0.16999441598 + 2.53273480186 0.16846714671 + 2.54274561135 0.16695422211 + 2.55275642085 0.16545549852 + 2.56276723034 0.16397083380 + 2.57277803983 0.16250008725 + 2.58278884933 0.16104311966 + 2.59279965882 0.15959979325 + 2.60281046831 0.15816997168 + 2.61282127781 0.15675352000 + 2.62283208730 0.15535030468 + 2.63284289679 0.15396019358 + 2.64285370629 0.15258305592 + 2.65286451578 0.15121876227 + 2.66287532527 0.14986718456 + 2.67288613477 0.14852819602 + 2.68289694426 0.14720167123 + 2.69290775375 0.14588748605 + 2.70291856325 0.14458551763 + 2.71292937274 0.14329564438 + 2.72294018224 0.14201774600 + 2.73295099173 0.14075170342 + 2.74296180122 0.13949739879 + 2.75297261072 0.13825471552 + 2.76298342021 0.13702353819 + 2.77299422970 0.13580375259 + 2.78300503920 0.13459524572 + 2.79301584869 0.13339790571 + 2.80302665818 0.13221162187 + 2.81303746768 0.13103628466 + 2.82304827717 0.12987178568 + 2.83305908666 0.12871801764 + 2.84306989616 0.12757487436 + 2.85308070565 0.12644225079 + 2.86309151514 0.12532004293 + 2.87310232464 0.12420814789 + 2.88311313413 0.12310646384 + 2.89312394362 0.12201488999 + 2.90313475312 0.12093332661 + 2.91314556261 0.11986167500 + 2.92315637211 0.11879983748 + 2.93316718160 0.11774771740 + 2.94317799109 0.11670521910 + 2.95318880059 0.11567224790 + 2.96319961008 0.11464871012 + 2.97321041957 0.11363451304 + 2.98322122907 0.11262956492 + 2.99323203856 0.11163377494 + 3.00324284805 0.11064705326 + 3.01325365755 0.10966931094 + 3.02326446704 0.10870045998 + 3.03327527653 0.10774041327 + 3.04328608603 0.10678908464 + 3.05329689552 0.10584638879 + 3.06330770501 0.10491224129 + 3.07331851451 0.10398655862 + 3.08332932400 0.10306925810 + 3.09334013350 0.10216025792 + 3.10335094299 0.10125947710 + 3.11336175248 0.10036683552 + 3.12337256198 0.09948225388 + 3.13338337147 0.09860565370 + 3.14339418096 0.09773695731 + 3.15340499046 0.09687608786 + 3.16341579995 0.09602296927 + 3.17342660944 0.09517752627 + 3.18343741894 0.09433968437 + 3.19344822843 0.09350936982 + 3.20345903792 0.09268650967 + 3.21346984742 0.09187103171 + 3.22348065691 0.09106286445 + 3.23349146640 0.09026193719 + 3.24350227590 0.08946817993 + 3.25351308539 0.08868152338 + 3.26352389488 0.08790189900 + 3.27353470438 0.08712923893 + 3.28354551387 0.08636347602 + 3.29355632337 0.08560454381 + 3.30356713286 0.08485237654 + 3.31357794235 0.08410690910 + 3.32358875185 0.08336807708 + 3.33359956134 0.08263581671 + 3.34361037083 0.08191006489 + 3.35362118033 0.08119075916 + 3.36363198982 0.08047783772 + 3.37364279931 0.07977123938 + 3.38365360881 0.07907090360 + 3.39366441830 0.07837677045 + 3.40367522779 0.07768878062 + 3.41368603729 0.07700687541 + 3.42369684678 0.07633099672 + 3.43370765627 0.07566108705 + 3.44371846577 0.07499708947 + 3.45372927526 0.07433894766 + 3.46374008476 0.07368660586 + 3.47375089425 0.07304000888 + 3.48376170374 0.07239910210 + 3.49377251324 0.07176383146 + 3.50378332273 0.07113414345 + 3.51379413222 0.07050998509 + 3.52380494172 0.06989130397 + 3.53381575121 0.06927804819 + 3.54382656070 0.06867016639 + 3.55383737020 0.06806760772 + 3.56384817969 0.06747032186 + 3.57385898918 0.06687825900 + 3.58386979868 0.06629136983 + 3.59388060817 0.06570960555 + 3.60389141766 0.06513291784 + 3.61390222716 0.06456125887 + 3.62391303665 0.06399458131 + 3.63392384614 0.06343283830 + 3.64393465564 0.06287598345 + 3.65394546513 0.06232397084 + 3.66395627463 0.06177675502 + 3.67396708412 0.06123429099 + 3.68397789361 0.06069653421 + 3.69398870311 0.06016344057 + 3.70399951260 0.05963496643 + 3.71401032209 0.05911106857 + 3.72402113159 0.05859170421 + 3.73403194108 0.05807683100 + 3.74404275057 0.05756640701 + 3.75405356007 0.05706039073 + 3.76406436956 0.05655874108 + 3.77407517905 0.05606141736 + 3.78408598855 0.05556837929 + 3.79409679804 0.05507958701 + 3.80410760753 0.05459500104 + 3.81411841703 0.05411458228 + 3.82412922652 0.05363829205 + 3.83414003601 0.05316609202 + 3.84415084551 0.05269794427 + 3.85416165500 0.05223381123 + 3.86417246450 0.05177365573 + 3.87418327399 0.05131744093 + 3.88419408348 0.05086513039 + 3.89420489298 0.05041668802 + 3.90421570247 0.04997207806 + 3.91422651196 0.04953126513 + 3.92423732146 0.04909421420 + 3.93424813095 0.04866089057 + 3.94425894044 0.04823125987 + 3.95426974994 0.04780528810 + 3.96428055943 0.04738294156 + 3.97429136892 0.04696418689 + 3.98430217842 0.04654899108 + 3.99431298791 0.04613732140 + 4.00432379740 0.04572914547 + 4.01433460690 0.04532443120 + 4.02434541639 0.04492314685 + 4.03435622589 0.04452526094 + 4.04436703538 0.04413074233 + 4.05437784487 0.04373956018 + 4.06438865437 0.04335168392 + 4.07439946386 0.04296708331 + 4.08441027335 0.04258572838 + 4.09442108285 0.04220758946 + 4.10443189234 0.04183263715 + 4.11444270183 0.04146084235 + 4.12445351133 0.04109217623 + 4.13446432082 0.04072661024 + 4.14447513031 0.04036411611 + 4.15448593981 0.04000466581 + 4.16449674930 0.03964823163 + 4.17450755879 0.03929478607 + 4.18451836829 0.03894430193 + 4.19452917778 0.03859675226 + 4.20453998727 0.03825211034 + 4.21455079677 0.03791034974 + 4.22456160626 0.03757144427 + 4.23457241576 0.03723536798 + 4.24458322525 0.03690209516 + 4.25459403474 0.03657160036 + 4.26460484424 0.03624385836 + 4.27461565373 0.03591884417 + 4.28462646322 0.03559653307 + 4.29463727272 0.03527690052 + 4.30464808221 0.03495992224 + 4.31465889170 0.03464557419 + 4.32466970120 0.03433383253 + 4.33468051069 0.03402467365 + 4.34469132018 0.03371807416 + 4.35470212968 0.03341401090 + 4.36471293917 0.03311246090 + 4.37472374866 0.03281340144 + 4.38473455816 0.03251680997 + 4.39474536765 0.03222266419 + 4.40475617715 0.03193094196 + 4.41476698664 0.03164162140 + 4.42477779613 0.03135468078 + 4.43478860563 0.03107009860 + 4.44479941512 0.03078785356 + 4.45481022461 0.03050792453 + 4.46482103411 0.03023029060 + 4.47483184360 0.02995493105 + 4.48484265309 0.02968182534 + 4.49485346259 0.02941095311 + 4.50486427208 0.02914229421 + 4.51487508157 0.02887582865 + 4.52488589107 0.02861153664 + 4.53489670056 0.02834939856 + 4.54490751005 0.02808939498 + 4.55491831955 0.02783150663 + 4.56492912904 0.02757571442 + 4.57493993853 0.02732199945 + 4.58495074803 0.02707034296 + 4.59496155752 0.02682072639 + 4.60497236702 0.02657313132 + 4.61498317651 0.02632753952 + 4.62499398600 0.02608393291 + 4.63500479550 0.02584229357 + 4.64501560499 0.02560260376 + 4.65502641448 0.02536484588 + 4.66503722398 0.02512900249 + 4.67504803347 0.02489505631 + 4.68505884296 0.02466299022 + 4.69506965246 0.02443278724 + 4.70508046195 0.02420443054 + 4.71509127144 0.02397790347 + 4.72510208094 0.02375318948 + 4.73511289043 0.02353027221 + 4.74512369992 0.02330913542 + 4.75513450942 0.02308976303 + 4.76514531891 0.02287213907 + 4.77515612841 0.02265624775 + 4.78516693790 0.02244207340 + 4.79517774739 0.02222960049 + 4.80518855689 0.02201881363 + 4.81519936638 0.02180969756 + 4.82521017587 0.02160223716 + 4.83522098537 0.02139641743 + 4.84523179486 0.02119222351 + 4.85524260435 0.02098964068 + 4.86525341385 0.02078865433 + 4.87526422334 0.02058924999 + 4.88527503283 0.02039141331 + 4.89528584233 0.02019513006 + 4.90529665182 0.02000038615 + 4.91530746131 0.01980716759 + 4.92531827081 0.01961546054 + 4.93532908030 0.01942525124 + 4.94533988979 0.01923652609 + 4.95535069929 0.01904927158 + 4.96536150878 0.01886347433 + 4.97537231828 0.01867912106 + 4.98538312777 0.01849619863 + 4.99539393726 0.01831469398 + 5.00540474676 0.01813459419 + 5.01541555625 0.01795588643 + 5.02542636574 0.01777855801 + 5.03543717524 0.01760259630 + 5.04544798473 0.01742798883 + 5.05545879422 0.01725472319 + 5.06546960372 0.01708278711 + 5.07548041321 0.01691216841 + 5.08549122270 0.01674285501 + 5.09550203220 0.01657483494 + 5.10551284169 0.01640809632 + 5.11552365118 0.01624262740 + 5.12553446068 0.01607841648 + 5.13554527017 0.01591545201 + 5.14555607966 0.01575372250 + 5.15556688916 0.01559321657 + 5.16557769865 0.01543392294 + 5.17558850815 0.01527583042 + 5.18559931764 0.01511892791 + 5.19561012713 0.01496320441 + 5.20562093663 0.01480864900 + 5.21563174612 0.01465525088 + 5.22564255561 0.01450299930 + 5.23565336511 0.01435188362 + 5.24566417460 0.01420189330 + 5.25567498409 0.01405301786 + 5.26568579359 0.01390524693 + 5.27569660308 0.01375857022 + 5.28570741257 0.01361297751 + 5.29571822207 0.01346845869 + 5.30572903156 0.01332500371 + 5.31573984105 0.01318260262 + 5.32575065055 0.01304124553 + 5.33576146004 0.01290092266 + 5.34577226954 0.01276162430 + 5.35578307903 0.01262334079 + 5.36579388852 0.01248606260 + 5.37580469802 0.01234978023 + 5.38581550751 0.01221448429 + 5.39582631700 0.01208016546 + 5.40583712650 0.01194681448 + 5.41584793599 0.01181442218 + 5.42585874548 0.01168297946 + 5.43586955498 0.01155247729 + 5.44588036447 0.01142290672 + 5.45589117396 0.01129425887 + 5.46590198346 0.01116652493 + 5.47591279295 0.01103969616 + 5.48592360244 0.01091376388 + 5.49593441194 0.01078871951 + 5.50594522143 0.01066455450 + 5.51595603092 0.01054126041 + 5.52596684042 0.01041882882 + 5.53597764991 0.01029725141 + 5.54598845941 0.01017651993 + 5.55599926890 0.01005662616 + 5.56601007839 0.00993756199 + 5.57602088789 0.00981931934 + 5.58603169738 0.00970189021 + 5.59604250687 0.00958526665 + 5.60605331637 0.00946944080 + 5.61606412586 0.00935440483 + 5.62607493535 0.00924015098 + 5.63608574485 0.00912667157 + 5.64609655434 0.00901395895 + 5.65610736383 0.00890200556 + 5.66611817333 0.00879080387 + 5.67612898282 0.00868034643 + 5.68613979231 0.00857062584 + 5.69615060181 0.00846163475 + 5.70616141130 0.00835336589 + 5.71617222080 0.00824581201 + 5.72618303029 0.00813896595 + 5.73619383978 0.00803282058 + 5.74620464928 0.00792736884 + 5.75621545877 0.00782260373 + 5.76622626826 0.00771851827 + 5.77623707776 0.00761510558 + 5.78624788725 0.00751235879 + 5.79625869674 0.00741027112 + 5.80626950624 0.00730883580 + 5.81628031573 0.00720804614 + 5.82629112522 0.00710789550 + 5.83630193472 0.00700837728 + 5.84631274421 0.00690948493 + 5.85632355370 0.00681121195 + 5.86633436320 0.00671355189 + 5.87634517269 0.00661649836 + 5.88635598218 0.00652004500 + 5.89636679168 0.00642418549 + 5.90637760117 0.00632891359 + 5.91638841067 0.00623422307 + 5.92639922016 0.00614010777 + 5.93641002965 0.00604656157 + 5.94642083915 0.00595357839 + 5.95643164864 0.00586115218 + 5.96644245813 0.00576927698 + 5.97645326763 0.00567794682 + 5.98646407712 0.00558715580 + 5.99647488661 0.00549689808 + 6.00648569611 0.00540716781 + 6.01649650560 0.00531795924 + 6.02650731509 0.00522926663 + 6.03651812459 0.00514108428 + 6.04652893408 0.00505340654 + 6.05653974357 0.00496622780 + 6.06655055307 0.00487954248 + 6.07656136256 0.00479334506 + 6.08657217206 0.00470763003 + 6.09658298155 0.00462239194 + 6.10659379104 0.00453762538 + 6.11660460054 0.00445332496 + 6.12661541003 0.00436948535 + 6.13662621952 0.00428610123 + 6.14663702902 0.00420316734 + 6.15664783851 0.00412067845 + 6.16665864800 0.00403862936 + 6.17666945750 0.00395701492 + 6.18668026699 0.00387582998 + 6.19669107648 0.00379506948 + 6.20670188598 0.00371472834 + 6.21671269547 0.00363480156 + 6.22672350496 0.00355528414 + 6.23673431446 0.00347617112 + 6.24674512395 0.00339745760 + 6.25675593344 0.00331913867 + 6.26676674294 0.00324120949 + 6.27677755243 0.00316366522 + 6.28678836193 0.00308650109 + 6.29679917142 0.00300971232 + 6.30680998091 0.00293329420 + 6.31682079041 0.00285724201 + 6.32683159990 0.00278155110 + 6.33684240939 0.00270621682 + 6.34685321889 0.00263123458 + 6.35686402838 0.00255659978 + 6.36687483787 0.00248230788 + 6.37688564737 0.00240835436 + 6.38689645686 0.00233473474 + 6.39690726635 0.00226144453 + 6.40691807585 0.00218847932 + 6.41692888534 0.00211583469 + 6.42693969483 0.00204350626 + 6.43695050433 0.00197148968 + 6.44696131382 0.00189978063 + 6.45697212332 0.00182837479 + 6.46698293281 0.00175726791 + 6.47699374230 0.00168645572 + 6.48700455180 0.00161593401 + 6.49701536129 0.00154569858 + 6.50702617078 0.00147574526 + 6.51703698028 0.00140606990 + 6.52704778977 0.00133666838 + 6.53705859926 0.00126753660 + 6.54706940876 0.00119867048 + 6.55708021825 0.00113006598 + 6.56709102774 0.00106171907 + 6.57710183724 0.00099362573 + 6.58711264673 0.00092578200 + 6.59712345622 0.00085818390 + 6.60713426572 0.00079082751 + 6.61714507521 0.00072370891 + 6.62715588470 0.00065682420 + 6.63716669420 0.00059016952 + 6.64717750369 0.00052374102 + 6.65718831319 0.00045753480 + 6.66719912268 0.00039154711 + 6.67720993217 0.00032577417 + 6.68722074167 0.00026021223 + 6.69723155116 0.00019485754 + 6.70724236065 0.00012970639 + 6.71725317015 0.00006475510 + 6.72726397964 0.00000000000 + 0 1 2 0 0.000000 #orbital l, n, z, is_polarized, population + 314 0.0100170843787149 3.1353474105377774 + 0.00000000000 2.38066178283 + 0.01001708438 2.38028386102 + 0.02003416876 2.37915055448 + 0.03005125314 2.37726415744 + 0.04006833751 2.37462840062 + 0.05008542189 2.37124845353 + 0.06010250627 2.36713090037 + 0.07011959065 2.36228369805 + 0.08013667503 2.35671612467 + 0.09015375941 2.35043871988 + 0.10017084379 2.34346321814 + 0.11018792817 2.33580247576 + 0.12020501254 2.32747039265 + 0.13022209692 2.31848182975 + 0.14023918130 2.30885252319 + 0.15025626568 2.29859899621 + 0.16027335006 2.28773846984 + 0.17029043444 2.27628877352 + 0.18030751882 2.26426825644 + 0.19032460320 2.25169570082 + 0.20034168757 2.23859023791 + 0.21035877195 2.22497126759 + 0.22037585633 2.21085838229 + 0.23039294071 2.19627129609 + 0.24041002509 2.18122977926 + 0.25042710947 2.16575359905 + 0.26044419385 2.14986246681 + 0.27046127823 2.13357599186 + 0.28047836260 2.11691364205 + 0.29049544698 2.09989471122 + 0.30051253136 2.08253829317 + 0.31052961574 2.06486326215 + 0.32054670012 2.04688825939 + 0.33056378450 2.02863168525 + 0.34058086888 2.01011169639 + 0.35059795326 1.99134620760 + 0.36061503763 1.97235289734 + 0.37063212201 1.95314921632 + 0.38064920639 1.93375239854 + 0.39066629077 1.91417947378 + 0.40068337515 1.89444728092 + 0.41070045953 1.87457248117 + 0.42071754391 1.85457157059 + 0.43073462828 1.83446089111 + 0.44075171266 1.81425663925 + 0.45076879704 1.79397487224 + 0.46078588142 1.77363151072 + 0.47080296580 1.75324233769 + 0.48082005018 1.73282299332 + 0.49083713456 1.71238896548 + 0.50085421894 1.69195557558 + 0.51087130331 1.67153795991 + 0.52088838769 1.65115104647 + 0.53090547207 1.63080952740 + 0.54092255645 1.61052782726 + 0.55093964083 1.59032006775 + 0.56095672521 1.57020002885 + 0.57097380959 1.55018110763 + 0.58099089397 1.53027627448 + 0.59100797834 1.51049802828 + 0.60102506272 1.49085835058 + 0.61104214710 1.47136865992 + 0.62105923148 1.45203976702 + 0.63107631586 1.43288183134 + 0.64109340024 1.41390432038 + 0.65111048462 1.39511597184 + 0.66112756900 1.37652475983 + 0.67114465337 1.35813786561 + 0.68116173775 1.33996165352 + 0.69117882213 1.32200165270 + 0.70119590651 1.30426254498 + 0.71121299089 1.28674815942 + 0.72123007527 1.26946147374 + 0.73124715965 1.25240462275 + 0.74126424402 1.23557891397 + 0.75128132840 1.21898485032 + 0.76129841278 1.20262215969 + 0.77131549716 1.18648983123 + 0.78133258154 1.17058615794 + 0.79134966592 1.15490878510 + 0.80136675030 1.13945476395 + 0.81138383468 1.12422061007 + 0.82140091905 1.10920236564 + 0.83141800343 1.09439566488 + 0.84143508781 1.07979580180 + 0.85145217219 1.06539779944 + 0.86146925657 1.05119647959 + 0.87148634095 1.03718653227 + 0.88150342533 1.02336258393 + 0.89152050971 1.00971926359 + 0.90153759408 0.99625126591 + 0.91155467846 0.98295341067 + 0.92157176284 0.96982069760 + 0.93158884722 0.95684835613 + 0.94160593160 0.94403188936 + 0.95162301598 0.93136711169 + 0.96164010036 0.91885017983 + 0.97165718474 0.90647761678 + 0.98167426911 0.89424632861 + 0.99169135349 0.88215361369 + 1.00170843787 0.87019716493 + 1.01172552225 0.85837506905 + 1.02174260663 0.84668574828 + 1.03175969101 0.83512778011 + 1.04177677539 0.82369976047 + 1.05179385977 0.81240029998 + 1.06181094414 0.80122802731 + 1.07182802852 0.79018158662 + 1.08184511290 0.77925963782 + 1.09186219728 0.76846085638 + 1.10187928166 0.75778393324 + 1.11189636604 0.74722757461 + 1.12191345042 0.73679050182 + 1.13193053479 0.72647145120 + 1.14194761917 0.71626917388 + 1.15196470355 0.70618243563 + 1.16198178793 0.69621001674 + 1.17199887231 0.68635071184 + 1.18201595669 0.67660332972 + 1.19203304107 0.66696669323 + 1.20205012545 0.65743963907 + 1.21206720982 0.64802101767 + 1.22208429420 0.63870969302 + 1.23210137858 0.62950454252 + 1.24211846296 0.62040445682 + 1.25213554734 0.61140833969 + 1.26215263172 0.60251510783 + 1.27216971610 0.59372369076 + 1.28218680048 0.58503303063 + 1.29220388485 0.57644208213 + 1.30222096923 0.56794981227 + 1.31223805361 0.55955520029 + 1.32225513799 0.55125723748 + 1.33227222237 0.54305492707 + 1.34228930675 0.53494728403 + 1.35230639113 0.52693333499 + 1.36232347551 0.51901211807 + 1.37234055988 0.51118268274 + 1.38235764426 0.50344408966 + 1.39237472864 0.49579541060 + 1.40239181302 0.48823572824 + 1.41240889740 0.48076413607 + 1.42242598178 0.47337973827 + 1.43244306616 0.46608164953 + 1.44246015053 0.45886899495 + 1.45247723491 0.45174090991 + 1.46249431929 0.44469653994 + 1.47251140367 0.43773504058 + 1.48252848805 0.43085557726 + 1.49254557243 0.42405732518 + 1.50256265681 0.41733946918 + 1.51257974119 0.41070120363 + 1.52259682556 0.40414173230 + 1.53261390994 0.39766026822 + 1.54263099432 0.39125603360 + 1.55264807870 0.38492825968 + 1.56266516308 0.37867618666 + 1.57268224746 0.37249906352 + 1.58269933184 0.36639614795 + 1.59271641622 0.36036670623 + 1.60273350059 0.35441001313 + 1.61275058497 0.34852535179 + 1.62276766935 0.34271201358 + 1.63278475373 0.33696929808 + 1.64280183811 0.33129651286 + 1.65281892249 0.32569297349 + 1.66283600687 0.32015800335 + 1.67285309125 0.31469093359 + 1.68287017562 0.30929110296 + 1.69288726000 0.30395785780 + 1.70290434438 0.29869055188 + 1.71292142876 0.29348854632 + 1.72293851314 0.28835120948 + 1.73295559752 0.28327791691 + 1.74297268190 0.27826805122 + 1.75298976628 0.27332100200 + 1.76300685065 0.26843616571 + 1.77302393503 0.26361294563 + 1.78304101941 0.25885075176 + 1.79305810379 0.25414900071 + 1.80307518817 0.24950711564 + 1.81309227255 0.24492452616 + 1.82310935693 0.24040066827 + 1.83312644130 0.23593498425 + 1.84314352568 0.23152692259 + 1.85316061006 0.22717593793 + 1.86317769444 0.22288149096 + 1.87319477882 0.21864304834 + 1.88321186320 0.21446008265 + 1.89322894758 0.21033207228 + 1.90324603196 0.20625850139 + 1.91326311633 0.20223885982 + 1.92328020071 0.19827264300 + 1.93329728509 0.19435935194 + 1.94331436947 0.19049849308 + 1.95333145385 0.18668957829 + 1.96334853823 0.18293212477 + 1.97336562261 0.17922565498 + 1.98338270699 0.17556969659 + 1.99339979136 0.17196378240 + 2.00341687574 0.16840745031 + 2.01343396012 0.16490024320 + 2.02345104450 0.16144170892 + 2.03346812888 0.15803140022 + 2.04348521326 0.15466887466 + 2.05350229764 0.15135369459 + 2.06351938202 0.14808542705 + 2.07353646639 0.14486364378 + 2.08355355077 0.14168792108 + 2.09357063515 0.13855783981 + 2.10358771953 0.13547298532 + 2.11360480391 0.13243294741 + 2.12362188829 0.12943732026 + 2.13363897267 0.12648570236 + 2.14365605704 0.12357769651 + 2.15367314142 0.12071290973 + 2.16369022580 0.11789095322 + 2.17370731018 0.11511144231 + 2.18372439456 0.11237399643 + 2.19374147894 0.10967823901 + 2.20375856332 0.10702379751 + 2.21377564770 0.10441030331 + 2.22379273207 0.10183739170 + 2.23380981645 0.09930470180 + 2.24382690083 0.09681187657 + 2.25384398521 0.09435856271 + 2.26386106959 0.09194441066 + 2.27387815397 0.08956907452 + 2.28389523835 0.08723221205 + 2.29391232273 0.08493348459 + 2.30392940710 0.08267255705 + 2.31394649148 0.08044909785 + 2.32396357586 0.07826277888 + 2.33398066024 0.07611327549 + 2.34399774462 0.07400026640 + 2.35401482900 0.07192343372 + 2.36403191338 0.06988246288 + 2.37404899776 0.06787704259 + 2.38406608213 0.06590686481 + 2.39408316651 0.06397162473 + 2.40410025089 0.06207102072 + 2.41411733527 0.06020475429 + 2.42413441965 0.05837253008 + 2.43415150403 0.05657405577 + 2.44416858841 0.05480904213 + 2.45418567279 0.05307720292 + 2.46420275716 0.05137825489 + 2.47421984154 0.04971191773 + 2.48423692592 0.04807791406 + 2.49425401030 0.04647596936 + 2.50427109468 0.04490581200 + 2.51428817906 0.04336717315 + 2.52430526344 0.04185978677 + 2.53432234781 0.04038338961 + 2.54433943219 0.03893772113 + 2.55435651657 0.03752252352 + 2.56437360095 0.03613754163 + 2.57439068533 0.03478252296 + 2.58440776971 0.03345721765 + 2.59442485409 0.03216137840 + 2.60444193847 0.03089476052 + 2.61445902284 0.02965712183 + 2.62447610722 0.02844822267 + 2.63449319160 0.02726782587 + 2.64451027598 0.02611569671 + 2.65452736036 0.02499160294 + 2.66454444474 0.02389531467 + 2.67456152912 0.02282660444 + 2.68457861350 0.02178524711 + 2.69459569787 0.02077101992 + 2.70461278225 0.01978370238 + 2.71462986663 0.01882307631 + 2.72464695101 0.01788892579 + 2.73466403539 0.01698103714 + 2.74468111977 0.01609919889 + 2.75469820415 0.01524320177 + 2.76471528853 0.01441283868 + 2.77473237290 0.01360790467 + 2.78474945728 0.01282819691 + 2.79476654166 0.01207351469 + 2.80478362604 0.01134365937 + 2.81480071042 0.01063843436 + 2.82481779480 0.00995764514 + 2.83483487918 0.00930109918 + 2.84485196356 0.00866860596 + 2.85486904793 0.00805997694 + 2.86488613231 0.00747502552 + 2.87490321669 0.00691356706 + 2.88492030107 0.00637541883 + 2.89493738545 0.00586039998 + 2.90495446983 0.00536833154 + 2.91497155421 0.00489903642 + 2.92498863858 0.00445233935 + 2.93500572296 0.00402806688 + 2.94502280734 0.00362604736 + 2.95503989172 0.00324611092 + 2.96505697610 0.00288808946 + 2.97507406048 0.00255181661 + 2.98509114486 0.00223712775 + 2.99510822924 0.00194385995 + 3.00512531361 0.00167185197 + 3.01514239799 0.00142094425 + 3.02515948237 0.00119097888 + 3.03517656675 0.00098179961 + 3.04519365113 0.00079325177 + 3.05521073551 0.00062518232 + 3.06522781989 0.00047743981 + 3.07524490427 0.00034987436 + 3.08526198864 0.00024233763 + 3.09527907302 0.00015468283 + 3.10529615740 0.00008676457 + 3.11531324178 0.00003843916 + 3.12533032616 0.00000956450 + 3.13534741054 0.00000000000 + 1 2 1 1 0.000000 #orbital l, n, z, is_polarized, population + 673 0.0100108094935117 6.7272639796398339 + 0.00000000000 1.83780030200 + 0.01001080949 1.75846471869 + 0.02002161899 1.70600224002 + 0.03003242848 1.66528707723 + 0.04004323797 1.63051344663 + 0.05005404747 1.59944492356 + 0.06006485696 1.57094489798 + 0.07007566645 1.54434711146 + 0.08008647595 1.51922525583 + 0.09009728544 1.49529000533 + 0.10010809494 1.47233656361 + 0.11011890443 1.45021531196 + 0.12012971392 1.42881417156 + 0.13014052342 1.40804739516 + 0.14015133291 1.38784811920 + 0.15016214240 1.36816323504 + 0.16017295190 1.34894975737 + 0.17018376139 1.33017219846 + 0.18019457088 1.31180064296 + 0.19020538038 1.29380932619 + 0.20021618987 1.27617558417 + 0.21022699936 1.25887908433 + 0.22023780886 1.24190127175 + 0.23024861835 1.22522498248 + 0.24025942784 1.20883418684 + 0.25027023734 1.19271383318 + 0.26028104683 1.17684976822 + 0.27029185632 1.16122871376 + 0.28030266582 1.14583828299 + 0.29031347531 1.13066702199 + 0.30032428481 1.11570446411 + 0.31033509430 1.10094118707 + 0.32034590379 1.08636886426 + 0.33035671329 1.07198030353 + 0.34036752278 1.05776946845 + 0.35037833227 1.04373147849 + 0.36038914177 1.02986258611 + 0.37039995126 1.01616013014 + 0.38041076075 1.00262246609 + 0.39042157025 0.98924887505 + 0.40043237974 0.97603945391 + 0.41044318923 0.96299499020 + 0.42045399873 0.95011682572 + 0.43046480822 0.93740671307 + 0.44047561771 0.92486666970 + 0.45048642721 0.91249883395 + 0.46049723670 0.90030532736 + 0.47050804620 0.88828812708 + 0.48051885569 0.87644895196 + 0.49052966518 0.86478916495 + 0.50054047468 0.85330969407 + 0.51055128417 0.84201097332 + 0.52056209366 0.83089290416 + 0.53057290316 0.81995483740 + 0.54058371265 0.80919557485 + 0.55059452214 0.79861338914 + 0.56060533164 0.78820605974 + 0.57061614113 0.77797092288 + 0.58062695062 0.76790493225 + 0.59063776012 0.75800472795 + 0.60064856961 0.74826671005 + 0.61065937910 0.73868711418 + 0.62067018860 0.72926208586 + 0.63068099809 0.71998775105 + 0.64069180758 0.71086028055 + 0.65070261708 0.70187594622 + 0.66071342657 0.69303116758 + 0.67072423607 0.68432254771 + 0.68073504556 0.67574689786 + 0.69074585505 0.66730125095 + 0.70075666455 0.65898286392 + 0.71076747404 0.65078921050 + 0.72077828353 0.64271794120 + 0.73078909303 0.63476678748 + 0.74079990252 0.62693352307 + 0.75081071201 0.61921596984 + 0.76082152151 0.61161199542 + 0.77083233100 0.60411951237 + 0.78084314049 0.59673647728 + 0.79085394999 0.58946088984 + 0.80086475948 0.58229079212 + 0.81087556897 0.57522426772 + 0.82088637847 0.56825944108 + 0.83089718796 0.56139447676 + 0.84090799745 0.55462757875 + 0.85091880695 0.54795698981 + 0.86092961644 0.54138099083 + 0.87094042594 0.53489790011 + 0.88095123543 0.52850607276 + 0.89096204492 0.52220390002 + 0.90097285442 0.51598980859 + 0.91098366391 0.50986225996 + 0.92099447340 0.50381974972 + 0.93100528290 0.49786080685 + 0.94101609239 0.49198399302 + 0.95102690188 0.48618790188 + 0.96103771138 0.48047115828 + 0.97104852087 0.47483241756 + 0.98105933036 0.46927036481 + 0.99107013986 0.46378371405 + 1.00108094935 0.45837120748 + 1.01109175884 0.45303161479 + 1.02110256834 0.44776373235 + 1.03111337783 0.44256638219 + 1.04112418733 0.43743841149 + 1.05113499682 0.43237869200 + 1.06114580631 0.42738611919 + 1.07115661581 0.42245961147 + 1.08116742530 0.41759810970 + 1.09117823479 0.41280057651 + 1.10118904429 0.40806599572 + 1.11119985378 0.40339337179 + 1.12121066327 0.39878172921 + 1.13122147277 0.39423011204 + 1.14123228226 0.38973758333 + 1.15124309175 0.38530322466 + 1.16125390125 0.38092613567 + 1.17126471074 0.37660543356 + 1.18127552023 0.37234025268 + 1.19128632973 0.36812974406 + 1.20129713922 0.36397307505 + 1.21130794871 0.35986942885 + 1.22131875821 0.35581800415 + 1.23132956770 0.35181801477 + 1.24134037720 0.34786868926 + 1.25135118669 0.34396927057 + 1.26136199618 0.34011901567 + 1.27137280568 0.33631719526 + 1.28138361517 0.33256309343 + 1.29139442466 0.32885600735 + 1.30140523416 0.32519524693 + 1.31141604365 0.32158013459 + 1.32142685314 0.31801000491 + 1.33143766264 0.31448420441 + 1.34144847213 0.31100209124 + 1.35145928162 0.30756303490 + 1.36147009112 0.30416641606 + 1.37148090061 0.30081162625 + 1.38149171010 0.29749806762 + 1.39150251960 0.29422515274 + 1.40151332909 0.29099230435 + 1.41152413859 0.28779895515 + 1.42153494808 0.28464454756 + 1.43154575757 0.28152853355 + 1.44155656707 0.27845037441 + 1.45156737656 0.27540954055 + 1.46157818605 0.27240551132 + 1.47158899555 0.26943777482 + 1.48159980504 0.26650582770 + 1.49161061453 0.26360917502 + 1.50162142403 0.26074733003 + 1.51163223352 0.25791981402 + 1.52164304301 0.25512615617 + 1.53165385251 0.25236589338 + 1.54166466200 0.24963857009 + 1.55167547149 0.24694373817 + 1.56168628099 0.24428095673 + 1.57169709048 0.24164979200 + 1.58170789997 0.23904981718 + 1.59171870947 0.23648061230 + 1.60172951896 0.23394176410 + 1.61174032846 0.23143286588 + 1.62175113795 0.22895351736 + 1.63176194744 0.22650332460 + 1.64177275694 0.22408189983 + 1.65178356643 0.22168886136 + 1.66179437592 0.21932383345 + 1.67180518542 0.21698644621 + 1.68181599491 0.21467633545 + 1.69182680440 0.21239314263 + 1.70183761390 0.21013651472 + 1.71184842339 0.20790610408 + 1.72185923288 0.20570156840 + 1.73187004238 0.20352257056 + 1.74188085187 0.20136877857 + 1.75189166136 0.19923986545 + 1.76190247086 0.19713550916 + 1.77191328035 0.19505539246 + 1.78192408985 0.19299920289 + 1.79193489934 0.19096663264 + 1.80194570883 0.18895737848 + 1.81195651833 0.18697114167 + 1.82196732782 0.18500762788 + 1.83197813731 0.18306654711 + 1.84198894681 0.18114761363 + 1.85199975630 0.17925054589 + 1.86201056579 0.17737506644 + 1.87202137529 0.17552090186 + 1.88203218478 0.17368778271 + 1.89204299427 0.17187544342 + 1.90205380377 0.17008362228 + 1.91206461326 0.16831206132 + 1.92207542275 0.16656050626 + 1.93208623225 0.16482870648 + 1.94209704174 0.16311641489 + 1.95210785123 0.16142338795 + 1.96211866073 0.15974938554 + 1.97212947022 0.15809417096 + 1.98214027972 0.15645751080 + 1.99215108921 0.15483917498 + 2.00216189870 0.15323893660 + 2.01217270820 0.15165657196 + 2.02218351769 0.15009186047 + 2.03219432718 0.14854458459 + 2.04220513668 0.14701452981 + 2.05221594617 0.14550148460 + 2.06222675566 0.14400524031 + 2.07223756516 0.14252559118 + 2.08224837465 0.14106233429 + 2.09225918414 0.13961526948 + 2.10226999364 0.13818419932 + 2.11228080313 0.13676892908 + 2.12229161262 0.13536926667 + 2.13230242212 0.13398502261 + 2.14231323161 0.13261600997 + 2.15232404111 0.13126204438 + 2.16233485060 0.12992294390 + 2.17234566009 0.12859852908 + 2.18235646959 0.12728862285 + 2.19236727908 0.12599305053 + 2.20237808857 0.12471163975 + 2.21238889807 0.12344422045 + 2.22239970756 0.12219062483 + 2.23241051705 0.12095068731 + 2.24242132655 0.11972424452 + 2.25243213604 0.11851113522 + 2.26244294553 0.11731120034 + 2.27245375503 0.11612428285 + 2.28246456452 0.11495022784 + 2.29247537401 0.11378888238 + 2.30248618351 0.11264009558 + 2.31249699300 0.11150371851 + 2.32250780249 0.11037960418 + 2.33251861199 0.10926760751 + 2.34252942148 0.10816758532 + 2.35254023098 0.10707939627 + 2.36255104047 0.10600290088 + 2.37256184996 0.10493796143 + 2.38257265946 0.10388444203 + 2.39258346895 0.10284220849 + 2.40259427844 0.10181112840 + 2.41260508794 0.10079107101 + 2.42261589743 0.09978190727 + 2.43262670692 0.09878350977 + 2.44263751642 0.09779575274 + 2.45264832591 0.09681851201 + 2.46265913540 0.09585166502 + 2.47266994490 0.09489509072 + 2.48268075439 0.09394866965 + 2.49269156388 0.09301228384 + 2.50270237338 0.09208581683 + 2.51271318287 0.09116915363 + 2.52272399236 0.09026218069 + 2.53273480186 0.08936478592 + 2.54274561135 0.08847685865 + 2.55275642085 0.08759828956 + 2.56276723034 0.08672897076 + 2.57277803983 0.08586879568 + 2.58278884933 0.08501765910 + 2.59279965882 0.08417545713 + 2.60281046831 0.08334208717 + 2.61282127781 0.08251744790 + 2.62283208730 0.08170143928 + 2.63284289679 0.08089396252 + 2.64285370629 0.08009492003 + 2.65286451578 0.07930421548 + 2.66287532527 0.07852175372 + 2.67288613477 0.07774744077 + 2.68289694426 0.07698118384 + 2.69290775375 0.07622289127 + 2.70291856325 0.07547247255 + 2.71292937274 0.07472983829 + 2.72294018224 0.07399490020 + 2.73295099173 0.07326757109 + 2.74296180122 0.07254776482 + 2.75297261072 0.07183539635 + 2.76298342021 0.07113038166 + 2.77299422970 0.07043263778 + 2.78300503920 0.06974208274 + 2.79301584869 0.06905863559 + 2.80302665818 0.06838221639 + 2.81303746768 0.06771274614 + 2.82304827717 0.06705014685 + 2.83305908666 0.06639434145 + 2.84306989616 0.06574525383 + 2.85308070565 0.06510280881 + 2.86309151514 0.06446693212 + 2.87310232464 0.06383755041 + 2.88311313413 0.06321459119 + 2.89312394362 0.06259798289 + 2.90313475312 0.06198765479 + 2.91314556261 0.06138353704 + 2.92315637211 0.06078556062 + 2.93316718160 0.06019365737 + 2.94317799109 0.05960775993 + 2.95318880059 0.05902780179 + 2.96319961008 0.05845371720 + 2.97321041957 0.05788544124 + 2.98322122907 0.05732290976 + 2.99323203856 0.05676605939 + 3.00324284805 0.05621482752 + 3.01325365755 0.05566915228 + 3.02326446704 0.05512897256 + 3.03327527653 0.05459422799 + 3.04328608603 0.05406485891 + 3.05329689552 0.05354080639 + 3.06330770501 0.05302201218 + 3.07331851451 0.05250841877 + 3.08332932400 0.05199996930 + 3.09334013350 0.05149660760 + 3.10335094299 0.05099827819 + 3.11336175248 0.05050492622 + 3.12337256198 0.05001649752 + 3.13338337147 0.04953293855 + 3.14339418096 0.04905419642 + 3.15340499046 0.04858021886 + 3.16341579995 0.04811095422 + 3.17342660944 0.04764635147 + 3.18343741894 0.04718636017 + 3.19344822843 0.04673093050 + 3.20345903792 0.04628001322 + 3.21346984742 0.04583355965 + 3.22348065691 0.04539152173 + 3.23349146640 0.04495385192 + 3.24350227590 0.04452050328 + 3.25351308539 0.04409142940 + 3.26352389488 0.04366658442 + 3.27353470438 0.04324592302 + 3.28354551387 0.04282940042 + 3.29355632337 0.04241697235 + 3.30356713286 0.04200859508 + 3.31357794235 0.04160422536 + 3.32358875185 0.04120382048 + 3.33359956134 0.04080733822 + 3.34361037083 0.04041473684 + 3.35362118033 0.04002597509 + 3.36363198982 0.03964101221 + 3.37364279931 0.03925980791 + 3.38365360881 0.03888232237 + 3.39366441830 0.03850851624 + 3.40367522779 0.03813835060 + 3.41368603729 0.03777178700 + 3.42369684678 0.03740878745 + 3.43370765627 0.03704931438 + 3.44371846577 0.03669333064 + 3.45372927526 0.03634079955 + 3.46374008476 0.03599168481 + 3.47375089425 0.03564595058 + 3.48376170374 0.03530356139 + 3.49377251324 0.03496448220 + 3.50378332273 0.03462867838 + 3.51379413222 0.03429611569 + 3.52380494172 0.03396676027 + 3.53381575121 0.03364057866 + 3.54382656070 0.03331753778 + 3.55383737020 0.03299760492 + 3.56384817969 0.03268074777 + 3.57385898918 0.03236693435 + 3.58386979868 0.03205613307 + 3.59388060817 0.03174831270 + 3.60389141766 0.03144344234 + 3.61390222716 0.03114149146 + 3.62391303665 0.03084242988 + 3.63392384614 0.03054622775 + 3.64393465564 0.03025285557 + 3.65394546513 0.02996228415 + 3.66395627463 0.02967448465 + 3.67396708412 0.02938942855 + 3.68397789361 0.02910708764 + 3.69398870311 0.02882743405 + 3.70399951260 0.02855044020 + 3.71401032209 0.02827607882 + 3.72402113159 0.02800432297 + 3.73403194108 0.02773514599 + 3.74404275057 0.02746852151 + 3.75405356007 0.02720442347 + 3.76406436956 0.02694282611 + 3.77407517905 0.02668370392 + 3.78408598855 0.02642703172 + 3.79409679804 0.02617278457 + 3.80410760753 0.02592093782 + 3.81411841703 0.02567146711 + 3.82412922652 0.02542434832 + 3.83414003601 0.02517955762 + 3.84415084551 0.02493707143 + 3.85416165500 0.02469686643 + 3.86417246450 0.02445891956 + 3.87418327399 0.02422320802 + 3.88419408348 0.02398970925 + 3.89420489298 0.02375840094 + 3.90421570247 0.02352926102 + 3.91422651196 0.02330226767 + 3.92423732146 0.02307739931 + 3.93424813095 0.02285463458 + 3.94425894044 0.02263395237 + 3.95426974994 0.02241533179 + 3.96428055943 0.02219875217 + 3.97429136892 0.02198419308 + 3.98430217842 0.02177163431 + 3.99431298791 0.02156105585 + 4.00432379740 0.02135243793 + 4.01433460690 0.02114576098 + 4.02434541639 0.02094100564 + 4.03435622589 0.02073815276 + 4.04436703538 0.02053718340 + 4.05437784487 0.02033807883 + 4.06438865437 0.02014082050 + 4.07439946386 0.01994539008 + 4.08441027335 0.01975176941 + 4.09442108285 0.01955994056 + 4.10443189234 0.01936988576 + 4.11444270183 0.01918158745 + 4.12445351133 0.01899502824 + 4.13446432082 0.01881019094 + 4.14447513031 0.01862705853 + 4.15448593981 0.01844561417 + 4.16449674930 0.01826584122 + 4.17450755879 0.01808772319 + 4.18451836829 0.01791124377 + 4.19452917778 0.01773638683 + 4.20453998727 0.01756313641 + 4.21455079677 0.01739147672 + 4.22456160626 0.01722139211 + 4.23457241576 0.01705286712 + 4.24458322525 0.01688588646 + 4.25459403474 0.01672043498 + 4.26460484424 0.01655649768 + 4.27461565373 0.01639405975 + 4.28462646322 0.01623310650 + 4.29463727272 0.01607362342 + 4.30464808221 0.01591559613 + 4.31465889170 0.01575901042 + 4.32466970120 0.01560385221 + 4.33468051069 0.01545010757 + 4.34469132018 0.01529776271 + 4.35470212968 0.01514680400 + 4.36471293917 0.01499721794 + 4.37472374866 0.01484899117 + 4.38473455816 0.01470211045 + 4.39474536765 0.01455656271 + 4.40475617715 0.01441233498 + 4.41476698664 0.01426941446 + 4.42477779613 0.01412778845 + 4.43478860563 0.01398744439 + 4.44479941512 0.01384836985 + 4.45481022461 0.01371055253 + 4.46482103411 0.01357398024 + 4.47483184360 0.01343864095 + 4.48484265309 0.01330452271 + 4.49485346259 0.01317161371 + 4.50486427208 0.01303990227 + 4.51487508157 0.01290937682 + 4.52488589107 0.01278002589 + 4.53489670056 0.01265183815 + 4.54490751005 0.01252480238 + 4.55491831955 0.01239890747 + 4.56492912904 0.01227414242 + 4.57493993853 0.01215049633 + 4.58495074803 0.01202795844 + 4.59496155752 0.01190651808 + 4.60497236702 0.01178616467 + 4.61498317651 0.01166688778 + 4.62499398600 0.01154867703 + 4.63500479550 0.01143152219 + 4.64501560499 0.01131541311 + 4.65502641448 0.01120033974 + 4.66503722398 0.01108629214 + 4.67504803347 0.01097326047 + 4.68505884296 0.01086123498 + 4.69506965246 0.01075020602 + 4.70508046195 0.01064016403 + 4.71509127144 0.01053109956 + 4.72510208094 0.01042300324 + 4.73511289043 0.01031586579 + 4.74512369992 0.01020967804 + 4.75513450942 0.01010443090 + 4.76514531891 0.01000011536 + 4.77515612841 0.00989672252 + 4.78516693790 0.00979424354 + 4.79517774739 0.00969266970 + 4.80518855689 0.00959199234 + 4.81519936638 0.00949220289 + 4.82521017587 0.00939329288 + 4.83522098537 0.00929525390 + 4.84523179486 0.00919807764 + 4.85524260435 0.00910175586 + 4.86525341385 0.00900628041 + 4.87526422334 0.00891164322 + 4.88527503283 0.00881783628 + 4.89528584233 0.00872485168 + 4.90529665182 0.00863268158 + 4.91530746131 0.00854131822 + 4.92531827081 0.00845075390 + 4.93532908030 0.00836098101 + 4.94533988979 0.00827199201 + 4.95535069929 0.00818377943 + 4.96536150878 0.00809633589 + 4.97537231828 0.00800965404 + 4.98538312777 0.00792372666 + 4.99539393726 0.00783854654 + 5.00540474676 0.00775410658 + 5.01541555625 0.00767039973 + 5.02542636574 0.00758741902 + 5.03543717524 0.00750515754 + 5.04544798473 0.00742360844 + 5.05545879422 0.00734276495 + 5.06546960372 0.00726262036 + 5.07548041321 0.00718316802 + 5.08549122270 0.00710440135 + 5.09550203220 0.00702631382 + 5.10551284169 0.00694889899 + 5.11552365118 0.00687215044 + 5.12553446068 0.00679606185 + 5.13554527017 0.00672062695 + 5.14555607966 0.00664583952 + 5.15556688916 0.00657169340 + 5.16557769865 0.00649818249 + 5.17558850815 0.00642530077 + 5.18559931764 0.00635304225 + 5.19561012713 0.00628140100 + 5.20562093663 0.00621037117 + 5.21563174612 0.00613994692 + 5.22564255561 0.00607012252 + 5.23565336511 0.00600089226 + 5.24566417460 0.00593225048 + 5.25567498409 0.00586419160 + 5.26568579359 0.00579671008 + 5.27569660308 0.00572980042 + 5.28570741257 0.00566345718 + 5.29571822207 0.00559767499 + 5.30572903156 0.00553244851 + 5.31573984105 0.00546777245 + 5.32575065055 0.00540364158 + 5.33576146004 0.00534005071 + 5.34577226954 0.00527699471 + 5.35578307903 0.00521446848 + 5.36579388852 0.00515246699 + 5.37580469802 0.00509098524 + 5.38581550751 0.00503001830 + 5.39582631700 0.00496956125 + 5.40583712650 0.00490960924 + 5.41584793599 0.00485015747 + 5.42585874548 0.00479120117 + 5.43586955498 0.00473273562 + 5.44588036447 0.00467475616 + 5.45589117396 0.00461725814 + 5.46590198346 0.00456023698 + 5.47591279295 0.00450368813 + 5.48592360244 0.00444760710 + 5.49593441194 0.00439198941 + 5.50594522143 0.00433683067 + 5.51595603092 0.00428212647 + 5.52596684042 0.00422787249 + 5.53597764991 0.00417406444 + 5.54598845941 0.00412069805 + 5.55599926890 0.00406776910 + 5.56601007839 0.00401527342 + 5.57602088789 0.00396320687 + 5.58603169738 0.00391156535 + 5.59604250687 0.00386034479 + 5.60605331637 0.00380954118 + 5.61606412586 0.00375915051 + 5.62607493535 0.00370916884 + 5.63608574485 0.00365959226 + 5.64609655434 0.00361041689 + 5.65610736383 0.00356163887 + 5.66611817333 0.00351325442 + 5.67612898282 0.00346525974 + 5.68613979231 0.00341765111 + 5.69615060181 0.00337042483 + 5.70616141130 0.00332357722 + 5.71617222080 0.00327710465 + 5.72618303029 0.00323100351 + 5.73619383978 0.00318527024 + 5.74620464928 0.00313990130 + 5.75621545877 0.00309489320 + 5.76622626826 0.00305024244 + 5.77623707776 0.00300594561 + 5.78624788725 0.00296199928 + 5.79625869674 0.00291840009 + 5.80626950624 0.00287514468 + 5.81628031573 0.00283222974 + 5.82629112522 0.00278965199 + 5.83630193472 0.00274740817 + 5.84631274421 0.00270549505 + 5.85632355370 0.00266390944 + 5.86633436320 0.00262264817 + 5.87634517269 0.00258170811 + 5.88635598218 0.00254108614 + 5.89636679168 0.00250077918 + 5.90637760117 0.00246078418 + 5.91638841067 0.00242109812 + 5.92639922016 0.00238171800 + 5.93641002965 0.00234264084 + 5.94642083915 0.00230386370 + 5.95643164864 0.00226538367 + 5.96644245813 0.00222719786 + 5.97645326763 0.00218930339 + 5.98646407712 0.00215169744 + 5.99647488661 0.00211437718 + 6.00648569611 0.00207733984 + 6.01649650560 0.00204058265 + 6.02650731509 0.00200410287 + 6.03651812459 0.00196789779 + 6.04652893408 0.00193196472 + 6.05653974357 0.00189630100 + 6.06655055307 0.00186090399 + 6.07656136256 0.00182577107 + 6.08657217206 0.00179089965 + 6.09658298155 0.00175628716 + 6.10659379104 0.00172193105 + 6.11660460054 0.00168782881 + 6.12661541003 0.00165397793 + 6.13662621952 0.00162037592 + 6.14663702902 0.00158702035 + 6.15664783851 0.00155390877 + 6.16665864800 0.00152103877 + 6.17666945750 0.00148840795 + 6.18668026699 0.00145601396 + 6.19669107648 0.00142385444 + 6.20670188598 0.00139192707 + 6.21671269547 0.00136022954 + 6.22672350496 0.00132875955 + 6.23673431446 0.00129751486 + 6.24674512395 0.00126649321 + 6.25675593344 0.00123569238 + 6.26676674294 0.00120511016 + 6.27677755243 0.00117474437 + 6.28678836193 0.00114459284 + 6.29679917142 0.00111465342 + 6.30680998091 0.00108492399 + 6.31682079041 0.00105540243 + 6.32683159990 0.00102608666 + 6.33684240939 0.00099697460 + 6.34685321889 0.00096806420 + 6.35686402838 0.00093935343 + 6.36687483787 0.00091084026 + 6.37688564737 0.00088252270 + 6.38689645686 0.00085439876 + 6.39690726635 0.00082646649 + 6.40691807585 0.00079872393 + 6.41692888534 0.00077116915 + 6.42693969483 0.00074380024 + 6.43695050433 0.00071661531 + 6.44696131382 0.00068961247 + 6.45697212332 0.00066278986 + 6.46698293281 0.00063614563 + 6.47699374230 0.00060967796 + 6.48700455180 0.00058338502 + 6.49701536129 0.00055726503 + 6.50702617078 0.00053131619 + 6.51703698028 0.00050553674 + 6.52704778977 0.00047992493 + 6.53705859926 0.00045447903 + 6.54706940876 0.00042919730 + 6.55708021825 0.00040407804 + 6.56709102774 0.00037911957 + 6.57710183724 0.00035432020 + 6.58711264673 0.00032967827 + 6.59712345622 0.00030519213 + 6.60713426572 0.00028086016 + 6.61714507521 0.00025668073 + 6.62715588470 0.00023265223 + 6.63716669420 0.00020877308 + 6.64717750369 0.00018504169 + 6.65718831319 0.00016145648 + 6.66719912268 0.00013801592 + 6.67720993217 0.00011471847 + 6.68722074167 0.00009156261 + 6.69723155116 0.00006854685 + 6.70724236065 0.00004566969 + 6.71725317015 0.00002292966 + 6.72726397964 0.00000000000 +# KBs:_______________ + 0 1 -3.4022469484000002 #kb l, n (seq), energy in Ry + 103 0.0100165306087297 1.0216861220904290 + 0.00000000000 3.86570030770 + 0.01001653061 3.88015668924 + 0.02003306122 3.92329938316 + 0.03004959183 3.99445154107 + 0.04006612243 4.09249607089 + 0.05008265304 4.21589168445 + 0.06009918365 4.36269512890 + 0.07011571426 4.53058919260 + 0.08013224487 4.71691607635 + 0.09014877548 4.91871561561 + 0.10016530609 5.13276779622 + 0.11018183670 5.35563892820 + 0.12019836730 5.58373077766 + 0.13021489791 5.81333195088 + 0.14023142852 6.04067074353 + 0.15024795913 6.26196869475 + 0.16026448974 6.47349404534 + 0.17028102035 6.67161433116 + 0.18029755096 6.85284730216 + 0.19031408157 7.01390951818 + 0.20033061217 7.15176178543 + 0.21034714278 7.26365094639 + 0.22036367339 7.34714726285 + 0.23038020400 7.40017702936 + 0.24039673461 7.42104984739 + 0.25041326522 7.40848028197 + 0.26042979583 7.36160356753 + 0.27044632644 7.27998523836 + 0.28046285704 7.16362452603 + 0.29047938765 7.01295160355 + 0.30049591826 6.82881871125 + 0.31051244887 6.61248540022 + 0.32052897948 6.36559816302 + 0.33054551009 6.09016478622 + 0.34056204070 5.78852392183 + 0.35057857131 5.46331032096 + 0.36059510191 5.11741634752 + 0.37061163252 4.75395037539 + 0.38062816313 4.37619272632 + 0.39064469374 3.98754983421 + 0.40066122435 3.59150738082 + 0.41067775496 3.19158305879 + 0.42069428557 2.79127974481 + 0.43071081618 2.39403970757 + 0.44072734678 2.00320058782 + 0.45074387739 1.62195372903 + 0.46076040800 1.25330547486 + 0.47077693861 0.90004195405 + 0.48079346922 0.56469781586 + 0.49080999983 0.24952931250 + 0.50082653044 -0.04350795224 + 0.51084306105 -0.31277637177 + 0.52085959165 -0.55696862859 + 0.53087612226 -0.77511485958 + 0.54089265287 -0.96658471089 + 0.55090918348 -1.13108438071 + 0.56092571409 -1.26864883138 + 0.57094224470 -1.37962942592 + 0.58095877531 -1.46467731771 + 0.59097530592 -1.52472298608 + 0.60099183652 -1.56095236745 + 0.61100836713 -1.57478007985 + 0.62102489774 -1.56782028323 + 0.63104142835 -1.54185573728 + 0.64105795896 -1.49880565324 + 0.65107448957 -1.44069293268 + 0.66109102018 -1.36961139134 + 0.67110755078 -1.28769355774 + 0.68112408139 -1.19707961135 + 0.69114061200 -1.09988799353 + 0.70115714261 -0.99818818082 + 0.71117367322 -0.89397615228 + 0.72119020383 -0.78914624980 + 0.73120673444 -0.68545470918 + 0.74122326505 -0.58449416520 + 0.75123979565 -0.48767763400 + 0.76125632626 -0.39622591782 + 0.77127285687 -0.31115905911 + 0.78128938748 -0.23329170740 + 0.79130591809 -0.16323233794 + 0.80132244870 -0.10138618439 + 0.81133897931 -0.04796168674 + 0.82135550992 -0.00298020040 + 0.83137204052 0.03371134049 + 0.84138857113 0.06242515296 + 0.85140510174 0.08361511537 + 0.86142163235 0.09785747224 + 0.87143816296 0.10583016929 + 0.88145469357 0.10829126673 + 0.89147122418 0.10605688275 + 0.90148775479 0.09997911474 + 0.91150428539 0.09092437351 + 0.92152081600 0.07975254524 + 0.93153734661 0.06729736867 + 0.94155387722 0.05434838106 + 0.95157040783 0.04163474624 + 0.96158693844 0.02981123369 + 0.97160346905 0.01944656620 + 0.98161999966 0.01101430792 + 0.99163653026 0.00487103566 + 1.00165306087 0.00137527857 + 1.01166959148 0.00036161876 + 1.02168612209 0.00000000000 + 0 2 -1.0689678359999999 #kb l, n (seq), energy in Ry + 103 0.0100165306087297 1.0216861220904290 + 0.00000000000 10.23583975500 + 0.01001653061 10.20688776968 + 0.02003306122 10.12039224494 + 0.03004959183 9.97742972601 + 0.04006612243 9.77977732329 + 0.05008265304 9.52988742590 + 0.06009918365 9.23085276265 + 0.07011571426 8.88636242954 + 0.08013224487 8.50064950314 + 0.09014877548 8.07843105093 + 0.10016530609 7.62484145389 + 0.11018183670 7.14536003823 + 0.12019836730 6.64573410599 + 0.13021489791 6.13189852662 + 0.14023142852 5.60989309778 + 0.15024795913 5.08577890719 + 0.16026448974 4.56555494587 + 0.17028102035 4.05507620722 + 0.18029755096 3.55997448549 + 0.19031408157 3.08558303692 + 0.20033061217 2.63686619633 + 0.21034714278 2.21835497124 + 0.22036367339 1.83408953040 + 0.23038020400 1.48756939143 + 0.24039673461 1.18171199711 + 0.25041326522 0.91882022486 + 0.26042979583 0.70055924147 + 0.27044632644 0.52794296445 + 0.28046285704 0.40133023740 + 0.29047938765 0.32043068495 + 0.30049591826 0.28432004936 + 0.31051244887 0.29146467778 + 0.32052897948 0.33975468124 + 0.33054551009 0.42654515908 + 0.34056204070 0.54870476158 + 0.35057857131 0.70267075338 + 0.36059510191 0.88450965180 + 0.37061163252 1.08998242919 + 0.38062816313 1.31461321302 + 0.39064469374 1.55376037291 + 0.40066122435 1.80268885314 + 0.41067775496 2.05664261532 + 0.42069428557 2.31091605129 + 0.43071081618 2.56092327223 + 0.44072734678 2.80226422539 + 0.45074387739 3.03078663373 + 0.46076040800 3.24264288500 + 0.47077693861 3.43434101732 + 0.48079346922 3.60278914633 + 0.49080999983 3.74533269743 + 0.50082653044 3.85978402504 + 0.51084306105 3.94444407260 + 0.52085959165 3.99811588107 + 0.53087612226 4.02010991284 + 0.54089265287 4.01024125576 + 0.55090918348 3.96881895069 + 0.56092571409 3.89662776869 + 0.57094224470 3.79490294117 + 0.58095877531 3.66529840565 + 0.59097530592 3.50984926856 + 0.60099183652 3.33092925291 + 0.61100836713 3.13120399076 + 0.62102489774 2.91358107196 + 0.63104142835 2.68115778291 + 0.64105795896 2.43716754124 + 0.65107448957 2.18492599799 + 0.66109102018 1.92777778750 + 0.67110755078 1.66904488566 + 0.68112408139 1.41197748307 + 0.69114061200 1.15970822508 + 0.70115714261 0.91521059560 + 0.71117367322 0.68126230607 + 0.72119020383 0.46039779706 + 0.73120673444 0.25484067388 + 0.74122326505 0.06646542645 + 0.75123979565 -0.10321912396 + 0.76125632626 -0.25308094764 + 0.77127285687 -0.38236897655 + 0.78128938748 -0.49071074318 + 0.79130591809 -0.57810364429 + 0.80132244870 -0.64490012465 + 0.81133897931 -0.69178717503 + 0.82135550992 -0.71976063281 + 0.83137204052 -0.73009485633 + 0.84138857113 -0.72430841445 + 0.85140510174 -0.70412649079 + 0.86142163235 -0.67144074729 + 0.87143816296 -0.62826742338 + 0.88145469357 -0.57670446205 + 0.89147122418 -0.51888845784 + 0.90148775479 -0.45695220826 + 0.91150428539 -0.39298362541 + 0.92152081600 -0.32898672498 + 0.93153734661 -0.26684535780 + 0.94155387722 -0.20829028894 + 0.95157040783 -0.15487015434 + 0.96158693844 -0.10792674683 + 0.97160346905 -0.06857499170 + 0.98161999966 -0.03768788917 + 0.99163653026 -0.01584063871 + 1.00165306087 -0.00367289735 + 1.01166959148 -0.00031943189 + 1.02168612209 0.00000000000 + 1 1 -1.0066422298000000 #kb l, n (seq), energy in Ry + 72 0.0100610607287875 0.7143353117439144 + 0.00000000000 -93.80393988937 + 0.01006106073 -93.49508177756 + 0.02012212146 -92.57473843649 + 0.03018318219 -91.06149194724 + 0.04024424292 -88.98573267503 + 0.05030530364 -86.38883037742 + 0.06036636437 -83.32200165012 + 0.07042742510 -79.84491642561 + 0.08048848583 -76.02408623897 + 0.09054954656 -71.93108497393 + 0.10061060729 -67.64065692282 + 0.11067166802 -63.22877034051 + 0.12073272875 -58.77067547415 + 0.13079378947 -54.33902560585 + 0.14085485020 -50.00211630260 + 0.15091591093 -45.82229392363 + 0.16097697166 -41.85457804754 + 0.17103803239 -38.14553453890 + 0.18109909312 -34.73242818139 + 0.19116015385 -31.64267273185 + 0.20122121458 -28.89358823720 + 0.21128227530 -26.49246315963 + 0.22134333603 -24.43691111883 + 0.23140439676 -22.71550105702 + 0.24146545749 -21.30863231828 + 0.25152651822 -20.18961861681 + 0.26158757895 -19.32593861696 + 0.27164863968 -18.68060734162 + 0.28170970041 -18.21361944775 + 0.29177076113 -17.88341479028 + 0.30183182186 -17.64831760123 + 0.31189288259 -17.46790310391 + 0.32195394332 -17.30424937442 + 0.33201500405 -17.12303793360 + 0.34207606478 -16.89447260283 + 0.35213712551 -16.59399412106 + 0.36219818624 -16.20277540465 + 0.37225924697 -15.70799088784 + 0.38232030769 -15.10286140415 + 0.39238136842 -14.38648391656 + 0.40244242915 -13.56346263738 + 0.41250348988 -12.64336443866 + 0.42256455061 -11.64002669469 + 0.43262561134 -10.57074999614 + 0.44268667207 -9.45541064234 + 0.45274773280 -8.31552944162 + 0.46280879352 -7.17333320040 + 0.47286985425 -6.05084392982 + 0.48293091498 -4.96902825792 + 0.49299197571 -3.94703567101 + 0.50305303644 -3.00154977882 + 0.51311409717 -2.14627118827 + 0.52317515790 -1.39154495912 + 0.53323621863 -0.74413933668 + 0.54329727935 -0.20717648043 + 0.55335834008 0.21979004628 + 0.56341940081 0.54056158546 + 0.57348046154 0.76195996262 + 0.58354152227 0.89339158922 + 0.59360258300 0.94633264298 + 0.60366364373 0.93375959343 + 0.61372470446 0.86955071434 + 0.62378576518 0.76788373820 + 0.63384682591 0.64265411052 + 0.64390788664 0.50693609126 + 0.65396894737 0.37250613905 + 0.66403000810 0.24944476905 + 0.67409106883 0.14582884363 + 0.68415212956 0.06752216216 + 0.69421319029 0.01801437429 + 0.70427425102 -0.00111961563 + 0.71433531174 0.00000000000 +# Vna:_______________ + 673 0.01001080949 6.72726397964 # npts, delta, cutoff + 0.00000000000 -2.21185752254 + 0.01001080949 -2.21104062950 + 0.02002161899 -2.20859555836 + 0.03003242848 -2.20453850723 + 0.04004323797 -2.19889588455 + 0.05005404747 -2.19170343038 + 0.06006485696 -2.18300506642 + 0.07007566645 -2.17285155282 + 0.08008647595 -2.16129903008 + 0.09009728544 -2.14840752402 + 0.10010809494 -2.13423949053 + 0.11011890443 -2.11885846440 + 0.12012971392 -2.10232786513 + 0.13014052342 -2.08470999283 + 0.14015133291 -2.06606523549 + 0.15016214240 -2.04645149189 + 0.16017295190 -2.02592380154 + 0.17018376139 -2.00453416565 + 0.18019457088 -1.98233153321 + 0.19020538038 -1.95936192536 + 0.20021618987 -1.93566866714 + 0.21022699936 -1.91129269764 + 0.22023780886 -1.88627293210 + 0.23024861835 -1.86064665001 + 0.24025942784 -1.83444989010 + 0.25027023734 -1.80771783429 + 0.26028104683 -1.78048516677 + 0.27029185632 -1.75278639938 + 0.28030266582 -1.72465615506 + 0.29031347531 -1.69612940549 + 0.30032428481 -1.66724166026 + 0.31033509430 -1.63802910772 + 0.32034590379 -1.60852870695 + 0.33035671329 -1.57877823427 + 0.34036752278 -1.54881628625 + 0.35037833227 -1.51868224242 + 0.36038914177 -1.48841619179 + 0.37039995126 -1.45805882737 + 0.38041076075 -1.42765131295 + 0.39042157025 -1.39723512591 + 0.40043237974 -1.36685188246 + 0.41044318923 -1.33654314738 + 0.42045399873 -1.30635023442 + 0.43046480822 -1.27631400146 + 0.44047561771 -1.24647464330 + 0.45048642721 -1.21687148778 + 0.46049723670 -1.18754279604 + 0.47050804620 -1.15852557253 + 0.48051885569 -1.12985538460 + 0.49052966518 -1.10156619553 + 0.50054047468 -1.07369021026 + 0.51055128417 -1.04625773560 + 0.52056209366 -1.01929705416 + 0.53057290316 -0.99283431114 + 0.54058371265 -0.96689341357 + 0.55059452214 -0.94149593823 + 0.56060533164 -0.91666104887 + 0.57061614113 -0.89240541814 + 0.58062695062 -0.86874315313 + 0.59063776012 -0.84568572198 + 0.60064856961 -0.82324187944 + 0.61065937910 -0.80141758926 + 0.62067018860 -0.78021594305 + 0.63068099809 -0.75963707408 + 0.64069180758 -0.73967806489 + 0.65070261708 -0.72033285061 + 0.66071342657 -0.70159211612 + 0.67072423607 -0.68344319013 + 0.68073504556 -0.66586993440 + 0.69074585505 -0.64885263180 + 0.70075666455 -0.63236787386 + 0.71076747404 -0.61638842882 + 0.72077828353 -0.60088444379 + 0.73078909303 -0.58582694672 + 0.74079990252 -0.57118926389 + 0.75081071201 -0.55694692141 + 0.76082152151 -0.54307765897 + 0.77083233100 -0.52956141049 + 0.78084314049 -0.51638028248 + 0.79085394999 -0.50351852441 + 0.80086475948 -0.49096248667 + 0.81087556897 -0.47870056359 + 0.82088637847 -0.46672311812 + 0.83089718796 -0.45502238662 + 0.84090799745 -0.44359236182 + 0.85091880695 -0.43242865390 + 0.86092961644 -0.42152833003 + 0.87094042594 -0.41088973328 + 0.88095123543 -0.40051228398 + 0.89096204492 -0.39039626581 + 0.90097285442 -0.38054260057 + 0.91098366391 -0.37095261645 + 0.92099447340 -0.36162781407 + 0.93100528290 -0.35256963577 + 0.94101609239 -0.34377924350 + 0.95102690188 -0.33525731002 + 0.96103771138 -0.32700382908 + 0.97104852087 -0.31901795220 + 0.98105933036 -0.31129777411 + 0.99107013986 -0.30384071718 + 1.00108094935 -0.29664282663 + 1.01109175884 -0.28969147338 + 1.02110256834 -0.28295636740 + 1.03111337783 -0.27639979396 + 1.04112418733 -0.27000985631 + 1.05113499682 -0.26378790808 + 1.06114580631 -0.25773130784 + 1.07115661581 -0.25183055291 + 1.08116742530 -0.24608241861 + 1.09117823479 -0.24048226780 + 1.10118904429 -0.23502544204 + 1.11119985378 -0.22970771991 + 1.12121066327 -0.22452494826 + 1.13122147277 -0.21947313327 + 1.14123228226 -0.21454842234 + 1.15124309175 -0.20974709864 + 1.16125390125 -0.20506557528 + 1.17126471074 -0.20050038978 + 1.18127552023 -0.19604819893 + 1.19128632973 -0.19170577393 + 1.20129713922 -0.18746999558 + 1.21130794871 -0.18333784987 + 1.22131875821 -0.17930642368 + 1.23132956770 -0.17537290062 + 1.24134037720 -0.17153455751 + 1.25135118669 -0.16778876052 + 1.26136199618 -0.16413296151 + 1.27137280568 -0.16056469486 + 1.28138361517 -0.15708157426 + 1.29139442466 -0.15368128978 + 1.30140523416 -0.15036160478 + 1.31141604365 -0.14712035325 + 1.32142685314 -0.14395543716 + 1.33143766264 -0.14086482386 + 1.34144847213 -0.13784654367 + 1.35145928162 -0.13489868774 + 1.36147009112 -0.13201940567 + 1.37148090061 -0.12920690342 + 1.38149171010 -0.12645944124 + 1.39150251960 -0.12377533180 + 1.40151332909 -0.12115293839 + 1.41152413859 -0.11859067307 + 1.42153494808 -0.11608699493 + 1.43154575757 -0.11364040843 + 1.44155656707 -0.11124946187 + 1.45156737656 -0.10891274604 + 1.46157818605 -0.10662889259 + 1.47158899555 -0.10439657264 + 1.48159980504 -0.10221449547 + 1.49161061453 -0.10008140726 + 1.50162142403 -0.09799608993 + 1.51163223352 -0.09595735991 + 1.52164304301 -0.09396406699 + 1.53165385251 -0.09201509315 + 1.54166466200 -0.09010935157 + 1.55167547149 -0.08824578574 + 1.56168628099 -0.08642336840 + 1.57169709048 -0.08464110053 + 1.58170789997 -0.08289801044 + 1.59171870947 -0.08119315309 + 1.60172951896 -0.07952560911 + 1.61174032846 -0.07789448405 + 1.62175113795 -0.07629890755 + 1.63176194744 -0.07473803257 + 1.64177275694 -0.07321103475 + 1.65178356643 -0.07171711171 + 1.66179437592 -0.07025548239 + 1.67180518542 -0.06882538635 + 1.68181599491 -0.06742608314 + 1.69182680440 -0.06605685172 + 1.70183761390 -0.06471698989 + 1.71184842339 -0.06340581376 + 1.72185923288 -0.06212265714 + 1.73187004238 -0.06086687106 + 1.74188085187 -0.05963782323 + 1.75189166136 -0.05843489765 + 1.76190247086 -0.05725749402 + 1.77191328035 -0.05610502729 + 1.78192408985 -0.05497692727 + 1.79193489934 -0.05387263823 + 1.80194570883 -0.05279161847 + 1.81195651833 -0.05173333985 + 1.82196732782 -0.05069728746 + 1.83197813731 -0.04968295925 + 1.84198894681 -0.04868986568 + 1.85199975630 -0.04771752933 + 1.86201056579 -0.04676548462 + 1.87202137529 -0.04583327738 + 1.88203218478 -0.04492046463 + 1.89204299427 -0.04402661422 + 1.90205380377 -0.04315130461 + 1.91206461326 -0.04229412453 + 1.92207542275 -0.04145467263 + 1.93208623225 -0.04063255724 + 1.94209704174 -0.03982739626 + 1.95210785123 -0.03903881677 + 1.96211866073 -0.03826645478 + 1.97212947022 -0.03750995496 + 1.98214027972 -0.03676897046 + 1.99215108921 -0.03604316275 + 2.00216189870 -0.03533220137 + 2.01217270820 -0.03463576360 + 2.02218351769 -0.03395353435 + 2.03219432718 -0.03328520594 + 2.04220513668 -0.03263047799 + 2.05221594617 -0.03198905714 + 2.06222675566 -0.03136065686 + 2.07223756516 -0.03074499730 + 2.08224837465 -0.03014180510 + 2.09225918414 -0.02955081328 + 2.10226999364 -0.02897176100 + 2.11228080313 -0.02840439350 + 2.12229161262 -0.02784846187 + 2.13230242212 -0.02730372290 + 2.14231323161 -0.02676993895 + 2.15232404111 -0.02624687778 + 2.16233485060 -0.02573431253 + 2.17234566009 -0.02523202149 + 2.18235646959 -0.02473978799 + 2.19236727908 -0.02425740025 + 2.20237808857 -0.02378465126 + 2.21238889807 -0.02332133871 + 2.22239970756 -0.02286726483 + 2.23241051705 -0.02242223631 + 2.24242132655 -0.02198606416 + 2.25243213604 -0.02155856366 + 2.26244294553 -0.02113955418 + 2.27245375503 -0.02072885913 + 2.28246456452 -0.02032630581 + 2.29247537401 -0.01993172541 + 2.30248618351 -0.01954495282 + 2.31249699300 -0.01916582661 + 2.32250780249 -0.01879418890 + 2.33251861199 -0.01842988528 + 2.34252942148 -0.01807276474 + 2.35254023098 -0.01772267957 + 2.36255104047 -0.01737948530 + 2.37256184996 -0.01704304064 + 2.38257265946 -0.01671320736 + 2.39258346895 -0.01638985027 + 2.40259427844 -0.01607283709 + 2.41260508794 -0.01576203841 + 2.42261589743 -0.01545732762 + 2.43262670692 -0.01515858085 + 2.44263751642 -0.01486567691 + 2.45264832591 -0.01457849723 + 2.46265913540 -0.01429692577 + 2.47266994490 -0.01402084902 + 2.48268075439 -0.01375015590 + 2.49269156388 -0.01348473767 + 2.50270237338 -0.01322448793 + 2.51271318287 -0.01296930255 + 2.52272399236 -0.01271907960 + 2.53273480186 -0.01247371932 + 2.54274561135 -0.01223312408 + 2.55275642085 -0.01199719831 + 2.56276723034 -0.01176584850 + 2.57277803983 -0.01153898310 + 2.58278884933 -0.01131651247 + 2.59279965882 -0.01109834886 + 2.60281046831 -0.01088440636 + 2.61282127781 -0.01067460089 + 2.62283208730 -0.01046885010 + 2.63284289679 -0.01026707338 + 2.64285370629 -0.01006919181 + 2.65286451578 -0.00987512812 + 2.66287532527 -0.00968480667 + 2.67288613477 -0.00949815334 + 2.68289694426 -0.00931509558 + 2.69290775375 -0.00913556232 + 2.70291856325 -0.00895948398 + 2.71292937274 -0.00878679245 + 2.72294018224 -0.00861742101 + 2.73295099173 -0.00845130433 + 2.74296180122 -0.00828837839 + 2.75297261072 -0.00812858050 + 2.76298342021 -0.00797184925 + 2.77299422970 -0.00781812450 + 2.78300503920 -0.00766734736 + 2.79301584869 -0.00751946012 + 2.80302665818 -0.00737440627 + 2.81303746768 -0.00723213044 + 2.82304827717 -0.00709257840 + 2.83305908666 -0.00695569701 + 2.84306989616 -0.00682143423 + 2.85308070565 -0.00668973905 + 2.86309151514 -0.00656056151 + 2.87310232464 -0.00643385266 + 2.88311313413 -0.00630956455 + 2.89312394362 -0.00618765017 + 2.90313475312 -0.00606806351 + 2.91314556261 -0.00595075944 + 2.92315637211 -0.00583569378 + 2.93316718160 -0.00572282321 + 2.94317799109 -0.00561210529 + 2.95318880059 -0.00550349842 + 2.96319961008 -0.00539696184 + 2.97321041957 -0.00529245560 + 2.98322122907 -0.00518994056 + 2.99323203856 -0.00508937839 + 3.00324284805 -0.00499073149 + 3.01325365755 -0.00489396300 + 3.02326446704 -0.00479903681 + 3.03327527653 -0.00470591749 + 3.04328608603 -0.00461457038 + 3.05329689552 -0.00452496146 + 3.06330770501 -0.00443705743 + 3.07331851451 -0.00435082562 + 3.08332932400 -0.00426623401 + 3.09334013350 -0.00418325121 + 3.10335094299 -0.00410184643 + 3.11336175248 -0.00402198952 + 3.12337256198 -0.00394365090 + 3.13338337147 -0.00386680159 + 3.14339418096 -0.00379141318 + 3.15340499046 -0.00371745782 + 3.16341579995 -0.00364490818 + 3.17342660944 -0.00357373750 + 3.18343741894 -0.00350391952 + 3.19344822843 -0.00343542851 + 3.20345903792 -0.00336823922 + 3.21346984742 -0.00330232693 + 3.22348065691 -0.00323766736 + 3.23349146640 -0.00317423674 + 3.24350227590 -0.00311201174 + 3.25351308539 -0.00305096948 + 3.26352389488 -0.00299108754 + 3.27353470438 -0.00293234394 + 3.28354551387 -0.00287471710 + 3.29355632337 -0.00281818589 + 3.30356713286 -0.00276272957 + 3.31357794235 -0.00270832781 + 3.32358875185 -0.00265496066 + 3.33359956134 -0.00260260859 + 3.34361037083 -0.00255125240 + 3.35362118033 -0.00250087330 + 3.36363198982 -0.00245145283 + 3.37364279931 -0.00240297290 + 3.38365360881 -0.00235541577 + 3.39366441830 -0.00230876405 + 3.40367522779 -0.00226300066 + 3.41368603729 -0.00221810887 + 3.42369684678 -0.00217407225 + 3.43370765627 -0.00213087471 + 3.44371846577 -0.00208850043 + 3.45372927526 -0.00204693394 + 3.46374008476 -0.00200616001 + 3.47375089425 -0.00196616376 + 3.48376170374 -0.00192693057 + 3.49377251324 -0.00188844610 + 3.50378332273 -0.00185069629 + 3.51379413222 -0.00181366733 + 3.52380494172 -0.00177734569 + 3.53381575121 -0.00174171807 + 3.54382656070 -0.00170677145 + 3.55383737020 -0.00167249304 + 3.56384817969 -0.00163887031 + 3.57385898918 -0.00160589096 + 3.58386979868 -0.00157354293 + 3.59388060817 -0.00154181438 + 3.60389141766 -0.00151069369 + 3.61390222716 -0.00148016947 + 3.62391303665 -0.00145023053 + 3.63392384614 -0.00142086592 + 3.64393465564 -0.00139206485 + 3.65394546513 -0.00136381678 + 3.66395627463 -0.00133611135 + 3.67396708412 -0.00130893839 + 3.68397789361 -0.00128228793 + 3.69398870311 -0.00125615020 + 3.70399951260 -0.00123051559 + 3.71401032209 -0.00120537468 + 3.72402113159 -0.00118071825 + 3.73403194108 -0.00115653721 + 3.74404275057 -0.00113282266 + 3.75405356007 -0.00110956587 + 3.76406436956 -0.00108675826 + 3.77407517905 -0.00106439143 + 3.78408598855 -0.00104245715 + 3.79409679804 -0.00102094730 + 3.80410760753 -0.00099985397 + 3.81411841703 -0.00097916935 + 3.82412922652 -0.00095888580 + 3.83414003601 -0.00093899579 + 3.84415084551 -0.00091949196 + 3.85416165500 -0.00090036708 + 3.86417246450 -0.00088161405 + 3.87418327399 -0.00086322593 + 3.88419408348 -0.00084519587 + 3.89420489298 -0.00082751719 + 3.90421570247 -0.00081018330 + 3.91422651196 -0.00079318775 + 3.92423732146 -0.00077652420 + 3.93424813095 -0.00076018642 + 3.94425894044 -0.00074416832 + 3.95426974994 -0.00072846391 + 3.96428055943 -0.00071306730 + 3.97429136892 -0.00069797272 + 3.98430217842 -0.00068317452 + 3.99431298791 -0.00066866713 + 4.00432379740 -0.00065444510 + 4.01433460690 -0.00064050308 + 4.02434541639 -0.00062683582 + 4.03435622589 -0.00061343816 + 4.04436703538 -0.00060030504 + 4.05437784487 -0.00058743150 + 4.06438865437 -0.00057481266 + 4.07439946386 -0.00056244374 + 4.08441027335 -0.00055032003 + 4.09442108285 -0.00053843694 + 4.10443189234 -0.00052678994 + 4.11444270183 -0.00051537458 + 4.12445351133 -0.00050418652 + 4.13446432082 -0.00049322147 + 4.14447513031 -0.00048247523 + 4.15448593981 -0.00047194369 + 4.16449674930 -0.00046162280 + 4.17450755879 -0.00045150859 + 4.18451836829 -0.00044159714 + 4.19452917778 -0.00043188466 + 4.20453998727 -0.00042236737 + 4.21455079677 -0.00041304160 + 4.22456160626 -0.00040390374 + 4.23457241576 -0.00039495023 + 4.24458322525 -0.00038617760 + 4.25459403474 -0.00037758242 + 4.26460484424 -0.00036916132 + 4.27461565373 -0.00036091101 + 4.28462646322 -0.00035282824 + 4.29463727272 -0.00034490984 + 4.30464808221 -0.00033715269 + 4.31465889170 -0.00032955375 + 4.32466970120 -0.00032211001 + 4.33468051069 -0.00031481853 + 4.34469132018 -0.00030767641 + 4.35470212968 -0.00030068082 + 4.36471293917 -0.00029382895 + 4.37472374866 -0.00028711808 + 4.38473455816 -0.00028054549 + 4.39474536765 -0.00027410856 + 4.40475617715 -0.00026780470 + 4.41476698664 -0.00026163138 + 4.42477779613 -0.00025558609 + 4.43478860563 -0.00024966639 + 4.44479941512 -0.00024386990 + 4.45481022461 -0.00023819424 + 4.46482103411 -0.00023263710 + 4.47483184360 -0.00022719621 + 4.48484265309 -0.00022186932 + 4.49485346259 -0.00021665426 + 4.50486427208 -0.00021154886 + 4.51487508157 -0.00020655101 + 4.52488589107 -0.00020165865 + 4.53489670056 -0.00019686974 + 4.54490751005 -0.00019218228 + 4.55491831955 -0.00018759432 + 4.56492912904 -0.00018310392 + 4.57493993853 -0.00017870921 + 4.58495074803 -0.00017440832 + 4.59496155752 -0.00017019945 + 4.60497236702 -0.00016608080 + 4.61498317651 -0.00016205062 + 4.62499398600 -0.00015810720 + 4.63500479550 -0.00015424883 + 4.64501560499 -0.00015047387 + 4.65502641448 -0.00014678067 + 4.66503722398 -0.00014316766 + 4.67504803347 -0.00013963324 + 4.68505884296 -0.00013617590 + 4.69506965246 -0.00013279412 + 4.70508046195 -0.00012948641 + 4.71509127144 -0.00012625132 + 4.72510208094 -0.00012308743 + 4.73511289043 -0.00011999333 + 4.74512369992 -0.00011696764 + 4.75513450942 -0.00011400902 + 4.76514531891 -0.00011111613 + 4.77515612841 -0.00010828768 + 4.78516693790 -0.00010552239 + 4.79517774739 -0.00010281900 + 4.80518855689 -0.00010017628 + 4.81519936638 -0.00009759301 + 4.82521017587 -0.00009506802 + 4.83522098537 -0.00009260012 + 4.84523179486 -0.00009018819 + 4.85524260435 -0.00008783111 + 4.86525341385 -0.00008552776 + 4.87526422334 -0.00008327708 + 4.88527503283 -0.00008107801 + 4.89528584233 -0.00007892950 + 4.90529665182 -0.00007683054 + 4.91530746131 -0.00007478011 + 4.92531827081 -0.00007277725 + 4.93532908030 -0.00007082097 + 4.94533988979 -0.00006891034 + 4.95535069929 -0.00006704442 + 4.96536150878 -0.00006522230 + 4.97537231828 -0.00006344309 + 4.98538312777 -0.00006170591 + 4.99539393726 -0.00006000989 + 5.00540474676 -0.00005835418 + 5.01541555625 -0.00005673797 + 5.02542636574 -0.00005516042 + 5.03543717524 -0.00005362075 + 5.04544798473 -0.00005211815 + 5.05545879422 -0.00005065186 + 5.06546960372 -0.00004922113 + 5.07548041321 -0.00004782521 + 5.08549122270 -0.00004646337 + 5.09550203220 -0.00004513490 + 5.10551284169 -0.00004383910 + 5.11552365118 -0.00004257529 + 5.12553446068 -0.00004134279 + 5.13554527017 -0.00004014094 + 5.14555607966 -0.00003896909 + 5.15556688916 -0.00003782660 + 5.16557769865 -0.00003671284 + 5.17558850815 -0.00003562719 + 5.18559931764 -0.00003456906 + 5.19561012713 -0.00003353785 + 5.20562093663 -0.00003253298 + 5.21563174612 -0.00003155389 + 5.22564255561 -0.00003060001 + 5.23565336511 -0.00002967080 + 5.24566417460 -0.00002876573 + 5.25567498409 -0.00002788427 + 5.26568579359 -0.00002702589 + 5.27569660308 -0.00002619010 + 5.28570741257 -0.00002537640 + 5.29571822207 -0.00002458429 + 5.30572903156 -0.00002381330 + 5.31573984105 -0.00002306296 + 5.32575065055 -0.00002233281 + 5.33576146004 -0.00002162239 + 5.34577226954 -0.00002093127 + 5.35578307903 -0.00002025901 + 5.36579388852 -0.00001960518 + 5.37580469802 -0.00001896936 + 5.38581550751 -0.00001835115 + 5.39582631700 -0.00001775014 + 5.40583712650 -0.00001716594 + 5.41584793599 -0.00001659816 + 5.42585874548 -0.00001604642 + 5.43586955498 -0.00001551035 + 5.44588036447 -0.00001498958 + 5.45589117396 -0.00001448377 + 5.46590198346 -0.00001399255 + 5.47591279295 -0.00001351559 + 5.48592360244 -0.00001305255 + 5.49593441194 -0.00001260310 + 5.50594522143 -0.00001216691 + 5.51595603092 -0.00001174367 + 5.52596684042 -0.00001133307 + 5.53597764991 -0.00001093480 + 5.54598845941 -0.00001054856 + 5.55599926890 -0.00001017406 + 5.56601007839 -0.00000981101 + 5.57602088789 -0.00000945913 + 5.58603169738 -0.00000911814 + 5.59604250687 -0.00000878778 + 5.60605331637 -0.00000846777 + 5.61606412586 -0.00000815786 + 5.62607493535 -0.00000785780 + 5.63608574485 -0.00000756732 + 5.64609655434 -0.00000728619 + 5.65610736383 -0.00000701417 + 5.66611817333 -0.00000675103 + 5.67612898282 -0.00000649654 + 5.68613979231 -0.00000625046 + 5.69615060181 -0.00000601260 + 5.70616141130 -0.00000578272 + 5.71617222080 -0.00000556061 + 5.72618303029 -0.00000534608 + 5.73619383978 -0.00000513891 + 5.74620464928 -0.00000493891 + 5.75621545877 -0.00000474588 + 5.76622626826 -0.00000455962 + 5.77623707776 -0.00000437996 + 5.78624788725 -0.00000420670 + 5.79625869674 -0.00000403968 + 5.80626950624 -0.00000387871 + 5.81628031573 -0.00000372364 + 5.82629112522 -0.00000357428 + 5.83630193472 -0.00000343048 + 5.84631274421 -0.00000329209 + 5.85632355370 -0.00000315893 + 5.86633436320 -0.00000303087 + 5.87634517269 -0.00000290774 + 5.88635598218 -0.00000278940 + 5.89636679168 -0.00000267571 + 5.90637760117 -0.00000256651 + 5.91638841067 -0.00000246169 + 5.92639922016 -0.00000236109 + 5.93641002965 -0.00000226460 + 5.94642083915 -0.00000217207 + 5.95643164864 -0.00000208340 + 5.96644245813 -0.00000199844 + 5.97645326763 -0.00000191709 + 5.98646407712 -0.00000183922 + 5.99647488661 -0.00000176472 + 6.00648569611 -0.00000169349 + 6.01649650560 -0.00000162541 + 6.02650731509 -0.00000156038 + 6.03651812459 -0.00000149829 + 6.04652893408 -0.00000143905 + 6.05653974357 -0.00000138256 + 6.06655055307 -0.00000132873 + 6.07656136256 -0.00000127744 + 6.08657217206 -0.00000122862 + 6.09658298155 -0.00000118217 + 6.10659379104 -0.00000113800 + 6.11660460054 -0.00000109603 + 6.12661541003 -0.00000105616 + 6.13662621952 -0.00000101832 + 6.14663702902 -0.00000098243 + 6.15664783851 -0.00000094841 + 6.16665864800 -0.00000091619 + 6.17666945750 -0.00000088570 + 6.18668026699 -0.00000085687 + 6.19669107648 -0.00000082963 + 6.20670188598 -0.00000080392 + 6.21671269547 -0.00000077966 + 6.22672350496 -0.00000075681 + 6.23673431446 -0.00000073528 + 6.24674512395 -0.00000071503 + 6.25675593344 -0.00000069600 + 6.26676674294 -0.00000067812 + 6.27677755243 -0.00000066135 + 6.28678836193 -0.00000064563 + 6.29679917142 -0.00000063090 + 6.30680998091 -0.00000061713 + 6.31682079041 -0.00000060425 + 6.32683159990 -0.00000059222 + 6.33684240939 -0.00000058099 + 6.34685321889 -0.00000057053 + 6.35686402838 -0.00000056077 + 6.36687483787 -0.00000055170 + 6.37688564737 -0.00000054326 + 6.38689645686 -0.00000053542 + 6.39690726635 -0.00000052815 + 6.40691807585 -0.00000052140 + 6.41692888534 -0.00000051515 + 6.42693969483 -0.00000050937 + 6.43695050433 -0.00000050402 + 6.44696131382 -0.00000049907 + 6.45697212332 -0.00000049450 + 6.46698293281 -0.00000049027 + 6.47699374230 -0.00000048636 + 6.48700455180 -0.00000048275 + 6.49701536129 -0.00000047940 + 6.50702617078 -0.00000047629 + 6.51703698028 -0.00000047341 + 6.52704778977 -0.00000047072 + 6.53705859926 -0.00000046822 + 6.54706940876 -0.00000046589 + 6.55708021825 -0.00000046370 + 6.56709102774 -0.00000046164 + 6.57710183724 -0.00000045970 + 6.58711264673 -0.00000045786 + 6.59712345622 -0.00000045611 + 6.60713426572 -0.00000045443 + 6.61714507521 -0.00000045282 + 6.62715588470 -0.00000045126 + 6.63716669420 -0.00000044975 + 6.64717750369 -0.00000044827 + 6.65718831319 -0.00000044681 + 6.66719912268 -0.00000044538 + 6.67720993217 -0.00000044396 + 6.68722074167 -0.00000044255 + 6.69723155116 -0.00000044115 + 6.70724236065 -0.00000043976 + 6.71725317015 -0.00000043837 + 6.72726397964 0.00000000000 +# Vlocal:_______________________ + 673 0.01001080949 6.72726397964 # npts, delta, cutoff + 0.00000000000 -3.15233440486 + 0.01001080949 -3.15147680421 + 0.02002161899 -3.14890960191 + 0.03003242848 -3.14464912433 + 0.04004323797 -3.13872198065 + 0.05005404747 -3.13116418792 + 0.06006485696 -3.12202002190 + 0.07007566645 -3.11134067305 + 0.08008647595 -3.09918278698 + 0.09009728544 -3.08560696793 + 0.10010809494 -3.07067632164 + 0.11011890443 -3.05445510224 + 0.12012971392 -3.03700751573 + 0.13014052342 -3.01839671365 + 0.14015133291 -2.99868399774 + 0.15016214240 -2.97792824024 + 0.16017295190 -2.95618551101 + 0.17018376139 -2.93350889573 + 0.18019457088 -2.90994847893 + 0.19020538038 -2.88555146548 + 0.20021618987 -2.86036240917 + 0.21022699936 -2.83442351991 + 0.22023780886 -2.80777502266 + 0.23024861835 -2.78045554251 + 0.24025942784 -2.75250249657 + 0.25027023734 -2.72395247491 + 0.26028104683 -2.69484159664 + 0.27029185632 -2.66520583236 + 0.28030266582 -2.63508128468 + 0.29031347531 -2.60450442309 + 0.30032428481 -2.57351227035 + 0.31033509430 -2.54214254064 + 0.32034590379 -2.51043372897 + 0.33035671329 -2.47842515517 + 0.34036752278 -2.44615696439 + 0.35037833227 -2.41367008754 + 0.36038914177 -2.38100616549 + 0.37039995126 -2.34820744140 + 0.38041076075 -2.31531662539 + 0.39042157025 -2.28237673535 + 0.40043237974 -2.24943092013 + 0.41044318923 -2.21652226752 + 0.42045399873 -2.18369360277 + 0.43046480822 -2.15098728206 + 0.44047561771 -2.11844498360 + 0.45048642721 -2.08610750219 + 0.46049723670 -2.05401454793 + 0.47050804620 -2.02220455484 + 0.48051885569 -1.99071449903 + 0.49052966518 -1.95957973045 + 0.50054047468 -1.92883381736 + 0.51055128417 -1.89850840543 + 0.52056209366 -1.86863309052 + 0.53057290316 -1.83923530454 + 0.54058371265 -1.81034021367 + 0.55059452214 -1.78197062550 + 0.56060533164 -1.75414690544 + 0.57061614113 -1.72688689797 + 0.58062695062 -1.70020585159 + 0.59063776012 -1.67411634489 + 0.60064856961 -1.64862821171 + 0.61065937910 -1.62374846316 + 0.62067018860 -1.59948120627 + 0.63068099809 -1.57582755761 + 0.64069180758 -1.55278555085 + 0.65070261708 -1.53035004003 + 0.66071342657 -1.50851259700 + 0.67072423607 -1.48726140549 + 0.68073504556 -1.46658115080 + 0.69074585505 -1.44645290811 + 0.70075666455 -1.42685403048 + 0.71076747404 -1.40775801751 + 0.72077828353 -1.38913571798 + 0.73078909303 -1.37095883255 + 0.74079990252 -1.35320133192 + 0.75081071201 -1.33583935911 + 0.76082152151 -1.31885124402 + 0.77083233100 -1.30221748496 + 0.78084314049 -1.28592072785 + 0.79085394999 -1.26994573755 + 0.80086475948 -1.25427935674 + 0.81087556897 -1.23891044988 + 0.82088637847 -1.22382982885 + 0.83089718796 -1.20903015873 + 0.84090799745 -1.19450584165 + 0.85091880695 -1.18025287887 + 0.86092961644 -1.16626871120 + 0.87094042594 -1.15255203883 + 0.88095123543 -1.13910262352 + 0.89096204492 -1.12592107559 + 0.90097285442 -1.11300862939 + 0.91098366391 -1.10036691247 + 0.92099447340 -1.08799771219 + 0.93100528290 -1.07590274574 + 0.94101609239 -1.06408343868 + 0.95102690188 -1.05254071666 + 0.96103771138 -1.04127481617 + 0.97104852087 -1.03028512176 + 0.98105933036 -1.01956995194 + 0.99107013986 -1.00912694398 + 1.00108094935 -0.99895234947 + 1.01109175884 -0.98903373745 + 1.02110256834 -0.97934100807 + 1.03111337783 -0.96983662899 + 1.04112418733 -0.96050887835 + 1.05113499682 -0.95135927733 + 1.06114580631 -0.94238534493 + 1.07115661581 -0.93357773195 + 1.08116742530 -0.92493336048 + 1.09117823479 -0.91644773356 + 1.10118904429 -0.90811632656 + 1.11119985378 -0.89993504569 + 1.12121066327 -0.89189985938 + 1.13122147277 -0.88400688953 + 1.14123228226 -0.87625239359 + 1.15124309175 -0.86863275919 + 1.16125390125 -0.86114449858 + 1.17126471074 -0.85378424313 + 1.18127552023 -0.84654873844 + 1.19128632973 -0.83943483956 + 1.20129713922 -0.83243950633 + 1.21130794871 -0.82555979913 + 1.22131875821 -0.81879287470 + 1.23132956770 -0.81213598212 + 1.24134037720 -0.80558645939 + 1.25135118669 -0.79914172972 + 1.26136199618 -0.79279929796 + 1.27137280568 -0.78655674758 + 1.28138361517 -0.78041173759 + 1.29139442466 -0.77436199964 + 1.30140523416 -0.76840533515 + 1.31141604365 -0.76253961263 + 1.32142685314 -0.75676276527 + 1.33143766264 -0.75107278831 + 1.34144847213 -0.74546773684 + 1.35145928162 -0.73994572368 + 1.36147009112 -0.73450491711 + 1.37148090061 -0.72914353888 + 1.38149171010 -0.72385986224 + 1.39150251960 -0.71865221015 + 1.40151332909 -0.71351895353 + 1.41152413859 -0.70845850952 + 1.42153494808 -0.70346933984 + 1.43154575757 -0.69854994917 + 1.44155656707 -0.69369888371 + 1.45156737656 -0.68891472991 + 1.46157818605 -0.68419611289 + 1.47158899555 -0.67954169517 + 1.48159980504 -0.67495017535 + 1.49161061453 -0.67042028698 + 1.50162142403 -0.66595079745 + 1.51163223352 -0.66154050683 + 1.52164304301 -0.65718824672 + 1.53165385251 -0.65289287924 + 1.54166466200 -0.64865329602 + 1.55167547149 -0.64446841739 + 1.56168628099 -0.64033719139 + 1.57169709048 -0.63625859280 + 1.58170789997 -0.63223162228 + 1.59171870947 -0.62825530574 + 1.60172951896 -0.62432869343 + 1.61174032846 -0.62045085920 + 1.62175113795 -0.61662089975 + 1.63176194744 -0.61283793390 + 1.64177275694 -0.60910110197 + 1.65178356643 -0.60540956520 + 1.66179437592 -0.60176250500 + 1.67180518542 -0.59815912239 + 1.68181599491 -0.59459863742 + 1.69182680440 -0.59108028855 + 1.70183761390 -0.58760333221 + 1.71184842339 -0.58416704220 + 1.72185923288 -0.58077070923 + 1.73187004238 -0.57741364037 + 1.74188085187 -0.57409515866 + 1.75189166136 -0.57081460262 + 1.76190247086 -0.56757132580 + 1.77191328035 -0.56436469631 + 1.78192408985 -0.56119409646 + 1.79193489934 -0.55805892243 + 1.80194570883 -0.55495858379 + 1.81195651833 -0.55189250315 + 1.82196732782 -0.54886011581 + 1.83197813731 -0.54586086941 + 1.84198894681 -0.54289422361 + 1.85199975630 -0.53995964974 + 1.86201056579 -0.53705663053 + 1.87202137529 -0.53418465975 + 1.88203218478 -0.53134324189 + 1.89204299427 -0.52853189198 + 1.90205380377 -0.52575013529 + 1.91206461326 -0.52299750702 + 1.92207542275 -0.52027355202 + 1.93208623225 -0.51757782452 + 1.94209704174 -0.51490988804 + 1.95210785123 -0.51226931507 + 1.96211866073 -0.50965568680 + 1.97212947022 -0.50706859284 + 1.98214027972 -0.50450763112 + 1.99215108921 -0.50197240771 + 2.00216189870 -0.49946253657 + 2.01217270820 -0.49697763930 + 2.02218351769 -0.49451734495 + 2.03219432718 -0.49208128992 + 2.04220513668 -0.48966911777 + 2.05221594617 -0.48728047902 + 2.06222675566 -0.48491503094 + 2.07223756516 -0.48257243742 + 2.08224837465 -0.48025236880 + 2.09225918414 -0.47795450178 + 2.10226999364 -0.47567851915 + 2.11228080313 -0.47342410980 + 2.12229161262 -0.47119096845 + 2.13230242212 -0.46897879556 + 2.14231323161 -0.46678729713 + 2.15232404111 -0.46461618466 + 2.16233485060 -0.46246517502 + 2.17234566009 -0.46033399033 + 2.18235646959 -0.45822235778 + 2.19236727908 -0.45613000951 + 2.20237808857 -0.45405668254 + 2.21238889807 -0.45200211867 + 2.22239970756 -0.44996606433 + 2.23241051705 -0.44794827050 + 2.24242132655 -0.44594849264 + 2.25243213604 -0.44396649053 + 2.26244294553 -0.44200202823 + 2.27245375503 -0.44005487391 + 2.28246456452 -0.43812479984 + 2.29247537401 -0.43621158226 + 2.30248618351 -0.43431500130 + 2.31249699300 -0.43243484091 + 2.32250780249 -0.43057088875 + 2.33251861199 -0.42872293614 + 2.34252942148 -0.42689077796 + 2.35254023098 -0.42507421256 + 2.36255104047 -0.42327304173 + 2.37256184996 -0.42148707060 + 2.38257265946 -0.41971610758 + 2.39258346895 -0.41795996431 + 2.40259427844 -0.41621845554 + 2.41260508794 -0.41449139908 + 2.42261589743 -0.41277861577 + 2.43262670692 -0.41107992939 + 2.44263751642 -0.40939516662 + 2.45264832591 -0.40772415696 + 2.46265913540 -0.40606673269 + 2.47266994490 -0.40442272884 + 2.48268075439 -0.40279198307 + 2.49269156388 -0.40117433564 + 2.50270237338 -0.39956962939 + 2.51271318287 -0.39797770962 + 2.52272399236 -0.39639842411 + 2.53273480186 -0.39483162303 + 2.54274561135 -0.39327715893 + 2.55275642085 -0.39173488667 + 2.56276723034 -0.39020466340 + 2.57277803983 -0.38868634848 + 2.58278884933 -0.38717980345 + 2.59279965882 -0.38568489196 + 2.60281046831 -0.38420147979 + 2.61282127781 -0.38272943475 + 2.62283208730 -0.38126862669 + 2.63284289679 -0.37981892743 + 2.64285370629 -0.37838021074 + 2.65286451578 -0.37695235230 + 2.66287532527 -0.37553522966 + 2.67288613477 -0.37412872219 + 2.68289694426 -0.37273271105 + 2.69290775375 -0.37134707917 + 2.70291856325 -0.36997171122 + 2.71292937274 -0.36860649360 + 2.72294018224 -0.36725131438 + 2.73295099173 -0.36590606325 + 2.74296180122 -0.36457063152 + 2.75297261072 -0.36324491204 + 2.76298342021 -0.36192879925 + 2.77299422970 -0.36062218910 + 2.78300503920 -0.35932497906 + 2.79301584869 -0.35803706806 + 2.80302665818 -0.35675835645 + 2.81303746768 -0.35548874605 + 2.82304827717 -0.35422814001 + 2.83305908666 -0.35297644291 + 2.84306989616 -0.35173356062 + 2.85308070565 -0.35049940037 + 2.86309151514 -0.34927387065 + 2.87310232464 -0.34805688127 + 2.88311313413 -0.34684834324 + 2.89312394362 -0.34564816885 + 2.90313475312 -0.34445627158 + 2.91314556261 -0.34327256611 + 2.92315637211 -0.34209696827 + 2.93316718160 -0.34092939507 + 2.94317799109 -0.33976976461 + 2.95318880059 -0.33861799613 + 2.96319961008 -0.33747400992 + 2.97321041957 -0.33633772739 + 2.98322122907 -0.33520907098 + 2.99323203856 -0.33408796421 + 3.00324284805 -0.33297433157 + 3.01325365755 -0.33186809856 + 3.02326446704 -0.33076919168 + 3.03327527653 -0.32967753837 + 3.04328608603 -0.32859306706 + 3.05329689552 -0.32751570710 + 3.06330770501 -0.32644538880 + 3.07331851451 -0.32538204335 + 3.08332932400 -0.32432560284 + 3.09334013350 -0.32327600022 + 3.10335094299 -0.32223316931 + 3.11336175248 -0.32119704479 + 3.12337256198 -0.32016756217 + 3.13338337147 -0.31914465779 + 3.14339418096 -0.31812826883 + 3.15340499046 -0.31711833322 + 3.16341579995 -0.31611478970 + 3.17342660944 -0.31511757777 + 3.18343741894 -0.31412663771 + 3.19344822843 -0.31314191053 + 3.20345903792 -0.31216333799 + 3.21346984742 -0.31119086257 + 3.22348065691 -0.31022442746 + 3.23349146640 -0.30926397657 + 3.24350227590 -0.30830945448 + 3.25351308539 -0.30736080646 + 3.26352389488 -0.30641797846 + 3.27353470438 -0.30548091708 + 3.28354551387 -0.30454956958 + 3.29355632337 -0.30362388386 + 3.30356713286 -0.30270380845 + 3.31357794235 -0.30178929249 + 3.32358875185 -0.30088028576 + 3.33359956134 -0.29997673863 + 3.34361037083 -0.29907860206 + 3.35362118033 -0.29818582759 + 3.36363198982 -0.29729836735 + 3.37364279931 -0.29641617403 + 3.38365360881 -0.29553920087 + 3.39366441830 -0.29466740170 + 3.40367522779 -0.29380073085 + 3.41368603729 -0.29293914320 + 3.42369684678 -0.29208259417 + 3.43370765627 -0.29123103968 + 3.44371846577 -0.29038443617 + 3.45372927526 -0.28954274059 + 3.46374008476 -0.28870591037 + 3.47375089425 -0.28787390346 + 3.48376170374 -0.28704667828 + 3.49377251324 -0.28622419374 + 3.50378332273 -0.28540640920 + 3.51379413222 -0.28459328449 + 3.52380494172 -0.28378477990 + 3.53381575121 -0.28298085615 + 3.54382656070 -0.28218147442 + 3.55383737020 -0.28138659632 + 3.56384817969 -0.28059618390 + 3.57385898918 -0.27981019965 + 3.58386979868 -0.27902860645 + 3.59388060817 -0.27825136762 + 3.60389141766 -0.27747844686 + 3.61390222716 -0.27670980828 + 3.62391303665 -0.27594541640 + 3.63392384614 -0.27518523611 + 3.64393465564 -0.27442923270 + 3.65394546513 -0.27367737185 + 3.66395627463 -0.27292961959 + 3.67396708412 -0.27218594234 + 3.68397789361 -0.27144630687 + 3.69398870311 -0.27071068033 + 3.70399951260 -0.26997903022 + 3.71401032209 -0.26925132439 + 3.72402113159 -0.26852753101 + 3.73403194108 -0.26780761863 + 3.74404275057 -0.26709155611 + 3.75405356007 -0.26637931264 + 3.76406436956 -0.26567085775 + 3.77407517905 -0.26496616129 + 3.78408598855 -0.26426519344 + 3.79409679804 -0.26356792468 + 3.80410760753 -0.26287432582 + 3.81411841703 -0.26218436796 + 3.82412922652 -0.26149802249 + 3.83414003601 -0.26081526113 + 3.84415084551 -0.26013605586 + 3.85416165500 -0.25946037897 + 3.86417246450 -0.25878820303 + 3.87418327399 -0.25811950091 + 3.88419408348 -0.25745424575 + 3.89420489298 -0.25679241098 + 3.90421570247 -0.25613397029 + 3.91422651196 -0.25547889762 + 3.92423732146 -0.25482716720 + 3.93424813095 -0.25417875352 + 3.94425894044 -0.25353363132 + 3.95426974994 -0.25289177560 + 3.96428055943 -0.25225316161 + 3.97429136892 -0.25161776485 + 3.98430217842 -0.25098556107 + 3.99431298791 -0.25035652626 + 4.00432379740 -0.24973063665 + 4.01433460690 -0.24910786871 + 4.02434541639 -0.24848819915 + 4.03435622589 -0.24787160490 + 4.04436703538 -0.24725806312 + 4.05437784487 -0.24664755121 + 4.06438865437 -0.24604004676 + 4.07439946386 -0.24543552762 + 4.08441027335 -0.24483397183 + 4.09442108285 -0.24423535766 + 4.10443189234 -0.24363966357 + 4.11444270183 -0.24304686826 + 4.12445351133 -0.24245695061 + 4.13446432082 -0.24186988973 + 4.14447513031 -0.24128566492 + 4.15448593981 -0.24070425566 + 4.16449674930 -0.24012564165 + 4.17450755879 -0.23954980278 + 4.18451836829 -0.23897671912 + 4.19452917778 -0.23840637096 + 4.20453998727 -0.23783873875 + 4.21455079677 -0.23727380315 + 4.22456160626 -0.23671154498 + 4.23457241576 -0.23615194526 + 4.24458322525 -0.23559498518 + 4.25459403474 -0.23504064609 + 4.26460484424 -0.23448890955 + 4.27461565373 -0.23393975726 + 4.28462646322 -0.23339317109 + 4.29463727272 -0.23284913311 + 4.30464808221 -0.23230762553 + 4.31465889170 -0.23176863076 + 4.32466970120 -0.23123213133 + 4.33468051069 -0.23069810998 + 4.34469132018 -0.23016654956 + 4.35470212968 -0.22963743311 + 4.36471293917 -0.22911074380 + 4.37472374866 -0.22858646497 + 4.38473455816 -0.22806458009 + 4.39474536765 -0.22754507280 + 4.40475617715 -0.22702792691 + 4.41476698664 -0.22651312634 + 4.42477779613 -0.22600065518 + 4.43478860563 -0.22549049766 + 4.44479941512 -0.22498263815 + 4.45481022461 -0.22447706116 + 4.46482103411 -0.22397375133 + 4.47483184360 -0.22347269344 + 4.48484265309 -0.22297387242 + 4.49485346259 -0.22247727330 + 4.50486427208 -0.22198288129 + 4.51487508157 -0.22149068170 + 4.52488589107 -0.22100065997 + 4.53489670056 -0.22051280168 + 4.54490751005 -0.22002709254 + 4.55491831955 -0.21954351837 + 4.56492912904 -0.21906206512 + 4.57493993853 -0.21858271889 + 4.58495074803 -0.21810546585 + 4.59496155752 -0.21763029234 + 4.60497236702 -0.21715718480 + 4.61498317651 -0.21668612977 + 4.62499398600 -0.21621711393 + 4.63500479550 -0.21575012406 + 4.64501560499 -0.21528514707 + 4.65502641448 -0.21482216996 + 4.66503722398 -0.21436117987 + 4.67504803347 -0.21390216402 + 4.68505884296 -0.21344510976 + 4.69506965246 -0.21299000454 + 4.70508046195 -0.21253683593 + 4.71509127144 -0.21208559159 + 4.72510208094 -0.21163625929 + 4.73511289043 -0.21118882691 + 4.74512369992 -0.21074328241 + 4.75513450942 -0.21029961387 + 4.76514531891 -0.20985780948 + 4.77515612841 -0.20941785751 + 4.78516693790 -0.20897974633 + 4.79517774739 -0.20854346441 + 4.80518855689 -0.20810900031 + 4.81519936638 -0.20767634270 + 4.82521017587 -0.20724548033 + 4.83522098537 -0.20681640204 + 4.84523179486 -0.20638909679 + 4.85524260435 -0.20596355360 + 4.86525341385 -0.20553976159 + 4.87526422334 -0.20511770999 + 4.88527503283 -0.20469738809 + 4.89528584233 -0.20427878528 + 4.90529665182 -0.20386189104 + 4.91530746131 -0.20344669493 + 4.92531827081 -0.20303318659 + 4.93532908030 -0.20262135576 + 4.94533988979 -0.20221119223 + 4.95535069929 -0.20180268592 + 4.96536150878 -0.20139582680 + 4.97537231828 -0.20099060491 + 4.98538312777 -0.20058701041 + 4.99539393726 -0.20018503351 + 5.00540474676 -0.19978466450 + 5.01541555625 -0.19938589376 + 5.02542636574 -0.19898871172 + 5.03543717524 -0.19859310893 + 5.04544798473 -0.19819907596 + 5.05545879422 -0.19780660350 + 5.06546960372 -0.19741568229 + 5.07548041321 -0.19702630316 + 5.08549122270 -0.19663845699 + 5.09550203220 -0.19625213476 + 5.10551284169 -0.19586732750 + 5.11552365118 -0.19548402633 + 5.12553446068 -0.19510222241 + 5.13554527017 -0.19472190699 + 5.14555607966 -0.19434307138 + 5.15556688916 -0.19396570696 + 5.16557769865 -0.19358980518 + 5.17558850815 -0.19321535755 + 5.18559931764 -0.19284235564 + 5.19561012713 -0.19247079109 + 5.20562093663 -0.19210065562 + 5.21563174612 -0.19173194100 + 5.22564255561 -0.19136463906 + 5.23565336511 -0.19099874170 + 5.24566417460 -0.19063424088 + 5.25567498409 -0.19027112861 + 5.26568579359 -0.18990939699 + 5.27569660308 -0.18954903815 + 5.28570741257 -0.18919004429 + 5.29571822207 -0.18883240767 + 5.30572903156 -0.18847612060 + 5.31573984105 -0.18812117546 + 5.32575065055 -0.18776756469 + 5.33576146004 -0.18741528077 + 5.34577226954 -0.18706431626 + 5.35578307903 -0.18671466374 + 5.36579388852 -0.18636631588 + 5.37580469802 -0.18601926539 + 5.38581550751 -0.18567350503 + 5.39582631700 -0.18532902763 + 5.40583712650 -0.18498582605 + 5.41584793599 -0.18464389323 + 5.42585874548 -0.18430322213 + 5.43586955498 -0.18396380579 + 5.44588036447 -0.18362563730 + 5.45589117396 -0.18328870977 + 5.46590198346 -0.18295301639 + 5.47591279295 -0.18261855039 + 5.48592360244 -0.18228530506 + 5.49593441194 -0.18195327373 + 5.50594522143 -0.18162244977 + 5.51595603092 -0.18129282661 + 5.52596684042 -0.18096439773 + 5.53597764991 -0.18063715663 + 5.54598845941 -0.18031109691 + 5.55599926890 -0.17998621215 + 5.56601007839 -0.17966249604 + 5.57602088789 -0.17933994227 + 5.58603169738 -0.17901854459 + 5.59604250687 -0.17869829680 + 5.60605331637 -0.17837919274 + 5.61606412586 -0.17806122629 + 5.62607493535 -0.17774439137 + 5.63608574485 -0.17742868197 + 5.64609655434 -0.17711409209 + 5.65610736383 -0.17680061578 + 5.66611817333 -0.17648824715 + 5.67612898282 -0.17617698034 + 5.68613979231 -0.17586680953 + 5.69615060181 -0.17555772894 + 5.70616141130 -0.17524973283 + 5.71617222080 -0.17494281551 + 5.72618303029 -0.17463697132 + 5.73619383978 -0.17433219464 + 5.74620464928 -0.17402847988 + 5.75621545877 -0.17372582151 + 5.76622626826 -0.17342421402 + 5.77623707776 -0.17312365195 + 5.78624788725 -0.17282412987 + 5.79625869674 -0.17252564240 + 5.80626950624 -0.17222818419 + 5.81628031573 -0.17193174991 + 5.82629112522 -0.17163633430 + 5.83630193472 -0.17134193212 + 5.84631274421 -0.17104853816 + 5.85632355370 -0.17075614724 + 5.86633436320 -0.17046475424 + 5.87634517269 -0.17017435405 + 5.88635598218 -0.16988494161 + 5.89636679168 -0.16959651188 + 5.90637760117 -0.16930905987 + 5.91638841067 -0.16902258061 + 5.92639922016 -0.16873706918 + 5.93641002965 -0.16845252067 + 5.94642083915 -0.16816893023 + 5.95643164864 -0.16788629302 + 5.96644245813 -0.16760460425 + 5.97645326763 -0.16732385914 + 5.98646407712 -0.16704405297 + 5.99647488661 -0.16676518103 + 6.00648569611 -0.16648723866 + 6.01649650560 -0.16621022121 + 6.02650731509 -0.16593412407 + 6.03651812459 -0.16565894268 + 6.04652893408 -0.16538467247 + 6.05653974357 -0.16511130895 + 6.06655055307 -0.16483884761 + 6.07656136256 -0.16456728400 + 6.08657217206 -0.16429661369 + 6.09658298155 -0.16402683226 + 6.10659379104 -0.16375793536 + 6.11660460054 -0.16348991864 + 6.12661541003 -0.16322277777 + 6.13662621952 -0.16295650847 + 6.14663702902 -0.16269110649 + 6.15664783851 -0.16242656759 + 6.16665864800 -0.16216288758 + 6.17666945750 -0.16190006227 + 6.18668026699 -0.16163808752 + 6.19669107648 -0.16137695922 + 6.20670188598 -0.16111667326 + 6.21671269547 -0.16085722558 + 6.22672350496 -0.16059861213 + 6.23673431446 -0.16034082889 + 6.24674512395 -0.16008387188 + 6.25675593344 -0.15982773713 + 6.26676674294 -0.15957242070 + 6.27677755243 -0.15931791866 + 6.28678836193 -0.15906422714 + 6.29679917142 -0.15881134226 + 6.30680998091 -0.15855926019 + 6.31682079041 -0.15830797710 + 6.32683159990 -0.15805748921 + 6.33684240939 -0.15780779273 + 6.34685321889 -0.15755888393 + 6.35686402838 -0.15731075909 + 6.36687483787 -0.15706341450 + 6.37688564737 -0.15681684650 + 6.38689645686 -0.15657105143 + 6.39690726635 -0.15632602567 + 6.40691807585 -0.15608176561 + 6.41692888534 -0.15583826766 + 6.42693969483 -0.15559552828 + 6.43695050433 -0.15535354391 + 6.44696131382 -0.15511231105 + 6.45697212332 -0.15487182619 + 6.46698293281 -0.15463208586 + 6.47699374230 -0.15439308661 + 6.48700455180 -0.15415482501 + 6.49701536129 -0.15391729765 + 6.50702617078 -0.15368050113 + 6.51703698028 -0.15344443210 + 6.52704778977 -0.15320908720 + 6.53705859926 -0.15297446310 + 6.54706940876 -0.15274055650 + 6.55708021825 -0.15250736412 + 6.56709102774 -0.15227488269 + 6.57710183724 -0.15204310896 + 6.58711264673 -0.15181203971 + 6.59712345622 -0.15158167173 + 6.60713426572 -0.15135200182 + 6.61714507521 -0.15112302683 + 6.62715588470 -0.15089474361 + 6.63716669420 -0.15066714901 + 6.64717750369 -0.15044023994 + 6.65718831319 -0.15021401330 + 6.66719912268 -0.14998846601 + 6.67720993217 -0.14976359502 + 6.68722074167 -0.14953939729 + 6.69723155116 -0.14931586981 + 6.70724236065 -0.14909300957 + 6.71725317015 -0.14887081359 + 6.72726397964 -0.14864884194 + +# ATOM AND REFERENCE CONFIGURATION +# atsym z nc nv iexc psfile +H 1.00 0 1 4 upf +# +# n l f energy (Ha) +1 0 1.00 +# +# PSEUDOPOTENTIAL AND OPTIMIZATION +# lmax +1 +# +# l, rc, ep, ncon, nbas, qcut +0 1.00000 -0.23860 4 7 8.50000 +1 0.70000 0.05000 4 7 11.00000 +# +# LOCAL POTENTIAL +# lloc, lpopt, rc(5), dvloc0 +4 5 0.70000 0.00000 +# +# VANDERBILT-KLEINMAN-BYLANDER PROJECTORs +# l, nproj, debl +0 2 1.00000 +1 1 1.00000 +# +# MODEL CORE CHARGE +# icmod, fcfact, rcfact +0 0.00000 0.00000 +# +# LOG DERIVATIVE ANALYSIS +# epsh1, epsh2, depsh +-12.00 12.00 0.02 +# +# OUTPUT GRID +# rlmax, drl +3.00 0.01 + diff --git a/testsuite/test_008_surface_dipole/Longer.in b/testsuite/test_008_surface_dipole/Longer.in new file mode 100644 index 000000000..fc1c5f15e --- /dev/null +++ b/testsuite/test_008_surface_dipole/Longer.in @@ -0,0 +1,7 @@ + 5.66918063400000 0.00000000000000 0.00000000000000 + 0.00000000000000 5.66918063400000 0.00000000000000 + 0.00000000000000 0.00000000000000 14.99999999952342 + 3 + 0.3229424998 0.3229424998 0.5000000000 1 T T T + 0.0674088150 0.3229424998 0.5761442602 2 T T T + 0.5784761847 0.3229424998 0.5761442602 2 T T T diff --git a/testsuite/test_008_surface_dipole/O.ion b/testsuite/test_008_surface_dipole/O.ion new file mode 100644 index 000000000..d77a1c717 --- /dev/null +++ b/testsuite/test_008_surface_dipole/O.ion @@ -0,0 +1,3956 @@ + + + Git Branch: develop; tag, hash: v1.3-302-gab601c1b + Date generated : 2024/12/19 at 11:17 + + + Hamann code version : v3.3.1 + Hamann input file name: O.in (appended at end of file) + Core radii (bohr) : l=0 1.350 l=1 1.450 l=2 1.250 + 2 valence shells : 2s 2p + XC functional code : 000101 + XC description : GGA PBE96 + Includes partial core corrections + Pseudopotential type : ONCVPSP + + +O basis set with GGA PBE96 functional +n = 2, l = 0, 2 zetas + Radii: 4.91 2.58 +n = 2, l = 1, 2 zetas + Radii: 4.91 2.58 +n = 3, l = 2, 1 zetas, perturbative polarisation shell + Radii: 4.91 + + + O pb nrl pcec + + +O # Element symbol +O # Label + 8.00 # Atomic number + 6.0000000000 # Valence charge + 16.0000000000 # Mass + 0.0000000000 # Self energy + 2 5 # Lmax for basis, no of orbitals + 2 5 # Lmax for projectors, no of proj +# PAOs:_______________ + 0 2 1 0 2.000000 #orbital l, n, z, is_polarized, population + 492 0.0100088191331246 4.9143301943641768 + 0.00000000000 1.35992252930 + 0.01000881913 1.35996111231 + 0.02001763827 1.36007662611 + 0.03002645740 1.36026836708 + 0.04003527653 1.36053516420 + 0.05004409567 1.36087538175 + 0.06005291480 1.36128692308 + 0.07006173393 1.36176723549 + 0.08007055306 1.36231331612 + 0.09007937220 1.36292171902 + 0.10008819133 1.36358856326 + 0.11009701046 1.36430954220 + 0.12010582960 1.36507993388 + 0.13011464873 1.36589461252 + 0.14012346786 1.36674806116 + 0.15013228700 1.36763438544 + 0.16014110613 1.36854732856 + 0.17014992526 1.36948028728 + 0.18015874440 1.37042632915 + 0.19016756353 1.37137821074 + 0.20017638266 1.37232839709 + 0.21018520180 1.37326908210 + 0.22019402093 1.37419221005 + 0.23020284006 1.37508949806 + 0.24021165919 1.37595245952 + 0.25022047833 1.37677242844 + 0.26022929746 1.37754058463 + 0.27023811659 1.37824797958 + 0.28024693573 1.37888556317 + 0.29025575486 1.37944421087 + 0.30026457399 1.37991475153 + 0.31027339313 1.38028799557 + 0.32028221226 1.38055476348 + 0.33029103139 1.38070591463 + 0.34029985053 1.38073237597 + 0.35030866966 1.38062517098 + 0.36031748879 1.38037544824 + 0.37032630793 1.37997450991 + 0.38033512706 1.37941383970 + 0.39034394619 1.37868513040 + 0.40035276532 1.37778031070 + 0.41036158446 1.37669157132 + 0.42037040359 1.37541139016 + 0.43037922272 1.37393255648 + 0.44038804186 1.37224819397 + 0.45039686099 1.37035178254 + 0.46040568012 1.36823717879 + 0.47041449926 1.36589863503 + 0.48042331839 1.36333081680 + 0.49043213752 1.36052881876 + 0.50044095666 1.35748817891 + 0.51044977579 1.35420489110 + 0.52045859492 1.35067541573 + 0.53046741406 1.34689668867 + 0.54047623319 1.34286612832 + 0.55048505232 1.33858164079 + 0.56049387145 1.33404162332 + 0.57050269059 1.32924496573 + 0.58051150972 1.32419105015 + 0.59052032885 1.31887974895 + 0.60052914799 1.31331142084 + 0.61053796712 1.30748690543 + 0.62054678625 1.30140751603 + 0.63055560539 1.29507503100 + 0.64056442452 1.28849168354 + 0.65057324365 1.28166015022 + 0.66058206279 1.27458353809 + 0.67059088192 1.26726537075 + 0.68059970105 1.25970957320 + 0.69060852019 1.25192045584 + 0.70061733932 1.24390269755 + 0.71062615845 1.23566132804 + 0.72063497758 1.22720170956 + 0.73064379672 1.21852951808 + 0.74065261585 1.20965072409 + 0.75066143498 1.20057157308 + 0.76067025412 1.19129856577 + 0.77067907325 1.18183843831 + 0.78068789238 1.17219814239 + 0.79069671152 1.16238482553 + 0.80070553065 1.15240581139 + 0.81071434978 1.14226858043 + 0.82072316892 1.13198075081 + 0.83073198805 1.12155005964 + 0.84074080718 1.11098434468 + 0.85074962632 1.10029152646 + 0.86075844545 1.08947959089 + 0.87076726458 1.07855657240 + 0.88077608371 1.06753053763 + 0.89078490285 1.05640956964 + 0.90079372198 1.04520175274 + 0.91080254111 1.03391515783 + 0.92081136025 1.02255782831 + 0.93082017938 1.01113776662 + 0.94082899851 0.99966292121 + 0.95083781765 0.98814117416 + 0.96084663678 0.97658032916 + 0.97085545591 0.96498810017 + 0.98086427505 0.95337210038 + 0.99087309418 0.94173983168 + 1.00088191331 0.93009867460 + 1.01089073245 0.91845587855 + 1.02089955158 0.90681855254 + 1.03090837071 0.89519365618 + 1.04091718984 0.88358799105 + 1.05092600898 0.87200819244 + 1.06093482811 0.86046072131 + 1.07094364724 0.84895185667 + 1.08095246638 0.83748768815 + 1.09096128551 0.82607410896 + 1.10097010464 0.81471680910 + 1.11097892378 0.80342126891 + 1.12098774291 0.79219275287 + 1.13099656204 0.78103630386 + 1.14100538118 0.76995673759 + 1.15101420031 0.75895863757 + 1.16102301944 0.74804635032 + 1.17103183858 0.73722398109 + 1.18104065771 0.72649538994 + 1.19104947684 0.71586418833 + 1.20105829597 0.70533373618 + 1.21106711511 0.69490713939 + 1.22107593424 0.68458724799 + 1.23108475337 0.67437665479 + 1.24109357251 0.66427769464 + 1.25110239164 0.65429244428 + 1.26111121077 0.64442272283 + 1.27112002991 0.63467009299 + 1.28112884904 0.62503586276 + 1.29113766817 0.61552108800 + 1.30114648731 0.60612657550 + 1.31115530644 0.59685288686 + 1.32116412557 0.58770034294 + 1.33117294471 0.57866902936 + 1.34118176384 0.56975880145 + 1.35119058297 0.56096929163 + 1.36119940210 0.55229991128 + 1.37120822124 0.54374992158 + 1.38121704037 0.53531848676 + 1.39122585950 0.52700473909 + 1.40123467864 0.51880777897 + 1.41124349777 0.51072666270 + 1.42125231690 0.50276041567 + 1.43126113604 0.49490803284 + 1.44126995517 0.48716848178 + 1.45127877430 0.47954070536 + 1.46128759344 0.47202362431 + 1.47129641257 0.46461613927 + 1.48130523170 0.45731713284 + 1.49131405084 0.45012547206 + 1.50132286997 0.44304001029 + 1.51133168910 0.43605958898 + 1.52134050823 0.42918303935 + 1.53134932737 0.42240918403 + 1.54135814650 0.41573683859 + 1.55136696563 0.40916481291 + 1.56137578477 0.40269191259 + 1.57138460390 0.39631694015 + 1.58139342303 0.39003869621 + 1.59140224217 0.38385598059 + 1.60141106130 0.37776759335 + 1.61141988043 0.37177233572 + 1.62142869957 0.36586901102 + 1.63143751870 0.36005642549 + 1.64144633783 0.35433338907 + 1.65145515697 0.34869871610 + 1.66146397610 0.34315122603 + 1.67147279523 0.33768974403 + 1.68148161436 0.33231310156 + 1.69149043350 0.32702013695 + 1.70149925263 0.32180969582 + 1.71150807176 0.31668063162 + 1.72151689090 0.31163180600 + 1.73152571003 0.30666208923 + 1.74153452916 0.30177036053 + 1.75154334830 0.29695550843 + 1.76155216743 0.29221643102 + 1.77156098656 0.28755203627 + 1.78156980570 0.28296124224 + 1.79157862483 0.27844297732 + 1.80158744396 0.27399618042 + 1.81159626310 0.26961980115 + 1.82160508223 0.26531279997 + 1.83161390136 0.26107414834 + 1.84162272049 0.25690282884 + 1.85163153963 0.25279783526 + 1.86164035876 0.24875817271 + 1.87164917789 0.24478285765 + 1.88165799703 0.24087091802 + 1.89166681616 0.23702139321 + 1.90167563529 0.23323333416 + 1.91168445443 0.22950580332 + 1.92169327356 0.22583787472 + 1.93170209269 0.22222863395 + 1.94171091183 0.21867717812 + 1.95171973096 0.21518261592 + 1.96172855009 0.21174406750 + 1.97173736923 0.20836066453 + 1.98174618836 0.20503155009 + 1.99175500749 0.20175587868 + 2.00176382662 0.19853281611 + 2.01177264576 0.19536153951 + 2.02178146489 0.19224123722 + 2.03179028402 0.18917110872 + 2.04179910316 0.18615036459 + 2.05180792229 0.18317822641 + 2.06181674142 0.18025392669 + 2.07182556056 0.17737670879 + 2.08183437969 0.17454582682 + 2.09184319882 0.17176054555 + 2.10185201796 0.16902014033 + 2.11186083709 0.16632389700 + 2.12186965622 0.16367111177 + 2.13187847536 0.16106109113 + 2.14188729449 0.15849315177 + 2.15189611362 0.15596662043 + 2.16190493275 0.15348083387 + 2.17191375189 0.15103513867 + 2.18192257102 0.14862889120 + 2.19193139015 0.14626145750 + 2.20194020929 0.14393221312 + 2.21194902842 0.14164054309 + 2.22195784755 0.13938584173 + 2.23196666669 0.13716751261 + 2.24197548582 0.13498496841 + 2.25198430495 0.13283763079 + 2.26199312409 0.13072493030 + 2.27200194322 0.12864630630 + 2.28201076235 0.12660120678 + 2.29201958149 0.12458908830 + 2.30202840062 0.12260941588 + 2.31203721975 0.12066166287 + 2.32204603888 0.11874531085 + 2.33205485802 0.11685984951 + 2.34206367715 0.11500477657 + 2.35207249628 0.11317959763 + 2.36208131542 0.11138382612 + 2.37209013455 0.10961698311 + 2.38209895368 0.10787859731 + 2.39210777282 0.10616820485 + 2.40211659195 0.10448534928 + 2.41212541108 0.10282958140 + 2.42213423022 0.10120045917 + 2.43214304935 0.09959754762 + 2.44215186848 0.09802041875 + 2.45216068762 0.09646865140 + 2.46216950675 0.09494183120 + 2.47217832588 0.09343955042 + 2.48218714501 0.09196140790 + 2.49219596415 0.09050700897 + 2.50220478328 0.08907596530 + 2.51221360241 0.08766789486 + 2.52222242155 0.08628242179 + 2.53223124068 0.08491917635 + 2.54224005981 0.08357779475 + 2.55224887895 0.08225791916 + 2.56225769808 0.08095919753 + 2.57226651721 0.07968128357 + 2.58227533635 0.07842383660 + 2.59228415548 0.07718652153 + 2.60229297461 0.07596900871 + 2.61230179375 0.07477097389 + 2.62231061288 0.07359209813 + 2.63231943201 0.07243206768 + 2.64232825114 0.07129057396 + 2.65233707028 0.07016731342 + 2.66234588941 0.06906198751 + 2.67235470854 0.06797430256 + 2.68236352768 0.06690396974 + 2.69237234681 0.06585070495 + 2.70238116594 0.06481422877 + 2.71238998508 0.06379426636 + 2.72239880421 0.06279054742 + 2.73240762334 0.06180280610 + 2.74241644248 0.06083078091 + 2.75242526161 0.05987421469 + 2.76243408074 0.05893285450 + 2.77244289988 0.05800645159 + 2.78245171901 0.05709476130 + 2.79246053814 0.05619754301 + 2.80246935727 0.05531456007 + 2.81247817641 0.05444557974 + 2.82248699554 0.05359037312 + 2.83249581467 0.05274871510 + 2.84250463381 0.05192038426 + 2.85251345294 0.05110516289 + 2.86252227207 0.05030283682 + 2.87253109121 0.04951319546 + 2.88253991034 0.04873603168 + 2.89254872947 0.04797114179 + 2.90255754861 0.04721832545 + 2.91256636774 0.04647738564 + 2.92257518687 0.04574812860 + 2.93258400601 0.04503036378 + 2.94259282514 0.04432390375 + 2.95260164427 0.04362856420 + 2.96261046340 0.04294416388 + 2.97261928254 0.04227052451 + 2.98262810167 0.04160747077 + 2.99263692080 0.04095483023 + 3.00264573994 0.04031243331 + 3.01265455907 0.03968011324 + 3.02266337820 0.03905770600 + 3.03267219734 0.03844505027 + 3.04268101647 0.03784198739 + 3.05268983560 0.03724836135 + 3.06269865474 0.03666401868 + 3.07270747387 0.03608880845 + 3.08271629300 0.03552258224 + 3.09272511214 0.03496519404 + 3.10273393127 0.03441650029 + 3.11274275040 0.03387635976 + 3.12275156953 0.03334463357 + 3.13276038867 0.03282118510 + 3.14276920780 0.03230588001 + 3.15277802693 0.03179858614 + 3.16278684607 0.03129917354 + 3.17279566520 0.03080751436 + 3.18280448433 0.03032348288 + 3.19281330347 0.02984695542 + 3.20282212260 0.02937781035 + 3.21283094173 0.02891592802 + 3.22283976087 0.02846119077 + 3.23284858000 0.02801348282 + 3.24285739913 0.02757269035 + 3.25286621827 0.02713870135 + 3.26287503740 0.02671140567 + 3.27288385653 0.02629069496 + 3.28289267566 0.02587646263 + 3.29290149480 0.02546860385 + 3.30291031393 0.02506701549 + 3.31291913306 0.02467159611 + 3.32292795220 0.02428224591 + 3.33293677133 0.02389886673 + 3.34294559046 0.02352136201 + 3.35295440960 0.02314963675 + 3.36296322873 0.02278359751 + 3.37297204786 0.02242315237 + 3.38298086700 0.02206821087 + 3.39298968613 0.02171868407 + 3.40299850526 0.02137448443 + 3.41300732440 0.02103552586 + 3.42301614353 0.02070172364 + 3.43302496266 0.02037299443 + 3.44303378179 0.02004925625 + 3.45304260093 0.01973042843 + 3.46305142006 0.01941643160 + 3.47306023919 0.01910718768 + 3.48306905833 0.01880261985 + 3.49307787746 0.01850265253 + 3.50308669659 0.01820721133 + 3.51309551573 0.01791622309 + 3.52310433486 0.01762961581 + 3.53311315399 0.01734731865 + 3.54312197313 0.01706926189 + 3.55313079226 0.01679537694 + 3.56313961139 0.01652559632 + 3.57314843053 0.01625985361 + 3.58315724966 0.01599808346 + 3.59316606879 0.01574022155 + 3.60317488792 0.01548620460 + 3.61318370706 0.01523597034 + 3.62319252619 0.01498945747 + 3.63320134532 0.01474660569 + 3.64321016446 0.01450735564 + 3.65321898359 0.01427164891 + 3.66322780272 0.01403942801 + 3.67323662186 0.01381063635 + 3.68324544099 0.01358521827 + 3.69325426012 0.01336311894 + 3.70326307926 0.01314428443 + 3.71327189839 0.01292866164 + 3.72328071752 0.01271619833 + 3.73328953666 0.01250684304 + 3.74329835579 0.01230054517 + 3.75330717492 0.01209725486 + 3.76331599405 0.01189692306 + 3.77332481319 0.01169950149 + 3.78333363232 0.01150494260 + 3.79334245145 0.01131319961 + 3.80335127059 0.01112422645 + 3.81336008972 0.01093797777 + 3.82336890885 0.01075440892 + 3.83337772799 0.01057347594 + 3.84338654712 0.01039513557 + 3.85339536625 0.01021934520 + 3.86340418539 0.01004606287 + 3.87341300452 0.00987524729 + 3.88342182365 0.00970685780 + 3.89343064279 0.00954085434 + 3.90343946192 0.00937719749 + 3.91344828105 0.00921584843 + 3.92345710018 0.00905676891 + 3.93346591932 0.00889992130 + 3.94347473845 0.00874526852 + 3.95348355758 0.00859277405 + 3.96349237672 0.00844240194 + 3.97350119585 0.00829411676 + 3.98351001498 0.00814788365 + 3.99351883412 0.00800366824 + 4.00352765325 0.00786143671 + 4.01353647238 0.00772115571 + 4.02354529152 0.00758279243 + 4.03355411065 0.00744631453 + 4.04356292978 0.00731169015 + 4.05357174892 0.00717888791 + 4.06358056805 0.00704787689 + 4.07358938718 0.00691862664 + 4.08359820631 0.00679110715 + 4.09360702545 0.00666528887 + 4.10361584458 0.00654114265 + 4.11362466371 0.00641863980 + 4.12363348285 0.00629775205 + 4.13364230198 0.00617845151 + 4.14365112111 0.00606071074 + 4.15365994025 0.00594450266 + 4.16366875938 0.00582980061 + 4.17367757851 0.00571657830 + 4.18368639765 0.00560480982 + 4.19369521678 0.00549446964 + 4.20370403591 0.00538553259 + 4.21371285505 0.00527797386 + 4.22372167418 0.00517176899 + 4.23373049331 0.00506689387 + 4.24373931244 0.00496332473 + 4.25374813158 0.00486103813 + 4.26375695071 0.00476001097 + 4.27376576984 0.00466022047 + 4.28377458898 0.00456164415 + 4.29378340811 0.00446425987 + 4.30379222724 0.00436804577 + 4.31380104638 0.00427298031 + 4.32380986551 0.00417904224 + 4.33381868464 0.00408621059 + 4.34382750378 0.00399446470 + 4.35383632291 0.00390378415 + 4.36384514204 0.00381414883 + 4.37385396118 0.00372553890 + 4.38386278031 0.00363793475 + 4.39387159944 0.00355131708 + 4.40388041857 0.00346566680 + 4.41388923771 0.00338096510 + 4.42389805684 0.00329719340 + 4.43390687597 0.00321433338 + 4.44391569511 0.00313236694 + 4.45392451424 0.00305127622 + 4.46393333337 0.00297104359 + 4.47394215251 0.00289165164 + 4.48395097164 0.00281308318 + 4.49395979077 0.00273532125 + 4.50396860991 0.00265834909 + 4.51397742904 0.00258215014 + 4.52398624817 0.00250670807 + 4.53399506731 0.00243200671 + 4.54400388644 0.00235803014 + 4.55401270557 0.00228476258 + 4.56402152470 0.00221218848 + 4.57403034384 0.00214029244 + 4.58403916297 0.00206905928 + 4.59404798210 0.00199847396 + 4.60405680124 0.00192852164 + 4.61406562037 0.00185918765 + 4.62407443950 0.00179045747 + 4.63408325864 0.00172231675 + 4.64409207777 0.00165475133 + 4.65410089690 0.00158774716 + 4.66410971604 0.00152129039 + 4.67411853517 0.00145536728 + 4.68412735430 0.00138996427 + 4.69413617344 0.00132506792 + 4.70414499257 0.00126066497 + 4.71415381170 0.00119674225 + 4.72416263083 0.00113328675 + 4.73417144997 0.00107028561 + 4.74418026910 0.00100772607 + 4.75418908823 0.00094559552 + 4.76419790737 0.00088388144 + 4.77420672650 0.00082257149 + 4.78421554563 0.00076165338 + 4.79422436477 0.00070111500 + 4.80423318390 0.00064094430 + 4.81424200303 0.00058112937 + 4.82425082217 0.00052165841 + 4.83425964130 0.00046251971 + 4.84426846043 0.00040370168 + 4.85427727957 0.00034519282 + 4.86428609870 0.00028698158 + 4.87429491783 0.00022905675 + 4.88430373696 0.00017140718 + 4.89431255610 0.00011402182 + 4.90432137523 0.00005688971 + 4.91433019436 0.00000000000 + 0 2 2 0 0.000000 #orbital l, n, z, is_polarized, population + 259 0.0100022326572360 2.5805760255668990 + 0.00000000000 1.59116760159 + 0.01000223266 1.59122578455 + 0.02000446531 1.59140000010 + 0.03000669797 1.59168925129 + 0.04000893063 1.59209187886 + 0.05001116329 1.59260556510 + 0.06001339594 1.59322733921 + 0.07001562860 1.59395358414 + 0.08001786126 1.59478004499 + 0.09002009392 1.59570183898 + 0.10002232657 1.59671346693 + 0.11002455923 1.59780882638 + 0.12002679189 1.59898122629 + 0.13002902454 1.60022340331 + 0.14003125720 1.60152753967 + 0.15003348986 1.60288528273 + 0.16003572252 1.60428776601 + 0.17003795517 1.60572563198 + 0.18004018783 1.60718905637 + 0.19004242049 1.60866777397 + 0.20004465314 1.61015110617 + 0.21004688580 1.61162798978 + 0.22004911846 1.61308700754 + 0.23005135112 1.61451641984 + 0.24005358377 1.61590419795 + 0.25005581643 1.61723805842 + 0.26005804909 1.61850549871 + 0.27006028175 1.61969383392 + 0.28006251440 1.62079023443 + 0.29006474706 1.62178176458 + 0.30006697972 1.62265542187 + 0.31006921237 1.62339817692 + 0.32007144503 1.62399701387 + 0.33007367769 1.62443897103 + 0.34007591035 1.62471118169 + 0.35007814300 1.62480091497 + 0.36008037566 1.62469561638 + 0.37008260832 1.62438294810 + 0.38008484097 1.62385082862 + 0.39008707363 1.62308747173 + 0.40008930629 1.62208142459 + 0.41009153895 1.62082160462 + 0.42009377160 1.61929733529 + 0.43009600426 1.61749838031 + 0.44009823692 1.61541497640 + 0.45010046958 1.61303786412 + 0.46010270223 1.61035831700 + 0.47010493489 1.60736816849 + 0.48010716755 1.60405983681 + 0.49010940020 1.60042634757 + 0.50011163286 1.59646135395 + 0.51011386552 1.59215915451 + 0.52011609818 1.58751470841 + 0.53011833083 1.58252364813 + 0.54012056349 1.57718228956 + 0.55012279615 1.57148763944 + 0.56012502881 1.56543740025 + 0.57012726146 1.55902997240 + 0.58012949412 1.55226445394 + 0.59013172678 1.54514063767 + 0.60013395943 1.53765900579 + 0.61013619209 1.52982072223 + 0.62013842475 1.52162762254 + 0.63014065741 1.51308220175 + 0.64014289006 1.50418760003 + 0.65014512272 1.49494758643 + 0.66014735538 1.48536654079 + 0.67014958803 1.47544943403 + 0.68015182069 1.46520180679 + 0.69015405335 1.45462974684 + 0.70015628601 1.44373986512 + 0.71015851866 1.43253927083 + 0.72016075132 1.42103554557 + 0.73016298398 1.40923671674 + 0.74016521664 1.39715123033 + 0.75016744929 1.38478792330 + 0.76016968195 1.37215599566 + 0.77017191461 1.35926498236 + 0.78017414726 1.34612472519 + 0.79017637992 1.33274534478 + 0.80017861258 1.31913721281 + 0.81018084524 1.30531092454 + 0.82018307789 1.29127727172 + 0.83018531055 1.27704721608 + 0.84018754321 1.26263186333 + 0.85018977587 1.24804243783 + 0.86019200852 1.23329025791 + 0.87019424118 1.21838671198 + 0.88019647384 1.20334323537 + 0.89019870649 1.18817128795 + 0.90020093915 1.17288233254 + 0.91020317181 1.15748781419 + 0.92020540447 1.14199914016 + 0.93020763712 1.12642766074 + 0.94020986978 1.11078465087 + 0.95021210244 1.09508129244 + 0.96021433509 1.07932865740 + 0.97021656775 1.06353769143 + 0.98021880041 1.04771919846 + 0.99022103307 1.03188382566 + 1.00022326572 1.01604204910 + 1.01022549838 1.00020415998 + 1.02022773104 0.98438025141 + 1.03022996370 0.96858020562 + 1.04023219635 0.95281368177 + 1.05023442901 0.93709010415 + 1.06023666167 0.92141865081 + 1.07023889432 0.90580824271 + 1.08024112698 0.89026753324 + 1.09024335964 0.87480489811 + 1.10024559230 0.85942842582 + 1.11024782495 0.84414590837 + 1.12025005761 0.82896483260 + 1.13025229027 0.81389237188 + 1.14025452292 0.79893537830 + 1.15025675558 0.78410037544 + 1.16025898824 0.76939355156 + 1.17026122090 0.75482075352 + 1.18026345355 0.74038748115 + 1.19026568621 0.72609888238 + 1.20026791887 0.71195974904 + 1.21027015153 0.69797451327 + 1.22027238418 0.68414724485 + 1.23027461684 0.67048164923 + 1.24027684950 0.65698106636 + 1.25027908215 0.64364847048 + 1.26028131481 0.63048647076 + 1.27028354747 0.61749731277 + 1.28028578013 0.60468288103 + 1.29028801278 0.59204470243 + 1.30029024544 0.57958395054 + 1.31029247810 0.56730145102 + 1.32029471076 0.55519768786 + 1.33029694341 0.54327281098 + 1.34029917607 0.53152664305 + 1.35030140873 0.51995869157 + 1.36030364138 0.50856814663 + 1.37030587404 0.49735397510 + 1.38030810670 0.48631500199 + 1.39031033936 0.47544999824 + 1.40031257201 0.46475769479 + 1.41031480467 0.45423675781 + 1.42031703733 0.44388580979 + 1.43031926998 0.43370342945 + 1.44032150264 0.42368815649 + 1.45032373530 0.41383849518 + 1.46032596796 0.40415291812 + 1.47032820061 0.39462986919 + 1.48033043327 0.38526776639 + 1.49033266593 0.37606500535 + 1.50033489859 0.36701996212 + 1.51033713124 0.35813099557 + 1.52033936390 0.34939644987 + 1.53034159656 0.34081465681 + 1.54034382921 0.33238393794 + 1.55034606187 0.32410260658 + 1.56034829453 0.31596896978 + 1.57035052719 0.30798133005 + 1.58035275984 0.30013798704 + 1.59035499250 0.29243723914 + 1.60035722516 0.28487738488 + 1.61035945782 0.27745672437 + 1.62036169047 0.27017356052 + 1.63036392313 0.26302620025 + 1.64036615579 0.25601295560 + 1.65036838844 0.24913214479 + 1.66037062110 0.24238209312 + 1.67037285376 0.23576113395 + 1.68037508642 0.22926760944 + 1.69037731907 0.22289987138 + 1.70037955173 0.21665628186 + 1.71038178439 0.21053521399 + 1.72038401704 0.20453505240 + 1.73038624970 0.19865419390 + 1.74038848236 0.19289104793 + 1.75039071502 0.18724403704 + 1.76039294767 0.18171159733 + 1.77039518033 0.17629217880 + 1.78039741299 0.17098424575 + 1.79039964565 0.16578627707 + 1.80040187830 0.16069676651 + 1.81040411096 0.15571422298 + 1.82040634362 0.15083717073 + 1.83040857627 0.14606414956 + 1.84041080893 0.14139371501 + 1.85041304159 0.13682443851 + 1.86041527425 0.13235490748 + 1.87041750690 0.12798372544 + 1.88041973956 0.12370951215 + 1.89042197222 0.11953090361 + 1.90042420487 0.11544655213 + 1.91042643753 0.11145512639 + 1.92042867019 0.10755531144 + 1.93043090285 0.10374580870 + 1.94043313550 0.10002533596 + 1.95043536816 0.09639262734 + 1.96043760082 0.09284643331 + 1.97043983348 0.08938552058 + 1.98044206613 0.08600867208 + 1.99044429879 0.08271468692 + 2.00044653145 0.07950238025 + 2.01044876410 0.07637058324 + 2.02045099676 0.07331814300 + 2.03045322942 0.07034392242 + 2.04045546208 0.06744680012 + 2.05045769473 0.06462567033 + 2.06045992739 0.06187944280 + 2.07046216005 0.05920704264 + 2.08046439271 0.05660741021 + 2.09046662536 0.05407950102 + 2.10046885802 0.05162228558 + 2.11047109068 0.04923474926 + 2.12047332333 0.04691589215 + 2.13047555599 0.04466472896 + 2.14047778865 0.04248028882 + 2.15048002131 0.04036161517 + 2.16048225396 0.03830776561 + 2.17048448662 0.03631781175 + 2.18048671928 0.03439083904 + 2.19048895193 0.03252594665 + 2.20049118459 0.03072224729 + 2.21049341725 0.02897886707 + 2.22049564991 0.02729494535 + 2.23049788256 0.02566963456 + 2.24050011522 0.02410210008 + 2.25050234788 0.02259152005 + 2.26050458054 0.02113708523 + 2.27050681319 0.01973799886 + 2.28050904585 0.01839347645 + 2.29051127851 0.01710274570 + 2.30051351116 0.01586504627 + 2.31051574382 0.01467962968 + 2.32051797648 0.01354575911 + 2.33052020914 0.01246270930 + 2.34052244179 0.01142976635 + 2.35052467445 0.01044622756 + 2.36052690711 0.00951140133 + 2.37052913976 0.00862460696 + 2.38053137242 0.00778517454 + 2.39053360508 0.00699244475 + 2.40053583774 0.00624576876 + 2.41053807039 0.00554450806 + 2.42054030305 0.00488803430 + 2.43054253571 0.00427572918 + 2.44054476837 0.00370698428 + 2.45054700102 0.00318120093 + 2.46054923368 0.00269779005 + 2.47055146634 0.00225617205 + 2.48055369899 0.00185577664 + 2.49055593165 0.00149604273 + 2.50055816431 0.00117641828 + 2.51056039697 0.00089636016 + 2.52056262962 0.00065533403 + 2.53056486228 0.00045281420 + 2.54056709494 0.00028828352 + 2.55056932760 0.00016123318 + 2.56057156025 0.00007116211 + 2.57057379291 0.00001757881 + 2.58057602557 0.00000000000 + 1 2 1 0 4.000000 #orbital l, n, z, is_polarized, population + 492 0.0100088191331246 4.9143301943641768 + 0.00000000000 4.59876619862 + 0.01000881913 4.59781129185 + 0.02001763827 4.59494787760 + 0.03002645740 4.59017988859 + 0.04003527653 4.58351386905 + 0.05004409567 4.57495896115 + 0.06005291480 4.56452688564 + 0.07006173393 4.55223191692 + 0.08007055306 4.53809085270 + 0.09007937220 4.52212297819 + 0.10008819133 4.50435002512 + 0.11009701046 4.48479612540 + 0.12010582960 4.46348775982 + 0.13011464873 4.44045370168 + 0.14012346786 4.41572495555 + 0.15013228700 4.38933469134 + 0.16014110613 4.36131817379 + 0.17014992526 4.33171268750 + 0.18015874440 4.30055745780 + 0.19016756353 4.26789356751 + 0.20017638266 4.23376386991 + 0.21018520180 4.19821289797 + 0.22019402093 4.16128677038 + 0.23020284006 4.12303309416 + 0.24021165919 4.08350086455 + 0.25022047833 4.04274036211 + 0.26022929746 4.00080304755 + 0.27023811659 3.95774145431 + 0.28024693573 3.91360907940 + 0.29025575486 3.86846027273 + 0.30026457399 3.82235012517 + 0.31027339313 3.77533435567 + 0.32028221226 3.72746919787 + 0.33029103139 3.67881128643 + 0.34029985053 3.62941754322 + 0.35030866966 3.57934506416 + 0.36031748879 3.52865100650 + 0.37032630793 3.47739247731 + 0.38033512706 3.42562642317 + 0.39034394619 3.37340952157 + 0.40035276532 3.32079807433 + 0.41036158446 3.26784790313 + 0.42037040359 3.21461424784 + 0.43037922272 3.16115166746 + 0.44038804186 3.10751394441 + 0.45039686099 3.05375399207 + 0.46040568012 2.99992376604 + 0.47041449926 2.94607417927 + 0.48042331839 2.89225502127 + 0.49043213752 2.83851488164 + 0.50044095666 2.78490107812 + 0.51044977579 2.73145958925 + 0.52045859492 2.67823499183 + 0.53046741406 2.62527040335 + 0.54047623319 2.57260742940 + 0.55048505232 2.52028611618 + 0.56049387145 2.46834490826 + 0.57050269059 2.41682061141 + 0.58051150972 2.36574836083 + 0.59052032885 2.31516159439 + 0.60052914799 2.26509203124 + 0.61053796712 2.21556965547 + 0.62054678625 2.16662270485 + 0.63055560539 2.11827766458 + 0.64056442452 2.07055926589 + 0.65057324365 2.02349048941 + 0.66058206279 1.97709257313 + 0.67059088192 1.93138502483 + 0.68059970105 1.88638563878 + 0.69060852019 1.84211051653 + 0.70061733932 1.79857409154 + 0.71062615845 1.75578915762 + 0.72063497758 1.71376690067 + 0.73064379672 1.67251693377 + 0.74065261585 1.63204733523 + 0.75066143498 1.59236468944 + 0.76067025412 1.55347413013 + 0.77067907325 1.51537938609 + 0.78068789238 1.47808282877 + 0.79069671152 1.44158552174 + 0.80070553065 1.40588727171 + 0.81071434978 1.37098668084 + 0.82072316892 1.33688120013 + 0.83073198805 1.30356718372 + 0.84074080718 1.27103994376 + 0.85074962632 1.23929380571 + 0.86075844545 1.20832216394 + 0.87076726458 1.17811753723 + 0.88077608371 1.14867162425 + 0.89078490285 1.11997535856 + 0.90079372198 1.09201896326 + 0.91080254111 1.06479200486 + 0.92081136025 1.03828344648 + 0.93082017938 1.01248170000 + 0.94082899851 0.98737467728 + 0.95083781765 0.96294984019 + 0.96084663678 0.93919424939 + 0.97085545591 0.91609461178 + 0.98086427505 0.89363732658 + 0.99087309418 0.87180852990 + 1.00088191331 0.85059413782 + 1.01089073245 0.82997988789 + 1.02089955158 0.80995137902 + 1.03090837071 0.79049410975 + 1.04091718984 0.77159351485 + 1.05092600898 0.75323500028 + 1.06093482811 0.73540397644 + 1.07094364724 0.71808588981 + 1.08095246638 0.70126625281 + 1.09096128551 0.68493067210 + 1.10097010464 0.66906487520 + 1.11097892378 0.65365473544 + 1.12098774291 0.63868629537 + 1.13099656204 0.62414578848 + 1.14100538118 0.61001965946 + 1.15101420031 0.59629458286 + 1.16102301944 0.58295748025 + 1.17103183858 0.56999553587 + 1.18104065771 0.55739621093 + 1.19104947684 0.54514725633 + 1.20105829597 0.53323672418 + 1.21106711511 0.52165297777 + 1.22107593424 0.51038470038 + 1.23108475337 0.49942090271 + 1.24109357251 0.48875092906 + 1.25110239164 0.47836446232 + 1.26111121077 0.46825152772 + 1.27112002991 0.45840249548 + 1.28112884904 0.44880808230 + 1.29113766817 0.43945935175 + 1.30114648731 0.43034771365 + 1.31115530644 0.42146492238 + 1.32116412557 0.41280307430 + 1.33117294471 0.40435460409 + 1.34118176384 0.39611228035 + 1.35119058297 0.38806920017 + 1.36119940210 0.38021878297 + 1.37120822124 0.37255476362 + 1.38121704037 0.36507118483 + 1.39122585950 0.35776238863 + 1.40123467864 0.35062300734 + 1.41124349777 0.34364795387 + 1.42125231690 0.33683241167 + 1.43126113604 0.33017182390 + 1.44126995517 0.32366188267 + 1.45127877430 0.31729851732 + 1.46128759344 0.31107788624 + 1.47129641257 0.30499632299 + 1.48130523170 0.29905029772 + 1.49131405084 0.29323638239 + 1.50132286997 0.28755123557 + 1.51133168910 0.28199161850 + 1.52134050823 0.27655438119 + 1.53134932737 0.27123646325 + 1.54135814650 0.26603489002 + 1.55136696563 0.26094677017 + 1.56137578477 0.25596929307 + 1.57138460390 0.25109972634 + 1.58139342303 0.24633541342 + 1.59140224217 0.24167377126 + 1.60141106130 0.23711228803 + 1.61141988043 0.23264852099 + 1.62142869957 0.22828009436 + 1.63143751870 0.22400469729 + 1.64144633783 0.21982008190 + 1.65145515697 0.21572406135 + 1.66146397610 0.21171450806 + 1.67147279523 0.20778935185 + 1.68148161436 0.20394657830 + 1.69149043350 0.20018422700 + 1.70149925263 0.19650039004 + 1.71150807176 0.19289321035 + 1.72151689090 0.18936088025 + 1.73152571003 0.18590163998 + 1.74153452916 0.18251377631 + 1.75154334830 0.17919562109 + 1.76155216743 0.17594555006 + 1.77156098656 0.17276198142 + 1.78156980570 0.16964337474 + 1.79157862483 0.16658822962 + 1.80158744396 0.16359508464 + 1.81159626310 0.16066251617 + 1.82160508223 0.15778913730 + 1.83161390136 0.15497359679 + 1.84162272049 0.15221457804 + 1.85163153963 0.14951079811 + 1.86164035876 0.14686100675 + 1.87164917789 0.14426398547 + 1.88165799703 0.14171854665 + 1.89166681616 0.13922353269 + 1.90167563529 0.13677781511 + 1.91168445443 0.13438029377 + 1.92169327356 0.13202989609 + 1.93170209269 0.12972557623 + 1.94171091183 0.12746631440 + 1.95171973096 0.12525111612 + 1.96172855009 0.12307901149 + 1.97173736923 0.12094905454 + 1.98174618836 0.11886032261 + 1.99175500749 0.11681191560 + 2.00176382662 0.11480295549 + 2.01177264576 0.11283258562 + 2.02178146489 0.11089997020 + 2.03179028402 0.10900429367 + 2.04179910316 0.10714476021 + 2.05180792229 0.10532059318 + 2.06181674142 0.10353103462 + 2.07182556056 0.10177534472 + 2.08183437969 0.10005280138 + 2.09184319882 0.09836269970 + 2.10185201796 0.09670435155 + 2.11186083709 0.09507708509 + 2.12186965622 0.09348024441 + 2.13187847536 0.09191318902 + 2.14188729449 0.09037529351 + 2.15189611362 0.08886594714 + 2.16190493275 0.08738455345 + 2.17191375189 0.08593052989 + 2.18192257102 0.08450330747 + 2.19193139015 0.08310233038 + 2.20194020929 0.08172705570 + 2.21194902842 0.08037695302 + 2.22195784755 0.07905150415 + 2.23196666669 0.07775020279 + 2.24197548582 0.07647255422 + 2.25198430495 0.07521807505 + 2.26199312409 0.07398629289 + 2.27200194322 0.07277674606 + 2.28201076235 0.07158898338 + 2.29201958149 0.07042256385 + 2.30202840062 0.06927705641 + 2.31203721975 0.06815203972 + 2.32204603888 0.06704710186 + 2.33205485802 0.06596184016 + 2.34206367715 0.06489586092 + 2.35207249628 0.06384877922 + 2.36208131542 0.06282021869 + 2.37209013455 0.06180981130 + 2.38209895368 0.06081719715 + 2.39210777282 0.05984202429 + 2.40211659195 0.05888394851 + 2.41212541108 0.05794263314 + 2.42213423022 0.05701774892 + 2.43214304935 0.05610897375 + 2.44215186848 0.05521599255 + 2.45216068762 0.05433849711 + 2.46216950675 0.05347618591 + 2.47217832588 0.05262876392 + 2.48218714501 0.05179594252 + 2.49219596415 0.05097743928 + 2.50220478328 0.05017297786 + 2.51221360241 0.04938228784 + 2.52222242155 0.04860510458 + 2.53223124068 0.04784116909 + 2.54224005981 0.04709022790 + 2.55224887895 0.04635203293 + 2.56225769808 0.04562634135 + 2.57226651721 0.04491291548 + 2.58227533635 0.04421152264 + 2.59228415548 0.04352193507 + 2.60229297461 0.04284392978 + 2.61230179375 0.04217728847 + 2.62231061288 0.04152179739 + 2.63231943201 0.04087724728 + 2.64232825114 0.04024343321 + 2.65233707028 0.03962015452 + 2.66234588941 0.03900721472 + 2.67235470854 0.03840442139 + 2.68236352768 0.03781158606 + 2.69237234681 0.03722852416 + 2.70238116594 0.03665505492 + 2.71238998508 0.03609100127 + 2.72239880421 0.03553618977 + 2.73240762334 0.03499045053 + 2.74241644248 0.03445361711 + 2.75242526161 0.03392552646 + 2.76243408074 0.03340601884 + 2.77244289988 0.03289493776 + 2.78245171901 0.03239212989 + 2.79246053814 0.03189744497 + 2.80246935727 0.03141073579 + 2.81247817641 0.03093185809 + 2.82248699554 0.03046067050 + 2.83249581467 0.02999703448 + 2.84250463381 0.02954081426 + 2.85251345294 0.02909187677 + 2.86252227207 0.02865009158 + 2.87253109121 0.02821533087 + 2.88253991034 0.02778746933 + 2.89254872947 0.02736638412 + 2.90255754861 0.02695195485 + 2.91256636774 0.02654406348 + 2.92257518687 0.02614259429 + 2.93258400601 0.02574743383 + 2.94259282514 0.02535847086 + 2.95260164427 0.02497559633 + 2.96261046340 0.02459870330 + 2.97261928254 0.02422768691 + 2.98262810167 0.02386244434 + 2.99263692080 0.02350287475 + 3.00264573994 0.02314887926 + 3.01265455907 0.02280036089 + 3.02266337820 0.02245722453 + 3.03267219734 0.02211937689 + 3.04268101647 0.02178672646 + 3.05268983560 0.02145918351 + 3.06269865474 0.02113665998 + 3.07270747387 0.02081906953 + 3.08271629300 0.02050632744 + 3.09272511214 0.02019835059 + 3.10273393127 0.01989505744 + 3.11274275040 0.01959636800 + 3.12275156953 0.01930220377 + 3.13276038867 0.01901248775 + 3.14276920780 0.01872714436 + 3.15277802693 0.01844609946 + 3.16278684607 0.01816928028 + 3.17279566520 0.01789661541 + 3.18280448433 0.01762803478 + 3.19281330347 0.01736346962 + 3.20282212260 0.01710285242 + 3.21283094173 0.01684611695 + 3.22283976087 0.01659319817 + 3.23284858000 0.01634403226 + 3.24285739913 0.01609855657 + 3.25286621827 0.01585670959 + 3.26287503740 0.01561843097 + 3.27288385653 0.01538366142 + 3.28289267566 0.01515234275 + 3.29290149480 0.01492441786 + 3.30291031393 0.01469983063 + 3.31291913306 0.01447852601 + 3.32292795220 0.01426044992 + 3.33293677133 0.01404554927 + 3.34294559046 0.01383377190 + 3.35295440960 0.01362506663 + 3.36296322873 0.01341938318 + 3.37297204786 0.01321667216 + 3.38298086700 0.01301688507 + 3.39298968613 0.01281997429 + 3.40299850526 0.01262589303 + 3.41300732440 0.01243459535 + 3.42301614353 0.01224603611 + 3.43302496266 0.01206017098 + 3.44303378179 0.01187695640 + 3.45304260093 0.01169634958 + 3.46305142006 0.01151830851 + 3.47306023919 0.01134279189 + 3.48306905833 0.01116975914 + 3.49307787746 0.01099917042 + 3.50308669659 0.01083098656 + 3.51309551573 0.01066516908 + 3.52310433486 0.01050168016 + 3.53311315399 0.01034048267 + 3.54312197313 0.01018154008 + 3.55313079226 0.01002481652 + 3.56313961139 0.00987027673 + 3.57314843053 0.00971788605 + 3.58315724966 0.00956761044 + 3.59316606879 0.00941941640 + 3.60317488792 0.00927327105 + 3.61318370706 0.00912914205 + 3.62319252619 0.00898699760 + 3.63320134532 0.00884680647 + 3.64321016446 0.00870853793 + 3.65321898359 0.00857216180 + 3.66322780272 0.00843764839 + 3.67323662186 0.00830496851 + 3.68324544099 0.00817409348 + 3.69325426012 0.00804499507 + 3.70326307926 0.00791764557 + 3.71327189839 0.00779201770 + 3.72328071752 0.00766808463 + 3.73328953666 0.00754582001 + 3.74329835579 0.00742519789 + 3.75330717492 0.00730619280 + 3.76331599405 0.00718877964 + 3.77332481319 0.00707293375 + 3.78333363232 0.00695863089 + 3.79334245145 0.00684584719 + 3.80335127059 0.00673455920 + 3.81336008972 0.00662474384 + 3.82336890885 0.00651637841 + 3.83337772799 0.00640944058 + 3.84338654712 0.00630390839 + 3.85339536625 0.00619976024 + 3.86340418539 0.00609697486 + 3.87341300452 0.00599553136 + 3.88342182365 0.00589540915 + 3.89343064279 0.00579658800 + 3.90343946192 0.00569904800 + 3.91344828105 0.00560276955 + 3.92345710018 0.00550773339 + 3.93346591932 0.00541392053 + 3.94347473845 0.00532131232 + 3.95348355758 0.00522989039 + 3.96349237672 0.00513963666 + 3.97350119585 0.00505053335 + 3.98351001498 0.00496256296 + 3.99351883412 0.00487570825 + 4.00352765325 0.00478995228 + 4.01353647238 0.00470527835 + 4.02354529152 0.00462167005 + 4.03355411065 0.00453911120 + 4.04356292978 0.00445758589 + 4.05357174892 0.00437707847 + 4.06358056805 0.00429757350 + 4.07358938718 0.00421905582 + 4.08359820631 0.00414151049 + 4.09360702545 0.00406492278 + 4.10361584458 0.00398927822 + 4.11362466371 0.00391456256 + 4.12363348285 0.00384076175 + 4.13364230198 0.00376786198 + 4.14365112111 0.00369584963 + 4.15365994025 0.00362471131 + 4.16366875938 0.00355443382 + 4.17367757851 0.00348500416 + 4.18368639765 0.00341640956 + 4.19369521678 0.00334863739 + 4.20370403591 0.00328167526 + 4.21371285505 0.00321551095 + 4.22372167418 0.00315013242 + 4.23373049331 0.00308552782 + 4.24373931244 0.00302168547 + 4.25374813158 0.00295859388 + 4.26375695071 0.00289624172 + 4.27376576984 0.00283461783 + 4.28377458898 0.00277371123 + 4.29378340811 0.00271351108 + 4.30379222724 0.00265400673 + 4.31380104638 0.00259518767 + 4.32380986551 0.00253704354 + 4.33381868464 0.00247956416 + 4.34382750378 0.00242273948 + 4.35383632291 0.00236655959 + 4.36384514204 0.00231101476 + 4.37385396118 0.00225609536 + 4.38386278031 0.00220179193 + 4.39387159944 0.00214809514 + 4.40388041857 0.00209499580 + 4.41388923771 0.00204248485 + 4.42389805684 0.00199055337 + 4.43390687597 0.00193919254 + 4.44391569511 0.00188839370 + 4.45392451424 0.00183814832 + 4.46393333337 0.00178844795 + 4.47394215251 0.00173928431 + 4.48395097164 0.00169064921 + 4.49395979077 0.00164253458 + 4.50396860991 0.00159493248 + 4.51397742904 0.00154783507 + 4.52398624817 0.00150123462 + 4.53399506731 0.00145512352 + 4.54400388644 0.00140949426 + 4.55401270557 0.00136433944 + 4.56402152470 0.00131965176 + 4.57403034384 0.00127542404 + 4.58403916297 0.00123164916 + 4.59404798210 0.00118832015 + 4.60405680124 0.00114543011 + 4.61406562037 0.00110297223 + 4.62407443950 0.00106093981 + 4.63408325864 0.00101932625 + 4.64409207777 0.00097812500 + 4.65410089690 0.00093732966 + 4.66410971604 0.00089693387 + 4.67411853517 0.00085693138 + 4.68412735430 0.00081731602 + 4.69413617344 0.00077808171 + 4.70414499257 0.00073922244 + 4.71415381170 0.00070073230 + 4.72416263083 0.00066260544 + 4.73417144997 0.00062483611 + 4.74418026910 0.00058741862 + 4.75418908823 0.00055034737 + 4.76419790737 0.00051361683 + 4.77420672650 0.00047722153 + 4.78421554563 0.00044115611 + 4.79422436477 0.00040541524 + 4.80423318390 0.00036999368 + 4.81424200303 0.00033488627 + 4.82425082217 0.00030008790 + 4.83425964130 0.00026559354 + 4.84426846043 0.00023139821 + 4.85427727957 0.00019749702 + 4.86428609870 0.00016388507 + 4.87429491783 0.00013055761 + 4.88430373696 0.00009750997 + 4.89431255610 0.00006473752 + 4.90432137523 0.00003223569 + 4.91433019436 0.00000000000 + 1 2 2 0 0.000000 #orbital l, n, z, is_polarized, population + 259 0.0100022326572360 2.5805760255668990 + 0.00000000000 5.87400266745 + 0.01000223266 5.87274971925 + 0.02000446531 5.86899258851 + 0.03000669797 5.86273643593 + 0.04000893063 5.85398984921 + 0.05001116329 5.84276482522 + 0.06001339594 5.82907674462 + 0.07001562860 5.81294433925 + 0.08001786126 5.79438965231 + 0.09002009392 5.77343799147 + 0.10002232657 5.75011787510 + 0.11002455923 5.72446097164 + 0.12002679189 5.69650203229 + 0.13002902454 5.66627881712 + 0.14003125720 5.63383201488 + 0.15003348986 5.59920515653 + 0.16003572252 5.56244452284 + 0.17003795517 5.52359904617 + 0.18004018783 5.48272020668 + 0.19004242049 5.43986192331 + 0.20004465314 5.39508043962 + 0.21004688580 5.34843420491 + 0.22004911846 5.29998375093 + 0.23005135112 5.24979156434 + 0.24005358377 5.19792195537 + 0.25005581643 5.14444092303 + 0.26005804909 5.08941601711 + 0.27006028175 5.03291619749 + 0.28006251440 4.97501169095 + 0.29006474706 4.91577384605 + 0.30006697972 4.85527498642 + 0.31006921237 4.79358826273 + 0.32007144503 4.73078750399 + 0.33007367769 4.66694706845 + 0.34007591035 4.60214169444 + 0.35007814300 4.53644635189 + 0.36008037566 4.46993609450 + 0.37008260832 4.40268591348 + 0.38008484097 4.33477059283 + 0.39008707363 4.26626456692 + 0.40008930629 4.19724178053 + 0.41009153895 4.12777555194 + 0.42009377160 4.05793843935 + 0.43009600426 3.98780211098 + 0.44009823692 3.91743721940 + 0.45010046958 3.84691328013 + 0.46010270223 3.77629855515 + 0.47010493489 3.70565994146 + 0.48010716755 3.63506286493 + 0.49010940020 3.56457117989 + 0.50011163286 3.49424707456 + 0.51011386552 3.42415098252 + 0.52011609818 3.35434150057 + 0.53011833083 3.28487531290 + 0.54012056349 3.21580712200 + 0.55012279615 3.14718958612 + 0.56012502881 3.07907326358 + 0.57012726146 3.01150656389 + 0.58012949412 2.94453570572 + 0.59013172678 2.87820468165 + 0.60013395943 2.81255522980 + 0.61013619209 2.74762681217 + 0.62013842475 2.68345659963 + 0.63014065741 2.62007946342 + 0.64014289006 2.55752797309 + 0.65014512272 2.49583240068 + 0.66014735538 2.43502073089 + 0.67014958803 2.37511867713 + 0.68015182069 2.31614970321 + 0.69015405335 2.25813505031 + 0.70015628601 2.20109376920 + 0.71015851866 2.14504275713 + 0.72016075132 2.08999679942 + 0.73016298398 2.03596861519 + 0.74016521664 1.98296890714 + 0.75016744929 1.93100641486 + 0.76016968195 1.88008797156 + 0.77017191461 1.83021856373 + 0.78017414726 1.78140139353 + 0.79017637992 1.73363794353 + 0.80017861258 1.68692804348 + 0.81018084524 1.64126993888 + 0.82018307789 1.59666036090 + 0.83018531055 1.55309459752 + 0.84018754321 1.51056656547 + 0.85018977587 1.46906888274 + 0.86019200852 1.42859294146 + 0.87019424118 1.38912898069 + 0.88019647384 1.35066615918 + 0.89019870649 1.31319262760 + 0.90020093915 1.27669560011 + 0.91020317181 1.24116142523 + 0.92020540447 1.20657565552 + 0.93020763712 1.17292311613 + 0.94020986978 1.14018797206 + 0.95021210244 1.10835379381 + 0.96021433509 1.07740362148 + 0.97021656775 1.04732002715 + 0.98021880041 1.01808517533 + 0.99022103307 0.98968088163 + 1.00022326572 0.96208866933 + 1.01022549838 0.93528982395 + 1.02022773104 0.90926544569 + 1.03022996370 0.88399649978 + 1.04023219635 0.85946386463 + 1.05023442901 0.83564837778 + 1.06023666167 0.81253087969 + 1.07023889432 0.79009225536 + 1.08024112698 0.76831347366 + 1.09024335964 0.74717562460 + 1.10024559230 0.72665995436 + 1.11024782495 0.70674789819 + 1.12025005761 0.68742111122 + 1.13025229027 0.66866149718 + 1.14025452292 0.65045123502 + 1.15025675558 0.63277280357 + 1.16025898824 0.61560900420 + 1.17026122090 0.59894298150 + 1.18026345355 0.58275824209 + 1.19026568621 0.56703867161 + 1.20026791887 0.55176854975 + 1.21027015153 0.53693256366 + 1.22027238418 0.52251581951 + 1.23027461684 0.50850385241 + 1.24027684950 0.49488263466 + 1.25027908215 0.48163858240 + 1.26028131481 0.46875856066 + 1.27028354747 0.45622988696 + 1.28028578013 0.44404033335 + 1.29028801278 0.43217812711 + 1.30029024544 0.42063194998 + 1.31029247810 0.40939093611 + 1.32029471076 0.39844466872 + 1.33029694341 0.38778317550 + 1.34029917607 0.37739692280 + 1.35030140873 0.36727680880 + 1.36030364138 0.35741415529 + 1.37030587404 0.34780069895 + 1.38030810670 0.33842858131 + 1.39031033936 0.32929033774 + 1.40031257201 0.32037888565 + 1.41031480467 0.31168751183 + 1.42031703733 0.30320985935 + 1.43031926998 0.29493991341 + 1.44032150264 0.28687198753 + 1.45032373530 0.27900070679 + 1.46032596796 0.27132100046 + 1.47032820061 0.26382803562 + 1.48033043327 0.25651716084 + 1.49033266593 0.24938386403 + 1.50033489859 0.24242374525 + 1.51033713124 0.23563253907 + 1.52033936390 0.22900609759 + 1.53034159656 0.22254039071 + 1.54034382921 0.21623150123 + 1.55034606187 0.21007562160 + 1.56034829453 0.20406905053 + 1.57035052719 0.19820818974 + 1.58035275984 0.19248954074 + 1.59035499250 0.18690970184 + 1.60035722516 0.18146536512 + 1.61035945782 0.17615331357 + 1.62036169047 0.17097041839 + 1.63036392313 0.16591363622 + 1.64036615579 0.16098000663 + 1.65036838844 0.15616664956 + 1.66037062110 0.15147076293 + 1.67037285376 0.14688962027 + 1.68037508642 0.14242056851 + 1.69037731907 0.13806102570 + 1.70037955173 0.13380847900 + 1.71038178439 0.12966048250 + 1.72038401704 0.12561465537 + 1.73038624970 0.12166867983 + 1.74038848236 0.11782029935 + 1.75039071502 0.11406731682 + 1.76039294767 0.11040759285 + 1.77039518033 0.10683904403 + 1.78039741299 0.10335964135 + 1.79039964565 0.09996740857 + 1.80040187830 0.09666042075 + 1.81040411096 0.09343680271 + 1.82040634362 0.09029472764 + 1.83040857627 0.08723241567 + 1.84041080893 0.08424813258 + 1.85041304159 0.08134018844 + 1.86041527425 0.07850693640 + 1.87041750690 0.07574677141 + 1.88041973956 0.07305812910 + 1.89042197222 0.07043948458 + 1.90042420487 0.06788935135 + 1.91042643753 0.06540628024 + 1.92042867019 0.06298885833 + 1.93043090285 0.06063570796 + 1.94043313550 0.05834548575 + 1.95043536816 0.05611688163 + 1.96043760082 0.05394861797 + 1.97043983348 0.05183944860 + 1.98044206613 0.04978815803 + 1.99044429879 0.04779356056 + 2.00044653145 0.04585449948 + 2.01044876410 0.04396984629 + 2.02045099676 0.04213849989 + 2.03045322942 0.04035938592 + 2.04045546208 0.03863145595 + 2.05045769473 0.03695368682 + 2.06045992739 0.03532507999 + 2.07046216005 0.03374466083 + 2.08046439271 0.03221147801 + 2.09046662536 0.03072460287 + 2.10046885802 0.02928312883 + 2.11047109068 0.02788617079 + 2.12047332333 0.02653286457 + 2.13047555599 0.02522236637 + 2.14047778865 0.02395385222 + 2.15048002131 0.02272651747 + 2.16048225396 0.02153957629 + 2.17048448662 0.02039226115 + 2.18048671928 0.01928382240 + 2.19048895193 0.01821352777 + 2.20049118459 0.01718066192 + 2.21049341725 0.01618452601 + 2.22049564991 0.01522443730 + 2.23049788256 0.01429972872 + 2.24050011522 0.01340974845 + 2.25050234788 0.01255385956 + 2.26050458054 0.01173143965 + 2.27050681319 0.01094188042 + 2.28050904585 0.01018458738 + 2.29051127851 0.00945897948 + 2.30051351116 0.00876448874 + 2.31051574382 0.00810055998 + 2.32051797648 0.00746665045 + 2.33052020914 0.00686222958 + 2.34052244179 0.00628677861 + 2.35052467445 0.00573979034 + 2.36052690711 0.00522076883 + 2.37052913976 0.00472922916 + 2.38053137242 0.00426469707 + 2.39053360508 0.00382670882 + 2.40053583774 0.00341481083 + 2.41053807039 0.00302855948 + 2.42054030305 0.00266752088 + 2.43054253571 0.00233127060 + 2.44054476837 0.00201939346 + 2.45054700102 0.00173148331 + 2.46054923368 0.00146714281 + 2.47055146634 0.00122598320 + 2.48055369899 0.00100762413 + 2.49055593165 0.00081169345 + 2.50055816431 0.00063782697 + 2.51056039697 0.00048566835 + 2.52056262962 0.00035486884 + 2.53056486228 0.00024508714 + 2.54056709494 0.00015598924 + 2.55056932760 0.00008724819 + 2.56057156025 0.00003854320 + 2.57057379291 0.00000956222 + 2.58057602557 0.00000000000 + 2 3 1 1 0.000000 #orbital l, n, z, is_polarized, population + 492 0.0100088191331246 4.9143301943641768 + 0.00000000000 5.33624913788 + 0.01000881913 4.97561016681 + 0.02001763827 4.74295486227 + 0.03002645740 4.56866188675 + 0.04003527653 4.42581294907 + 0.05004409567 4.30383701209 + 0.06005291480 4.19719234746 + 0.07006173393 4.10248255798 + 0.08007055306 4.01740268817 + 0.09007937220 3.94027017217 + 0.10008819133 3.86978775927 + 0.11009701046 3.80491253722 + 0.12010582960 3.74477869086 + 0.13011464873 3.68864964590 + 0.14012346786 3.63588726542 + 0.15013228700 3.58593141521 + 0.16014110613 3.53828606981 + 0.17014992526 3.49250966256 + 0.18015874440 3.44820824806 + 0.19016756353 3.40503055371 + 0.20017638266 3.36266430851 + 0.21018520180 3.32083343362 + 0.22019402093 3.27929580706 + 0.23020284006 3.23784140073 + 0.24021165919 3.19629064671 + 0.25022047833 3.15449293105 + 0.26022929746 3.11232514328 + 0.27023811659 3.06969023166 + 0.28024693573 3.02651573093 + 0.29025575486 2.98275224149 + 0.30026457399 2.93837184932 + 0.31027339313 2.89336648289 + 0.32028221226 2.84774621014 + 0.33029103139 2.80153748245 + 0.34029985053 2.75478133685 + 0.35030866966 2.70753157032 + 0.36031748879 2.65985290156 + 0.37032630793 2.61181913774 + 0.38033512706 2.56351136372 + 0.39034394619 2.51501617174 + 0.40035276532 2.46642394926 + 0.41036158446 2.41782724192 + 0.42037040359 2.36931920728 + 0.43037922272 2.32099217379 + 0.44038804186 2.27293631761 + 0.45039686099 2.22523846803 + 0.46040568012 2.17798104992 + 0.47041449926 2.13124116968 + 0.48042331839 2.08508984871 + 0.49043213752 2.03959140601 + 0.50044095666 1.99480298946 + 0.51044977579 1.95077425283 + 0.52045859492 1.90754717375 + 0.53046741406 1.86515600582 + 0.54047623319 1.82362735619 + 0.55048505232 1.78298037874 + 0.56049387145 1.74322707143 + 0.57050269059 1.70437266548 + 0.58051150972 1.66641609353 + 0.59052032885 1.62935052297 + 0.60052914799 1.59316394104 + 0.61053796712 1.55783977784 + 0.62054678625 1.52335755397 + 0.63055560539 1.48969353998 + 0.64056442452 1.45682141535 + 0.65057324365 1.42471291598 + 0.66058206279 1.39333845956 + 0.67059088192 1.36266774004 + 0.68059970105 1.33267028293 + 0.69060852019 1.30331595499 + 0.70061733932 1.27457542270 + 0.71062615845 1.24642055549 + 0.72063497758 1.21882477084 + 0.73064379672 1.19176331962 + 0.74065261585 1.16521351120 + 0.75066143498 1.13915487889 + 0.76067025412 1.11356928758 + 0.77067907325 1.08844098577 + 0.78068789238 1.06375660574 + 0.79069671152 1.03950511556 + 0.80070553065 1.01567772788 + 0.81071434978 0.99226777036 + 0.82072316892 0.96927052331 + 0.83073198805 0.94668303009 + 0.84074080718 0.92450388610 + 0.85074962632 0.90273301217 + 0.86075844545 0.88137141776 + 0.87076726458 0.86042095974 + 0.88077608371 0.83988410162 + 0.89078490285 0.81976367817 + 0.90079372198 0.80006266971 + 0.91080254111 0.78078398995 + 0.92081136025 0.76193029070 + 0.93082017938 0.74350378617 + 0.94082899851 0.72550609909 + 0.95083781765 0.70793813017 + 0.96084663678 0.69079995201 + 0.97085545591 0.67409072772 + 0.98086427505 0.65780865439 + 0.99087309418 0.64195093060 + 1.00088191331 0.62651374712 + 1.01089073245 0.61149229915 + 1.02089955158 0.59688081851 + 1.03090837071 0.58267262352 + 1.04091718984 0.56886018444 + 1.05092600898 0.55543520202 + 1.06093482811 0.54238869639 + 1.07094364724 0.52971110397 + 1.08095246638 0.51739237975 + 1.09096128551 0.50542210240 + 1.10097010464 0.49378958010 + 1.11097892378 0.48248395448 + 1.12098774291 0.47149430103 + 1.13099656204 0.46080972405 + 1.14100538118 0.45041944478 + 1.15101420031 0.44031288116 + 1.16102301944 0.43047971845 + 1.17103183858 0.42090996999 + 1.18104065771 0.41159402751 + 1.19104947684 0.40252270079 + 1.20105829597 0.39368724694 + 1.21106711511 0.38507938920 + 1.22107593424 0.37669132588 + 1.23108475337 0.36851573030 + 1.24109357251 0.36054574187 + 1.25110239164 0.35277494993 + 1.26111121077 0.34519737380 + 1.27112002991 0.33780742385 + 1.28112884904 0.33059978063 + 1.29113766817 0.32356932348 + 1.30114648731 0.31671106609 + 1.31115530644 0.31002018512 + 1.32116412557 0.30349200531 + 1.33117294471 0.29712199665 + 1.34118176384 0.29090576915 + 1.35119058297 0.28483906871 + 1.36119940210 0.27891777273 + 1.37120822124 0.27313788603 + 1.38121704037 0.26749553675 + 1.39122585950 0.26198697234 + 1.40123467864 0.25660855559 + 1.41124349777 0.25135676088 + 1.42125231690 0.24622817056 + 1.43126113604 0.24121947144 + 1.44126995517 0.23632745122 + 1.45127877430 0.23154899514 + 1.46128759344 0.22688108284 + 1.47129641257 0.22232078499 + 1.48130523170 0.21786526013 + 1.49131405084 0.21351175202 + 1.50132286997 0.20925758675 + 1.51133168910 0.20510016982 + 1.52134050823 0.20103698358 + 1.53134932737 0.19706558473 + 1.54135814650 0.19318360177 + 1.55136696563 0.18938873271 + 1.56137578477 0.18567874278 + 1.57138460390 0.18205146219 + 1.58139342303 0.17850478407 + 1.59140224217 0.17503666238 + 1.60141106130 0.17164510998 + 1.61141988043 0.16832819671 + 1.62142869957 0.16508404757 + 1.63143751870 0.16191084093 + 1.64144633783 0.15880680686 + 1.65145515697 0.15577022548 + 1.66146397610 0.15279942534 + 1.67147279523 0.14989278194 + 1.68148161436 0.14704871621 + 1.69149043350 0.14426569311 + 1.70149925263 0.14154222025 + 1.71150807176 0.13887684656 + 1.72151689090 0.13626816098 + 1.73152571003 0.13371479127 + 1.74153452916 0.13121540278 + 1.75154334830 0.12876869731 + 1.76155216743 0.12637341197 + 1.77156098656 0.12402831813 + 1.78156980570 0.12173222037 + 1.79157862483 0.11948395546 + 1.80158744396 0.11728239140 + 1.81159626310 0.11512642646 + 1.82160508223 0.11301498830 + 1.83161390136 0.11094703309 + 1.84162272049 0.10892154461 + 1.85163153963 0.10693753350 + 1.86164035876 0.10499403641 + 1.87164917789 0.10309011526 + 1.88165799703 0.10122485649 + 1.89166681616 0.09939737032 + 1.90167563529 0.09760679010 + 1.91168445443 0.09585227160 + 1.92169327356 0.09413299237 + 1.93170209269 0.09244815111 + 1.94171091183 0.09079696704 + 1.95171973096 0.08917867937 + 1.96172855009 0.08759254666 + 1.97173736923 0.08603784628 + 1.98174618836 0.08451387392 + 1.99175500749 0.08301994302 + 2.00176382662 0.08155538429 + 2.01177264576 0.08011954522 + 2.02178146489 0.07871178962 + 2.03179028402 0.07733149713 + 2.04179910316 0.07597806282 + 2.05180792229 0.07465089673 + 2.06181674142 0.07334942346 + 2.07182556056 0.07207308180 + 2.08183437969 0.07082132428 + 2.09184319882 0.06959361684 + 2.10185201796 0.06838943845 + 2.11186083709 0.06720828076 + 2.12186965622 0.06604964772 + 2.13187847536 0.06491305531 + 2.14188729449 0.06379803115 + 2.15189611362 0.06270411423 + 2.16190493275 0.06163085458 + 2.17191375189 0.06057781301 + 2.18192257102 0.05954456076 + 2.19193139015 0.05853067930 + 2.20194020929 0.05753575997 + 2.21194902842 0.05655940382 + 2.22195784755 0.05560122127 + 2.23196666669 0.05466083189 + 2.24197548582 0.05373786418 + 2.25198430495 0.05283195533 + 2.26199312409 0.05194275097 + 2.27200194322 0.05106990496 + 2.28201076235 0.05021307922 + 2.29201958149 0.04937194344 + 2.30202840062 0.04854617495 + 2.31203721975 0.04773545851 + 2.32204603888 0.04693948609 + 2.33205485802 0.04615795671 + 2.34206367715 0.04539057626 + 2.35207249628 0.04463705733 + 2.36208131542 0.04389711903 + 2.37209013455 0.04317048681 + 2.38209895368 0.04245689234 + 2.39210777282 0.04175607332 + 2.40211659195 0.04106777336 + 2.41212541108 0.04039174180 + 2.42213423022 0.03972773359 + 2.43214304935 0.03907550914 + 2.44215186848 0.03843483418 + 2.45216068762 0.03780547966 + 2.46216950675 0.03718722158 + 2.47217832588 0.03657984089 + 2.48218714501 0.03598312336 + 2.49219596415 0.03539685948 + 2.50220478328 0.03482084432 + 2.51221360241 0.03425487742 + 2.52222242155 0.03369876273 + 2.53223124068 0.03315230841 + 2.54224005981 0.03261532684 + 2.55224887895 0.03208763443 + 2.56225769808 0.03156905156 + 2.57226651721 0.03105940249 + 2.58227533635 0.03055851525 + 2.59228415548 0.03006622156 + 2.60229297461 0.02958235674 + 2.61230179375 0.02910675965 + 2.62231061288 0.02863927255 + 2.63231943201 0.02817974107 + 2.64232825114 0.02772801411 + 2.65233707028 0.02728394376 + 2.66234588941 0.02684738525 + 2.67235470854 0.02641819683 + 2.68236352768 0.02599623977 + 2.69237234681 0.02558137821 + 2.70238116594 0.02517347915 + 2.71238998508 0.02477241237 + 2.72239880421 0.02437805034 + 2.73240762334 0.02399026821 + 2.74241644248 0.02360894370 + 2.75242526161 0.02323395705 + 2.76243408074 0.02286519100 + 2.77244289988 0.02250253069 + 2.78245171901 0.02214586361 + 2.79246053814 0.02179507957 + 2.80246935727 0.02145007064 + 2.81247817641 0.02111073107 + 2.82248699554 0.02077695730 + 2.83249581467 0.02044864784 + 2.84250463381 0.02012570327 + 2.85251345294 0.01980802620 + 2.86252227207 0.01949552117 + 2.87253109121 0.01918809468 + 2.88253991034 0.01888565510 + 2.89254872947 0.01858811262 + 2.90255754861 0.01829537925 + 2.91256636774 0.01800736875 + 2.92257518687 0.01772399659 + 2.93258400601 0.01744517995 + 2.94259282514 0.01717083761 + 2.95260164427 0.01690089000 + 2.96261046340 0.01663525910 + 2.97261928254 0.01637386844 + 2.98262810167 0.01611664304 + 2.99263692080 0.01586350941 + 3.00264573994 0.01561439550 + 3.01265455907 0.01536923065 + 3.02266337820 0.01512794560 + 3.03267219734 0.01489047243 + 3.04268101647 0.01465674454 + 3.05268983560 0.01442669662 + 3.06269865474 0.01420026462 + 3.07270747387 0.01397738575 + 3.08271629300 0.01375799840 + 3.09272511214 0.01354204216 + 3.10273393127 0.01332945778 + 3.11274275040 0.01312018715 + 3.12275156953 0.01291417325 + 3.13276038867 0.01271136017 + 3.14276920780 0.01251169305 + 3.15277802693 0.01231511809 + 3.16278684607 0.01212158248 + 3.17279566520 0.01193103443 + 3.18280448433 0.01174342313 + 3.19281330347 0.01155869873 + 3.20282212260 0.01137681228 + 3.21283094173 0.01119771581 + 3.22283976087 0.01102136219 + 3.23284858000 0.01084770520 + 3.24285739913 0.01067669949 + 3.25286621827 0.01050830053 + 3.26287503740 0.01034246463 + 3.27288385653 0.01017914891 + 3.28289267566 0.01001831128 + 3.29290149480 0.00985991043 + 3.30291031393 0.00970390581 + 3.31291913306 0.00955025761 + 3.32292795220 0.00939892676 + 3.33293677133 0.00924987489 + 3.34294559046 0.00910306436 + 3.35295440960 0.00895845818 + 3.36296322873 0.00881602005 + 3.37297204786 0.00867571435 + 3.38298086700 0.00853750607 + 3.39298968613 0.00840136085 + 3.40299850526 0.00826724496 + 3.41300732440 0.00813512525 + 3.42301614353 0.00800496921 + 3.43302496266 0.00787674486 + 3.44303378179 0.00775042084 + 3.45304260093 0.00762596632 + 3.46305142006 0.00750335104 + 3.47306023919 0.00738254525 + 3.48306905833 0.00726351977 + 3.49307787746 0.00714624591 + 3.50308669659 0.00703069549 + 3.51309551573 0.00691684084 + 3.52310433486 0.00680465476 + 3.53311315399 0.00669411054 + 3.54312197313 0.00658518194 + 3.55313079226 0.00647784318 + 3.56313961139 0.00637206892 + 3.57314843053 0.00626783429 + 3.58315724966 0.00616511481 + 3.59316606879 0.00606388647 + 3.60317488792 0.00596412566 + 3.61318370706 0.00586580916 + 3.62319252619 0.00576891418 + 3.63320134532 0.00567341831 + 3.64321016446 0.00557929953 + 3.65321898359 0.00548653619 + 3.66322780272 0.00539510703 + 3.67323662186 0.00530499114 + 3.68324544099 0.00521616797 + 3.69325426012 0.00512861732 + 3.70326307926 0.00504231935 + 3.71327189839 0.00495725452 + 3.72328071752 0.00487340366 + 3.73328953666 0.00479074791 + 3.74329835579 0.00470926873 + 3.75330717492 0.00462894790 + 3.76331599405 0.00454976748 + 3.77332481319 0.00447170987 + 3.78333363232 0.00439475774 + 3.79334245145 0.00431889407 + 3.80335127059 0.00424410209 + 3.81336008972 0.00417036535 + 3.82336890885 0.00409766766 + 3.83337772799 0.00402599309 + 3.84338654712 0.00395532598 + 3.85339536625 0.00388565094 + 3.86340418539 0.00381695282 + 3.87341300452 0.00374921673 + 3.88342182365 0.00368242802 + 3.89343064279 0.00361657230 + 3.90343946192 0.00355163538 + 3.91344828105 0.00348760333 + 3.92345710018 0.00342446245 + 3.93346591932 0.00336219926 + 3.94347473845 0.00330080048 + 3.95348355758 0.00324025308 + 3.96349237672 0.00318054422 + 3.97350119585 0.00312166127 + 3.98351001498 0.00306359182 + 3.99351883412 0.00300632365 + 4.00352765325 0.00294984472 + 4.01353647238 0.00289414323 + 4.02354529152 0.00283920753 + 4.03355411065 0.00278502617 + 4.04356292978 0.00273158788 + 4.05357174892 0.00267888159 + 4.06358056805 0.00262689639 + 4.07358938718 0.00257562154 + 4.08359820631 0.00252504648 + 4.09360702545 0.00247516083 + 4.10361584458 0.00242595435 + 4.11362466371 0.00237741698 + 4.12363348285 0.00232953883 + 4.13364230198 0.00228231013 + 4.14365112111 0.00223572130 + 4.15365994025 0.00218976290 + 4.16366875938 0.00214442563 + 4.17367757851 0.00209970036 + 4.18368639765 0.00205557807 + 4.19369521678 0.00201204990 + 4.20370403591 0.00196910715 + 4.21371285505 0.00192674122 + 4.22372167418 0.00188494365 + 4.23373049331 0.00184370615 + 4.24373931244 0.00180302051 + 4.25374813158 0.00176287867 + 4.26375695071 0.00172327270 + 4.27376576984 0.00168419479 + 4.28377458898 0.00164563725 + 4.29378340811 0.00160759251 + 4.30379222724 0.00157005310 + 4.31380104638 0.00153301170 + 4.32380986551 0.00149646108 + 4.33381868464 0.00146039411 + 4.34382750378 0.00142480381 + 4.35383632291 0.00138968326 + 4.36384514204 0.00135502569 + 4.37385396118 0.00132082439 + 4.38386278031 0.00128707280 + 4.39387159944 0.00125376441 + 4.40388041857 0.00122089286 + 4.41388923771 0.00118845185 + 4.42389805684 0.00115643518 + 4.43390687597 0.00112483677 + 4.44391569511 0.00109365061 + 4.45392451424 0.00106287078 + 4.46393333337 0.00103249147 + 4.47394215251 0.00100250692 + 4.48395097164 0.00097291151 + 4.49395979077 0.00094369966 + 4.50396860991 0.00091486589 + 4.51397742904 0.00088640481 + 4.52398624817 0.00085831111 + 4.53399506731 0.00083057954 + 4.54400388644 0.00080320495 + 4.55401270557 0.00077618226 + 4.56402152470 0.00074950648 + 4.57403034384 0.00072317266 + 4.58403916297 0.00069717596 + 4.59404798210 0.00067151159 + 4.60405680124 0.00064617485 + 4.61406562037 0.00062116109 + 4.62407443950 0.00059646575 + 4.63408325864 0.00057208432 + 4.64409207777 0.00054801236 + 4.65410089690 0.00052424551 + 4.66410971604 0.00050077946 + 4.67411853517 0.00047760997 + 4.68412735430 0.00045473286 + 4.69413617344 0.00043214402 + 4.70414499257 0.00040983938 + 4.71415381170 0.00038781496 + 4.72416263083 0.00036606682 + 4.73417144997 0.00034459108 + 4.74418026910 0.00032338392 + 4.75418908823 0.00030244157 + 4.76419790737 0.00028176032 + 4.77420672650 0.00026133652 + 4.78421554563 0.00024116657 + 4.79422436477 0.00022124692 + 4.80423318390 0.00020157407 + 4.81424200303 0.00018214458 + 4.82425082217 0.00016295505 + 4.83425964130 0.00014400214 + 4.84426846043 0.00012528255 + 4.85427727957 0.00010679303 + 4.86428609870 0.00008853035 + 4.87429491783 0.00007049138 + 4.88430373696 0.00005267302 + 4.89431255610 0.00003507224 + 4.90432137523 0.00001768603 + 4.91433019436 0.00000000000 +# KBs:_______________ + 0 1 12.1134709477999998 #kb l, n (seq), energy in Ry + 138 0.0100098813191848 1.3713537407283178 + 0.00000000000 9.66903042769 + 0.01000988132 9.66281764299 + 0.02001976264 9.64420803469 + 0.03002964396 9.61328740140 + 0.04003952528 9.57019788104 + 0.05004940660 9.51513661156 + 0.06005928792 9.44835390108 + 0.07006916923 9.37015092131 + 0.08007905055 9.28087693797 + 0.09008893187 9.18092612314 + 0.10009881319 9.07073398714 + 0.11010869451 8.95077346923 + 0.12011857583 8.82155073908 + 0.13012845715 8.68360074446 + 0.14013833847 8.53748260090 + 0.15014821979 8.38377483029 + 0.16015810111 8.22307049582 + 0.17016798243 8.05597239534 + 0.18017786375 7.88308821080 + 0.19018774506 7.70502578693 + 0.20019762638 7.52238858006 + 0.21020750770 7.33577127122 + 0.22021738902 7.14575563891 + 0.23022727034 6.95290672064 + 0.24023715166 6.75776931847 + 0.25024703298 6.56086487324 + 0.26025691430 6.36268870111 + 0.27026679562 6.16370770511 + 0.28027667694 5.96435848208 + 0.29028655826 5.76504592064 + 0.30029643958 5.56614222136 + 0.31030632089 5.36798639614 + 0.32031620221 5.17088421981 + 0.33032608353 4.97510862321 + 0.34033596485 4.78090048374 + 0.35034584617 4.58846984646 + 0.36035572749 4.39799748433 + 0.37036560881 4.20963681089 + 0.38037549013 4.02351608226 + 0.39038537145 3.83974084781 + 0.40039525277 3.65839661033 + 0.41040513409 3.47955165948 + 0.42041501541 3.30326000448 + 0.43042489672 3.12956437284 + 0.44043477804 2.95849922931 + 0.45044465936 2.79009374617 + 0.46045454068 2.62437470288 + 0.47046442200 2.46136923815 + 0.48047430332 2.30110744588 + 0.49048418464 2.14362473926 + 0.50049406596 1.98896396678 + 0.51050394728 1.83717725463 + 0.52051382860 1.68832751973 + 0.53052370992 1.54248965694 + 0.54053359124 1.39975137202 + 0.55054347256 1.26021364943 + 0.56055335387 1.12399085070 + 0.57056323519 0.99121044122 + 0.58057311651 0.86201235447 + 0.59058299783 0.73654800219 + 0.60059287915 0.61497894874 + 0.61060276047 0.49747527294 + 0.62061264179 0.38421364137 + 0.63062252311 0.27537512967 + 0.64063240443 0.17114282172 + 0.65064228575 0.07169923033 + 0.66065216707 -0.02277642101 + 0.67066204839 -0.11211101125 + 0.68067192970 -0.19614038319 + 0.69068181102 -0.27471220808 + 0.70069169234 -0.34768880549 + 0.71070157366 -0.41494987330 + 0.72071145498 -0.47639508352 + 0.73072133630 -0.53194649933 + 0.74073121762 -0.58155077508 + 0.75074109894 -0.62518110005 + 0.76075098026 -0.66283885460 + 0.77076086158 -0.69455494695 + 0.78077074290 -0.72039080838 + 0.79078062422 -0.74043902493 + 0.80079050553 -0.75482359283 + 0.81080038685 -0.76369978800 + 0.82081026817 -0.76725364523 + 0.83082014949 -0.76570105195 + 0.84083003081 -0.75928646184 + 0.85083991213 -0.74828124339 + 0.86084979345 -0.73298168116 + 0.87085967477 -0.71370665416 + 0.88086955609 -0.69079501972 + 0.89087943741 -0.66460273490 + 0.90088931873 -0.63549975248 + 0.91089920005 -0.60386673100 + 0.92090908137 -0.57009160113 + 0.93091896268 -0.53456603238 + 0.94092884400 -0.49768184634 + 0.95093872532 -0.45982742267 + 0.96094860664 -0.42138414375 + 0.97095848796 -0.38272292422 + 0.98096836928 -0.34420086986 + 0.99097825060 -0.30615810771 + 1.00098813192 -0.26891482805 + 1.01099801324 -0.23276857482 + 1.02100789456 -0.19799181687 + 1.03101777588 -0.16482982965 + 1.04102765720 -0.13349891230 + 1.05103753851 -0.10418495746 + 1.06104741983 -0.07704239156 + 1.07105730115 -0.05219349206 + 1.08106718247 -0.02972808591 + 1.09107706379 -0.00970362786 + 1.10108694511 0.00785434798 + 1.11109682643 0.02295141709 + 1.12110670775 0.03562311115 + 1.13111658907 0.04593344459 + 1.14112647039 0.05397314540 + 1.15113635171 0.05985762427 + 1.16114623303 0.06372471636 + 1.17115611434 0.06573223137 + 1.18116599566 0.06605533929 + 1.19117587698 0.06488387109 + 1.20118575830 0.06241956698 + 1.21119563962 0.05887315920 + 1.22120552094 0.05445903416 + 1.23121540226 0.04939035174 + 1.24122528358 0.04387444567 + 1.25123516490 0.03811059847 + 1.26124504622 0.03228711091 + 1.27125492754 0.02657884766 + 1.28126480886 0.02114495931 + 1.29127469017 0.01612692087 + 1.30128457149 0.01164685141 + 1.31129445281 0.00780615342 + 1.32130433413 0.00468449266 + 1.33131421545 0.00233234788 + 1.34132409677 0.00081248454 + 1.35133397809 0.00012060269 + 1.36134385941 0.00000216822 + 1.37135374073 0.00000000000 + 0 2 1.6480481951999999 #kb l, n (seq), energy in Ry + 138 0.0100098813191848 1.3713537407283178 + 0.00000000000 -3.84177753486 + 0.01000988132 -3.83381204101 + 0.02001976264 -3.80997494337 + 0.03002964396 -3.77044378212 + 0.04003952528 -3.71551228413 + 0.05004940660 -3.64558715302 + 0.06005928792 -3.56118362355 + 0.07006916923 -3.46291984471 + 0.08007905055 -3.35151015585 + 0.09008893187 -3.22775735963 + 0.10009881319 -3.09254406752 + 0.11010869451 -2.94682324455 + 0.12011857583 -2.79160806605 + 0.13012845715 -2.62796121501 + 0.14013833847 -2.45698375210 + 0.15014821979 -2.27980370915 + 0.16015810111 -2.09756453291 + 0.17016798243 -1.91141353416 + 0.18017786375 -1.72249048307 + 0.19018774506 -1.53191648464 + 0.20019762638 -1.34078327887 + 0.21020750770 -1.15014308533 + 0.22021738902 -0.96099912226 + 0.23022727034 -0.77429690230 + 0.24023715166 -0.59091641094 + 0.25024703298 -0.41166525379 + 0.26025691430 -0.23727284499 + 0.27026679562 -0.06838569673 + 0.28027667694 0.09443614392 + 0.29028655826 0.25072148547 + 0.30029643958 0.40008919514 + 0.31030632089 0.54224821972 + 0.32031620221 0.67699644330 + 0.33032608353 0.80421841752 + 0.34033596485 0.92388201404 + 0.35034584617 1.03603406530 + 0.36035572749 1.14079506943 + 0.37036560881 1.23835305200 + 0.38037549013 1.32895668079 + 0.39038537145 1.41290775042 + 0.40039525277 1.49055314663 + 0.41040513409 1.56227642111 + 0.42041501541 1.62848909894 + 0.43042489672 1.68962185310 + 0.44043477804 1.74611567491 + 0.45044465936 1.79841316913 + 0.46045454068 1.84695010253 + 0.47046442200 1.89214732498 + 0.48047430332 1.93440317870 + 0.49048418464 1.97408650226 + 0.50049406596 2.01153032627 + 0.51050394728 2.04702634648 + 0.52051382860 2.08082024374 + 0.53052370992 2.11310792543 + 0.54053359124 2.14403271351 + 0.55054347256 2.17368352408 + 0.56055335387 2.20209406045 + 0.57056323519 2.22924300545 + 0.58057311651 2.25505521544 + 0.59058299783 2.27940387876 + 0.60059287915 2.30211359584 + 0.61060276047 2.32296432840 + 0.62061264179 2.34169616304 + 0.63062252311 2.35801476447 + 0.64063240443 2.37159749143 + 0.65064228575 2.38210001990 + 0.66065216707 2.38916339728 + 0.67066204839 2.39242140183 + 0.68067192970 2.39150810411 + 0.69068181102 2.38606548184 + 0.70069169234 2.37575101090 + 0.71070157366 2.36024506579 + 0.72071145498 2.33925805779 + 0.73072133630 2.31253715413 + 0.74073121762 2.27987252229 + 0.75074109894 2.24110295377 + 0.76075098026 2.19612080960 + 0.77076086158 2.14487619975 + 0.78077074290 2.08738032575 + 0.79078062422 2.02370794477 + 0.80079050553 1.95399889690 + 0.81080038685 1.87845867928 + 0.82081026817 1.79735806282 + 0.83082014949 1.71103172723 + 0.84083003081 1.61987596169 + 0.85083991213 1.52434543111 + 0.86084979345 1.42494907848 + 0.87085967477 1.32224519680 + 0.88086955609 1.21683575428 + 0.89087943741 1.10936004243 + 0.90088931873 1.00048774322 + 0.91089920005 0.89091150538 + 0.92090908137 0.78133913797 + 0.93091896268 0.67248553015 + 0.94092884400 0.56506440911 + 0.95093872532 0.45978005177 + 0.96094860664 0.35731906523 + 0.97095848796 0.25834235038 + 0.98096836928 0.16347735986 + 0.99097825060 0.07331075368 + 1.00098813192 -0.01161844318 + 1.01099801324 -0.09082509136 + 1.02100789456 -0.16388351323 + 1.03101777588 -0.23043232069 + 1.04102765720 -0.29017843252 + 1.05103753851 -0.34290023384 + 1.06104741983 -0.38844983664 + 1.07105730115 -0.42675442135 + 1.08106718247 -0.45781664880 + 1.09107706379 -0.48171414595 + 1.10108694511 -0.49859807956 + 1.11109682643 -0.50869085239 + 1.12110670775 -0.51228296350 + 1.13111658907 -0.50972908759 + 1.14112647039 -0.50144343367 + 1.15113635171 -0.48789446728 + 1.16114623303 -0.46959908128 + 1.17115611434 -0.44711630400 + 1.18116599566 -0.42104060943 + 1.19117587698 -0.39199504027 + 1.20118575830 -0.36062421772 + 1.21119563962 -0.32758688727 + 1.22120552094 -0.29354106729 + 1.23121540226 -0.25913089675 + 1.24122528358 -0.22497448999 + 1.25123516490 -0.19165908697 + 1.26124504622 -0.15973387771 + 1.27125492754 -0.12970419039 + 1.28126480886 -0.10202607902 + 1.29127469017 -0.07710171621 + 1.30128457149 -0.05527548667 + 1.31129445281 -0.03683088008 + 1.32130433413 -0.02198823499 + 1.33131421545 -0.01087181397 + 1.34132409677 -0.00370404850 + 1.35133397809 -0.00043609991 + 1.36134385941 0.00010613080 + 1.37135374073 0.00000000000 + 1 1 -9.4342591198000001 #kb l, n (seq), energy in Ry + 148 0.0100210963042408 1.4731011567233914 + 0.00000000000 23.38707804586 + 0.01002109630 23.37485751873 + 0.02004219261 23.33823849647 + 0.03006328891 23.27734586349 + 0.04008438522 23.19238722768 + 0.05010548152 23.08365133785 + 0.06012657783 22.95150612397 + 0.07014767413 22.79639629427 + 0.08016877043 22.61884042307 + 0.09018986674 22.41942753025 + 0.10021096304 22.19881329899 + 0.11023205935 21.95771587450 + 0.12025315565 21.69691125474 + 0.13027425196 21.41722842965 + 0.14029534826 21.11954425223 + 0.15031644456 20.80477802628 + 0.16033754087 20.47388600001 + 0.17035863717 20.12785568315 + 0.18037973348 19.76770011347 + 0.19040082978 19.39445209437 + 0.20042192608 19.00915848195 + 0.21044302239 18.61287451950 + 0.22046411869 18.20665831915 + 0.23048521500 17.79156550348 + 0.24050631130 17.36864406388 + 0.25052740761 16.93892947308 + 0.26054850391 16.50344005347 + 0.27056960021 16.06317275159 + 0.28059069652 15.61909913187 + 0.29061179282 15.17216187337 + 0.30063288913 14.72327153557 + 0.31065398543 14.27330384664 + 0.32067508174 13.82309729396 + 0.33069617804 13.37345124004 + 0.34071727434 12.92512438994 + 0.35073837065 12.47883365949 + 0.36075946695 12.03525354369 + 0.37078056326 11.59501578399 + 0.38080165956 11.15870944052 + 0.39082275587 10.72688135762 + 0.40084385217 10.30003690352 + 0.41086494847 9.87864105691 + 0.42088604478 9.46311974269 + 0.43090714108 9.05386141091 + 0.44092823739 8.65121884935 + 0.45094933369 8.25551111865 + 0.46097043000 7.86702566791 + 0.47099152630 7.48602053718 + 0.48101262260 7.11272658830 + 0.49103371891 6.74734982015 + 0.50105481521 6.39007361963 + 0.51107591152 6.04106101554 + 0.52109700782 5.70045681243 + 0.53111810412 5.36838967978 + 0.54113920043 5.04497404512 + 0.55116029673 4.73031190300 + 0.56118139304 4.42449437689 + 0.57120248934 4.12760316864 + 0.58122358565 3.83971174075 + 0.59124468195 3.56088631456 + 0.60126577825 3.29118664548 + 0.61128687456 3.03066657698 + 0.62130797086 2.77937436185 + 0.63132906717 2.53735278423 + 0.64135016347 2.30463906698 + 0.65137125978 2.08126457186 + 0.66139235608 1.86725434226 + 0.67141345238 1.66262646021 + 0.68143454869 1.46739127205 + 0.69145564499 1.28155048690 + 0.70147674130 1.10509617957 + 0.71149783760 0.93800971926 + 0.72151893391 0.78026065235 + 0.73154003021 0.63180556560 + 0.74156112651 0.49258695483 + 0.75158222282 0.36253212972 + 0.76160331912 0.24155217653 + 0.77162441543 0.12954100657 + 0.78164551173 0.02637451298 + 0.79166660804 -0.06809014218 + 0.80168770434 -0.15401509039 + 0.81170880064 -0.23158215153 + 0.82172989695 -0.30099304623 + 0.83175099325 -0.36246941270 + 0.84177208956 -0.41625262108 + 0.85179318586 -0.46260337608 + 0.86181428216 -0.50180110860 + 0.87183537847 -0.53414315337 + 0.88185647477 -0.55994371853 + 0.89187757108 -0.57953265238 + 0.90189866738 -0.59325401836 + 0.91191976369 -0.60146448914 + 0.92194085999 -0.60453157665 + 0.93196195629 -0.60283171450 + 0.94198305260 -0.59674821428 + 0.95200414890 -0.58666911627 + 0.96202524521 -0.57298495860 + 0.97204634151 -0.55608649051 + 0.98206743782 -0.53636235359 + 0.99208853412 -0.51419675989 + 1.00210963042 -0.48996719029 + 1.01213072673 -0.46404214354 + 1.02215182303 -0.43677895813 + 1.03217291934 -0.40852173400 + 1.04219401564 -0.37959937806 + 1.05221511195 -0.35032379481 + 1.06223620825 -0.32098824263 + 1.07225730455 -0.29186587574 + 1.08227840086 -0.26320848602 + 1.09229949716 -0.23524545926 + 1.10232059347 -0.20818295578 + 1.11234168977 -0.18220332477 + 1.12236278607 -0.15746475672 + 1.13238388238 -0.13410117577 + 1.14240497868 -0.11222237152 + 1.15242607499 -0.09191436739 + 1.16244717129 -0.07324001696 + 1.17246826760 -0.05623982015 + 1.18248936390 -0.04093294612 + 1.19251046020 -0.02731845266 + 1.20253155651 -0.01537670449 + 1.21255265281 -0.00507081035 + 1.22257374912 0.00365255052 + 1.23259484542 0.01086196840 + 1.24261594173 0.01663990421 + 1.25263703803 0.02108055699 + 1.26265813433 0.02428800879 + 1.27267923064 0.02637422937 + 1.28270032694 0.02745709774 + 1.29272142325 0.02765844869 + 1.30274251955 0.02710216089 + 1.31276361586 0.02591230139 + 1.32278471216 0.02421137146 + 1.33280580846 0.02211864989 + 1.34282690477 0.01974865319 + 1.35284800107 0.01720974883 + 1.36286909738 0.01460290572 + 1.37289019368 0.01202061286 + 1.38291128999 0.00954597053 + 1.39293238629 0.00725195194 + 1.40295348259 0.00520085275 + 1.41297457890 0.00344391589 + 1.42299567520 0.00202031694 + 1.43301677151 0.00095799061 + 1.44303786781 0.00029000296 + 1.45305896411 0.00000132391 + 1.46308006042 -0.00003151954 + 1.47310115672 0.00000000000 + 1 2 -2.2985413700000001 #kb l, n (seq), energy in Ry + 148 0.0100210963042408 1.4731011567233914 + 0.00000000000 -13.97785785522 + 0.01002109630 -13.96266638562 + 0.02004219261 -13.91717044483 + 0.03006328891 -13.84160410327 + 0.04008438522 -13.73635544881 + 0.05010548152 -13.60196342612 + 0.06012657783 -13.43911345577 + 0.07014767413 -13.24863190201 + 0.08016877043 -13.03147945817 + 0.09018986674 -12.78874345754 + 0.10021096304 -12.52162924646 + 0.11023205935 -12.23145064935 + 0.12025315565 -11.91961966102 + 0.13027425196 -11.58763549999 + 0.14029534826 -11.23707303536 + 0.15031644456 -10.86957079151 + 0.16033754087 -10.48681863056 + 0.17035863717 -10.09054518226 + 0.18037973348 -9.68250522557 + 0.19040082978 -9.26446707784 + 0.20042192608 -8.83820013734 + 0.21044302239 -8.40546270036 + 0.22046411869 -7.96799014420 + 0.23048521500 -7.52748362415 + 0.24050631130 -7.08559933363 + 0.25052740761 -6.64393845896 + 0.26054850391 -6.20403790002 + 0.27056960021 -5.76736182515 + 0.28059069652 -5.33529413644 + 0.29061179282 -4.90913189250 + 0.30063288913 -4.49007972803 + 0.31065398543 -4.07924531233 + 0.32067508174 -3.67763584399 + 0.33069617804 -3.28615561672 + 0.34071727434 -2.90560462472 + 0.35073837065 -2.53667820433 + 0.36075946695 -2.17996768411 + 0.37078056326 -1.83596199705 + 0.38080165956 -1.50505021396 + 0.39082275587 -1.18752492947 + 0.40084385217 -0.88358644796 + 0.41086494847 -0.59334767905 + 0.42088604478 -0.31683967401 + 0.43090714108 -0.05401770759 + 0.44092823739 0.19523217902 + 0.45094933369 0.43108627266 + 0.46097043000 0.65377601453 + 0.47099152630 0.86358065442 + 0.48101262260 1.06081983109 + 0.49103371891 1.24584617034 + 0.50105481521 1.41903799672 + 0.51107591152 1.58079224022 + 0.52109700782 1.73151762950 + 0.53111810412 1.87162823722 + 0.54113920043 2.00153746002 + 0.55116029673 2.12165248363 + 0.56118139304 2.23236929561 + 0.57120248934 2.33406828769 + 0.58122358565 2.42711048183 + 0.59124468195 2.51183441260 + 0.60126577825 2.58855367591 + 0.61128687456 2.65755515461 + 0.62130797086 2.71909792160 + 0.63132906717 2.77341280059 + 0.64135016347 2.82070257013 + 0.65137125978 2.86114278602 + 0.66139235608 2.89488316064 + 0.67141345238 2.92204949902 + 0.68143454869 2.94274608046 + 0.69145564499 2.95705849672 + 0.70147674130 2.96505681576 + 0.71149783760 2.96679905678 + 0.72151893391 2.96233489026 + 0.73154003021 2.95170947933 + 0.74156112651 2.93496741294 + 0.75158222282 2.91215664144 + 0.76160331912 2.88333235810 + 0.77162441543 2.84856074254 + 0.78164551173 2.80792252157 + 0.79166660804 2.76151626518 + 0.80168770434 2.70946137580 + 0.81170880064 2.65190072305 + 0.82172989695 2.58900285225 + 0.83175099325 2.52096377419 + 0.84177208956 2.44800826094 + 0.85179318586 2.37039065916 + 0.86181428216 2.28839517776 + 0.87183537847 2.20233567739 + 0.88185647477 2.11255491408 + 0.89187757108 2.01942330926 + 0.90189866738 1.92333719160 + 0.91191976369 1.82471660157 + 0.92194085999 1.72400264203 + 0.93196195629 1.62165443141 + 0.94198305260 1.51814570482 + 0.95200414890 1.41396110302 + 0.96202524521 1.30959220710 + 0.97204634151 1.20553337434 + 0.98206743782 1.10227742818 + 0.99208853412 1.00031127926 + 1.00210963042 0.90011151469 + 1.01213072673 0.80214004248 + 1.02215182303 0.70683983684 + 1.03217291934 0.61463084808 + 1.04219401564 0.52590613523 + 1.05221511195 0.44102827434 + 1.06223620825 0.36032609049 + 1.07225730455 0.28409176382 + 1.08227840086 0.21257834390 + 1.09229949716 0.14599770955 + 1.10232059347 0.08451899990 + 1.11234168977 0.02826754124 + 1.12236278607 -0.02267571775 + 1.13238388238 -0.06827425593 + 1.14240497868 -0.10853551224 + 1.15242607499 -0.14350990598 + 1.16244717129 -0.17328936190 + 1.17246826760 -0.19800535745 + 1.18248936390 -0.21782652204 + 1.19251046020 -0.23295580443 + 1.20253155651 -0.24362718503 + 1.21255265281 -0.25010250585 + 1.22257374912 -0.25267054902 + 1.23259484542 -0.25164492772 + 1.24261594173 -0.24736124511 + 1.25263703803 -0.24017182941 + 1.26265813433 -0.23044152875 + 1.27267923064 -0.21854307864 + 1.28270032694 -0.20485257433 + 1.29272142325 -0.18974502067 + 1.30274251955 -0.17359000842 + 1.31276361586 -0.15674754811 + 1.32278471216 -0.13956416378 + 1.33280580846 -0.12236923734 + 1.34282690477 -0.10547164796 + 1.35284800107 -0.08915678759 + 1.36286909738 -0.07368391713 + 1.37289019368 -0.05928393284 + 1.38291128999 -0.04615755150 + 1.39293238629 -0.03447391079 + 1.40295348259 -0.02436962130 + 1.41297457890 -0.01594824216 + 1.42299567520 -0.00927647200 + 1.43301677151 -0.00438829811 + 1.44303786781 -0.00135903512 + 1.45305896411 -0.00006439180 + 1.46308006042 0.00009292496 + 1.47310115672 0.00000000000 + 2 1 -2.6639099890000000 #kb l, n (seq), energy in Ry + 128 0.0100522365417035 1.2766340407963410 + 0.00000000000 149.31349661539 + 0.01005223654 149.01872683209 + 0.02010447308 148.13706927318 + 0.03015670963 146.67645447188 + 0.04020894617 144.64999202940 + 0.05026118271 142.07581325397 + 0.06031341925 138.97685261684 + 0.07036565579 135.38057212208 + 0.08041789233 131.31863268745 + 0.09047012888 126.82651660903 + 0.10052236542 121.94310692447 + 0.11057460196 116.71022926607 + 0.12062683850 111.17216233922 + 0.13067907504 105.37512468998 + 0.14073131158 99.36674338166 + 0.15078354813 93.19551311182 + 0.16083578467 86.91025251175 + 0.17088802121 80.55956464811 + 0.18094025775 74.19130951437 + 0.19099249429 67.85209482473 + 0.20104473083 61.58679188426 + 0.21109696738 55.43808267240 + 0.22114920392 49.44604357471 + 0.23120144046 43.64777071760 + 0.24125367700 38.07705134069 + 0.25130591354 32.76408456527 + 0.26135815008 27.73525444215 + 0.27141038663 23.01295722956 + 0.28146262317 18.61548407023 + 0.29151485971 14.55695933668 + 0.30156709625 10.84733419585 + 0.31161933279 7.49243412803 + 0.32167156933 4.49405826876 + 0.33172380588 1.85012789032 + 0.34177604242 -0.44511944983 + 0.35182827896 -2.40089410067 + 0.36188051550 -4.02958140021 + 0.37193275204 -5.34643661221 + 0.38198498858 -6.36925307296 + 0.39203722513 -7.11800911462 + 0.40208946167 -7.61449955850 + 0.41214169821 -7.88195757637 + 0.42219393475 -7.94467277723 + 0.43224617129 -7.82761118361 + 0.44229840783 -7.55604263485 + 0.45235064438 -7.15518082266 + 0.46240288092 -6.64984083619 + 0.47245511746 -6.06411866260 + 0.48250735400 -5.42109658778 + 0.49255959054 -4.74257793629 + 0.50261182709 -4.04885399377 + 0.51266406363 -3.35850534874 + 0.52271630017 -2.68823928173 + 0.53276853671 -2.05276418917 + 0.54282077325 -1.46470140019 + 0.55287300979 -0.93453413303 + 0.56292524634 -0.47059274626 + 0.57297748288 -0.07907488372 + 0.58302971942 0.23590141578 + 0.59308195596 0.47221401822 + 0.60313419250 0.62962521689 + 0.61318642904 0.70964561903 + 0.62323866559 0.71537682873 + 0.63329090213 0.65133659341 + 0.64334313867 0.52327018726 + 0.65339537521 0.33795192174 + 0.66344761175 0.10298066456 + 0.67349984829 -0.17342683403 + 0.68355208484 -0.48264110101 + 0.69360432138 -0.81582007944 + 0.70365655792 -1.16410099292 + 0.71370879446 -1.51878095562 + 0.72376103100 -1.87148368473 + 0.73381326754 -2.21431003077 + 0.74386550409 -2.53997045131 + 0.75391774063 -2.84189794983 + 0.76396997717 -3.11434041831 + 0.77402221371 -3.35243177602 + 0.78407445025 -3.55224165567 + 0.79412668679 -3.71080389074 + 0.80417892334 -3.82612431072 + 0.81423115988 -3.89716885319 + 0.82428339642 -3.92383320463 + 0.83433563296 -3.90689556309 + 0.84438786950 -3.84795429836 + 0.85444010604 -3.74935252521 + 0.86449234259 -3.61409176317 + 0.87454457913 -3.44573692704 + 0.88459681567 -3.24831501784 + 0.89464905221 -3.02620982141 + 0.90470128875 -2.78405495279 + 0.91475352530 -2.52662746525 + 0.92480576184 -2.25874416774 + 0.93485799838 -1.98516257179 + 0.94491023492 -1.71048828295 + 0.95496247146 -1.43909040627 + 0.96501470800 -1.17502626183 + 0.97506694455 -0.92197651652 + 0.98511918109 -0.68319154219 + 0.99517141763 -0.46144954382 + 1.00522365417 -0.25902674460 + 1.01527589071 -0.07767964386 + 1.02532812725 0.08136086288 + 1.03538036380 0.21738400274 + 1.04543260034 0.33018293543 + 1.05548483688 0.42002873550 + 1.06553707342 0.48763559901 + 1.07558930996 0.53411836969 + 1.08564154650 0.56094380154 + 1.09569378305 0.56987682303 + 1.10574601959 0.56292321412 + 1.11579825613 0.54227010939 + 1.12585049267 0.51022565879 + 1.13590272921 0.46915941222 + 1.14595496575 0.42144443551 + 1.15600720230 0.36940245114 + 1.16605943884 0.31525300701 + 1.17611167538 0.26106778405 + 1.18616391192 0.20873053209 + 1.19621614846 0.15990340830 + 1.20626838500 0.11599991540 + 1.21632062155 0.07816678181 + 1.22637285809 0.04727413186 + 1.23642509463 0.02387486054 + 1.24647733117 0.00839205070 + 1.25652956771 0.00098989091 + 1.26658180425 -0.00036733167 + 1.27663404080 0.00000000000 +# Vna:_______________ + 492 0.01000881913 4.91433019436 # npts, delta, cutoff + 0.00000000000 -3.83270122726 + 0.01000881913 -3.83186445735 + 0.02001763827 -3.82937596336 + 0.03002645740 -3.82529967185 + 0.04003527653 -3.81973732839 + 0.05004409567 -3.81282184806 + 0.06005291480 -3.80470909182 + 0.07006173393 -3.79556889520 + 0.08007055306 -3.78557617525 + 0.09007937220 -3.77490281665 + 0.10008819133 -3.76371084219 + 0.11009701046 -3.75214715215 + 0.12010582960 -3.74033990826 + 0.13011464873 -3.72839646909 + 0.14012346786 -3.71640266769 + 0.15013228700 -3.70442316022 + 0.16014110613 -3.69250255643 + 0.17014992526 -3.68066706243 + 0.18015874440 -3.66892640450 + 0.19016756353 -3.65727584963 + 0.20017638266 -3.64569819162 + 0.21018520180 -3.63416561429 + 0.22019402093 -3.62264138224 + 0.23020284006 -3.61108133935 + 0.24021165919 -3.59943521522 + 0.25022047833 -3.58764775237 + 0.26022929746 -3.57565967548 + 0.27023811659 -3.56340852333 + 0.28024693573 -3.55082936356 + 0.29025575486 -3.53785540753 + 0.30026457399 -3.52441853457 + 0.31027339313 -3.51044973354 + 0.32028221226 -3.49587946430 + 0.33029103139 -3.48063794260 + 0.34029985053 -3.46465535396 + 0.35030866966 -3.44786201057 + 0.36031748879 -3.43018847460 + 0.37032630793 -3.41156568758 + 0.38033512706 -3.39192516165 + 0.39034394619 -3.37119930052 + 0.40035276532 -3.34932193255 + 0.41036158446 -3.32622913447 + 0.42037040359 -3.30186041396 + 0.43037922272 -3.27616028718 + 0.44038804186 -3.24908024290 + 0.45039686099 -3.22058101724 + 0.46040568012 -3.19063503741 + 0.47041449926 -3.15922882197 + 0.48042331839 -3.12636507587 + 0.49043213752 -3.09206420157 + 0.50044095666 -3.05636497401 + 0.51044977579 -3.01932419661 + 0.52045859492 -2.98101527637 + 0.53046741406 -2.94152578771 + 0.54047623319 -2.90095423481 + 0.55048505232 -2.85940633058 + 0.56049387145 -2.81699116469 + 0.57050269059 -2.77381763198 + 0.58051150972 -2.72999142862 + 0.59052032885 -2.68561281833 + 0.60052914799 -2.64077525268 + 0.61053796712 -2.59556480847 + 0.62054678625 -2.55006031950 + 0.63055560539 -2.50433402031 + 0.64056442452 -2.45845250216 + 0.65057324365 -2.41247779168 + 0.66058206279 -2.36646839083 + 0.67059088192 -2.32048016445 + 0.68059970105 -2.27456700093 + 0.69060852019 -2.22878121730 + 0.70061733932 -2.18317371276 + 0.71062615845 -2.13779390164 + 0.72063497758 -2.09268947353 + 0.73064379672 -2.04790603693 + 0.74065261585 -2.00348670672 + 0.75066143498 -1.95947168649 + 0.76067025412 -1.91589789395 + 0.77067907325 -1.87279866332 + 0.78068789238 -1.83020354623 + 0.79069671152 -1.78813822299 + 0.80070553065 -1.74662452558 + 0.81071434978 -1.70568056192 + 0.82072316892 -1.66532093045 + 0.83073198805 -1.62555700598 + 0.84074080718 -1.58639727708 + 0.85074962632 -1.54784771672 + 0.86075844545 -1.50991216767 + 0.87076726458 -1.47259272694 + 0.88077608371 -1.43589011561 + 0.89078490285 -1.39980402465 + 0.90079372198 -1.36433342757 + 0.91080254111 -1.32947685626 + 0.92081136025 -1.29523263615 + 0.93082017938 -1.26159907952 + 0.94082899851 -1.22857463769 + 0.95083781765 -1.19615801352 + 0.96084663678 -1.16434823627 + 0.97085545591 -1.13314470182 + 0.98086427505 -1.10254718215 + 0.99087309418 -1.07255580603 + 1.00088191331 -1.04317101653 + 1.01089073245 -1.01439350738 + 1.02089955158 -0.98622414196 + 1.03090837071 -0.95866385868 + 1.04091718984 -0.93171356554 + 1.05092600898 -0.90537402666 + 1.06093482811 -0.87964574363 + 1.07094364724 -0.85452883424 + 1.08095246638 -0.83002291070 + 1.09096128551 -0.80612695919 + 1.10097010464 -0.78283922246 + 1.11097892378 -0.76015708737 + 1.12098774291 -0.73807697787 + 1.13099656204 -0.71659425473 + 1.14100538118 -0.69570312282 + 1.15101420031 -0.67539654578 + 1.16102301944 -0.65566616877 + 1.17103183858 -0.63650224894 + 1.18104065771 -0.61789359599 + 1.19104947684 -0.59982751183 + 1.20105829597 -0.58228973319 + 1.21106711511 -0.56526442440 + 1.22107593424 -0.54873522154 + 1.23108475337 -0.53268603271 + 1.24109357251 -0.51710171197 + 1.25110239164 -0.50196774459 + 1.26111121077 -0.48727032575 + 1.27112002991 -0.47299632692 + 1.28112884904 -0.45913328853 + 1.29113766817 -0.44566940056 + 1.30114648731 -0.43259348134 + 1.31115530644 -0.41989497627 + 1.32116412557 -0.40756385866 + 1.33117294471 -0.39559059158 + 1.34118176384 -0.38396620578 + 1.35119058297 -0.37268319462 + 1.36119940210 -0.36173733079 + 1.37120822124 -0.35112665330 + 1.38121704037 -0.34085036936 + 1.39122585950 -0.33090245927 + 1.40123467864 -0.32127419825 + 1.41124349777 -0.31195666894 + 1.42125231690 -0.30294212160 + 1.43126113604 -0.29422450923 + 1.44126995517 -0.28579590970 + 1.45127877430 -0.27764597173 + 1.46128759344 -0.26976017483 + 1.47129641257 -0.26212026191 + 1.48130523170 -0.25470499417 + 1.49131405084 -0.24750452744 + 1.50132286997 -0.24051850545 + 1.51133168910 -0.23373956739 + 1.52134050823 -0.22715991753 + 1.53134932737 -0.22077381245 + 1.54135814650 -0.21457534400 + 1.55136696563 -0.20855864357 + 1.56137578477 -0.20271805012 + 1.57138460390 -0.19704808233 + 1.58139342303 -0.19154342452 + 1.59140224217 -0.18619892724 + 1.60141106130 -0.18100960575 + 1.61141988043 -0.17597063752 + 1.62142869957 -0.17107736039 + 1.63143751870 -0.16632526954 + 1.64144633783 -0.16171001474 + 1.65145515697 -0.15722739668 + 1.66146397610 -0.15287335827 + 1.67147279523 -0.14864398500 + 1.68148161436 -0.14453555467 + 1.69149043350 -0.14054445178 + 1.70149925263 -0.13666691172 + 1.71150807176 -0.13289927805 + 1.72151689090 -0.12923848007 + 1.73152571003 -0.12568170812 + 1.74153452916 -0.12222618276 + 1.75154334830 -0.11886921679 + 1.76155216743 -0.11560762549 + 1.77156098656 -0.11243799550 + 1.78156980570 -0.10935761152 + 1.79157862483 -0.10636403863 + 1.80158744396 -0.10345471757 + 1.81159626310 -0.10062712026 + 1.82160508223 -0.09787883583 + 1.83161390136 -0.09520754128 + 1.84162272049 -0.09261097937 + 1.85163153963 -0.09008696181 + 1.86164035876 -0.08763336851 + 1.87164917789 -0.08524814483 + 1.88165799703 -0.08292929953 + 1.89166681616 -0.08067490267 + 1.90167563529 -0.07848308359 + 1.91168445443 -0.07635202903 + 1.92169327356 -0.07427998122 + 1.93170209269 -0.07226523609 + 1.94171091183 -0.07030614150 + 1.95171973096 -0.06840109559 + 1.96172855009 -0.06654854522 + 1.97173736923 -0.06474698433 + 1.98174618836 -0.06299495244 + 1.99175500749 -0.06129103313 + 2.00176382662 -0.05963385273 + 2.01177264576 -0.05802207896 + 2.02178146489 -0.05645441951 + 2.03179028402 -0.05492962084 + 2.04179910316 -0.05344646691 + 2.05180792229 -0.05200377805 + 2.06181674142 -0.05060040977 + 2.07182556056 -0.04923525168 + 2.08183437969 -0.04790722635 + 2.09184319882 -0.04661528833 + 2.10185201796 -0.04535842313 + 2.11186083709 -0.04413564625 + 2.12186965622 -0.04294600226 + 2.13187847536 -0.04178856385 + 2.14188729449 -0.04066243101 + 2.15189611362 -0.03956673013 + 2.16190493275 -0.03850061324 + 2.17191375189 -0.03746325713 + 2.18192257102 -0.03645386266 + 2.19193139015 -0.03547165395 + 2.20194020929 -0.03451587775 + 2.21194902842 -0.03358580269 + 2.22195784755 -0.03268071863 + 2.23196666669 -0.03179993599 + 2.24197548582 -0.03094278511 + 2.25198430495 -0.03010861566 + 2.26199312409 -0.02929679605 + 2.27200194322 -0.02850671283 + 2.28201076235 -0.02773777022 + 2.29201958149 -0.02698938952 + 2.30202840062 -0.02626100859 + 2.31203721975 -0.02555208134 + 2.32204603888 -0.02486207725 + 2.33205485802 -0.02419048091 + 2.34206367715 -0.02353679163 + 2.35207249628 -0.02290052291 + 2.36208131542 -0.02228120203 + 2.37209013455 -0.02167836964 + 2.38209895368 -0.02109157935 + 2.39210777282 -0.02052039741 + 2.40211659195 -0.01996440227 + 2.41212541108 -0.01942318430 + 2.42213423022 -0.01889634528 + 2.43214304935 -0.01838349821 + 2.44215186848 -0.01788426688 + 2.45216068762 -0.01739828564 + 2.46216950675 -0.01692519903 + 2.47217832588 -0.01646466151 + 2.48218714501 -0.01601633715 + 2.49219596415 -0.01557989934 + 2.50220478328 -0.01515503053 + 2.51221360241 -0.01474142198 + 2.52222242155 -0.01433877348 + 2.53223124068 -0.01394679311 + 2.54224005981 -0.01356519700 + 2.55224887895 -0.01319370910 + 2.56225769808 -0.01283206094 + 2.57226651721 -0.01247999149 + 2.58227533635 -0.01213724685 + 2.59228415548 -0.01180358010 + 2.60229297461 -0.01147875097 + 2.61230179375 -0.01116252574 + 2.62231061288 -0.01085467700 + 2.63231943201 -0.01055498371 + 2.64232825114 -0.01026323081 + 2.65233707028 -0.00997920915 + 2.66234588941 -0.00970271512 + 2.67235470854 -0.00943355065 + 2.68236352768 -0.00917152297 + 2.69237234681 -0.00891644458 + 2.70238116594 -0.00866813303 + 2.71238998508 -0.00842641081 + 2.72239880421 -0.00819110514 + 2.73240762334 -0.00796204791 + 2.74241644248 -0.00773907548 + 2.75242526161 -0.00752202862 + 2.76243408074 -0.00731075237 + 2.77244289988 -0.00710509588 + 2.78245171901 -0.00690491237 + 2.79246053814 -0.00671005892 + 2.80246935727 -0.00652039647 + 2.81247817641 -0.00633578962 + 2.82248699554 -0.00615610658 + 2.83249581467 -0.00598121905 + 2.84250463381 -0.00581100210 + 2.85251345294 -0.00564533416 + 2.86252227207 -0.00548409682 + 2.87253109121 -0.00532717484 + 2.88253991034 -0.00517445600 + 2.89254872947 -0.00502583103 + 2.90255754861 -0.00488119355 + 2.91256636774 -0.00474043995 + 2.92257518687 -0.00460346935 + 2.93258400601 -0.00447018353 + 2.94259282514 -0.00434048682 + 2.95260164427 -0.00421428605 + 2.96261046340 -0.00409149052 + 2.97261928254 -0.00397201185 + 2.98262810167 -0.00385576402 + 2.99263692080 -0.00374266321 + 3.00264573994 -0.00363262779 + 3.01265455907 -0.00352557823 + 3.02266337820 -0.00342143709 + 3.03267219734 -0.00332012893 + 3.04268101647 -0.00322158029 + 3.05268983560 -0.00312571960 + 3.06269865474 -0.00303247715 + 3.07270747387 -0.00294178501 + 3.08271629300 -0.00285357701 + 3.09272511214 -0.00276778867 + 3.10273393127 -0.00268435718 + 3.11274275040 -0.00260322137 + 3.12275156953 -0.00252432163 + 3.13276038867 -0.00244759986 + 3.14276920780 -0.00237299950 + 3.15277802693 -0.00230046542 + 3.16278684607 -0.00222994390 + 3.17279566520 -0.00216138263 + 3.18280448433 -0.00209473058 + 3.19281330347 -0.00202993805 + 3.20282212260 -0.00196695661 + 3.21283094173 -0.00190573905 + 3.22283976087 -0.00184623939 + 3.23284858000 -0.00178841284 + 3.24285739913 -0.00173221573 + 3.25286621827 -0.00167760551 + 3.26287503740 -0.00162454071 + 3.27288385653 -0.00157298090 + 3.28289267566 -0.00152288667 + 3.29290149480 -0.00147421965 + 3.30291031393 -0.00142694243 + 3.31291913306 -0.00138101854 + 3.32292795220 -0.00133641247 + 3.33293677133 -0.00129308957 + 3.34294559046 -0.00125101608 + 3.35295440960 -0.00121015909 + 3.36296322873 -0.00117048651 + 3.37297204786 -0.00113196708 + 3.38298086700 -0.00109457035 + 3.39298968613 -0.00105826662 + 3.40299850526 -0.00102302694 + 3.41300732440 -0.00098882311 + 3.42301614353 -0.00095562762 + 3.43302496266 -0.00092341367 + 3.44303378179 -0.00089215511 + 3.45304260093 -0.00086182649 + 3.46305142006 -0.00083240297 + 3.47306023919 -0.00080386036 + 3.48306905833 -0.00077617506 + 3.49307787746 -0.00074932408 + 3.50308669659 -0.00072328501 + 3.51309551573 -0.00069803599 + 3.52310433486 -0.00067355573 + 3.53311315399 -0.00064982347 + 3.54312197313 -0.00062681896 + 3.55313079226 -0.00060452248 + 3.56313961139 -0.00058291478 + 3.57314843053 -0.00056197712 + 3.58315724966 -0.00054169123 + 3.59316606879 -0.00052203931 + 3.60317488792 -0.00050300398 + 3.61318370706 -0.00048456833 + 3.62319252619 -0.00046671587 + 3.63320134532 -0.00044943051 + 3.64321016446 -0.00043269657 + 3.65321898359 -0.00041649877 + 3.66322780272 -0.00040082222 + 3.67323662186 -0.00038565239 + 3.68324544099 -0.00037097513 + 3.69325426012 -0.00035677666 + 3.70326307926 -0.00034304353 + 3.71327189839 -0.00032976264 + 3.72328071752 -0.00031692121 + 3.73328953666 -0.00030450681 + 3.74329835579 -0.00029250730 + 3.75330717492 -0.00028091086 + 3.76331599405 -0.00026970595 + 3.77332481319 -0.00025888135 + 3.78333363232 -0.00024842611 + 3.79334245145 -0.00023832954 + 3.80335127059 -0.00022858126 + 3.81336008972 -0.00021917114 + 3.82336890885 -0.00021008931 + 3.83337772799 -0.00020132616 + 3.84338654712 -0.00019287230 + 3.85339536625 -0.00018471860 + 3.86340418539 -0.00017685618 + 3.87341300452 -0.00016927634 + 3.88342182365 -0.00016197066 + 3.89343064279 -0.00015493089 + 3.90343946192 -0.00014814901 + 3.91344828105 -0.00014161722 + 3.92345710018 -0.00013532789 + 3.93346591932 -0.00012927362 + 3.94347473845 -0.00012344719 + 3.95348355758 -0.00011784155 + 3.96349237672 -0.00011244987 + 3.97350119585 -0.00010726546 + 3.98351001498 -0.00010228184 + 3.99351883412 -0.00009749266 + 4.00352765325 -0.00009289177 + 4.01353647238 -0.00008847316 + 4.02354529152 -0.00008423099 + 4.03355411065 -0.00008015956 + 4.04356292978 -0.00007625334 + 4.05357174892 -0.00007250693 + 4.06358056805 -0.00006891510 + 4.07358938718 -0.00006547273 + 4.08359820631 -0.00006217486 + 4.09360702545 -0.00005901664 + 4.10361584458 -0.00005599336 + 4.11362466371 -0.00005310046 + 4.12363348285 -0.00005033346 + 4.13364230198 -0.00004768803 + 4.14365112111 -0.00004515996 + 4.15365994025 -0.00004274513 + 4.16366875938 -0.00004043955 + 4.17367757851 -0.00003823934 + 4.18368639765 -0.00003614072 + 4.19369521678 -0.00003414003 + 4.20370403591 -0.00003223369 + 4.21371285505 -0.00003041825 + 4.22372167418 -0.00002869032 + 4.23373049331 -0.00002704664 + 4.24373931244 -0.00002548401 + 4.25374813158 -0.00002399936 + 4.26375695071 -0.00002258966 + 4.27376576984 -0.00002125202 + 4.28377458898 -0.00001998359 + 4.29378340811 -0.00001878162 + 4.30379222724 -0.00001764345 + 4.31380104638 -0.00001656650 + 4.32380986551 -0.00001554824 + 4.33381868464 -0.00001458624 + 4.34382750378 -0.00001367813 + 4.35383632291 -0.00001282162 + 4.36384514204 -0.00001201447 + 4.37385396118 -0.00001125452 + 4.38386278031 -0.00001053969 + 4.39387159944 -0.00000986795 + 4.40388041857 -0.00000923735 + 4.41388923771 -0.00000864599 + 4.42389805684 -0.00000809204 + 4.43390687597 -0.00000757373 + 4.44391569511 -0.00000708931 + 4.45392451424 -0.00000663715 + 4.46393333337 -0.00000621562 + 4.47394215251 -0.00000582318 + 4.48395097164 -0.00000545831 + 4.49395979077 -0.00000511958 + 4.50396860991 -0.00000480559 + 4.51397742904 -0.00000451498 + 4.52398624817 -0.00000424646 + 4.53399506731 -0.00000399877 + 4.54400388644 -0.00000377071 + 4.55401270557 -0.00000356111 + 4.56402152470 -0.00000336886 + 4.57403034384 -0.00000319289 + 4.58403916297 -0.00000303215 + 4.59404798210 -0.00000288567 + 4.60405680124 -0.00000275249 + 4.61406562037 -0.00000263171 + 4.62407443950 -0.00000252244 + 4.63408325864 -0.00000242387 + 4.64409207777 -0.00000233519 + 4.65410089690 -0.00000225565 + 4.66410971604 -0.00000218451 + 4.67411853517 -0.00000212108 + 4.68412735430 -0.00000206472 + 4.69413617344 -0.00000201479 + 4.70414499257 -0.00000197071 + 4.71415381170 -0.00000193192 + 4.72416263083 -0.00000189790 + 4.73417144997 -0.00000186814 + 4.74418026910 -0.00000184220 + 4.75418908823 -0.00000181964 + 4.76419790737 -0.00000180005 + 4.77420672650 -0.00000178305 + 4.78421554563 -0.00000176829 + 4.79422436477 -0.00000175544 + 4.80423318390 -0.00000174422 + 4.81424200303 -0.00000173435 + 4.82425082217 -0.00000172558 + 4.83425964130 -0.00000171771 + 4.84426846043 -0.00000171054 + 4.85427727957 -0.00000170389 + 4.86428609870 -0.00000169762 + 4.87429491783 -0.00000169161 + 4.88430373696 -0.00000168577 + 4.89431255610 -0.00000168002 + 4.90432137523 -0.00000167432 + 4.91433019436 0.00000000000 +# Vlocal:_______________________ + 492 0.01000881913 4.91433019436 # npts, delta, cutoff + 0.00000000000 -10.29158648606 + 0.01000881913 -10.29068791762 + 0.02001763827 -10.28801350644 + 0.03002645740 -10.28362561783 + 0.04003527653 -10.27762340554 + 0.05004409567 -10.27013617774 + 0.06005291480 -10.26131519480 + 0.07006173393 -10.25132472530 + 0.08007055306 -10.24033318599 + 0.09007937220 -10.22850506627 + 0.10008819133 -10.21599414237 + 0.11009701046 -10.20293826520 + 0.12010582960 -10.18945579738 + 0.13011464873 -10.17564360588 + 0.14012346786 -10.16157640079 + 0.15013228700 -10.14730714831 + 0.16014110613 -10.13286826873 + 0.17014992526 -10.11827334915 + 0.18015874440 -10.10351913925 + 0.19016756353 -10.08858764543 + 0.20017638266 -10.07344819164 + 0.21018520180 -10.05805935794 + 0.22019402093 -10.04237074677 + 0.23020284006 -10.02632455662 + 0.24021165919 -10.00985696298 + 0.25022047833 -9.99289931878 + 0.26022929746 -9.97537919517 + 0.27023811659 -9.95722128311 + 0.28024693573 -9.93834817519 + 0.29025575486 -9.91868104485 + 0.30026457399 -9.89814023178 + 0.31027339313 -9.87664574122 + 0.32028221226 -9.85411765944 + 0.33029103139 -9.83047648864 + 0.34029985053 -9.80564340668 + 0.35030866966 -9.77954046541 + 0.36031748879 -9.75209075096 + 0.37032630793 -9.72321854544 + 0.38033512706 -9.69284954578 + 0.39034394619 -9.66091120758 + 0.40035276532 -9.62733329633 + 0.41036158446 -9.59204872450 + 0.42037040359 -9.55499474286 + 0.43037922272 -9.51611452208 + 0.44038804186 -9.47535911665 + 0.45039686099 -9.43268973482 + 0.46040568012 -9.38808017357 + 0.47041449926 -9.34151920605 + 0.48042331839 -9.29301265998 + 0.49043213752 -9.24258490867 + 0.50044095666 -9.19027952251 + 0.51044977579 -9.13615889846 + 0.52045859492 -9.08030280588 + 0.53046741406 -9.02280591842 + 0.54047623319 -8.96377454240 + 0.55048505232 -8.90332285964 + 0.56049387145 -8.84156905772 + 0.57050269059 -8.77863171927 + 0.58051150972 -8.71462677772 + 0.59052032885 -8.64966524242 + 0.60052914799 -8.58385177700 + 0.61053796712 -8.51728409466 + 0.62054678625 -8.45005304758 + 0.63055560539 -8.38224322843 + 0.64056442452 -8.31393388453 + 0.65057324365 -8.24519995504 + 0.66058206279 -8.17611307033 + 0.67059088192 -8.10674239974 + 0.68059970105 -8.03715527351 + 0.69060852019 -7.96741755033 + 0.70061733932 -7.89759373463 + 0.71062615845 -7.82774687471 + 0.72063497758 -7.75793828961 + 0.73064379672 -7.68822718098 + 0.74065261585 -7.61867019056 + 0.75066143498 -7.54932095415 + 0.76067025412 -7.48022970040 + 0.77067907325 -7.41144292842 + 0.78068789238 -7.34300318555 + 0.79069671152 -7.27494895747 + 0.80070553065 -7.20731467158 + 0.81071434978 -7.14013080361 + 0.82072316892 -7.07342407608 + 0.83073198805 -7.00721772985 + 0.84074080718 -6.94153184876 + 0.85074962632 -6.87638371918 + 0.86075844545 -6.81178820574 + 0.87076726458 -6.74775812765 + 0.88077608371 -6.68430462184 + 0.89078490285 -6.62143748332 + 0.90079372198 -6.55916547373 + 0.91080254111 -6.49749659423 + 0.92081136025 -6.43643831883 + 0.93082017938 -6.37599778699 + 0.94082899851 -6.31618195595 + 0.95083781765 -6.25699771441 + 0.96084663678 -6.19845195933 + 0.97085545591 -6.14055163885 + 0.98086427505 -6.08330376527 + 0.99087309418 -6.02671539969 + 1.00088191331 -5.97079361427 + 1.01089073245 -5.91554543365 + 1.02089955158 -5.86097775962 + 1.03090837071 -5.80709728243 + 1.04091718984 -5.75391038173 + 1.05092600898 -5.70142301976 + 1.06093482811 -5.64964062959 + 1.07094364724 -5.59856800097 + 1.08095246638 -5.54820916577 + 1.09096128551 -5.49856728501 + 1.10097010464 -5.44964453893 + 1.11097892378 -5.40144202206 + 1.12098774291 -5.35395964385 + 1.13099656204 -5.30719603595 + 1.14100538118 -5.26114846709 + 1.15101420031 -5.21581276529 + 1.16102301944 -5.17118324801 + 1.17103183858 -5.12725266010 + 1.18104065771 -5.08401212158 + 1.19104947684 -5.04145107447 + 1.20105829597 -4.99955723244 + 1.21106711511 -4.95831658049 + 1.22107593424 -4.91771442580 + 1.23108475337 -4.87773620464 + 1.24109357251 -4.83836816267 + 1.25110239164 -4.79959704644 + 1.26111121077 -4.76141018810 + 1.27112002991 -4.72379547771 + 1.28112884904 -4.68674136154 + 1.29113766817 -4.65023682814 + 1.30114648731 -4.61427139240 + 1.31115530644 -4.57883509943 + 1.32116412557 -4.54391843023 + 1.33117294471 -4.50951226828 + 1.34118176384 -4.47560798192 + 1.35119058297 -4.44219832363 + 1.36119940210 -4.40927925089 + 1.37120822124 -4.37684891705 + 1.38121704037 -4.34490657699 + 1.39122585950 -4.31344619559 + 1.40123467864 -4.28245897280 + 1.41124349777 -4.25193585937 + 1.42125231690 -4.22186891999 + 1.43126113604 -4.19225187118 + 1.44126995517 -4.16307650601 + 1.45127877430 -4.13433214261 + 1.46128759344 -4.10600388631 + 1.47129641257 -4.07807306457 + 1.48130523170 -4.05051798374 + 1.49131405084 -4.02332830757 + 1.50132286997 -3.99650315220 + 1.51133168910 -3.97003459566 + 1.52134050823 -3.94391424925 + 1.53134932737 -3.91813574642 + 1.54135814650 -3.89269252742 + 1.55136696563 -3.86757804517 + 1.56137578477 -3.84278593473 + 1.57138460390 -3.81830998698 + 1.58139342303 -3.79414413598 + 1.59140224217 -3.77028246083 + 1.60141106130 -3.74671918554 + 1.61141988043 -3.72344867771 + 1.62142869957 -3.70046544798 + 1.63143751870 -3.67776414809 + 1.64144633783 -3.65533956929 + 1.65145515697 -3.63318663970 + 1.66146397610 -3.61130041669 + 1.67147279523 -3.58967608818 + 1.68148161436 -3.56830902332 + 1.69149043350 -3.54719468783 + 1.70149925263 -3.52632838901 + 1.71150807176 -3.50570553388 + 1.72151689090 -3.48532210755 + 1.73152571003 -3.46517434927 + 1.74153452916 -3.44525852238 + 1.75154334830 -3.42557097697 + 1.76155216743 -3.40610756085 + 1.77156098656 -3.38686388903 + 1.78156980570 -3.36783627108 + 1.79157862483 -3.34902129397 + 1.80158744396 -3.33041541800 + 1.81159626310 -3.31201513275 + 1.82160508223 -3.29381704373 + 1.83161390136 -3.27581784343 + 1.84162272049 -3.25801428975 + 1.85163153963 -3.24040320957 + 1.86164035876 -3.22298149847 + 1.87164917789 -3.20574611837 + 1.88165799703 -3.18869409585 + 1.89166681616 -3.17182252041 + 1.90167563529 -3.15512854283 + 1.91168445443 -3.13860937356 + 1.92169327356 -3.12226228118 + 1.93170209269 -3.10608459088 + 1.94171091183 -3.09007368296 + 1.95171973096 -3.07422699145 + 1.96172855009 -3.05854200283 + 1.97173736923 -3.04301625459 + 1.98174618836 -3.02764733395 + 1.99175500749 -3.01243287659 + 2.00176382662 -2.99737056552 + 2.01177264576 -2.98245812987 + 2.02178146489 -2.96769334375 + 2.03179028402 -2.95307402508 + 2.04179910316 -2.93859803457 + 2.05180792229 -2.92426327471 + 2.06181674142 -2.91006768871 + 2.07182556056 -2.89600925954 + 2.08183437969 -2.88208600894 + 2.09184319882 -2.86829599651 + 2.10185201796 -2.85463731881 + 2.11186083709 -2.84110810850 + 2.12186965622 -2.82770653346 + 2.13187847536 -2.81443079600 + 2.14188729449 -2.80127913200 + 2.15189611362 -2.78824981019 + 2.16190493275 -2.77534113136 + 2.17191375189 -2.76255142761 + 2.18192257102 -2.74987906166 + 2.19193139015 -2.73732242607 + 2.20194020929 -2.72487994270 + 2.21194902842 -2.71255006198 + 2.22195784755 -2.70033126224 + 2.23196666669 -2.68822204912 + 2.24197548582 -2.67622095491 + 2.25198430495 -2.66432653803 + 2.26199312409 -2.65253738239 + 2.27200194322 -2.64085209682 + 2.28201076235 -2.62926931464 + 2.29201958149 -2.61778769299 + 2.30202840062 -2.60640591241 + 2.31203721975 -2.59512267625 + 2.32204603888 -2.58393671020 + 2.33205485802 -2.57284676183 + 2.34206367715 -2.56185160017 + 2.35207249628 -2.55095001520 + 2.36208131542 -2.54014081739 + 2.37209013455 -2.52942283726 + 2.38209895368 -2.51879492497 + 2.39210777282 -2.50825594997 + 2.40211659195 -2.49780480055 + 2.41212541108 -2.48744038349 + 2.42213423022 -2.47716162357 + 2.43214304935 -2.46696746330 + 2.44215186848 -2.45685686249 + 2.45216068762 -2.44682879798 + 2.46216950675 -2.43688226324 + 2.47217832588 -2.42701626804 + 2.48218714501 -2.41722983811 + 2.49219596415 -2.40752201483 + 2.50220478328 -2.39789185493 + 2.51221360241 -2.38833843015 + 2.52222242155 -2.37886082699 + 2.53223124068 -2.36945814636 + 2.54224005981 -2.36012950336 + 2.55224887895 -2.35087402694 + 2.56225769808 -2.34169085969 + 2.57226651721 -2.33257915757 + 2.58227533635 -2.32353808963 + 2.59228415548 -2.31456683777 + 2.60229297461 -2.30566459637 + 2.61230179375 -2.29683057214 + 2.62231061288 -2.28806398387 + 2.63231943201 -2.27936406239 + 2.64232825114 -2.27073005014 + 2.65233707028 -2.26216120110 + 2.66234588941 -2.25365678032 + 2.67235470854 -2.24521606387 + 2.68236352768 -2.23683833860 + 2.69237234681 -2.22852290201 + 2.70238116594 -2.22026906201 + 2.71238998508 -2.21207613674 + 2.72239880421 -2.20394345435 + 2.73240762334 -2.19587035283 + 2.74241644248 -2.18785617982 + 2.75242526161 -2.17990029246 + 2.76243408074 -2.17200205721 + 2.77244289988 -2.16416084968 + 2.78245171901 -2.15637605447 + 2.79246053814 -2.14864706499 + 2.80246935727 -2.14097328333 + 2.81247817641 -2.13335412008 + 2.82248699554 -2.12578899420 + 2.83249581467 -2.11827733284 + 2.84250463381 -2.11081857123 + 2.85251345294 -2.10341215253 + 2.86252227207 -2.09605752769 + 2.87253109121 -2.08875415530 + 2.88253991034 -2.08150150149 + 2.89254872947 -2.07429903977 + 2.90255754861 -2.06714625090 + 2.91256636774 -2.06004262279 + 2.92257518687 -2.05298765035 + 2.93258400601 -2.04598083541 + 2.94259282514 -2.03902168656 + 2.95260164427 -2.03210971903 + 2.96261046340 -2.02524445465 + 2.97261928254 -2.01842542167 + 2.98262810167 -2.01165215467 + 2.99263692080 -2.00492419445 + 3.00264573994 -1.99824108795 + 3.01265455907 -1.99160238809 + 3.02266337820 -1.98500765374 + 3.03267219734 -1.97845644959 + 3.04268101647 -1.97194834607 + 3.05268983560 -1.96548291926 + 3.06269865474 -1.95905975074 + 3.07270747387 -1.95267842758 + 3.08271629300 -1.94633854216 + 3.09272511214 -1.94003969217 + 3.10273393127 -1.93378148047 + 3.11274275040 -1.92756351505 + 3.12275156953 -1.92138540892 + 3.13276038867 -1.91524678003 + 3.14276920780 -1.90914725121 + 3.15277802693 -1.90308645008 + 3.16278684607 -1.89706400896 + 3.17279566520 -1.89107956485 + 3.18280448433 -1.88513275925 + 3.19281330347 -1.87922323819 + 3.20282212260 -1.87335065211 + 3.21283094173 -1.86751465579 + 3.22283976087 -1.86171490835 + 3.23284858000 -1.85595107310 + 3.24285739913 -1.85022281753 + 3.25286621827 -1.84452981321 + 3.26287503740 -1.83887173573 + 3.27288385653 -1.83324826464 + 3.28289267566 -1.82765908341 + 3.29290149480 -1.82210387935 + 3.30291031393 -1.81658234358 + 3.31291913306 -1.81109417095 + 3.32292795220 -1.80563905999 + 3.33293677133 -1.80021671284 + 3.34294559046 -1.79482683520 + 3.35295440960 -1.78946913628 + 3.36296322873 -1.78414332875 + 3.37297204786 -1.77884912871 + 3.38298086700 -1.77358625561 + 3.39298968613 -1.76835443222 + 3.40299850526 -1.76315338457 + 3.41300732440 -1.75798284190 + 3.42301614353 -1.75284253661 + 3.43302496266 -1.74773220423 + 3.44303378179 -1.74265158335 + 3.45304260093 -1.73760041562 + 3.46305142006 -1.73257844564 + 3.47306023919 -1.72758542099 + 3.48306905833 -1.72262109213 + 3.49307787746 -1.71768521238 + 3.50308669659 -1.71277753789 + 3.51309551573 -1.70789782758 + 3.52310433486 -1.70304584311 + 3.53311315399 -1.69822134886 + 3.54312197313 -1.69342411183 + 3.55313079226 -1.68865390169 + 3.56313961139 -1.68391049065 + 3.57314843053 -1.67919365352 + 3.58315724966 -1.67450316760 + 3.59316606879 -1.66983881269 + 3.60317488792 -1.66520037102 + 3.61318370706 -1.66058762725 + 3.62319252619 -1.65600036840 + 3.63320134532 -1.65143838386 + 3.64321016446 -1.64690146530 + 3.65321898359 -1.64238940670 + 3.66322780272 -1.63790200428 + 3.67323662186 -1.63343905648 + 3.68324544099 -1.62900036395 + 3.69325426012 -1.62458572948 + 3.70326307926 -1.62019495800 + 3.71327189839 -1.61582785654 + 3.72328071752 -1.61148423422 + 3.73328953666 -1.60716390218 + 3.74329835579 -1.60286667362 + 3.75330717492 -1.59859236369 + 3.76331599405 -1.59434078953 + 3.77332481319 -1.59011177020 + 3.78333363232 -1.58590512670 + 3.79334245145 -1.58172068189 + 3.80335127059 -1.57755826052 + 3.81336008972 -1.57341768917 + 3.82336890885 -1.56929879626 + 3.83337772799 -1.56520141196 + 3.84338654712 -1.56112536824 + 3.85339536625 -1.55707049881 + 3.86340418539 -1.55303663911 + 3.87341300452 -1.54902362625 + 3.88342182365 -1.54503129905 + 3.89343064279 -1.54105949797 + 3.90343946192 -1.53710806513 + 3.91344828105 -1.53317684423 + 3.92345710018 -1.52926568060 + 3.93346591932 -1.52537442111 + 3.94347473845 -1.52150291421 + 3.95348355758 -1.51765100989 + 3.96349237672 -1.51381855963 + 3.97350119585 -1.51000541642 + 3.98351001498 -1.50621143473 + 3.99351883412 -1.50243647049 + 4.00352765325 -1.49868038106 + 4.01353647238 -1.49494302523 + 4.02354529152 -1.49122426318 + 4.03355411065 -1.48752395650 + 4.04356292978 -1.48384196815 + 4.05357174892 -1.48017816244 + 4.06358056805 -1.47653240500 + 4.07358938718 -1.47290456280 + 4.08359820631 -1.46929450412 + 4.09360702545 -1.46570209851 + 4.10361584458 -1.46212721680 + 4.11362466371 -1.45856973108 + 4.12363348285 -1.45502951468 + 4.13364230198 -1.45150644215 + 4.14365112111 -1.44800038927 + 4.15365994025 -1.44451123299 + 4.16366875938 -1.44103885145 + 4.17367757851 -1.43758312399 + 4.18368639765 -1.43414393106 + 4.19369521678 -1.43072115428 + 4.20370403591 -1.42731467640 + 4.21371285505 -1.42392438126 + 4.22372167418 -1.42055015383 + 4.23373049331 -1.41719188014 + 4.24373931244 -1.41384944732 + 4.25374813158 -1.41052274354 + 4.26375695071 -1.40721165804 + 4.27376576984 -1.40391608108 + 4.28377458898 -1.40063590396 + 4.29378340811 -1.39737101899 + 4.30379222724 -1.39412131949 + 4.31380104638 -1.39088669975 + 4.32380986551 -1.38766705505 + 4.33381868464 -1.38446228165 + 4.34382750378 -1.38127227673 + 4.35383632291 -1.37809693845 + 4.36384514204 -1.37493616589 + 4.37385396118 -1.37178985904 + 4.38386278031 -1.36865791883 + 4.39387159944 -1.36554024708 + 4.40388041857 -1.36243674651 + 4.41388923771 -1.35934732071 + 4.42389805684 -1.35627187417 + 4.43390687597 -1.35321031221 + 4.44391569511 -1.35016254102 + 4.45392451424 -1.34712846763 + 4.46393333337 -1.34410799989 + 4.47394215251 -1.34110104650 + 4.48395097164 -1.33810751695 + 4.49395979077 -1.33512732156 + 4.50396860991 -1.33216037142 + 4.51397742904 -1.32920657844 + 4.52398624817 -1.32626585529 + 4.53399506731 -1.32333811540 + 4.54400388644 -1.32042327300 + 4.55401270557 -1.31752124304 + 4.56402152470 -1.31463194123 + 4.57403034384 -1.31175528401 + 4.58403916297 -1.30889118856 + 4.59404798210 -1.30603957278 + 4.60405680124 -1.30320035527 + 4.61406562037 -1.30037345536 + 4.62407443950 -1.29755879307 + 4.63408325864 -1.29475628909 + 4.64409207777 -1.29196586482 + 4.65410089690 -1.28918744233 + 4.66410971604 -1.28642094435 + 4.67411853517 -1.28366629428 + 4.68412735430 -1.28092341616 + 4.69413617344 -1.27819223469 + 4.70414499257 -1.27547267523 + 4.71415381170 -1.27276466373 + 4.72416263083 -1.27006812681 + 4.73417144997 -1.26738299169 + 4.74418026910 -1.26470918620 + 4.75418908823 -1.26204663881 + 4.76419790737 -1.25939527854 + 4.77420672650 -1.25675503504 + 4.78421554563 -1.25412583855 + 4.79422436477 -1.25150761987 + 4.80423318390 -1.24890031039 + 4.81424200303 -1.24630384207 + 4.82425082217 -1.24371814744 + 4.83425964130 -1.24114315957 + 4.84426846043 -1.23857881212 + 4.85427727957 -1.23602503925 + 4.86428609870 -1.23348177570 + 4.87429491783 -1.23094895674 + 4.88430373696 -1.22842651814 + 4.89431255610 -1.22591439622 + 4.90432137523 -1.22341252783 + 4.91433019436 -1.22091918180 +# Core:__________________________ + 173 0.01000116946 1.72020114769 # npts, delta, cutoff + 0.00000000000 3.42392161086 + 0.01000116946 3.42063920117 + 0.02000233893 3.41080963613 + 0.03000350839 3.39448578522 + 0.04000467785 3.37175526472 + 0.05000584732 3.34273970449 + 0.06000701678 3.30759373025 + 0.07000818624 3.26650367375 + 0.08000935571 3.21968602279 + 0.09001052517 3.16738563506 + 0.10001169463 3.10987372773 + 0.11001286410 3.04744566824 + 0.12001403356 2.98041859366 + 0.13001520302 2.90912887312 + 0.14001637249 2.83392945306 + 0.15001754195 2.75518710383 + 0.16001871141 2.67327960040 + 0.17001988088 2.58859286503 + 0.18002105034 2.50151810158 + 0.19002221980 2.41244894507 + 0.20002338927 2.32177866101 + 0.21002455873 2.22989741476 + 0.22002572819 2.13718964339 + 0.23002689766 2.04403154104 + 0.24002806712 1.95078869399 + 0.25002923658 1.85781387306 + 0.26003040605 1.76544500793 + 0.27003157551 1.67400335196 + 0.28003274497 1.58379185420 + 0.29003391444 1.49509374599 + 0.30003508390 1.40817134822 + 0.31003625336 1.32326510296 + 0.32003742283 1.24059283318 + 0.33003859229 1.16034922785 + 0.34003976175 1.08270554232 + 0.35004093122 1.00780952440 + 0.36004210068 0.93578553431 + 0.37004327014 0.86673487246 + 0.38004443961 0.80073628369 + 0.39004560907 0.73784663424 + 0.40004677853 0.67810174496 + 0.41004794800 0.62151736202 + 0.42004911746 0.56809025101 + 0.43005028692 0.51779939499 + 0.44005145639 0.47060727956 + 0.45005262585 0.42646124724 + 0.46005379531 0.38529490187 + 0.47005496478 0.34702954746 + 0.48005613424 0.31157564359 + 0.49005730370 0.27883426098 + 0.50005847317 0.24869852296 + 0.51005964263 0.22105501816 + 0.52006081209 0.19578517140 + 0.53006198155 0.17276656136 + 0.54006315102 0.15187417516 + 0.55006432048 0.13298158988 + 0.56006548994 0.11596207515 + 0.57006665941 0.10068960952 + 0.58006782887 0.08703980709 + 0.59006899833 0.07489075046 + 0.60007016780 0.06412372933 + 0.61007133726 0.05462388331 + 0.62007250672 0.04628075029 + 0.63007367619 0.03898872200 + 0.64007484565 0.03264740975 + 0.65007601511 0.02716192407 + 0.66007718458 0.02244307271 + 0.67007835404 0.01840748226 + 0.68007952350 0.01497764920 + 0.69008069297 0.01208192610 + 0.70008186243 0.00965444991 + 0.71008303189 0.00763501847 + 0.72008420136 0.00596892213 + 0.73008537082 0.00460673697 + 0.74008654028 0.00350408612 + 0.75008770975 0.00262137554 + 0.76008887921 0.00192351015 + 0.77009004867 0.00137959602 + 0.78009121814 0.00096263383 + 0.79009238760 0.00064920858 + 0.80009355706 0.00041917972 + 0.81009472653 0.00025537571 + 0.82009589599 0.00014329646 + 0.83009706545 0.00007082636 + 0.84009823492 0.00002796055 + 0.85009940438 0.00000654618 + 0.86010057384 0.00000004030 + 0.87010174331 0.00000328530 + 0.88010291277 0.00001230276 + 0.89010408223 0.00002410580 + 0.90010525170 0.00003653009 + 0.91010642116 0.00004808314 + 0.92010759062 0.00005781128 + 0.93010876009 0.00006518371 + 0.94010992955 0.00006999255 + 0.95011109901 0.00007226782 + 0.96011226848 0.00007220642 + 0.97011343794 0.00007011356 + 0.98011460740 0.00006635561 + 0.99011577687 0.00006132313 + 1.00011694633 0.00005540261 + 1.01011811579 0.00004895591 + 1.02011928526 0.00004230631 + 1.03012045472 0.00003572977 + 1.04012162418 0.00002945081 + 1.05012279365 0.00002364176 + 1.06012396311 0.00001842478 + 1.07012513257 0.00001387578 + 1.08012630204 0.00001002972 + 1.09012747150 0.00000688673 + 1.10012864096 0.00000441853 + 1.11012981043 0.00000257492 + 1.12013097989 0.00000128992 + 1.13013214935 0.00000048750 + 1.14013331882 0.00000008662 + 1.15013448828 0.00000000552 + 1.16013565774 0.00000016535 + 1.17013682721 0.00000049288 + 1.18013799667 0.00000092258 + 1.19013916613 0.00000139798 + 1.20014033560 0.00000187237 + 1.21014150506 0.00000230896 + 1.22014267452 0.00000268066 + 1.23014384399 0.00000296945 + 1.24014501345 0.00000316543 + 1.25014618291 0.00000326580 + 1.26014735238 0.00000327361 + 1.27014852184 0.00000319656 + 1.28014969130 0.00000304575 + 1.29015086077 0.00000283458 + 1.30015203023 0.00000257761 + 1.31015319969 0.00000228972 + 1.32015436916 0.00000198528 + 1.33015553862 0.00000167754 + 1.34015670808 0.00000137819 + 1.35015787755 0.00000109698 + 1.36015904701 0.00000084161 + 1.37016021647 0.00000061761 + 1.38016138594 0.00000042844 + 1.39016255540 0.00000027562 + 1.40016372486 0.00000015891 + 1.41016489433 0.00000007659 + 1.42016606379 0.00000002576 + 1.43016723325 0.00000000258 + 1.44016840272 0.00000000264 + 1.45016957218 0.00000002117 + 1.46017074164 0.00000005334 + 1.47017191111 0.00000009447 + 1.48017308057 0.00000014021 + 1.49017425003 0.00000018671 + 1.50017541950 0.00000023066 + 1.51017658896 0.00000026943 + 1.52017775842 0.00000030104 + 1.53017892789 0.00000032420 + 1.54018009735 0.00000033823 + 1.55018126681 0.00000034300 + 1.56018243627 0.00000033893 + 1.57018360574 0.00000032680 + 1.58018477520 0.00000030771 + 1.59018594466 0.00000028300 + 1.60018711413 0.00000025413 + 1.61018828359 0.00000022258 + 1.62018945305 0.00000018981 + 1.63019062252 0.00000015718 + 1.64019179198 0.00000012590 + 1.65019296144 0.00000009698 + 1.66019413091 0.00000007122 + 1.67019530037 0.00000004919 + 1.68019646983 0.00000003124 + 1.69019763930 0.00000001747 + 1.70019880876 0.00000000791 + 1.71019997822 0.00000000238 + 1.72020114769 0.00000000000 + +# ATOM AND REFERENCE CONFIGURATION +# atsym z nc nv iexc psfile +O 8.00 1 2 4 upf +# +# n l f energy (Ha) +1 0 2.00 +2 0 2.00 +2 1 4.00 +# +# PSEUDOPOTENTIAL AND OPTIMIZATION +# lmax +2 +# +# l, rc, ep, ncon, nbas, qcut +0 1.35000 -0.88057 4 8 8.40000 +1 1.45000 -0.33187 4 8 9.30000 +2 1.25000 0.10000 4 8 6.00000 +# +# LOCAL POTENTIAL +# lloc, lpopt, rc(5), dvloc0 +4 5 1.20000 0.00000 +# +# VANDERBILT-KLEINMAN-BYLANDER PROJECTORs +# l, nproj, debl +0 2 1.00000 +1 2 1.00000 +2 1 1.00000 +# +# MODEL CORE CHARGE +# icmod, fcfact, rcfact +3 4.00000 1.50000 +# +# LOG DERIVATIVE ANALYSIS +# epsh1, epsh2, depsh +-12.00 12.00 0.02 +# +# OUTPUT GRID +# rlmax, drl +6.00 0.01 + diff --git a/testsuite/test_check_output.py b/testsuite/test_check_output.py index 901aa52f9..7ce939c4a 100644 --- a/testsuite/test_check_output.py +++ b/testsuite/test_check_output.py @@ -130,3 +130,12 @@ def test_007(self, key, testsuite_directory): res = results(path, key) np.testing.assert_allclose(res[0], res[1], rtol = precision(key), verbose = True) + @pytest.mark.parametrize("key", ['Harris-Foulkes energy', + 'Max force', + 'Force residual', + 'Total stress']) + def test_008(self, key, testsuite_directory): + + path = os.path.join(testsuite_directory, "test_008_surface_dipole") + res = results(path, key) + np.testing.assert_allclose(res[0], res[1], rtol = precision(key), verbose = True) From b630f43672f4cfdbd446a17c22e89158654255cd Mon Sep 17 00:00:00 2001 From: David Bowler Date: Thu, 20 Feb 2025 14:22:42 +0000 Subject: [PATCH 28/45] Add Conquest_out.ref for dipole test The .gitignore file directs all Conquest_o* files to be ignored so Conquest_out.ref needs to be added with -f --- .../test_008_surface_dipole/Conquest_out.ref | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 testsuite/test_008_surface_dipole/Conquest_out.ref diff --git a/testsuite/test_008_surface_dipole/Conquest_out.ref b/testsuite/test_008_surface_dipole/Conquest_out.ref new file mode 100644 index 000000000..b44590cd6 --- /dev/null +++ b/testsuite/test_008_surface_dipole/Conquest_out.ref @@ -0,0 +1,94 @@ + ________________________________________________________________________ + + CONQUEST + + Concurrent Order N QUantum Electronic STructure + ________________________________________________________________________ + + Conquest lead developers: + D.R.Bowler (UCL, NIMS), T.Miyazaki (NIMS), A.Nakata (NIMS), + L. Truflandier (U. Bordeaux) + + Developers: + M.Arita (NIMS), J.S.Baker (UCL), V.Brazdova (UCL), R.Choudhury (UCL), + S.Y.Mujahed (UCL), J.T.Poulton (UCL), Z.Raza (NIMS), A.Sena (UCL), + U.Terranova (UCL), L.Tong (UCL), A.Torralba (NIMS) + + Early development: + I.J.Bush (STFC), C.M.Goringe (Keele), E.H.Hernandez (Keele) + + Original inspiration and project oversight: + M.J.Gillan (Keele, UCL) + ________________________________________________________________________ + + Simulation cell dimensions: 5.6692 a0 x 5.6692 a0 x 15.0000 a0 + + Atomic coordinates (a0) + Atom X Y Z Species + 1 1.8308 1.8308 7.5000 1 + 2 0.3822 1.8308 8.6422 2 + 3 3.2795 1.8308 8.6422 2 + + Using a MP mesh for k-points: 1 x 1 x 1 + + This job was run on 2025/02/20 at 13:42 +0000 + Code was compiled on 2025/02/20 at 12:08 +0000 + Version comment: Git Branch: f-dipole-correction; tag, hash: v1.4-25-g3c4d9ed3 + + Job title: Water layer + Job to be run: static calculation + + Ground state search: + Support functions represented with PAO basis + 1:1 PAO to SF mapping + Non-spin-polarised electrons + Solving for the K matrix using diagonalisation + + Integration grid spacing: 0.177 a0 x 0.177 a0 x 0.208 a0 + + Number of species: 2 + -------------------------------------------------------- + | # mass (au) Charge (e) SF Rad (a0) NSF Label | + -------------------------------------------------------- + | 1 15.999 6.000 5.208 13 O | + | 2 1.000 1.000 7.083 5 H | + -------------------------------------------------------- + + Applying surface dipole correction along axis 3 + No location for discontinuity specified! It will be placed at point of lowest density + + The calculation will be performed on 1 process + + The calculation will be performed on 1 thread + + Using the default matrix multiplication kernel + + The functional used will be GGA PBE96 + + PulayMixSC: Reached SCF tolerance of 0.70718E-08 after 38 iterations + | Number of electrons = 8.000023 + |* Harris-Foulkes energy = -17.605528555144605 Ha + + force: Forces on atoms (Ha/a0) + force: Atom X Y Z + force: 1 0.0011188320 0.0027838808 0.0222433569 + force: 2 0.0320789140 -0.0000300833 -0.0110191074 + force: 3 -0.0324725568 -0.0000525327 -0.0110801308 + + force: Maximum force : 0.03247256(Ha/a0) on atom 3 in x direction + force: Force Residual: 0.03072179 Ha/a0 + force: Total stress: -10.90868275 -10.46662884 1.37716200 GPa + + BIBLIOGRAPHY: Please consider citing the following references in the conquest.bib file + + CONQUEST: Bowler2002pt, Miyazaki2004, Nakata2020 + Basis: Bowler2019 + DM: Bowler:2006xr + Pseudopotentials: Hamann2013, Bowler2019 + XC functional: Perdew1996 + + Warnings written to file Conquest_warnings; please check + + Max total mem use is 149.170 MB + + Total run time was: 7.117 seconds From 7caf918131eade2026db1b21fc113907b6268714 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Thu, 20 Mar 2025 16:08:47 +0000 Subject: [PATCH 29/45] Implement correction to S-Pulay force and stress We were missing a contribution to the force and stress that comes from the Lagrange multiplier used to maintain electron number. This has now been implemented. --- src/DMMinModule.f90 | 7 +++++-- src/force_module.f90 | 16 +++++++++++----- src/global_module.f90 | 2 ++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/DMMinModule.f90 b/src/DMMinModule.f90 index ac67afd30..10205443c 100644 --- a/src/DMMinModule.f90 +++ b/src/DMMinModule.f90 @@ -827,7 +827,7 @@ subroutine lateDM(ndone, n_L_iterations, done, deltaE, vary_mu, & flag_mix_L_SC_min, & flag_fix_spin_population, nspin, & spin_factor, flag_dump_L, & - flag_SpinDependentSF, min_layer + flag_SpinDependentSF, min_layer, mu_DMM use timer_module, only: cq_timer,start_timer, & stop_print_timer, WITH_LEVEL use io_module, only: dump_matrix, return_prefix @@ -877,6 +877,7 @@ subroutine lateDM(ndone, n_L_iterations, done, deltaE, vary_mu, & if (ndone > n_L_iterations) & call cq_abort('lateDM: too many L iterations', ndone, n_L_iterations) + mu_DMM = zero do spin = 1, nspin do i = 1, maxpulayDMM mat_Lstore(i,spin) = allocate_temp_matrix(Lrange,0) @@ -888,7 +889,6 @@ subroutine lateDM(ndone, n_L_iterations, done, deltaE, vary_mu, & matSphi(spin) = allocate_temp_matrix(Lrange,0) mat_temp(spin) = allocate_temp_matrix(TLrange,0) end do - ! Update the charge density if flag is set min_layer = min_layer - 1 if (flag_mix_L_SC_min) then @@ -931,6 +931,7 @@ subroutine lateDM(ndone, n_L_iterations, done, deltaE, vary_mu, & call matrix_product(mat_temp(spin), matT(spin_SF), matSphi(spin), mult(TL_T_L)) e_dot_n(spin) = matrix_product_trace(matSM3(spin), matphi(spin)) n_dot_n(spin) = matrix_product_trace(matSphi(spin), matphi(spin)) + mu_DMM(spin) = e_dot_n(spin) / n_dot_n(spin) if (inode == ionode .and. iprint_DM + min_layer >= 3) then write(io_lun, '(4x,a,i1,") ",f16.6)') & trim(prefix)//" e.n (spin=", spin, e_dot_n(spin) @@ -1057,6 +1058,7 @@ subroutine lateDM(ndone, n_L_iterations, done, deltaE, vary_mu, & mult(TL_T_L)) e_dot_n(spin) = matrix_product_trace(matSM3(spin), matphi(spin)) n_dot_n(spin) = matrix_product_trace(matSphi(spin), matphi(spin)) + mu_DMM(spin) = e_dot_n(spin) / n_dot_n(spin) end do if (flag_fix_spin_population) then do spin = 1, nspin @@ -1185,6 +1187,7 @@ subroutine lateDM(ndone, n_L_iterations, done, deltaE, vary_mu, & matSphi(spin), mult(TL_T_L)) e_dot_n(spin) = matrix_product_trace(matSM3(spin), matphi(spin)) n_dot_n(spin) = matrix_product_trace(matSphi(spin), matphi(spin)) + mu_DMM(spin) = e_dot_n(spin) / n_dot_n(spin) end do if (flag_fix_spin_population) then do spin = 1, nspin diff --git a/src/force_module.f90 b/src/force_module.f90 index 6077503fb..6c432db0c 100644 --- a/src/force_module.f90 +++ b/src/force_module.f90 @@ -986,6 +986,8 @@ end subroutine force !! Added calculations for off-diagonal elements of PP_stress and SP_stress !! 2019/05/08 zamaan !! Added atomic stress contributions + !! 2025/03/20 16:07 dave + !! Added electron number gradient contribution to S-Pulay force and stress !! SOURCE !! subroutine pulay_force(p_force, KE_force, fixed_potential, vary_mu, & @@ -999,7 +1001,7 @@ subroutine pulay_force(p_force, KE_force, fixed_potential, vary_mu, & use matrix_module, only: matrix, matrix_halo use matrix_data, only: mat, halo, blip_trans, Srange, aSa_range use mult_module, only: LNV_matrix_multiply, & - matM12, & + matM12, matM4, & allocate_temp_matrix, & free_temp_matrix, & return_matrix_value, & @@ -1007,7 +1009,7 @@ subroutine pulay_force(p_force, KE_force, fixed_potential, vary_mu, & scale_matrix_value, & matKatomf, & return_matrix_block_pos, & - matrix_scale, & + matrix_scale, matrix_sum, & SF_to_AtomF_transform use global_module, only: iprint_MD, WhichPulay, & BothPulay, PhiPulay, & @@ -1019,7 +1021,7 @@ subroutine pulay_force(p_force, KE_force, fixed_potential, vary_mu, & id_glob, species_glob, & flag_diagonalisation, & flag_full_stress, flag_stress, & - flag_atomic_stress, min_layer + flag_atomic_stress, min_layer, mu_DMM use set_bucket_module, only: rem_bucket, atomf_atomf_rem use blip_grid_transform_module, only: blip_to_support_new, & blip_to_grad_new @@ -1162,8 +1164,12 @@ subroutine pulay_force(p_force, KE_force, fixed_potential, vary_mu, & ! If we're diagonalising, we've already build data_M12 if (.not. flag_diagonalisation) then call LNV_matrix_multiply(electrons, energy_tmp, dontK, doM1, & - doM2, dontM3, dontM4, dontphi, dontE, & - mat_M12=matM12) + doM2, dontM3, doM4, dontphi, dontE, & + mat_M12=matM12, mat_M4=matM4) + ! Electron number gradient contribution to S-Pulay force and stress + do spin=1,nspin + call matrix_sum(one,matM12(spin),-half*mu_DMM(spin),matM4(spin)) + end do end if t1 = mtime() t0 = t1 diff --git a/src/global_module.f90 b/src/global_module.f90 index 3b521481e..a4eef0650 100644 --- a/src/global_module.f90 +++ b/src/global_module.f90 @@ -424,5 +424,7 @@ module global_module integer :: i_pol_dir_st, i_pol_dir_end ! Either 1,1 or 1,3 integer, dimension(3) :: i_pol_dir ! Either n,0,0 or 1,2,3 + ! Density matrix Lagrange multiplier for correct electron number (needed for forces and stress) + real(double), dimension(2) :: mu_DMM ! Allow for spin end module global_module !!*** From 7c425ffb3f5a2e6ed756520ccf9ea3ac41df2b14 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Fri, 21 Mar 2025 14:35:27 +0000 Subject: [PATCH 30/45] Update reference output for linear scaling test The bugfix corrects erroneous stress so the reference values need updating --- .../Conquest_out.ref | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/testsuite/test_002_bulk_Si_1proc_OrderN/Conquest_out.ref b/testsuite/test_002_bulk_Si_1proc_OrderN/Conquest_out.ref index d097422a4..db5fb4165 100644 --- a/testsuite/test_002_bulk_Si_1proc_OrderN/Conquest_out.ref +++ b/testsuite/test_002_bulk_Si_1proc_OrderN/Conquest_out.ref @@ -21,7 +21,7 @@ M.J.Gillan (Keele, UCL) ________________________________________________________________________ - Simulation cell dimensions: 10.3600 a0 x 10.3600 a0 x 10.3600 a0 + Simulation cell dimensions: 10.3600 a0 x 10.3600 a0 x 10.3600 a0 Atomic coordinates (a0) Atom X Y Z Species @@ -34,9 +34,9 @@ 7 2.5900 7.7700 7.7700 1 8 7.7700 2.5900 7.7700 1 - This job was run on 2023/05/23 at 15:11 +0100 - Code was compiled on 2023/05/23 at 14:56 +0100 - Version comment: Git Branch: master; tag, hash: v1.1 + This job was run on 2025/03/21 at 14:30 +0000 + Code was compiled on 2025/03/20 at 16:02 +0000 + Version comment: Git Branch: bugfix-correct-force-stress; tag, hash: v1.4-39-g049ac20c Job title: Job to be run: static calculation @@ -57,30 +57,34 @@ -------------------------------------------------------- The calculation will be performed on 1 process + + The calculation will be performed on 1 thread + + Using the default matrix multiplication kernel Density Matrix range = 16.0000 a0 The functional used will be GGA PBE96 - lateDM: reached residual of 0.687257E-07 after 29 iterations + lateDM: reached residual of 0.693388E-07 after 29 iterations | Number of electrons = 32.000031 - |* Harris-Foulkes energy = -33.569389509372144 Ha + |* Harris-Foulkes energy = -33.569389505626887 Ha force: Forces on atoms (Ha/a0) force: Atom X Y Z - force: 1 -0.0021719988 -0.0040582799 -0.0060871907 - force: 2 0.0000826094 0.0001737196 -0.0005472291 - force: 3 0.0000821377 -0.0003627707 0.0002616019 - force: 4 -0.0001763387 0.0001709996 0.0002604078 - force: 5 0.0026208445 0.0027153199 0.0028116541 - force: 6 0.0001194484 0.0002209308 0.0003000775 - force: 7 -0.0014819902 0.0018086628 0.0019152353 - force: 8 0.0009217186 -0.0005998024 0.0011300341 - - force: Maximum force : 0.00608719(Ha/a0) on atom 1 in z direction - force: Force Residual: 0.00340652 Ha/a0 - force: Total stress: -9.65909297 -9.66104273 -9.66437275 GPa + force: 1 -0.0021132141 -0.0039395925 -0.0059091849 + force: 2 0.0000893280 0.0001876750 -0.0004909937 + force: 3 0.0000887525 -0.0003253930 0.0002828883 + force: 4 -0.0001578731 0.0001849757 0.0002817526 + force: 5 0.0025536669 0.0026340003 0.0027161702 + force: 6 0.0001055402 0.0001928153 0.0002577064 + force: 7 -0.0014596011 0.0017440213 0.0018365365 + force: 8 0.0008896896 -0.0006100493 0.0010697559 + + force: Maximum force : 0.00590918(Ha/a0) on atom 1 in z direction + force: Force Residual: 0.00330389 Ha/a0 + force: Total stress: -6.71161888 -6.71375049 -6.71725660 GPa BIBLIOGRAPHY: Please consider citing the following references in the conquest.bib file @@ -90,6 +94,6 @@ Pseudopotentials: Hamann2013, Bowler2019 XC functional: Perdew1996 - Max total mem use is 105.637 MB + Max total mem use is 105.403 MB - Total run time was: 26.736 seconds + Total run time was: 51.565 seconds From ddcea1a28edbef1184bcc524a99e77241418de70 Mon Sep 17 00:00:00 2001 From: ayakon Date: Thu, 3 Jul 2025 17:14:25 +0900 Subject: [PATCH 31/45] fixed a bug in reading .ion files with PostProcessCQ. Subroutine "read_header_tmp" in pseudo_tm_info.f90 was updated as that in src. --- tools/PostProcessing/pseudo_tm_info.f90 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/PostProcessing/pseudo_tm_info.f90 b/tools/PostProcessing/pseudo_tm_info.f90 index a16988f70..89dbbe445 100644 --- a/tools/PostProcessing/pseudo_tm_info.f90 +++ b/tools/PostProcessing/pseudo_tm_info.f90 @@ -631,6 +631,8 @@ end subroutine radial_read_ascii !! Bug fix: set semicore when numprocs>1 !! 2020/01/22 16:59 dave !! Bug fix: change header to read Hamann code version line if present + !! 2025/07/03 17:00 nakata + !! Bug fix: change header to read Pseudopotential type line if present !! SOURCE !! subroutine read_ion_ascii_tmp(ps_info,pao_info) @@ -1027,8 +1029,19 @@ subroutine read_header_tmp(n_orbnl, lmax_basis, n_pjnl, zval, z, unit, xc_func, end if else if (leqi(trim_line(1:14),' Date: Mon, 8 Dec 2025 09:46:34 +0000 Subject: [PATCH 32/45] Update installing.rst Changed link for Conquest space package --- docs/installing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installing.rst b/docs/installing.rst index 20e43d5a9..e50dc5c09 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -112,7 +112,7 @@ and load the ``Conquest`` executable to ``PATH`` with The build can be customized by adding options to the `Spack spec `_ ``conquest``. -The CONQUEST package includes variants for OpenMP support and different matrix multiplication kernels; more details can be found in the `Spack CONQUEST package `_. +The CONQUEST package includes variants for OpenMP support and different matrix multiplication kernels; more details can be found in the `Spack CONQUEST package `_. Installing on Ubuntu ----------- From 4092524a7b3475cf50f0ebeff17fd1d66e258b26 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Miyazaki Date: Wed, 4 Feb 2026 17:05:45 +0900 Subject: [PATCH 33/45] a bug in BasisGeneration/schro_module.f90 for f-electrons is removed. a bug in BasisGeneration/schro_module.f90 for f-electrons is removed. --- tools/BasisGeneration/schro_module.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/BasisGeneration/schro_module.f90 b/tools/BasisGeneration/schro_module.f90 index 0efe1d837..151a41f1a 100644 --- a/tools/BasisGeneration/schro_module.f90 +++ b/tools/BasisGeneration/schro_module.f90 @@ -146,6 +146,8 @@ subroutine find_unconfined_valence_states(i_species,vha,vxc) newcharge = newcharge + val%occ(i_shell)*psi*psi*rr*rr else if(ell==2) then newcharge = newcharge + val%occ(i_shell)*psi*psi*rr*rr*rr*rr + else + newcharge = newcharge + val%occ(i_shell)*psi*psi*rr**(2*ell) end if end do ! Find residual From 0814a9c6ad3e7a75bede2d0177b5cd9d773ddaff Mon Sep 17 00:00:00 2001 From: David Bowler Date: Wed, 4 Feb 2026 12:11:45 +0000 Subject: [PATCH 34/45] Add cell volume output Also tweaked the iprint level at which all k-points are printed --- src/initial_read_module.f90 | 8 ++++++-- src/io_module.f90 | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index 40acbd537..da38ae72f 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -3078,6 +3078,8 @@ end subroutine write_info !! Moved printing to capture default gamma point behaviour !! 2023/07/20 12:00 tsuyoshi !! Implementing 1st version of Padding H and S matrices + !! 2026/02/04 12:10 dave + !! Tweak k-point output !! SOURCE !! subroutine readDiagInfo @@ -3504,7 +3506,7 @@ subroutine readDiagInfo end do end do ! Write out fractional k-points - if(iprint_init>1.AND.inode==ionode) then + if((iprint_init>2.or.(iprint_init>1.AND.nkp_tmp<20)).AND.inode==ionode) then write(io_lun,7) nkp_tmp do i=1,nkp_tmp write(io_lun,fmt='(8x,i5,3f15.6,f12.3)')& @@ -3560,7 +3562,7 @@ subroutine readDiagInfo deallocate(kk_tmp,wtk_tmp,STAT=stat) if(stat/=0) & call cq_abort('FindEvals: couldnt deallocate kpoints', nkp_tmp) - if(iprint_init>1.AND.inode==ionode) then + if((iprint_init>2.or.(iprint_init>1.AND.nkp_tmp<20)).AND.inode==ionode) then ! write(io_lun,*) write(io_lun,10) nkp @@ -3568,6 +3570,8 @@ subroutine readDiagInfo write (io_lun,fmt='(8x,i5,3f15.6,f12.3)') & i,kk(1,i),kk(2,i),kk(3,i),wtk(i) end do + else if(iprint_init>1.AND.inode==ionode) then + write(io_lun,fmt='(8x,i4,a)') nkp, ' symmetry inequivalent Kpoints' end if do i = 1, nkp diff --git a/src/io_module.f90 b/src/io_module.f90 index 83008c3eb..003f83ffd 100644 --- a/src/io_module.f90 +++ b/src/io_module.f90 @@ -180,7 +180,7 @@ module io_module subroutine read_atomic_positions(filename) use datatypes - use dimens, only: r_super_x, r_super_y, r_super_z + use dimens, only: r_super_x, r_super_y, r_super_z, volume use global_module, only: x_atom_cell, y_atom_cell, z_atom_cell, & ni_in_cell, numprocs, & flag_fractional_atomic_coords, rcellx, & @@ -516,6 +516,7 @@ subroutine read_atomic_positions(filename) ! Check for sensible number of processes if(ni_in_cell0) .or. (iprint_init==0.AND.ni_in_cell Date: Thu, 5 Feb 2026 16:22:57 +0900 Subject: [PATCH 35/45] Boundary in the DOS calculations has been changed (PostProcess). Boundary in the DOS calculations has been changed (PostProcess). Now, the range of calculated DOS is reduced to have the correct DOS values in this range. --- tools/PostProcessing/process_module.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/PostProcessing/process_module.f90 b/tools/PostProcessing/process_module.f90 index 17fdb09e6..80b413b3c 100644 --- a/tools/PostProcessing/process_module.f90 +++ b/tools/PostProcessing/process_module.f90 @@ -339,8 +339,8 @@ subroutine process_dos if(six*sigma_DOS < dE_DOS) write(*,fmt='(4x,"Sigma is much less than bin size: this may cause errors")') end if ! Adjust limits to allow full peak to be seen - E_DOS_min = E_DOS_min - four*sigma_DOS - E_DOS_max = E_DOS_max + four*sigma_DOS + E_DOS_min = E_DOS_min + four*sigma_DOS + E_DOS_max = E_DOS_max - four*sigma_DOS ! Recalculate dE_DOS now that we've broadened it dE_DOS = (E_DOS_max - E_DOS_min)/real(n_DOS-1,double) write(*,fmt='(2x,"Dividing DOS into ",i5," bins of width ",f12.6," Ha")') n_DOS, dE_DOS From d7637a07ee1d475166cffde03ad49c28f4448414 Mon Sep 17 00:00:00 2001 From: ayakon Date: Fri, 6 Feb 2026 19:22:43 +0900 Subject: [PATCH 36/45] Changed the maximum line length to be read from Conquest_input from 132 to 256 in input_module.f90. --- src/input_module.f90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/input_module.f90 b/src/input_module.f90 index 200cf7a09..96bf9d0d1 100644 --- a/src/input_module.f90 +++ b/src/input_module.f90 @@ -19,6 +19,8 @@ !! MODIFICATION HISTORY !! 2008/09/03 10:43 dave !! Possible bug fix: add datatypes as module wide for typing of fdf_double +!! 2026/02/06 19:30 nakata +!! Changed the maximum length of a line to be read from Conquest_input from 132 to 256 !! SOURCE !! module input_module @@ -33,11 +35,11 @@ module input_module save ! Input array integer :: input_lines - character(len=132), dimension(:), allocatable :: input_array + character(len=256), dimension(:), allocatable :: input_array ! Parsing integer :: current_line, ntokens - character(len=132) :: line + character(len=256) :: line integer, dimension(100) :: first, last ! Control @@ -83,6 +85,8 @@ module input_module !! - Bug fix in closing a file !! 2015/06/08 lat !! - Added experimental backtrace +!! 2026/02/06 19:30 nakata +!! - Changed the maximum length of a line to be read from Conquest_input from 132 to 256 !! SOURCE !! subroutine load_input @@ -92,7 +96,7 @@ subroutine load_input implicit none type(cq_timer) :: backtrace_timer - character(len=132) :: line + character(len=256) :: line character(len=10) :: slabel real(double) :: r logical :: good_line, done @@ -164,7 +168,7 @@ subroutine load_input call io_close(lun) end if do i=1,input_lines - call gcopy(input_array(i),132) + call gcopy(input_array(i),256) end do current_line = 0 if(inode==ionode) then From edbe8c3f985ceeb4f662aae6ebfca3c5a84cfd80 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Fri, 6 Feb 2026 10:50:29 +0000 Subject: [PATCH 37/45] Adjust default sigma for DOS --- tools/PostProcessing/read_module.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/PostProcessing/read_module.f90 b/tools/PostProcessing/read_module.f90 index 6f82c58de..1f419359e 100644 --- a/tools/PostProcessing/read_module.f90 +++ b/tools/PostProcessing/read_module.f90 @@ -272,7 +272,7 @@ subroutine read_input ! Add flag for window relative to Fermi level E_DOS_min = fdf_double('Process.min_DOS_E',E_wf_min) E_DOS_max = fdf_double('Process.max_DOS_E',E_wf_max) - sigma_DOS = fdf_double('Process.sigma_DOS',zero) ! Adjust to minimum of 4*energy spacing + sigma_DOS = fdf_double('Process.sigma_DOS',0.001_double) ! Better than adaptive n_DOS = fdf_integer('Process.n_DOS',1001) flag_total_iDOS = fdf_boolean('Process.TotalIntegratedDOS',.false.) if(i_job==7) then @@ -478,7 +478,7 @@ subroutine read_eigenvalues write(*,fmt='(4x,"Fermi level: ",f12.5," Ha (=",f10.3," eV)")') efermi(1), efermi(1)*HaToeV else read(17,fmt='(a6,2f18.10)') str,efermi(1), efermi(2) - write(*,fmt='(4x,"Fermi levels: ",2f12.5," Ha (=",2f10.3" eV)")') efermi, efermi*HaToeV + write(*,fmt='(4x,"Fermi levels: ",2f12.5," Ha (=",2f10.3," eV)")') efermi, efermi*HaToeV end if read(17,*) str ! Allocate memory From 0204c75a82af1eb3f4fa5c850d9f41d8f0997ffa Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 9 Feb 2026 11:48:46 +0000 Subject: [PATCH 38/45] Change version number and date --- README.md | 2 +- docs/conf.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a0e032853..05ba3c9ec 100644 --- a/README.md +++ b/README.md @@ -50,4 +50,4 @@ DOI for the specific version you have used in any given study. ## Version number -CONQUEST is now at version 1.4 (tag:v1.4) +CONQUEST is now at version 1.5 (tag:v1.5) diff --git a/docs/conf.py b/docs/conf.py index e139dcfd4..55aaf60f9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,7 +55,7 @@ # General information about the project. project = u'CONQUEST' -copyright = u'2018-2024, CONQUEST Developers' +copyright = u'2018-2026, CONQUEST Developers' author = u'CONQUEST Developers' # The version info for the project you're documenting, acts as replacement for @@ -63,9 +63,9 @@ # built documents. # # The short X.Y version. -version = u'1.4' +version = u'1.5' # The full version, including alpha/beta/rc tags. -release = u'1.4' +release = u'1.5' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From f566eb7669c1bf06ccbf68ef41a7d7f37d427e81 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 9 Feb 2026 12:01:46 +0000 Subject: [PATCH 39/45] Add options to allow ELPA to use GPUs At present only NVIDIA supported --- src/ELPAModule.f90 | 9 ++++++++- src/ELPAModuleDUMMY.f90 | 1 + src/initial_read_module.f90 | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ELPAModule.f90 b/src/ELPAModule.f90 index f500eda1a..1f7c03329 100644 --- a/src/ELPAModule.f90 +++ b/src/ELPAModule.f90 @@ -10,6 +10,7 @@ module ELPA_module logical :: flag_elpa_dummy = .false. ! A marker to show ELPA in compilation logical :: flag_use_elpa = .false. ! whether we use ELPA or not + logical :: flag_elpa_GPU = .false. ! Should ELPA use GPUs? character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 character(len=16) :: elpa_kernel = "GENERIC" integer :: elpa_API = 20241105 @@ -82,6 +83,7 @@ subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) call elp%set( "blacs_context", context, info ) if( info /= ELPA_OK ) call cq_abort("ELPA_Init: Could not set parameter blacs_cotext") + if(flag_elpa_GPU) info = elp%setup() select case( elpa_solver ) case("ELPA1") call elp%set( "solver", ELPA_SOLVER_1STAGE, info ) ! ELPA1 @@ -116,7 +118,12 @@ subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) !!$ call elp%set( "omp_threads", omp_get_max_threads(), info ) - info = elp%setup() + if(flag_elpa_GPU) then + call elp%set("nvidia-gpu",1,info) + call elp%set("solver",ELPA_SOLVER_1STAGE,info) + else + info = elp%setup() + end if if( info /= ELPA_OK ) call cq_abort("something wrong in ELPA !") end subroutine init_ELPA diff --git a/src/ELPAModuleDUMMY.f90 b/src/ELPAModuleDUMMY.f90 index ec78acfc6..38474ec61 100644 --- a/src/ELPAModuleDUMMY.f90 +++ b/src/ELPAModuleDUMMY.f90 @@ -7,6 +7,7 @@ module ELPA_module logical :: flag_elpa_dummy = .true. ! A marker to show no ELPA in compilation logical :: flag_use_elpa = .false. ! This should be false for ELPAModuleDummy + logical :: flag_elpa_GPU = .false. ! Should ELPA use GPUs? character(len=16) :: elpa_solver = "ELPA1" ! ELPA1 or ELPA2 character(len=16) :: elpa_kernel = "GENERIC" integer :: elpa_API = 20241105 diff --git a/src/initial_read_module.f90 b/src/initial_read_module.f90 index da38ae72f..70c67fe20 100644 --- a/src/initial_read_module.f90 +++ b/src/initial_read_module.f90 @@ -3103,7 +3103,8 @@ subroutine readDiagInfo type_dbl use species_module, only: nsf_species use units, only: en_conv, en_units, energy_units - use ELPA_module, only: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy + use ELPA_module, only: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy, & + flag_elpa_GPU implicit none @@ -3275,6 +3276,7 @@ subroutine readDiagInfo else call cq_abort("Invalid Diag.ELPASolver " // elpa_solver ) endif + flag_elpa_GPU = fdf_boolean('Diag.ELPA_GPU',.false.) else elpa_solver = "NONE" elpa_kernel = "NONE" From 2f383712ad6b08bccc3ebe32c8310a188f368763 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 9 Feb 2026 14:16:14 +0000 Subject: [PATCH 40/45] Update public status of new ELPA GPU flag --- src/ELPAModule.f90 | 2 +- src/ELPAModuleDUMMY.f90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ELPAModule.f90 b/src/ELPAModule.f90 index 1f7c03329..86a26bab1 100644 --- a/src/ELPAModule.f90 +++ b/src/ELPAModule.f90 @@ -19,7 +19,7 @@ module ELPA_module class(elpa_t), pointer :: elp private - public :: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy + public :: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy, flag_elpa_GPU public :: init_ELPA, end_ELPA, ELPA_zhegv contains diff --git a/src/ELPAModuleDUMMY.f90 b/src/ELPAModuleDUMMY.f90 index 38474ec61..73636f1a2 100644 --- a/src/ELPAModuleDUMMY.f90 +++ b/src/ELPAModuleDUMMY.f90 @@ -14,7 +14,7 @@ module ELPA_module integer :: merow, mecol private - public :: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy + public :: flag_use_elpa, elpa_solver, elpa_kernel, elpa_API, flag_elpa_dummy, flag_elpa_GPU public :: init_ELPA, end_ELPA, ELPA_zhegv contains From 393306765f90ad5b6379dac56f5eb0a3c4793d6a Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 9 Feb 2026 15:45:25 +0000 Subject: [PATCH 41/45] Added missing elpa setup_gpu call --- src/ELPAModule.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ELPAModule.f90 b/src/ELPAModule.f90 index 86a26bab1..e36b28c94 100644 --- a/src/ELPAModule.f90 +++ b/src/ELPAModule.f90 @@ -121,6 +121,7 @@ subroutine init_ELPA (matrix_size, row_size, col_size, desc, info) if(flag_elpa_GPU) then call elp%set("nvidia-gpu",1,info) call elp%set("solver",ELPA_SOLVER_1STAGE,info) + info = elp%setup_gpu() else info = elp%setup() end if From 5859449fc843d89f8fd1b19c0e6eb23820d8f97e Mon Sep 17 00:00:00 2001 From: David Bowler Date: Mon, 9 Feb 2026 15:52:53 +0000 Subject: [PATCH 42/45] Added very brief instructions for ELPA and GPUs --- docs/groundstate.rst | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/groundstate.rst b/docs/groundstate.rst index a4f0b0c6c..3a09a85ef 100644 --- a/docs/groundstate.rst +++ b/docs/groundstate.rst @@ -185,7 +185,7 @@ for the block size of the matrix, specify the following two variables. Diag.BlockSizeC 20 Note that these two numbers should be the same when padding -(and when using ELPA which will be introduced to CONQUEST soon). +(and when using ELPA as described below). We suggest that an appropriate value is between 20 and 200, but this should be tested. @@ -197,6 +197,26 @@ like to remove it, set the following variable. Diag.PaddingHmatrix F +Go to :ref:`top ` + +.. _gs_diag_elpa: + +Using ELPA +~~~~~~~~~~ + +`ELPA `_ is an alternative to ScaLAPACK for +diagonalisation which can show better parallelisation, and allows use of +GPU cards for acceleration (though the GPU implementation in CONQUEST is +at a very early stage). To enable ELPA and GPUs, set the following tags: + + :: + + Diag.UseELPA T + Diag.ELPA_GPU T + +Some care is needed in the balance between MPI processes and number of GPUs +on the compute nodes: careful testing is important. + Go to :ref:`top `. .. _gs_on: From 61cd402d5155490228d7e1ab84c430c33b50f773 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Tue, 10 Feb 2026 10:46:45 +0000 Subject: [PATCH 43/45] Fixed potential array overflow in alloc_recv_array The variable nreq passed to MPI_Recv was allocated as an array with the wrong size, but can be simple integer as it is passed to a blocking receive. --- src/UpdateInfo_module.f90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/UpdateInfo_module.f90 b/src/UpdateInfo_module.f90 index a01788096..f835b50c2 100644 --- a/src/UpdateInfo_module.f90 +++ b/src/UpdateInfo_module.f90 @@ -1300,6 +1300,8 @@ end subroutine CommMat_send_data !! Changing MPI tag to conform to standard !! 2019/11/14 tsuyoshi !! Added InfoGlob in dummy arguments, and removed glob2node_old + !! 2026/02/10 10:45 dave + !! Bug fix: changed nreq to single integer (used in block receive) !! SOURCE !! subroutine alloc_recv_array(InfoGlob,irecv_array,irecv2_array,recv_array, & @@ -1334,7 +1336,7 @@ subroutine alloc_recv_array(InfoGlob,irecv_array,irecv2_array,recv_array, & logical :: flag_find_old ! -- process 2. -- ! integer :: ind_nnd,ibeg,isize,inode_send - integer :: tag,ierr,nreq(MPI_STATUS_SIZE) + integer :: tag,ierr,nreq integer, allocatable :: isort_node(:),irecv_array(:) ! -- process 3. -- ! integer :: iprim_remote,isize1,isize2,ia,nalpha,nj,njbeta,iglob_local @@ -1477,7 +1479,7 @@ subroutine alloc_recv_array(InfoGlob,irecv_array,irecv2_array,recv_array, & !! /----- DEBUG ------ !! call MPI_recv(irecv_array(ibeg),isize,MPI_INTEGER,inode_send-1,tag, & - MPI_COMM_WORLD,nreq(nnd),ierr) + MPI_COMM_WORLD,nreq,ierr) if (ierr.NE.MPI_SUCCESS) call cq_abort('Error receiving irecv_array: ', nnd, ierr) enddo endif From 5f1d7eea9b1f0b014273ca69ebafa8d10cdc2ddb Mon Sep 17 00:00:00 2001 From: David Bowler Date: Wed, 11 Feb 2026 11:37:38 +0000 Subject: [PATCH 44/45] Add citations for LibXC Citation for LibXC added to output file, and URL and citation added to manual (under Installation). Added URL for ELPA at the same time. --- docs/installing.rst | 14 ++++++++++++-- docs/references.bib | 16 +++++++++++++--- src/XC_LibXC_v5_module.f90 | 11 +++++++---- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/installing.rst b/docs/installing.rst index e50dc5c09..621f148c2 100644 --- a/docs/installing.rst +++ b/docs/installing.rst @@ -43,8 +43,10 @@ a working MPI installation including a Fortran90 compiler (often can be obtained from `the netlib repository `_ if you need to compile it) -Additionally, Conquest can use LibXC if it is available (v4.x or -later). +Additionally, Conquest can use `ELPA `_ as an +alternative to ScaLAPACK (with GPU implementations also available). +It will also use `LibXC `_ if it is +available (v4.x or later) :cite:`i-Lehtola:2018le`. The library locations are set in the ``system.make`` file in the ``src/system`` directory, along with other parameters needed for compilation. The default file @@ -223,5 +225,13 @@ Compile CONQUEST dos2unix ./makedeps # For Windows Subsystem for Linux (WSL), there may be some incompatibilities thus file conversion is recommended. make # Or make -j`nproc` for parallel compilation using all available cores + Go to :ref:`top ` +.. bibliography:: references.bib + :cited: + :labelprefix: I + :keyprefix: i- + :style: unsrt + +Go to :ref:`top ` diff --git a/docs/references.bib b/docs/references.bib index 8144fe1c8..606a2df95 100644 --- a/docs/references.bib +++ b/docs/references.bib @@ -1,12 +1,22 @@ %% This BibTeX bibliography file was created using BibDesk. -%% http://bibdesk.sourceforge.net/ +%% https://bibdesk.sourceforge.io/ - -%% Created for David Bowler at 2019-12-20 09:46:12 +0000 +%% Created for David Bowler at 2026-02-11 11:22:57 +0000 %% Saved with string encoding Unicode (UTF-8) + + +@article{Lehtola:2018le, + author = {Lehtola, Susi and Steigemann, Conrad and Oliveira, Micael J. T. and Marques, Miguel A. L.}, + doi = {10.1016/j.softx.2017.11.002}, + journal = {SoftwareX}, + pages = {1--5}, + title = {Recent developments in libxc —A comprehensive library of functionals for density functional theory}, + volume = {7}, + year = {2018}} + @article{Torralba:2009nr, author = {Torralba, Antonio S and Bowler, David R and Miyazaki, Tsuyoshi and Gillan, Michael J}, doi = {10.1021/ct8005425}, diff --git a/src/XC_LibXC_v5_module.f90 b/src/XC_LibXC_v5_module.f90 index 857c6ea3d..4a1ff5311 100644 --- a/src/XC_LibXC_v5_module.f90 +++ b/src/XC_LibXC_v5_module.f90 @@ -126,9 +126,9 @@ subroutine init_xc call xc_f03_version(vmajor, vminor, vmicro) if(inode==ionode.AND.iprint_ops>0) then if(vmajor>2) then - write(io_lun,'(4x,"LibXC version: ",I2,".",I2,".",I2)') vmajor, vminor, vmicro + write(io_lun,'(4x,"Using LibXC version: ",I2,".",I2,".",I2)') vmajor, vminor, vmicro else - write(io_lun,'(4x,"LibXC version: ",I2,".",I2)') vmajor, vminor + write(io_lun,'(4x,"Using LibXC version: ",I2,".",I2)') vmajor, vminor end if end if ! Identify the functional @@ -313,15 +313,18 @@ subroutine write_xc_refs implicit none integer :: i, j - character(len=120) :: ref + character(len=200) :: ref + call xc_f03_reference(ref) + write(io_lun,fmt='(/4x,"LibXC reference: ",a)') ref write(io_lun,fmt='(4x,"XC references from LibXC:")') do j=1,n_xc_terms i = 0 ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) + write(io_lun,fmt='(6x,a)') trim(ref) do while(i >= 0) - write(io_lun, '(6x,a)') trim(ref) ref = xc_f03_func_reference_get_ref(xc_f03_func_info_get_references(xc_info(j),i)) + write(io_lun, '(6x,a)') trim(ref) end do end do return From fbf301f99eec036d989a91aa8df642a61e28c924 Mon Sep 17 00:00:00 2001 From: David Bowler Date: Wed, 25 Feb 2026 10:08:06 +0000 Subject: [PATCH 45/45] Update LibXC instructions and linking Make it clear that the options are v4 or v5 (which covers v5, v6 and v7) and update linking lines to use xcf03 for v5, v6 and v7. --- src/system/system.example.make | 4 ++-- src/system/system.gha.make | 3 ++- src/system/system.kathleen.make | 5 +++-- src/system/system.mac.make | 5 +++-- src/system/system.myriad.make | 6 ++++-- src/system/system.ubuntu.make | 3 ++- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/system/system.example.make b/src/system/system.example.make index 5dc76b5dc..93a747020 100644 --- a/src/system/system.example.make +++ b/src/system/system.example.make @@ -31,10 +31,10 @@ SCALAPACK = -lscalapack #XC_COMPFLAGS = # LibXC compatibility -# Choose LibXC version: v4 (deprecated) or v5/6/7 (v5, v6 and v7 have the same interface) +# Choose LibXC version: v4 (deprecated) or v5 (v5, v6 and v7 have the same interface) #XC_LIBRARY = LibXC_v4 -XC_LIBRARY = LibXC_v5 #XC_LIB = -lxcf90 -lxc +XC_LIBRARY = LibXC_v5 XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/usr/local/include diff --git a/src/system/system.gha.make b/src/system/system.gha.make index 523187d7e..80ff96a51 100644 --- a/src/system/system.gha.make +++ b/src/system/system.gha.make @@ -5,8 +5,9 @@ LINKFLAGS=-fopenmp -L/usr/lib -L/usr/lib/x86_64-linux-gnu # Set BLAS and LAPACK libraries BLAS= -llapack -lblas # LibXC compatibility (LibXC below) or Conquest XC library -XC_LIBRARY = LibXC_v5 +#XC_LIBRARY = LibXC_v4 #XC_LIB = -lxcf90 -lxc +XC_LIBRARY = LibXC_v5 XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/usr/include # Set FFT library diff --git a/src/system/system.kathleen.make b/src/system/system.kathleen.make index c863740b2..3750bf98c 100644 --- a/src/system/system.kathleen.make +++ b/src/system/system.kathleen.make @@ -28,10 +28,11 @@ OMP_DUMMY = #XC_COMPFLAGS = # LibXC compatibility -# Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) +# Choose LibXC version: v4 (deprecated) or v5 (v5, v6 and v7 have the same interface) # XC_LIBRARY = LibXC_v4 +#XC_LIB = -lxcf90 -lxc XC_LIBRARY = LibXC_v5 -XC_LIB = -lxcf90 -lxc +XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/usr/local/include # Set FFT library diff --git a/src/system/system.mac.make b/src/system/system.mac.make index 915e72c35..b216b39cd 100644 --- a/src/system/system.mac.make +++ b/src/system/system.mac.make @@ -31,10 +31,11 @@ SCALAPACK = -lscalapack #XC_COMPFLAGS = # LibXC compatibility -# Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) +# Choose LibXC version: v4 (deprecated) or v5 (v5, v6 and v7 have the same interface) #XC_LIBRARY = LibXC_v4 +#XC_LIB = -lxcf90 -lxc XC_LIBRARY = LibXC_v5 -XC_LIB = -lxcf90 -lxc +XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/opt/homebrew/Cellar/libxc/6.2.2/include # Set FFT library diff --git a/src/system/system.myriad.make b/src/system/system.myriad.make index 73441f34e..0bf80088b 100644 --- a/src/system/system.myriad.make +++ b/src/system/system.myriad.make @@ -29,9 +29,11 @@ OMPFLAGS= -fopenmp #XC_COMPFLAGS = # LibXC compatibility -# Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) +# Choose LibXC version: v4 (deprecated) or v5 (v5, v6 and v7 have the same interface) +#XC_LIBRARY = LibXC_v4 +#XC_LIB = -lxcf90 -lxc XC_LIBRARY = LibXC_v5 -XC_LIB = -lxcf90 -lxc +XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I/usr/local/include # Compilation flags diff --git a/src/system/system.ubuntu.make b/src/system/system.ubuntu.make index ca71a5e86..df55cae19 100644 --- a/src/system/system.ubuntu.make +++ b/src/system/system.ubuntu.make @@ -22,8 +22,9 @@ BLAS= -llapack -lblas SCALAPACK = -lscalapack-openmpi # LibXC compatibility -# Choose LibXC version: v4 (deprecated) or v5/6 (v5 and v6 have the same interface) +# Choose LibXC version: v4 (deprecated) or v5 (v5, v6 and v7 have the same interface) # XC_LIBRARY = LibXC_v4 +#XC_LIB = -lxcf90 -lxc XC_LIBRARY = LibXC_v5 XC_LIB = -lxcf03 -lxc XC_COMPFLAGS = -I${HOME}/local/include -I/usr/local/include