Skip to content

Commit

Permalink
consistent comments: oniom.f90, gfnff_eg.f90, timer.f90
Browse files Browse the repository at this point in the history
Signed-off-by: albert <92109627+Albkat@users.noreply.github.com>
  • Loading branch information
Albkat committed Jul 7, 2023
1 parent d8a5d5b commit 18e6803
Show file tree
Hide file tree
Showing 7 changed files with 3,734 additions and 3,383 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
*.out
*.app

# Editor specific metadata
.vscode
*f90.swp

# directories
/build*/
/_*/
Expand All @@ -41,7 +45,7 @@ man/*.pdf
man/*.xml
man/*.html

# files produces by the program
# files produced by the program
xtbrestart
.EDISP
energy
Expand All @@ -65,3 +69,6 @@ __pycache__/
python/dist
python/build
*.egg-info

# external directory
ext
51 changes: 31 additions & 20 deletions src/gfnff/calculator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module xtb_gfnff_calculator
public :: TGFFCalculator, newGFFCalculator


!> Calculator interface for xTB based methods
!> calculator interface for xTB based methods
type, extends(TCalculator) :: TGFFCalculator

type(TGFFData) :: param
Expand All @@ -70,6 +70,7 @@ module xtb_gfnff_calculator


subroutine newGFFCalculator(env, mol, calc, fname, restart, version)

use xtb_gfnff_param
use xtb_gfnff_setup, only : gfnff_setup
use xtb_disp_dftd4, only : newD3Model
Expand Down Expand Up @@ -100,19 +101,22 @@ subroutine newGFFCalculator(env, mol, calc, fname, restart, version)

call calc%topo%zero
calc%update = .true.
! global accuracy factor similar to acc in xtb used in SCF

! global accuracy factor similar to acc in xtb used in SCF !
calc%accuracy = 0.1_wp
if (mol%n > 10000) then
calc%accuracy = 2.0_wp
end if

!> Obtain the parameter file
! obtain the parameter file !
call open_file(ich, fname, 'r')
exist = ich /= -1
if (exist) then
call gfnff_read_param(ich, calc%param)
call close_file(ich)
else ! no parameter file, try to load internal version
call close_file(ich)

! no parameter file, try to load internal version !
else
call gfnff_load_param(calc%version, calc%param, exist)
if (.not.exist) then
call env%error('Parameter file '//fname//' not found!', source)
Expand All @@ -134,7 +138,7 @@ subroutine newGFFCalculator(env, mol, calc, fname, restart, version)
end subroutine newGFFCalculator



!> GFN-FF wrapper for the single point energy evaluation
subroutine singlepoint(self, env, mol, chk, printlevel, restart, &
& energy, gradient, sigma, hlgap, results)

Expand Down Expand Up @@ -182,9 +186,13 @@ subroutine singlepoint(self, env, mol, chk, printlevel, restart, &
logical, parameter :: ccm = .true.
logical :: exitRun
logical :: pr

!> GFN-FF geometry optimization
logical :: optpr
!! for the case of the geometry optimization

!-------!
! setup !
!-------!

call mol%update

Expand All @@ -199,7 +207,7 @@ subroutine singlepoint(self, env, mol, chk, printlevel, restart, &
call newBornModel(self%solvation, env, solvation, mol%at)
end if

!> To distinguish optimization, final sp and sp
! to distinguish optimization, final sp and sp !
if ((set%runtyp.eq.p_run_opt).or.(set%runtyp.eq.p_run_ohess).or. &
& (set%runtyp.eq.p_run_omd).or.(set%runtyp.eq.p_run_screen).or. &
& (set%runtyp.eq.p_run_metaopt)) then
Expand All @@ -210,10 +218,10 @@ subroutine singlepoint(self, env, mol, chk, printlevel, restart, &

pr = gff_print .and. printlevel > 0

!--------------------!
! actual calculation !
!--------------------!

! ------------------------------------------------------------------------
! actual calculation
! ------------------------------------------------------------------------
call gfnff_eg(env,pr,mol%n,nint(mol%chrg),mol%at,mol%xyz,make_chrg, &
& gradient,energy,results,self%param,self%topo,chk%nlist,solvation,&
& self%update,self%version,self%accuracy,minpr=optpr)
Expand All @@ -224,19 +232,18 @@ subroutine singlepoint(self, env, mol, chk, printlevel, restart, &
return
end if

! ------------------------------------------------------------------------
! post processing of gradient and energy

! ------------------------------------------------------------------------
! various external potentials
! ---------------------------------------!
! post processing of gradient and energy !
!----------------------------------------!

! various external potentials !
call constrain_pot(potset,mol%n,mol%at,mol%xyz,gradient,efix)
call constrpot (mol%n,mol%at,mol%xyz,gradient,efix)
call cavity_egrad(mol%n,mol%at,mol%xyz,efix,gradient)
call metadynamic (metaset,mol%n,mol%at,mol%xyz,efix,gradient)
call metadynamic (rmsdset,mol%n,mol%at,mol%xyz,efix,gradient)

! ------------------------------------------------------------------------
! fixing of certain atoms
! fixing of certain atoms !
! print*,abs(efix/etot)
energy = energy + efix
results%e_total = energy
Expand All @@ -249,7 +256,7 @@ subroutine singlepoint(self, env, mol, chk, printlevel, restart, &
endif

if (printlevel.ge.2) then
! start with summary header
! start with summary header !
if (.not.set%silent) then
write(env%unit,'(9x,53(":"))')
write(env%unit,'(9x,"::",21x,a,21x,"::")') "SUMMARY"
Expand Down Expand Up @@ -290,10 +297,14 @@ subroutine singlepoint(self, env, mol, chk, printlevel, restart, &
end subroutine singlepoint

subroutine print_gfnff_results(iunit,res_gff,verbose,lsolv)

use xtb_type_data
integer, intent(in) :: iunit ! file handle (usually output_unit=6)

!> file handle (usually output_unit=6)
integer, intent(in) :: iunit
type(scc_results), intent(in) :: res_gff
logical,intent(in) :: verbose,lsolv

write(iunit,outfmt) "bond energy ", res_gff%e_bond, "Eh "
write(iunit,outfmt) "angle energy ", res_gff%e_angl, "Eh "
write(iunit,outfmt) "torsion energy ", res_gff%e_tors, "Eh "
Expand Down
Loading

0 comments on commit 18e6803

Please sign in to comment.