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

Fixing implicit solvation in tblite and safer MKL handling #331

Merged
merged 32 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
df50288
First implementation of CANGEN algo
pprcht Jul 30, 2024
c136e44
fix bug in strucreader change
pprcht Jul 30, 2024
a5d5c90
Merge branch 'devel' into cangen
pprcht Jul 30, 2024
08669d8
cangen implementation, stereocenter identification
pprcht Jul 31, 2024
b94f176
Merge branch 'devel' into cangen
pprcht Jul 31, 2024
177c5f9
Add shrinking and comparison routines to canonical mod
pprcht Jul 31, 2024
934f297
Implementation of comparison via canonical identifiers in protonation
pprcht Jul 31, 2024
ad46820
Add function to add 2 or more protons at once (e.g. "--protonate 2" )
pprcht Aug 2, 2024
6d33db4
Kick out dissociated structures in new protonation script
pprcht Aug 2, 2024
507a899
printout change
pprcht Aug 2, 2024
3387e8d
Update GFNFF submodule
pprcht Aug 2, 2024
90a9591
Refinement implementation for protonation tool
pprcht Aug 2, 2024
b0a7842
Some playing around with the sorting
pprcht Aug 4, 2024
69ae558
Start deprotonation rework
pprcht Aug 5, 2024
0332798
remove stop
pprcht Aug 5, 2024
885605b
Implementation of alternative canonical algorithm
pprcht Aug 5, 2024
4806dcb
Merge branch 'devel' into cangen
pprcht Aug 6, 2024
388e45d
Merge branch 'devel' into protonate2
pprcht Aug 6, 2024
352163d
Start implementing revised tautomerization script
pprcht Aug 6, 2024
5e494c9
Merge branch 'cangen' into protonate2
pprcht Aug 7, 2024
894e3d6
single-tautomerization routine
pprcht Aug 7, 2024
3b19b6b
Calculation object handling update in protonation tools
pprcht Aug 11, 2024
25627ce
Slightly safer MKL nested parallelism handling
pprcht Aug 11, 2024
f2f6449
Repair fragment change sorting in protonation routines
pprcht Aug 11, 2024
4c28023
Better OpenBLAS compatibility (working towards conda builds)
pprcht Aug 11, 2024
bba8d4e
Take care of parallelization in tester
pprcht Aug 11, 2024
e11448b
More changes for correct gcc/openblas build
pprcht Aug 12, 2024
86e6d3d
Edit cmd settings
pprcht Aug 13, 2024
c83cfbc
remove overwrite of env%ref for energy-sorting-only CREGEN
pprcht Aug 13, 2024
0998418
repair handling of testmol.f90
pprcht Aug 13, 2024
d0e78e1
fix printout
pprcht Aug 15, 2024
340ec32
Adapt tblite fork with fixed implicit solvation
pprcht Aug 17, 2024
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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
url = https://github.com/fortran-lang/test-drive.git
[submodule "subprojects/tblite"]
path = subprojects/tblite
url = https://github.com/tblite/tblite.git
branch = main
url = https://github.com/pprcht/tblite.git
branch = xtb_solvation
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ if(NOT TARGET "OpenMP::OpenMP_Fortran" AND WITH_OpenMP)
find_package("OpenMP" REQUIRED)
endif()

# Check if we are using OpenBLAS (need a precompiler definition if yes)
if(LAPACK_LIBRARIES)
string(FIND "${LAPACK_LIBRARIES}" "openblas" _openblas_in_lapack)

if(NOT _openblas_in_lapack EQUAL -1)
message(STATUS "libopenblas was found as part of LAPACK")
add_compile_definitions(WITH_OPENBLAS)
endif()
endif()

# Fortran unit test interface (also used by other subprojects)
if(NOT TARGET "test-drive::test-drive" AND WITH_TESTS)
find_package("test-drive" REQUIRED)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ Working and tested builds of CREST (mostly on Ubuntu 20.04 LTS):

| Build System | Compiler | Linear Algebra Backend | Build type | Status | Note |
|--------------|----------|------------------------|:--------------:|:----------:|:----:|
| CMake 3.28.3 | GNU (gcc 10.3.0) | [OpenBLAS](https://github.com/xianyi/OpenBLAS) (with OpenMP) | dynamic | ✅ ||
| CMake 3.28.3 | GNU (gcc 10.3.0) | [MKL shared (oneAPI 2023.1)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) | dynamic | ✅ ||
| CMake 3.28.3 | GNU (gcc 9.5.0) | [MKL shared (oneAPI 2023.1)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) | dynamic | ✅ ||
| CMake 3.28.3 | [Intel (`ifort`/`icc` 2021.9.0)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html) | [MKL static (oneAPI 2023.1)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) | dynamic | ⚠️ | OpenMP problem ([#285](https://github.com/crest-lab/crest/issues/285)) |
| CMake 3.30.2 | GNU (gcc 14.1.0) | [libopenblas 0.3.27](https://anaconda.org/conda-forge/libopenblas) | dynamic | ✅ ||
| CMake 3.28.3 | [Intel (`ifort`/`icc` 2021.9.0)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html) | [MKL static (oneAPI 2023.1)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) | dynamic | ⚠️ | OpenMP/MKL problem ([#285](https://github.com/crest-lab/crest/issues/285)) |
| Meson 1.2.0 | [Intel (`ifort`/`icc` 2021.9.0)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html) | [MKL static (oneAPI 2023.1)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) | static | ✅ | [continuous release build](https://github.com/crest-lab/crest/releases/tag/latest) |
| Meson 1.2.0 | [Intel (`ifort` 2021.9.0/`icx` 2023.1.0)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/toolkits.html) | [MKL static (oneAPI 2023.1)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) | static | ✅ ||

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ list(APPEND srcs
"${dir}/axis_module.f90"
"${dir}/biasmerge.f90"
"${dir}/bondconstraint.f90"
"${dir}/canonical.f90"
"${dir}/ccegen.f90"
"${dir}/choose_settings.f90"
"${dir}/classes.f90"
Expand Down Expand Up @@ -79,7 +80,6 @@ list(APPEND srcs
"${dir}/strucreader.f90"
"${dir}/symmetry2.f90"
"${dir}/symmetry_i.c"
"${dir}/testmol.f90"
"${dir}/timer.f90"
"${dir}/trackorigin.f90"
"${dir}/utilmod.f90"
Expand Down
31 changes: 25 additions & 6 deletions src/algos/parallel.f90
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,27 @@ subroutine crest_sploop(env,nat,nall,at,xyz,eread)
integer :: i,j,k,l,io,ich,ich2,c,z,job_id,zcopy
logical :: pr,wr,ex
type(calcdata),allocatable :: calculations(:)
integer :: T !> number of parallel running instances
real(wp) :: energy,gnorm
real(wp),allocatable :: grad(:,:),grads(:,:,:)
integer :: thread_id,vz,job
character(len=80) :: atmp
real(wp) :: percent,runtime

type(timer) :: profiler
integer :: T,Tn !> threads and threads per core
logical :: nested

!>--- check if we have any calculation settings allocated
if (env%calc%ncalculations < 1) then
write (stdout,*) 'no calculations allocated'
return
end if

!>--- prepare calculation objects for parallelization (one per thread)
call new_ompautoset(env,'auto_nested',nall,T,Tn)
nested = env%omp_allow_nested


!>--- prepare objects for parallelization
T = env%threads
allocate (calculations(T),source=env%calc)
Expand Down Expand Up @@ -153,7 +159,7 @@ subroutine crest_sploop(env,nat,nall,at,xyz,eread)
!>--- loop over ensemble
!$omp parallel &
!$omp shared(env,calculations,nat,nall,at,xyz,eread,grads,c,k,z,pr,wr) &
!$omp shared(ich,ich2,mols)
!$omp shared(ich,ich2,mols, nested,Tn)
!$omp single
do i = 1,nall

Expand All @@ -162,6 +168,9 @@ subroutine crest_sploop(env,nat,nall,at,xyz,eread)
!$omp task firstprivate( vz ) private(i,j,job,energy,io,thread_id,zcopy)
call initsignal()

!>--- OpenMP nested region threads
if (nested) call ompmklset(Tn)

thread_id = OMP_GET_THREAD_NUM()
job = thread_id+1
!>--- modify calculation spaces
Expand Down Expand Up @@ -259,14 +268,15 @@ subroutine crest_oloop(env,nat,nall,at,xyz,eread,dump,customcalc)
integer :: i,j,k,l,io,ich,ich2,c,z,job_id,zcopy
logical :: pr,wr,ex
type(calcdata),allocatable :: calculations(:)
integer :: T !> number of parallel running instances
real(wp) :: energy,gnorm
real(wp),allocatable :: grads(:,:,:)
integer :: thread_id,vz,job
character(len=80) :: atmp
real(wp) :: percent,runtime
type(calcdata),pointer :: mycalc
type(timer) :: profiler
integer :: T,Tn !> threads and threads per core
logical :: nested

!>--- decide wether to skip this call
if (trackrestart(env)) then
Expand All @@ -287,8 +297,11 @@ subroutine crest_oloop(env,nat,nall,at,xyz,eread,dump,customcalc)
return
end if

!>--- prepare calculation objects for parallelization (one per thread)
call new_ompautoset(env,'auto_nested',nall,T,Tn)
nested = env%omp_allow_nested

!>--- prepare objects for parallelization
T = env%threads
allocate (calculations(T),source=mycalc)
allocate (mols(T),molsnew(T))
do i = 1,T
Expand All @@ -299,6 +312,9 @@ subroutine crest_oloop(env,nat,nall,at,xyz,eread,dump,customcalc)
if (.not.ex) then
io = makedir(trim(mycalc%calcs(j)%calcspace))
end if
if(calculations(i)%calcs(j)%id == jobtype%tblite)then
calculations(i)%optnewinit=.true.
endif
write (atmp,'(a,"_",i0)') sep,i
calculations(i)%calcs(j)%calcspace = mycalc%calcs(j)%calcspace//trim(atmp)
call calculations(i)%calcs(j)%printid(i,j)
Expand Down Expand Up @@ -331,7 +347,7 @@ subroutine crest_oloop(env,nat,nall,at,xyz,eread,dump,customcalc)
!>--- loop over ensemble
!$omp parallel &
!$omp shared(env,calculations,nat,nall,at,xyz,eread,grads,c,k,z,pr,wr,dump) &
!$omp shared(ich,ich2,mols,molsnew)
!$omp shared(ich,ich2,mols,molsnew, nested,Tn)
!$omp single
do i = 1,nall

Expand All @@ -340,6 +356,9 @@ subroutine crest_oloop(env,nat,nall,at,xyz,eread,dump,customcalc)
!$omp task firstprivate( vz ) private(j,job,energy,io,atmp,gnorm,thread_id,zcopy)
call initsignal()

!>--- OpenMP nested region threads
if (nested) call ompmklset(Tn)

thread_id = OMP_GET_THREAD_NUM()
job = thread_id+1
!>--- modify calculation spaces
Expand Down Expand Up @@ -1036,7 +1055,7 @@ subroutine parallel_md_finish_printout(MD,vz,io,profiler)
if (io == 0) then
write (btmp,'(a,1x,i3,a)') trim(atmp),vz,' completed successfully'
else
write (btmp,'(a,1x,i3,a)') trim(atmp),vz,' terminated with early'
write (btmp,'(a,1x,i3,a)') trim(atmp),vz,' terminated EARLY'
end if
call profiler%write_timing(stdout,vz,trim(btmp))

Expand Down
49 changes: 14 additions & 35 deletions src/algos/playground.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,7 @@ subroutine crest_playground(env,tim)
use crest_data
use crest_calculator
use strucrd
use optimize_module
use tblite_api
use wiberg_mayer, only: write_wbo
use adjacency
use zdata
use probabilities_module
use parse_csv
use cregen_interface
use dynamics_module
use canonical_mod
implicit none
type(systemdata),intent(inout) :: env
type(timer),intent(inout) :: tim
Expand All @@ -55,21 +47,11 @@ subroutine crest_playground(env,tim)
logical,allocatable :: rings(:,:)
integer,allocatable :: tmp(:)
logical :: connected,fail
type(zmolecule) :: zmol

real(wp) :: energy
real(wp),allocatable :: grad(:,:),geo(:,:),csv(:,:)
integer,allocatable :: na(:),nb(:),nc(:),at2(:)
integer :: nat2
real(wp),allocatable :: mu(:)
real(wp) :: kappa,rrad

integer :: nsim
character(len=:),allocatable :: ensnam
type(mddata) :: mddat
type(mddata),allocatable :: mddats(:)


type(canonical_sorter) :: can
!========================================================================================!
call tim%start(14,'Test implementation')
!========================================================================================!
Expand All @@ -88,23 +70,20 @@ subroutine crest_playground(env,tim)
write(*,*)
!========================================================================================!

!>--- sets the MD length according to a flexibility measure
call md_length_setup(env)
!>--- create the MD calculator saved to env
call env_to_mddat(env)


nsim = 3
call crest_search_multimd_init(env,mol,mddat,nsim)
allocate (mddats(nsim), source=mddat)
call crest_search_multimd_init2(env,mddats,nsim)
allocate(grad(3,mol%nat), source=0.0_wp)
call env2calc(env,calc,mol)
calc%calcs(1)%rdwbo=.true.
call calc%info(stdout)

call crest_search_multimd(env,mol,mddats,nsim)
!>--- a file called crest_dynamics.trj should have been written
ensnam = 'crest_dynamics.trj'
!>--- deallocate for next iteration
if(allocated(mddats))deallocate(mddats)
call engrad(mol,calc,energy,grad,io)
call calculation_summary(calc,mol,energy,grad)


write(stdout,*)
write(stdout,*) 'CANGEN algorithm'
call can%init(mol,calc%calcs(1)%wbo,'apsp+')
call can%stereo(mol)
call can%rankprint(mol)

!========================================================================================!
call tim%stop(14)
Expand Down
Loading
Loading