![]() |
(git:f7b9015)
|
Reduced-coordinate parameterization of cell constraints for CELL_OPT. More...
Data Types | |
| type | cell_manifold_type |
| Active constraint set and fixed coordinate bases anchored at q0. More... | |
Functions/Subroutines | |
| subroutine, public | cell_manifold_init (m, q0, mask, info, lin_w, eq_pair) |
| Record constraint targets at q0, check row independence, and build [Y, Z]. | |
| subroutine, public | cell_manifold_geometry (q, s, info) |
| Compute cell lengths, angles in radians, and volume s(q). | |
| subroutine, public | cell_manifold_jacobian (q, j, info) |
| Compute the analytic 7 x 6 Jacobian J = ds/dq of the geometric quantities. | |
| subroutine, public | cell_manifold_residual (m, q, r, info) |
| Evaluate the k active constraint residuals r(q). | |
| subroutine, public | cell_manifold_active_jacobian (m, q, a, info) |
| Assemble the k x 6 Jacobian A(q) = dr/dq of the active constraints. | |
| subroutine, public | cell_manifold_chart_eval (m, u, q, info) |
| Map reduced coordinates u to a canonical cell q(u) that satisfies r(q) = 0. | |
| subroutine, public | cell_manifold_chart_inv (m, q, u) |
| Map a canonical cell q back to reduced coordinates u = u0 + Z^T (q - q0). | |
| subroutine, public | cell_manifold_chart_pullback_grad (m, q, g_q, g_u, info) |
| Transform a 6-component cell gradient g_q into the reduced gradient g_u = (dq/du)^T g_q. | |
| subroutine, public | cell_manifold_proj_pressure (m, q, g_phys, pdiff, projected, info) |
| Compute the pressure residual P_constr - pres_ext along unconstrained cell directions. | |
| pure real(kind=dp) function, dimension(n_slot), public | cell_manifold_pack_hmat (hmat) |
| Pack the upper-triangular canonical cell matrix into q(1:6). | |
| pure subroutine, public | cell_manifold_unpack_hmat (q, hmat) |
| Write q(1:6) into the upper-triangular canonical cell matrix. | |
| pure character(len=default_string_length) function, public | cell_manifold_status_label (info) |
| Return a short description of a cell_manifold_utils status code. | |
| logical function, public | cell_manifold_is_redundant (m, mask, lin_w, eq_pair) |
| Test whether one candidate constraint stays zero on manifold m near q0. | |
| subroutine, public | cell_manifold_pin_semidefinite (m, mask, is_pinned, lin_w, eq_pair) |
| Pin implied directions when a candidate constraint is semidefinite at q0. | |
Variables | |
| integer, parameter, public | n_slot = 6 |
| integer, parameter, public | n_geom = 7 |
| integer, parameter, public | slot_ax = 1 |
| integer, parameter, public | slot_bx = 2 |
| integer, parameter, public | slot_by = 3 |
| integer, parameter, public | slot_cx = 4 |
| integer, parameter, public | slot_cy = 5 |
| integer, parameter, public | slot_cz = 6 |
| integer, parameter, public | geom_a = 1 |
| integer, parameter, public | geom_b = 2 |
| integer, parameter, public | geom_c = 3 |
| integer, parameter, public | geom_alpha = 4 |
| integer, parameter, public | geom_beta = 5 |
| integer, parameter, public | geom_gamma = 6 |
| integer, parameter, public | geom_v = 7 |
| integer, parameter, public | comp_ax = 2**0 |
| integer, parameter, public | comp_bx = 2**1 |
| integer, parameter, public | comp_by = 2**2 |
| integer, parameter, public | comp_cx = 2**3 |
| integer, parameter, public | comp_cy = 2**4 |
| integer, parameter, public | comp_cz = 2**5 |
| integer, parameter, public | mask_a = comp_ax |
| integer, parameter, public | mask_b = comp_bx + comp_by |
| integer, parameter, public | mask_c = comp_cx + comp_cy + comp_cz |
| integer, parameter, public | mask_x = comp_ax + comp_bx + comp_cx |
| integer, parameter, public | mask_y = comp_bx + comp_by + comp_cy |
| integer, parameter, public | mask_z = mask_c |
| integer, parameter, public | mask_xy = comp_ax + comp_bx + comp_by + comp_cx + comp_cy |
| integer, parameter, public | mask_xz = comp_ax + comp_bx + comp_cx + comp_cy + comp_cz |
| integer, parameter, public | mask_yz = comp_bx + comp_by + comp_cx + comp_cy + comp_cz |
| integer, parameter, public | mask_all = comp_ax + comp_bx + comp_by + comp_cx + comp_cy + comp_cz |
| integer, parameter, public | gfix_a = 2**6 |
| integer, parameter, public | gfix_b = 2**7 |
| integer, parameter, public | gfix_c = 2**8 |
| integer, parameter, public | gfix_alpha = 2**9 |
| integer, parameter, public | gfix_beta = 2**10 |
| integer, parameter, public | gfix_gamma = 2**11 |
| integer, parameter, public | gfix_v = 2**12 |
| integer, parameter, public | gfix_all = gfix_a + gfix_b + gfix_c + gfix_alpha + gfix_beta + gfix_gamma + gfix_v |
| integer, parameter, public | n_constraint_bits = n_slot + n_geom |
| real(kind=dp), parameter, public | min_cell_length = 1.0E-8_dp |
| integer, parameter, public | info_ok = 0 |
| integer, parameter, public | info_degenerate = -1 |
| integer, parameter, public | info_licq = -2 |
| integer, parameter, public | info_no_converge = -3 |
| integer, parameter, public | info_bad_input = -4 |
| external | dgeqrf |
Reduced-coordinate parameterization of cell constraints for CELL_OPT.
This pure-math module depends only on kinds, ieee_arithmetic, and LAPACK. It has no force_env, cell_type, or input dependencies.
Canonical cell vector: CP2K places lattice vector a along x and b in the xy plane: hmat(:, 1) = (AX, 0, 0) hmat(:, 2) = (BX, BY, 0) hmat(:, 3) = (CX, CY, CZ) The 6 upper-triangular entries form q = (AX, BX, BY, CX, CY, CZ). The 7 geometric quantities are s(q) = (a, b, c, alpha, beta, gamma, V), with angles in radians and volume V = AX * BY * CZ.
Constraint equations and reduced coordinates: Active constraints define k equations r(q) = 0 with k x 6 Jacobian A(q) = dr/dq:
At the initial cell q0, QR factorization splits R^6 into two fixed orthonormal bases:
The optimizer works only on the reduced vector u of length ndof:
Sign convention: get_dg_dh returns g_q = +d(E + pres_ext*V)/dq. Routine cell_manifold_proj_pressure maps g_q to pdiff = P_constr - pres_ext.
| subroutine, public cell_manifold_utils::cell_manifold_init | ( | type(cell_manifold_type), intent(out) | m, |
| real(kind=dp), dimension(n_slot), intent(in) | q0, | ||
| integer, intent(in) | mask, | ||
| integer, intent(out) | info, | ||
| real(kind=dp), dimension(:, :), intent(in), optional | lin_w, | ||
| integer, dimension(:, :), intent(in), optional | eq_pair ) |
Record constraint targets at q0, check row independence, and build [Y, Z].
| m | initialized constraint state |
| q0 | initial canonical cell components |
| mask | bit union of comp_* and gfix_* flags |
| info | info_ok, info_degenerate, info_licq, or info_bad_input |
| lin_w | optional 6 x n_lin linear coupling weights, one constraint per column |
| eq_pair | optional 2 x n_eq index pairs [m, n] in 1..6 for s_m(q) = s_n(q) |
Definition at line 199 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_geometry | ( | real(kind=dp), dimension(n_slot), intent(in) | q, |
| real(kind=dp), dimension(n_geom), intent(out) | s, | ||
| integer, intent(out) | info ) |
Compute cell lengths, angles in radians, and volume s(q).
| q | canonical cell components (AX, BX, BY, CX, CY, CZ) |
| s | geometric quantities (a, b, c, alpha, beta, gamma, V) |
| info | info_ok or info_degenerate |
Definition at line 289 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_jacobian | ( | real(kind=dp), dimension(n_slot), intent(in) | q, |
| real(kind=dp), dimension(n_geom, n_slot), intent(out) | j, | ||
| integer, intent(out) | info ) |
Compute the analytic 7 x 6 Jacobian J = ds/dq of the geometric quantities.
| q | canonical cell components (AX, BX, BY, CX, CY, CZ) |
| J | Jacobian matrix ds/dq |
| info | info_ok or info_degenerate |
Definition at line 346 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_residual | ( | type(cell_manifold_type), intent(in) | m, |
| real(kind=dp), dimension(n_slot), intent(in) | q, | ||
| real(kind=dp), dimension(m%k), intent(out) | r, | ||
| integer, intent(out) | info ) |
Evaluate the k active constraint residuals r(q).
| m | constraint state |
| q | canonical cell vector |
| r | residual vector of length mk (zero when q satisfies all constraints) |
| info | info_ok or info_degenerate |
Definition at line 410 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_active_jacobian | ( | type(cell_manifold_type), intent(in) | m, |
| real(kind=dp), dimension(n_slot), intent(in) | q, | ||
| real(kind=dp), dimension(m%k, n_slot), intent(out) | a, | ||
| integer, intent(out) | info ) |
Assemble the k x 6 Jacobian A(q) = dr/dq of the active constraints.
| m | constraint state |
| q | canonical cell vector |
| A | active constraint Jacobian in the same row order as cell_manifold_residual |
| info | info_ok or info_degenerate |
Definition at line 457 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_chart_eval | ( | type(cell_manifold_type), intent(inout) | m, |
| real(kind=dp), dimension(m%ndof), intent(in) | u, | ||
| real(kind=dp), dimension(n_slot), intent(out) | q, | ||
| integer, intent(out) | info ) |
Map reduced coordinates u to a canonical cell q(u) that satisfies r(q) = 0.
| m | constraint state. This routine updates only last_iter and last_resid. |
| u | reduced coordinates of length mndof |
| q | canonical cell vector on the constraint surface |
| info | info_ok, info_degenerate, info_licq, or info_no_converge |
Definition at line 501 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_chart_inv | ( | type(cell_manifold_type), intent(in) | m, |
| real(kind=dp), dimension(n_slot), intent(in) | q, | ||
| real(kind=dp), dimension(m%ndof), intent(out) | u ) |
Map a canonical cell q back to reduced coordinates u = u0 + Z^T (q - q0).
| m | constraint state |
| q | canonical cell vector |
| u | reduced coordinates of length mndof |
Definition at line 596 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_chart_pullback_grad | ( | type(cell_manifold_type), intent(in) | m, |
| real(kind=dp), dimension(n_slot), intent(in) | q, | ||
| real(kind=dp), dimension(n_slot), intent(in) | g_q, | ||
| real(kind=dp), dimension(m%ndof), intent(out) | g_u, | ||
| integer, intent(out) | info ) |
Transform a 6-component cell gradient g_q into the reduced gradient g_u = (dq/du)^T g_q.
| m | constraint state |
| q | current canonical cell vector |
| g_q | enthalpy gradient +dH/dq in canonical cell components |
| g_u | enthalpy gradient +dH/du in reduced coordinates |
| info | info_ok, info_degenerate, or info_licq |
Definition at line 620 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_proj_pressure | ( | type(cell_manifold_type), intent(in) | m, |
| real(kind=dp), dimension(n_slot), intent(in) | q, | ||
| real(kind=dp), dimension(n_slot), intent(in) | g_phys, | ||
| real(kind=dp), intent(out) | pdiff, | ||
| logical, intent(out) | projected, | ||
| integer, intent(out) | info ) |
Compute the pressure residual P_constr - pres_ext along unconstrained cell directions.
| m | constraint state |
| q | current canonical cell components |
| g_phys | enthalpy gradient +d(E + pres_ext*V)/dq from get_dg_dh |
| pdiff | residual pressure P_constr - pres_ext along the allowed volume direction |
| projected | .TRUE. if free directions change volume, .FALSE. if volume is fixed |
| info | info_ok, info_degenerate, or info_licq |
Definition at line 669 of file cell_manifold_utils.F.
| pure real(kind=dp) function, dimension(n_slot), public cell_manifold_utils::cell_manifold_pack_hmat | ( | real(kind=dp), dimension(3, 3), intent(in) | hmat | ) |
Pack the upper-triangular canonical cell matrix into q(1:6).
| hmat | canonical 3x3 cell matrix (a along x, b in the xy plane) |
Definition at line 728 of file cell_manifold_utils.F.
| pure subroutine, public cell_manifold_utils::cell_manifold_unpack_hmat | ( | real(kind=dp), dimension(n_slot), intent(in) | q, |
| real(kind=dp), dimension(3, 3), intent(out) | hmat ) |
Write q(1:6) into the upper-triangular canonical cell matrix.
| q | canonical cell vector (AX, BX, BY, CX, CY, CZ) |
| hmat | canonical 3x3 cell matrix with zeroed lower triangle |
Definition at line 741 of file cell_manifold_utils.F.
| pure character(len=default_string_length) function, public cell_manifold_utils::cell_manifold_status_label | ( | integer, intent(in) | info | ) |
Return a short description of a cell_manifold_utils status code.
| info | status code from a cell_manifold_* routine |
Definition at line 760 of file cell_manifold_utils.F.
| logical function, public cell_manifold_utils::cell_manifold_is_redundant | ( | type(cell_manifold_type), intent(in) | m, |
| integer, intent(in) | mask, | ||
| real(kind=dp), dimension(:, :), intent(in), optional | lin_w, | ||
| integer, dimension(:, :), intent(in), optional | eq_pair ) |
Test whether one candidate constraint stays zero on manifold m near q0.
| m | active constraint manifold anchored at q0 |
| mask | candidate comp_* or gfix_* bit, or 0 for a lin_w or eq_pair test |
| lin_w | optional 6 x 1 column of candidate linear weights |
| eq_pair | optional 2 x 1 index pair for a candidate equality |
Definition at line 789 of file cell_manifold_utils.F.
| subroutine, public cell_manifold_utils::cell_manifold_pin_semidefinite | ( | type(cell_manifold_type), intent(inout) | m, |
| integer, intent(in) | mask, | ||
| logical, intent(out) | is_pinned, | ||
| real(kind=dp), dimension(:, :), intent(in), optional | lin_w, | ||
| integer, dimension(:, :), intent(in), optional | eq_pair ) |
Pin implied directions when a candidate constraint is semidefinite at q0.
| m | active constraint manifold at q0. This routine updates m when is_pinned is .TRUE. |
| mask | candidate comp_* or gfix_* bit, or 0 for a lin_w or eq_pair test |
| is_pinned | .TRUE. if this routine pins the candidate constraint |
| lin_w | optional 6 x 1 column of candidate linear weights |
| eq_pair | optional 2 x 1 index pair for a candidate equality |
Definition at line 886 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::n_slot = 6 |
Definition at line 59 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::n_geom = 7 |
Definition at line 59 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::slot_ax = 1 |
Definition at line 60 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::slot_bx = 2 |
Definition at line 60 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::slot_by = 3 |
Definition at line 60 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::slot_cx = 4 |
Definition at line 60 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::slot_cy = 5 |
Definition at line 60 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::slot_cz = 6 |
Definition at line 60 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::geom_a = 1 |
Definition at line 66 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::geom_b = 2 |
Definition at line 66 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::geom_c = 3 |
Definition at line 66 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::geom_alpha = 4 |
Definition at line 66 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::geom_beta = 5 |
Definition at line 66 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::geom_gamma = 6 |
Definition at line 66 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::geom_v = 7 |
Definition at line 66 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::comp_ax = 2**0 |
Definition at line 75 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::comp_bx = 2**1 |
Definition at line 75 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::comp_by = 2**2 |
Definition at line 75 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::comp_cx = 2**3 |
Definition at line 75 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::comp_cy = 2**4 |
Definition at line 75 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::comp_cz = 2**5 |
Definition at line 75 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::mask_a = comp_ax |
Definition at line 81 of file cell_manifold_utils.F.
Definition at line 81 of file cell_manifold_utils.F.
Definition at line 81 of file cell_manifold_utils.F.
Definition at line 81 of file cell_manifold_utils.F.
Definition at line 81 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::mask_z = mask_c |
Definition at line 81 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::mask_xy = comp_ax + comp_bx + comp_by + comp_cx + comp_cy |
Definition at line 81 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::mask_xz = comp_ax + comp_bx + comp_cx + comp_cy + comp_cz |
Definition at line 81 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::mask_yz = comp_bx + comp_by + comp_cx + comp_cy + comp_cz |
Definition at line 81 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::mask_all = comp_ax + comp_bx + comp_by + comp_cx + comp_cy + comp_cz |
Definition at line 81 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_a = 2**6 |
Definition at line 96 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_b = 2**7 |
Definition at line 96 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_c = 2**8 |
Definition at line 96 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_alpha = 2**9 |
Definition at line 96 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_beta = 2**10 |
Definition at line 96 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_gamma = 2**11 |
Definition at line 96 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_v = 2**12 |
Definition at line 96 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::gfix_all = gfix_a + gfix_b + gfix_c + gfix_alpha + gfix_beta + gfix_gamma + gfix_v |
Definition at line 103 of file cell_manifold_utils.F.
Definition at line 105 of file cell_manifold_utils.F.
| real(kind=dp), parameter, public cell_manifold_utils::min_cell_length = 1.0E-8_dp |
Definition at line 109 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::info_ok = 0 |
Definition at line 137 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::info_degenerate = -1 |
Definition at line 138 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::info_licq = -2 |
Definition at line 139 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::info_no_converge = -3 |
Definition at line 140 of file cell_manifold_utils.F.
| integer, parameter, public cell_manifold_utils::info_bad_input = -4 |
Definition at line 141 of file cell_manifold_utils.F.
| external cell_manifold_utils::dgeqrf |
Definition at line 186 of file cell_manifold_utils.F.