Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/fortran-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
env:
FC: ${{ matrix.fc }}
CC: ${{ matrix.cc }}
MESON_ARGS: ${{ '-Dlapack=netlib -Dtblite=disabled -Dcpcmx=disabled' }}
MESON_ARGS: ${{ '-Dlapack=netlib -Dtblite=disabled' }}
- name: Build project
run: meson compile -C ${{ env.BUILD_DIR }}
- name: Run unit tests
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
- name: Install CMake
run: pip3 install ninja cmake
- name: Configure build
run: cmake -B ${{ env.BUILD_DIR }} -DWITH_CPCMX=false -DWITH_TBLITE=false -G Ninja
run: cmake -B ${{ env.BUILD_DIR }} -DWITH_TBLITE=false -G Ninja
env:
FC: ${{ matrix.fc }}
CC: ${{ matrix.cc }}
Expand Down
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ if(NOT TARGET "tblite::tblite" AND WITH_TBLITE)
add_compile_definitions(WITH_TBLITE)
endif()

if(NOT TARGET "cpcmx::cpcmx" AND WITH_CPCMX)
find_package("cpcmx" REQUIRED)
add_compile_definitions(WITH_CPCMX)
endif()

if(NOT TARGET "test-drive::test-drive")
find_package("test-drive" REQUIRED)
endif()
Expand Down Expand Up @@ -105,7 +100,6 @@ if(WITH_OBJECT)
"${PROJECT_NAME}-object"
PUBLIC
"mctc-lib::mctc-lib"
"$<$<BOOL:${WITH_CPCMX}>:cpcmx::cpcmx>"
"$<$<BOOL:${WITH_TBLITE}>:tblite::tblite>"
"$<$<BOOL:${WITH_OpenMP}>:OpenMP::OpenMP_Fortran>"
)
Expand Down Expand Up @@ -148,7 +142,6 @@ target_link_libraries(
${LAPACK_LIBRARIES}
"$<$<BOOL:${WITH_OpenMP}>:OpenMP::OpenMP_Fortran>"
"mctc-lib::mctc-lib"
"$<$<BOOL:${WITH_CPCMX}>:cpcmx::cpcmx>"
$<$<BOOL:${WITH_TBLITE}>:tblite::tblite>
)

Expand Down Expand Up @@ -188,7 +181,6 @@ if (WITH_OBJECT)
${LAPACK_LIBRARIES}
"$<$<BOOL:${WITH_OpenMP}>:OpenMP::OpenMP_Fortran>"
"mctc-lib::mctc-lib"
"$<$<BOOL:${WITH_CPCMX}>:cpcmx::cpcmx>"
"$<$<BOOL:${WITH_TBLITE}>:tblite::tblite>"
)

Expand Down
1 change: 0 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# Some user-configurable features
option(WITH_OpenMP "Enable support for shared memory parallelisation with OpenMP" TRUE)
option(WITH_TBLITE "Use tblite library as backend for xTB" TRUE)
option(WITH_CPCMX "Use CPCM-X solvation library for xTB" TRUE)


# Set build type as CMake does not provide defaults
Expand Down
84 changes: 0 additions & 84 deletions cmake/modules/Findcpcmx.cmake

This file was deleted.

7 changes: 0 additions & 7 deletions include/xtb.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,6 @@ xtb_setElectronicTemp(xtb_TEnvironment /* env */,
xtb_TCalculator /* calc */,
double /* temperature */) XTB_API_SUFFIX__VERSION_2_0_0;

//// Calculate CPCM-X solvation energy
extern XTB_API_ENTRY void XTB_API_CALL
xtb_cpcmx_calc(xtb_TEnvironment /* env */,
xtb_TMolecule /* mol */,
xtb_TCalculator /* calc */,
xtb_TResults /* res */) XTB_API_SUFFIX__VERSION_2_0_0;

/// Perform singlepoint calculation
extern XTB_API_ENTRY void XTB_API_CALL
xtb_singlepoint(xtb_TEnvironment /* env */,
Expand Down
2 changes: 0 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ xtb_lib = library(
install: install,
fortran_args: [
'-DWITH_TBLITE=@0@'.format(tblite_dep.found() ? 1 : 0),
'-DWITH_CPCMX=@0@'.format(cpx_dep.found() ? 1 : 0),
],
link_language: 'fortran',
)
Expand Down Expand Up @@ -144,7 +143,6 @@ xtb_exe = executable(
install: install,
fortran_args: [
'-DWITH_TBLITE=@0@'.format(tblite_dep.found() ? 1 : 0),
'-DWITH_CPCMX=@0@'.format(cpx_dep.found() ? 1 : 0),
],
)

Expand Down
9 changes: 0 additions & 9 deletions meson/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,3 @@ dftd4_dep = dependency(
required: get_option('tblite')
)
lib_deps += dftd4_dep

# Get CPCM-X
cpx_dep = dependency(
'cpx',
fallback: ['cpx', 'cpx_dep'],
default_options: ['default_library=static'],
required: get_option('cpcmx')
)
lib_deps += cpx_dep
8 changes: 0 additions & 8 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ option(
description: 'use tblite library as backend for xTB',
)

option(
'cpcmx',
type: 'feature',
value: 'auto',
yield: true,
description: 'include CPCM-X library for solvation evaluation',
)

option(
'dftd4',
type: 'feature',
Expand Down
7 changes: 0 additions & 7 deletions src/api/calculator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,6 @@ subroutine setSolvent_api(venv, vcalc, charptr, state, temperature, grid, charpt
input%cosmo = .true.
elseif (solv_model == 'tmcosmo') then
input%tmcosmo = .true.
elseif (solv_model == 'cpcmx') then
! CPCM-X does an initial SCF with COSMO and a special solvent
! before running a second SCF with the actual solvent.
input%cosmo = .true.
input%solvent = 'infinity'

input%cpxsolvent = solvent
else
call env%ptr%error("Unknown solvation model", source)
return
Expand Down
151 changes: 0 additions & 151 deletions src/api/interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -155,157 +155,6 @@ subroutine singlepoint_api(venv, vmol, vcalc, vres) &

end subroutine singlepoint_api

subroutine cpcmx_calc_api(venv, vmol, vcalc, vres) &
& bind(C, name="xtb_cpcmx_calc")
!DEC$ ATTRIBUTES DLLEXPORT :: cpcmx_calc_api
use xtb_solv_cpx, only: TCpcmx
use xtb_type_calculator, only: TCalculator

character(len=*), parameter :: source = 'xtb_api_cpcmx_calc'
type(c_ptr), value :: venv
type(VEnvironment), pointer :: env
type(c_ptr), value :: vmol
type(VMolecule), pointer :: mol
type(c_ptr), value :: vcalc
type(VCalculator), pointer :: calc
type(c_ptr), value :: vres
type(VResults), pointer :: res
type(scc_results) :: spRes

type(TCpcmx) :: cpx
type(VCalculator) :: cpx_calc
real(c_double) :: energy_gas

if (c_associated(venv)) then
call c_f_pointer(venv, env)
call checkGlobalEnv

if (.not.c_associated(vmol)) then
call env%ptr%error("Molecular structure data is not allocated", source)
return
end if
call c_f_pointer(vmol, mol)

if (.not.c_associated(vcalc)) then
call env%ptr%error("Singlepoint calculator is not allocated", source)
return
end if
call c_f_pointer(vcalc, calc)

! Fail early if CPCM-X solvation model is not set
if (allocated(calc%ptr%solvation)) then
if (.not. allocated(calc%ptr%solvation%cpxsolvent)) then
call env%ptr%error("CPCM-X solvent not set", source)
return
end if
else
call env%ptr%error("No solvation input given", source)
return
end if

! Fail early if not using xTB
select type(xtb => calc%ptr)
type is (TGFFCalculator)
call env%ptr%error("CPCM-X is not possible with a force field.", source)
return
end select

if (.not.allocated(calc%ptr)) then
call env%ptr%error("No calculator loaded for single point", &
& source)
return
end if

if (.not.c_associated(vres)) then
call env%ptr%error("Calculation results are not allocated", source)
return
end if
call c_f_pointer(vres, res)

! check cache, automatically invalidate missmatched data
if (allocated(res%chk)) then
select type(xtb => calc%ptr)
type is(TxTBCalculator)
if (res%chk%wfn%n /= mol%ptr%n .or. res%chk%wfn%n /= xtb%basis%n .or. &
& res%chk%wfn%nao /= xtb%basis%nao .or. &
& res%chk%wfn%nshell /= xtb%basis%nshell) then
deallocate(res%chk)
end if
end select
end if

if (.not.allocated(res%chk)) then
allocate(res%chk)
! in case of a new wavefunction cache we have to perform an initial guess
select type(xtb => calc%ptr)
type is(TxTBCalculator)
call newWavefunction(env%ptr, mol%ptr, xtb, res%chk)
end select
end if

if (.not.allocated(res%energy)) then
allocate(res%energy)
end if

if (.not.allocated(res%egap)) then
allocate(res%egap)
end if

if (allocated(res%pcgradient)) then
deallocate(res%pcgradient)
end if

if (allocated(res%gradient)) then
if (any(shape(res%gradient) /= [3, mol%ptr%n])) then
call env%ptr%warning("Shape missmatch in gradient, reallocating", source)
deallocate(res%gradient)
end if
end if
if (.not.allocated(res%gradient)) then
allocate(res%gradient(3, mol%ptr%n))
end if

if (allocated(res%sigma)) then
if (any(shape(res%sigma) /= [3, 3])) then
call env%ptr%warning("Shape missmatch in virial, reallocating", source)
deallocate(res%sigma)
end if
end if
if (.not.allocated(res%sigma)) then
allocate(res%sigma(3, 3))
end if

! Initial COSMO singlepoint calculation
call calc%ptr%singlepoint(env%ptr, mol%ptr, res%chk, env%verbosity, .true., &
& res%energy, res%gradient, res%sigma, res%egap, spRes)

! CPCM-X calculation
call cpx%setup(env%ptr, calc%ptr%solvation%cpxsolvent)
cpx_calc = calc
deallocate(cpx_calc%ptr%solvation)

energy_gas = res%energy
call generic_header(env%ptr%unit, "CPCM-X post-SCF solvation evaluation", 49, 10)
call cpx_calc%ptr%singlepoint(env%ptr, mol%ptr, res%chk, env%verbosity, .false., &
& energy_gas, res%gradient, res%sigma, res%egap, spRes)


call cpx%calc_solv(env%ptr, calc%ptr%solvation%cpxsolvent, energy_gas, &
& 0.4_wp, 298.15_wp, 500, 0.0001_wp, spRes%e_total)
call cpx%print(.true.)

res%energy = spRes%e_total
res%solvation_energy = res%energy - energy_gas
res%dipole = spRes%dipole

! Zero out the gradient and sigma (not yet implemented for CPCM-X)
res%gradient = 0.0_wp
res%sigma = 0.0_wp

endif

end subroutine cpcmx_calc_api


subroutine hessian_api(venv, vmol, vcalc, vres, c_hess, &
& c_step, c_list, c_dipgrad, c_polgrad) &
Expand Down
Loading