Skip to content

Commit

Permalink
Linter fixes (adding intent attributes mostly)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Nov 27, 2024
1 parent 8e176e3 commit ff1c1a7
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 22 deletions.
13 changes: 8 additions & 5 deletions src/remd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ subroutine remd_swap(x, y, z, px, py, pz, fxc, fyc, fzc, eclas)
real(DP), intent(inout) :: fxc(:, :), fyc(:, :), fzc(:, :)
real(DP), intent(inout) :: eclas
real(DP) :: eclas_new, prob, probs(MAX_REPLICA), ran(MAX_REPLICA), rn
integer :: source, ierr, tag_en = 10, tag_swap = 1
integer, parameter :: tag_en = 10, tag_swap = 1
integer :: source, ierr
integer :: status(MPI_STATUS_SIZE), i
integer :: my_rank
logical :: lswap = .false., lswaps(MAX_REPLICA)
logical :: lswap, lswaps(MAX_REPLICA)
character(len=100) :: formt

lswap = .false.

! Broadcast array of random numbers from rank 0
my_rank = get_mpi_rank()
if (my_rank == 0) call vranf(ran, nreplica - 1)
Expand Down Expand Up @@ -147,9 +150,9 @@ subroutine swap_replicas(x, y, z, px, py, pz, fxc, fyc, fzc, rank1, rank2)
integer :: status(MPI_STATUS_SIZE)
integer :: my_rank

integer :: tag_x = 11, tag_y = 12, tag_z = 13
integer :: tag_px = 114, tag_py = 115, tag_pz = 116
integer :: tag_fx = 17, tag_fy = 18, tag_fz = 19
integer, parameter :: tag_x = 11, tag_y = 12, tag_z = 13
integer, parameter :: tag_px = 114, tag_py = 115, tag_pz = 116
integer, parameter :: tag_fx = 17, tag_fy = 18, tag_fz = 19
integer :: ierr, dest, size1, size2, irank

my_rank = get_mpi_rank()
Expand Down
1 change: 1 addition & 0 deletions src/sh_integ.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module mod_sh_integ
abstract interface
subroutine sh_integrator(en_array_int, en_array_newint, dotproduct_int, dotproduct_newint, dtp)
import :: DP
implicit none
! Interpolated potential energies
real(DP), intent(in), dimension(:) :: en_array_int, en_array_newint
! Interpolated dotproduct = nacm x velocity
Expand Down
6 changes: 3 additions & 3 deletions src/shake.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ subroutine find_hbonds(x, y, z, num_shake)

! DH fixed threshold for now, we should make it a parameter
! Or determine bonds in a better way
hbond_len_thr = 2.0 * ANG
hbond_len_thr = 2.0_DP * ANG

Check warning on line 28 in src/shake.F90

View check run for this annotation

Codecov / codecov/patch

src/shake.F90#L28

Added line #L28 was not covered by tests
! Here we assume that each H atom has a single bond
num_shake = count_atoms_by_name(names, 'H', natom)
! TODO: Not sure about this, but shake does not
Expand Down Expand Up @@ -76,8 +76,8 @@ end subroutine find_hbonds

subroutine shake_init(x, y, z)
use mod_files, only: stdout
real(DP) x(:, :), y(:, :), z(:, :)
real(DP) xi, yi, zi, xj, yj, zj
real(DP), intent(in) :: x(:, :), y(:, :), z(:, :)
real(DP) :: xi, yi, zi, xj, yj, zj
integer :: ixshake, i, j

write (stdout, *) 'Setting distances for SHAKE from XYZ coordinates'
Expand Down
2 changes: 1 addition & 1 deletion src/surfacehop.F90
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ end subroutine print_sh_input
subroutine set_current_state(current_state)
integer, intent(in) :: current_state
istate = current_state
end subroutine
end subroutine set_current_state

subroutine check_sh_parameters()
use mod_utils, only: int_positive, int_nonnegative, int_switch, real_nonnegative
Expand Down
2 changes: 1 addition & 1 deletion src/tera_mpi_api.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module mod_terampi
subroutine initialize_terachem_interface(tc_server_name)
use mod_general, only: nwalk, iremd
use mod_mpi, only: get_mpi_rank
character(len=*) :: tc_server_name
character(len=*), intent(in) :: tc_server_name
integer :: i, ierr

if (nwalk > 1) then
Expand Down
11 changes: 4 additions & 7 deletions src/utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ end function get_distance
real(DP) function get_angle(x, y, z, at1, at2, at3, iw) result(angle)
use mod_const, only: PI
real(DP), intent(in) :: x(:, :), y(:, :), z(:, :)
integer, intent(in) :: iw
integer, intent(in) :: at1, at2, at3, iw
real(DP) :: vec1x, vec1y, vec1z
real(DP) :: vec2x, vec2y, vec2z
integer :: at1, at2, at3

if (at1 == at2 .or. at1 == at3 .or. at2 == at3) then
angle = 0
Expand All @@ -53,12 +52,11 @@ end function get_angle
real(DP) function get_dihedral(x, y, z, at1, at2, at3, at4, iw, shiftdih)
use mod_const, only: PI
real(DP), intent(in) :: x(:, :), y(:, :), z(:, :), shiftdih
integer, intent(in) :: iw
integer, intent(in) :: at1, at2, at3, at4, iw
real(DP) :: vec1x, vec1y, vec1z
real(DP) :: vec2x, vec2y, vec2z
real(DP) :: vec3x, vec3y, vec3z, sign
real(DP) :: norm1x, norm1y, norm1z, norm2x, norm2y, norm2z
integer :: at1, at2, at3, at4

vec1x = x(at1, iw) - x(at2, iw)
vec1y = y(at1, iw) - y(at2, iw)
Expand Down Expand Up @@ -269,7 +267,7 @@ subroutine file_exists_or_exit(fname)
end subroutine file_exists_or_exit

integer function open_file_for_reading(fname) result(un)
character(len=*) :: fname
character(len=*), intent(in) :: fname
character(300) :: errmsg
integer :: iost

Expand All @@ -281,7 +279,6 @@ integer function open_file_for_reading(fname) result(un)
end function open_file_for_reading

real(DP) function ekin_p(px, py, pz, mass, natom, nwalk)
implicit none
real(DP), dimension(:, :), intent(in) :: px, py, pz
real(DP), dimension(:, :), intent(in) :: mass
integer, intent(in) :: natom, nwalk
Expand Down Expand Up @@ -349,7 +346,7 @@ end subroutine int_switch
subroutine milisleep(milisec)
use, intrinsic :: iso_c_binding, only: C_INT, C_INT32_T
use mod_interfaces, only: usleep
integer :: milisec
integer, intent(in) :: milisec
integer(kind=C_INT32_T) :: usec
integer(kind=C_INT) :: c_err

Expand Down
9 changes: 5 additions & 4 deletions src/vinit.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ module mod_vinit
! Adapted (real(DP), no angular velocities, mass) B. Schmidt, Apr 6, 1995
!
!------------------------------------------------------------------------
subroutine vinit(TEMP, MASS, vx, vy, vz)
subroutine vinit(temp, mass, vx, vy, vz)
use mod_general, only: natom, nwalk
use mod_random, only: gautrg
real(DP), intent(out) :: vx(:, :), vy(:, :), vz(:, :)
real(DP), intent(in) :: temp
real(DP), intent(in) :: mass(:)
real(DP), intent(out) :: vx(:, :), vy(:, :), vz(:, :)
real(DP) :: rans(3 * size(mass))
real(DP) :: TEMP, SIGMA
real(DP) :: sigma
integer :: iw, iat, pom

do iw = 1, nwalk
Expand Down Expand Up @@ -264,7 +265,7 @@ subroutine calc_inertia_tensor(x, y, z, masses, iw, I)
real(DP), intent(in) :: x(:, :), y(:, :), z(:, :)
real(DP), intent(in) :: masses(:)
integer, intent(in) :: iw ! Bead index
real(DP) :: I(0:8)
real(DP), intent(out) :: I(0:8)
real(DP) :: xx, xy, xz, yy, yz, zz
integer :: iat

Expand Down
2 changes: 1 addition & 1 deletion src/water.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ subroutine check_water(natom, names)
use mod_error, only: fatal_error
use mod_utils, only: count_atoms_by_name
integer, intent(in) :: natom
character(len=2) :: names(:)
character(len=2), intent(in) :: names(:)
integer :: nH, nO
integer :: error, iat

Expand Down

0 comments on commit ff1c1a7

Please sign in to comment.