-
Notifications
You must be signed in to change notification settings - Fork 0
/
Log.f90
75 lines (46 loc) · 1.66 KB
/
Log.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
MODULE Log
! #DES: Module for interacting with the log file
IMPLICIT NONE
PRIVATE
PUBLIC :: CreateLogFile, EndLogFile, logUnit
INTEGER, PARAMETER :: logUnit = 6
CONTAINS
SUBROUTINE CreateLogFile()
! #DES: Creates a new log file 'logFile' for writing and writes its head
USE FileIO, ONLY : OpenFile
IMPLICIT NONE
CALL OpenFile(logUnit,"logFile","write")
CALL WriteLogHead()
END SUBROUTINE CreateLogFile
!*
SUBROUTINE EndLogFile(message)
! #DES: Writes 'message' to the log file, prints the tail and attempts to close it
USE FileIO, ONLY : CloseFile
IMPLICIT NONE
CHARACTER(*), INTENT(IN) :: message
WRITE(logUnit,'(a)',ADVANCE='NO') TRIM(ADJUSTL(message))
CALL WriteLogTail()
CALL CloseFile(logUnit)
END SUBROUTINE EndLogFile
!*
SUBROUTINE WriteLogHead()
! #DES: Writes calculation-agnostic header to the log file
IMPLICIT NONE
WRITE(logUnit,*) ""
WRITE(logUnit,*) "* FEPCAT *"
WRITE(logUnit,*) "* A Free Energy Calculation Tool *"
WRITE(logUnit,*) " Matthew JL Mills "
WRITE(logUnit,*) " Joint BioEnergy Institute "
WRITE(logUnit,*) " LICENSE GOES HERE "
WRITE(logUnit,*) ""
END SUBROUTINE WriteLogHead
!*
SUBROUTINE WriteLogTail()
! #DES: Writes calculation-agnostic tail to the log file (time and date of completion)
IMPLICIT NONE
CHARACTER(8) :: date
CHARACTER(10) :: time
CALL DATE_AND_TIME(date,time)
WRITE(logUnit,'(1X,A,2X,A,2X)') date, time
END SUBROUTINE WriteLogTail
END MODULE Log