Skip to content

Dfpt csj - #2

Closed
Zanthoxylum wants to merge 7 commits into
mohanchen:developfrom
Zanthoxylum:dfpt-csj
Closed

Dfpt csj#2
Zanthoxylum wants to merge 7 commits into
mohanchen:developfrom
Zanthoxylum:dfpt-csj

Conversation

@Zanthoxylum

Copy link
Copy Markdown

based on PR deepmodeling#7356
added class Q_Vectors and Function Overloading for this class in k_vector_utils
NOT FINISHED, Symmetry reduced qstars need to be treated

abacus_fixer and others added 7 commits May 18, 2026 09:45
This commit adds the complete framework for a Density Functional Perturbation Theory (DFPT) solver for plane-wave basis set in ABACUS.

New files added:
- source/source_pw/module_dfpt/dfpt_pw.h/cpp - Main DFPT-PW interface (Pimpl pattern)
- source/source_pw/module_dfpt/dfpt_pw_data.h/cpp - PW-specific data container
- source/source_pw/module_dfpt/dfpt_pert.h/cpp - Perturbation construction
- source/source_pw/module_dfpt/dfpt_stern.h/cpp - Sternheimer equation solver
- source/source_pw/module_dfpt/dfpt_rho.h/cpp - First-order density handling
- source/source_pw/module_dfpt/dfpt_phon.h/cpp - Phonon/dynamical matrix
- source/source_pw/module_dfpt/dfpt_q0.h/cpp - q=0 special handling (dielectric, Born)
- source/source_pw/module_dfpt/dfpt_metal.h/cpp - Metal system handling
- source/source_pw/module_dfpt/CMakeLists.txt - Module build configuration
- source/source_pw/module_dfpt/README.md - Module documentation
- source/source_cell/qlist.h/cpp - q-point management
- source/source_esolver/esolver_dfpt_pw.h/cpp - DFPT energy solver

Modified files:
- CMakeLists.txt - Added module_dfpt to target_link_libraries
- source/source_pw/CMakeLists.txt - Added module_dfpt subdirectory
- source/source_cell/CMakeLists.txt - Added qlist.cpp and qlist.h
- source/source_esolver/CMakeLists.txt - Added esolver_dfpt_pw.cpp

Note: This code is in design phase and has not been put into production yet.
All implementation classes contain stub implementations that need to be filled in.
在pr-7356的基础上填充dfpt的代码内容
@mohanchen mohanchen closed this Jun 16, 2026
mohanchen added a commit that referenced this pull request Jun 17, 2026
* Refactor: Restructure tools/ directory for clarity and fix include analysis script

This commit consolidates three previous commits (#1, #2, deepmodeling#3) into a single
comprehensive refactor of the tools/ directory, addressing both
organizational structure and a path-related bug in the code analysis script.

1. tools/ directory reorganization
   - Group all numerical atomic orbital (NAO) generation tools under
     01_NAO_generation/, including:
       * SIAB/ (Simulated Annealing method in C++)
       * pytorch/ and pytorch_dpsi/ (PyTorch gradient methods)
       * pytorch_gradient_source/ (original PyTorch implementation)
       * lcao_bash/ and abfs_bash/ (bash-based orbital generators)
       * qo/ (quasiatomic orbital generation)
       * Generate_Orbital_AllInOne.sh (main entry script)
       * examples/ (example input files)
   - Move all post-processing and visualization tools under
     02_postprocessing/:
       * rt-tddft-tools/, stm/, average_pot/, selective_dynamics/, plot-tools/
   - Place source code analysis tools under 03_code_analysis/
   - Rename windows/ to 04_windows_installation/ for consistency
   - Use numerical prefixes (01_, 02_, 03_, 04_) to define a clear order
   - Use git mv to preserve file history throughout the refactor

2. New tools/README.md
   - Add a comprehensive README with directory tree, quick start guide
     and tool descriptions

3. Fix generate_include_analysis.py path bug
   - The script computed repo_root using os.path.dirname(script_dir),
     assuming the script lived in tools/. After moving to
     tools/03_code_analysis/, this resolved to tools/ instead of the
     repository root, causing os.walk to find no source files.
   - Update to os.path.dirname(os.path.dirname(script_dir)) to correctly
     resolve the repository root from the new script location.

Combined previous commits:
  6e3b7954c add code analysis python file
  546d7cd76 update tools
  92094b81d update

* Fix: Update path references in docs and source code after tools/ directory restructuring

After the tools/ directory reorganization, several path references in documentation
and source code were still pointing to the old directory structure. This commit
updates all hardcoded paths to match the new organization:

1. docs/advanced/windows_installer.md
   - tools/windows/ → tools/04_windows_installation/ (3 occurrences)

2. docs/advanced/input_files/input-main.md
   - tools/average_pot/aveElecStatPot.py → tools/02_postprocessing/average_pot/aveElecStatPot.py

3. docs/parameters.yaml
   - tools/average_pot/aveElecStatPot.py → tools/02_postprocessing/average_pot/aveElecStatPot.py

4. source/source_io/module_qo/to_qo_kernel.cpp
   - /tools/qo/postprocess.py → /tools/01_NAO_generation/qo/postprocess.py

5. source/source_basis/module_nao/atomic_radials.cpp
   - Update SIAB/PyTorchGradient paths to 01_NAO_generation/pytorch and 01_NAO_generation/SIAB

6. source/source_io/module_parameter/read_input_item_output.cpp
   - tools/average_pot/aveElecStatPot.py → tools/02_postprocessing/average_pot/aveElecStatPot.py

* add a threshold in 17_DS_DFTU/01_LCAO_SPIN_S2_Z

---------

Co-authored-by: abacus_fixer <mohanchen@pku.eud.cn>
Co-authored-by: Xiaoyang Zhang <tsfxwbbzxy@163.com>
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.

2 participants