Commit 38f2ffe3 authored by Gregor Michalicek's avatar Gregor Michalicek

Store some symmetry data in cdn.hdf and pot.hdf

parent 7e2002eb
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
! Store structure data ! Store structure data
CALL storeStructureIfNew(input, atoms, cell, vacuum, oneD) CALL storeStructureIfNew(input, atoms, cell, vacuum, oneD, sym)
!+odim !+odim
IF (input%film.OR.(sym%namgrp.NE.'any ')) THEN IF (input%film.OR.(sym%namgrp.NE.'any ')) THEN
......
...@@ -770,19 +770,21 @@ MODULE m_cdn_io ...@@ -770,19 +770,21 @@ MODULE m_cdn_io
END SUBROUTINE writeCoreDensity END SUBROUTINE writeCoreDensity
SUBROUTINE storeStructureIfNew(input, atoms, cell, vacuum, oneD) SUBROUTINE storeStructureIfNew(input, atoms, cell, vacuum, oneD, sym)
TYPE(t_input),INTENT(IN) :: input TYPE(t_input),INTENT(IN) :: input
TYPE(t_atoms), INTENT(IN) :: atoms TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_cell), INTENT(IN) :: cell TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_vacuum), INTENT(IN) :: vacuum TYPE(t_vacuum), INTENT(IN) :: vacuum
TYPE(t_oneD),INTENT(IN) :: oneD TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_input) :: inputTemp TYPE(t_input) :: inputTemp
TYPE(t_atoms) :: atomsTemp TYPE(t_atoms) :: atomsTemp
TYPE(t_cell) :: cellTemp TYPE(t_cell) :: cellTemp
TYPE(t_vacuum) :: vacuumTemp TYPE(t_vacuum) :: vacuumTemp
TYPE(t_oneD) :: oneDTemp TYPE(t_oneD) :: oneDTemp
TYPE(t_sym) :: symTemp
INTEGER :: mode INTEGER :: mode
INTEGER :: currentStarsIndex,currentLatharmsIndex,currentStructureIndex INTEGER :: currentStarsIndex,currentLatharmsIndex,currentStructureIndex
...@@ -804,8 +806,8 @@ MODULE m_cdn_io ...@@ -804,8 +806,8 @@ MODULE m_cdn_io
currentStructureIndex = currentStructureIndex + 1 currentStructureIndex = currentStructureIndex + 1
l_writeStructure = .TRUE. l_writeStructure = .TRUE.
ELSE ELSE
CALL readStructureHDF(fileID, inputTemp, atomsTemp, cellTemp, vacuumTemp, oneDTemp, currentStructureIndex) CALL readStructureHDF(fileID, inputTemp, atomsTemp, cellTemp, vacuumTemp, oneDTemp, symTemp, currentStructureIndex)
CALL compareStructure(atoms, vacuum, cell, atomsTemp, vacuumTemp, cellTemp, l_same) CALL compareStructure(atoms, vacuum, cell, sym, atomsTemp, vacuumTemp, cellTemp, symTemp, l_same)
IF(.NOT.l_same) THEN IF(.NOT.l_same) THEN
currentStructureIndex = currentStructureIndex + 1 currentStructureIndex = currentStructureIndex + 1
l_writeStructure = .TRUE. l_writeStructure = .TRUE.
...@@ -813,7 +815,7 @@ MODULE m_cdn_io ...@@ -813,7 +815,7 @@ MODULE m_cdn_io
END IF END IF
IF (l_writeStructure) THEN IF (l_writeStructure) THEN
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, currentStructureIndex) CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex)
CALL writeCDNHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,& CALL writeCDNHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,readDensityIndex,lastDensityIndex) currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
END IF END IF
......
...@@ -58,12 +58,13 @@ MODULE m_cdnpot_io_common ...@@ -58,12 +58,13 @@ MODULE m_cdnpot_io_common
END SUBROUTINE compareStepfunctions END SUBROUTINE compareStepfunctions
SUBROUTINE compareStructure(atoms, vacuum, cell, refAtoms, refVacuum,& SUBROUTINE compareStructure(atoms, vacuum, cell, sym, refAtoms, refVacuum,&
refCell, l_same) refCell, refSym, l_same)
TYPE(t_atoms),INTENT(IN) :: atoms, refAtoms TYPE(t_atoms),INTENT(IN) :: atoms, refAtoms
TYPE(t_vacuum),INTENT(IN) :: vacuum, refVacuum TYPE(t_vacuum),INTENT(IN) :: vacuum, refVacuum
TYPE(t_cell),INTENT(IN) :: cell, refCell TYPE(t_cell),INTENT(IN) :: cell, refCell
TYPE(t_sym),INTENT(IN) :: sym, refSym
LOGICAL, INTENT(OUT) :: l_same LOGICAL, INTENT(OUT) :: l_same
...@@ -74,10 +75,14 @@ MODULE m_cdnpot_io_common ...@@ -74,10 +75,14 @@ MODULE m_cdnpot_io_common
IF(atoms%lmaxd.NE.refAtoms%lmaxd) l_same = .FALSE. IF(atoms%lmaxd.NE.refAtoms%lmaxd) l_same = .FALSE.
IF(atoms%jmtd.NE.refAtoms%jmtd) l_same = .FALSE. IF(atoms%jmtd.NE.refAtoms%jmtd) l_same = .FALSE.
IF(vacuum%dvac.NE.refVacuum%dvac) l_same = .FALSE. IF(vacuum%dvac.NE.refVacuum%dvac) l_same = .FALSE.
IF(sym%nop.NE.refSym%nop) l_same = .FALSE.
IF(sym%nop2.NE.refSym%nop2) l_same = .FALSE.
IF(ANY(ABS(cell%amat(:,:)-refCell%amat(:,:)).GT.1e-10)) l_same = .FALSE. IF(ANY(ABS(cell%amat(:,:)-refCell%amat(:,:)).GT.1e-10)) l_same = .FALSE.
IF(l_same) THEN IF(l_same) THEN
IF(ANY(atoms%nz(:).NE.refAtoms%nz(:))) l_same = .FALSE. IF(ANY(atoms%nz(:).NE.refAtoms%nz(:))) l_same = .FALSE.
! IF(ANY(atoms%lmax(:).NE.refAtoms%lmax(:))) l_same = .FALSE. IF(ANY(sym%mrot(:,:,:sym%nop).NE.refSym%mrot(:,:,:sym%nop))) l_same = .FALSE.
IF(ANY(ABS(sym%tau(:,:sym%nop)-refSym%tau(:,:sym%nop)).GT.1e-10)) l_same = .FALSE.
END IF END IF
IF(l_same) THEN IF(l_same) THEN
DO i = 1, atoms%nat DO i = 1, atoms%nat
...@@ -128,9 +133,9 @@ MODULE m_cdnpot_io_common ...@@ -128,9 +133,9 @@ MODULE m_cdnpot_io_common
TYPE(t_atoms) :: atomsTemp TYPE(t_atoms) :: atomsTemp
TYPE(t_sphhar) :: latharmsTemp TYPE(t_sphhar) :: latharmsTemp
TYPE(t_input) :: inputTemp TYPE(t_input) :: inputTemp
TYPE(t_sym) :: symTemp
TYPE(t_cell) :: cellTemp TYPE(t_cell) :: cellTemp
TYPE(t_oneD) :: oneDTemp TYPE(t_oneD) :: oneDTemp
TYPE(t_sym) :: symTemp
INTEGER :: starsIndexTemp, structureIndexTemp INTEGER :: starsIndexTemp, structureIndexTemp
LOGICAL :: l_same, l_writeAll LOGICAL :: l_same, l_writeAll
...@@ -141,16 +146,16 @@ MODULE m_cdnpot_io_common ...@@ -141,16 +146,16 @@ MODULE m_cdnpot_io_common
IF(currentStructureIndex.EQ.0) THEN IF(currentStructureIndex.EQ.0) THEN
currentStructureIndex = 1 currentStructureIndex = 1
l_storeIndices = .TRUE. l_storeIndices = .TRUE.
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, currentStructureIndex) CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex)
ELSE ELSE
CALL readStructureHDF(fileID, inputTemp, atomsTemp, cellTemp, vacuumTemp, oneDTemp, currentStructureIndex) CALL readStructureHDF(fileID, inputTemp, atomsTemp, cellTemp, vacuumTemp, oneDTemp, symTemp, currentStructureIndex)
CALL compareStructure(atoms, vacuum, cell, atomsTemp, vacuumTemp, cellTemp, l_same) CALL compareStructure(atoms, vacuum, cell, sym, atomsTemp, vacuumTemp, cellTemp, symTemp, l_same)
IF(.NOT.l_same) THEN IF(.NOT.l_same) THEN
currentStructureIndex = currentStructureIndex + 1 currentStructureIndex = currentStructureIndex + 1
l_storeIndices = .TRUE. l_storeIndices = .TRUE.
l_writeAll = .TRUE. l_writeAll = .TRUE.
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, currentStructureIndex) CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex)
END IF END IF
END IF END IF
IF (currentStarsIndex.EQ.0) THEN IF (currentStarsIndex.EQ.0) THEN
......
...@@ -930,7 +930,7 @@ MODULE m_cdnpot_io_hdf ...@@ -930,7 +930,7 @@ MODULE m_cdnpot_io_hdf
END SUBROUTINE peekLatharmsHDF END SUBROUTINE peekLatharmsHDF
SUBROUTINE writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, structureIndex) SUBROUTINE writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, structureIndex)
INTEGER(HID_T), INTENT(IN) :: fileID INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(IN) :: structureIndex INTEGER, INTENT(IN) :: structureIndex
...@@ -939,6 +939,7 @@ MODULE m_cdnpot_io_hdf ...@@ -939,6 +939,7 @@ MODULE m_cdnpot_io_hdf
TYPE(t_cell), INTENT(IN) :: cell TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_vacuum), INTENT(IN) :: vacuum TYPE(t_vacuum), INTENT(IN) :: vacuum
TYPE(t_oneD),INTENT(IN) :: oneD TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_sym),INTENT(IN) :: sym
INTEGER(HID_T) :: groupID INTEGER(HID_T) :: groupID
INTEGER :: hdfError INTEGER :: hdfError
...@@ -963,6 +964,8 @@ MODULE m_cdnpot_io_hdf ...@@ -963,6 +964,8 @@ MODULE m_cdnpot_io_hdf
INTEGER(HID_T) :: zatomSpaceID, zatomSetID INTEGER(HID_T) :: zatomSpaceID, zatomSetID
INTEGER(HID_T) :: posSpaceID, posSetID INTEGER(HID_T) :: posSpaceID, posSetID
INTEGER(HID_T) :: taualSpaceID, taualSetID INTEGER(HID_T) :: taualSpaceID, taualSetID
INTEGER(HID_T) :: mrotSpaceID, mrotSetID
INTEGER(HID_T) :: tauSpaceID, tauSetID
WRITE(groupname,'(a,i0)') '/structure-', structureIndex WRITE(groupname,'(a,i0)') '/structure-', structureIndex
...@@ -1002,6 +1005,14 @@ MODULE m_cdnpot_io_hdf ...@@ -1002,6 +1005,14 @@ MODULE m_cdnpot_io_hdf
CALL io_write_attint0(groupID,'od_nq2',oneD%odi%nq2) CALL io_write_attint0(groupID,'od_nq2',oneD%odi%nq2)
CALL io_write_attlog0(groupID,'invs2',sym%invs2)
CALL io_write_attlog0(groupID,'invs',sym%invs)
CALL io_write_attlog0(groupID,'zrfs',sym%zrfs)
CALL io_write_attint0(groupID,'nop',sym%nop)
CALL io_write_attint0(groupID,'nop2',sym%nop2)
CALL io_write_attchar0(groupID,'latnam',sym%latnam)
CALL io_write_attchar0(groupID,'namgrp',sym%namgrp)
dims(:2)=(/3,3/) dims(:2)=(/3,3/)
dimsInt = dims dimsInt = dims
CALL h5screate_simple_f(2,dims(:2),amatSpaceID,hdfError) CALL h5screate_simple_f(2,dims(:2),amatSpaceID,hdfError)
...@@ -1130,11 +1141,27 @@ MODULE m_cdnpot_io_hdf ...@@ -1130,11 +1141,27 @@ MODULE m_cdnpot_io_hdf
CALL io_write_real2(taualSetID,(/1,1/),dimsInt(:2),atoms%taual) CALL io_write_real2(taualSetID,(/1,1/),dimsInt(:2),atoms%taual)
CALL h5dclose_f(taualSetID, hdfError) CALL h5dclose_f(taualSetID, hdfError)
dims(:3)=(/3,3,sym%nop/)
dimsInt = dims
CALL h5screate_simple_f(3,dims(:3),mrotSpaceID,hdfError)
CALL h5dcreate_f(groupID, "mrot", H5T_NATIVE_INTEGER, mrotSpaceID, mrotSetID, hdfError)
CALL h5sclose_f(mrotSpaceID,hdfError)
CALL io_write_integer3(mrotSetID,(/1,1,1/),dimsInt(:3),sym%mrot)
CALL h5dclose_f(mrotSetID, hdfError)
dims(:2)=(/3,sym%nop/)
dimsInt = dims
CALL h5screate_simple_f(2,dims(:2),tauSpaceID,hdfError)
CALL h5dcreate_f(groupID, "tau", H5T_NATIVE_DOUBLE, tauSpaceID, tauSetID, hdfError)
CALL h5sclose_f(tauSpaceID,hdfError)
CALL io_write_real2(tauSetID,(/1,1/),dimsInt(:2),sym%tau)
CALL h5dclose_f(tauSetID, hdfError)
CALL h5gclose_f(groupID, hdfError) CALL h5gclose_f(groupID, hdfError)
END SUBROUTINE writeStructureHDF END SUBROUTINE writeStructureHDF
SUBROUTINE readStructureHDF(fileID, input, atoms, cell, vacuum, oneD, structureIndex) SUBROUTINE readStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, structureIndex)
INTEGER(HID_T), INTENT(IN) :: fileID INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(IN) :: structureIndex INTEGER, INTENT(IN) :: structureIndex
...@@ -1143,6 +1170,7 @@ MODULE m_cdnpot_io_hdf ...@@ -1143,6 +1170,7 @@ MODULE m_cdnpot_io_hdf
TYPE(t_cell), INTENT(INOUT) :: cell TYPE(t_cell), INTENT(INOUT) :: cell
TYPE(t_vacuum), INTENT(INOUT) :: vacuum TYPE(t_vacuum), INTENT(INOUT) :: vacuum
TYPE(t_oneD),INTENT(INOUT) :: oneD TYPE(t_oneD),INTENT(INOUT) :: oneD
TYPE(t_sym),INTENT(INOUT) :: sym
INTEGER(HID_T) :: groupID INTEGER(HID_T) :: groupID
INTEGER :: hdfError INTEGER :: hdfError
...@@ -1166,6 +1194,8 @@ MODULE m_cdnpot_io_hdf ...@@ -1166,6 +1194,8 @@ MODULE m_cdnpot_io_hdf
INTEGER(HID_T) :: zatomSetID INTEGER(HID_T) :: zatomSetID
INTEGER(HID_T) :: posSetID INTEGER(HID_T) :: posSetID
INTEGER(HID_T) :: taualSetID INTEGER(HID_T) :: taualSetID
INTEGER(HID_T) :: mrotSetID
INTEGER(HID_T) :: tauSetID
WRITE(groupname,'(a,i0)') '/structure-', structureIndex WRITE(groupname,'(a,i0)') '/structure-', structureIndex
...@@ -1205,6 +1235,14 @@ MODULE m_cdnpot_io_hdf ...@@ -1205,6 +1235,14 @@ MODULE m_cdnpot_io_hdf
CALL io_read_attint0(groupID,'od_nq2',oneD%odi%nq2) CALL io_read_attint0(groupID,'od_nq2',oneD%odi%nq2)
CALL io_read_attlog0(groupID,'invs2',sym%invs2)
CALL io_read_attlog0(groupID,'invs',sym%invs)
CALL io_read_attlog0(groupID,'zrfs',sym%zrfs)
CALL io_read_attint0(groupID,'nop',sym%nop)
CALL io_read_attint0(groupID,'nop2',sym%nop2)
CALL io_read_attchar0(groupID,'latnam',sym%latnam)
CALL io_read_attchar0(groupID,'namgrp',sym%namgrp)
IF(ALLOCATED(atoms%nz)) DEALLOCATE(atoms%nz) IF(ALLOCATED(atoms%nz)) DEALLOCATE(atoms%nz)
IF(ALLOCATED(atoms%neq)) DEALLOCATE(atoms%neq) IF(ALLOCATED(atoms%neq)) DEALLOCATE(atoms%neq)
IF(ALLOCATED(atoms%jri)) DEALLOCATE(atoms%jri) IF(ALLOCATED(atoms%jri)) DEALLOCATE(atoms%jri)
...@@ -1220,6 +1258,8 @@ MODULE m_cdnpot_io_hdf ...@@ -1220,6 +1258,8 @@ MODULE m_cdnpot_io_hdf
IF(ALLOCATED(atoms%zatom)) DEALLOCATE(atoms%zatom) IF(ALLOCATED(atoms%zatom)) DEALLOCATE(atoms%zatom)
IF(ALLOCATED(atoms%pos)) DEALLOCATE(atoms%pos) IF(ALLOCATED(atoms%pos)) DEALLOCATE(atoms%pos)
IF(ALLOCATED(atoms%taual)) DEALLOCATE(atoms%taual) IF(ALLOCATED(atoms%taual)) DEALLOCATE(atoms%taual)
IF(ALLOCATED(sym%mrot)) DEALLOCATE(sym%mrot)
IF(ALLOCATED(sym%tau)) DEALLOCATE(sym%tau)
ALLOCATE(atoms%nz(atoms%ntype)) ALLOCATE(atoms%nz(atoms%ntype))
ALLOCATE(atoms%neq(atoms%ntype)) ALLOCATE(atoms%neq(atoms%ntype))
...@@ -1236,6 +1276,8 @@ MODULE m_cdnpot_io_hdf ...@@ -1236,6 +1276,8 @@ MODULE m_cdnpot_io_hdf
ALLOCATE(atoms%zatom(atoms%ntype)) ALLOCATE(atoms%zatom(atoms%ntype))
ALLOCATE(atoms%pos(3,atoms%nat)) ALLOCATE(atoms%pos(3,atoms%nat))
ALLOCATE(atoms%taual(3,atoms%nat)) ALLOCATE(atoms%taual(3,atoms%nat))
ALLOCATE(sym%mrot(3,3,sym%nop))
ALLOCATE(sym%tau(3,sym%nop))
dimsInt(:2)=(/3,3/) dimsInt(:2)=(/3,3/)
CALL h5dopen_f(groupID, 'amat', amatSetID, hdfError) CALL h5dopen_f(groupID, 'amat', amatSetID, hdfError)
...@@ -1317,6 +1359,16 @@ MODULE m_cdnpot_io_hdf ...@@ -1317,6 +1359,16 @@ MODULE m_cdnpot_io_hdf
CALL io_read_real2(taualSetID,(/1,1/),dimsInt(:2),atoms%taual) CALL io_read_real2(taualSetID,(/1,1/),dimsInt(:2),atoms%taual)
CALL h5dclose_f(taualSetID, hdfError) CALL h5dclose_f(taualSetID, hdfError)
dimsInt(:3) = (/3,3,sym%nop/)
CALL h5dopen_f(groupID, 'mrot', mrotSetID, hdfError)
CALL io_read_integer3(mrotSetID,(/1,1,1/),dimsInt(:3),sym%mrot)
CALL h5dclose_f(mrotSetID, hdfError)
dimsInt(:2) = (/3,sym%nop/)
CALL h5dopen_f(groupID, 'tau', tauSetID, hdfError)
CALL io_read_real2(tauSetID,(/1,1/),dimsInt(:2),sym%tau)
CALL h5dclose_f(tauSetID, hdfError)
CALL h5gclose_f(groupID, hdfError) CALL h5gclose_f(groupID, hdfError)
END SUBROUTINE readStructureHDF END SUBROUTINE readStructureHDF
......
...@@ -2248,7 +2248,7 @@ SUBROUTINE r_inpXML(& ...@@ -2248,7 +2248,7 @@ SUBROUTINE r_inpXML(&
! Store structure data ! Store structure data
CALL storeStructureIfNew(input, atoms, cell, vacuum, oneD) CALL storeStructureIfNew(input, atoms, cell, vacuum, oneD, sym)
! Generate stars ! Generate stars
......
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