Skip to main content
Orochi Logo

orochi.pdfsim

PyPi Forge PythonVersion PR

CI Codecov Black Tracking

Overview

The orochi.pdfsim package is a Python module dedicated to the calculation of Pair Distribution Functions (PDFs), denoted as G(r). It interfaces with orochi.phase to obtain structural information and computes the PDF considering periodic boundary conditions.

The core calculations are optimized for speed using Numpy and Numba. While primarily designed for CPU-based computation, GPU support for large-scale calculations is under development to further enhance performance.

A key characteristic of orochi.pdfsim is its ability to incorporate the scattering angle dependence (Q-dependence) of atomic scattering factors. This feature is particularly advantageous for accurately simulating PDFs of materials containing pairs of atoms with significantly different atomic numbers.

Key Features

  • Pair Distribution Function (PDF) Simulation:

    Calculates G(r) from structural models.

  • Integration with ``orochi.phase``:

    Seamlessly retrieves atomic coordinates, occupancies, displacement parameters, and lattice information.

  • Periodic Boundary Conditions:

    Correctly handles periodic structures to accurately compute pair distances across unit cell boundaries.

  • High-Performance Core:

    Utilizes Numpy and Numba for efficient computation on CPUs.

  • GPU Acceleration (Upcoming):

    GPU support is currently being updated to enable faster processing of large-scale simulations.

  • Q-dependent Scattering Factors:

    Allows for the inclusion of the Q-dependence of atomic scattering factors, providing more accurate PDF simulations, especially for systems with heavy and light element combinations.

Quickstart: Simulating G(r)

from orochi.phase import Phase
from orochi.pdfsim import Simulator
import matplotlib.pyplot as plt

# 1. Load crystallographic structure
phase = Phase()
phase.read_file("CeO2.cif")
phase["shape_type"] = "analytical"   # Bulk crystal representation

# 2. Configure Simulator and link Phase
sim = Simulator()
sim.phase = phase
sim["rambda"] = 0.18033              # X-ray wavelength in Angstrom
sim["qmin"] = 1.0
sim["qmax"] = 25.0
sim["rmin"] = 1.5
sim["rmax"] = 30.0
sim["qdamp"] = 0.028                 # Instrumental resolution damping
sim["qdepend"] = True                # Exact Q-dependent form factors via DCT

# 3. Execution
# Standard call utilizes internal caching (only recalculates modified dependencies):
sim()

# Alternatively, use run(force=True) to guarantee full recalculation:
# sim.run(force=True)

# 4. Access calculated PDF arrays
r = sim.r
gr = sim.Gr

plt.plot(r, gr, label="Calculated G(r)")
plt.xlabel("r (Å)")
plt.ylabel("G(r) (Å⁻²)")
plt.legend()
plt.show()

Execution and Caching Lifecycle

orochi.pdfsim inherits from orochi.base.core.OrochiBase and incorporates dependency-aware method wrapping:

  • Initial Execution: On the first call (_state == "INIT"), the entire pipeline executes: atomic coordinate expansion, shape envelope convolution, atomic form factors, pair histograms g_ij(r), and G(r) synthesis. Upon completion, state transitions to "DONE".

  • Intelligent Incremental Recalculation (``sim()``): During optimization (e.g. refining scale factor or resolution damping Q_damp), expensive pair distance calculations (calc_rij) are automatically skipped because geometric parameters have not changed.

  • Forced Recalculation (``sim.run(force=True)``): When parameters are modified outside standard dictionaries or when absolute state reset is desired, passing force=True resets internal states to "INIT", enforcing complete end-to-end recomputation.

Citation

If you use orochi.pdfsim in a scientific publication, please cite this package as:

S. Tominaka, Orochi: A Physics-Grounded Python Package for Pair Distribution Function Analysis of Crystalline and Low-Dimensional Materials, 2026. https://github.com/Tominaka-Laboratory/orochi.pdfsim

Installation

The preferred method is to install using pip:

pip install orochi.pdfsim

To confirm that the installation was successful, type:

python -c "import orochi.pdfsim; print('Orochi PDFsim imported successfully')"

If you prefer to install from source:

git clone https://github.com/Tominaka-Laboratory/orochi.pdfsim.git
cd orochi.pdfsim
pip install -e .

Getting Started

You may consult our online documentation for tutorials and API references.

Support and Contribute

The orochi.pdfsim project welcomes your expertise and enthusiasm!

If you see a bug or want to request a feature, please report it as an issue and/or submit a fix as a PR.

Feel free to fork the project and contribute. To install orochi.pdfsim in a development mode, with its sources being directly used by Python rather than copied to a package directory, use the following in the root directory

pip install -e .

To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit hooks.

Improvements and fixes are always appreciated.

Before contributing, please read our Code of Conduct.

License

This project is licensed under the GNU General Public License v3.0 (GPLv3). See the LICENSE.rst file for details.

This copyleft license guarantees that Orochi remains freely accessible, open, and transparent to the entire scientific community, and that all derivative works must likewise remain open source.

Citation

If you use this package in academic research, please cite:

@article{tominaka2026orochi,
  title   = {Orochi: A Physics-Grounded Python Package for Pair Distribution Function Analysis of Crystalline and Low-Dimensional Materials},
  author  = {Tominaka, Satoshi},
  year    = {2026},
  url     = {https://github.com/Tominaka-Laboratory/orochi}
}

Contact

For more information on orochi.pdfsim please visit the project web-page or email Dr. Satoshi Tominaka at tominaka.satoshi@nims.go.jp.

Metadata

Release files for orochi.pdfsim 4.0.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 orochi.pdfsim 4.0.0
File Size Uploaded Provenance
orochi_pdfsim-4.0.0.tar.gz 62.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for orochi.pdfsim 4.0.0
File Interpreter ABI Platform
orochi_pdfsim-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 130.6 kB

Release files / orochi_pdfsim-4.0.0.tar.gz

Download URL orochi_pdfsim-4.0.0.tar.gz
Size 62.6 kB
Tags Source
SHA-256 checksum
How to use checksums
388de932e6a47d4a259dc2cde93ac0f9004bd22e197271066cc074e428139783
BLAKE2b-256 checksum
How to use checksums
79ee2ac3809c84b149e4eb1b390badf074a7553acc09543b3e8dca234bce6971
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / orochi_pdfsim-4.0.0-py3-none-any.whl

Download URL orochi_pdfsim-4.0.0-py3-none-any.whl
Size 68.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
853f5887e528dd3d5629523ddab2f7df3f32ed7d79089395c7fed15583041153
BLAKE2b-256 checksum
How to use checksums
833664f2e6a36e505560c1502cacd0ff49cd4577dc871a1f8091371052dcbb76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for orochi.pdfsim 4.0.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.

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

4.0.0 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