Dft Data Processing Core
Project description
DDPC - DFT Data Processing Core
DDPC is a Python library for processing and analyzing density functional theory (DFT) calculation data. It provides a unified interface for reading, writing, and manipulating crystal structures, electronic band structures, and density of states data from various DFT codes including VASP, DS-PAW, and RESCU.
Status: Early stage development. API may change.
Features
- Universal structure I/O for multiple formats (VASP, DS-PAW, RESCU, CIF, XYZ)
- Electronic structure data processing (band structure, density of states)
- Structure manipulation utilities (primitive cell, orthogonal supercell)
- Full type annotations
- Command-line interface
MCP Adapter Layer
Provides in-process MCP tool registration and invocation entry points, with support for three tool groups: structure, volumetric, and band-dos. See examples/mcp_structure_server.py and src/ddpc/mcp/ for details.
Quick Start
Installation
pip install "ddpc[full]"
Basic Usage
Structure I/O
from ddpc import read_structure, write_structure
# Read crystal structure from various formats
atoms = read_structure("input.vasp") # VASP POSCAR
atoms = read_structure("structure.as") # DS-PAW format
atoms = read_structure("crystal.cif") # CIF format
# Write to different formats
write_structure("output.vasp", atoms)
write_structure("structure.xyz", atoms)
Electronic Structure Analysis
Currently only support DS-PAW output hdf5/json format, will support others in the future.
from ddpc import read_band, read_dos
# Read band structure data
df_band, fermi_energy, has_projections = read_band("band.h5", mode=5)
print(f"Fermi energy: {fermi_energy:.3f} eV")
# Read density of states
df_dos, fermi_energy, has_projections = read_dos("dos.json", mode=1)
Structure Utilities
from ddpc import find_primitive, find_orthogonal, scale_positions
from ddpc import read_structure, write_structure
# Find primitive cell
atoms = read_structure("input.vasp")
prim = find_primitive(atoms, symprec=1e-5, angle_tolerance=-1.0)
write_structure("primitive.vasp", prim, format="vasp")
# Create orthogonal supercell
orth = find_orthogonal(atoms, min_length=15.0, max_length=20.0)
write_structure("ortho.vasp", orth, format="vasp")
# Convert to fractional coordinates
scaled = scale_positions(atoms)
write_structure("scaled.vasp", scaled, format="vasp", direct=True)
Command-Line Interface
Structure Commands
# Convert structure formats
ddpc structure convert input.vasp output.cif
# Show structure information
ddpc structure info input.vasp
# Find primitive cell
ddpc structure primitive input.vasp -o primitive.vasp
# Find orthogonal supercell
ddpc structure orthogonal input.vasp -o ortho.vasp
# Convert to fractional coordinates
ddpc structure scale input.vasp -o scaled.vasp
Data Commands
# Read band structure data
ddpc data band read band.h5 -o band_data.csv
# Show band structure info
ddpc data band info band.h5
# Read DOS data
ddpc data dos read dos.json -o dos_data.csv
# Show DOS info
ddpc data dos info dos.json
Supported Formats
Crystal Structures
- VASP: POSCAR/CONTCAR files
- DS-PAW: Custom .as format with constraints and magnetism
- RESCU: Extended .xyz format with magnetic moments
- Standard formats: CIF, XYZ, and other ASE-supported formats
Electronic Structure Data
- HDF5 files: Band structure and DOS data from DFT calculations
- JSON files: Alternative format for smaller datasets
- Projected data: Orbital-resolved band structures and DOS
Advanced Features
Constraint Handling
DDPC preserves and processes atomic and lattice constraints from specialized DFT codes:
# DS-PAW format with constraints
atoms = read_structure("constrained.as")
print(atoms.info) # Shows constraint information
Magnetic Systems
Support for both collinear and non-collinear magnetic systems:
# Read magnetic structure
atoms = read_structure("magnetic.xyz")
print(atoms.get_initial_magnetic_moments())
Data Processing Modes
Multiple projection modes for electronic structure analysis:
# Different projection modes for band structure
df, ef, proj = read_band("band.h5", mode=1) # Element-resolved
df, ef, proj = read_band("band.h5", mode=2) # Orbital-resolved (s,p,d,f)
df, ef, proj = read_band("band.h5", mode=5) # Detailed orbital projections
License
MIT License - see LICENSE file for details.
Changelog
v2025.12.09
Recreate this package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ddpc-2026.2.10.tar.gz.
File metadata
- Download URL: ddpc-2026.2.10.tar.gz
- Upload date:
- Size: 32.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f244121bdcf3e0fce113974582abdd52072345e1274c3b5365ce7a9a16695e08
|
|
| MD5 |
f32a4d39a12f290cb8f079f7b8680405
|
|
| BLAKE2b-256 |
93a7c44caba582c5878d524ac56f8f5497bde919ef96452eafa160106048bdb0
|
Provenance
The following attestation bundles were made for ddpc-2026.2.10.tar.gz:
Publisher:
ci.yml on xbugs221/ddpc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ddpc-2026.2.10.tar.gz -
Subject digest:
f244121bdcf3e0fce113974582abdd52072345e1274c3b5365ce7a9a16695e08 - Sigstore transparency entry: 936732256
- Sigstore integration time:
-
Permalink:
xbugs221/ddpc@7c5b70c01c5281d46b074d97d1237a25d1cfb6ce -
Branch / Tag:
refs/heads/main - Owner: https://github.com/xbugs221
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7c5b70c01c5281d46b074d97d1237a25d1cfb6ce -
Trigger Event:
push
-
Statement type:
File details
Details for the file ddpc-2026.2.10-py3-none-any.whl.
File metadata
- Download URL: ddpc-2026.2.10-py3-none-any.whl
- Upload date:
- Size: 47.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3bd614f326beddb53e253be5528368bba50ebb10a46673398b918a81ccfb2de
|
|
| MD5 |
7eff966542a2b52f9f977b5e5a388627
|
|
| BLAKE2b-256 |
89a452f761673bf40d61c8dcce97dedf091f35da69f384111a0149549f9dbc5c
|
Provenance
The following attestation bundles were made for ddpc-2026.2.10-py3-none-any.whl:
Publisher:
ci.yml on xbugs221/ddpc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ddpc-2026.2.10-py3-none-any.whl -
Subject digest:
e3bd614f326beddb53e253be5528368bba50ebb10a46673398b918a81ccfb2de - Sigstore transparency entry: 936732262
- Sigstore integration time:
-
Permalink:
xbugs221/ddpc@7c5b70c01c5281d46b074d97d1237a25d1cfb6ce -
Branch / Tag:
refs/heads/main - Owner: https://github.com/xbugs221
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7c5b70c01c5281d46b074d97d1237a25d1cfb6ce -
Trigger Event:
push
-
Statement type: