From 67d54bf0e15b09f8ef79f8bf41dce5be1545ca4d Mon Sep 17 00:00:00 2001 From: Bowen Zhang Date: Fri, 1 May 2026 16:17:38 +0800 Subject: [PATCH] fix(calculator): adapt to upstream tblite/gfnff API drift `gfnff_initialize` (gfnff main) replaced the legacy `print=logical, iunit=int` pair with `printlevel=int, printunit=int`. Map the existing optional `pr` (logical) and `iunit` (int) arguments of `gfnff_api_setup` to the new signature: pl=2 when pr=.true., 0 otherwise (silent default matches old "pr absent" behavior); pu defaults to stdout. `eeq_guess` (tblite xtb_solvation) gained a trailing `error` argument. Pass through the `error_type` already in scope at the call site. Without these the build now fails on a fresh deps fetch: gfnff_api.F90:75: Keyword argument 'print' is not in the procedure tblite_api.F90:379: There is no specific subroutine for 'eeq_guess' Verified: crest-exe builds cleanly and runs an MCP iMTD-GC end-to-end (see Bowen's MCP CREST benchmark, all 6 cyclic peptides). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/calculator/gfnff_api.F90 | 15 +++++++++++++-- src/calculator/tblite_api.F90 | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/calculator/gfnff_api.F90 b/src/calculator/gfnff_api.F90 index c9ec8ec4..f28d09c9 100644 --- a/src/calculator/gfnff_api.F90 +++ b/src/calculator/gfnff_api.F90 @@ -66,18 +66,29 @@ subroutine gfnff_api_setup(mol,chrg,ff_dat,io,pr,iunit) integer,intent(in),optional :: iunit type(gfnff_data),allocatable,intent(inout) :: ff_dat type(coord) :: refmol + integer :: pl, pu io = 0 #ifdef WITH_GFNFF + !> map the legacy (logical pr, integer iunit) pair to the current + !> upstream gfnff_initialize signature: (printlevel, printunit). + !> 0 = silent, 2 = info-level (matches "pr=.true." behavior). + pl = 0 + if (present(pr)) then + if (pr) pl = 2 + end if + pu = stdout + if (present(iunit)) pu = iunit + if (allocated(ff_dat%refgeo)) then !> initialize GFN-FF from a separate reference structure call refmol%open(ff_dat%refgeo) call gfnff_initialize(refmol%nat,refmol%at,refmol%xyz,ff_dat, & - & ichrg=chrg,print=pr,iostat=io,iunit=iunit) + & ichrg=chrg,iostat=io,printlevel=pl,printunit=pu) call refmol%deallocate() else !> initialize parametrization and topology of GFN-FF call gfnff_initialize(mol%nat,mol%at,mol%xyz,ff_dat, & - & ichrg=chrg,print=pr,iostat=io,iunit=iunit) + & ichrg=chrg,iostat=io,printlevel=pl,printunit=pu) end if #else /* WITH_GFNFF */ diff --git a/src/calculator/tblite_api.F90 b/src/calculator/tblite_api.F90 index 34e72df4..45eaac9b 100644 --- a/src/calculator/tblite_api.F90 +++ b/src/calculator/tblite_api.F90 @@ -376,7 +376,9 @@ subroutine tblite_singlepoint(mol,chrg,uhf,tblite,energy,gradient,iostatus) call ceh_singlepoint(tblite%ctx,tblite%calc,mctcmol,tblite%wfn, & & tblite%accuracy,verbosity) case (xtblvl%eeq) - call eeq_guess(mctcmol,tblite%calc,tblite%wfn) + !> upstream eeq_guess gained an `error` argument; pass through the + !> existing error_type already declared above. + call eeq_guess(mctcmol,tblite%calc,tblite%wfn,error) end select if (tblite%ctx%failed()) then