Skip to content

Commit

Permalink
Set threads for MD, allow ANCOPT threshold definition in input.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
pprcht committed Nov 7, 2023
1 parent c187847 commit e784258
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 39 deletions.
4 changes: 3 additions & 1 deletion src/algos/dynamics.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ subroutine crest_moleculardynamics(env,tim)
write(stdout,*) " |___/ "
write(stdout,*)
!========================================================================================!
call ompset_max(env%threads)
call ompprint_intern()
call tim%start(14,'Molecular dynamics (MD)')
call env%ref%to(mol)
write (stdout,*)
Expand All @@ -61,7 +63,7 @@ subroutine crest_moleculardynamics(env,tim)

!>--- parallelization settings
!call ompautoset(env%threads,7,env%omp,env%MAXRUN,1)
call ompprint_intern()
!call ompprint_intern()

pr = .true.
!>--- default settings from env
Expand Down
12 changes: 7 additions & 5 deletions src/algos/scan.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ subroutine crest_scan(env,tim)

real(wp) :: energy
real(wp),allocatable :: grad(:,:)
!========================================================================================!
call tim%start(14,'Coordinate scan')

!========================================================================================!
write (*,*)
!call system('figlet scan')
Expand All @@ -57,7 +56,10 @@ subroutine crest_scan(env,tim)
write (stdout,*) "\__ \ (_| (_| | | | |"
write (stdout,*) "|___/\___\__,_|_| |_|"
write (stdout,*) " "

!========================================================================================!
call ompset_max(env%threads)
call ompprint_intern()
call tim%start(14,'Coordinate scan')
!========================================================================================!
call env%ref%to(mol)
write (*,*)
Expand All @@ -76,8 +78,8 @@ subroutine crest_scan(env,tim)
calcclean = env%calc

!>--- initialize scanning
io = makedir('scanfiles')
call initscans(mol,calc)
io = makedir('scanfiles')

!>--- runscan
i = 1
Expand Down Expand Up @@ -143,7 +145,7 @@ subroutine initscans(mol,calc)
call calc%add(constr)
calc%scans(i)%constrnmbr = calc%nconstraints
k = minloc(abs(tmppoints(:) - dref),1)
call shiftpoints(nsteps,k,tmppoints,calc%scans(i)%restore,.false.)
!call shiftpoints(nsteps,k,tmppoints,calc%scans(i)%restore,.false.)
calc%scans(i)%points = tmppoints
!write(*,*) calc%scans(i)%points
case (3) !>-- dihedral
Expand Down
105 changes: 72 additions & 33 deletions src/parsing/parse_calcdata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module parse_calcdata
use tblite_api,only:xtblvl

use parse_block,only:datablock
use parse_keyvalue,only:keyvalue
use parse_keyvalue,only:keyvalue,valuetypes
use parse_datastruct,only:root_object

implicit none
Expand Down Expand Up @@ -658,42 +658,81 @@ subroutine parse_scan_auto(scn,kv,success)
scn%type = 1
scn%n = 2
allocate (scn%atms(2))
read (kv%value_rawa(1),*) atm1
scn%atms(1) = atm1
read (kv%value_rawa(2),*) atm2
scn%atms(2) = atm2
read (kv%value_rawa(3),*) dum1
scn%minval = dum1
read (kv%value_rawa(4),*) dum2
scn%maxval = dum2
if (kv%na > 4) then
read (kv%value_rawa(5),*) nsteps
scn%steps = nsteps
end if
success = .true.
if(kv%id == valuetypes%float_array ) then
scn%atms(1) = nint(kv%value_fa(1))
scn%atms(2) = nint(kv%value_fa(2))
scn%minval = kv%value_fa(3)
scn%maxval = kv%value_fa(4)
if (kv%na > 4) then
scn%steps = nint(kv%value_fa(5))
end if
success = .true.
else if( kv%id == valuetypes%int_array ) then
scn%atms(1) = kv%value_ia(1)
scn%atms(2) = kv%value_ia(2)
scn%minval = real(kv%value_ia(3))
scn%maxval = real(kv%value_ia(4))
if (kv%na > 4) then
scn%steps = kv%value_ia(5)
end if
success = .true.
endif

case ('dihedral')
scn%type = 3
scn%n = 2
write(*,*) kv%value_rawa(:)
write(*,*) kv%value_ia(:)
write(*,*) kv%value_fa(:)
allocate (scn%atms(4))
read (kv%value_rawa(1),*) atm1
scn%atms(1) = atm1
read (kv%value_rawa(2),*) atm2
scn%atms(2) = atm2
read (kv%value_rawa(3),*) atm3
scn%atms(3) = atm3
read (kv%value_rawa(4),*) atm4
scn%atms(4) = atm4
if (kv%na > 4) then
read (kv%value_rawa(5),*) nsteps
scn%steps = nsteps
end if
if (kv%na > 6) then
read (kv%value_rawa(6),*) dum1
scn%minval = dum1
read (kv%value_rawa(7),*) dum2
scn%maxval = dum2
end if
success = .true.

if(kv%id == valuetypes%float_array ) then
scn%atms(1) = nint(kv%value_fa(1))
scn%atms(2) = nint(kv%value_fa(2))
scn%atms(3) = nint(kv%value_fa(3))
scn%atms(4) = nint(kv%value_fa(4))
if (kv%na > 4) then
scn%steps = nint(kv%value_fa(5))
end if
if (kv%na > 6) then
scn%minval = kv%value_fa(6)
scn%maxval = kv%value_fa(7)
end if
success = .true.
else if( kv%id == valuetypes%int_array ) then
scn%atms(1) = kv%value_ia(1)
scn%atms(2) = kv%value_ia(2)
scn%atms(3) = kv%value_ia(3)
scn%atms(4) = kv%value_ia(4)
if (kv%na > 4) then
scn%steps = kv%value_ia(5)
end if
if (kv%na > 6) then
scn%minval = real(kv%value_ia(6))
scn%maxval = real(kv%value_ia(7))
end if
success = .true.
endif

!read (kv%value_rawa(1),*) atm1
!scn%atms(1) = atm1
!read (kv%value_rawa(2),*) atm2
!scn%atms(2) = atm2
!read (kv%value_rawa(3),*) atm3
!scn%atms(3) = atm3
!read (kv%value_rawa(4),*) atm4
!scn%atms(4) = atm4
!if (kv%na > 4) then
! read (kv%value_rawa(5),*) nsteps
! scn%steps = nsteps
!end if
!if (kv%na > 6) then
! read (kv%value_rawa(6),*) dum1
! scn%minval = dum1
! read (kv%value_rawa(7),*) dum2
! scn%maxval = dum2
!end if
!success = .true.
case default
return
end select
Expand Down
7 changes: 7 additions & 0 deletions src/parsing/parse_maindata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ subroutine parse_main_auto(env,kv)
case (valuetypes%string) !> string
call parse_main_c(env,kv%key,kv%value_c)
end select
!> other, with multiple or raw type
select case(kv%key)
case ('optlev','ancopt_level')
env%optlev = optlevnum(kv%rawvalue)
end select
end subroutine parse_main_auto
subroutine parse_main_float(env,key,val)
implicit none
Expand Down Expand Up @@ -105,9 +110,11 @@ subroutine parse_main_c(env,key,val)
case ('ancopt','optimize')
env%preopt = .false.
env%crestver = crest_optimize
env%optlev = 0.0_wp
case ('ancopt_ensemble','optimize_ensemble','mdopt')
env%preopt = .false.
env%crestver = crest_mdopt2
env%optlev = 0.0d0
case ('screen_ensemble','screen')
env%preopt = .false.
env%crestver = crest_screen
Expand Down

0 comments on commit e784258

Please sign in to comment.