CCL Home Page
Up Directory CCL wfn_sma
C======================================================================
C File: wfn.f
C RCS:  $Id: wfn.f,v 1.9 1994/05/04 15:47:54 lyndon Exp $
C======================================================================
C 05/6-DEC-92  Changed include statements and other small modifcations
C            due to new distribution description and include structure
C 04-AUGUST-94 Small changes to take advantage of the way T3D 
C              comunicates with the Y-MP. (ADS and RP).

C----------------------------------------------------------------------C
C File : wfn.sp                                                        C
C Created: 17/10/90 LJC                                                C
C History: See below                                                   C
C----------------------------------------------------------------------C
C   23-MAY-91 COSMETIC CHANGES DONE TO MEET SPECIFIC MEIKO
C             REQUIREMENTS.   (IS)
C----------------------------------------------------------------------
      SUBROUTINE GETWFN(IUNIT,NRPLWV,NBANDS,CPTW,CWORK)
        
      IMPLICIT INTEGER*4 (I-N)
      IMPLICIT COMPLEX*16 (C)
      IMPLICIT REAL*8 (A,B,D-H,O-Z)
      INTEGER ZSIZE
      PARAMETER (ZSIZE=2)

      INCLUDE 'cube.inc' 
      INCLUDE 'data.inc'         

      DIMENSION CPTW(NRPLWV,NBANDS),CWORK(NRPLWV)

      IF (INODE.EQ.IONODE) THEN
        DO 10 JNODE = 1,NODES
          DO 10 NB = 1,NBANDS
            IF (JNODE.EQ.INODE) THEN
              CALL CBUFFERREAD(IUNIT, CPTW(1,NB), NRPLWV)
            ELSE
              READ (IUNIT) CWORK
              CALL SHMEM_PUT(CPTW(1,NB), CWORK, ZSIZE*NRPLWV, JNODE-1)
            ENDIF
  10    CONTINUE
      END IF

      CALL BARRIER()
      CALL shmem_udcflush
      RETURN
      END

      SUBROUTINE PUTWFN(IUNIT,NRPLWV,NBANDS,CPTW,CWORK)
        
      IMPLICIT INTEGER*4 (I-N)
      IMPLICIT COMPLEX*16 (C)
      IMPLICIT REAL*8 (A,B,D-H,O-Z)
      INTEGER ZSIZE
      PARAMETER (ZSIZE=2)

      INCLUDE 'cube.inc'  
      INCLUDE 'data.inc' 

      DIMENSION CPTW(NRPLWV,NBANDS),CWORK(NRPLWV)

      CALL BARRIER()
      IF (INODE.EQ.IONODE) THEN
        DO 10 JNODE = 1,NODES
          DO 10 NB = 1,NBANDS
            IF (JNODE.EQ.INODE) THEN
              CALL CBUFFERWRITE(IUNIT, CPTW(1,NB), NRPLWV)
            ELSE
              CALL SHMEM_GET(CWORK, CPTW(1,NB), ZSIZE*NRPLWV, JNODE-1)
              WRITE (IUNIT) CWORK
            ENDIF
  10    CONTINUE
      END IF

      RETURN
      END


      SUBROUTINE CBUFFERWRITE(IUNIT, CBUFFER, LEN)

      IMPLICIT INTEGER*4 (I-N)
      IMPLICIT COMPLEX*16 (C)
      IMPLICIT REAL*8 (A,B,D-H,O-Z)

      DIMENSION CBUFFER(LEN)

      WRITE (IUNIT) CBUFFER

      RETURN
      END


      SUBROUTINE CBUFFERREAD(IUNIT, CBUFFER, LEN)

      IMPLICIT INTEGER*4 (I-N)
      IMPLICIT COMPLEX*16 (C)
      IMPLICIT REAL*8 (A,B,D-H,O-Z)

      DIMENSION CBUFFER(LEN)

      READ (IUNIT) CBUFFER

      RETURN
      END

C======================================================================
C End of File: wfn.f
C======================================================================
Modified: Fri Mar 17 17:00:00 1995 GMT
Page accessed 5768 times since Sat Apr 17 21:25:18 1999 GMT