Skip to content

Implementation of compliance elements and reusable internal coordinate infrastructure - #1446

Merged
lmseidler merged 24 commits into
grimme-lab:mainfrom
lmseidler:compliance
Sep 25, 2026
Merged

lmseidler merged 24 commits into
grimme-lab:mainfrom
lmseidler:compliance

Conversation

@lmseidler

@lmseidler lmseidler commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

The goal of this PR is to introduce the calculation of compliance elements from the Cartesian Hessian. In the process I'll also implement a robust internal coordinate implementation, which can later be used to replace redundant code in different modules (intmodes, geosum) in a separate PR.

Edit: there is also potential to further reduce redundant code in model Hessian infrastructure but this needs some special internal coordinate generation rules and is beyond the scope of this PR. Added a TODO though.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Pure-procedure compilation blockers and correctness/coverage gaps remain in the new internal-coordinate and compliance paths.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 High severity · 3 Medium severity

Open (6)
What changed in this PR

This PR adds compliance-matrix calculation from Cartesian Hessians, reusable redundant internal-coordinate infrastructure, and refactors model-Hessian configuration.

Changes:

  • Adds covalent neighbour graphs, redundant coordinates, and Wilson B-matrix assembly.
  • Integrates compliance reporting into numerical Hessian workflows.
  • Updates model-Hessian constructors and expands regression tests.
File Description
test/​unit/​test_model_hessian.f90 Updates model-Hessian constructor tests.
test/​unit/​test_hessian.f90 Adds compliance and internal-coordinate tests.
test/​unit/​test_bmatrix.f90 Expands linear-bend finite-difference tests.
src/​type/​neighbourlist.f90 Adds covalent neighbour generation.
src/​type/​calculator.f90 Uses configured Swart Hessian construction.
src/​optimizer.f90 Updates model-Hessian allocation and calls.
src/​model_hessian/​type.f90 Simplifies the model-Hessian interface.
src/​model_hessian/​{swart,lindh,internal,gff}.f90 Adds constructors and configuration-backed computation.
src/​meson.build Registers internals and compliance sources.
src/​internals/​* Adds graph and redundant-coordinate infrastructure.
src/​hessian.F90 Invokes compliance reporting after numerical Hessians.
src/​compliance.f90 Implements compliance calculation and output.
src/​CMakeLists.txt Registers new sources.
src/​bmatrix.f90 Adds generic B-matrix assembly and linear-bend helpers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/bmatrix.f90
Comment thread src/bmatrix.f90
Comment thread src/internals/redundant.f90
Comment thread src/compliance.f90 Outdated
Comment thread src/type/neighbourlist.f90
Comment thread test/unit/test_hessian.f90
Comment thread src/internals/graph.f90
Comment thread src/internals/redundant.f90
Comment thread src/internals/redundant.f90 Outdated
type(graph_type), intent(in) :: graph
!> Cartesian reference coordinates, dimension (3, graph%n), in the length
!> unit the coordinate values are reported in
real(wp), intent(in) :: xyz(:, :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to take a structure object in here instead of moving around its components?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to keep the signature as simple as possible and to minimize dependencies (this method only needs the cartesian coords, no need to import also the molecule type) i think it's preferable to pass only the single attribute.

Comment thread src/internals/redundant.f90 Outdated
Comment thread src/compliance.f90 Outdated
Comment thread src/compliance.f90 Outdated
Comment thread src/compliance.f90 Outdated
Comment thread src/compliance.f90 Outdated
Comment thread src/compliance.f90 Outdated
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: Leopold Seidler <seidler118@gmail.com>
Signed-off-by: Leopold Seidler <seidler118@gmail.com>
Signed-off-by: Leopold Seidler <seidler118@gmail.com>
Signed-off-by: Leopold Seidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
…lculation

Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: Leopold Seidler <seidler118@gmail.com>
Comment thread src/compliance.f90
! noise
Hp = 0.5_wp * (H + transpose(H))

! Hp = (1 - Q Q^T) Hp (1 - Q Q^T)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually our mctc_gemm interface? Don't we have anything shorter (also for Lapack?)

Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
thfroitzheim
thfroitzheim previously approved these changes Sep 24, 2026
Comment thread man/xtb.1.adoc Outdated
*--o1nh*::
perform the numerical hessian calculation using the ODLR approximation (O1NumHess)

Hessian runs automatically perform a compliance analysis for nonperiodic

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry just saw it now. Please indent this part (and maybe reduce a bit this is quite long)

Signed-off-by: lmseidler <seidler118@gmail.com>
Signed-off-by: lmseidler <seidler118@gmail.com>
@lmseidler
lmseidler merged commit 1779020 into grimme-lab:main Sep 25, 2026
25 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.

3 participants