Enable NLCC for native SKALA grid

This commit is contained in:
Thomas D. Kuehne 2026-06-06 10:07:46 +02:00
parent bad8391e77
commit 98ab6fd1ef
6 changed files with 84 additions and 16 deletions

View file

@ -1426,10 +1426,11 @@ CONTAINS
"should not preload CPU-only Torch libraries such as libtorch_cpu.so. "// &
"MPI runs collect a global atom-partitioned feature block by default; "// &
"NATIVE_GRID_ATOM_CHUNKS can split the Torch evaluation by atom block. "// &
"Analytical stress is supported for the regular-grid path. "// &
"Analytical stress is supported for the regular-grid path. NLCC "// &
"pseudopotentials use CP2K's standard frozen-core density contribution "// &
"on the XC grid. "// &
"METHOD GAPW_XC, PAW/one-center GAPW+GTH/ECP, ROKS, ADMM, "// &
"NLCC pseudopotentials, and non-k-point multiple-image "// &
"calculations are not implemented.", &
"and non-k-point multiple-image calculations are not implemented.", &
usage="NATIVE_GRID T", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)

View file

@ -650,14 +650,10 @@ CONTAINS
IF (gapw_xc) THEN
CPABORT(native_skala_gapw_xc_msg)
END IF
IF (ASSOCIATED(rho_nlcc)) THEN
CALL cp_abort(__LOCATION__, &
"Native SKALA grid evaluation with NLCC pseudopotentials is not implemented. "// &
"The frozen core density would need a SKALA-consistent feature definition.")
END IF
IF (gapw) THEN
DO ikind = 1, SIZE(qs_kind_set)
IF (qs_kind_set(ikind)%paw_atom .AND. &
IF (qs_kind_set(ikind)%paw_atom .AND. .NOT. &
qs_kind_set(ikind)%gpw_type_forced .AND. &
(ASSOCIATED(qs_kind_set(ikind)%gth_potential) .OR. &
ASSOCIATED(qs_kind_set(ikind)%sgp_potential))) THEN
CALL cp_abort(__LOCATION__, &

View file

@ -201,11 +201,6 @@ CONTAINS
END IF
IF (PRESENT(edisp)) edisp = 0.0_dp
native_skala_grid = xc_section_uses_native_skala_grid(xc_section)
IF (native_skala_grid .AND. ASSOCIATED(rho_nlcc_use)) THEN
CALL cp_abort(__LOCATION__, &
"Native SKALA grid evaluation with NLCC pseudopotentials is not implemented. "// &
"The frozen core density would need a SKALA-consistent feature definition.")
END IF
IF (myfun /= xc_none .OR. vdW_nl) THEN

View file

@ -386,7 +386,7 @@ CONTAINS
LOGICAL :: has_paw_pseudopotentials
INTEGER :: ikind
LOGICAL :: paw_atom
LOGICAL :: gpw_type_forced, paw_atom
TYPE(gth_potential_type), POINTER :: gth_potential
TYPE(sgp_potential_type), POINTER :: sgp_potential
@ -397,9 +397,11 @@ CONTAINS
NULLIFY (gth_potential, sgp_potential)
CALL get_qs_kind(qs_kind_set(ikind), &
gth_potential=gth_potential, &
gpw_type_forced=gpw_type_forced, &
paw_atom=paw_atom, &
sgp_potential=sgp_potential)
IF ((ASSOCIATED(gth_potential) .OR. ASSOCIATED(sgp_potential)) .AND. paw_atom) THEN
IF ((ASSOCIATED(gth_potential) .OR. ASSOCIATED(sgp_potential)) .AND. &
paw_atom .AND. .NOT. gpw_type_forced) THEN
has_paw_pseudopotentials = .TRUE.
EXIT
END IF

View file

@ -0,0 +1,71 @@
&GLOBAL
PRINT_LEVEL LOW
PROJECT_NAME H2O_NATIVE_SKALA_GPW_NLCC_STRESS
RUN_TYPE ENERGY_FORCE
&END GLOBAL
&FORCE_EVAL
METHOD Quickstep
STRESS_TENSOR ANALYTICAL
&DFT
BASIS_SET_FILE_NAME GTH_BASIS_SETS
MULTIPLICITY 1
POTENTIAL_FILE_NAME POTENTIAL
UKS FALSE
&MGRID
CUTOFF 150
REL_CUTOFF 30
&END MGRID
&POISSON
PERIODIC XYZ
&END POISSON
&QS
EPS_DEFAULT 1.0E-8
EXTRAPOLATION USE_PREV_WF
METHOD GPW
&END QS
&SCF
EPS_SCF 1.0E-5
IGNORE_CONVERGENCE_FAILURE T
MAX_SCF 1
SCF_GUESS ATOMIC
&DIAGONALIZATION
&END DIAGONALIZATION
&END SCF
&XC
&XC_FUNCTIONAL
&GAUXC
MODEL SKALA
NATIVE_GRID T
NATIVE_GRID_DIAGNOSTICS T
&END GAUXC
&END XC_FUNCTIONAL
&END XC
&END DFT
&PRINT
&FORCES ON
&END FORCES
&STRESS_TENSOR
COMPONENTS
&END STRESS_TENSOR
&END PRINT
&SUBSYS
&CELL
ABC 6.0 6.0 6.0
PERIODIC XYZ
&END CELL
&COORD
O 3.000000 3.000000 3.000000
H 3.000000 3.758602 3.504284
H 3.000000 2.241398 3.504284
&END COORD
&KIND O
BASIS_SET DZVP-GTH
POTENTIAL GTH-NLCC-PBE-q6
&END KIND
&KIND H
BASIS_SET DZVP-GTH
POTENTIAL GTH-NLCC-PBE-q1
&END KIND
&END SUBSYS
&END FORCE_EVAL

View file

@ -8,6 +8,9 @@
"H2_NATIVE_SKALA_GPW_STRESS.inp" = [{matcher="E_total", tol=1e-8, ref=-0.963819771363320},
{matcher="M072", tol=1e-5, ref=3.03110658E-04},
{matcher="M031", tol=1e-5, ref=-1.67988358588E+05}]
"H2O_NATIVE_SKALA_GPW_NLCC_STRESS.inp" = [{matcher="E_total", tol=1e-8, ref=-18.116097365992886},
{matcher="M072", tol=1e-5, ref=1.70927481E-02},
{matcher="M031", tol=1e-5, ref=-6.29395423311E+04}]
"H2_NATIVE_SKALA_GAPW_AE_STRESS.inp" = [{matcher="E_total", tol=1e-8, ref=-0.967785239290550},
{matcher="M072", tol=1e-5, ref=9.50003206E-04},
{matcher="M031", tol=1e-5, ref=-9.13910039743E+04}]