Skip to main content

tricor

Documentation Status

Generate disordered atomic supercells guided by three-body (g3) distributions, spanning the full spectrum from liquid to nanocrystalline. Designed for machine-learning training data generation.

Documentation

Installation

pip install tricor

# Optional data-IO extras
pip install 'tricor[data]'        # h5py, zarr

Or to install the development checkout:

git clone https://github.com/ophusgroup/tricor
cd tricor
uv sync                # or: pip install -e '.[test]'

tricor requires Python ≥ 3.10 and works on Linux, macOS, and Windows.

Quick start - Si

from ase.build import bulk
import tricor as tc

atoms = bulk('Si', 'diamond', a=5.431)
shell_target = tc.CoordinationShellTarget.from_atoms(
    atoms,
    phi_num_bins=90,
)

cell = tc.Supercell.from_atoms(
    atoms,
    cell_dim_angstroms=(40, 40, 40),
    r_max=10,
    r_step=0.1,
    phi_num_bins=90,
    relative_density=0.96,
    rng_seed=42,
)
cell.generate(
    shell_target,
    num_steps=150,
    grain_size=13.0,
    bond_weight=1.9,
    angle_weight=0.9,
    repulsion_weight=2.5,
    hard_core_scale=0.95,
    nonbond_push_scale=0.7,
    displacement_sigma=0.04,
)

cell.measure_g3()
cell.plot_g3()

cell.plot_structure(output='structure.mp4')

Quick start - SiC (binary)

atoms = bulk('SiC', 'zincblende', a=4.36)
shell_target = tc.CoordinationShellTarget.from_atoms(
    atoms,
    phi_num_bins=90,
)

cell = tc.Supercell.from_atoms(
    atoms,
    cell_dim_angstroms=(40, 40, 40),
    r_max=10,
    r_step=0.1,
    phi_num_bins=90,
    relative_density=0.96,
    rng_seed=42,
)
cell.generate(
    shell_target,
    num_steps=150,
    grain_size=13.0,
    bond_weight=1.9,
    angle_weight=0.9,
    repulsion_weight=2.5,
    hard_core_scale=0.95,
    nonbond_push_scale=0.7,
    displacement_sigma=0.04,
)

cell.measure_g3()
cell.plot_g3()  # browse Si | Si Si, C | C C, etc.

Structure generation

generate() builds disordered structures by combining Voronoi grain construction with spring-network relaxation.

Parameter Controls
grain_size Crystallite diameter (A). None = no grains (liquid).
bond_weight Spring strength for bond distances. Larger = tighter.
angle_weight Spring strength for bond angles. Larger = tighter.
hard_core_scale Scales the minimum bond distance wall. < 1 = softer (liquid).
nonbond_push_scale Scales the non-bonded clearance distance. < 1 = broader 2nd shell.
displacement_sigma Gaussian jitter on grain atoms (A). Broadens crystalline peaks.
relative_density Density relative to crystal (set on from_atoms).

Available as Supercell.PRESETS:

cell = tc.Supercell.from_atoms(
    atoms,
    (40, 40, 40),
    rng_seed=42,
)
cell.generate(shell_target, **tc.Supercell.PRESETS["MRO"])
Regime grain_size bond_wt angle_wt rep_wt hc_scale nbp_scale disp_sigma
liquid None 0.4 0.5 0.5 0.75 0.7 -
amorphous 6 1.2 0.6 1.5 0.9 0.5 0.08
SRO 10 2.2 1.0 2.0 0.95 0.6 0.04
MRO 13 1.9 0.9 2.5 0.95 0.7 0.04
MRO_more 18 2.0 1.0 default 0.95 0.9 0.04
nanocrystalline_10 15 2.8 1.3 default default default 0.02
nanocrystalline_20 20 3.0 1.5 default default default 0.02

All presets use relative_density=0.96. Abbreviations: rep_wt = repulsion_weight, hc_scale = hard_core_scale, nbp_scale = nonbond_push_scale.

Optional: target g3 for comparison

To compare the supercell against a target distribution, create one explicitly and pass it as the initial distribution:

dist = tc.G3Distribution(atoms)
dist.measure_g3(
    r_max=10,
    r_step=0.1,
    phi_num_bins=90,
)
target = dist.target_g3(
    target_r_min=5.0,
    target_r_max=8.0,
    r_sigma=0.05,
    phi_sigma_deg=3.0,
)

cell = tc.Supercell(
    target,
    cell_dim_angstroms=(40, 40, 40),
    relative_density=0.96,
)
cell.generate(
    shell_target,
    grain_size=13.0,
    bond_weight=1.9,
    angle_weight=0.9,
    repulsion_weight=2.5,
    hard_core_scale=0.95,
    nonbond_push_scale=0.7,
    displacement_sigma=0.04,
)
cell.measure_g3()
cell.plot_g3_compare()

Core classes

  • G3Distribution - measures rooted three-body angle/distance histograms from atomic structures
  • CoordinationShellTarget - extracts first-shell coordination targets (bond lengths, angles, coordination numbers) from a reference crystal
  • Supercell - generates and optimises disordered supercells

Dependencies

  • numpy, matplotlib, ase, anywidget
  • Optional: h5py, zarr (for data I/O)

Metadata

Release files for tricor 0.1.1

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

Source distribution (sdist)

Source distribution for tricor 0.1.1
File Size Uploaded Provenance
tricor-0.1.1.tar.gz 7.1 MB Without provenance Details

Built distribution (wheel)

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

Total release size: 7.3 MB

Release files / tricor-0.1.1.tar.gz

Download URL tricor-0.1.1.tar.gz
Size 7.1 MB
Tags Source
SHA-256 checksum
How to use checksums
55123630ddc7801dd55bd99088e78147e561b84c284a35ccfcf70ed6e2c1daa5
BLAKE2b-256 checksum
How to use checksums
f5adcfe35edf158916c33d2c293953e22374f8b97b3c5f16b2e4483902157996
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / tricor-0.1.1-py3-none-any.whl

Download URL tricor-0.1.1-py3-none-any.whl
Size 215.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb187ad5cf0d2c448180c6d5e0b70e7cccca31d4388d8909d626ad0c5d36e0f6
BLAKE2b-256 checksum
How to use checksums
a547b36308dfb478ef4dd915873800bafa114a9901e2f535ce6629739eb88e25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for tricor 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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