Registry / data / symfc
library1.7.2pypypi✓ verified 83d ago

symfc is a Python library designed for calculating symmetry-adapted force constants, a critical component for phonon calculations in materials science. It utilizes crystal symmetry to significantly reduce the computational expense of determining these constants. The current version is 1.6.1, with new releases occurring periodically for bug fixes, performance enhancements, and new features.

pip install symfc
INSTALL
IMPORT
SIG · SYMFC
S
symfc
datapythonv1.7.2
Install
7.6s avg
Import
Disk
233MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.920 runs
build_error
glibc
py 3.103.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}")
Debug
Known issues
breakingThe 'Phonon' class was moved from `symfc.calculator` to `symfc.phonon_calculator` in version 1.1.0.
fix
Update your import statements: `from symfc.phonon_calculator import Phonon`.
affects: >=1.1.0
gotchaInput data for crystal structures (lattice, positions, numbers) and force/displacement arrays must be correctly formatted numpy arrays with specific shapes and data types. Incorrect formatting is a common source of errors.
fix
Refer to the `symfc` documentation and examples on GitHub for precise input data requirements for `supercell_lattice`, `supercell_positions`, `supercell_numbers`, `forces`, and `displacements`.
affects: All versions
gotchaThe `spglib` library is a core dependency for symmetry operations. Ensure it is correctly installed and accessible in your environment, especially if installing `symfc` in a complex setup.
fix
Verify `spglib` installation: `pip install spglib`. If problems persist, check `spglib`'s own documentation for installation troubleshooting or environment-specific issues.
affects: All versions
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.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
symfc — pip install symfc · libregistry