The Elk Code
 
Loading...
Searching...
No Matches
genidxelo.f90
Go to the documentation of this file.
1
2! Copyright (C) 2025 J. K. Dewhurst and S. Sharma.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6subroutine genidxelo
7use modmain
8implicit none
9! local variables
10integer is,n,i,j,k,l
11! automatic arrays
12integer idx(nlomax)
13real(8) e0(nlomax)
14! generate the index which arranges the local-orbitals in ascending energy
15do is=1,nspecies
16 n=nlorb(is)
17 do i=1,n
18 e0(i)=minval(lorbe0(1:lorbord(i,is),i,is))
19 idx(i)=i
20 end do
21 do i=1,n
22 k=i
23 do j=i+1,n
24 if (e0(idx(j)) < e0(idx(k))) k=j
25 end do
26 if (k /= i) then
27 l=idx(i)
28 idx(i)=idx(k)
29 idx(k)=l
30 end if
31 end do
32 idxelo(1:n,is)=idx(1:n)
33end do
34end subroutine
35
subroutine genidxelo
Definition genidxelo.f90:7
real(8), dimension(maxlorbord, maxlorb, maxspecies) lorbe0
Definition modmain.f90:804
integer, dimension(maxlorb, maxspecies) lorbord
Definition modmain.f90:792
integer, dimension(maxlorb, maxspecies) idxelo
Definition modmain.f90:806
integer, dimension(maxspecies) nlorb
Definition modmain.f90:786
integer nspecies
Definition modmain.f90:34