Commit a7f27c4a authored by Gregor Michalicek's avatar Gregor Michalicek

Write out inp_new.xml iff forces are calculated

parent df09adc2
...@@ -39,6 +39,8 @@ CONTAINS ...@@ -39,6 +39,8 @@ CONTAINS
USE m_bfgs USE m_bfgs
USE m_bfgs0 USE m_bfgs0
USE m_types USE m_types
USE m_rinpXML
USE m_winpXML
IMPLICIT NONE IMPLICIT NONE
TYPE(t_oneD),INTENT(IN) :: oneD TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_cell),INTENT(IN) :: cell TYPE(t_cell),INTENT(IN) :: cell
...@@ -63,7 +65,54 @@ CONTAINS ...@@ -63,7 +65,54 @@ CONTAINS
TYPE(t_input):: input TYPE(t_input):: input
! temporary variables for XML IO
TYPE(t_input) :: input_temp
TYPE(t_dimension) :: dimension_temp
TYPE(t_atoms) :: atoms_temp
TYPE(t_sphhar) :: sphhar_temp
TYPE(t_cell) :: cell_temp
TYPE(t_stars) :: stars_temp
TYPE(t_sym) :: sym_temp
TYPE(t_noco) :: noco_temp
TYPE(t_vacuum) :: vacuum_temp
TYPE(t_sliceplot) :: sliceplot_temp
TYPE(t_banddos) :: banddos_temp
TYPE(t_obsolete) :: obsolete_temp
TYPE(t_enpara) :: enpara_temp
TYPE(t_xcpot) :: xcpot_temp
TYPE(t_results) :: results_temp
TYPE(t_jij) :: jij_temp
TYPE(t_kpts) :: kpts_temp
TYPE(t_hybrid) :: hybrid_temp
TYPE(t_oneD) :: oneD_temp
LOGICAL :: l_opti_temp
INTEGER :: numSpecies
INTEGER :: div(3)
INTEGER, ALLOCATABLE :: xmlElectronStates(:,:)
INTEGER, ALLOCATABLE :: atomTypeSpecies(:)
INTEGER, ALLOCATABLE :: speciesRepAtomType(:)
REAL, ALLOCATABLE :: xmlCoreOccs(:,:,:)
LOGICAL, ALLOCATABLE :: xmlPrintCoreStates(:,:)
CHARACTER(len=3), ALLOCATABLE :: noel_temp(:)
CHARACTER(len=4) :: namex_temp
CHARACTER(len=12) :: relcor_temp
CHARACTER(LEN=20) :: filename
REAL :: a1_temp(3),a2_temp(3),a3_temp(3)
REAL :: scale_temp, dtild_temp
input=input_in input=input_in
atoms_new=atoms
! na = 1
! DO i = 1,atoms_new%ntype
! IF (input%film) atoms_new%taual(3,na) = atoms_new%taual(3,na)/cell%amat(3,3)
! DO j = 1,3
! tau0_i(j,i) = atoms_new%taual(j,na)
! END DO
! tau0(:,i)=MATMUL(cell%amat,tau0_i(:,i))
!! CALL cotra0(tau0_i(1,i),tau0(1,i),cell%amat)
! na = na + atoms_new%neq(i)
! END DO
CALL bfgs0(& CALL bfgs0(&
& atoms%ntype,& & atoms%ntype,&
...@@ -96,8 +145,6 @@ CONTAINS ...@@ -96,8 +145,6 @@ CONTAINS
WRITE (6,'(a)') "Des woars!" WRITE (6,'(a)') "Des woars!"
CALL juDFT_end(" GEO Des woars ", 1) ! The 1 is temporarily. Should be mpi%irank. CALL juDFT_end(" GEO Des woars ", 1) ! The 1 is temporarily. Should be mpi%irank.
ELSE ELSE
atoms_new=atoms
na = 0 na = 0
DO itype=1,atoms%ntype DO itype=1,atoms%ntype
tau0_i(:,itype)=MATMUL(cell%bmat,tau0(:,itype)) tau0_i(:,itype)=MATMUL(cell%bmat,tau0(:,itype))
...@@ -126,13 +173,34 @@ CONTAINS ...@@ -126,13 +173,34 @@ CONTAINS
ENDDO ENDDO
ENDDO ENDDO
CALL judft_error("Writing on new input file not implemented in geo") ! CALL judft_error("Writing on new input file not implemented in geo")
! input%l_f = .false. input%l_f = .false.
! CALL rw_inp(& ! CALL rw_inp('W',atoms_new,obsolete,vacuum,input,stars,sliceplot,banddos,&
! & 'W',atoms_new,obsolete,vacuum,input,stars,sliceplot,banddos,& ! cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,&
! & cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,& ! noel,namex,relcor,a1,a2,a3,scale,dtild,name)
! & noel,namex,relcor,a1,a2,a3,scale,dtild,name) IF(input%l_inpXML) THEN
ALLOCATE(noel_temp(1),atomTypeSpecies(1),speciesRepAtomType(1))
ALLOCATE(xmlElectronStates(1,1),xmlPrintCoreStates(1,1))
ALLOCATE(xmlCoreOccs(1,1,1))
CALL r_inpXML(&
atoms_temp,obsolete_temp,vacuum_temp,input_temp,stars_temp,sliceplot_temp,&
banddos_temp,dimension_temp,cell_temp,sym_temp,xcpot_temp,noco_temp,Jij_temp,&
oneD_temp,hybrid_temp,kpts_temp,enpara_temp,sphhar_temp,l_opti_temp,noel_temp,&
namex_temp,relcor_temp,a1_temp,a2_temp,a3_temp,scale_temp,dtild_temp,xmlElectronStates,&
xmlPrintCoreStates,xmlCoreOccs,atomTypeSpecies,speciesRepAtomType)
numSpecies = SIZE(speciesRepAtomType)
filename = 'inp_new.xml'
input_temp%l_f = input%l_f
div(:) = MIN(kpts_temp%nmop(:),1)
CALL w_inpXML(&
& atoms_new,obsolete_temp,vacuum_temp,input_temp,stars_temp,sliceplot_temp,&
banddos_temp,cell_temp,sym_temp,xcpot_temp,noco_temp,jij_temp,oneD_temp,hybrid_temp,&
kpts_temp,kpts_temp%nmop,kpts_temp%l_gamma,noel_temp,namex_temp,relcor_temp,a1_temp,a2_temp,a3_temp,&
scale_temp,dtild_temp,input_temp%comment,xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
& atomTypeSpecies,speciesRepAtomType,.FALSE.,filename,numSpecies,enpara_temp)
DEALLOCATE(noel_temp,atomTypeSpecies,speciesRepAtomType)
DEALLOCATE(xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs)
END IF
ENDIF ENDIF
RETURN RETURN
......
...@@ -57,12 +57,13 @@ ...@@ -57,12 +57,13 @@
REAL dx0(atoms%ntype), rmtTemp(atoms%ntype) REAL dx0(atoms%ntype), rmtTemp(atoms%ntype)
INTEGER div(3) INTEGER div(3)
INTEGER jri0(atoms%ntype),lmax0(atoms%ntype),nlo0(atoms%ntype),llo0(atoms%nlod,atoms%ntype) INTEGER jri0(atoms%ntype),lmax0(atoms%ntype),nlo0(atoms%ntype),llo0(atoms%nlod,atoms%ntype)
CHARACTER(len=1) :: ch_rw CHARACTER(len=1) :: ch_rw
CHARACTER(len=4) :: namex CHARACTER(len=4) :: namex
CHARACTER(len=3) :: noel(atoms%ntype) CHARACTER(len=3) :: noel(atoms%ntype)
CHARACTER(len=12) :: relcor CHARACTER(len=12) :: relcor
CHARACTER(len=3) :: latnamTemp CHARACTER(len=3) :: latnamTemp
INTEGER nu,iofile CHARACTER(LEN=20) :: filename
INTEGER nu,iofile
INTEGER iggachk INTEGER iggachk
INTEGER n ,iostat, errorStatus, numSpecies INTEGER n ,iostat, errorStatus, numSpecies
REAL scale,scpos ,zc REAL scale,scpos ,zc
...@@ -428,14 +429,15 @@ ...@@ -428,14 +429,15 @@
IF(errorStatus.NE.0) THEN IF(errorStatus.NE.0) THEN
STOP 'Error: Cannot print out FleurInputSchema.xsd' STOP 'Error: Cannot print out FleurInputSchema.xsd'
END IF END IF
filename = 'inp.xml'
numSpecies = atoms%nat numSpecies = atoms%nat
CALL w_inpXML(& CALL w_inpXML(&
& atoms,obsolete,vacuum,input,stars,sliceplot,banddos,& & atoms,obsolete,vacuum,input,stars,sliceplot,banddos,&
& cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,div,l_gamma,& & cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,div,l_gamma,&
& noel,namex,relcor,a1,a2,a3,scale,dtild,input%comment,& & noel,namex,relcor,a1,a2,a3,scale,dtild,input%comment,&
& xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,& & xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
& atomTypeSpecies,speciesRepAtomType,.FALSE.,numSpecies,& & atomTypeSpecies,speciesRepAtomType,.FALSE.,filename,&
& enpara) & numSpecies,enpara)
IF(juDFT_was_argument("-explicit")) THEN IF(juDFT_was_argument("-explicit")) THEN
sumWeight = 0.0 sumWeight = 0.0
......
...@@ -21,8 +21,8 @@ SUBROUTINE w_inpXML(& ...@@ -21,8 +21,8 @@ SUBROUTINE w_inpXML(&
& cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,div,l_gamma,& & cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,div,l_gamma,&
& noel,namex,relcor,a1,a2,a3,scale,dtild_opt,name_opt,& & noel,namex,relcor,a1,a2,a3,scale,dtild_opt,name_opt,&
& xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,& & xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
& atomTypeSpecies,speciesRepAtomType,l_outFile,numSpecies,& & atomTypeSpecies,speciesRepAtomType,l_outFile,filename,&
& enpara) & numSpecies,enpara)
USE m_types USE m_types
USE m_juDFT_init USE m_juDFT_init
...@@ -61,6 +61,7 @@ SUBROUTINE w_inpXML(& ...@@ -61,6 +61,7 @@ SUBROUTINE w_inpXML(&
CHARACTER(len=3),INTENT(IN) :: noel(atoms%ntypd) CHARACTER(len=3),INTENT(IN) :: noel(atoms%ntypd)
CHARACTER(len=4),INTENT(IN) :: namex CHARACTER(len=4),INTENT(IN) :: namex
CHARACTER(len=12),INTENT(IN):: relcor CHARACTER(len=12),INTENT(IN):: relcor
CHARACTER(LEN=*),INTENT(IN) :: filename
REAL,INTENT(IN),OPTIONAL :: dtild_opt REAL,INTENT(IN),OPTIONAL :: dtild_opt
CHARACTER(len=8),INTENT(IN),OPTIONAL:: name_opt(10) CHARACTER(len=8),INTENT(IN),OPTIONAL:: name_opt(10)
...@@ -155,7 +156,7 @@ SUBROUTINE w_inpXML(& ...@@ -155,7 +156,7 @@ SUBROUTINE w_inpXML(&
CALL openXMLElementNoAttributes('inputData') CALL openXMLElementNoAttributes('inputData')
ELSE ELSE
fileNum = 5 fileNum = 5
OPEN (fileNum,file='inp.xml',form='formatted',status='unknown') OPEN (fileNum,file=TRIM(ADJUSTL(filename)),form='formatted',status='unknown')
REWIND (fileNum) REWIND (fileNum)
WRITE (fileNum,'(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' WRITE (fileNum,'(a)') '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
COMPLEX :: cdum COMPLEX :: cdum
CHARACTER(len=4) :: namex CHARACTER(len=4) :: namex
CHARACTER(len=12) :: relcor CHARACTER(len=12) :: relcor
CHARACTER(LEN=20) :: filename
REAL :: a1(3),a2(3),a3(3) REAL :: a1(3),a2(3),a3(3)
REAL :: scale, dtild REAL :: scale, dtild
#ifdef CPP_MPI #ifdef CPP_MPI
...@@ -124,14 +125,15 @@ ...@@ -124,14 +125,15 @@
ALLOCATE (results%force_old(3,atoms%ntype)) ALLOCATE (results%force_old(3,atoms%ntype))
results%force(:,:,:) = 0.0 results%force(:,:,:) = 0.0
filename = ''
numSpecies = SIZE(speciesRepAtomType) numSpecies = SIZE(speciesRepAtomType)
CALL w_inpXML(& CALL w_inpXML(&
& atoms,obsolete,vacuum,input,stars,sliceplot,banddos,& & atoms,obsolete,vacuum,input,stars,sliceplot,banddos,&
& cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,(/1,1,1/),kpts%l_gamma,& & cell,sym,xcpot,noco,jij,oneD,hybrid,kpts,(/1,1,1/),kpts%l_gamma,&
& noel,namex,relcor,a1,a2,a3,scale,dtild,input%comment,& & noel,namex,relcor,a1,a2,a3,scale,dtild,input%comment,&
& xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,& & xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs,&
& atomTypeSpecies,speciesRepAtomType,.TRUE.,numSpecies,& & atomTypeSpecies,speciesRepAtomType,.TRUE.,filename,&
& enpara) & numSpecies,enpara)
DEALLOCATE(noel,atomTypeSpecies,speciesRepAtomType) DEALLOCATE(noel,atomTypeSpecies,speciesRepAtomType)
DEALLOCATE(xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs) DEALLOCATE(xmlElectronStates,xmlPrintCoreStates,xmlCoreOccs)
END IF END IF
......
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