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