Skip to content

Commit 4a2aeeb

Browse files
committed
Run autoformat
1 parent 72319ec commit 4a2aeeb

9 files changed

+75
-75
lines changed

src/abin.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ program abin
6969
write (stdout, *) ''
7070

7171
! LZ warning for too many states
72-
if (ipimd == 5 .and. (nsinglet_lz > 2 .or. ntriplet_lz > 2 )) then
72+
if (ipimd == 5 .and. (nsinglet_lz > 2 .or. ntriplet_lz > 2)) then
7373
write (*, *) 'WARNING: LZ was derived for a two-state problem. More states might cause unphysical behavior.'
7474
write (stdout, *) ''
7575
end if

src/cmdline.F90

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ subroutine get_cmdline(chinput, chcoords, chveloc, &
3030
use mod_error, only: fatal_error
3131
use mod_utils, only: file_exists_or_exit
3232
character(len=*), intent(inout) :: chinput, chcoords, chveloc
33-
character(len=*), intent(inout) :: tc_server_name ! TeraChem MPI interface
34-
character(len=*), intent(inout) :: tcpb_input_file ! TeraChem protobuf interface
33+
character(len=*), intent(inout) :: tc_server_name ! TeraChem MPI interface
34+
character(len=*), intent(inout) :: tcpb_input_file ! TeraChem protobuf interface
3535
character(len=*), intent(inout) :: tcpb_host
3636
integer, intent(inout) :: tcpb_port
3737
character(len=len(chinput)) :: arg

src/force_tcpb.F90

+23-23
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ subroutine initialize_tcpb(natqm, at_names, tc_port, tc_host, tc_file)
9595
if (status == 0) then
9696
write (stdout, *) "Successfully connected to TeraChem server."
9797
else if (status == 1) then
98-
call fatal_error(__FILE__, __LINE__, &
99-
& "Connection to TeraChem TCPB server failed! Is it running?")
98+
call fatal_error(__FILE__, __LINE__, &
99+
& "Connection to TeraChem TCPB server failed! Is it running?")
100100
else if (status == 2) then
101-
call fatal_error(__FILE__, __LINE__, &
102-
& "Connection to TeraChem server succeed, but the "&
103-
& //" server is not available!")
101+
call fatal_error(__FILE__, __LINE__, &
102+
& "Connection to TeraChem server succeed, but the "&
103+
& //" server is not available!")
104104
else
105-
call fatal_error(__FILE__, __LINE__, &
106-
& "Could not connect to TCPB server. Is it running?")
105+
call fatal_error(__FILE__, __LINE__, &
106+
& "Could not connect to TCPB server. Is it running?")
107107
end if
108108

109109
! Setup TeraChem
@@ -113,16 +113,16 @@ subroutine initialize_tcpb(natqm, at_names, tc_port, tc_host, tc_file)
113113
#endif
114114
status = 0
115115
if (status == 0) then
116-
write (*,*) "TeraChem setup completed with success."
116+
write (*, *) "TeraChem setup completed with success."
117117
else if (status == 1) then
118-
call fatal_error(__FILE__, __LINE__, &
119-
& "TCPB: No options read from TeraChem input file or mismatch in the input options!")
118+
call fatal_error(__FILE__, __LINE__, &
119+
& "TCPB: No options read from TeraChem input file or mismatch in the input options!")
120120
else if (status == 2) then
121-
call fatal_error(__FILE__, __LINE__, &
122-
& "TCPB: Failed to setup TeraChem.")
121+
call fatal_error(__FILE__, __LINE__, &
122+
& "TCPB: Failed to setup TeraChem.")
123123
else
124-
call fatal_error(__FILE__, __LINE__, &
125-
& "TCPB: Status on tc_setup function is not recognized!")
124+
call fatal_error(__FILE__, __LINE__, &
125+
& "TCPB: Status on tc_setup function is not recognized!")
126126
end if
127127
end subroutine initialize_tcpb
128128

@@ -151,20 +151,20 @@ subroutine force_tcpb(x, y, z, fx, fy, fz, eclas, walkmax)
151151

152152
allocate (qmcharges(natqm))
153153
allocate (qmcoords(3 * natqm))
154-
allocate (qmgrad(3* natqm))
154+
allocate (qmgrad(3 * natqm))
155155

156156
qmgrad = 0.0D0
157157
mmgrad = 0.0D0
158158
mmcoords = 0.0D0
159-
mmcharges= 0.0D0
160-
qmcharges= 0.0D0
159+
mmcharges = 0.0D0
160+
qmcharges = 0.0D0
161161

162162
do iw = 1, walkmax
163163

164164
do iat = 1, natqm
165-
qmcoords(3*iat - 2) = x(iat, iw)
166-
qmcoords(3*iat - 1) = y(iat, iw)
167-
qmcoords(3*iat) = z(iat, iw)
165+
qmcoords(3 * iat - 2) = x(iat, iw)
166+
qmcoords(3 * iat - 1) = y(iat, iw)
167+
qmcoords(3 * iat) = z(iat, iw)
168168
end do
169169

170170
status = -1
@@ -186,9 +186,9 @@ subroutine force_tcpb(x, y, z, fx, fy, fz, eclas, walkmax)
186186
end if
187187

188188
do iat = 1, natqm
189-
fx(iat, iw) = -qmgrad(3*iat - 2)
190-
fy(iat, iw) = -qmgrad(3*iat - 1)
191-
fz(iat, iw) = -qmgrad(3*iat)
189+
fx(iat, iw) = -qmgrad(3 * iat - 2)
190+
fy(iat, iw) = -qmgrad(3 * iat - 1)
191+
fz(iat, iw) = -qmgrad(3 * iat)
192192
end do
193193

194194
! ONIOM was not yet tested!!

src/force_terash.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ subroutine receive_terash(fx, fy, fz, eclas, tc_comm)
127127
call check_recv_count(status, nstate * nstate, MPI_DOUBLE_PRECISION)
128128

129129
! Should change the following according to what is done in TeraChem
130-
if (oldwfn /= 0 .and. ipimd /= 5) then
130+
if (oldwfn /= 0 .and. ipimd /= 5) then
131131
i = Check_CIVector(CIvecs, CIvecs_old, civec, nstate)
132132
end if
133133

src/fortran_interfaces.F90

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
! Some functions are currently outside of modules due to
55
! circular dependencies.
66
module mod_interfaces
7-
use, intrinsic :: iso_c_binding, only: c_int, c_int32_t
7+
use, intrinsic :: iso_c_binding, only: C_INT, C_INT32_T
88
use mod_const, only: DP
99
public
1010
interface
@@ -58,9 +58,9 @@ end subroutine omp_set_num_threads
5858
! https://cyber.dabamos.de/programming/modernfortran/sleep.html
5959
! int usleep(useconds_t useconds)
6060
function usleep(useconds) bind(c, name='usleep')
61-
import :: c_int, c_int32_t
62-
integer(kind=c_int32_t), value :: useconds
63-
integer(kind=c_int) :: usleep
61+
import :: C_INT, C_INT32_T
62+
integer(kind=C_INT32_T), value :: useconds
63+
integer(kind=C_INT) :: usleep
6464
end function usleep
6565

6666
end interface

src/landau_zener.F90

+38-38
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,23 @@ subroutine lz_init(pot)
106106
end subroutine lz_init
107107

108108
subroutine lz_init_terash()
109-
use mod_general, only: natom
110-
use mod_sh, only: en_array, tocalc, nacx, nacy, nacz
111-
112-
nstate = nstate_lz !Needed in init_terash
113-
inac = 2 !Turns off couplings calculation
114-
115-
!Based on sh_init() routine, sharing most of the functions
116-
!TODO: Break dependence - separation of MPI interface needed
117-
allocate (en_array(nstate_lz))
118-
allocate (nacx(natom, nstate_lz, nstate_lz))
119-
allocate (nacy(natom, nstate_lz, nstate_lz))
120-
allocate (nacz(natom, nstate_lz, nstate_lz))
121-
allocate (tocalc(nstate, nstate))
122-
en_array = 0.0D0
123-
tocalc = 0
124-
tocalc(istate_lz, istate_lz) = 1
125-
call set_current_state(istate_lz)
109+
use mod_general, only: natom
110+
use mod_sh, only: en_array, tocalc, nacx, nacy, nacz
111+
112+
nstate = nstate_lz !Needed in init_terash
113+
inac = 2 !Turns off couplings calculation
114+
115+
!Based on sh_init() routine, sharing most of the functions
116+
!TODO: Break dependence - separation of MPI interface needed
117+
allocate (en_array(nstate_lz))
118+
allocate (nacx(natom, nstate_lz, nstate_lz))
119+
allocate (nacy(natom, nstate_lz, nstate_lz))
120+
allocate (nacz(natom, nstate_lz, nstate_lz))
121+
allocate (tocalc(nstate, nstate))
122+
en_array = 0.0D0
123+
tocalc = 0
124+
tocalc(istate_lz, istate_lz) = 1
125+
call set_current_state(istate_lz)
126126
end subroutine lz_init_terash
127127

128128
!LZ singlets hop
@@ -176,9 +176,9 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
176176
end if
177177

178178
do ist1 = ibeg, iend
179-
if (ist1 == ist) cycle
179+
if (ist1 == ist) cycle
180180
! only closest states are considered for hopping
181-
if (ist1 > (ist + 1) .or. ist1 < (ist - 1)) cycle
181+
if (ist1 > (ist + 1) .or. ist1 < (ist - 1)) cycle
182182

183183
do ihist = 1, 4
184184
en_diff(ihist) = abs(en_array_lz(ist, ihist) - en_array_lz(ist1, ihist))
@@ -204,31 +204,31 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
204204
! only for significant probabilities, for tiny probabilities this does not make sense
205205
! e.g. for parallel states (the whole LZ does not make sense for this case)
206206
if (prob(ist1) > 0.01) then
207-
! Calculating backward second derivative formula. We are not using the newest energy
208-
! but the previous three. Discontinuity would not affect this formula.
209-
second_der_back = ((en_diff(2) - 2 * en_diff(3) + en_diff(4)) / dt**2)
210-
! We have central and backward second derivative formulas and compare them.
211-
! If the change is too large, we either almost hit the CI or we have discontinuity.
212-
der_check = abs((second_der - second_der_back) / second_der)
213-
! If they differ by more then 130%, we have aa unphysical change of curvature --> certain discontinuity.
214-
if (der_check > 1.3) then
215-
write (stdout,*) "ERROR: Change of curvature --> discontinuity in PES!"
216-
write (stdout,*) "Probability set to 0!"
217-
prob(ist1) = 0.0D0
218-
! 30% threshold was set empirically and should capture most discontinuities
219-
! yet it can also be a conical intersection. Thus, we just issue an warning
220-
! and let the user to evaluate on his own.
221-
else if (der_check > 0.3) then
222-
write (stdout,*) "WARNING: Possible discontinuity in PES! Check PES.dat!"
223-
end if
224-
end if
207+
! Calculating backward second derivative formula. We are not using the newest energy
208+
! but the previous three. Discontinuity would not affect this formula.
209+
second_der_back = ((en_diff(2) - 2 * en_diff(3) + en_diff(4)) / dt**2)
210+
! We have central and backward second derivative formulas and compare them.
211+
! If the change is too large, we either almost hit the CI or we have discontinuity.
212+
der_check = abs((second_der - second_der_back) / second_der)
213+
! If they differ by more then 130%, we have aa unphysical change of curvature --> certain discontinuity.
214+
if (der_check > 1.3) then
215+
write (stdout, *) "ERROR: Change of curvature --> discontinuity in PES!"
216+
write (stdout, *) "Probability set to 0!"
217+
prob(ist1) = 0.0D0
218+
! 30% threshold was set empirically and should capture most discontinuities
219+
! yet it can also be a conical intersection. Thus, we just issue an warning
220+
! and let the user to evaluate on his own.
221+
else if (der_check > 0.3) then
222+
write (stdout, *) "WARNING: Possible discontinuity in PES! Check PES.dat!"
223+
end if
224+
end if
225225

226226
end if
227227
end do
228228

229229
! LZ warning
230230
if (sum(prob) > 1) then
231-
write (stdout, *) "WARNING: Sum of hopping probabilities > 1. Breakdown of LZ assumptions"
231+
write (stdout, *) "WARNING: Sum of hopping probabilities > 1. Breakdown of LZ assumptions"
232232
end if
233233

234234
!Hop?

src/surfacehop.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ subroutine try_hop_nacme_rescale(vx, vy, vz, instate, outstate, eclas)
912912
a_temp = 0.5D0 * a_temp
913913
c_temp = b_temp**2 + 4 * a_temp * (en_array(instate) - en_array(outstate))
914914

915-
if (a_temp <= 0.0D0 ) then
915+
if (a_temp <= 0.0D0) then
916916
write (stdout, *) 'WARNING: NACME vector is zero, rescaling velocities isotropically along the velocity vector'
917917
call try_hop_simple_rescale(vx, vy, vz, instate, outstate, eclas)
918918
return

src/tera_mpi_api.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ subroutine finalize_terachem(abin_error_code)
244244

245245
do itera = 1, nteraservers
246246

247-
if (.not.communication_established(itera)) cycle
247+
if (.not. communication_established(itera)) cycle
248248

249249
write (stdout, '(A,I0)') 'Shutting down TeraChem server id = ', itera
250250

src/utils.F90

+4-4
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,13 @@ subroutine int_switch(i, varname)
347347
end subroutine int_switch
348348

349349
subroutine milisleep(milisec)
350-
use, intrinsic :: iso_c_binding, only: c_int, c_int32_t
350+
use, intrinsic :: iso_c_binding, only: C_INT, C_INT32_T
351351
use mod_interfaces, only: usleep
352352
integer :: milisec
353-
integer(kind=c_int32_t) :: usec
354-
integer(kind=c_int) :: c_err
353+
integer(kind=C_INT32_T) :: usec
354+
integer(kind=C_INT) :: c_err
355355

356-
usec = int(milisec * 1000, c_int32_t)
356+
usec = int(milisec * 1000, C_INT32_T)
357357
! TODO: Based on usleep(2) manpage, we probably should not sleep more than a second
358358
c_err = usleep(usec)
359359
if (c_err /= 0) then

0 commit comments

Comments
 (0)