Skip to content

Fix multipole order forwarding and ddCOSMO radius derivatives - #185

Merged
mnottoli merged 3 commits into
ddsolvation:mainfrom
robin-dahl:fix-version-for-mpddX
Sep 2, 2026
Merged

Fix multipole order forwarding and ddCOSMO radius derivatives#185
mnottoli merged 3 commits into
ddsolvation:mainfrom
robin-dahl:fix-version-for-mpddX

Conversation

@robin-dahl

Copy link
Copy Markdown
Contributor

Summary

This PR fixes two independent problems affecting multipolar electrostatics and combined Cartesian/radius derivatives.

Multipolar electrostatics

multipole_electrostatics previously passed a hard-coded mmax = 0 to the underlying _0, _1, and _2 routines. Consequently, only monopoles were evaluated even when the caller supplied higher-order multipoles.

The wrapper now forwards the requested mmax in all three paths.

COSMO radius derivatives

contract_grad_U previously updated either the Cartesian force or the radius derivative, depending on whether dr was present. Therefore, requesting radius derivatives caused the Cartesian force to omit the entire U contribution. The routine now always accumulates the Cartesian contribution and additionally accumulates dr when requested.

The combined COSMO derivative now also:

  • applies the required -1/2 scaling to the radius derivatives.
  • includes the missing radial zeta contribution through zeta_grad_dr.

Finally, the gradient tests now use a separate scratch-force array when evaluating radius derivatives. This prevents the corrected combined-output behavior from modifying Cartesian-gradient results that are checked later.

The existing tests did not expose this discrepancy because they validated the Cartesian and radius contributions separately through helper routines that already applied the correct -1/2 scaling and radial zeta term, rather than testing the affected combined cosmo_solvation_force_dr_terms routine.

@mnottoli
mnottoli force-pushed the fix-version-for-mpddX branch from e303b7d to 098d27d Compare September 1, 2026 14:27
@mnottoli
mnottoli force-pushed the fix-version-for-mpddX branch from c6ca29c to c869193 Compare September 2, 2026 08:43
@mnottoli
mnottoli enabled auto-merge (squash) September 2, 2026 08:45
@mnottoli
mnottoli merged commit c2adde3 into ddsolvation:main Sep 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants