1c
2c
3c     ###################################################
4c     ##  COPYRIGHT (C)  1992  by  Jay William Ponder  ##
5c     ##              All Rights Reserved              ##
6c     ###################################################
7c
8c     ###########################################################
9c     ##                                                       ##
10c     ##  subroutine getpdb  --  get a Protein Data Bank file  ##
11c     ##                                                       ##
12c     ###########################################################
13c
14c
15c     "getpdb" asks for a Protein Data Bank file name,
16c     then reads in the coordinates file
17c
18c
19      subroutine getpdb
20      use inform
21      use iounit
22      implicit none
23      integer ipdb,nask
24      integer freeunit
25      logical exist
26      character*240 pdbfile
27c
28c
29c     try to get a filename from the command line arguments
30c
31      call nextarg (pdbfile,exist)
32      if (exist) then
33         call basefile (pdbfile)
34         call suffix (pdbfile,'pdb','old')
35         inquire (file=pdbfile,exist=exist)
36      end if
37c
38c     ask for the user specified input structure filename
39c
40      nask = 0
41      do while (.not.exist .and. nask.lt.maxask)
42         nask = nask + 1
43         write (iout,10)
44   10    format (/,' Enter Protein Data Bank File Name :  ',$)
45         read (input,20)  pdbfile
46   20    format (a240)
47         call basefile (pdbfile)
48         call suffix (pdbfile,'pdb','old')
49         inquire (file=pdbfile,exist=exist)
50      end do
51      if (.not. exist)  call fatal
52c
53c     first open and then read the PDB coordinates file
54c
55      ipdb = freeunit ()
56      open (unit=ipdb,file=pdbfile,status='old')
57      rewind (unit=ipdb)
58      call readpdb (ipdb)
59      close (unit=ipdb)
60      return
61      end
62