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

45 lines
1.0 KiB
Fortran
Raw Normal View History

2020-05-15 14:53:55 +02:00
BEGIN_PROVIDER [ character*(256), qp_stop_filename ]
&BEGIN_PROVIDER [ character*(256), qp_kill_filename ]
2019-01-25 11:39:31 +01:00
&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
2019-11-26 10:22:07 +01:00
! qp_stop is true
2019-01-25 11:39:31 +01:00
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