synth_afm.kernels
The kernels module contains the low-level, fully differentiable JAX functions that implement the
AFM imaging physics. These can be used directly for advanced workflows or custom simulators.
simple_height_map_kernel(positions, radii, grid_x, grid_y, smoothness=0.1)
A differentiable forward kernel to compute a molecular height map. Uses a Log-Sum-Exp approximation to smoothly combine atomic heights. Note: The background substrate is assumed to be at z=0.0, and the final height map is clipped to be non-negative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
positions
|
Array
|
(N, 3) array of atomic coordinates. |
required |
radii
|
Array
|
(N,) array of atomic van der Waals radii. |
required |
grid_x
|
Array
|
(H, W) grid of X coordinates. |
required |
grid_y
|
Array
|
(H, W) grid of Y coordinates. |
required |
smoothness
|
float
|
Controls the sharpness of the surface (lower is sharper). |
0.1
|
Returns:
| Type | Description |
|---|---|
Array
|
(H, W) height map array. |
Source code in synth_afm/kernels.py
tip_sample_height_map(positions, radii, grid_x, grid_y, tip_radius=20.0, smoothness=0.5)
Computes a height map where the tip radius is explicitly modeled. This simulates 'tip dilation' where the image is the dilation of the sample surface by the tip shape.
Note: The background substrate is assumed to be at z=0.0, and the final height map is clipped to be non-negative.
Technically, the height at grid point (x, y) is: H(x, y) = max_{atom i} (z_i + sqrt((r_i + r_tip)^2 - d_xy_i^2)) - r_tip