! ! Copyright (C) 2011 Quantum ESPRESSO group ! 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 . ! ! !--------------------------------------------------------------------- PROGRAM upf22upf1 !--------------------------------------------------------------------- ! ! Convert a pseudopotential written in UPF v.2 format to UPF v.1 format ! USE pseudo_types, ONLY : pseudo_upf, nullify_pseudo_upf, & deallocate_pseudo_upf USE radial_grids, ONLY: radial_grid_type, nullify_radial_grid USE upf_module, ONLY: read_upf USE write_upf_module, ONLY: write_upf ! IMPLICIT NONE TYPE(pseudo_upf) :: upf TYPE (radial_grid_type), TARGET :: grid CHARACTER(len=256) filein, fileout INTEGER :: ios, isupf INTEGER, EXTERNAL :: atomic_number ! CALL get_file ( filein ) IF ( trim(filein) == ' ') & CALL errore ('upf22upf1', 'usage: upf22upf1 "file-to-be-converted"', 1) OPEN ( unit=1, file=filein, status = 'old', form='formatted', iostat=ios ) IF ( ios /= 0) & CALL errore ('upf22upf21', 'file: '//trim(filein)//' not found', 2) CLOSE (unit=1) !CALL nullify_pseudo_upf ( upf ) !CALL nullify_radial_grid ( grid ) !upf%grid => grid CALL read_upf (upf, grid, isupf, filename=filein, xml_only=.True.) !IF ( ios /= 0) & ! CALL errore ('upf22upf1', 'file '//trim(filein)//' not UPF v.', 3) ! ! ! ! write to file ! fileout=trim(filein)//'.UPF' PRINT '(''Output PP file in UPF format : '',a)', fileout !OPEN(unit=2,file=fileout,status='unknown',form='formatted') ! CALL write_upf (FILENAME = fileout, UPF = upf, SCHEMA = 'v1') ! CLOSE (unit=2) CALL deallocate_pseudo_upf ( upf ) ! ---------------------------------------------------------- WRITE (6,"('Pseudopotential successfully written')") WRITE (6,"('Please review the content of the PP_INFO fields')") WRITE (6,"('*** Please TEST BEFORE USING !!! ***')") ! ---------------------------------------------------------- ! STOP END PROGRAM upf22upf1