Commit ebed47a4 authored by Daniel Wortmann's avatar Daniel Wortmann

Bugfixes

parent 58b69859
......@@ -45,32 +45,11 @@ include(kpoints/CMakeLists.txt)
include(tests/tests_old.cmake)
#include(tests/tests_new.cmake)
set(inpgen_F77 ${inpgen_F77}
inpgen/element.f inpgen/atom_input.f inpgen/crystal.f inpgen/lattice2.f inpgen/setab.f inpgen/super_check.f
inpgen/atom_sym.f inpgen/generator.f inpgen/read_record.f inpgen/soc_or_ssdw.f inpgen/symproperties.f
inpgen/bravais_symm.f inpgen/set_atom_core.f inpgen/spg_gen.f global/triang.f
inpgen/lapw_input.f inpgen/struct_input.f inpgen/write_struct.f
io/calculator.f global/ss_sym.f global/soc_sym.f io/rw_symfile.f
kpoints/kptgen_hybrid.f kpoints/od_kptsgen.f kpoints/bravais.f kpoints/divi.f kpoints/brzone.f
kpoints/kptmop.f kpoints/kpttet.f init/bandstr1.F kpoints/ordstar.f kpoints/fulstar.f kpoints/kprep.f
kpoints/tetcon.f kpoints/kvecon.f init/boxdim.f global/radsra.f global/differ.f math/inwint.f
math/outint.f math/grule.f )
set(inpgen_F90 ${inpgen_F90} global/constants.f90 io/xsf_io.f90
eigen/orthoglo.F90 math/ylm4.F90 mpi/mpi_bc_tool.F90 math/inv3.f90
global/sort.f90 global/chkmt.f90 inpgen/inpgen.f90 inpgen/set_inp.f90 inpgen/inpgen_help.f90 io/rw_inp.f90 global/find_enpara.f90
inpgen/closure.f90 math/intgr.F90
io/w_inpXML.f90 kpoints/julia.f90 global/utility.F90
init/compile_descr.F90 kpoints/kpoints.f90 io/xmlOutput.F90 kpoints/brzone2.f90 cdn/slab_dim.f90 cdn/slabgeom.f90 dos/nstm3.f90 cdn/int_21.f90
cdn/int_21lo.f90 cdn_mt/rhomt21.f90 cdn_mt/rhonmt21.f90 force/force_a21.F90 force/force_a21_lo.f90 force/force_a21_U.f90 force/force_a12.f90
eigen/tlmplm_store.F90 xc-pot/gaunt.f90 kpoints/unfoldBandKPTS.f90)
set(fleur_SRC ${fleur_F90} ${fleur_F77})
set_source_files_properties(${fleur_F90} PROPERTIES Fortran_FORMAT FREE)
set_source_files_properties(${fleur_F77} PROPERTIES Fortran_FORMAT FIXED)
set_source_files_properties(${inpgen_F90} PROPERTIES Fortran_FORMAT FREE)
set_source_files_properties(${inpgen_F77} PROPERTIES Fortran_FORMAT FIXED)
string(REPLACE ";" " " CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${FLEUR_PRECISION_OPTION}")
message("Flags: ${CMAKE_Fortran_FLAGS}")
......@@ -95,12 +74,6 @@ if(${FLEUR_USE_MPI})
set_target_properties(fleur_MPI PROPERTIES Fortran_MODULE_DIRECTORY modules/fleur_MPI COMPILE_OPTIONS -Imodules/fleur_MPI)
endif ()
#inpgen executable
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_filesInpgen})
target_compile_definitions(inpgen PUBLIC ${FLEUR_DEFINITIONS})
target_link_libraries(inpgen ${FLEUR_LIBRARIES})
target_link_libraries(inpgen juDFT)
set_target_properties(inpgen PROPERTIES Fortran_MODULE_DIRECTORY modules/inpgen COMPILE_OPTIONS -Imodules/inpgen)
include(cmake/docker.txt)
......
......@@ -8,7 +8,7 @@ option(INPGEN_USE_DEBUG "Set CPP_DEBUG when compiling code" OFF)
#set(JUFDT_COMPILEOPTS "-r8")
set(FLEUR_SRC "/home/fleur/")
set(FLEUR_SRC "/Users/wortmann/eclipse/fleur/")
add_executable(inpgen2
inpgen_help.f90
......@@ -49,21 +49,20 @@ ${FLEUR_SRC}/math/util.F
${FLEUR_SRC}/types/types_input.F90
${FLEUR_SRC}/types/types_input.f90
${FLEUR_SRC}/types/types_xcpot.F90
${FLEUR_SRC}/types/types_xcpot_inbuild_nofunction.F90
${FLEUR_SRC}/types/types_xcpot_data.F90
${FLEUR_SRC}/types/types_kpts.f90
${FLEUR_SRC}/types/types_input.F90
${FLEUR_SRC}/types/types_sym.F90
${FLEUR_SRC}/types/types_cell.F90
${FLEUR_SRC}/types/types_oneD.F90
${FLEUR_SRC}/types/types_noco.F90
${FLEUR_SRC}/types/types_sym.f90
${FLEUR_SRC}/types/types_cell.f90
${FLEUR_SRC}/types/types_oneD.f90
${FLEUR_SRC}/types/types_noco.f90
${FLEUR_SRC}/types/types_atoms.F90
${FLEUR_SRC}/types/types_econfig.F90
${FLEUR_SRC}/types/types_hybrid.F90
${FLEUR_SRC}/types/types_stars.F90
${FLEUR_SRC}/types/types_vacuum.F90
${FLEUR_SRC}/types/types_hybrid.f90
${FLEUR_SRC}/types/types_stars.f90
${FLEUR_SRC}/types/types_vacuum.f90
${FLEUR_SRC}/types/types_sphhar.f90
${FLEUR_SRC}/types/types_banddos.f90
${FLEUR_SRC}/types/types_sliceplot.f90
......@@ -71,10 +70,10 @@ ${FLEUR_SRC}/types/types_potden.F90
${FLEUR_SRC}/types/types_enpara.F90
${FLEUR_SRC}/types/types_mpi.F90
${FLEUR_SRC}/types/types_dos.f90
${FLEUR_SRC}/types/types_forcetheo.f90
${FLEUR_SRC}/types/types_forcetheo.F90
${FLEUR_SRC}/types/types_dimension.f90
${FLEUR_SRC}/types/types_regionCharges.f90
${FLEUR_SRC}/types/types_misc.f90
${FLEUR_SRC}/types/types_misc.F90
${FLEUR_SRC}/io/xmlOutput.F90
${FLEUR_SRC}/global/utility.F90
${FLEUR_SRC}/global/radsra.f
......@@ -84,7 +83,7 @@ ${FLEUR_SRC}/global/ss_sym.f
${FLEUR_SRC}/math/inwint.f
${FLEUR_SRC}/math/outint.f
${FLEUR_SRC}/math/intgr.F90
${FLEUR_SRC}/global/find_enpara.F90
${FLEUR_SRC}/global/find_enpara.f90
${FLEUR_SRC}/mpi/mpi_bc_tool.F90
${FLEUR_SRC}/math/d_wigner.F90
${FLEUR_SRC}/io/xsf_io.f90
......
......@@ -133,6 +133,7 @@ contains
integer :: n
call add_atompar() !Make sure we have at least the defaults
!check if there is an id given
if (present(id)) then
DO n=no_of_atompars,1,-1
......@@ -158,7 +159,7 @@ contains
DO n=no_of_atompars,1,-1
ap=atompar_list(n)
if (ap%nucnumber==nucnumber) then
if (ap%rmt_min<=rmt_max) then
IF (ap%rmt_min>5.0.OR.ap%rmt_min<=rmt_max) THEN
ap%rmt=rmt_max
return
endif
......
......@@ -26,6 +26,7 @@ CONTAINS
CALL new_argument(0,"-inp.xml","modify existing inp.xml file","")
CALL new_argument(0,"-inp","convert old inp file to inp.xml file","")
CALL new_argument(1,"-f","filename to process","")
CALL new_argument(0,"-warn_only","do not stop for warnings","")
CALL new_argument(0,"-h","Print this help message","")
......
......@@ -85,8 +85,7 @@ CONTAINS
WHERE ( ABS( atoms%taual ) < eps12 ) atoms%taual = 0.00
!Generate postions in cartesian coordinates
ALLOCATE(atoms%pos(3,atoms%nat))
atoms%pos(:,n) = MATMUL( cell%amat , atoms%taual(:,n) )
atoms%pos(:,:) = MATMUL( cell%amat , atoms%taual(:,:) )
END SUBROUTINE make_atom_groups
END MODULE m_make_atom_groups
......@@ -17,6 +17,7 @@ CONTAINS
USE m_types_vacuum
USE m_types_cell
USE m_types_oneD
USE m_constants
TYPE(t_atoms),INTENT(INOUT) :: atoms
TYPE(t_input),INTENT(IN) :: input
......@@ -24,10 +25,12 @@ CONTAINS
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_oneD),INTENT(IN) :: oneD
INTEGER :: i,l,id,n
INTEGER :: i,l,id,n,nn
INTEGER :: element_species(120)
CHARACTER(len=1) :: lotype(0:3)=(/'s','p','d','f'/)
TYPE(t_atompar):: ap
element_species=0
atoms%nlod=9 ! This fixed dimensioning might have to be made more dynamical!
ALLOCATE(atoms%nz(atoms%ntype))
......@@ -44,7 +47,14 @@ CONTAINS
ALLOCATE(atoms%econf(atoms%ntype))
ALLOCATE(atoms%relax(3,atoms%ntype))
ALLOCATE(atoms%ulo_der(atoms%nlod,atoms%ntype))
ALLOCATE(atoms%rmt(atoms%ntype))
ALLOCATE(atoms%speciesname(atoms%ntype))
ALLOCATE(atoms%lapw_l(atoms%ntype))
atoms%lapw_l=0
atoms%speciesname=""
atoms%nz(:) = NINT(atoms%zatom(:))
atoms%rmt(:) = 999.9
atoms%ulo_der = 0
......@@ -92,6 +102,15 @@ CONTAINS
! rounding
atoms%dx(:) = REAL(NINT(atoms%dx(:) * 1000) / 1000.)
!Generate species-names
DO nn=1,n
if (atoms%same_species(n,nn)) atoms%speciesname(n)=atoms%speciesname(nn)
enddo
if (len_trim(atoms%speciesname(n))<1) THEN
element_species(atoms%nz(n))=element_species(atoms%nz(n))+1
write(atoms%speciesname(n),"(a,a,i0)") namat_const(atoms%nz(n)),"-",element_species(atoms%nz(n))
endif
END DO
......
......@@ -82,7 +82,7 @@ CONTAINS
!
xcpot%gmaxxc = merge(xcpot%gmaxxc,3.0*input%rkmax,xcpot%gmaxxc>0)
xcpot%gmaxxc = real(NINT(xcpot%gmaxxc * 10 ) / 10.)
if (xcpot%icorr==0) call xcpot%init("pbe ",.false.,atoms%ntype)
!
!vacuum
......
......@@ -55,7 +55,8 @@ CONTAINS
INQUIRE(file=filename,exist=l_exist)
IF (.NOT.l_exist) CALL judft_error("Input file specified is not readable")
OPEN(97,file=filename)
OPEN(98,status='scratch')
!OPEN(98,status='scratch')
OPEN(98,file="scratch")
CALL normalize_file(97,98)
close(97)
......@@ -67,7 +68,7 @@ CONTAINS
endif
aa=0.0
DO WHILE(ios.NE.0)
DO WHILE(ios==0)
READ(98,"(a)",iostat=ios) line
IF (ios.NE.0) EXIT
IF (line(1:1)=="&") THEN
......@@ -123,10 +124,10 @@ CONTAINS
ELSE
!the bravais matrix has to follow
a1(1)=evaluatefirst(line);a1(2)=evaluatefirst(line);a1(3)=evaluatefirst(line)
READ(line,*,iostat=ios) line
READ(98,"(a)",iostat=ios) line
IF (ios.NE.0) CALL judft_error(("Error reading bravais matrix"))
a2(1)=evaluatefirst(line);a2(2)=evaluatefirst(line);a2(3)=evaluatefirst(line)
READ(line,*,iostat=ios) line
READ(98,"(a)",iostat=ios) line
IF (ios.NE.0) CALL judft_error(("Error reading bravais matrix"))
a3(1)=evaluatefirst(line);a3(2)=evaluatefirst(line);a3(3)=evaluatefirst(line)
vacuum%dvac=evaluatefirst(line)
......@@ -135,10 +136,10 @@ CONTAINS
WRITE(*,*)'Setting default for dVac'
vacuum%dvac = ABS(a3(3)) ! This is later set to the real default by the chkmt result
END IF
READ(line,*,iostat=ios) line
READ(98,"(a)",iostat=ios) line
IF (ios.NE.0) CALL judft_error(("Error reading bravais matrix"))
aa=evaluatefirst(line)
READ(line,*,iostat=ios) line
READ(98,"(a)",iostat=ios) line
IF (ios.NE.0) CALL judft_error(("Error reading bravais matrix"))
scale(1)=evaluatefirst(line);scale(2)=evaluatefirst(line);scale(3)=evaluatefirst(line)
mat=0.0
......
......@@ -378,9 +378,9 @@ SUBROUTINE w_inpXML(&
EXIT
END IF
! <species name="Si-1" element="Si" atomicNumber="14" coreStates="4" magMom="0.0" flipSpin="F">
300 FORMAT(' <species name="',a,'" element="',a,'" atomicNumber="',i0,'" magMom="',f0.8,'" flipSpin="',l1,'">')
300 FORMAT(' <species name="',a,'" element="',a,'" atomicNumber="',i0,'" flipSpin="',l1,'">')
speciesName = TRIM(ADJUSTL(atoms%speciesName(iSpecies)))
WRITE (fileNum,300) TRIM(ADJUSTL(speciesName)),TRIM(ADJUSTL(namat_const(atoms%nz(iAtomType)+1))),atoms%nz(iAtomType),atoms%bmu(iAtomType),atoms%nflip(iAtomType)
WRITE (fileNum,300) TRIM(ADJUSTL(speciesName)),TRIM(ADJUSTL(namat_const(atoms%nz(iAtomType)+1))),atoms%nz(iAtomType),atoms%nflip(iAtomType)
! <mtSphere radius="2.160000" gridPoints="521" logIncrement="0.022000"/>
310 FORMAT(' <mtSphere radius="',f0.8,'" gridPoints="',i0,'" logIncrement="',f0.8,'"/>')
......@@ -390,11 +390,12 @@ SUBROUTINE w_inpXML(&
320 FORMAT(' <atomicCutoffs lmax="',i0,'" lnonsphr="',i0,'"/>')
WRITE (fileNum,320) atoms%lmax(iAtomType),atoms%lnonsph(iAtomType)
IF (ALL(enpara%qn_el(0:3,iAtomType,1).ne.0)) THEN
! <energyParameters s="3" p="3" d="3" f="4"/>
321 FORMAT(' <energyParameters s="',i0,'" p="',i0,'" d="',i0,'" f="',i0,'"/>')
WRITE (fileNum,321) enpara%qn_el(0:3,iAtomType,1)
END IF
print *,"enpara IO missing"
! IF (ALL(enpara%qn_el(0:3,iAtomType,1).ne.0)) THEN
!! <energyParameters s="3" p="3" d="3" f="4"/>
! 321 FORMAT(' <energyParameters s="',i0,'" p="',i0,'" d="',i0,'" f="',i0,'"/>')
! WRITE (fileNum,321) enpara%qn_el(0:3,iAtomType,1)
! END IF
IF(l_explicit.OR.hybrid%l_hybrid) THEN
315 FORMAT(' <prodBasis lcutm="',i0,'" lcutwf="',i0,'" select="',a,'"/>')
......@@ -433,7 +434,7 @@ SUBROUTINE w_inpXML(&
DO ilo = 1, atoms%nlo(iAtomType)
! <lo type="HELO" l="0" n="4"/>
l = atoms%llo(ilo,iAtomType)
l = atoms%llo(ilo,iAtomType)
n = enpara%qn_ello(ilo,iAtomType,1)
loType = 'SCLO'
IF(n.LT.0) THEN
......
......@@ -8,10 +8,10 @@ types/types_xcpot_inbuild.F90
types/types_xcpot_data.F90
types/types_xcpot_libxc.F90
types/types_mpi.F90
types/types_stars.F90
types/types_stars.f90
types/types_atoms.F90
types/types_lapw.F90
types/types_sphhar.F90
types/types_sphhar.f90
types/types_tlmplm.F90
types/types_misc.F90
types/types_mpimat.F90
......
......@@ -103,6 +103,33 @@ MODULE m_types_atoms
INTEGER, ALLOCATABLE :: nflip(:) !<flip magnetisation of this atom
! CONTAINS
! procedure :: nsp => calc_nsp_atom
contains
PROCEDURE :: same_species
END TYPE t_atoms
contains
LOGICAL function same_species(atoms,n,nn)
use m_judft
implicit none
class(t_atoms),INTENT(IN)::atoms
integer,intent(in)::n,nn
if (n>atoms%ntype.or.nn>atoms%ntype) call judft_error("Same species checked for non-existing atom")
same_species=atoms%nz(n)==atoms%nz(nn)
same_species=same_species.and.atoms%speciesname(n)==atoms%speciesname(nn)
same_species=same_species.and.atoms%jri(n)==atoms%jri(nn)
same_species=same_species.and.atoms%dx(n)==atoms%dx(nn)
same_species=same_species.and.atoms%rmt(n)==atoms%rmt(nn)
same_species=same_species.and.atoms%lmax(n)==atoms%lmax(nn)
same_species=same_species.and.atoms%lnonsph(n)==atoms%lnonsph(nn)
same_species=same_species.and.atoms%nlo(n)==atoms%nlo(nn)
if (atoms%nlo(n)==atoms%nlo(nn)) same_species=same_species.and.all(atoms%llo(:,n)==atoms%llo(:,nn))
same_species=same_species.and.atoms%lapw_l(n)==atoms%lapw_l(nn)
same_species=same_species.and.atoms%l_geo(n)==atoms%l_geo(nn)
same_species=same_species.and.trim(atoms%econf(n)%coreconfig)==trim(atoms%econf(nn)%coreconfig)
same_species=same_species.and.trim(atoms%econf(n)%valenceconfig)==trim(atoms%econf(nn)%valenceconfig)
same_species=same_species.and.trim(atoms%econf(n)%valenceconfig)==trim(atoms%econf(nn)%valenceconfig)
end function
END MODULE m_types_atoms
......@@ -48,7 +48,7 @@ MODULE m_types_cell
cell%area = cell%omtil/cell%amat(3,3)
ELSE
cell%vol = cell%omtil
cell%area = cell%amat(1,1)*cell%amat(2,2)-cell%amat(1,2)*cell%amat(2,1)
cell%area =abs(cell%amat(1,1)*cell%amat(2,2)-cell%amat(1,2)*cell%amat(2,1))
IF (cell%area < 1.0e-7) THEN
cell%area = 1.
CALL juDFT_warn("area = 0",calledby ="types_cell")
......
......@@ -120,18 +120,21 @@ CONTAINS
INTEGER :: n
REAL,allocatable :: core_occ(:),valence_occ(:)
IF (INDEX(str,"|")==0) CALL judft_error(("Invalid econfig:"//TRIM(str)))
n=INDEX(str,"|")
IF (n==0) CALL judft_error(("Invalid econfig:"//TRIM(str)))
CALL convert_to_extended(str(:INDEX(str,"|")-1),core,core_occ)
CALL convert_to_extended(str(1:n-1),core,core_occ)
CALL convert_to_extended(str(INDEX(str,"|")+1:),valence,valence_occ)
CALL econf%init(core,valence)
!Now set occupations
core=core(INDEX(core,"("):) !remove noble gas
core=econf%coreconfig(INDEX(econf%coreconfig,"("):) !remove noble gas
DO n=1,SIZE(core_occ)
CALL econf%set_occupation(core(:INDEX(core,")")),core_occ(n),-1.)
core=core(INDEX(core,")")+1:)
ENDDO
valence=econf%valenceconfig
DO n=1,SIZE(valence_occ)
CALL econf%set_occupation(valence(:INDEX(valence,")")),valence_occ(n),-1.)
valence=valence(INDEX(valence,")")+1:)
......@@ -358,6 +361,7 @@ CONTAINS
REAL :: occ,occupation(100) !this is the tmp local variable (no 's')
INTEGER:: n,nn
CHARACTER:: n_ch,ch
extended=""
conf=ADJUSTL(simple)
n=INDEX(conf,"[")
......@@ -371,24 +375,24 @@ CONTAINS
IF (VERIFY(conf,"01234567890spdf ")>0) CALL judft_error(("Invalid econfig:"//TRIM(simple)))
n=1
DO WHILE (len_TRIM(conf)>1)
READ(conf,"(i1,a1,i2)") n_ch,ch,occ
READ(conf,"(a1,a1,i2)") n_ch,ch,occ
SELECT CASE (ch)
CASE ('s')
extended=extended//" ("//n_ch//"s1/2)"
extended=trim(extended)//" ("//n_ch//"s1/2)"
occupation(n)=occ
n=n+1
CASE ('p')
extended=extended//" ("//n_ch//"p1/2) ("//n_ch//"p3/2)"
extended=trim(extended)//" ("//n_ch//"p1/2) ("//n_ch//"p3/2)"
occupation(n)=occ*1./3.
occupation(n+1)=occ*2./3.
n=n+2
CASE('d')
extended=extended//" ("//n_ch//"d3/2) ("//n_ch//"d5/2)"
extended=trim(extended)//" ("//n_ch//"d3/2) ("//n_ch//"d5/2)"
occupation(n)=occ*2./5.
occupation(n+1)=occ*3./5.
n=n+2
CASE('f')
extended=extended//" ("//n_ch//"f5/2) ("//n_ch//"f7/2)"
extended=trim(extended)//" ("//n_ch//"f5/2) ("//n_ch//"f7/2)"
occupation(n)=occ*3./7.
occupation(n+1)=occ*4./7.
n=n+2
......
......@@ -37,11 +37,7 @@ MODULE m_types_xcpot_inbuild_nofunction
REAL, PARAMETER :: amix_hf = 1.00
TYPE, EXTENDS(t_xcpot):: t_xcpot_inbuild_nf
#ifdef CPP_MPI
INTEGER :: icorr=0 !not private to allow bcasting it around
#else
INTEGER,PRIVATE :: icorr=0
#endif
INTEGER :: icorr=0 !not private to allow bcasting it around, and to check for initiazaition
TYPE(t_xcpot_data) :: DATA
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment