2006-07-01 23:02:46 +08:00
|
|
|
!
|
2009-08-02 05:02:07 +08:00
|
|
|
! Copyright (C) 2006 Quantum ESPRESSO group
|
2006-07-01 23:02:46 +08:00
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!---------------------------------------------------------------------
|
2010-06-11 17:00:04 +08:00
|
|
|
PROGRAM read_upf_tofile
|
2006-07-01 23:02:46 +08:00
|
|
|
!---------------------------------------------------------------------
|
|
|
|
!
|
2010-06-11 17:00:04 +08:00
|
|
|
! This small program reads the pseudopotential in the Unified
|
2006-07-01 23:02:46 +08:00
|
|
|
! Pseudopotential Format and writes three files
|
|
|
|
! in a format which can be plotted. The files are:
|
|
|
|
!
|
|
|
|
! filewfc with the pseudo-wavefunctions
|
|
|
|
! filebeta with the beta functions
|
|
|
|
! filepot with the local potential, the valence and core charge.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! PWSCF modules
|
|
|
|
!
|
|
|
|
!
|
2010-06-11 17:00:04 +08:00
|
|
|
USE constants, ONLY : fpi
|
2006-07-01 23:02:46 +08:00
|
|
|
USE pseudo_types
|
This is a quite complex check-in, but actually not very much is done. Changelog follows.
LP
UPF file format updated completely, UPFv2 introduced:
* ld1.x can still produce old format, with the switch upf_v1_format=.true. in inputp
this is disabled by default, but we can discuss if it should be the opposite.
* pw.x cp.x and all utilities should notice no difference
* some utilities in upftools still need to be updated, anyway conversion UPFv1 to UPFv2
is very easy, so this should be no big issue
* starting from now to produce an UPF file you need to fill the pseudo_upf derivedd type
and feed it to write_upf woutine in upf_module (Modules/upf.f90)
* extensive use of iotk
I have tried to make the new format as self contained as possible, e.g. there should be
minimal need for post-processing after the data is read, no more reconstruction of known
quantities, and no more odd syntax to save negligible quantity of space. Also the human
readable section is a bit richer, all the rest is more machine readable.
I hope this will not cause any throuble, and tried really hard to, all examples and all
tests works as fine as before and gives (what really looks like) the same results.
Other changes that I needed to make:
* radial grids are now allocatable, they management is a bit less of a hack too
* paw and uspp augmentation are stored in the same place
* paw print total all-electron energy if all atoms are paw, not very useful, but nice
* most of the pseudopotential-writing reading files have been renamed to some more
logical name, I spare you the list. E.g. read_oldpseudo -> read_pseudo_rrkj3
* paw_t derived type was only used in atomic, so I have put it there (as the pseudo_type
module take ages to recompile it was awkward to leave it there).
PAW tests inserted in test/ there are 6 of them, as a consequence I have also put 5 paw
pseudopotentials in the pseudo/ directory.
I will update the PAW scf examples soon, by deleting them (as running a pw with a PAW
pseudopotential requires no option at all). PAW generation examples should be updated.
A lot of small bugfixes here & there mostly uninitialized variables or unallocated
pointers used as subrotuine arguments.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4769 c92efa57-630b-4861-b058-cf58834340f0
2008-04-03 23:50:43 +08:00
|
|
|
USE upf_module
|
2010-06-11 17:00:04 +08:00
|
|
|
USE radial_grids, ONLY : radial_grid_type, nullify_radial_grid
|
2006-07-01 23:02:46 +08:00
|
|
|
!
|
|
|
|
IMPLICIT NONE
|
|
|
|
!
|
|
|
|
INTEGER :: iunps, ierr
|
|
|
|
!
|
|
|
|
CHARACTER(30) :: file_pseudo
|
|
|
|
!
|
|
|
|
! Local variables
|
|
|
|
!
|
|
|
|
INTEGER :: ios, n, j
|
|
|
|
TYPE (pseudo_upf) :: upf
|
This is a quite complex check-in, but actually not very much is done. Changelog follows.
LP
UPF file format updated completely, UPFv2 introduced:
* ld1.x can still produce old format, with the switch upf_v1_format=.true. in inputp
this is disabled by default, but we can discuss if it should be the opposite.
* pw.x cp.x and all utilities should notice no difference
* some utilities in upftools still need to be updated, anyway conversion UPFv1 to UPFv2
is very easy, so this should be no big issue
* starting from now to produce an UPF file you need to fill the pseudo_upf derivedd type
and feed it to write_upf woutine in upf_module (Modules/upf.f90)
* extensive use of iotk
I have tried to make the new format as self contained as possible, e.g. there should be
minimal need for post-processing after the data is read, no more reconstruction of known
quantities, and no more odd syntax to save negligible quantity of space. Also the human
readable section is a bit richer, all the rest is more machine readable.
I hope this will not cause any throuble, and tried really hard to, all examples and all
tests works as fine as before and gives (what really looks like) the same results.
Other changes that I needed to make:
* radial grids are now allocatable, they management is a bit less of a hack too
* paw and uspp augmentation are stored in the same place
* paw print total all-electron energy if all atoms are paw, not very useful, but nice
* most of the pseudopotential-writing reading files have been renamed to some more
logical name, I spare you the list. E.g. read_oldpseudo -> read_pseudo_rrkj3
* paw_t derived type was only used in atomic, so I have put it there (as the pseudo_type
module take ages to recompile it was awkward to leave it there).
PAW tests inserted in test/ there are 6 of them, as a consequence I have also put 5 paw
pseudopotentials in the pseudo/ directory.
I will update the PAW scf examples soon, by deleting them (as running a pw with a PAW
pseudopotential requires no option at all). PAW generation examples should be updated.
A lot of small bugfixes here & there mostly uninitialized variables or unallocated
pointers used as subrotuine arguments.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4769 c92efa57-630b-4861-b058-cf58834340f0
2008-04-03 23:50:43 +08:00
|
|
|
TYPE (radial_grid_type) :: grid
|
2006-07-01 23:02:46 +08:00
|
|
|
!
|
2010-06-11 17:00:04 +08:00
|
|
|
WRITE(6,'("Name of the upf file > ", $)')
|
|
|
|
READ(5,'(a)') file_pseudo
|
2006-07-01 23:02:46 +08:00
|
|
|
|
2008-04-27 16:58:55 +08:00
|
|
|
! nullify objects as soon as they are instantiated
|
2010-06-11 17:00:04 +08:00
|
|
|
|
2008-04-27 16:58:55 +08:00
|
|
|
CALL nullify_pseudo_upf( upf )
|
|
|
|
CALL nullify_radial_grid( grid )
|
|
|
|
|
2006-07-01 23:02:46 +08:00
|
|
|
iunps=2
|
|
|
|
OPEN(UNIT=iunps,FILE=file_pseudo,STATUS='old',FORM='formatted', &
|
|
|
|
ERR=100, IOSTAT=ios)
|
|
|
|
100 CALL errore('read_upf_tofile','open error on file '//file_pseudo,ios)
|
|
|
|
|
This is a quite complex check-in, but actually not very much is done. Changelog follows.
LP
UPF file format updated completely, UPFv2 introduced:
* ld1.x can still produce old format, with the switch upf_v1_format=.true. in inputp
this is disabled by default, but we can discuss if it should be the opposite.
* pw.x cp.x and all utilities should notice no difference
* some utilities in upftools still need to be updated, anyway conversion UPFv1 to UPFv2
is very easy, so this should be no big issue
* starting from now to produce an UPF file you need to fill the pseudo_upf derivedd type
and feed it to write_upf woutine in upf_module (Modules/upf.f90)
* extensive use of iotk
I have tried to make the new format as self contained as possible, e.g. there should be
minimal need for post-processing after the data is read, no more reconstruction of known
quantities, and no more odd syntax to save negligible quantity of space. Also the human
readable section is a bit richer, all the rest is more machine readable.
I hope this will not cause any throuble, and tried really hard to, all examples and all
tests works as fine as before and gives (what really looks like) the same results.
Other changes that I needed to make:
* radial grids are now allocatable, they management is a bit less of a hack too
* paw and uspp augmentation are stored in the same place
* paw print total all-electron energy if all atoms are paw, not very useful, but nice
* most of the pseudopotential-writing reading files have been renamed to some more
logical name, I spare you the list. E.g. read_oldpseudo -> read_pseudo_rrkj3
* paw_t derived type was only used in atomic, so I have put it there (as the pseudo_type
module take ages to recompile it was awkward to leave it there).
PAW tests inserted in test/ there are 6 of them, as a consequence I have also put 5 paw
pseudopotentials in the pseudo/ directory.
I will update the PAW scf examples soon, by deleting them (as running a pw with a PAW
pseudopotential requires no option at all). PAW generation examples should be updated.
A lot of small bugfixes here & there mostly uninitialized variables or unallocated
pointers used as subrotuine arguments.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4769 c92efa57-630b-4861-b058-cf58834340f0
2008-04-03 23:50:43 +08:00
|
|
|
CALL read_upf(upf, grid, ierr, unit=iunps)
|
2006-07-01 23:02:46 +08:00
|
|
|
!
|
2010-06-11 17:00:04 +08:00
|
|
|
IF (ierr /= 0) &
|
|
|
|
CALL errore('read_upf_tofile','reading pseudo upf', abs(ierr))
|
2006-07-01 23:02:46 +08:00
|
|
|
!
|
|
|
|
CLOSE(iunps)
|
|
|
|
!
|
|
|
|
OPEN(UNIT=iunps,FILE='filewfc',STATUS='unknown',FORM='formatted', &
|
|
|
|
ERR=200, IOSTAT=ios)
|
2010-06-11 17:00:04 +08:00
|
|
|
200 CALL errore('read_upf_tofile','open error on file filewfc',abs(ios))
|
2006-07-01 23:02:46 +08:00
|
|
|
|
|
|
|
DO n=1,upf%mesh
|
|
|
|
WRITE(iunps,'(30f12.6)') upf%r(n), (upf%chi(n,j), j=1,upf%nwfc)
|
2010-06-11 17:00:04 +08:00
|
|
|
ENDDO
|
2006-07-01 23:02:46 +08:00
|
|
|
|
|
|
|
CLOSE(iunps)
|
|
|
|
|
|
|
|
OPEN(UNIT=iunps,FILE='filebeta',STATUS='unknown',FORM='formatted', &
|
|
|
|
ERR=300, IOSTAT=ios)
|
2010-06-11 17:00:04 +08:00
|
|
|
300 CALL errore('read_upf_tofile','open error on file filebeta',abs(ios))
|
2006-07-01 23:02:46 +08:00
|
|
|
|
|
|
|
DO n=1,upf%mesh
|
|
|
|
WRITE(iunps,'(30f12.6)') upf%r(n), (upf%beta(n,j), j=1,upf%nbeta)
|
2010-06-11 17:00:04 +08:00
|
|
|
ENDDO
|
2006-07-01 23:02:46 +08:00
|
|
|
|
|
|
|
CLOSE(iunps)
|
|
|
|
|
|
|
|
OPEN(UNIT=iunps,FILE='filepot',STATUS='unknown',FORM='formatted', &
|
|
|
|
ERR=400, IOSTAT=ios)
|
2010-06-11 17:00:04 +08:00
|
|
|
400 CALL errore('read_upf_tofile','open error on file filepot',abs(ios))
|
2006-07-01 23:02:46 +08:00
|
|
|
|
|
|
|
DO n=1,upf%mesh
|
2007-09-04 20:10:05 +08:00
|
|
|
WRITE(iunps,'(4f12.6)') upf%r(n), upf%vloc(n), &
|
2010-06-11 17:00:04 +08:00
|
|
|
upf%rho_at(n), upf%rho_atc(n)*fpi*upf%r(n)**2
|
|
|
|
ENDDO
|
2006-07-01 23:02:46 +08:00
|
|
|
|
|
|
|
CLOSE(iunps)
|
|
|
|
|
|
|
|
CALL deallocate_pseudo_upf( upf )
|
|
|
|
|
|
|
|
END PROGRAM read_upf_tofile
|