Skip to main content

Adsorption

Conda Version PyPI version PyPI Downloads

Deterministic generation and geometric/energetic pre-screening of molecular adsorption configurations on clusters and periodic surfaces, built on ASE.

The package is organised as two processes:

  • A — generation (AdsorptionConfigurationGeneratorABC): a fixed-budget, deterministic enumeration of the site O, the approach direction OA on a deterministic near-uniform spherical point set (the spherical Fibonacci lattice by default), the molecular orientation on SO(3) (Super-Fibonacci quaternions), and the anchor distance d.
  • B — filtering (AdsorptionConfigurationFilterABC): a cheap pairwise distance floor, a repulsive Lennard-Jones tier, and an optional relaxation tier.

Generation never imports an ASE calculator; the energy engine is injected only in process B.

Installation

pip install adsorption

Or with pixi:

pixi install

Requires Python 3.12–3.13, ASE, NumPy, SciPy, Hydra, and graphatoms.

Quick start

from ase import Atoms
from ase.build import fcc111
from adsorption import AdsorptionConfigurationPipeline, GeometryFilter
from adsorption import SingleSiteGenerator

slab = fcc111("Cu", size=(3, 4, 3), vacuum=10, orthogonal=True)
oxygen = Atoms("O")
generator = SingleSiteGenerator(
    slab,
    0,                     # adsorption centre: atom index 0
    oxygen,                # adsorbate
    n_oa=50,               # approach directions
    n_rot=1,               # orientations (a single atom has none)
    n_d=6,                 # anchor distances
    d_min=2.0,
    d_max=3.0,
)
filt = GeometryFilter({29: 2.338, 8: 3.0})  # Cu and O sigma
pipeline = AdsorptionConfigurationPipeline(generator, [filt])

for record in pipeline.accepted():
    print(record.trial.index, record.trial.meta["distance"])

For a molecule, build the rotation set with build_orientation("auto", adsorbate, n=200): linear molecules use S^2, planar and three-dimensional molecules use SO(3).

Campaign runner

adsorption-run                         # Hydra entry point, packaged run.yaml
python -m adsorption.runner            # same entry point
adsorption-run parallel.n_jobs=4       # Hydra config override
adsorption-run start=1 stop=100 outputs=./runs/demo

run.yaml is a single file next to the runner package (src/adsorption/runner/run.yaml): it declares the substrate, the adsorbate, the site declaration, the generation protocol, the filter chain and the budget. Swappable objects are _target_ nodes instantiated with hydra.utils.instantiate.

The runner detects the adsorbate's rotatable bonds: when it finds any, it builds a conformer ensemble and uses MultiAdsorbateGenerator; otherwise it uses the single reference. The site declaration is adaptive too: one core set builds SingleSiteGenerator, several core sets build MultiSiteGenerator, and sites: auto selects every top-layer atom as a top site. Candidate intervals are evaluated in parallel with joblib (default backend loky); records.jsonl holds one JSON line per candidate, accepted.xyz holds the accepted structures as one extended-XYZ trajectory, and summary.json holds the campaign totals. A run refuses to start when the candidate count exceeds budget.max_candidates.

The two processes

AdsConfGenABC                       AdsConfFilterABC
├── SingleSiteGenerator   one site        ├── GeometryFilter   pairwise floor
├── MultiSiteGenerator    many sites      ├── LJFilter         repulsive energy
└── MultiAdsorbateGenerator  many         └── EnergyFilter     relaxation + E cut
    conformers (consumed)

AdsConfPipeline applies the filters in order and stops at the first rejection. Every Trial carries its one-based index and budget; every Verdict carries the measured value and the reason.

Package layout

src/adsorption/
├── process/       # Trial, Verdict, the two ABCs, pipeline
├── generate/      # SingleSiteGenerator, MultiSiteGenerator, MultiAdsorbateGenerator
├── filters/       # GeometryFilter, LJFilter, EnergyFilter
├── geometry/      # site, grids, SuperFibonacciSO3, rotation, placement
├── protocol/      # index, plan, sidecar, hashing
├── evaluation/    # single-point and two-stage relaxation
├── metrics/       # ranking, cascade, spherical, rotation metrics
└── config/        # Hydra dataclasses, run.yaml and config groups

Deprecated

The previous three-layer AdsorptionABC hierarchy, the admissible_directions filter, the screen and runner packages, and the pydantic protocol spec are frozen under deprecated/. They are not imported, tested, linted, or packaged.

Development

pixi run test              # pytest -s -vv
pytest src/tests -m "not slow"

The 96 single-site examples live in examples/0-SingleSite/<site>/<adsorbate>/; the six-system multi-site gallery is in examples/1-MultiSite/, and the flexible-adsorbate gallery (n-hexane and 1,5-hexadiene) is in examples/2-FlexibleAdsorbate/. Each folder has its own run_all.sh.

Citation and license

Code: https://github.com/LiuGaoyong/Adsorption, GPL-3.0-or-later. See paper-1/ for the method and the pre-registered evaluation protocol.

Metadata

Release files for adsorption 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adsorption 0.2.0
File Size Uploaded Provenance Actions
adsorption-0.2.0.tar.gz 44.4 kB With provenance Details for adsorption-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adsorption 0.2.0
File Interpreter ABI Platform Actions
adsorption-0.2.0-py3-none-any.whl Python 3 none any Details for adsorption-0.2.0-py3-none-any.whl

Total release size: 103.1 kB

Release files / adsorption-0.2.0.tar.gz

Download URL adsorption-0.2.0.tar.gz
Size 44.4 kB
Tags Source
SHA-256 checksum
How to use checksums
544ca1cbfffc29b977833b04ef0eb76427a138bf12eef8a25c03f4339a30a0b7
BLAKE2b-256 checksum
How to use checksums
cd8fa8bd45508f7a892964c30a9e775be4e28a72db953e67a9b9ae5b52d8f607
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 Nov 6, 2026.

Transparency log

Release files / adsorption-0.2.0-py3-none-any.whl

Download URL adsorption-0.2.0-py3-none-any.whl
Size 58.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39b6241ce92427003e2fedbd2359e0f5df02417801f0178ca34468608d84230a
BLAKE2b-256 checksum
How to use checksums
aee40a3e328fd96afe50ed4584dda2846aaba09e231aa1d7354f5acf7010da21
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 Nov 6, 2026.

Transparency log

Security for adsorption 0.2.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.

Select from 2 files

Attestation for adsorption-0.2.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 Nov 6, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page