      subroutine dslash (xyz,x,ierr)                                    DSLA001
c ----------------------------------------------------------------------DSLA002
c     transform fractionals to rationals                                DSLA003
c ----------------------------------------------------------------------DSLA004
c     This program module is part of the PhysiSoft X-ray Library        DSLA005
c     and may not be sold or reproduced for commercial purposes.        DSLA006
c     Although it has been tested carefully, there is no warranty       DSLA007
c     regarding accuracy or freedom from side-effects.                  DSLA008
c                   (C) 1986-1990 Bernhard Rupp                         DSLA009
c ----------------------------------------------------------------------DSLA010
                                                                        DSLA011
      character id(14),ps(8),xyz*8                                      DSLA012
                                                                        DSLA013
      data (id(i),i=1,14) /'0','1','2','3','4','5','6','7','8','9',     DSLA014
     & '.','-',' ','/'/                                                 DSLA015
      ierr=0                                                            DSLA016
                                                                        DSLA017
      read (xyz,'(8a1)') (ps(i),i=1,8)                                  DSLA018
c     write (*,*) (ps(i),i=1,8)                                         DSLA019
c --- check if allowed characters only in position string ---           DSLA020
      isok=0                                                            DSLA021
      islash=0                                                          DSLA022
      do 0001 i=1,len(xyz)                                              DSLA023
         do 0002 j=1,14                                                 DSLA024
            if (ps(i).eq.id(14)) islash=i                               DSLA025
            if (ps(i).eq.id(j)) goto 0001                               DSLA026
 0002    continue                                                       DSLA027
         write (*,'(/a,i1,a,a,a)') ' Position ',i,' of input string ',  DSLA028
     &   'contains invalid symbol ',ps(i)                               DSLA029
         ierr=1                                                         DSLA030
         return                                                         DSLA031
 0001 continue                                                          DSLA032
c --- transform to real if no slash --                                  DSLA033
      if (islash.eq.0) then                                             DSLA034
c        write (*,*) ' No slash detected in ',xyz                       DSLA035
         read (xyz,'(f8.5)',err=9001) x                                 DSLA036
         if (abs(x).gt.1.0) then                                        DSLA037
            write (*,*) ' Atom coordinate exceeds 1.0 - invalid'        DSLA038
            ierr=1                                                      DSLA039
         end if                                                         DSLA040
         return                                                         DSLA041
      end if                                                            DSLA042
                                                                        DSLA043
c --- get zaehler                                                       DSLA044
      iascii=ichar(ps(islash-1))                                        DSLA045
      ze=float(iascii-48)                                               DSLA046
c --- get nenner                                                        DSLA047
      iascii=ichar(ps(islash+1))                                        DSLA048
      re=float(iascii-48)                                               DSLA049
      x=ze/re                                                           DSLA050
c --- get - sign                                                        DSLA051
      if ((islash-2).gt.0) then                                         DSLA052
         if (ps(islash-2).eq.'-') x= -1.0*x                             DSLA053
      end if                                                            DSLA054
      if (abs(x).gt.1.0) then                                           DSLA055
         write (*,*) ' Atom coordinate exceeds 1.0 - invalid'           DSLA056
         ierr=1                                                         DSLA057
      end if                                                            DSLA058
      return                                                            DSLA059
 9001 write (*,*) ' Invalid atom coordinate : ',xyz                     DSLA060
      ierr=1                                                            DSLA061
      return                                                            DSLA062
      end                                                               DSLA063
                                                                        DSLA064
                                                                        DSLA065
