Implements hierarchical many-body expansion for fragment-based quantum chemistry calculations with MPI parallelization and energy/gradient computation. MBE energy with optional gradient and hessian GMBE energy with optional gradient and hessian
Bottom-up computation of n-body correction (non-recursive, uses pre-computed subset deltas) deltaE(i1,i2,…,in) = E(i1,i2,…,in) - sum of all subset deltaE values All subsets must have been computed already (guaranteed by processing fragments in order)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | fragment_idx |
Index of this fragment (already known) |
||
| integer, | intent(in) | :: | fragment(:) | |||
| type(fragment_lookup_t), | intent(in) | :: | lookup |
Pre-built hash table for lookups |
||
| real(kind=dp), | intent(in) | :: | energies(:) |
Pre-computed delta values |
||
| real(kind=dp), | intent(in) | :: | delta_energies(:) |
Pre-computed delta values |
||
| integer, | intent(in) | :: | n | |||
| type(comm_t), | intent(in), | optional | :: | world_comm |
MPI communicator for abort |
Compute generalized many-body expansion (GMBE) energy with optional gradient and/or hessian
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | monomers(:) | |||
| integer, | intent(in) | :: | n_monomers | |||
| type(calculation_result_t), | intent(in) | :: | monomer_results(:) | |||
| integer, | intent(in) | :: | n_intersections | |||
| type(calculation_result_t), | intent(in), | optional | :: | intersection_results(:) | ||
| integer, | intent(in), | optional | :: | intersection_sets(:,:) | ||
| integer, | intent(in), | optional | :: | intersection_levels(:) | ||
| real(kind=dp), | intent(out) | :: | total_energy | |||
| type(system_geometry_t), | intent(in), | optional | :: | sys_geom | ||
| real(kind=dp), | intent(out), | optional | :: | total_gradient(:,:) | ||
| real(kind=dp), | intent(out), | optional | :: | total_hessian(:,:) | ||
| type(bond_t), | intent(in), | optional | :: | bonds(:) | ||
| type(comm_t), | intent(in), | optional | :: | world_comm |
Compute many-body expansion (MBE) energy with optional gradient, hessian, and dipole
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | polymers(:,:) | |||
| integer(kind=int64), | intent(in) | :: | fragment_count | |||
| integer, | intent(in) | :: | max_level | |||
| type(calculation_result_t), | intent(in) | :: | results(:) | |||
| type(mbe_result_t), | intent(inout) | :: | mbe_result |
Pre-allocated by caller |
||
| type(system_geometry_t), | intent(in), | optional | :: | sys_geom |
Required for gradient/hessian |
|
| type(comm_t), | intent(in), | optional | :: | world_comm |
MPI communicator for abort |
|
| type(json_output_data_t), | intent(out), | optional | :: | json_data |
JSON output data |
Build hash table for fast fragment lookups
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | polymers(:,:) | |||
| integer(kind=int64), | intent(in) | :: | fragment_count | |||
| integer, | intent(in) | :: | max_level | |||
| type(fragment_lookup_t), | intent(inout) | :: | lookup | |||
| type(error_t), | intent(out), | optional | :: | error |
Bottom-up computation of n-body dipole correction Exactly mirrors the energy MBE logic: deltaDipole = Dipole - sum(all subset deltaDipoles) Dipoles are additive vectors in the system frame, no coordinate mapping needed
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | fragment_idx | |||
| integer, | intent(in) | :: | fragment(:) | |||
| type(fragment_lookup_t), | intent(in) | :: | lookup | |||
| type(calculation_result_t), | intent(in) | :: | results(:) | |||
| real(kind=dp), | intent(inout) | :: | delta_dipoles(:,:) |
(3, fragment_count) |
||
| integer, | intent(in) | :: | n | |||
| type(comm_t), | intent(in), | optional | :: | world_comm |
MPI communicator for abort |
Bottom-up computation of n-body dipole derivative correction Mirrors MBE Hessian logic but for dipole derivatives Bond connectivity is accessed via sys_geom%bonds
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | fragment_idx | |||
| integer, | intent(in) | :: | fragment(:) | |||
| type(fragment_lookup_t), | intent(in) | :: | lookup | |||
| type(calculation_result_t), | intent(in) | :: | results(:) | |||
| real(kind=dp), | intent(inout) | :: | delta_dipole_derivs(:,:,:) |
(3, 3*total_atoms, fragment_count) |
||
| integer, | intent(in) | :: | n | |||
| type(system_geometry_t), | intent(in) | :: | sys_geom |
Bottom-up computation of n-body gradient correction Exactly mirrors the energy MBE logic: deltaG = G - sum(all subset deltaGs) All gradients are in system coordinates, so subtraction is simple Bond connectivity is accessed via sys_geom%bonds
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | fragment_idx | |||
| integer, | intent(in) | :: | fragment(:) | |||
| type(fragment_lookup_t), | intent(in) | :: | lookup | |||
| type(calculation_result_t), | intent(in) | :: | results(:) | |||
| real(kind=dp), | intent(inout) | :: | delta_gradients(:,:,:) |
(3, total_atoms, fragment_count) |
||
| integer, | intent(in) | :: | n | |||
| type(system_geometry_t), | intent(in) | :: | sys_geom | |||
| type(comm_t), | intent(in), | optional | :: | world_comm |
MPI communicator for abort |
Bottom-up computation of n-body Hessian correction Mirrors MBE gradient logic but for second derivatives Bond connectivity is accessed via sys_geom%bonds
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | fragment_idx | |||
| integer, | intent(in) | :: | fragment(:) | |||
| type(fragment_lookup_t), | intent(in) | :: | lookup | |||
| type(calculation_result_t), | intent(in) | :: | results(:) | |||
| real(kind=dp), | intent(inout) | :: | delta_hessians(:,:,:) |
(3total_atoms, 3total_atoms, fragment_count) |
||
| integer, | intent(in) | :: | n | |||
| type(system_geometry_t), | intent(in) | :: | sys_geom |
Build 0-indexed atom list for a monomer, handling fixed or variable-sized fragments.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(system_geometry_t), | intent(in) | :: | sys_geom | |||
| integer, | intent(in) | :: | monomer_idx | |||
| integer, | intent(out), | allocatable | :: | atom_list(:) | ||
| integer, | intent(out) | :: | n_atoms |
Map fragment dipole derivatives to system coordinates with hydrogen cap redistribution
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | frag_dipole_derivs(:,:) |
(3, 3*natoms_frag) |
||
| integer, | intent(in) | :: | monomers(:) | |||
| type(system_geometry_t), | intent(in) | :: | sys_geom | |||
| real(kind=dp), | intent(inout) | :: | sys_dipole_derivs(:,:) |
(3, 3*total_atoms) |
Map fragment gradient to system gradient coordinates with hydrogen cap redistribution
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | frag_grad(:,:) |
(3, natoms_frag) |
||
| integer, | intent(in) | :: | monomers(:) |
Monomer indices in fragment |
||
| type(system_geometry_t), | intent(in) | :: | sys_geom | |||
| real(kind=dp), | intent(inout) | :: | sys_grad(:,:) |
(3, total_atoms) |
||
| type(comm_t), | intent(in), | optional | :: | world_comm |
MPI communicator for abort |
Map fragment Hessian to system Hessian coordinates with hydrogen cap redistribution Bond connectivity is accessed via sys_geom%bonds
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | frag_hess(:,:) |
(3natoms_frag, 3natoms_frag) |
||
| integer, | intent(in) | :: | monomers(:) | |||
| type(system_geometry_t), | intent(in) | :: | sys_geom | |||
| real(kind=dp), | intent(inout) | :: | sys_hess(:,:) |
(3total_atoms, 3total_atoms) |
Print MBE energy breakdown to logger
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | sum_by_level(:) | |||
| integer, | intent(in) | :: | max_level | |||
| real(kind=dp), | intent(in) | :: | total_energy |
Print MBE gradient information
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | total_gradient(:,:) | |||
| type(system_geometry_t), | intent(in) | :: | sys_geom | |||
| integer, | intent(in) | :: | current_log_level |
Process derivatives for a single intersection fragment
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | inter_idx | |||
| integer, | intent(in) | :: | k | |||
| real(kind=dp), | intent(in) | :: | sign_factor | |||
| type(calculation_result_t), | intent(in) | :: | intersection_results(:) | |||
| integer, | intent(in) | :: | intersection_sets(:,:) | |||
| type(system_geometry_t), | intent(in) | :: | sys_geom | |||
| real(kind=dp), | intent(inout) | :: | total_gradient(:,:) | |||
| real(kind=dp), | intent(inout), | optional | :: | total_hessian(:,:) | ||
| type(bond_t), | intent(in), | optional | :: | bonds(:) | ||
| logical, | intent(in) | :: | compute_grad | |||
| logical, | intent(in) | :: | compute_hess | |||
| integer, | intent(in) | :: | hess_dim | |||
| type(comm_t), | intent(in), | optional | :: | world_comm |