Install & Compatibility
Where this runs
tested against v1.7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 7.6s · import 0.000s · 229MB
233MB installed
● package 233MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Symfc
✓ from symfc import Symfc
✗ from symfc.symfc import Symfc
This quickstart demonstrates how to import the `Symfc` class and instantiate a `Symfc` object. It uses dummy data for crystal structure (lattice, positions, numbers) and simulation results (forces, displacements). In a real application, these inputs would come from ab initio calculations or experimental data. The `run()` method would then be called on the instantiated object to compute the force constants.
import numpy as np
from symfc.symfc import Symfc
# In a real scenario, these would come from your simulation or experiment.
# lattice: 3x3 matrix representing the supercell lattice vectors.
# positions: Nx3 array of atomic positions in fractional coordinates within the supercell.
# numbers: N array of atomic numbers for each atom in the supercell.
# forces: M x (N*3) array of forces for M displacement datasets.
# displacements: M x (N*3) array of displacements for M displacement datasets.
# --- Dummy Data for demonstration (replace with your actual data) ---
# Example: a 1-atom supercell (highly simplified, not practical for real phonon calcs)
num_atom_supercell = 1
num_displacement_datasets = 1
lattice = np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
positions = np.array([[0.0, 0.0, 0.0]]) # Single atom at origin
numbers = np.array([1]) # Hydrogen atom
forces = np.random.rand(num_displacement_datasets, num_atom_supercell * 3)
displacements = np.random.rand(num_displacement_datasets, num_atom_supercell * 3)
dataset_weights = np.ones(num_displacement_datasets)
# --- End Dummy Data ---
# Instantiate the Symfc calculator
try:
calculator = Symfc(
forces=forces,
displacements=displacements,
supercell_lattice=lattice,
supercell_positions=positions,
supercell_numbers=numbers,
# For this quickstart, assume primitive cell is the same as supercell
primitive_lattice=lattice,
primitive_positions=positions,
primitive_numbers=numbers,
dataset_weights=dataset_weights,
physical_units=True # Set to False if your units are already compatible
)
print("Symfc object instantiated successfully.")
# To compute force constants, you would typically call:
# force_constants = calculator.run()
# print("Force constants calculated (shape will vary):", force_constants.shape)
except Exception as e:
print(f"Error instantiating Symfc: {e}")
Upgrade
Version history
1.7.2latest on PyPI · released May 27, 2026
Audit
Dependencies
numpyrequiredNumerical operations and array handling.
scipyrequiredScientific computing functionalities, particularly linear algebra and optimization.
spglibrequiredCrucial for crystal symmetry operations and space group determination.