Skip to content

Conversation

@harrisonlabollita
Copy link
Collaborator

Summary

This PR ports the C++ code in dft_tools to pure Python. Specifically, it replaces the linear tetrahedron integration routine from the VASP converter—used to calculate the density of states—with a Python implementation. Since this routine is not performance-critical, a Python version improves maintainability without impacting efficiency.

As a result, the dft_tools repository is now a Python + Fortran (via f2py) project.

Key Changes

  • Removed legacy C/C++ code from c++/triqs_dft_tools/converters/vasp/.
  • Reimplemented the linear tetrahedron integration routines in Python at python/triqs_dft_tools/converters/vasp/plovasp/lintetra.py
  • Updated the corresponding linear tetrahedron tests.

Copy link
Member

@the-hampel the-hampel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this looks good to me. I added a numpy vectorized form of the tetrahedron. In my tests this is only a little slower than the C implementation. For 9 bands (5d orbitals NiO) and a 11x11x11 mesh of kpoints (1331) on 3001 grid points I get on my m3 macbook:

33x/log: Elapsed time: 15.8411 seconds       
rewrite_py/log: Elapsed time: 24.3028 seconds

for the integration call. Given that this is only used to verify a setup, and should also greatly improve when symmetries are used I think we can safely replace the C code to make dft_tools python only. We can also leverage trivially mpi parallelism if we wish in the calling function in the future.

@opeil any objections?

We should maybe enforce Python support then in this build @Wentzell does this make sense? Currently there is still some code like this:

if(PythonSupport)
 add_subdirectory(python)
 add_subdirectory(python/plovasp)
 add_subdirectory(python/elk)
endif()

in the cmake files.

Best,
Alex

C++ code has been completely removed from the codebase. This commit
removes all related CMake configuration:

- Remove PythonSupport option (Python is now always built)
- Remove cpp2py dependency from deps/CMakeLists.txt
- Remove cpp2py module building logic from python/triqs_dft_tools/
- Remove wrap_generators handling (no *_desc.py files exist)
- Update project description to remove cpp2py reference

The project now builds Python-only components without conditional
C++ support checks.
@the-hampel
Copy link
Member

I removed now all C++ dependencies in cmake and also rebased this branch on top of dft_tools/unstable (was previously 3.3.x) . Can you have a look @Wentzell if I removed the right things (I removed also dependency on cpp2py). Thanks!

Copy link
Member

@Wentzell Wentzell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed some additional cleanups for the project structure / CMake. This looks good to be merged.

@Wentzell Wentzell merged commit e51cca9 into unstable Nov 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants