diff --git a/.gitmodules b/.gitmodules index 36b1713c..c6ae0d61 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,6 +21,6 @@ path = subprojects/tblite url = https://github.com/pprcht/tblite.git branch = xtb_solvation -[submodule "subprojects/libpvol"] - path = subprojects/libpvol +[submodule "subprojects/pvol"] + path = subprojects/pvol url = https://github.com/neudecker-group/libpvol.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e1c91fe..72d773cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,7 @@ if(NOT TARGET "gfn0::gfn0" AND WITH_GFN0) endif() # libpvol -if(NOT TARGET "libpvol::libpvol" AND WITH_LIBPVOL) +if(NOT TARGET "pvol::pvol" AND WITH_LIBPVOL) find_package("libpvol" REQUIRED) add_compile_definitions(WITH_LIBPVOL) endif() @@ -150,7 +150,7 @@ if(WITH_OBJECT AND NOT STATICBUILD) $<$:tblite::tblite> $<$:gfn0::gfn0> $<$:gfnff::gfnff> - $<$:xhcff::xhcff> + $<$:pvol::pvol> $<$:toml-f::toml-f> $<$:lwoniom::lwoniom> $<$:OpenMP::OpenMP_Fortran> @@ -201,7 +201,7 @@ target_link_libraries( $<$:tblite::tblite> $<$:gfn0::gfn0> $<$:gfnff::gfnff> - $<$:xhcff::xhcff> + $<$:pvol::pvol> $<$:toml-f::toml-f> $<$:lwoniom::lwoniom> $<$:-static> @@ -246,7 +246,7 @@ if (WITH_OBJECT AND NOT STATICBUILD) $<$:tblite::tblite> $<$:gfn0::gfn0> $<$:gfnff::gfnff> - $<$:xhcff::xhcff> + $<$:pvol::pvol> $<$:toml-f::toml-f> $<$:lwoniom::lwoniom> ) diff --git a/config/modules/Findlibpvol.cmake b/config/modules/Findlibpvol.cmake index dcb8ef44..2e756b9e 100644 --- a/config/modules/Findlibpvol.cmake +++ b/config/modules/Findlibpvol.cmake @@ -14,8 +14,8 @@ # You should have received a copy of the GNU Lesser General Public License # along with crest. If not, see . -set(_lib "libpvol") -set(_pkg "LIBPVOL") +set(_lib "pvol") +set(_pkg "PVOL") set(_url "https://github.com/neudecker-group/libpvol.git") if(NOT DEFINED "${_pkg}_FIND_METHOD") @@ -27,7 +27,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") set(found FALSE) -if(TARGET "libpvol::libpvol") +if(TARGET "pvol::pvol") set (found TRUE) endif() message(STATUS "Found libpvol: ${found}") diff --git a/src/calculator/CMakeLists.txt b/src/calculator/CMakeLists.txt index 4c38569a..13e1cd2e 100644 --- a/src/calculator/CMakeLists.txt +++ b/src/calculator/CMakeLists.txt @@ -31,7 +31,7 @@ list(APPEND srcs "${dir}/api_helpers.F90" "${dir}/api_engrad.f90" "${dir}/gradreader.f90" - "${dir}/xhcff.F90" + "${dir}/libpvol.F90" "${dir}/subprocess_types.f90" "${dir}/xtb_sc.f90" "${dir}/orca_sc.f90" diff --git a/src/calculator/api_engrad.f90 b/src/calculator/api_engrad.f90 index a9141436..ac85417b 100644 --- a/src/calculator/api_engrad.f90 +++ b/src/calculator/api_engrad.f90 @@ -33,7 +33,7 @@ module api_engrad use tblite_api use gfn0_api use gfnff_api - use xhcff_api + use libpvol_api use lj implicit none !>--- private module variables and parameters @@ -42,7 +42,7 @@ module api_engrad public :: tblite_engrad public :: gfn0_engrad,gfn0occ_engrad public :: gfnff_engrad - public :: xhcff_engrad + public :: libpvol_engrad public :: lj_engrad !> RE-EXPORT !=========================================================================================! @@ -280,7 +280,7 @@ end subroutine gfnff_engrad !========================================================================================! - subroutine xhcff_engrad(mol,calc,energy,grad,iostatus) + subroutine libpvol_engrad(mol,calc,energy,grad,iostatus) !*************************************************************** !* Interface singlepoint call between CREST and XHC force field !*************************************************************** @@ -300,33 +300,33 @@ subroutine xhcff_engrad(mol,calc,energy,grad,iostatus) pr = .false. !>--- setup system call information !$omp critical - call xhcff_initcheck(calc,loadnew) + call libpvol_initcheck(calc,loadnew) !>--- printout handling - call api_handle_output(calc,'xhcff.out',mol,pr) + call api_handle_output(calc,'libpvol.out',mol,pr) !>--- populate parameters if (loadnew) then - !> call xhcff with verbosity turned off - call xhcff_setup(mol,calc%xhcff,calc%extpressure,calc%ngrid,calc%proberad, & - & calc%vdwset,pr,calc%prch,iostatus) + !> call libpvol with verbosity turned off + call libpvol_setup(mol,calc%libpvol,calc%extpressure,calc%pvmodel, & + & calc%ngrid,calc%proberad,calc%vdwset,calc%pvradscal,pr,calc%prch,iostatus) end if !$omp end critical if (iostatus /= 0) return !>--- do the engrad call call initsignal() - call xhcff_sp(mol,calc%xhcff,energy,grad,iostatus) + call libpvol_sp(mol,calc%libpvol,energy,grad,iostatus) if (iostatus /= 0) return !>--- printout if (pr) then - !> the xhcff_sp call includes the printout within xhcff-lib + !> the libpvol_sp call includes the printout within libpvol-lib call api_print_e_grd(pr,calc%prch,mol,energy,grad) end if !>--- postprocessing, getting other data return - end subroutine xhcff_engrad + end subroutine libpvol_engrad !========================================================================================! !========================================================================================! diff --git a/src/calculator/api_helpers.F90 b/src/calculator/api_helpers.F90 index ed524062..731f534c 100644 --- a/src/calculator/api_helpers.F90 +++ b/src/calculator/api_helpers.F90 @@ -372,20 +372,20 @@ end subroutine gfnff_properties !========================================================================================! -!>--- XHCFF setup/helper routines - subroutine xhcff_initcheck(calc,loadnew) +!>--- LIBPVOL setup/helper routines + subroutine libpvol_initcheck(calc,loadnew) implicit none type(calculation_settings),intent(inout) :: calc logical,intent(out) :: loadnew loadnew = .false. -#ifdef WITH_XHCFF - if (.not.allocated(calc%xhcff)) then - allocate (calc%xhcff) +#ifdef WITH_LIBPVOL + if (.not.allocated(calc%libpvol)) then + allocate (calc%libpvol) loadnew = .true. end if if (calc%apiclean) loadnew = .true. #endif - end subroutine xhcff_initcheck + end subroutine libpvol_initcheck !========================================================================================! !========================================================================================! diff --git a/src/calculator/calc_type.f90 b/src/calculator/calc_type.f90 index c58d80e4..c9a75b53 100644 --- a/src/calculator/calc_type.f90 +++ b/src/calculator/calc_type.f90 @@ -25,7 +25,7 @@ module calc_type use tblite_api use gfn0_api use gfnff_api,only:gfnff_data - use xhcff_api,only:xhcff_calculator + use libpvol_api,only:libpvol_calculator !>--- other types use orca_type use lwoniom_module @@ -47,7 +47,7 @@ module calc_type integer :: gfn0 = 7 integer :: gfn0occ = 8 integer :: gfnff = 9 - integer :: xhcff = 10 + integer :: libpvol = 10 integer :: lj = 11 end type enum_jobtype type(enum_jobtype), parameter,public :: jobtype = enum_jobtype() @@ -63,7 +63,7 @@ module calc_type & 'GFN0-xTB calculation via GFN0 lib ', & & 'GFN0*-xTB calculation via GFN0 lib ', & & 'GFN-FF calculation via GFNFF lib ', & - & 'XHCFF calculation via XHCFF-lib ', & + & 'external pressure calculation via libpvol ', & & 'Lennard-Jones potential calculation ' ] !&> @@ -158,12 +158,14 @@ module calc_type !>--- GFN-FF data type(gfnff_data),allocatable :: ff_dat -!>--- XHCFF data - integer :: ngrid = 230 !> lebedev grid points per atom - real(wp) :: extpressure = 0.0_wp !> hydorstatic pressure in Gpa - real(wp) :: proberad = 1.5_wp !> proberadius in Angstroem - integer :: vdwset = 0 !> Set of VDW radii to use in sas calculation -> default D3, 1 -> Bondi - type(xhcff_calculator),allocatable :: xhcff +!>--- libpvol data + integer :: pvmodel = 1 !> libpvol model type (0=XHCFF, 1=PV) + integer :: ngrid = 230 !> lebedev grid points per atom + real(wp) :: extpressure = 0.0_wp !> hydorstatic pressure in Gpa + real(wp) :: proberad = 1.5_wp !> proberadius in Angstroem + integer :: vdwset = 0 !> Type of VDW radii -> 0 (default) D3, 1 -> Bondi + real(wp) :: pvradscal = 1.0_wp !> Scaling factor for SAS radii + type(libpvol_calculator),allocatable :: libpvol !> ONIOM fragment IDs integer :: ONIOM_highlowroot = 0 @@ -352,7 +354,7 @@ subroutine calculation_deallocate_params(self) if(allocated(self%calcs(i)%tblite)) deallocate(self%calcs(i)%tblite) if(allocated(self%calcs(i)%g0calc)) deallocate(self%calcs(i)%g0calc) if(allocated(self%calcs(i)%ff_dat)) deallocate(self%calcs(i)%ff_dat) - if(allocated(self%calcs(i)%xhcff)) deallocate(self%calcs(i)%xhcff) + if(allocated(self%calcs(i)%libpvol)) deallocate(self%calcs(i)%libpvol) end do end if end subroutine calculation_deallocate_params @@ -913,7 +915,7 @@ subroutine calculation_settings_deallocate(self) if (allocated(self%tblite)) deallocate (self%tblite) if (allocated(self%g0calc)) deallocate (self%g0calc) if (allocated(self%ff_dat)) deallocate (self%ff_dat) - if (allocated(self%xhcff)) deallocate (self%xhcff) + if (allocated(self%libpvol)) deallocate (self%libpvol) self%id = 0 self%prch = stdout @@ -1039,8 +1041,8 @@ subroutine calculation_settings_shortflag(self) self%shortflag = 'GFN0-xTB*' case( jobtype%gfnff ) self%shortflag = 'GFN-FF' - case( jobtype%xhcff ) - self%shortflag = 'XHCFF' + case( jobtype%libpvol ) + self%shortflag = 'LIVPVOL' case( jobtype%lj ) self%shortflag = 'LJ' case default diff --git a/src/calculator/calculator.F90 b/src/calculator/calculator.F90 index 66157a14..9cd47931 100644 --- a/src/calculator/calculator.F90 +++ b/src/calculator/calculator.F90 @@ -351,9 +351,9 @@ subroutine potential_core(molptr,calc,id,iostatus) !> GFN-FF api call gfnff_engrad(molptr,calc%calcs(id),calc%etmp(id),calc%grdtmp(:,1:pnat,id),iostatus) - case (jobtype%xhcff) - !> XHCFF-lib - call xhcff_engrad(molptr,calc%calcs(id),calc%etmp(id),calc%grdtmp(:,1:pnat,id),iostatus) + case (jobtype%libpvol) + !> libpvol + call libpvol_engrad(molptr,calc%calcs(id),calc%etmp(id),calc%grdtmp(:,1:pnat,id),iostatus) case (jobtype%turbomole) !> Turbomole-style SPs diff --git a/src/calculator/libpvol.F90 b/src/calculator/libpvol.F90 new file mode 100644 index 00000000..02f72d4f --- /dev/null +++ b/src/calculator/libpvol.F90 @@ -0,0 +1,132 @@ +!================================================================================! +! This file is part of crest. +! +! Copyright (C) 2023 Philipp Pracht +! +! crest is free software: you can redistribute it and/or modify it under +! the terms of the GNU Lesser General Public License as published by +! the Free Software Foundation, either version 3 of the License, or +! (at your option) any later version. +! +! crest is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU Lesser General Public License for more details. +! +! You should have received a copy of the GNU Lesser General Public License +! along with crest. If not, see . +!================================================================================! + +module libpvol_api + use iso_fortran_env,only:wp => real64,stdout => output_unit + use strucrd +#ifdef WITH_LIBPVOL + use libpvol_interface +#endif + implicit none + private + +#ifndef WITH_LIBPVOL + !> this is a placeholder if no libpvol module is used! + type :: libpvol_calculator + integer :: id = 0 + end type libpvol_calculator +#endif + + public :: libpvol_calculator !> if compiled without(!!!) -DWITH_LIBPVOL=true this will export + !> the placeholder from above. Otherwise it will re-export + !> the type from libpvol_interface + + public :: libpvol_setup,libpvol_sp,libpvol_print + +!========================================================================================! +!========================================================================================! +contains !>--- Module routines start here +!========================================================================================! +!========================================================================================! + + subroutine libpvol_setup(mol, libpvol, pressure, model, gridpts, & + & proberad, vdwset, radscal, pr, iunit, iostatus) + implicit none + type(coord),intent(in) :: mol + real(wp), intent(in) :: pressure !> pressure + integer,intent(in) :: model + integer, intent(in) :: gridpts + real(wp), intent(in) :: proberad + integer, intent(in) :: vdwset + real(wp),intent(in) :: radscal + type(libpvol_calculator),intent(inout) :: libpvol + integer, intent(inout) :: iostatus + logical, intent(in) :: pr + integer,intent(in) :: iunit +#ifdef WITH_LIBPVOL + !> initialize LIBPVOL + select case(model) + case (1) !> PV + call libpvol%init(mol%nat,mol%at,mol%xyz,pressure,'PV', & + & gridpts=gridpts, proberad=proberad, verbose=pr,iunit=iunit, & + & printlevel=2,scaling=radscal,vdwset=vdwset,iostat=iostatus) + case (0) !> XHCFF + call libpvol%init(mol%nat,mol%at,mol%xyz,pressure,'XHCFF', & + & gridpts=gridpts, proberad=proberad, verbose=pr,iunit=iunit, & + & printlevel=2,scaling=radscal,vdwset=vdwset,iostat=iostatus) + case default + error stop 'Unkown libpvol model type' + end select + +#else /* WITH_LIBPVOL */ + write (stdout,*) 'Error: Compiled without LIBPVOL-lib support!' + write (stdout,*) 'Use -DWITH_LIBPVOL=true in the setup to enable this function' + error stop +#endif + end subroutine libpvol_setup + +!========================================================================================! + + subroutine libpvol_sp(mol,libpvol,energy,gradient,iostatus) +!******************************************************** +!* The actual energy+gradient call to libpvol-lib. +!* Requires the libpvol_calculator object to be set up already. +!* Note that the original libpvol has no contribution to +!* the energy, only to the gradient +!******************************************************** + implicit none + !> INPUT + type(coord),intent(in) :: mol + type(libpvol_calculator),intent(inout) :: libpvol + !> OUTPUT + real(wp),intent(out) :: energy + real(wp),intent(out) :: gradient(3,mol%nat) + integer,intent(out) :: iostatus + !> LOCAL + logical :: fail + energy = 0.0_wp + gradient = 0.0_wp + iostatus = 0 + fail = .false. +#ifdef WITH_LIBPVOL +!TODO update + call libpvol%singlepoint(mol%nat,mol%at,mol%xyz,energy,gradient,iostat=iostatus) +#else + write (stdout,*) 'Error: Compiled without LIBPVOL-lib support!' + write (stdout,*) 'Use -DWITH_LIBPVOL=true in the setup to enable this function' + error stop +#endif + end subroutine libpvol_sp + +!========================================================================================! + + subroutine libpvol_print(iunit,libpvol) + implicit none + integer,intent(in) :: iunit + type(libpvol_calculator),intent(in) :: libpvol +#ifdef WITH_LIBPVOL + call libpvol%info(iunit) +#endif + return + end subroutine libpvol_print + +!========================================================================================! +!========================================================================================! +end module libpvol_api + diff --git a/src/calculator/meson.build b/src/calculator/meson.build index ad0ebf9c..da3d2598 100644 --- a/src/calculator/meson.build +++ b/src/calculator/meson.build @@ -29,7 +29,7 @@ srcs += files( 'api_helpers.F90', 'api_engrad.f90', 'gradreader.f90', - 'xhcff.F90', + 'libpvol.F90', 'xtb_sc.f90', 'subprocess_types.f90', 'orca_sc.f90', diff --git a/src/calculator/xhcff.F90 b/src/calculator/xhcff.F90 deleted file mode 100644 index ea4ad10c..00000000 --- a/src/calculator/xhcff.F90 +++ /dev/null @@ -1,120 +0,0 @@ -!================================================================================! -! This file is part of crest. -! -! Copyright (C) 2023 Philipp Pracht -! -! crest is free software: you can redistribute it and/or modify it under -! the terms of the GNU Lesser General Public License as published by -! the Free Software Foundation, either version 3 of the License, or -! (at your option) any later version. -! -! crest is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -! GNU Lesser General Public License for more details. -! -! You should have received a copy of the GNU Lesser General Public License -! along with crest. If not, see . -!================================================================================! - -module xhcff_api - use iso_fortran_env,only:wp => real64,stdout => output_unit - use strucrd -#ifdef WITH_XHCFF - use xhcff_interface -#endif - implicit none - private - -#ifndef WITH_XHCFF - !> this is a placeholder if no xhcff module is used! - type :: xhcff_calculator - integer :: id = 0 - end type xhcff_calculator -#endif - - public :: xhcff_calculator !> if compiled without(!!!) -DWITH_XHCFF=true this will export - !> the placeholder from above. Otherwise it will re-export - !> the type from xhcff_interface - - - public :: xhcff_setup,xhcff_sp,xhcff_print - -!========================================================================================! -!========================================================================================! -contains !>--- Module routines start here -!========================================================================================! -!========================================================================================! - - subroutine xhcff_setup(mol, xhcff, pressure, gridpts, proberad, vdwset, pr, iunit, iostatus) - implicit none - type(coord),intent(in) :: mol - real(wp), intent(in) :: pressure !> pressure - integer, intent(in) :: gridpts - real(wp), intent(in) :: proberad - integer, intent(in) :: vdwset - type(xhcff_calculator),intent(inout) :: xhcff - integer, intent(inout) :: iostatus - logical, intent(in) :: pr - integer,intent(in) :: iunit -#ifdef WITH_XHCFF - !> initialize XHCFF - call xhcff%init(mol%nat,mol%at,mol%xyz, & - & pressure, gridpts, proberad, verbose=pr,iunit=iunit,vdwset=vdwset,iostat=iostatus) - -#else /* WITH_XHCFF */ - write (stdout,*) 'Error: Compiled without XHCFF-lib support!' - write (stdout,*) 'Use -DWITH_XHCFF=true in the setup to enable this function' - error stop -#endif - end subroutine xhcff_setup - -!========================================================================================! - - subroutine xhcff_sp(mol,xhcff,energy,gradient,iostatus) -!******************************************************** -!* The actual energy+gradient call to xhcff-lib. -!* Requires the xhcff_calculator object to be set up already. -!* Note that the original xhcff has no contribution to -!* the energy, only to the gradient -!******************************************************** - implicit none - !> INPUT - type(coord),intent(in) :: mol - type(xhcff_calculator),intent(inout) :: xhcff - !> OUTPUT - real(wp),intent(out) :: energy - real(wp),intent(out) :: gradient(3,mol%nat) - integer,intent(out) :: iostatus - !> LOCAL - logical :: fail - energy = 0.0_wp - gradient = 0.0_wp - iostatus = 0 - fail = .false. -#ifdef WITH_XHCFF -!TODO update - call xhcff%singlepoint(mol%nat,mol%at,mol%xyz,energy,gradient,iostatus) -#else - write (stdout,*) 'Error: Compiled without XHCFF-lib support!' - write (stdout,*) 'Use -DWITH_XHCFF=true in the setup to enable this function' - error stop -#endif - end subroutine xhcff_sp - -!========================================================================================! - - subroutine xhcff_print(iunit,xhcff) - implicit none - integer,intent(in) :: iunit - type(xhcff_calculator),intent(in) :: xhcff -#ifdef WITH_XHCFF - call xhcff%info(iunit) -#endif - return - end subroutine xhcff_print - -!========================================================================================! -!========================================================================================! -end module xhcff_api - diff --git a/src/parsing/parse_calcdata.f90 b/src/parsing/parse_calcdata.f90 index 3597568a..61fc65ac 100644 --- a/src/parsing/parse_calcdata.f90 +++ b/src/parsing/parse_calcdata.f90 @@ -237,8 +237,8 @@ subroutine parse_setting_auto(env,job,kv,rd) job%id = jobtype%gfn0occ case ('gfnff','gff','gfn-ff') job%id = jobtype%gfnff - case ('xhcff') - job%id = jobtype%xhcff + case ('pvol','libpvol','xhcff') + job%id = jobtype%libpvol case ('none') job%id = jobtype%unknown case ('lj','lennard-jones') diff --git a/subprojects/libpvol b/subprojects/pvol similarity index 100% rename from subprojects/libpvol rename to subprojects/pvol