SUBROUTINE MolproPluginInit(tMolpro)
IMPLICIT NONE
LOGICAL, INTENT(inout) :: tMolpro
CHARACTER(1024) :: id
CHARACTER(c_char), DIMENSION(7) :: host = ['M', 'O', 'L', 'P', 'R', 'O', c_null_char]
! is this a Molpro plugin?
CALL PluginGuestopen(host)
tMolpro = PluginGuestActive() /= 0
molpro_plugin = .FALSE.
IF (.NOT. tMolpro) RETURN
molpro_plugin = .TRUE.
! ask for an FCIDUMP
IF (.NOT. PluginGuestSendF('GIVE OPERATOR HAMILTONIAN FCIDUMP')) STOP 'plugin request has failed'
molpro_plugin_fcidumpname = PluginGuestReceiveF()
! ask for a data file
IF (.NOT. PluginGuestSendF('GIVE INPUT NECI')) STOP 'plugin request has failed'
molpro_plugin_datafilename = PluginGuestReceiveF()
IF (.FALSE.) THEN ! debugging
write(stdout, '(''Dump file: '',A)') TRIM(molpro_plugin_fcidumpname)
write(stdout, '(''Input file: '',A)') TRIM(molpro_plugin_datafilename)
open(1, file=molpro_plugin_datafilename, status='OLD')
DO WHILE (.TRUE.)
read(1, '(A)', END=99) id
write(stdout, '(A)') TRIM(id)
END DO
99 close(1)
END IF
END SUBROUTINE MolproPluginInit