funnyhills-parameterization
The Funny-Hills {c, h, α} nuclear shapes of Brack, Damgaard, Jensen, Pauli,
Strutinsky and Wong (Rev. Mod. Phys. 44 (1972) 320, §VII): a Fortran 2018
library with a C API and Python bindings. It takes [c, h, alpha] and
returns the axial surface: R(theta) and dR/dtheta at caller thetas, the
ρ(z) profile on a uniform z grid, the poles, the neck, the resolved
coefficients A and B with their branch, the (c, h)-plane reference lines,
and the diagnostics q2 and ρ_cm.
The library follows the two-tier shape parameterization contract shared with beta-parameterization, fos-parameterization, tqs-parameterization and cassini-parameterization: one-shot functions, plus a read-only cache that is built once and shared across threads. Like tqs it is fixed-arity: exactly three parameters.
The shape
In R0 = 1 units (volume 4π/3), with u ∈ [−1, 1], z = c u − z_cm and ρ = c √P(u):
B ≥ 0 (polynomial branch, eq. VII.4): P = (1 − u²)(A + B u² + α u)
B < 0 (exponential branch, eq. VII.5): P = (1 − u²)(A + α u) exp(B c³ u²)
B = 2h + (c − 1)/2 (eq. VII.7)
The sphere is [1, 0, 0]. The line h = −(c − 1)/4 is the ellipsoid line
(B = 0, the branch switch); h = 0 approximately follows the liquid-drop
valley. A is fixed by exact volume conservation: A = 1/c³ − B/5 on the
polynomial branch (VII.7) and A = 4/(3 c³ K₀₁(B c³)) on the exponential one,
with K₀₁ a positive-term power series. This is the literal reading of the
paper (its eq. VII.6 is exact for VII.4 and "approximately equal" for VII.5):
c is the true half-length on both branches, so the length is exactly 2c
independently of α. The origin is the centre of mass of every connected
shape: z_cm = α c⁴/5 on the polynomial branch, (3/4) α c⁴ K₁₁(B c³) on the
exponential one (for separated shapes see below). Every
integral is closed form; the only root-finds are R(θ) per theta and the
between-node refinement of the star margin.
What is accepted and what is flagged.
- Separated (103 on the R(θ) paths,
shapeand the checked profile): on the polynomial branch with B > 0, f = A + αu + Bu² dips below zero at u* = −α/(2B) inside (−1, 1). The unchecked profile draws both fragments with ρ = 0 in the void;geometryreports the gap andlobe_volume. Past scission the paper's normalization integrates P over the whole interval, void included, so the fragments hold more than 4π/3 (5.7% more at (2.2, 0, 0), 10.8% at (1.9, 0.3, 0));lobe_volumesays by how much. The frame follows the paper's full-interval convention: z_cm = c ∫uP/∫P over the whole of [−1, 1], void included (α c⁴/5 on the polynomial branch, whatever B). For a symmetric separated shape that is the fragments' centre of mass; for an asymmetric one it is not, and the offset is large. SEPARATED_ASYM[2.2, 0.3, 0.2]puts the origin 0.40 above the fragments' centre of mass. Once α c³ > 5 the origin lies beyond the north pole andgeometryreports a negativer_north: at[2.5, 0.6, 0.5]the body spans z ∈ [−6.41, −1.41],r_north = −1.41, and the fragments' centre of mass is at −2.92. Physics paths are unaffected (every R(θ) output andshapereport 103 there), so this matters only to a caller drawing or splitting separated shapes. - Pinched (102 on the R(θ) paths): |f(u*)| ≤ 1e-12, the scission line.
- Pole-negative (101, every path but
coefficients): f(±1) ≤ 0, i.e. A + B ≤ |α| (polynomial) or A ≤ |α| (exponential): ρ² < 0 next to a pole, outside the family. - c ≤ 0 (100, every path).
The star gate. R(θ) exists only where the surface is star-convex from
the centre of mass. The gate quantity is d, the signed distance from the
origin to the tangent line of the profile curve (1 on the sphere, the pole
radius at a pole). d is sampled on the scan in φ = arccos u, every sampled
local minimum is refined by golden section between its scan neighbours, and
the gate passes iff the refined minimum d_min ≥ 1e-3 (provisional,
inclusive). Sampling alone is not enough: [2.13, −0.165, 0.2] samples
d = +2.9e-3 on a 65-node scan, but its minimum is −8.4e-4 and the ray at
θ ≈ 3.0244 meets the surface three times. d_min is exported on every
resolvable shape.
The neck is exact: the critical points of P are the roots of the cubic P'(u) = −4Bu³ − 3αu² + 2(B − A)u + α, and a neck exists iff all three are real and inside (−1, 1). The exponential branch and the ellipsoid line never have one (P is log-concave there). Pinched and separated shapes report the split plane z = c u* − z_cm with ρ_neck = 0.
ρ_cm is half the distance between the mass centres of the halves u < 0
and u > 0 (sphere 3/8), as the paper's prose (p. 368) and figs. VII-3 and
VIII-3 use it. The printed eq. VII.17a is twice that (sphere 3/4); the
library follows the prose and the figures. q2 is ⟨r² P2(cos θ)⟩ with the
reference normalization 3/(4π) in the library frame; for a separated shape it
is integrated over the fragments, not divided by lobe_volume.
Two tiers
- One-shot. One call computes a shape and keeps nothing.
- Read-only cache. Build a cache once (the scan resolution
n_u_gridand a primary theta set;max_paramsmust be 3), then request any number of shapes against it. Nothing derived from a shape parameter is stored, so no call influences a later one, and any number of threads may compute on one cache at once.
The two tiers return the same status and bitwise-identical outputs.
| Output | Cached | One-shot |
|---|---|---|
| R(theta) at the primary thetas | cache_radius_grid_s |
compute_radius_grid_standalone_s |
| R(theta) and dR/dtheta | cache_radius_and_derivative_s |
compute_radius_and_derivative_standalone_s |
| R(theta) and dR/dtheta at caller thetas | cache_radius_and_derivative_at_thetas_s |
(the one-shot forms take caller thetas) |
| z_shift and pole distances, with the R(theta) verdict | cache_shape_s |
compute_shape_standalone_s |
| profile (z, rho, drho/dz) on uniform z, checked | cache_rho_z_grid_s |
compute_rho_z_grid_standalone_s |
| profile, separated shapes included | cache_rho_z_grid_unchecked_s |
compute_rho_z_grid_unchecked_standalone_s |
| neck position and radius | cache_neck_s |
compute_neck_standalone_s |
| geometry: branch, A, B, z_shift, poles, gap, lobe_volume, d_min, flags | cache_geometry_s |
compute_geometry_standalone_s |
| q2 and ρ_cm | cache_moments_s |
compute_moments_standalone_s |
| A, B, branch, h_ellipsoid and h_scission at this c | cache_coefficients_s |
compute_coefficients_standalone_s |
The C functions are funnyhills_param_cache_<output> and
funnyhills_param_<output>; the Python names are the methods of Cache and
the module-level functions.
Fortran
use funnyhills_parameterization_mod, only: cache_t, cache_init_s, cache_radius_grid_s, &
compute_geometry_standalone_s, funnyhills_geometry_t
type(cache_t) :: cache
type(funnyhills_geometry_t) :: geometry
real(kind = rk) :: thetas(64), radii(64)
integer(kind = ik) :: status
! One-shot
call compute_geometry_standalone_s([1.6_rk, 0.3_rk, 0.2_rk], 2049_ik, geometry, status)
! Cached
call cache_init_s(cache, 3_ik, 2049_ik, thetas, status)
call cache_radius_grid_s(cache, [1.0_rk, 0.0_rk, 0.0_rk], radii, status)
C
#include "funnyhills_parameterization.h"
const double params[3] = {1.6, 0.3, 0.2};
int32_t status;
funnyhills_param_cache_t *cache = funnyhills_param_cache_create(3, 2049, thetas, n_thetas, &status);
status = funnyhills_param_cache_radius_grid(cache, params, 3, radii, n_thetas);
funnyhills_param_geometry_t geometry;
funnyhills_param_geometry(params, 3, 2049, &geometry, &status); /* one-shot */
funnyhills_param_cache_destroy(cache);
Python
import funnyhills_parameterization as fp
print(fp.moments([1.0, 0.0, 0.0])) # one-shot: q2 = 0, rho_cm = 0.375
params = [1.6, 0.3, 0.2]
with fp.Cache(2049, fp.theta_grid(64)) as cache: # cached
res = cache.radius_and_derivative(params)
if res.ok:
print(res.radii, res.dr_dtheta)
print(cache.geometry(params), cache.coefficients(params))
Status codes
Every fallible routine reports an integer status; 0 is success. On any
nonzero status every output is zero-filled.
| Code | Name | Meaning |
|---|---|---|
| 1 | too_many_params |
max_params > 3, or a one-shot call with more than 3 parameters |
| 2 | cache_not_initialized |
compute on a cache that was not built |
| 3 | invalid_grid |
no thetas, a theta outside [0, pi], n_u_grid < 65, a profile under 3 nodes, or an output array of the wrong size |
| 4 | wrong_param_count |
a cached call without exactly 3 parameters, or a one-shot call with fewer |
| 5 | invalid_init |
max_params < 3 (and, in C, a negative size argument to a one-shot call) |
| 100 | invalid_c |
c ≤ 0 |
| 101 | pole_negative |
ρ² negative next to a pole: not in the family |
| 102 | not_star_convex |
R(theta) outputs and shape only: pinched, or star margin below 1e-3 |
| 103 | separated |
R(theta) outputs, shape and the checked profile: two fragments |
Precedence on every path: usage codes, then 100, 101, 103, 102. neck,
geometry, moments and the unchecked profile fail only with usage codes,
100 and 101; coefficients only with usage codes and 100. Codes 1-5 are
shared with the other shape libraries. Inputs must be finite: the release
build cannot detect NaN.
Build and install
Python. 0.1.0 is not on PyPI yet. Build the wheel from a checkout:
python -m pip install build
python -m build --wheel --outdir dist_raw
python -m pip install dist_raw/funnyhills_parameterization-*.whl
CMake. Fetch the library into a Fortran or C/C++ project:
include(FetchContent)
FetchContent_Declare(
funnyhills-parameterization
GIT_REPOSITORY https://github.com/AleksanderAugustyn/funnyhills-parameterization.git
GIT_TAG 0.1.0
)
set(FUNNYHILLS_PARAM_BUILD_TESTS OFF)
FetchContent_MakeAvailable(funnyhills-parameterization)
target_link_libraries(my_target PRIVATE FunnyhillsParameterization::funnyhills_parameterization)
Targets: FunnyhillsParameterization::funnyhills_parameterization (static,
Fortran modules), FunnyhillsParameterization::funnyhills_parameterization_shared
(shared library) and FunnyhillsParameterization::funnyhills_parameterization_cxx
(the C header plus the shared library).
From a checkout.
cmake -S . -B build/release -DCMAKE_BUILD_TYPE=Release
cmake --build build/release -j
ctest --test-dir build/release --output-on-failure -E geometry_sweep
FUNNYHILLS_PARAM_LIB=$PWD/build/release/libfunnyhills_parameterization.so PYTHONPATH=$PWD/python \
python -m pytest python/tests -q
The geometry sweep over the published window is its own pair of ctests
(ctest -L sweep: the default pass and --full). The Python loader prefers
FUNNYHILLS_PARAM_LIB, then the library inside an installed wheel, then
build/release: rebuild build/release after pulling, or a stale build can
shadow the source you are testing.
Version pins
| Dependency | Version |
|---|---|
| gcc-compiler-options | 2.0.0 |
| fortran-foundations | 3.0.0 |
Both are fetched by CMake. The library needs gfortran 10 or newer; it is developed with gfortran 13. Python 3.9 or newer, NumPy 1.21 or newer.
Changelog and license
See the changelog. MIT license.
Metadata
Release files for funnyhills-parameterization 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| funnyhills_parameterization-0.1.0.tar.gz | 90.3 kB | With provenance | Details for funnyhills_parameterization-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| funnyhills_parameterization-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details for funnyhills_parameterization-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
Total release size: 1.2 MB
Release files / funnyhills_parameterization-0.1.0.tar.gz
| Download URL | funnyhills_parameterization-0.1.0.tar.gz |
|---|---|
| Size | 90.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5d0871f43b3bf243cac291bb87f3c47e2cc640608b810345912b59607d288eb
|
|
BLAKE2b-256 checksum How to use checksums |
45dfa77001877f83167c399a7f6c67847cac590d8eecc23d98de90927cb0b7f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / funnyhills_parameterization-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | funnyhills_parameterization-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
85d155bd1f9bec216d16eadf5a09c5d9db51c1f50c0c8cf5b49fc3c3dde2a56a
|
|
BLAKE2b-256 checksum How to use checksums |
1fc52802971706f9c789f3d6b32eead76683fbe31e29bb59731b5cd0b90c5d96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for funnyhills-parameterization 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for funnyhills_parameterization-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.