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 for #252 #253

Merged
merged 2 commits into from
Jan 21, 2024
Merged
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
8 changes: 5 additions & 3 deletions src/legacy_algos/protonate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ subroutine xtblmo(env)
implicit none
type(systemdata) :: env
character(len=80) :: fname
character(len=512) :: jobcall
character(len=:),allocatable :: jobcall
integer :: io
character(len=*),parameter :: pipe = ' > xtb.out 2>/dev/null'

Expand All @@ -218,8 +218,10 @@ subroutine xtblmo(env)
!---- jobcall
write (*,*)
write (*,'('' LMO calculation ... '')',advance='no')
write (jobcall,'(a,1x,a,1x,a,'' --sp --lmo'',1x,a)') &
& trim(env%ProgName),trim(fname),trim(env%gfnver),trim(env%solv)
jobcall = trim(env%ProgName)
jobcall = trim(jobcall)//' '//trim(fname)
jobcall = trim(jobcall)//' '//trim(env%gfnver)
jobcall = trim(jobcall)//' --sp --lmo '//trim(env%solv)
jobcall = trim(jobcall)//trim(pipe)
call command(trim(jobcall),io)
write (*,'(''done.'')')
Expand Down
54 changes: 29 additions & 25 deletions src/legacy_algos/tautomerize.f90
Original file line number Diff line number Diff line change
Expand Up @@ -414,26 +414,24 @@ subroutine protens(ens,env,prot,tim)
real(wp) :: percent

character(len=*) :: ens
character(len=32) :: dirn
character(len=256) :: thispath,tmppath
character(len=256) :: filename
character(len=128) :: inpnam,outnam
character(len=512) :: jobcall

character(len=:),allocatable :: jobcall
logical :: niceprint

real(wp),allocatable :: xyz(:,:,:),eread(:)
integer,allocatable :: at(:)

character(len=*),parameter :: dirn='PROT'
!call printprotcy

!--- some settings
call getcwd(thispath)
dirn = 'PROT'
niceprint = env%niceprint
refchrg = env%chrg

r = makedir(trim(dirn))
r = makedir(dirn)

!--- read the file
call rdensembleparam(ens,nat,nall)
Expand All @@ -443,11 +441,11 @@ subroutine protens(ens,env,prot,tim)
natp = nat+1

!--- change dir
call chdir(trim(dirn))
call chdir(dirn)
call getcwd(tmppath)
!--- make new dirs
do i = 1,nall
write (filename,'(a,i0)') trim(dirn),i
write (filename,'(a,i0)') dirn,i
r = makedir(trim(filename))
call chdir(trim(filename))
call wrc0('coord',nat,at,xyz(:,:,i))
Expand All @@ -464,8 +462,12 @@ subroutine protens(ens,env,prot,tim)
end if

!--- creating the job
write (jobcall,'(a,1x,a,1x,a,'' --sp --lmo '',a,1x,a,a)') &
& trim(env%ProgName),'coord',trim(env%gfnver),trim(env%solv),' > xtb.out 2>/dev/null'
jobcall = trim(env%ProgName)
jobcall = trim(jobcall)//' '//'coord'
jobcall = trim(jobcall)//' '//trim(env%gfnver)
jobcall = trim(jobcall)//' --sp --lmo '//trim(env%solv)
jobcall = trim(jobcall)//' > xtb.out 2>/dev/null'


!--- calculation loop for LMOs
call tim%start(1,'LMO calc.')
Expand All @@ -475,30 +477,32 @@ subroutine protens(ens,env,prot,tim)
if (niceprint) then
call printprogbar(0.0_wp)
end if
!$omp parallel &
!$omp shared( vz,jobcall,nall,dirn,percent,k,niceprint )
!$omp single

!!$omp parallel &
!!$omp shared( vz,jobcall,nall,percent,k,niceprint ) &
!!$omp private(filename)
!!$omp single
do i = 1,nall
vz = i
!$omp task firstprivate( vz ) private( filename,io )
! !$omp task firstprivate( vz ) private( io )
call initsignal()
write (filename,'(a,i0)') trim(dirn),vz
write (filename,'(a,i0)') dirn,vz
call command('cd '//trim(filename)//' && '//trim(jobcall),io)
!$omp critical
! !$omp critical
k = k+1
if (niceprint) then
percent = float(k)/float(nall)*100.0d0
call printprogbar(percent)
else
write (6,'(1x,i0)',advance='no') k
flush (6)
write (stdout,'(1x,i0)',advance='no') k
flush (stdout)
end if
!$omp end critical
!$omp end task
! !$omp end critical
! !$omp end task
end do
!$omp taskwait
!$omp end single
!$omp end parallel
!!$omp taskwait
!!$omp end single
!!$omp end parallel
!--- this is a test for BASF
if (env%threads > 8) then
call sleep(5)
Expand All @@ -507,7 +511,7 @@ subroutine protens(ens,env,prot,tim)
write (*,'(a)',advance='no') 'Collecting generated protomers ...'
jobcall = trim(tmppath)//'/'//'protomers.xyz'
do i = 1,nall
write (filename,'(a,i0)') trim(dirn),i
write (filename,'(a,i0)') dirn,i
call chdir(trim(filename))
call coord2xyz('coordprot.0','struc_0.xyz')
call appendto('struc_0.xyz',jobcall)
Expand Down Expand Up @@ -565,7 +569,7 @@ subroutine protens(ens,env,prot,tim)

!--- change back to original dir and copy the file with optimized protomers
call chdir(thispath)
write (jobcall,'(a,a,a)') trim(tmppath),'/','protonated.xyz'
jobcall = trim(tmppath)//'/'//'protonared.xyz'
call rename(trim(jobcall),'protonated.xyz')
call rmrf(dirn)
return
Expand Down