Skip to content

Commit 8ea513f

Browse files
committed
Remove CPCM-X library
Signed-off-by: Igor S. Gerasimov <foxtranigor@gmail.com>
1 parent d3f212b commit 8ea513f

26 files changed

+3
-670
lines changed

CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ if(NOT TARGET "tblite::tblite" AND WITH_TBLITE)
4949
add_compile_definitions(WITH_TBLITE)
5050
endif()
5151

52-
if(NOT TARGET "cpcmx::cpcmx" AND WITH_CPCMX)
53-
find_package("cpcmx" REQUIRED)
54-
add_compile_definitions(WITH_CPCMX)
55-
endif()
56-
5752
if(NOT TARGET "test-drive::test-drive")
5853
find_package("test-drive" REQUIRED)
5954
endif()
@@ -105,7 +100,6 @@ if(WITH_OBJECT)
105100
"${PROJECT_NAME}-object"
106101
PUBLIC
107102
"mctc-lib::mctc-lib"
108-
"$<$<BOOL:${WITH_CPCMX}>:cpcmx::cpcmx>"
109103
"$<$<BOOL:${WITH_TBLITE}>:tblite::tblite>"
110104
"$<$<BOOL:${WITH_OpenMP}>:OpenMP::OpenMP_Fortran>"
111105
)
@@ -148,7 +142,6 @@ target_link_libraries(
148142
${LAPACK_LIBRARIES}
149143
"$<$<BOOL:${WITH_OpenMP}>:OpenMP::OpenMP_Fortran>"
150144
"mctc-lib::mctc-lib"
151-
"$<$<BOOL:${WITH_CPCMX}>:cpcmx::cpcmx>"
152145
$<$<BOOL:${WITH_TBLITE}>:tblite::tblite>
153146
)
154147

@@ -188,7 +181,6 @@ if (WITH_OBJECT)
188181
${LAPACK_LIBRARIES}
189182
"$<$<BOOL:${WITH_OpenMP}>:OpenMP::OpenMP_Fortran>"
190183
"mctc-lib::mctc-lib"
191-
"$<$<BOOL:${WITH_CPCMX}>:cpcmx::cpcmx>"
192184
"$<$<BOOL:${WITH_TBLITE}>:tblite::tblite>"
193185
)
194186

cmake/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# Some user-configurable features
1818
option(WITH_OpenMP "Enable support for shared memory parallelisation with OpenMP" TRUE)
1919
option(WITH_TBLITE "Use tblite library as backend for xTB" TRUE)
20-
option(WITH_CPCMX "Use CPCM-X solvation library for xTB" TRUE)
2120

2221

2322
# Set build type as CMake does not provide defaults

cmake/modules/Findcpcmx.cmake

Lines changed: 0 additions & 84 deletions
This file was deleted.

include/xtb.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,6 @@ xtb_setElectronicTemp(xtb_TEnvironment /* env */,
225225
xtb_TCalculator /* calc */,
226226
double /* temperature */) XTB_API_SUFFIX__VERSION_2_0_0;
227227

228-
//// Calculate CPCM-X solvation energy
229-
extern XTB_API_ENTRY void XTB_API_CALL
230-
xtb_cpcmx_calc(xtb_TEnvironment /* env */,
231-
xtb_TMolecule /* mol */,
232-
xtb_TCalculator /* calc */,
233-
xtb_TResults /* res */) XTB_API_SUFFIX__VERSION_2_0_0;
234-
235228
/// Perform singlepoint calculation
236229
extern XTB_API_ENTRY void XTB_API_CALL
237230
xtb_singlepoint(xtb_TEnvironment /* env */,

meson.build

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ xtb_lib = library(
115115
install: install,
116116
fortran_args: [
117117
'-DWITH_TBLITE=@0@'.format(tblite_dep.found() ? 1 : 0),
118-
'-DWITH_CPCMX=@0@'.format(cpx_dep.found() ? 1 : 0),
119118
],
120119
link_language: 'fortran',
121120
)
@@ -144,7 +143,6 @@ xtb_exe = executable(
144143
install: install,
145144
fortran_args: [
146145
'-DWITH_TBLITE=@0@'.format(tblite_dep.found() ? 1 : 0),
147-
'-DWITH_CPCMX=@0@'.format(cpx_dep.found() ? 1 : 0),
148146
],
149147
)
150148

meson/meson.build

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,3 @@ dftd4_dep = dependency(
245245
required: get_option('tblite')
246246
)
247247
lib_deps += dftd4_dep
248-
249-
# Get CPCM-X
250-
cpx_dep = dependency(
251-
'cpx',
252-
fallback: ['cpx', 'cpx_dep'],
253-
default_options: ['default_library=static'],
254-
required: get_option('cpcmx')
255-
)
256-
lib_deps += cpx_dep

meson_options.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ option(
4040
description: 'use tblite library as backend for xTB',
4141
)
4242

43-
option(
44-
'cpcmx',
45-
type: 'feature',
46-
value: 'auto',
47-
yield: true,
48-
description: 'include CPCM-X library for solvation evaluation',
49-
)
50-
5143
option(
5244
'dftd4',
5345
type: 'feature',

src/api/calculator.f90

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,6 @@ subroutine setSolvent_api(venv, vcalc, charptr, state, temperature, grid, charpt
420420
input%cosmo = .true.
421421
elseif (solv_model == 'tmcosmo') then
422422
input%tmcosmo = .true.
423-
elseif (solv_model == 'cpcmx') then
424-
! CPCM-X does an initial SCF with COSMO and a special solvent
425-
! before running a second SCF with the actual solvent.
426-
input%cosmo = .true.
427-
input%solvent = 'infinity'
428-
429-
input%cpxsolvent = solvent
430423
else
431424
call env%ptr%error("Unknown solvation model", source)
432425
return

src/api/interface.f90

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -155,157 +155,6 @@ subroutine singlepoint_api(venv, vmol, vcalc, vres) &
155155

156156
end subroutine singlepoint_api
157157

158-
subroutine cpcmx_calc_api(venv, vmol, vcalc, vres) &
159-
& bind(C, name="xtb_cpcmx_calc")
160-
!DEC$ ATTRIBUTES DLLEXPORT :: cpcmx_calc_api
161-
use xtb_solv_cpx, only: TCpcmx
162-
use xtb_type_calculator, only: TCalculator
163-
164-
character(len=*), parameter :: source = 'xtb_api_cpcmx_calc'
165-
type(c_ptr), value :: venv
166-
type(VEnvironment), pointer :: env
167-
type(c_ptr), value :: vmol
168-
type(VMolecule), pointer :: mol
169-
type(c_ptr), value :: vcalc
170-
type(VCalculator), pointer :: calc
171-
type(c_ptr), value :: vres
172-
type(VResults), pointer :: res
173-
type(scc_results) :: spRes
174-
175-
type(TCpcmx) :: cpx
176-
type(VCalculator) :: cpx_calc
177-
real(c_double) :: energy_gas
178-
179-
if (c_associated(venv)) then
180-
call c_f_pointer(venv, env)
181-
call checkGlobalEnv
182-
183-
if (.not.c_associated(vmol)) then
184-
call env%ptr%error("Molecular structure data is not allocated", source)
185-
return
186-
end if
187-
call c_f_pointer(vmol, mol)
188-
189-
if (.not.c_associated(vcalc)) then
190-
call env%ptr%error("Singlepoint calculator is not allocated", source)
191-
return
192-
end if
193-
call c_f_pointer(vcalc, calc)
194-
195-
! Fail early if CPCM-X solvation model is not set
196-
if (allocated(calc%ptr%solvation)) then
197-
if (.not. allocated(calc%ptr%solvation%cpxsolvent)) then
198-
call env%ptr%error("CPCM-X solvent not set", source)
199-
return
200-
end if
201-
else
202-
call env%ptr%error("No solvation input given", source)
203-
return
204-
end if
205-
206-
! Fail early if not using xTB
207-
select type(xtb => calc%ptr)
208-
type is (TGFFCalculator)
209-
call env%ptr%error("CPCM-X is not possible with a force field.", source)
210-
return
211-
end select
212-
213-
if (.not.allocated(calc%ptr)) then
214-
call env%ptr%error("No calculator loaded for single point", &
215-
& source)
216-
return
217-
end if
218-
219-
if (.not.c_associated(vres)) then
220-
call env%ptr%error("Calculation results are not allocated", source)
221-
return
222-
end if
223-
call c_f_pointer(vres, res)
224-
225-
! check cache, automatically invalidate missmatched data
226-
if (allocated(res%chk)) then
227-
select type(xtb => calc%ptr)
228-
type is(TxTBCalculator)
229-
if (res%chk%wfn%n /= mol%ptr%n .or. res%chk%wfn%n /= xtb%basis%n .or. &
230-
& res%chk%wfn%nao /= xtb%basis%nao .or. &
231-
& res%chk%wfn%nshell /= xtb%basis%nshell) then
232-
deallocate(res%chk)
233-
end if
234-
end select
235-
end if
236-
237-
if (.not.allocated(res%chk)) then
238-
allocate(res%chk)
239-
! in case of a new wavefunction cache we have to perform an initial guess
240-
select type(xtb => calc%ptr)
241-
type is(TxTBCalculator)
242-
call newWavefunction(env%ptr, mol%ptr, xtb, res%chk)
243-
end select
244-
end if
245-
246-
if (.not.allocated(res%energy)) then
247-
allocate(res%energy)
248-
end if
249-
250-
if (.not.allocated(res%egap)) then
251-
allocate(res%egap)
252-
end if
253-
254-
if (allocated(res%pcgradient)) then
255-
deallocate(res%pcgradient)
256-
end if
257-
258-
if (allocated(res%gradient)) then
259-
if (any(shape(res%gradient) /= [3, mol%ptr%n])) then
260-
call env%ptr%warning("Shape missmatch in gradient, reallocating", source)
261-
deallocate(res%gradient)
262-
end if
263-
end if
264-
if (.not.allocated(res%gradient)) then
265-
allocate(res%gradient(3, mol%ptr%n))
266-
end if
267-
268-
if (allocated(res%sigma)) then
269-
if (any(shape(res%sigma) /= [3, 3])) then
270-
call env%ptr%warning("Shape missmatch in virial, reallocating", source)
271-
deallocate(res%sigma)
272-
end if
273-
end if
274-
if (.not.allocated(res%sigma)) then
275-
allocate(res%sigma(3, 3))
276-
end if
277-
278-
! Initial COSMO singlepoint calculation
279-
call calc%ptr%singlepoint(env%ptr, mol%ptr, res%chk, env%verbosity, .true., &
280-
& res%energy, res%gradient, res%sigma, res%egap, spRes)
281-
282-
! CPCM-X calculation
283-
call cpx%setup(env%ptr, calc%ptr%solvation%cpxsolvent)
284-
cpx_calc = calc
285-
deallocate(cpx_calc%ptr%solvation)
286-
287-
energy_gas = res%energy
288-
call generic_header(env%ptr%unit, "CPCM-X post-SCF solvation evaluation", 49, 10)
289-
call cpx_calc%ptr%singlepoint(env%ptr, mol%ptr, res%chk, env%verbosity, .false., &
290-
& energy_gas, res%gradient, res%sigma, res%egap, spRes)
291-
292-
293-
call cpx%calc_solv(env%ptr, calc%ptr%solvation%cpxsolvent, energy_gas, &
294-
& 0.4_wp, 298.15_wp, 500, 0.0001_wp, spRes%e_total)
295-
call cpx%print(.true.)
296-
297-
res%energy = spRes%e_total
298-
res%solvation_energy = res%energy - energy_gas
299-
res%dipole = spRes%dipole
300-
301-
! Zero out the gradient and sigma (not yet implemented for CPCM-X)
302-
res%gradient = 0.0_wp
303-
res%sigma = 0.0_wp
304-
305-
endif
306-
307-
end subroutine cpcmx_calc_api
308-
309158

310159
subroutine hessian_api(venv, vmol, vcalc, vres, c_hess, &
311160
& c_step, c_list, c_dipgrad, c_polgrad) &

src/features.F90

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,13 @@
1717
#define WITH_TBLITE 0
1818
#endif
1919

20-
#ifndef WITH_CPCMX
21-
#define WITH_CPCMX 0
22-
#endif
23-
2420
module xtb_features
2521
implicit none
2622
private
2723

2824
public :: get_xtb_feature
2925

3026
logical, parameter :: tblite_support = WITH_TBLITE /= 0
31-
logical, parameter :: cpcmx_support = WITH_CPCMX /= 0
3227

3328

3429
contains
@@ -42,8 +37,6 @@ function get_xtb_feature(feature) result(has_feature)
4237
select case(feature)
4338
case("tblite")
4439
has_feature = tblite_support
45-
case("cpcmx")
46-
has_feature = cpcmx_support
4740
case("color")
4841
has_feature = color_support()
4942
case default

0 commit comments

Comments
 (0)