9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-14 17:33:38 +01:00
qp2/src/ezfio_files/qp_stop.irp.f

44 lines
1016 B
Fortran
Raw Normal View History

2019-01-25 11:39:31 +01:00
BEGIN_PROVIDER [ character*(128), qp_stop_filename ]
&BEGIN_PROVIDER [ character*(128), qp_kill_filename ]
&BEGIN_PROVIDER [ integer, qp_stop_variable ]
implicit none
BEGIN_DOC
! Name of the file to check for qp stop
END_DOC
qp_stop_filename = trim(ezfio_filename)//'/work/qpstop'
qp_kill_filename = trim(ezfio_filename)//'/work/qpkill'
qp_stop_variable = 0
END_PROVIDER
logical function qp_stop()
implicit none
BEGIN_DOC
! Checks if the qp_stop command was invoked for the clean termination of the program
END_DOC
integer :: iunit
integer, external :: getUnitAndOpen
if (qp_stop_variable == 0) then
INQUIRE(FILE=trim(qp_kill_filename), EXIST=qp_stop)
if (qp_stop) then
qp_stop_variable = 1
return
endif
INQUIRE(FILE=trim(qp_stop_filename), EXIST=qp_stop)
if (qp_stop) then
iunit = getUnitAndOpen(trim(qp_stop_filename),'r')
close(iunit, STATUS='DELETE')
endif
else
qp_stop = .True.
endif
end