Files
sics/difrac/pfind.f
cvs 714b8ae84d - Fixed a bug which caused the SICServer to die when a socket was broken.
- Fixed many things in DIFRAC subsystem:
  * Recoded tcentr.f etc so that the course centering will work and will not
    go into an endless loop.
  * fixed boundary overwrites which occurred when yesno or alfnum where
    uset to get a single character and several were given.
  * Addeded documentation for DIFRAC
- Added tcl-files which  support the WWW status system
2000-03-31 13:16:50 +00:00

56 lines
2.0 KiB
Fortran

C-----------------------------------------------------------------------
C Get the coarse value of Phi for PCENTR
C-----------------------------------------------------------------------
SUBROUTINE PFIND (TIM,MAXCOUNT)
INCLUDE 'COMDIF'
REAL MAXCOUNT, MCOUNT
DIMENSION PCOUNT(NSIZE)
EQUIVALENCE (ACOUNT(9*NSIZE + 1), PCOUNT(1))
C-----------------------------------------------------------------------
C If offset by 2.5 deg and do 20 0.25 deg steps then we should find
C the maximum.
C-----------------------------------------------------------------------
STEPM = 0.05
PSTEP = 0.25
NPTS = 20
NATT = 0
C-----------------------------------------------------------------------
C Offset phi to the start of the scan
C-----------------------------------------------------------------------
100 POFFS = PSTEP*10.0
PHI = PHI - POFFS
IF (PHI .LT. 0.0) PHI = PHI + 360.0
IF (PHI .GE. 360.0) PHI = PHI - 360.0
PHIOFF = PHI
CALL ANGSET (THETA,OMEGA,CHI,PHI,NATT,ICOL)
C-----------------------------------------------------------------------
C Find the max intensity either by step and count or by doing a scan,
C depending on the type of diffractometer
C-----------------------------------------------------------------------
ICOUNT = 0
MCOUNT = 0
DO 110 I = 1,NPTS
CALL CCTIME (TIM,PCOUNT(I))
CALL KORQ (IFLAG1)
IF (IFLAG1 .NE. 1) THEN
KI = 'O4'
RETURN
ENDIF
IF (PCOUNT(I) .GT. MCOUNT) THEN
MCOUNT = PCOUNT(I)
ICOUNT = I
ENDIF
PHI = PHI + PSTEP
IF (PHI .LT. 0.0) PHI = PHI + 360.0
IF (PHI .GE. 360.0) PHI = PHI - 360.0
CALL ANGSET (THETA,OMEGA,CHI,PHI,NATT,ICOL)
110 CONTINUE
MAXCOUNT = REAL(MCOUNT)
IF (ICOUNT .EQ. 1 .OR. ICOUNT .EQ. NPTS) THEN
TIM = -5.0
RETURN
ENDIF
PHI = PHIOFF + (ICOUNT - 1)*PSTEP
RETURN
END