Skip to main content

symcrys for Python

Crystallographic symmetry calculations: the 32 crystallographic point groups with their settings (ITC and Birss conventions), symbols, symmetry elements, site symmetry and Wyckoff positions, and the forms of property tensors of rank 0 to 4 they allow, checked against print (ITC, Birss, Yariv).

This package is the TypeScript library symcrys of the same version, run in an embedded JavaScript engine (quickjs-ng). The results are those of the TypeScript library (up to rounding in the last bit of a float); the names follow a fixed rule (tensorForm → tensor_form), and matrices and vectors are NumPy arrays.

pip install symcrys

Example: second-harmonic generation at a surface

import numpy as np
import symcrys

SHG = {"rank": 3, "parity": "polar", "time_parity": "i", "intrinsic": "jk"}

symcrys.tensor_form("m-3m", SHG)["basis"].shape   # (0, 27): no SHG from the bulk

ops = symcrys.operations("m-3m")
site = symcrys.site_symmetry(ops, [1, 1, 1])      # symmetry of the (111) surface normal
form = symcrys.tensor_form_of([ops[i] for i in site["operations"]], SHG)
form["parameters"]                                # 4 free components (3m)

# The same form in a frame with z along the normal and x along a mirror normal:
z = np.array([1, 1, 1]) / np.sqrt(3)
x = np.array([1, -1, 0]) / np.sqrt(2)
frame = np.array([x, np.cross(z, x), z])
basis = np.array([symcrys.rotate_tensor(b, frame, SHG) for b in form["basis"]])
chi = basis.reshape(-1, 3, 3, 3)                  # chi[k] is the k-th basis tensor chi_ijk

A tensor form has basis (rows of length 3**rank in reduced row echelon form, components in C order, so reshape((3,)*rank) gives the tensor), parameters (the free components as index lists) and relations (rows r with r @ t = 0). Each call costs about a millisecond or more: fetch forms and operations once, then compute with NumPy.

Documentation

  • Conventions, frames and the print sources of every result: docs/conventions.md.
  • Functions: the docstrings here, and the TypeScript API they call (same names in camelCase).
  • Errors from the library raise symcrys.SymcrysError, a subclass of ValueError.

Python 3.10 or later. quickjs-ng has no wheel for macOS on Intel; pip builds it from source there (a C compiler is needed). Licence: MIT.

Metadata

Release files for symcrys 0.5.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 symcrys 0.5.0
File Size Uploaded Provenance Actions
symcrys-0.5.0.tar.gz 21.9 kB With provenance Details for symcrys-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 45.1 kB

Release files / symcrys-0.5.0.tar.gz

Download URL symcrys-0.5.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f5ff5b92c0cffb5362b65abf616071f1ab131fbd12ad6bce0738efaa7bb65a69
BLAKE2b-256 checksum
How to use checksums
686df97f0c763cf45220987af8c864c9afece3db7a746cc19396de8ca07e156f
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 19, 2026.

Transparency log

Release files / symcrys-0.5.0-py3-none-any.whl

Download URL symcrys-0.5.0-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
875e913e93c317e7d0d13df94b97dcdc4549468c753932985b073e61b4f3e41f
BLAKE2b-256 checksum
How to use checksums
8f335524dd480e73f6599fe50ac927239e62f2de37025a935c965cf26a3013a2
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 19, 2026.

Transparency log

Security for symcrys 0.5.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 symcrys-0.5.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 19, 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