MolproPluginTerm Subroutine

public subroutine MolproPluginTerm(signal)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: signal

Contents

Source Code


Source Code

    SUBROUTINE MolproPluginTerm(signal)
        USE iso_c_binding, ONLY: c_int
        INTEGER, INTENT(in) :: signal
        INTERFACE
            SUBROUTINE fsleep(seconds) BIND(C, name="sleep")
                IMPORT
                INTEGER(c_int), value :: seconds
            END SUBROUTINE fsleep
        END INTERFACE
        IF (PluginGuestActive() /= 0) THEN
! Graceful exit if Molpro server
            CALL PluginGuestClose
            ! without this print, then MPI gets lost ???
            write(stdout, *) 'Stopping Molpro plugin, signal =', signal; FLUSH (6)
! doesn't look like slave threads ever make it here, so do not have a barrier
!  IF (signal.EQ.0) THEN
!   CALL MPI_Barrier(MPI_COMM_WORLD,ierr)
!  ELSE
            ! for abnormal termination, signal.lt.0, and then don't risk a barrier
            CALL fsleep(1_c_int) ! give the message time to arrive
!  END IF
        END IF
    END SUBROUTINE MolproPluginTerm