~nickpapior/siesta/tddft-work

« back to all changes in this revision

Viewing changes to Util/vpsb2asc.f

  • Committer: Rafi Ullah
  • Date: 2017-09-27 12:02:36 UTC
  • mfrom: (611.1.22 trunk)
  • Revision ID: rraffiu@gmail.com-20170927120236-68zal54nt0bu1jxp
Merged with trunk-633

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
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.
7
 
!
8
 
c$Id: vpsb2asc.f,v 1.4 2001/07/22 14:32:10 wdpgaara Exp $
9
 
c
10
 
      program vpsb2asc
11
 
c
12
 
      implicit none
13
 
c
14
 
c     This program converts pseudopotential "VPS" files (created by 
15
 
c     the ATOM program) from Binary to ASCII.
16
 
c
17
 
c     Use 12 significant digits (G-format) for the double precision
18
 
c     quantities.
19
 
c
20
 
      integer nrmax, lmax
21
 
      parameter (nrmax=2000, lmax=4)
22
 
c
23
 
      double precision a, b, zion
24
 
      character*2 nameat, corr
25
 
      character*3 rel
26
 
      character*4 core
27
 
      character*10 ray(6), title(7)
28
 
c
29
 
      integer i, j, lo, nrp, npotd, npotu
30
 
      double precision  r(nrmax), viod(lmax,nrmax), viou(lmax,nrmax),
31
 
     &                  cdc(nrmax), cdv(nrmax)
32
 
c
33
 
      character*70 message
34
 
c
35
 
      integer iargc, nargs
36
 
      character*70 ascii_file, binary_file
37
 
c
38
 
c     Let's get the files from the command line:
39
 
c
40
 
      nargs = iargc()
41
 
      if (nargs .ne. 2) then
42
 
         write(0,*) 'Usage: vpsb2asc binary_file ascii_file'
43
 
         stop 
44
 
      endif
45
 
c
46
 
      call getarg(1,binary_file)
47
 
      call getarg(2,ascii_file)
48
 
c
49
 
c      open files
50
 
c
51
 
      open(unit=2,file=binary_file,form='unformatted',status='old')
52
 
      rewind(2)
53
 
      open(unit=6,file=ascii_file,form='formatted',status='unknown')
54
 
      rewind(6)
55
 
c
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'
59
 
 
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
63
 
c
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)
67
 
c      
68
 
c     Note the format. Change if needed.
69
 
c
70
 
 8000 format(1x,i2)
71
 
 9030 format(4(g20.12))
72
 
 9040 format(1x,a)
73
 
c
74
 
c     Radial grid
75
 
c
76
 
      read(2) (r(j),j=1,nrp)
77
 
      write(6,9040) 'Radial grid follows' 
78
 
      write(6,9030) (r(j),j=1,nrp)
79
 
80
 
c     "Down" potentials
81
 
c
82
 
      do 30 i = 1, npotd
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'
86
 
         write(6,8000) lo
87
 
         write(6,9030) (viod(lo+1,j),j=1,nrp)
88
 
   30 continue
89
 
c
90
 
c     "Up" potentials
91
 
c
92
 
      do 35 i = 1, npotu
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'
96
 
         write(6,8000) lo
97
 
         write(6,9030) (viou(lo+1,j),j=1,nrp)
98
 
   35 continue
99
 
c
100
 
c     Core and valence charge
101
 
c
102
 
      read(2) (cdc(j),j=1,nrp)
103
 
      read(2) (cdv(j),j=1,nrp)
104
 
c
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)
109
 
c
110
 
      stop
111
 
c
112
 
      end