Skip to main content

Onça-pintada logo

License: MIT PyPI

Onça-pintada

Onça-pintada is a Python package designed to compute thermodynamic properties of binary and multicomponent alloys. It enables the calculation of enthalpy, entropy, and Gibbs free energy of mixing within the subregular solution model, as well as the determination of binodal and spinodal curves for phase diagrams.

The package also supports the evaluation of cluster interactions using the quasi-chemical approximation (QCA), allowing for the description of chemical short-range order (CSRO). Additionally, it provides tools to reconstruct atomistic geometries of alloys based on short-range order metrics, facilitating subsequent calculations of their electronic properties.

The Cluster Expansion builder follows Calango Studio's native approach: it decorates an active sublattice, groups pair/triplet/quadruplet clusters by distance, and retains configurations with distinct correlation fingerprints. It supports exact compositions and seeded sampling for binary and multicomponent alloys, with pure end members preserved during unrestricted generation. The SQS module optimizes fixed-composition supercells against random-alloy correlations using simulated annealing, including periodic pair and optional triplet/quadruplet clusters. No ICET dependency is required.

Installation

python -m pip install oncapintada

For development from a local checkout (Python 3.10 or later):

python -m pip install -e '.[dev,docs]'
python -m pytest

Getting started

import numpy as np
from ase.build import bulk
from oncapintada import BinaryAlloy, ClusterExpansionOptions, generate_cluster_expansion

alloy = BinaryAlloy([[-3.0, -3.9], [-3.1, -4.0]], dilution=0.1)
x = np.linspace(0, 1, 101)
gibbs = alloy.gibbs_free_energy_of_mixing(x, [300, 600])  # kJ/mol

parent = bulk("Cu", "fcc", a=3.6, cubic=True)
options = ClusterExpansionOptions(
    active_element="Cu",
    species=("Cu", "Au", "Ag"),
    supercell=(2, 1, 1),
    pair_cutoff=2.7,
    composition=(0.5, 0.25, 0.25),
    seed=42,
)
result = generate_cluster_expansion(parent, options)
result.write("CuAuAg.extxyz")
print(len(result.configs), result.exhaustive)

See the quick start, Cluster Expansion guide, SQS guide, Monte Carlo guide, review notes, and runnable binary/ternary example.

Fingerprint equality means correlation equivalence at the selected cutoffs, not proven space-group symmetry equivalence. Degeneracies are exact only when result.exhaustive is true. A ridge energy fit with held-out validation is available through fit_effective_cluster_interactions; compute consistent energies for the generated configurations before fitting.

Imports are silent. Use oncapintada.banner() when environment diagnostics are needed. Random alloy, Cluster Expansion, and SQS generation are supported structure workflows. ASE-backed Metropolis chains support species swaps, random displacements, and optional geometry relaxation.

SQS supercells

from oncapintada import generate_sqs

# The same API handles binary and multicomponent alloys.
for name, composition in {
    "CuAu": {"Cu": 0.5, "Au": 0.5},
    "CuAuAg": {"Cu": 0.5, "Au": 0.25, "Ag": 0.25},
}.items():
    sqs = generate_sqs(
        parent,
        composition,
        supercell=(2, 2, 2),  # 32 atoms for this conventional FCC parent
        pair_cutoff=3.7,     # first two FCC neighbor shells, in Å
        n_steps=10_000,
        seed=42,
    )
    sqs.write(f"{name}_sqs.extxyz")
    print(name, sqs.species_counts, sqs.objective, sqs.converged)

Inspect the correlation mismatch before using the structure for calculator runs. Targets use the composition actually realized after site-count rounding. Annealing returns the best visited decoration; it does not guarantee a globally optimal SQS. See examples/sqs.py for an executable workflow.

Energy-based Monte Carlo

from ase.calculators.emt import EMT
from oncapintada import MetropolisMonteCarlo

mc = MetropolisMonteCarlo(
    sqs.atoms, calculator=EMT, temperature=600,
    move="mixed", distribution="gaussian", displacement=0.03,
    swap_indices=sqs.active_indices, seed=42,
)
chain = mc.run(100)
chain.write("mc_trajectory.extxyz")
print(chain.energy, chain.best_energy, chain.acceptance_rate)

Moves either exchange two unlike species or independently displace all atoms. Metropolis acceptance uses total calculator energies in eV and temperature in kelvin. Add relax=True, optimizer="BFGS" to optimize each proposal before comparing energies; this performs a basin-hopping structure search. See the executable example and Monte Carlo guide for relaxation and diagnostics.

License

This is open source code under the MIT License.

Metadata

Release files for oncapintada 26.10.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 oncapintada 26.10.1
File Size Uploaded
oncapintada-26.10.1.tar.gz 6.9 MB Details

Built distribution (wheel)

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

Total release size: 7.0 MB

Release files / oncapintada-26.10.1.tar.gz

Download URL oncapintada-26.10.1.tar.gz
Size 6.9 MB
Tags Source
SHA-256 checksum
How to use checksums
2fdcbfb995f511d24745483087fe5db9b7d5a63bd966de2c09cfd94b82bbe133
BLAKE2b-256 checksum
How to use checksums
730a8e2ab172d35cd004b95db2b3384f5162518eaea1ec3147ae050f7fec8fd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / oncapintada-26.10.1-py3-none-any.whl

Download URL oncapintada-26.10.1-py3-none-any.whl
Size 57.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3768373af12a7a14c3fea47623cf661f9aa913ea072d7be220235df2ab84c35f
BLAKE2b-256 checksum
How to use checksums
75deef30f26d1652f474ae135affde07210066a0762a79d66320185917d8fb59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

26.10.1 This release

2 release files

26.4.9

2 release files

26.4.8

2 release files

26.4.7

2 release files

26.4.6

2 release files

26.4.5

2 release files

26.4.4

2 release files

26.4.3

2 release files

26.4.2

2 release files

26.4.1

2 release files

26.4.0

2 release files

26.3.9

2 release files

26.3.8

2 release files

26.3.7

2 release files

26.3.6

2 release files

26.3.5

2 release files

26.3.4

2 release files

26.3.3

2 release files

26.3.2

2 release files

26.3.1

2 release files

26.3.0

2 release files

26.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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