Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some warnings #1139

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
51 changes: 26 additions & 25 deletions src/constrain_pot.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ subroutine qpothess2(fix,n,at,xyz,h)
! calculate hessian
do i = 1, fix%n !loop over all atoms
ii = (fix%atoms(i)-1)*3
do k = 1, 3 !loop diagonal elements (xyz components)
do j = 1, fix%n !inner loop for sum over all atoms
if (i.ne.j) then
rij = xyz(:,fix%atoms(j))-xyz(:,fix%atoms(i))
r = norm2(rij)
r2 = r*r
r3 = r2*r
ij = lin(i-1,j-1)+1
r0 = fix%val(ij)
dr = r-r0
do j = 1, fix%n !inner loop for sum over all atoms
if (i.ne.j) then
rij = xyz(:,fix%atoms(j))-xyz(:,fix%atoms(i))
r = norm2(rij)
r2 = r*r
r3 = r2*r
ij = lin(i-1,j-1)+1
r0 = fix%val(ij)
dr = r-r0
do k = 1, 3 !loop diagonal elements (xyz components)
dx = xyz(k,fix%atoms(i))-xyz(k,fix%atoms(j))
dx2 = dx*dx
iik = lin(ii+k,ii+k)
Expand All @@ -123,32 +123,33 @@ subroutine qpothess2(fix,n,at,xyz,h)
iikl = lin(ii+k,ii+l)
h(iikl) = h(iikl) + 2.0_wp*fix%fc*r0*dx*dy/r3
enddo !end loop same-atom block-diagonal elements
endif
enddo !end inner loop for sum over all atoms
do j = i+1, fix%n !loop over the rest (mixed atoms)
rij = xyz(:,fix%atoms(j))-xyz(:,fix%atoms(i))
r = norm2(rij)
r2 = r*r
r3 = r2*r
ij = lin(i-1,j-1)+1
r0 = fix%val(ij)
dr = r-r0
jj = (fix%atoms(j)-1)*3
enddo !end loop diagonal elements (xyz components)
endif
enddo !end inner loop for sum over all atoms
do j = i+1, fix%n !loop over the rest (mixed atoms)
rij = xyz(:,fix%atoms(j))-xyz(:,fix%atoms(i))
r = norm2(rij)
r2 = r*r
r3 = r2*r
ij = lin(i-1,j-1)+1
r0 = fix%val(ij)
dr = r-r0
jj = (fix%atoms(j)-1)*3
do k = 1, 3 !loop diagonal elements (xyz components)
dx = xyz(k,fix%atoms(i))-xyz(k,fix%atoms(j))
do m = 1, 3
if (k.eq.m) then !same component case
dx = xyz(k,fix%atoms(i))-xyz(k,fix%atoms(j))
dx2 = dx*dx
ijk = lin(ii+k,jj+k)
h(ijk) = h(ijk) - 2.0_wp*fix%fc*(1.0_wp+dx2/r2-dx2*dr/r3-r0/r)
else !different component case
dx = xyz(k,fix%atoms(i))-xyz(k,fix%atoms(j))
dy = xyz(m,fix%atoms(i))-xyz(m,fix%atoms(j))
ikjm = lin(ii+k,jj+m)
h(ikjm) = h(ikjm) - 2.0_wp*fix%fc*r0*dx*dy/r3
endif
enddo
enddo
enddo !end loop diagonal elements (xyz components)
enddo !end loop diagonal elements (xyz components)
enddo
enddo !end loop atoms

contains
Expand Down
22 changes: 7 additions & 15 deletions src/gfnff/frag_hess.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,17 @@ function shortest_distance(nspin, start, goal, numnb, neighbours, input_distance
integer, intent(in) :: start
integer, intent(in) :: goal
integer, intent(in) :: numnb
integer, intent(in) :: neighbours(20, nspin)
integer, intent(in) :: neighbours(numnb, nspin, 1)
real(wp), intent(in) :: input_distances(nspin, nspin)
logical, intent(out) :: visited(nspin)
integer, intent(out) :: precessor(nspin)
integer :: current
integer :: neighbour
integer :: i_neighbours
integer :: bonds
real(wp) :: alt_dist
real(wp) :: distance(nspin)
end function shortest_distance
subroutine eigsort4(lab,ew,u)
subroutine eigsort4(lab,u,ew)
use xtb_mctc_accuracy, only : sp
implicit none
integer :: ii,k, j, i
real(sp) :: pp, hilf
integer :: lab
real(sp) :: ew(lab)
real(sp) :: u(lab,lab)
integer, intent(in) :: lab
real(sp), intent(inout) :: u(lab,lab)
real(sp), intent(inout) :: ew(lab)
end subroutine eigsort4
end interface

Expand Down Expand Up @@ -486,9 +478,9 @@ subroutine eigsort4(lab,u,ew)
integer :: ii,k, j, i
real(sp) :: pp, hilf

integer, intent(in) :: lab
real(sp), intent(inout) :: ew(lab)
integer, intent(in) :: lab
real(sp), intent(inout) :: u(lab,lab)
real(sp), intent(inout) :: ew(lab)

do ii = 2, lab
i = ii - 1
Expand Down
2 changes: 1 addition & 1 deletion src/gfnff/gfnff_eg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ subroutine egbond_hb(i,iat,jat,iTr,rab,rij,drij,drijdcn,hb_cn,hb_dcn,n,at,xyz,e,
hbH=jat
hbA=iat
else
write(*,'(10x,"No H-atom found in this bond ",i0,1x,i0)'), iat,jat
write(*,'(10x,"No H-atom found in this bond ",i0,1x,i0)') iat,jat
return
end if

Expand Down