2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-06-18 22:58:40 +08:00
|
|
|
! Copyright (C) 2001-2003 PWSCF group
|
2003-01-20 05:58:50 +08:00
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
program plotrho
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
! 2D contour plot - logarithmically or linearly spaced levels
|
|
|
|
! - negative values are shaded
|
|
|
|
! - contours plus gray levels
|
|
|
|
! - Postscript printable output
|
|
|
|
!
|
|
|
|
#include "machine.h"
|
2003-11-06 17:41:13 +08:00
|
|
|
USE io_global, ONLY : stdout
|
|
|
|
use parameters, only : DP
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
|
|
|
integer :: nwrk, nximax, nyimax, nxmax, nymax, nlevelx, nax
|
2003-01-20 05:58:50 +08:00
|
|
|
parameter (nwrk = 10000, nximax = 64, nyimax = 64, nxmax = 128, &
|
|
|
|
nymax = 128, nlevelx = 19, nax = 130)
|
|
|
|
integer :: ityp (nax), nxi, nyi, nx, ny, i, j, k, nlevels, na, &
|
2003-06-12 15:43:14 +08:00
|
|
|
nat, ierr, ilen
|
2003-01-20 05:58:50 +08:00
|
|
|
real(kind=DP) :: rhoi (0:nximax, 0:nyimax), xi (0:nximax), yi (0: &
|
|
|
|
nyimax), rhoo (0:nxmax, 0:nymax), x (0:nxmax), y (0:nymax), &
|
2003-06-18 22:58:40 +08:00
|
|
|
z (0:nlevelx), wrk (nwrk), xmin, xmax, ymin, ymax, rhomin, &
|
|
|
|
rhomax, rhoomin, rhoomax
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: xdim, ydim, xs, ys
|
|
|
|
real(kind=DP) :: r0 (3), tau1 (3), tau2 (3), tau (3, nax)
|
|
|
|
real(kind=DP) :: at (3, 3), a0
|
2003-04-13 03:25:08 +08:00
|
|
|
character (len=80) :: filename, fileout, ans * 1
|
2003-06-12 15:43:14 +08:00
|
|
|
integer, external :: iargc
|
|
|
|
logical :: logarithmic_scale
|
2003-02-08 00:04:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
i = iargc ()
|
2003-06-18 22:58:40 +08:00
|
|
|
if (i == 0) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("input file > ",$)')
|
2003-02-08 00:04:36 +08:00
|
|
|
read (5, '(a)', end = 20, err = 20) filename
|
2003-06-18 22:58:40 +08:00
|
|
|
elseif (i == 1) then
|
2003-02-08 00:04:36 +08:00
|
|
|
call getarg (1, filename)
|
|
|
|
else
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("usage: plotrho [input file] ")')
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
open (unit = 1, file = filename, form = 'formatted', status = &
|
|
|
|
'old', iostat = i)
|
2003-06-18 22:58:40 +08:00
|
|
|
if (i /= 0) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Error: file not found ")')
|
2003-02-08 00:04:36 +08:00
|
|
|
stop
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-06-18 22:58:40 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
read (1, * ) nxi, nyi
|
2003-06-18 22:58:40 +08:00
|
|
|
if (nxi > nximax .or. nyi > nyimax) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Error: nx or ny too big ")')
|
2003-02-08 00:04:36 +08:00
|
|
|
stop
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
read (1, * ) (xi (i), i = 0, nxi)
|
|
|
|
read (1, * ) (yi (j), j = 0, nyi)
|
|
|
|
read (1, * ) ( (rhoi (i, j), i = 0, nxi), j = 0, nyi)
|
|
|
|
read (1, * ) r0
|
|
|
|
read (1, * ) tau1
|
|
|
|
read (1, * ) tau2
|
|
|
|
read (1, * ) nat
|
2003-06-18 22:58:40 +08:00
|
|
|
if (nat > nax) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Error: too many atoms (",i4,", max:",i4,")")') nat, nax
|
2003-02-08 00:04:36 +08:00
|
|
|
stop
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
read (1, * ) ( (tau (j, na), j = 1, 3), ityp (na), na = 1, nat)
|
|
|
|
read (1, * ) a0
|
|
|
|
read (1, * ) at
|
|
|
|
close (unit = 1)
|
2003-06-18 22:58:40 +08:00
|
|
|
!
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("r0 : ",3f8.4)') r0
|
|
|
|
WRITE( stdout, '("tau1 : ",3f8.4)') tau1
|
|
|
|
WRITE( stdout, '("tau2 : ",3f8.4)') tau2
|
2003-06-18 22:58:40 +08:00
|
|
|
!
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("read",i4," atomic positions")') nat
|
|
|
|
! WRITE( stdout,'("Atomic positions:")')
|
|
|
|
! WRITE( stdout,'(3f8.4)') ( (tau(j,na),j=1,3),na=1,nat)
|
|
|
|
WRITE( stdout, '("output file > ",$)')
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
read (5, '(a)') fileout
|
2003-06-18 22:58:40 +08:00
|
|
|
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Read ",i3," *",i3," grid")') nxi+1, nyi+1
|
2003-06-18 22:58:40 +08:00
|
|
|
#ifdef __AIX
|
|
|
|
!
|
|
|
|
! interpolation implemented only for ESSL routines ...
|
|
|
|
!
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("nx, ny (output) > ",$)')
|
2003-02-08 00:04:36 +08:00
|
|
|
read (5, * ) nx, ny
|
2003-06-18 22:58:40 +08:00
|
|
|
if (nx > nxmax .or. ny > nymax) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Error: nx or ny too big ")')
|
2003-02-08 00:04:36 +08:00
|
|
|
stop
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-06-18 22:58:40 +08:00
|
|
|
#else
|
|
|
|
nx = nxi
|
|
|
|
ny = nyi
|
|
|
|
#endif
|
2003-02-08 00:04:36 +08:00
|
|
|
xmin = xi (0)
|
|
|
|
xmax = xi (nxi)
|
|
|
|
do i = 0, nx
|
|
|
|
x (i) = (xi (nxi) - xi (0) ) * float (i) / float (nx)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-01-29 16:17:04 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
ymin = yi (0)
|
|
|
|
ymax = yi (nyi)
|
|
|
|
do i = 0, ny
|
|
|
|
y (i) = (yi (nyi) - yi (0) ) * float (i) / float (ny)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-23 19:34:24 +08:00
|
|
|
#ifdef __AIX
|
2003-01-20 05:58:50 +08:00
|
|
|
call dcsin2 (xi, yi, rhoi, nxi + 1, nyi + 1, nximax + 1, x, y, nx &
|
|
|
|
+ 1, ny + 1, rhoo, nxmax + 1, wrk, nwrk)
|
|
|
|
#else
|
2003-06-18 22:58:40 +08:00
|
|
|
rhoo (0:nx, 0:ny) = rhoi (0:nx, 0:ny)
|
2003-01-20 05:58:50 +08:00
|
|
|
#endif
|
2003-06-18 22:58:40 +08:00
|
|
|
rhomin = minval (rhoo(0:nx, 0:ny))
|
|
|
|
rhomax = maxval (rhoo(0:nx, 0:ny))
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-06-18 22:58:40 +08:00
|
|
|
if (rhomin > 0.d0) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout,'("Logarithmic scale (y/n)? > ",$)')
|
2003-06-18 22:58:40 +08:00
|
|
|
read (5, '(a)') ans
|
|
|
|
logarithmic_scale = ans.ne.'n'.and.ans.ne.'N'
|
|
|
|
else
|
|
|
|
logarithmic_scale = .false.
|
|
|
|
end if
|
|
|
|
10 continue
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Bounds: ",2f12.6)') rhomin, rhomax
|
|
|
|
WRITE( stdout, '("min, max, # of levels > ",$)')
|
2003-02-08 00:04:36 +08:00
|
|
|
read (5, * ) rhoomin, rhoomax, nlevels
|
2003-06-18 22:58:40 +08:00
|
|
|
if ( rhoomax <= rhoomin .or. &
|
|
|
|
rhoomin >= rhomax .or. rhoomax <= rhomin ) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Out of Bounds! try again")')
|
2003-06-18 22:58:40 +08:00
|
|
|
go to 10
|
|
|
|
end if
|
|
|
|
if (nlevels > nlevelx) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Too many levels, reducing to allowed max:",i4))') &
|
2003-06-18 22:58:40 +08:00
|
|
|
nlevelx
|
|
|
|
nlevels = nlevelx
|
|
|
|
else if (nlevels < 1) then
|
2003-11-06 17:41:13 +08:00
|
|
|
WRITE( stdout, '("Too few levels! assuming 1 level"))')
|
2003-06-18 22:58:40 +08:00
|
|
|
nlevels = 1
|
|
|
|
end if
|
2003-02-08 00:04:36 +08:00
|
|
|
if (logarithmic_scale) then
|
|
|
|
do k = 0, nlevels - 1
|
2003-01-20 05:58:50 +08:00
|
|
|
z (k) = exp (log (rhoomin) + (log (rhoomax) - log (rhoomin) ) &
|
|
|
|
* float (k) / (nlevels - 1) )
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
|
|
|
do k = 0, nlevels - 1
|
2003-01-29 16:17:04 +08:00
|
|
|
z (k) = rhoomin + (rhoomax - rhoomin) * float (k) / (nlevels - 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
z (nlevels) = z (nlevels - 1)
|
2003-01-29 16:17:04 +08:00
|
|
|
xdim = 15.0 * (xmax - xmin) / sqrt ( (xmax - xmin) **2 + (ymax - ymin) **2)
|
|
|
|
ydim = 15.0 * (ymax - ymin) / sqrt ( (xmax - xmin) **2 + (ymax - ymin) **2)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
xs = 4.0
|
|
|
|
ys = 3.0
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
call cplot (rhoo, nxmax, nymax, x, xmin, xmax, nx, y, ymin, ymax, &
|
|
|
|
ny, nlevels, z, xdim, ydim, xs, ys, filename, fileout)
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call atomi (nat, tau, ityp, at, a0, r0, tau1, tau2, xdim, ydim)
|
|
|
|
20 stop
|
2003-01-20 05:58:50 +08:00
|
|
|
end program plotrho
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
subroutine cplot (d, imax, jmax, x, xmin, xmax, iub, y, ymin, &
|
|
|
|
ymax, jub, nc, z, xdim, ydim, xs, ys, str, filename)
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! draws a contour plot of d(i,j). PostScript output on unit 1
|
|
|
|
! F.Gygi Dec.15 1987 - P. Giannozzi Oct.6 1989 and later
|
|
|
|
! Algorithm by Paul D. Bourke, Byte magazine, june 1987, p. 143
|
|
|
|
! d(0:imax,0:jmax) contains the function to plot
|
|
|
|
! x(0:imax) workspace
|
|
|
|
! xmin,xmax determines the range of the variable x
|
|
|
|
! iub is the number of intervals along the x axis (<=imax)
|
|
|
|
! y(0:jmax) workspace
|
|
|
|
! idem for ymin,ymax and jub (<=jmax)
|
|
|
|
! nc is the number of levels wanted ( <=ncmax),
|
|
|
|
! z(0:nc) are the levels,
|
|
|
|
! xdim and ydim are the physical dimensions of the figure in cm
|
|
|
|
! xs and ys determine a shift of the origin in cm
|
|
|
|
use parameters, only: DP
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
|
|
|
integer :: imax, jmax, iub, jub, nc
|
|
|
|
real(kind=DP) :: d (0:imax, 0:jmax), x (0:imax), y (0:jmax), z (0:nc)
|
|
|
|
real(kind=DP) :: xmin, xmax, ymin, ymax, xdim, ydim, xs, ys
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-04-13 03:25:08 +08:00
|
|
|
character (len=*) :: filename, str
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: ncmax
|
|
|
|
parameter (ncmax = 19)
|
|
|
|
integer :: i, j, k
|
|
|
|
real(kind=DP) :: gray (0:ncmax), dim, cm, width, gray0, deltagray
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
data cm / 28.453 /, width / 0.5 /, gray0 / 1.0 /, deltagray / 0.7 /
|
|
|
|
! cm : number of points per cm
|
|
|
|
! width: linewidth of the contour plot for PostScript printer
|
|
|
|
|
|
|
|
open (unit = 1, file = filename, status = 'unknown', form = &
|
|
|
|
'formatted')
|
2003-02-08 00:04:36 +08:00
|
|
|
if (nc.gt.ncmax.or.nc.lt.1) stop ' nc too big or wrong'
|
|
|
|
if (iub.gt.imax.or.iub.lt.1) stop ' iub too big or wrong'
|
|
|
|
if (jub.gt.jmax.or.jub.lt.1) stop ' jub too big or wrong'
|
|
|
|
if (xdim.lt.3.0.or.ydim.lt.3.0) stop ' really too small!'
|
|
|
|
if (xdim.gt.20.0.or.ydim.gt.30.0) stop ' really too big!'
|
|
|
|
if (abs (xs) .gt.20.or.abs (ys) .gt.30) stop ' xs or ys are weird'
|
2003-01-20 05:58:50 +08:00
|
|
|
! initializations for PostScript output
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '%! PS-Adobe-1.0'
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '("%%BoundingBox:",4f6.1)') xs * cm, ys * cm, (xs + &
|
|
|
|
xdim) * cm, (ys + ydim) * cm
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '/localdict 100 dict def'
|
|
|
|
write (1, '(a)') 'localdict begin'
|
|
|
|
write (1, '(a)') '/cm {28.453 mul} def'
|
|
|
|
write (1, '(a)') '/title {('//str//')} def'
|
|
|
|
write (1, '(a)') '/Times-Roman findfont 12 scalefont setfont'
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(a)') '% cshow prints a centered string at current position'
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '/cshow {gsave dup stringwidth pop 2 div neg 0'
|
|
|
|
write (1, '(a)') ' rmoveto show grestore} def'
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(a)') '% x1 y1 x2 y2 p : draws a segment from point 1 to point 2'
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '/p {0 setgray newpath moveto lineto stroke} def'
|
|
|
|
write (1, '(a)') '% x1 y1 x2 y2 x3 y3 x4 y4 sn :'
|
|
|
|
write (1, '(a)') '% fills the region bounded by points 1 to 4'
|
|
|
|
write (1, '(a)') '% with greyscale n'
|
2003-01-20 05:58:50 +08:00
|
|
|
! type of gray for shaded areas
|
2003-02-08 00:04:36 +08:00
|
|
|
do k = 0, nc
|
|
|
|
gray (k) = gray0 - k * deltagray / nc
|
|
|
|
if (k.lt.10) then
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '("/s",i1," {",f4.2," setgray newpath ", &
|
|
|
|
& "moveto lineto lineto lineto fill} def")') k, gray (k)
|
|
|
|
write (1, '("/t",i1," {",f4.2," setgray newpath ", &
|
|
|
|
& "moveto lineto lineto fill} def")') k, gray (k)
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '("/u",i1," {",f4.2," setgray newpath ", &
|
|
|
|
& "moveto lineto lineto lineto fill} def")') mod (k, 10) , &
|
|
|
|
&gray (k)
|
|
|
|
write (1, '("/v",i1," {",f4.2," setgray newpath ", &
|
|
|
|
& "moveto lineto lineto fill} def")') mod (k, 10) , gray (k &
|
|
|
|
&)
|
|
|
|
endif
|
|
|
|
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '%%EndPreamble'
|
|
|
|
write (1, '(a)') 'gsave'
|
|
|
|
write (1, '(1x,f6.2," cm ",f6.2," cm translate")') xs, ys
|
|
|
|
write (1, '(a)') '% Uncomment next line if you want a big picture'
|
|
|
|
write (1, '(a)') '% 1.8 1.8 scale'
|
|
|
|
write (1, '(f7.3," setlinewidth")') width
|
|
|
|
write (1, '(a)') '% Comment the next line to remove the title'
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
write (1, '(1x,f6.2," cm ",f6.2," cm moveto title cshow")') &
|
|
|
|
xdim / 2, ydim + 1.5
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call hatch (0.d0, xdim, 0.d0, ydim)
|
|
|
|
do i = 0, iub
|
|
|
|
x (i) = xdim * float (i) / iub
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
do j = 0, jub
|
|
|
|
y (j) = ydim * float (j) / jub
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
enddo
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call conrec (imax, iub, jmax, jub, x, y, d, nc, z)
|
2003-01-20 05:58:50 +08:00
|
|
|
! draw frame of size xdim by ydim
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '1 setlinewidth 0 setgray newpath'
|
|
|
|
write (1, '(2f6.1," moveto")') 0.0, 0.0
|
|
|
|
write (1, '(2f6.1," lineto")') xdim * cm, 0.0
|
|
|
|
write (1, '(2f6.1," lineto")') xdim * cm, ydim * cm
|
|
|
|
write (1, '(2f6.1," lineto")') 0.0, ydim * cm
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') 'closepath stroke'
|
2003-01-20 05:58:50 +08:00
|
|
|
! write (1,'(a)') 'grestore'
|
|
|
|
! write (1,'(a)') '%%Trailer'
|
|
|
|
! write (1,'(a)') 'showpage'
|
|
|
|
! close(1)
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
end subroutine cplot
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine conrec (imax, iub, jmax, jub, x, y, d, nc, z)
|
2003-01-20 05:58:50 +08:00
|
|
|
use parameters, only: DP
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
|
|
|
integer :: imax, iub, jmax, jub, nc
|
|
|
|
|
|
|
|
real(kind=DP) :: d (0:imax, 0:jmax), x (0:imax), y (0:jmax), z (0:nc)
|
|
|
|
integer :: ncmax
|
|
|
|
parameter (ncmax = 19)
|
|
|
|
character (len=4) :: triangle (0:ncmax), trapez (0:ncmax)
|
|
|
|
real(kind=DP) :: h (0:4), xh (0:4), yh (0:4)
|
2003-01-20 05:58:50 +08:00
|
|
|
real(kind=DP) :: x1, y1, x2, y2, x3, y3, x4, y4, dx, dy, xx, yy, cm, &
|
|
|
|
dmin, dmax
|
|
|
|
! cm : conversion factor from cm to points for PostScript
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: ish (0:4), im (0:3), jm (0:3), castab (0:2, 0:2, 0:2)
|
2003-01-20 05:58:50 +08:00
|
|
|
integer :: i, j, k, m, m1, m2, m3, npoint, icase, levelin, &
|
|
|
|
nolevel
|
2003-02-08 00:04:36 +08:00
|
|
|
data cm / 28.453 /
|
|
|
|
data (im (i), i = 0, 3) / 0, 1, 1, 0 /
|
|
|
|
data (jm (i), i = 0, 3) / 0, 0, 1, 1 /
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
data ( ( (castab (i, j, k), k = 0, 2), j = 0, 2), i = 0, 2) &
|
|
|
|
/ 0, 0, 8, 0, 2, 5, 7, 6, 9, 0, 3, 4, 1, 3, 1, 4, 3, 0, 9, 6, 7, &
|
|
|
|
5, 2, 0, 8, 0, 0 /
|
2003-02-08 00:04:36 +08:00
|
|
|
dy = (y (jub) - y (0) ) / (nc + 1)
|
|
|
|
xx = x (iub) + 1.0
|
|
|
|
dx = 0.5
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '% Start of Color Code'
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call hatch (xx, xx + dx, y (0), y (jub) )
|
|
|
|
do k = 0, nc
|
|
|
|
yy = y (jub) - k * dy
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(8f6.1,$)') xx * cm, yy * cm, (xx + dx) * cm, yy * cm, &
|
|
|
|
(xx + dx) * cm, (yy - dy) * cm, xx * cm, (yy - dy) * cm
|
2003-02-08 00:04:36 +08:00
|
|
|
if (k.lt.10) then
|
|
|
|
write (triangle (k) , '(" t",i1,1x)') k
|
|
|
|
write (trapez (k) , '(" s",i1,1x)') k
|
|
|
|
else
|
|
|
|
write (triangle (k) , '(" v",i1)') mod (k, 10)
|
|
|
|
write (trapez (k) , '(" u",i1)') mod (k, 10)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a4)') trapez (k)
|
|
|
|
write (1, * ) '0 setgray newpath'
|
|
|
|
write (1, '(2f6.1," moveto")') xx * cm, yy * cm
|
|
|
|
write (1, '(2f6.1," lineto")') (xx + dx) * cm, yy * cm
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(2f6.1," lineto")') (xx + dx) * cm, (yy - dy) &
|
|
|
|
* cm
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(2f6.1," lineto")') xx * cm, (yy - dy) * cm
|
|
|
|
write (1, * ) 'closepath stroke'
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(2f6.1," moveto")') (x (iub) + 2.0) * cm, (yy - dy / &
|
|
|
|
2) * cm
|
2003-02-08 00:04:36 +08:00
|
|
|
if (k.eq.0) then
|
|
|
|
write (1, '("(z<",f7.5,") show")') z (0)
|
|
|
|
elseif (k.eq.nc) then
|
|
|
|
write (1, '("(z>",f7.5,") show")') z (nc - 1)
|
|
|
|
else
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '("(",f7.5,"<z<",f7.5,") show")') z (k - 1) , &
|
|
|
|
z (k)
|
|
|
|
endif
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '% End of Color Code'
|
|
|
|
do k = 1, nc - 1
|
|
|
|
if (z (k) .le.z (k - 1) ) stop 'zk order'
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
enddo
|
|
|
|
! scan the array, top down, left to right, to paint shaded areas
|
2003-02-08 00:04:36 +08:00
|
|
|
do j = jub - 1, 0, - 1
|
|
|
|
do i = 0, iub - 1
|
2003-01-20 05:58:50 +08:00
|
|
|
! find lowest and highest vertex
|
|
|
|
dmin = min (d (i, j), d (i, j + 1), d (i + 1, j), d (i + 1, j + 1) &
|
|
|
|
)
|
|
|
|
dmax = max (d (i, j), d (i, j + 1), d (i + 1, j), d (i + 1, j + 1) &
|
|
|
|
)
|
|
|
|
! search for levels in this box
|
2003-02-08 00:04:36 +08:00
|
|
|
nolevel = 0
|
|
|
|
do k = 0, nc - 1
|
|
|
|
if (z (k) .lt.dmin) nolevel = k + 1
|
|
|
|
if (z (k) .ge.dmin.and.z (k) .le.dmax) then
|
|
|
|
levelin = k
|
|
|
|
goto 10
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
! no level in this box: paint the whole box and pass to another box
|
|
|
|
write (1, '(8f6.1,a4)') x (i) * cm, y (j) * cm, x (i + 1) * cm, y &
|
|
|
|
(j) * cm, x (i + 1) * cm, y (j + 1) * cm, x (i) * cm, y (j + 1) &
|
|
|
|
* cm, trapez (nolevel)
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
goto 100
|
2003-01-20 05:58:50 +08:00
|
|
|
! there is at least a level in this box: paint the whole box
|
2003-02-08 00:04:36 +08:00
|
|
|
10 continue
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(8f6.1,a4)') x (i) * cm, y (j) * cm, x (i + 1) * cm, y &
|
|
|
|
(j) * cm, x (i + 1) * cm, y (j + 1) * cm, x (i) * cm, y (j + 1) &
|
|
|
|
* cm, trapez (levelin)
|
2003-02-08 00:04:36 +08:00
|
|
|
do k = levelin, nc - 1
|
2003-01-20 05:58:50 +08:00
|
|
|
! if no more levels in this box, pas to another box
|
2003-02-08 00:04:36 +08:00
|
|
|
if (z (k) .gt.dmax) goto 100
|
2003-01-20 05:58:50 +08:00
|
|
|
! find contour of zero levels in this box
|
2003-02-08 00:04:36 +08:00
|
|
|
do m = 1, 4
|
|
|
|
h (m) = d (i + im (m - 1), j + jm (m - 1) ) - z (k)
|
|
|
|
xh (m) = x (i + im (m - 1) )
|
|
|
|
yh (m) = y (j + jm (m - 1) )
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
h (0) = (h (1) + h (2) + h (3) + h (4) ) / 4
|
|
|
|
xh (0) = (x (i) + x (i + 1) ) / 2
|
|
|
|
yh (0) = (y (j) + y (j + 1) ) / 2
|
|
|
|
do m = 0, 4
|
|
|
|
if (h (m) .gt.0) then
|
|
|
|
ish (m) = 2
|
|
|
|
elseif (h (m) .lt.0) then
|
|
|
|
ish (m) = 0
|
|
|
|
else
|
|
|
|
ish (m) = 1
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
enddo
|
|
|
|
! scan each triangle in the box to paint shaded areas
|
2003-02-08 00:04:36 +08:00
|
|
|
do m = 1, 4
|
|
|
|
m1 = m
|
|
|
|
m2 = 0
|
|
|
|
m3 = mod (m, 4) + 1
|
|
|
|
npoint = 0
|
|
|
|
icase = castab (ish (m1), ish (m2), ish (m3) )
|
|
|
|
if (icase.eq.0) then
|
|
|
|
if (ish (m1) .eq.2) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! paint this triangle if positive
|
2003-02-08 00:04:36 +08:00
|
|
|
x1 = xh (m1)
|
|
|
|
y1 = yh (m1)
|
|
|
|
x2 = xh (m2)
|
|
|
|
y2 = yh (m2)
|
|
|
|
x3 = xh (m3)
|
|
|
|
y3 = yh (m3)
|
|
|
|
npoint = 3
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
elseif (icase.eq.1) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between vertices m1 and m2
|
2003-02-08 00:04:36 +08:00
|
|
|
x1 = xh (m1)
|
|
|
|
y1 = yh (m1)
|
|
|
|
x2 = xh (m2)
|
|
|
|
y2 = yh (m2)
|
|
|
|
if (ish (m3) .eq.2) then
|
|
|
|
x3 = xh (m3)
|
|
|
|
y3 = yh (m3)
|
|
|
|
npoint = 3
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
elseif (icase.eq.2) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between vertices m2 and m3
|
2003-02-08 00:04:36 +08:00
|
|
|
x1 = xh (m2)
|
|
|
|
y1 = yh (m2)
|
|
|
|
x2 = xh (m3)
|
|
|
|
y2 = yh (m3)
|
|
|
|
if (ish (m1) .eq.2) then
|
|
|
|
x3 = xh (m1)
|
|
|
|
y3 = yh (m1)
|
|
|
|
npoint = 3
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
elseif (icase.eq.3) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between vertices m3 and m1
|
2003-02-08 00:04:36 +08:00
|
|
|
x1 = xh (m3)
|
|
|
|
y1 = yh (m3)
|
|
|
|
x2 = xh (m1)
|
|
|
|
y2 = yh (m1)
|
|
|
|
if (ish (m2) .eq.2) then
|
|
|
|
x3 = xh (m2)
|
|
|
|
y3 = yh (m2)
|
|
|
|
npoint = 3
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
elseif (icase.eq.4) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between vertex m1 and side m2-m3
|
2003-02-08 00:04:36 +08:00
|
|
|
x1 = xh (m1)
|
|
|
|
y1 = yh (m1)
|
2003-01-20 05:58:50 +08:00
|
|
|
x2 = (h (m3) * xh (m2) - h (m2) * xh (m3) ) / (h (m3) - h (m2) &
|
|
|
|
)
|
|
|
|
y2 = (h (m3) * yh (m2) - h (m2) * yh (m3) ) / (h (m3) - h (m2) &
|
|
|
|
)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (ish (m3) .eq.2) then
|
|
|
|
x3 = xh (m3)
|
|
|
|
y3 = yh (m3)
|
|
|
|
else
|
|
|
|
x3 = xh (m2)
|
|
|
|
y3 = yh (m2)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
npoint = 3
|
|
|
|
elseif (icase.eq.5) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between vertex m2 and side m3-m1
|
2003-02-08 00:04:36 +08:00
|
|
|
x1 = xh (m2)
|
|
|
|
y1 = yh (m2)
|
2003-01-20 05:58:50 +08:00
|
|
|
x2 = (h (m1) * xh (m3) - h (m3) * xh (m1) ) / (h (m1) - h (m3) &
|
|
|
|
)
|
|
|
|
y2 = (h (m1) * yh (m3) - h (m3) * yh (m1) ) / (h (m1) - h (m3) &
|
|
|
|
)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (ish (m1) .eq.2) then
|
|
|
|
x3 = xh (m1)
|
|
|
|
y3 = yh (m1)
|
|
|
|
else
|
|
|
|
x3 = xh (m3)
|
|
|
|
y3 = yh (m3)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
npoint = 3
|
|
|
|
elseif (icase.eq.6) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between vertex m3 and line m1-m2
|
2003-02-08 00:04:36 +08:00
|
|
|
x1 = xh (m3)
|
|
|
|
y1 = yh (m3)
|
2003-01-20 05:58:50 +08:00
|
|
|
x2 = (h (m2) * xh (m1) - h (m1) * xh (m2) ) / (h (m2) - h (m1) &
|
|
|
|
)
|
|
|
|
y2 = (h (m2) * yh (m1) - h (m1) * yh (m2) ) / (h (m2) - h (m1) &
|
|
|
|
)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (ish (m2) .eq.2) then
|
|
|
|
x3 = xh (m2)
|
|
|
|
y3 = yh (m2)
|
|
|
|
else
|
|
|
|
x3 = xh (m1)
|
|
|
|
y3 = yh (m1)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
npoint = 3
|
|
|
|
elseif (icase.eq.7) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between sides m1-m2 and m2-m3
|
|
|
|
x1 = (h (m2) * xh (m1) - h (m1) * xh (m2) ) / (h (m2) - h (m1) &
|
|
|
|
)
|
|
|
|
y1 = (h (m2) * yh (m1) - h (m1) * yh (m2) ) / (h (m2) - h (m1) &
|
|
|
|
)
|
|
|
|
x2 = (h (m3) * xh (m2) - h (m2) * xh (m3) ) / (h (m3) - h (m2) &
|
|
|
|
)
|
|
|
|
y2 = (h (m3) * yh (m2) - h (m2) * yh (m3) ) / (h (m3) - h (m2) &
|
|
|
|
)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (ish (m2) .eq.2) then
|
|
|
|
x3 = xh (m2)
|
|
|
|
y3 = yh (m2)
|
|
|
|
npoint = 3
|
|
|
|
else
|
|
|
|
x3 = xh (m3)
|
|
|
|
y3 = yh (m3)
|
|
|
|
x4 = xh (m1)
|
|
|
|
y4 = yh (m1)
|
|
|
|
npoint = 4
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
elseif (icase.eq.8) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between sides m2-m3 and m3-m1
|
|
|
|
x1 = (h (m3) * xh (m2) - h (m2) * xh (m3) ) / (h (m3) - h (m2) &
|
|
|
|
)
|
|
|
|
y1 = (h (m3) * yh (m2) - h (m2) * yh (m3) ) / (h (m3) - h (m2) &
|
|
|
|
)
|
|
|
|
x2 = (h (m1) * xh (m3) - h (m3) * xh (m1) ) / (h (m1) - h (m3) &
|
|
|
|
)
|
|
|
|
y2 = (h (m1) * yh (m3) - h (m3) * yh (m1) ) / (h (m1) - h (m3) &
|
|
|
|
)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (ish (m3) .eq.2) then
|
|
|
|
x3 = xh (m3)
|
|
|
|
y3 = yh (m3)
|
|
|
|
npoint = 3
|
|
|
|
else
|
|
|
|
x3 = xh (m1)
|
|
|
|
y3 = yh (m1)
|
|
|
|
x4 = xh (m2)
|
|
|
|
y4 = yh (m2)
|
|
|
|
npoint = 4
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
elseif (icase.eq.9) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! line between sides m3-m1 and m1-m2
|
|
|
|
x1 = (h (m1) * xh (m3) - h (m3) * xh (m1) ) / (h (m1) - h (m3) &
|
|
|
|
)
|
|
|
|
y1 = (h (m1) * yh (m3) - h (m3) * yh (m1) ) / (h (m1) - h (m3) &
|
|
|
|
)
|
|
|
|
x2 = (h (m2) * xh (m1) - h (m1) * xh (m2) ) / (h (m2) - h (m1) &
|
|
|
|
)
|
|
|
|
y2 = (h (m2) * yh (m1) - h (m1) * yh (m2) ) / (h (m2) - h (m1) &
|
|
|
|
)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (ish (m1) .eq.2) then
|
|
|
|
x3 = xh (m1)
|
|
|
|
y3 = yh (m1)
|
|
|
|
npoint = 3
|
|
|
|
else
|
|
|
|
x3 = xh (m2)
|
|
|
|
y3 = yh (m2)
|
|
|
|
x4 = xh (m3)
|
|
|
|
y4 = yh (m3)
|
|
|
|
npoint = 4
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
if (npoint.eq.3) then
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(6f6.1,a4)') x1 * cm, y1 * cm, x2 * cm, y2 * cm, x3 &
|
|
|
|
* cm, y3 * cm, triangle (k + 1)
|
2003-02-08 00:04:36 +08:00
|
|
|
elseif (npoint.eq.4) then
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(8f6.1,a4)') x1 * cm, y1 * cm, x2 * cm, y2 * cm, x3 &
|
|
|
|
* cm, y3 * cm, x4 * cm, y4 * cm, trapez (k + 1)
|
|
|
|
endif
|
|
|
|
if (icase.ne.0) write (1, '(4f6.1," p")') x1 * cm, y1 * cm, x2 * &
|
|
|
|
cm, y2 * cm
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
100 continue
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine conrec
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
subroutine atomi (nat, tau, ityp, at, a0, r0, tau1, tau2, xdim, ydim)
|
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
use parameters, only: DP
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
|
|
|
integer :: nat, ityp (nat)
|
2003-01-29 16:17:04 +08:00
|
|
|
real(kind=DP) :: tau (3, nat), at (3, 3), r0 (3), tau1 (3), tau2 (3), a0
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: xdim, ydim
|
|
|
|
integer :: n1, n2, n3, i, n
|
2003-01-29 16:17:04 +08:00
|
|
|
real(kind=DP) :: r (3), ri (3), tau1n, tau2n, delta, delta0, cm, r1, r2, r3
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
parameter (delta = 1.0, cm = 28.453)
|
2003-01-20 05:58:50 +08:00
|
|
|
! Soluzione piu' che provvisoria con algoritmo mongolissimo:
|
|
|
|
! genera tutti (si spera) gli atomi che stanno dentro al rettangolo
|
2003-02-08 00:04:36 +08:00
|
|
|
delta0 = delta / a0
|
|
|
|
tau1n = sqrt (tau1 (1) **2 + tau1 (2) **2 + tau1 (3) **2)
|
|
|
|
tau2n = sqrt (tau2 (1) **2 + tau2 (2) **2 + tau2 (3) **2)
|
2003-01-20 05:58:50 +08:00
|
|
|
! clippa il rettangolo
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') 'gsave newpath'
|
|
|
|
write (1, '(2f6.1," moveto")') 0.0, 0.0
|
|
|
|
write (1, '(2f6.1," lineto")') xdim * cm, 0.0
|
|
|
|
write (1, '(2f6.1," lineto")') xdim * cm, ydim * cm
|
|
|
|
write (1, '(2f6.1," lineto")') 0.0, ydim * cm
|
|
|
|
|
|
|
|
write (1, '(a)') 'closepath clip stroke'
|
|
|
|
do n1 = - 3, + 3
|
|
|
|
do n2 = - 3, + 3
|
|
|
|
do n3 = - 3, + 3
|
|
|
|
do i = 1, 3
|
|
|
|
r (i) = n1 * at (i, 1) + n2 * at (i, 2) + n3 * at (i, 3)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
do n = 1, nat
|
|
|
|
do i = 1, 3
|
|
|
|
ri (i) = tau (i, n) + r (i) - r0 (i)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
! questa e' la componente lungo la direzione 1 ...
|
|
|
|
r1 = (ri (1) * tau1 (1) + ri (2) * tau1 (2) + ri (3) * tau1 (3) ) &
|
|
|
|
/ tau1n
|
2003-02-08 00:04:36 +08:00
|
|
|
if (r1.gt. - delta0.and.r1.lt.tau1n + delta0) then
|
2003-01-20 05:58:50 +08:00
|
|
|
! e questa lungo la direzione 2 ...
|
|
|
|
r2 = (ri (1) * tau2 (1) + ri (2) * tau2 (2) + ri (3) * tau2 (3) &
|
|
|
|
) / tau2n
|
2003-02-08 00:04:36 +08:00
|
|
|
if (r2.gt. - delta0.and.r2.lt.tau2n + delta0) then
|
|
|
|
do i = 1, 3
|
2003-01-20 05:58:50 +08:00
|
|
|
ri (i) = ri (i) - r1 * tau1 (i) / tau1n - r2 * tau2 (i) &
|
|
|
|
/ tau2n
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
r3 = sqrt (ri (1) **2 + ri (2) **2 + ri (3) **2)
|
2003-01-20 05:58:50 +08:00
|
|
|
! e questa lungo la direzione ortogonale al piano
|
2003-02-08 00:04:36 +08:00
|
|
|
if (abs (r3) .lt.delta0) then
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(3f6.1," 0 360 arc gsave ",f4.2, &
|
|
|
|
& " setgray fill grestore stroke")') &
|
|
|
|
r1 / tau1n * xdim * cm, r2 / tau2n * ydim * cm,&
|
|
|
|
delta0 / tau1n * xdim * cm, abs (r3) / delta0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') 'grestore'
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') 'grestore'
|
|
|
|
write (1, '(a)') '%%Trailer'
|
|
|
|
write (1, '(a)') 'showpage'
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
close (1)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
end subroutine atomi
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine hatch (x1, x2, y1, y2)
|
2003-01-20 05:58:50 +08:00
|
|
|
use parameters, only: DP
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
|
|
|
real(kind=DP) :: x1, x2, y1, y2
|
|
|
|
real(kind=DP) :: cm, delta, dim
|
|
|
|
integer :: nhach, n
|
|
|
|
|
|
|
|
|
|
|
|
data cm / 28.453 /, delta / 0.2 /
|
|
|
|
write (1, '(a)') '% Beginning of hatching'
|
|
|
|
write (1, '(a)') 'gsave newpath'
|
|
|
|
write (1, '(2f6.1," moveto")') x1 * cm, y1 * cm
|
|
|
|
write (1, '(2f6.1," lineto")') x2 * cm, y1 * cm
|
|
|
|
write (1, '(2f6.1," lineto")') x2 * cm, y2 * cm
|
|
|
|
write (1, '(2f6.1," lineto")') x1 * cm, y2 * cm
|
|
|
|
write (1, '(a)') 'closepath clip'
|
|
|
|
|
|
|
|
dim = max (x2 - x1, y2 - y1)
|
|
|
|
nhach = dim / delta
|
2003-01-20 05:58:50 +08:00
|
|
|
! delta=dim/nhach
|
2003-02-08 00:04:36 +08:00
|
|
|
do n = 1, nhach
|
2003-01-20 05:58:50 +08:00
|
|
|
write (1, '(4f6.1," p")') (x1 + (n - 1) * delta) * cm, y1 * cm, &
|
|
|
|
(x1 + dim) * cm, (y1 + dim - (n - 1) * delta) * cm
|
|
|
|
write (1, '(4f6.1," p")') x1 * cm, (y1 + (n - 1) * delta) &
|
|
|
|
* cm, (x1 + dim - (n - 1) * delta) * cm, (y1 + dim) * cm
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') 'grestore'
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
write (1, '(a)') '% End of hatching'
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine hatch
|