Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/format-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v5

- name: Install fortitude linter
run: pip install fortitude-lint==0.7.1
run: pip install fortitude-lint==0.7.5

- name: Lint check
run: fortitude check src/
Expand Down
2 changes: 2 additions & 0 deletions fortitude.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ ignore = [
"line-too-long",
"trailing-whitespace", # we should enable this, autofix available
"incorrect-space-before-comment", # we should enable this, autofix available
"superfluous-semicolon", # same as above
"use-all", # should use "only:"
"assumed-size-character-intent", # TODO: We should fix all instances!
"implicit-external-procedures", # requires Fortran 2018
"bad-quote-string", # Use single or double quotes consistently
]
exclude = [
"src/fftw3.F90",
Expand Down
1 change: 1 addition & 0 deletions ruff.toml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: remove this file

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
line-length = 120
2 changes: 1 addition & 1 deletion src/compile_info.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
! and the current Git commit, which is passed in from Makefile.
! allow(procedure-not-in-module) ! fortitude linter
subroutine print_compile_info()
use iso_fortran_env, only: compiler_version, compiler_options
use, intrinsic :: iso_fortran_env, only: compiler_version, compiler_options
use mod_files, only: stdout
character(len=*), parameter :: ABIN_VERSION = '1.2.0'

Expand Down
4 changes: 2 additions & 2 deletions src/force_bound.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ subroutine sbc_init(x, y, z)
! calculation of the cluster radius, taken from the center of mass
do iat = 1, natom
r = (x(iat, iw) - xcm)**2 + (y(iat, iw) - ycm)**2 + (z(iat, iw) - zcm)**2
r = dsqrt(r)
r = sqrt(r)
if (r > rmax .and. names(iat) /= 'H') then
rmax = r
end if
Expand Down Expand Up @@ -97,7 +97,7 @@ subroutine force_sbc(x, y, z, fx, fy, fz, walkmax)
do iw = 1, walkmax
do iat = 1, natom
r = (x(iat, iw) - xcm)**2 + (y(iat, iw) - ycm)**2 + (z(iat, iw) - zcm)**2
r = dsqrt(r)
r = sqrt(r)
if (r > rb_sbc .and. names(iat) /= 'H') then
frb = -kb_sbc * (r - rb_sbc)
fx(iat, iw) = fx(iat, iw) + frb * (x(iat, iw) - xcm) / (r)
Expand Down
4 changes: 4 additions & 0 deletions src/force_h2o.F90
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ subroutine numerical_forces(x, y, z, fx, fy, fz, Epot, natom, nbeads)
y_new_forward(i, j) = y_new_forward(i, j) + DELTA
case (3)
z_new_forward(i, j) = z_new_forward(i, j) + DELTA
case default
call fatal_error(__FILE__, __LINE__, "Whoops, I should not be here!")
end select

! Calculate the energy for the forward perturbed geometry
Expand All @@ -209,6 +211,8 @@ subroutine numerical_forces(x, y, z, fx, fy, fz, Epot, natom, nbeads)
fy(i, j) = -(Epot_delta(1) - Eclas_orig) / DELTA
case (3)
fz(i, j) = -(Epot_delta(1) - Eclas_orig) / DELTA
case default
call fatal_error(__FILE__, __LINE__, "Whoops, I should not be here!")
end select
end do
end do
Expand Down
6 changes: 3 additions & 3 deletions src/force_mm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ subroutine initialize_LJ(rmin, eps, num_types, natom)
if (LJcomb == 'LB') then
! WARNING: We expect rmin in angstroms!
rij = 0.5D0 * (rmin(i) + rmin(j)) * ANG
epsij = dsqrt(eps(i) * eps(j))
epsij = sqrt(eps(i) * eps(j))
end if
Bij(i, j) = 2 * 6 * epsij * rij**6
Aij(i, j) = 12 * epsij * rij**12
Expand Down Expand Up @@ -211,15 +211,15 @@ subroutine force_mm(x, y, z, fx, fy, fz, eclas, walkmax)
i = inames(iat1)
j = inames(iat2)
kLJ = ri3 * (ri3 * Aij(i, j) - Bij(i, j)) * ri
kC = q(i) * q(j) * dsqrt(ri3)
kC = q(i) * q(j) * sqrt(ri3)
fx(iat1, iw) = fx(iat1, iw) + (kLJ + kC) * dx
fx(iat2, iw) = fx(iat2, iw) - (kLJ + kC) * dx
fy(iat1, iw) = fy(iat1, iw) + (kLJ + kC) * dy
fy(iat2, iw) = fy(iat2, iw) - (kLJ + kC) * dy
fz(iat1, iw) = fz(iat1, iw) + (kLJ + kC) * dz
fz(iat2, iw) = fz(iat2, iw) - (kLJ + kC) * dz
eclas = eclas + ri3 * (ri3 * Aij(i, j) / 12 - Bij(i, j) / 6)
eclas = eclas + q(i) * q(j) / dsqrt(r)
eclas = eclas + q(i) * q(j) / sqrt(r)
end do
end do
end do
Expand Down
2 changes: 1 addition & 1 deletion src/forces.F90
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ subroutine force_quantum(fx, fy, fz, x, y, z, amg, quantum_energy)
! Tuckerman normal modes Hamiltonian
! Not tested
if (inormalmodes == 2) then
ak = NWALK * TEMP**2 * amg / dsqrt(nwalk * 1.0D0)
ak = NWALK * TEMP**2 * amg / sqrt(nwalk * 1.0D0)
end if

! This is the energy coming from the Path Integral harmonic forces
Expand Down
2 changes: 1 addition & 1 deletion src/geom_analysis.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ subroutine print_distances(x, y, z)
! If we have only one atom, take the distance from the origin,
! i.e. [0, 0, 0]
if (natom == 1) then
r(idist) = dsqrt(x(1, iw)**2 + y(1, iw)**2 + z(1, iw)**2)
r(idist) = sqrt(x(1, iw)**2 + y(1, iw)**2 + z(1, iw)**2)
else
r(idist) = get_distance(x, y, z, dist1(idist), dist2(idist), iw)
end if
Expand Down
14 changes: 7 additions & 7 deletions src/gle.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ subroutine pile_init(dt, tau0)
tau = tau0 / AUtoFS * 1000
gam = 1 / tau
c1(1) = exp(-dt * gam)
c2(1) = dsqrt(1 - c1(1)**2) * dsqrt(temp * nwalk)
c2(1) = sqrt(1 - c1(1)**2) * sqrt(temp * nwalk)

! Now normal modes of bead necklace
do iw = 2, nwalk
omega = 2 * temp * nwalk * sin((iw - 1) * PI / nwalk)
gam = 2 * omega
c1(iw) = exp(-dt * gam)
c2(iw) = dsqrt(1 - c1(iw)**2) * dsqrt(temp * nwalk)
c2(iw) = sqrt(1 - c1(iw)**2) * sqrt(temp * nwalk)
end do
end subroutine pile_init

Expand All @@ -116,9 +116,9 @@ subroutine pile_step(px, py, pz, m)
! TODO: implement global version according to equations 51-54
do iw = 1, nwalk
do iat = 1, natom
px(iat, iw) = c1(iw) * px(iat, iw) + c2(iw) * ran(pom) * dsqrt(m(iat, iw))
py(iat, iw) = c1(iw) * py(iat, iw) + c2(iw) * ran(pom + 1) * dsqrt(m(iat, iw))
pz(iat, iw) = c1(iw) * pz(iat, iw) + c2(iw) * ran(pom + 2) * dsqrt(m(iat, iw))
px(iat, iw) = c1(iw) * px(iat, iw) + c2(iw) * ran(pom) * sqrt(m(iat, iw))
py(iat, iw) = c1(iw) * py(iat, iw) + c2(iw) * ran(pom + 1) * sqrt(m(iat, iw))
pz(iat, iw) = c1(iw) * pz(iat, iw) + c2(iw) * ran(pom + 2) * sqrt(m(iat, iw))
pom = pom + 3
end do
end do
Expand Down Expand Up @@ -529,7 +529,7 @@ subroutine gle_propagate(p, T, S, mass, iw)
do i = 1, ns + 1
call gautrg(ran, natom * 3)
do j = 1, natom
sqm = dsqrt(mass(j, iw))
sqm = sqrt(mass(j, iw))
p(j, i) = ran(j) * sqm
p(j + natom, i) = ran(j + natom) * sqm
p(j + natom * 2, i) = ran(j + natom * 2) * sqm
Expand Down Expand Up @@ -610,7 +610,7 @@ subroutine cholesky(SST, S, n)
end do
do i = 1, n
if (D(i, i) >= 0.0D0) then
D(i, i) = dsqrt(D(i, i))
D(i, i) = sqrt(D(i, i))
else
write (stderr, *) "WARNING: negative eigenvalue (", D(i, i), ")in LDL^T decomposition."
D(i, i) = 0.0D0
Expand Down
2 changes: 2 additions & 0 deletions src/init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ subroutine print_basic_info()
write (stdout, *) ' Minimization '
case (5)
write (stdout, *) ' Landau Zener MD '
case default
call fatal_error(__FILE__, __LINE__, 'invalid ipimd in '//trim(chinput))
end select

write (stdout, *) ' using potential: '//toupper(trim(pot))
Expand Down
4 changes: 2 additions & 2 deletions src/io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ subroutine print_dipoles(dipoles, iw, nstates)
! Most QM program print Dx, Dy, Dz components first.
do ind = 1, 3 * nstates, 3
total_dip = dipoles(ind)**2 + dipoles(ind + 1)**2 + dipoles(ind + 2)**2
total_dip = dsqrt(total_dip)
total_dip = sqrt(total_dip)
write (UDIP, format2, advance="no") total_dip
end do

Expand All @@ -67,7 +67,7 @@ subroutine print_transdipoles(tdipoles, istate, ntdip)

do ind = 1, 3 * ntdip, 3
total_tdip = tdipoles(ind)**2 + tdipoles(ind + 1)**2 + tdipoles(ind + 2)**2
total_tdip = dsqrt(total_tdip)
total_tdip = sqrt(total_tdip)
write (UTDIP, format2, advance="no") total_tdip
end do

Expand Down
6 changes: 3 additions & 3 deletions src/landau_zener.F90
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
! Three point minima of adiabatic splitting Zjk
if ((en_diff(1) > en_diff(2)) .and. (en_diff(2) < en_diff(3)) .and. (it > 2)) then
second_der = ((en_diff(3) - 2 * en_diff(2) + en_diff(1)) / dt**2)
prob(ist1) = exp(-PI / 2 * (dsqrt(en_diff(2)**3 / second_der)))
prob(ist1) = exp(-PI / 2 * (sqrt(en_diff(2)**3 / second_der)))
write (fmt_in, '(I2.2)') ist
write (fmt_out, '(I2.2)') ist1
write (stdout, *) "Three-point minimum (", trim(fmt_in), "->", trim(fmt_out), &
Expand Down Expand Up @@ -364,7 +364,7 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
call force_clas(fxc, fyc, fzc, x, y, z, eclas, pot)

!d) Simple velocity rescaling (https://doi.org/10.1063/1.4882073)
vel_rescale = dsqrt(1 - (dE / Ekin))
vel_rescale = sqrt(1 - (dE / Ekin))
do iat = 1, natom
vx(iat, 1) = vx(iat, 1) * vel_rescale
vy(iat, 1) = vy(iat, 1) * vel_rescale
Expand Down Expand Up @@ -398,7 +398,7 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)
prob = 0.0D0

Ekin = ekin_v(vx, vy, vz)
molveloc = dsqrt(2.0D0 * Ekin / sum(am(1:natom)))
molveloc = sqrt(2.0D0 * Ekin / sum(am(1:natom)))
call vranf(ran, 1)
hop_rdnum = ran(1)
icross = 0
Expand Down
32 changes: 16 additions & 16 deletions src/nosehoover.F90
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ subroutine initialize_nhc_momenta(temp)
call gautrg(ran, natom * 3)
ipom = 1
do iat = 1, natom
pnhx(iat, iw, inh) = ran(ipom) * dsqrt(temp * Qm(iw))
pnhy(iat, iw, inh) = ran(ipom + 1) * dsqrt(temp * Qm(iw))
pnhz(iat, iw, inh) = ran(ipom + 2) * dsqrt(temp * Qm(iw))
pnhx(iat, iw, inh) = ran(ipom) * sqrt(temp * Qm(iw))
pnhy(iat, iw, inh) = ran(ipom + 1) * sqrt(temp * Qm(iw))
pnhz(iat, iw, inh) = ran(ipom + 2) * sqrt(temp * Qm(iw))
end do
ipom = ipom + 3
end do
Expand All @@ -316,7 +316,7 @@ subroutine initialize_nhc_momenta(temp)
! +1 if nmolt=1, gautrg needs array at least of length=2
call gautrg(ran, nmolt + 1)
do imol = 1, nmolt
pnhx(imol, iw, inh) = ran(imol) * dsqrt(temp * ms(imol, inh))
pnhx(imol, iw, inh) = ran(imol) * sqrt(temp * ms(imol, inh))
end do
end do
end do
Expand Down Expand Up @@ -482,13 +482,13 @@ subroutine shiftNHC_yosh(px, py, pz, amt, dt)
pnhx(imol, iw, nchain) = pnhx(imol, iw, nchain) + G(nchain) * wdt2
! UPDATE THERMOSTAT VELOCITIES
do inh = 1, nchain - 1
AA = dexp(-wdt4 * pnhx(imol, iw, nchain - inh + 1) / ms(imol, nchain - inh + 1))
AA = exp(-wdt4 * pnhx(imol, iw, nchain - inh + 1) / ms(imol, nchain - inh + 1))
pnhx(imol, iw, nchain - inh) = pnhx(imol, iw, nchain - inh) * AA * AA + &
& wdt2 * G(nchain - inh) * AA
end do

! UPDATE PARTICLE VELOCITIES
AA = dexp(-wdt * pnhx(imol, iw, 1) / ms(imol, 1))
AA = exp(-wdt * pnhx(imol, iw, 1) / ms(imol, 1))
pscale = pscale * AA
! UPDATE FORCES
G(1) = pscale * pscale * ekin2 - nf * temp
Expand All @@ -501,7 +501,7 @@ subroutine shiftNHC_yosh(px, py, pz, amt, dt)

! UPDATE THERMOSTAT VELOCITIES
do inh = 1, nchain - 1
AA = dexp(-wdt4 * pnhx(imol, iw, inh + 1) / ms(imol, inh + 1))
AA = exp(-wdt4 * pnhx(imol, iw, inh + 1) / ms(imol, inh + 1))
pnhx(imol, iw, inh) = pnhx(imol, iw, inh) * AA * AA + wdt2 * G(inh) * AA
G(inh + 1) = pnhx(imol, iw, inh) * pnhx(imol, iw, inh) / ms(imol, inh) - temp
end do
Expand Down Expand Up @@ -564,23 +564,23 @@ subroutine shiftNHC_yosh_mass(px, py, pz, amt, dt)

! UPDATE THERMOSTAT VELOCITIES
do inh = 1, nchain - 1
AA = dexp(-wdt4 * pnhx(iat, iw, nchain - inh + 1) / Qm(iw))
AA = exp(-wdt4 * pnhx(iat, iw, nchain - inh + 1) / Qm(iw))
pnhx(iat, iw, nchain - inh) = pnhx(iat, iw, nchain - inh) * AA * AA + &
& wdt2 * Gx(nchain - inh) * AA
AA = dexp(-wdt4 * pnhy(iat, iw, nchain - inh + 1) / Qm(iw))
AA = exp(-wdt4 * pnhy(iat, iw, nchain - inh + 1) / Qm(iw))
pnhy(iat, iw, nchain - inh) = pnhy(iat, iw, nchain - inh) * AA * AA + &
& wdt2 * Gy(nchain - inh) * AA
AA = dexp(-wdt4 * pnhz(iat, iw, nchain - inh + 1) / Qm(iw))
AA = exp(-wdt4 * pnhz(iat, iw, nchain - inh + 1) / Qm(iw))
pnhz(iat, iw, nchain - inh) = pnhz(iat, iw, nchain - inh) * AA * AA + &
& wdt2 * Gz(nchain - inh) * AA
end do

! UPDATE PARTICLE VELOCITIES
AA = dexp(-wdt * pnhx(iat, iw, 1) / Qm(iw))
AA = exp(-wdt * pnhx(iat, iw, 1) / Qm(iw))
px(iat, iw) = px(iat, iw) * AA
AA = dexp(-wdt * pnhy(iat, iw, 1) / Qm(iw))
AA = exp(-wdt * pnhy(iat, iw, 1) / Qm(iw))
py(iat, iw) = py(iat, iw) * AA
AA = dexp(-wdt * pnhz(iat, iw, 1) / Qm(iw))
AA = exp(-wdt * pnhz(iat, iw, 1) / Qm(iw))
pz(iat, iw) = pz(iat, iw) * AA

! UPDATE FORCES
Expand All @@ -597,13 +597,13 @@ subroutine shiftNHC_yosh_mass(px, py, pz, amt, dt)

! UPDATE THERMOSTAT VELOCITIES
do inh = 1, nchain - 1
AA = dexp(-wdt4 * pnhx(iat, iw, inh + 1) / Qm(iw))
AA = exp(-wdt4 * pnhx(iat, iw, inh + 1) / Qm(iw))
pnhx(iat, iw, inh) = pnhx(iat, iw, inh) * AA * AA + wdt2 * Gx(inh) * AA
Gx(inh + 1) = pnhx(iat, iw, inh)**2 / Qm(iw) - temp
AA = dexp(-wdt4 * pnhy(iat, iw, inh + 1) / Qm(iw))
AA = exp(-wdt4 * pnhy(iat, iw, inh + 1) / Qm(iw))
pnhy(iat, iw, inh) = pnhy(iat, iw, inh) * AA * AA + wdt2 * Gy(inh) * AA
Gy(inh + 1) = pnhy(iat, iw, inh)**2 / Qm(iw) - temp
AA = dexp(-wdt4 * pnhz(iat, iw, inh + 1) / Qm(iw))
AA = exp(-wdt4 * pnhz(iat, iw, inh + 1) / Qm(iw))
pnhz(iat, iw, inh) = pnhz(iat, iw, inh) * AA * AA + wdt2 * Gz(inh) * AA
Gz(inh + 1) = pnhz(iat, iw, inh)**2 / Qm(iw) - temp
end do
Expand Down
2 changes: 1 addition & 1 deletion src/plumed.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
! PLUMED is statically linked with ABIN, see Makefile.
! To install PLUMED libraries, see 'dev_scripts/install_plumed.sh'
module mod_plumed
use iso_c_binding, only: C_NULL_PTR
use, intrinsic :: iso_c_binding, only: C_NULL_PTR
use mod_const, only: DP
#ifndef USE_PLUMED
use mod_error, only: not_compiled_with
Expand Down
10 changes: 5 additions & 5 deletions src/potentials.F90
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ subroutine force_harmonic_rotor(x, y, z, fx, fy, fz, eclas, nwalk)
dy = y(2, i) - y(1, i)
dz = z(2, i) - z(1, i)
r = dx**2 + dy**2 + dz**2
r = dsqrt(r)
r = sqrt(r)
fac = hrot%k * (r - hrot%r0) / r
fx(1, i) = fac * dx
fx(2, i) = -fx(1, i)
Expand All @@ -258,7 +258,7 @@ subroutine hessian_harmonic_rotor(x, y, z, nwalk, hess)
dy = y(2, i) - y(1, i)
dz = z(2, i) - z(1, i)
r = dx**2 + dy**2 + dz**2
r = dsqrt(r)
r = sqrt(r)
fac = hrot%k * (r - hrot%r0) / r
hess(1, 1, i) = (hrot%k * dx**2 / r**2 - fac * dx**2 / r**2 + fac) / nwalk
hess(2, 2, i) = (hrot%k * dy**2 / r**2 - fac * dy**2 / r**2 + fac) / nwalk
Expand Down Expand Up @@ -313,7 +313,7 @@ subroutine morse_init(natom, k_morse, r0, d0)
call real_positive(d0, 'd0_morse')
call real_positive(r0, 'r0_morse')

a = dsqrt(k_morse / 2.0D0 / d0)
a = sqrt(k_morse / 2.0D0 / d0)
morse = morse_params(d0=d0, a=a, r0=r0)
end subroutine morse_init

Expand All @@ -332,7 +332,7 @@ subroutine force_morse(x, y, z, fx, fy, fz, eclas, nwalk)
dy = y(2, i) - y(1, i)
dz = z(2, i) - z(1, i)
r = dx**2 + dy**2 + dz**2
r = dsqrt(r)
r = sqrt(r)
ex = exp(-morse%a * (r - morse%r0))
fac = 2 * morse%a * ex * morse%d0 * (1 - ex) / r
fx(1, i) = fac * dx
Expand Down Expand Up @@ -364,7 +364,7 @@ subroutine hessian_morse(x, y, z, nwalk, hess)
dy = y(2, i) - y(1, i)
dz = z(2, i) - z(1, i)
r = dx**2 + dy**2 + dz**2
r = dsqrt(r)
r = sqrt(r)
ex = exp(-a * (r - morse%r0))
fac = 2 * a * ex * morse%d0 * (1 - ex) / r
fac2 = 2 * morse%d0 * a**2 * ex**2 / r**2
Expand Down
Loading
Loading