2
! Copyright (C) 1996-2016 The SIESTA group
3
! This file is distributed under the terms of the
4
! GNU General Public License: see COPYING in the top directory
5
! or http://www.gnu.org/copyleft/gpl.txt.
6
! See Docs/Contributors.txt for a list of contributors.
8
c$Id: vpsb2asc.f,v 1.4 2001/07/22 14:32:10 wdpgaara Exp $
14
c This program converts pseudopotential "VPS" files (created by
15
c the ATOM program) from Binary to ASCII.
17
c Use 12 significant digits (G-format) for the double precision
21
parameter (nrmax=2000, lmax=4)
23
double precision a, b, zion
24
character*2 nameat, corr
27
character*10 ray(6), title(7)
29
integer i, j, lo, nrp, npotd, npotu
30
double precision r(nrmax), viod(lmax,nrmax), viou(lmax,nrmax),
31
& cdc(nrmax), cdv(nrmax)
36
character*70 ascii_file, binary_file
38
c Let's get the files from the command line:
41
if (nargs .ne. 2) then
42
write(0,*) 'Usage: vpsb2asc binary_file ascii_file'
46
call getarg(1,binary_file)
47
call getarg(2,ascii_file)
51
open(unit=2,file=binary_file,form='unformatted',status='old')
53
open(unit=6,file=ascii_file,form='formatted',status='unknown')
56
read(2) nameat, corr, rel, core, (ray(j),j=1,6),
57
& (title(j),j=1,7), npotd, npotu, nrp, a, b, zion
58
if (nrp .gt. nrmax) stop 'NRMAX'
60
write(6,9000) nameat, corr, rel, core
61
write(6,9010) (ray(j),j=1,6), (title(j),j=1,7)
62
write(6,9015) npotd, npotu, nrp, a, b, zion
64
9000 format(1x,a2,1x,a2,1x,a3,1x,a4)
65
9010 format(1x,6a10,/,1x,7a10)
66
9015 format(1x,2i3,i5,3g20.12)
68
c Note the format. Change if needed.
71
9030 format(4(g20.12))
76
read(2) (r(j),j=1,nrp)
77
write(6,9040) 'Radial grid follows'
78
write(6,9030) (r(j),j=1,nrp)
83
read(2) lo, (viod(lo+1,j),j=1,nrp)
84
write(6,9040) 'Down Pseudopotential follows (l on next line)'
85
if (lo .gt. (lmax-1)) stop 'LMAX'
87
write(6,9030) (viod(lo+1,j),j=1,nrp)
93
read(2) lo, (viou(lo+1,j),j=1,nrp)
94
write(6,9040) 'Up Pseudopotential follows (l on next line)'
95
if (lo .gt. (lmax-1)) stop 'LMAX'
97
write(6,9030) (viou(lo+1,j),j=1,nrp)
100
c Core and valence charge
102
read(2) (cdc(j),j=1,nrp)
103
read(2) (cdv(j),j=1,nrp)
105
write(6,9040) 'Core charge follows'
106
write(6,9030) (cdc(j),j=1,nrp)
107
write(6,9040) 'Valence charge follows'
108
write(6,9030) (cdv(j),j=1,nrp)