Skip to content

Commit fa45668

Browse files
committed
fortitude: Enforce single quotes for strings
1 parent 16e3258 commit fa45668

30 files changed

Lines changed: 341 additions & 339 deletions

fortitude.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ ignore = [
33
"implicit-external-procedures", # requires Fortran 2018
44
"star-kind", # don't use integer*4 et al
55
"literal-kind",
6-
"bad-quote-string",
76
"unchecked-stat", # TODO: Fix this!
87
"nonportable-shortcircuit-inquiry", # TODO: Fix this!
98
]
109
line-length = 132
1110
show-fixes = true
1211
extend-exclude = ["unit_tests/testdrive.F90"]
1312

13+
[check.strings]
14+
quotes = 'single'
15+
1416
# In general, we enforce the "use SomeModule, only: xxx, yyy" pattern,
1517
# to make it explicit which subroutine/variable come from a given module.
1618
# The below modules are exceptions, either for convenience (GlobalModule)

src/dynamics.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ recursive subroutine FMS_Dynamics(Bundle, Timestep, GoalTime)
3838

3939
! Initialize backup bundle
4040
if (FirstTime) then
41-
write (fmiOut, *) "Saving the first bundle"
41+
write (fmiOut, *) 'Saving the first bundle'
4242
call BSave%create(numtraj=Bundle%NumTraj, &
4343
numdeadtraj=Bundle%NumDeadTraj, &
4444
numstates=Bundle%NumStates, &
@@ -195,9 +195,9 @@ end subroutine FMS_CheckStop
195195
subroutine RecursionCrash()
196196
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
197197

198-
call FMS_PrintMessg("ERROR in FMS_Dynamics.")
199-
call FMS_PrintMessg("Timestep below minimum timestep.")
200-
call FMS_PrintMessg("Simulation will stop ...")
198+
call FMS_PrintMessg('ERROR in FMS_Dynamics.')
199+
call FMS_PrintMessg('Timestep below minimum timestep.')
200+
call FMS_PrintMessg('Simulation will stop ...')
201201
call BSave%destroy()
202202
call FMS_Shutdown(B1=Bundle)
203203

src/modules/BundleCalcsModule.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ subroutine FMS_CalcAmpDot(B1)
745745
! tjm Alternative procedure is to build b=HEff1*Amp
746746
! tjm Then solve S x ampdot = b
747747
! DH: Deactivate this branch to get rid of dependency on BLAS/LAPACK
748-
call FMS_DieError("GlzIterInv is not supported right now")
748+
call FMS_DieError('GlzIterInv is not supported right now')
749749

750750
call cpu_time(time_tmp1)
751751

src/modules/BundleIOModule.f90

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ subroutine FMS_WriteFBranching(B1)
4141
! write header the first time through
4242
if (iunit == 0) then
4343
! 1. Make the file name
44-
file_name = trim(FMSWorkingDir)//"N.dat"
44+
file_name = trim(FMSWorkingDir)//'N.dat'
4545

4646
! 2. See if it exists
4747
inquire (file=file_name, exist=file_exists)
4848
if (file_exists) then
49-
open (newunit=iunit, file=trim(file_name), position="append")
49+
open (newunit=iunit, file=trim(file_name), position='append')
5050
else
5151
open (newunit=iunit, file=trim(file_name))
5252
write (fmt_str, *) '(a12,', nstate, '(" State ",i3,2x ),a10)'
@@ -78,12 +78,12 @@ subroutine FMS_WriteFEnergy(B1)
7878
! write header the first time through
7979
if (iunit == 0) then
8080
! 1. Make the file name
81-
file_name = trim(FMSWorkingDir)//"E.dat"
81+
file_name = trim(FMSWorkingDir)//'E.dat'
8282

8383
! 2. See if it exists
8484
inquire (file=file_name, exist=file_exists)
8585
if (file_exists) then
86-
open (newunit=iunit, file=trim(file_name), position="append")
86+
open (newunit=iunit, file=trim(file_name), position='append')
8787
else
8888
open (newunit=iunit, file=trim(file_name))
8989
write (iunit, '(a10,6(a15))') '#Time', 'EPotentialQM', 'EKineticQM', 'ETotalQM', &
@@ -168,12 +168,12 @@ subroutine FMS_WriteFCorr(B1)
168168
! write header the first time through
169169
if (iunit == 0) then
170170
! 1. Make the file name
171-
file_name = trim(FMSWorkingDir)//"CFxn.dat"
171+
file_name = trim(FMSWorkingDir)//'CFxn.dat'
172172

173173
! 2. See if it exists
174174
inquire (file=file_name, exist=file_exists)
175175
if (file_exists) then
176-
open (newunit=iunit, file=trim(file_name), position="append")
176+
open (newunit=iunit, file=trim(file_name), position='append')
177177
else
178178
open (newunit=iunit, file=trim(file_name))
179179
write (iunit, '(6(a10))') '#Time', 'Amp^2', 'CorrReal', 'CorrImag'
@@ -221,7 +221,7 @@ subroutine FMS_WriteFParentChildOlap(T1, T2, filename, firsttime)
221221
character(len=256) :: file_name
222222

223223
! 1. get the file name and unit number
224-
file_name = trim(FMSWorkingDir)//"pcolap."//filename
224+
file_name = trim(FMSWorkingDir)//'pcolap.'//filename
225225

226226
! 2. work out if we are opening a new file
227227
open_new_file = .false.
@@ -236,12 +236,12 @@ subroutine FMS_WriteFParentChildOlap(T1, T2, filename, firsttime)
236236
if (open_new_file) then
237237
open (newunit=IUnit, file=trim(file_name))
238238
if (NTrip /= 0) then
239-
write (IUnit, '(a15,2(2x,i1), a15,2(2x,i1))') "# Child ID, Ms", T1%TrajID, T1%Ms, &
240-
"Parent ID, Ms", T2%TrajID, T2%Ms
239+
write (IUnit, '(a15,2(2x,i1), a15,2(2x,i1))') '# Child ID, Ms', T1%TrajID, T1%Ms, &
240+
'Parent ID, Ms', T2%TrajID, T2%Ms
241241
else
242-
write (IUnit, '(a10,i1,a9,i1)') "# Child ID", T1%TrajID, "Parent ID", T2%TrajID
242+
write (IUnit, '(a10,i1,a9,i1)') '# Child ID', T1%TrajID, 'Parent ID', T2%TrajID
243243
end if
244-
write (IUnit, '(4(4x,a10))') "# Time", "abs(S)", "Re(S)", "Im(S)"
244+
write (IUnit, '(4(4x,a10))') '# Time', 'abs(S)', 'Re(S)', 'Im(S)'
245245
else
246246
open (newunit=iunit, file=trim(file_name), position='append')
247247
end if
@@ -267,7 +267,7 @@ subroutine FMS_WriteFSOME(T1, T2, Tc, filename, firsttime)
267267
integer :: IUnit
268268
character(len=256) :: file_name
269269

270-
file_name = trim(FMSWorkingDir)//"SOME."//filename
270+
file_name = trim(FMSWorkingDir)//'SOME.'//filename
271271

272272
! 2. work out if we are opening a new file
273273
file_exists = .true.
@@ -278,9 +278,9 @@ subroutine FMS_WriteFSOME(T1, T2, Tc, filename, firsttime)
278278
! 3. open the file
279279
if (.not. file_exists) then
280280
open (newunit=IUnit, file=trim(file_name))
281-
write (IUnit, '(a15,2(2x,i1), a15,2(2x,i1))') "# Child ID, Ms", T1%TrajID, T1%Ms, &
282-
"Parent ID, Ms", T2%TrajID, T2%Ms
283-
write (IUnit, '(4(4x,a10))') "# Time", "Centroid pos.", "SOME (Re, Im)", "SOMENorm"
281+
write (IUnit, '(a15,2(2x,i1), a15,2(2x,i1))') '# Child ID, Ms', T1%TrajID, T1%Ms, &
282+
'Parent ID, Ms', T2%TrajID, T2%Ms
283+
write (IUnit, '(4(4x,a10))') '# Time', 'Centroid pos.', 'SOME (Re, Im)', 'SOMENorm'
284284
else
285285
open (newunit=iunit, file=trim(file_name), position='append')
286286
end if
@@ -312,7 +312,7 @@ subroutine FMS_WriteFSOCeff(T1, T2, js, filename, firsttime)
312312
character(len=256) :: file_name
313313

314314
! 1. get the file name and unit number
315-
file_name = trim(FMSWorkingDir)//"SOCeff."//filename
315+
file_name = trim(FMSWorkingDir)//'SOCeff.'//filename
316316

317317
! 2. work out if we are opening a new file
318318
open_new_file = .false.
@@ -326,8 +326,8 @@ subroutine FMS_WriteFSOCeff(T1, T2, js, filename, firsttime)
326326
! 3. open the file
327327
if (open_new_file) then
328328
open (newunit=IUnit, file=trim(file_name))
329-
write (IUnit, '(a15,2(2x,i1), a15,2(2x,i1))') "# Child ID, Ms", T1%TrajID, T1%Ms, &
330-
"Parent ID, Ms", T2%TrajID, T2%Ms
329+
write (IUnit, '(a15,2(2x,i1), a15,2(2x,i1))') '# Child ID, Ms', T1%TrajID, T1%Ms, &
330+
'Parent ID, Ms', T2%TrajID, T2%Ms
331331
else
332332
open (newunit=iunit, file=trim(file_name), position='append')
333333
end if

src/modules/ElecStrucModule.f90

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ subroutine FMS_ESInit(NumParticles, NumStates)
127127
! FMSZero: fake electronic structure
128128
!
129129
case (FMSZERO)
130-
write (fmiOut, *) "FMSZero: Using toy potentials in adiabatic basis."
130+
write (fmiOut, *) 'FMSZero: Using toy potentials in adiabatic basis.'
131131
eszAnalyticForces = .true.
132132
eszNACoupVec = .true.
133133
eszPartialCharges = .false.
@@ -138,14 +138,14 @@ subroutine FMS_ESInit(NumParticles, NumStates)
138138
case (1)
139139
write (fmiOut, *) 'gliMethod=1: Tully model 1'
140140
if (NumStates /= 2) then
141-
write (fmiOut, *) "Number of states set to 2."
141+
write (fmiOut, *) 'Number of states set to 2.'
142142
NumStates = 2
143143
end if
144144

145145
case (2)
146146
write (fmiOut, *) 'gliMethod=2: Persico Model 2D 2-state CI'
147147
if (NumStates /= 2) then
148-
write (fmiOut, *) "Number of states set to 2."
148+
write (fmiOut, *) 'Number of states set to 2.'
149149
NumStates = 2
150150
end if
151151
if (NumParticles < 2) then
@@ -155,7 +155,7 @@ subroutine FMS_ESInit(NumParticles, NumStates)
155155
case (3)
156156
write (fmiOut, *) 'gliMethod=3: Izmaylov Model 2D 2-state CI'
157157
if (NumStates /= 2) then
158-
write (fmiOut, *) "Number of states set to 2."
158+
write (fmiOut, *) 'Number of states set to 2.'
159159
NumStates = 2
160160
end if
161161
if (NumParticles < 2) then
@@ -165,22 +165,22 @@ subroutine FMS_ESInit(NumParticles, NumStates)
165165
case (4) !GAIMS_model
166166
write (fmiOut, *) 'gliMethod=4: GAIMS Model 1D 2-state SOC'
167167
if (NumStates /= 2) then
168-
write (fmiOut, *) "Number of states set to 2."
168+
write (fmiOut, *) 'Number of states set to 2.'
169169
NumStates = 2
170170
end if
171171

172172
case default
173-
write (fmiOut, *) "Invalid gliMethod = ", gliMethod
174-
write (fmiOut, *) "iMethod must be 1, 2 or 3"
175-
call FMS_DieError("gliMethod not valid")
173+
write (fmiOut, *) 'Invalid gliMethod = ', gliMethod
174+
write (fmiOut, *) 'iMethod must be 1, 2 or 3'
175+
call FMS_DieError('gliMethod not valid')
176176
end select
177177
! end of fmszero initialization
178178

179179
!
180180
! FMSTemplate: write electronic structure input decks with templates
181181
!
182182
case (TEMPLATE)
183-
write (fmiOut, *) "FMSTemplate: system call ES interface."
183+
write (fmiOut, *) 'FMSTemplate: system call ES interface.'
184184
if (eslCIVec > 0) esnElecPhase = NumStates
185185

186186
case (TC)
@@ -202,7 +202,7 @@ subroutine FMS_ESInit(NumParticles, NumStates)
202202
eszPartialCharges = .false.
203203

204204
case default
205-
call FMS_DieError("Invalid iModel")
205+
call FMS_DieError('Invalid iModel')
206206

207207
end select
208208

src/modules/GlobalModule.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ subroutine FMS_OpenFile(fileName, iunit, fileExists)
456456
filePath = trim(FMSWorkingDir)//trim(fileName)
457457
inquire (file=filePath, exist=fileExists)
458458
if (fileExists) then
459-
open (newunit=iunit, file=filePath, position="append")
459+
open (newunit=iunit, file=filePath, position='append')
460460
else
461461
open (newunit=iunit, file=filePath)
462462
end if

src/modules/MinSearchModule.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function FMS_Minimizer(iter, toler, nChargeCycle, StepNum)
217217

218218
mniStartPtcle = qcNumQM
219219
mnNumPartSearch = qcNumMM
220-
ctype = "Fx"
220+
ctype = 'Fx'
221221
qczPCharge = .true.
222222

223223
case default

src/modules/OverlapModule.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ function overlap_V_trajectory(T_i, T_j, T_c, S_ij_precalc) result(V)
853853
! write(fmiOut,*) '#########################'
854854

855855
case default
856-
call FMS_DieError("Invalid mode in overlap_V_trajectory")
856+
call FMS_DieError('Invalid mode in overlap_V_trajectory')
857857

858858
end select
859859

@@ -979,7 +979,7 @@ function nuc_dip_particlexf(P1, P2, charge) result(S_ij)
979979
delta_x, delta_p, x_cent, charge
980980

981981
if (P1%NumDimensions /= 3) then
982-
call FMS_DieError("nuc_dip_particlexf only implemented for 3D systems")
982+
call FMS_DieError('nuc_dip_particlexf only implemented for 3D systems')
983983
end if
984984

985985
a_1 = P1%width
@@ -1032,7 +1032,7 @@ function SPA1_SOC_model(T1, T2, S_ij) result(PotEn)
10321032
complex(kind=DefComp) :: PotEn, dE, dSOC, roe
10331033

10341034
if (glIMethod /= 4) then
1035-
call FMS_DieError("SPA1 only available for GAIMS 1D Toy Model")
1035+
call FMS_DieError('SPA1 only available for GAIMS 1D Toy Model')
10361036
end if
10371037

10381038
x_1 = T1%Particle(1)%get_pos(1)

src/modules/ParticleModule.f90

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ subroutine create_particle(P1, ID, NumDim)
101101
P1%Mass = 0.0d0
102102
P1%Charge = 0.0d0
103103
P1%AtomicNum = 0.0d0
104-
P1%Elmnt = "XX"
104+
P1%Elmnt = 'XX'
105105

106106
allocate (P1%Position(NumDim))
107107
P1%Position = 0.d0
@@ -157,7 +157,7 @@ subroutine destroy_particle(P1)
157157
P1%Width = 0.0d0
158158
P1%Charge = 0.0d0
159159
P1%AtomicNum = 0.0d0
160-
P1%Elmnt = "XX"
160+
P1%Elmnt = 'XX'
161161

162162
if (allocated(P1%Position)) then
163163
deallocate (P1%Position)
@@ -234,7 +234,7 @@ function get_position_component(P1, i) result(pos)
234234
real(kind=DefReal) :: pos
235235

236236
if (i < 1 .or. i > size(P1%Position)) then
237-
call FMS_DieError("Particle%get_position_component: index out of range")
237+
call FMS_DieError('Particle%get_position_component: index out of range')
238238
pos = 0.0d0; return
239239
end if
240240

@@ -274,7 +274,7 @@ subroutine set_position_component(P1, i, NewPosition)
274274
real(kind=DefReal), intent(in) :: NewPosition
275275

276276
if (i < 1 .or. i > size(P1%Position)) then
277-
call FMS_DieError("Particle%set_position_component: index out of range ")
277+
call FMS_DieError('Particle%set_position_component: index out of range ')
278278
return
279279
end if
280280

@@ -297,7 +297,7 @@ subroutine set_position_vec(P1, NewPosition)
297297
real(kind=DefReal), intent(in) :: NewPosition(:)
298298

299299
if (size(P1%Position) /= size(NewPosition)) then
300-
call FMS_DieError("Particle%set_position_vec: wrong array size")
300+
call FMS_DieError('Particle%set_position_vec: wrong array size')
301301
return
302302
end if
303303

@@ -318,7 +318,7 @@ function get_momentum_component(P1, i) result(mom)
318318
real(kind=DefReal) :: mom
319319

320320
if (i < 1 .or. i > size(P1%Momentum)) then
321-
call FMS_DieError("Particle%get_momentum_component: index out of range")
321+
call FMS_DieError('Particle%get_momentum_component: index out of range')
322322
mom = 0.0d0; return
323323
end if
324324

@@ -355,7 +355,7 @@ subroutine set_momentum_component(P1, i, NewMomentum)
355355
real(kind=DefReal), intent(in) :: NewMomentum
356356

357357
if (i < 1 .or. i > size(P1%Momentum)) then
358-
call FMS_DieError("Particle%set_momentum_component: index out of range ")
358+
call FMS_DieError('Particle%set_momentum_component: index out of range ')
359359
return
360360
end if
361361

@@ -372,7 +372,7 @@ subroutine set_momentum_vec(P1, new_momentum)
372372
real(kind=DefReal), intent(in) :: new_momentum(:)
373373

374374
if (size(P1%Momentum) /= size(new_momentum)) then
375-
call FMS_DieError("Particle%set_momentum_vec: wrong array size")
375+
call FMS_DieError('Particle%set_momentum_vec: wrong array size')
376376
return
377377
end if
378378

@@ -384,7 +384,7 @@ subroutine set_momentum2_vec(P, new_mom2)
384384
real(kind=DefReal), intent(in) :: new_mom2(:)
385385

386386
if (size(P%Momentum) /= size(new_mom2)) then
387-
call FMS_DieError("Particle%set_momentum2_vec: wrong array size")
387+
call FMS_DieError('Particle%set_momentum2_vec: wrong array size')
388388
return
389389
end if
390390
P%Momentum2 = new_mom2
@@ -480,12 +480,12 @@ function FMS_Dihedral_Particle(Pi, Pj, Pk, Pl) result(phi)
480480
! if the angle betwenn i,j,k or j,k,l are less than 5 deg. print a warning
481481
theta = FMS_Angle_Particle(Pi, Pj, Pk)
482482
if (theta < tol_lo .or. tol_hi < theta) then
483-
write (fmiOut, *) "FMS_Dihedral_Particle : small angle between i,j,k"
483+
write (fmiOut, *) 'FMS_Dihedral_Particle : small angle between i,j,k'
484484
end if
485485

486486
theta = FMS_Angle_Particle(Pj, Pk, Pl)
487487
if (theta < tol_lo .or. tol_hi < theta) then
488-
write (fmiOut, *) "FMS_Dihedral_Particle : small angle between j,k,l"
488+
write (fmiOut, *) 'FMS_Dihedral_Particle : small angle between j,k,l'
489489
end if
490490

491491
Xji = Pi%get_pos() - Pj%get_pos()

src/modules/PropagationModule.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ subroutine FMS_Monitor(Bundle, BSave, Timestep)
630630
!
631631
if (smSMD) then
632632
if (Bundle%NumTraj > 1) then
633-
call FMS_DieError("SMD should only have 1 trajectory")
633+
call FMS_DieError('SMD should only have 1 trajectory')
634634
end if
635635
if (SMD_Completed()) then
636636
call FMS_Shutdown(B1=Bundle)

0 commit comments

Comments
 (0)