Provides utilities for generating perturbed geometries and computing numerical derivatives via finite differences (gradients, Hessians, etc.) Generate forward/backward displacements Container for displaced geometry Compute Hessian from gradient differences Compute dipole derivatives from dipole differences Copy and displace geometry Re-export for backward compatibility
Container for a single displaced geometry
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | atom_index |
Which atom was displaced (1-based) |
|||
| integer, | public | :: | coordinate |
Which coordinate was displaced (1=x, 2=y, 3=z) |
|||
| integer, | public | :: | direction |
+1 for forward, -1 for backward |
|||
| real(kind=dp), | public | :: | displacement |
Displacement magnitude in Bohr |
|||
| type(physical_fragment_t), | public | :: | geometry |
The displaced geometry |
| procedure, public :: destroy => displaced_geometry_destroy |
Create a copy of reference geometry with one coordinate displaced
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(physical_fragment_t), | intent(in) | :: | reference_geom | |||
| integer, | intent(in) | :: | atom_idx | |||
| integer, | intent(in) | :: | coord_idx | |||
| real(kind=dp), | intent(in) | :: | displacement | |||
| type(physical_fragment_t), | intent(out) | :: | displaced_geom |
Compute dipole moment derivatives via central finite differences
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n_atoms | |||
| real(kind=dp), | intent(in) | :: | forward_dipoles(:,:) |
(3*n_atoms, 3) |
||
| real(kind=dp), | intent(in) | :: | backward_dipoles(:,:) |
(3*n_atoms, 3) |
||
| real(kind=dp), | intent(in) | :: | displacement | |||
| real(kind=dp), | intent(out), | allocatable | :: | dipole_derivatives(:,:) |
(3, 3*n_atoms) |
Compute Hessian matrix from finite differences of gradients
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(physical_fragment_t), | intent(in) | :: | reference_geom | |||
| real(kind=dp), | intent(in) | :: | forward_gradients(:,:,:) |
(n_displacements, 3, n_atoms) |
||
| real(kind=dp), | intent(in) | :: | backward_gradients(:,:,:) |
(n_displacements, 3, n_atoms) |
||
| real(kind=dp), | intent(in) | :: | displacement | |||
| real(kind=dp), | intent(out), | allocatable | :: | hessian(:,:) |
(3n_atoms, 3n_atoms) |
Generate all forward and backward displaced geometries for finite difference calculations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(physical_fragment_t), | intent(in) | :: | reference_geom | |||
| real(kind=dp), | intent(in) | :: | displacement | |||
| type(displaced_geometry_t), | intent(out), | allocatable | :: | forward_geoms(:) | ||
| type(displaced_geometry_t), | intent(out), | allocatable | :: | backward_geoms(:) |
Clean up memory for displaced geometry
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(displaced_geometry_t), | intent(inout) | :: | this |