Skip to content

Refactor: normalize and shorten source filenames for consistency - #7797

Merged
mohanchen merged 28 commits into
deepmodeling:developfrom
mohanchen:2026-08-10-b
Aug 13, 2026
Merged

Refactor: normalize and shorten source filenames for consistency#7797
mohanchen merged 28 commits into
deepmodeling:developfrom
mohanchen:2026-08-10-b

Conversation

@mohanchen

Copy link
Copy Markdown
Collaborator

Summary

This PR systematically renames source files under source/ to follow
consistent naming conventions:

  1. Shorten overly long filenames (≥25 chars) using standard abbreviations
  2. Remove uppercase letters from filenames (e.g., LCAO_lcao_,
    ORB_orb_, FORCE_force_, H_h_)
  3. Replace dashes with underscores (e.g., exx_abfs-io.cpp
    exx_abfs_io.cpp, matrix-inl.hmatrix_inl.h)

Motivation

The codebase had inconsistent filename conventions: mixed case
(LCAO_set.cpp vs lcao_set_fs.cpp), dashes (exx_abfs-io.cpp),
and excessively long names (charge_mixing_preconditioner.cpp).
This made file discovery harder and broke the KISS principle.

Changes

Phase 1–5: Shorten long filenames (61 files)

  • charge_mixing_preconditioner.cppmix_precond.cpp
  • spherical_bessel_transformer.{cpp,h}sph_bessel_tf.{cpp,h}
  • gint_vl_metagga_nspin4_gpu.{cpp,h}gint_vl_mgga_n4_gpu.{cpp,h}
  • read_input_item_*read_inp_* (8 files)
  • ... and 46 more

Phase A: LCAO_ → lcao_ (16 files)

  • LCAO_deepks.{cpp,h}lcao_deepks.{cpp,h}
  • LCAO_set.{cpp,h}lcao_set.{cpp,h}
  • LCAO_domain.hlcao_domain.h
  • ... and 13 more

Phase B: ORB_ → orb_ (18 files)

  • ORB_atomic.{cpp,h}orb_atomic.{cpp,h}
  • ORB_read.{cpp,h}orb_read.{cpp,h}
  • ORB_unittest.{cpp,h}orb_unittest.{cpp,h}
  • ... and 15 more

Phase C–G: Remaining normalization (planned)

  • H_Ewald_pw.{cpp,h}h_ewald_pw.{cpp,h}
  • FORCE_STRESS.{cpp,h}force_stress.{cpp,h}
  • Matrix_Orbs11.{cpp,h}matrix_orbs11.{cpp,h}
  • ABFs_Construct-PCA.{cpp,h}abfs_construct_pca.{cpp,h}
  • Inverse_Matrix.{h,hpp}invmat_ri.{h,hpp} (avoid name clash)
  • ... and ~115 more

What is preserved

  • Function names, class names, namespace names (e.g., LCAO_domain::,
    ORB_gaunt_table)
  • Header guard macro names
  • CMake target identifiers
  • esolver_ks_lcao_tddft, two_center_integrator, blas_connector_*
    intentionally kept unchanged

Verification

  • All #include paths updated
  • All CMakeLists.txt and Makefile.Objects entries updated
  • Python pyabacus references updated where applicable
  • Each phase compiled and tested before proceeding to the next

abacus_fixer added 9 commits August 10, 2026 16:36
Rename 7 files (32-29 chars → 12-22 chars):
- charge_mixing_preconditioner.cpp → mix_precond.cpp
- spherical_bessel_transformer.{cpp,h} → sph_bessel_tf.{cpp,h}
- read_input_item_postprocess.cpp → read_inp_postproc.cpp
- gint_vl_metagga_nspin4_gpu.{cpp,h} → gint_vl_mgga_n4_gpu.{cpp,h}
- snap_projector_half_tddft.{cpp,h} → snap_proj_half_tddft.{cpp,h}

Update all #include references, CMakeLists.txt, Makefile.Objects,
header guards, and code comments. Function names (e.g.
snap_projector_half_tddft) are preserved unchanged.
Rename 15 files (29-25 chars → 12-21 chars):
- read_input_item_elec_stru.cpp → read_inp_estruc.cpp
- gint_precision_controller.{cpp,h} → gint_prec_ctrl.{cpp,h}
- global_function-func_each_2.h → glob_fn_each2.h
- snap_phialpha_half_tddft.{cpp,h} → snap_pha_half_tddft.{cpp,h}
- snap_psibeta_half_tddft.{cpp,h} → snap_psb_half_tddft.{cpp,h}
- symmetry_rotation_output.cpp → symm_rot_out.cpp
- read_input_item_exx_dftu.cpp → read_inp_exx_dftu.cpp
- write_mlkedf_descriptors.{cpp,h} → write_mlkedf_desc.{cpp,h}
- global_function_ddotreal.cpp → glob_fn_ddotreal.cpp
- exx_abfs-construct_orbs.{cpp,h} → exx_abfs_ctor_orbs.{cpp,h}

Update all #include references, CMakeLists.txt, Makefile.Objects,
and header guards. Function and variable names preserved unchanged.
Rename 8 files (27-25 chars → 12-21 chars):
- to_wannier90_lcao_in_pw.{cpp,h} → to_w90_lcao_pw.{cpp,h}
- dist_matrix_transformer.{cpp,h} → dist_mat_tf.{cpp,h}
- element_basis_index-ORB.{cpp,h} → elem_basis_idx_orb.{cpp,h}
- sph_bessel_recursive-d1.cpp → sph_bessel_rec_d1.cpp
- sph_bessel_recursive-d2.cpp → sph_bessel_rec_d2.cpp

Update all #include references, CMakeLists.txt, Makefile.Objects,
and header guards. Function and class names preserved unchanged.
Rename 20 files (26 chars → 12-20 chars), including 6 .cpp/.h pairs:
- lattice_change_methods.{cpp,h} → lat_change_method.{cpp,h}
- vec_mul_vec_complex_op.{cpp,h} → vec_mul_cx_op.{cpp,h}
- psi_init_atomic_random.{cpp,h} → psi_init_atom_rand.{cpp,h}
- cal_mlkedf_descriptors.{cpp,h} → cal_mlkedf_desc.{cpp,h}
- gint_vl_metagga_nspin4.{cpp,h} → gint_vl_mgga_n4.{cpp,h}
- symmetry_rotation_spin.{cpp,h} → symm_rot_spin.{cpp,h}
- irreducible_sector_bvk.cpp → irred_sec_bvk.cpp
- read_input_item_{system,output,deepks}.cpp → read_inp_{sys,out,deepks}.cpp
- charge_mixing_residual.cpp → mix_resid.cpp
- elecstate_energy_terms.cpp → estate_e_terms.cpp
- pw_distributeg_method{1,2}.cpp → pw_distg_method{1,2}.cpp

Update all #include references, CMakeLists.txt, Makefile.Objects,
Makefile, header guards, and WARNING string literals. Function,
class, and struct names preserved unchanged.
Rename 20 files (26 chars → 12-20 chars), including 6 .cpp/.h pairs:
- lattice_change_methods.{cpp,h} → lat_change_method.{cpp,h}
- vec_mul_vec_complex_op.{cpp,h} → vec_mul_cx_op.{cpp,h}
- psi_init_atomic_random.{cpp,h} → psi_init_atom_rand.{cpp,h}
- cal_mlkedf_descriptors.{cpp,h} → cal_mlkedf_desc.{cpp,h}
- gint_vl_metagga_nspin4.{cpp,h} → gint_vl_mgga_n4.{cpp,h}
- symmetry_rotation_spin.{cpp,h} → symm_rot_spin.{cpp,h}
- irreducible_sector_bvk.cpp → irred_sec_bvk.cpp
- read_input_item_{system,output,deepks}.cpp → read_inp_{sys,out,deepks}.cpp
- charge_mixing_residual.cpp → mix_resid.cpp
- elecstate_energy_terms.cpp → estate_e_terms.cpp
- pw_distributeg_method{1,2}.cpp → pw_distg_method{1,2}.cpp

Update all #include references, CMakeLists.txt, Makefile.Objects,
Makefile, header guards, and WARNING string literals. Function,
class, and struct names preserved unchanged.
Rename 11 files (25 chars → 14-20 chars), including 3 .cpp/.h pairs:
- LCAO_deepks_interface.{cpp,h} → lcao_deepks_iface.{cpp,h}
- para_linear_transform.{cpp,h} → para_lin_tf.{cpp,h}
- read_input_item_{tddft,relax,other,ofdft,model}.cpp → read_inp_{...}.cpp
- vdwd3_autoset_xcparam.cpp → vdwd3_auto_xcpar.cpp
- element_covalent_radius.h → elem_cov_rad.h

Update all #include references, CMakeLists.txt, Makefile.Objects,
header guards, and python pyabacus references. Function, class, and
variable names preserved unchanged.

Note: esolver_ks_lcao_tddft, two_center_integrator, and blas_connector
files are intentionally kept unchanged per user request.
Rename 16 files from LCAO_* to lcao_* (remove uppercase letters):
- LCAO_allocate.cpp → lcao_allocate.cpp
- LCAO_domain.h → lcao_domain.h
- LCAO_HS_arrays.hpp → lcao_hs_arrays.hpp
- LCAO_init_basis.cpp → lcao_init_basis.cpp
- LCAO_nl_mu.cpp → lcao_nl_mu.cpp
- LCAO_nonlocal_info.h → lcao_nonlocal_info.h
- LCAO_set.{cpp,h} → lcao_set.{cpp,h}
- LCAO_set_{fs,mat2d,st,zero}.cpp → lcao_set_{...}.cpp
- LCAO_deepks.{cpp,h} → lcao_deepks.{cpp,h}
- LCAO_deepks_io.{cpp,h} → lcao_deepks_io.{cpp,h}

Update all #include references, CMakeLists.txt, Makefile.Objects,
and code comments. Namespace names (LCAO_domain::), class names,
and header guards preserved unchanged.
Rename 18 files from ORB_* to orb_* (remove uppercase letters):
- ORB_atomic.{cpp,h} → orb_atomic.{cpp,h}
- ORB_atomic_lm.{cpp,h} → orb_atomic_lm.{cpp,h}
- ORB_gaunt_table.{cpp,h} → orb_gaunt_table.{cpp,h}
- ORB_nonlocal.{cpp,h} → orb_nonlocal.{cpp,h}
- ORB_nonlocal_lm.{cpp,h} → orb_nonlocal_lm.{cpp,h}
- ORB_read.{cpp,h} → orb_read.{cpp,h}
- ORB_{atomic_lm,nonlocal_lm,nonlocal,read}_test.cpp → orb_{...}_test.cpp
- ORB_unittest.{cpp,h} → orb_unittest.{cpp,h}

Update all #include references, CMakeLists.txt, Makefile.Objects,
and README. Class names, header guards, and CMake target identifiers
preserved unchanged.
Rename 18 files from ORB_* to orb_* (remove uppercase letters):
- ORB_atomic.{cpp,h} → orb_atomic.{cpp,h}
- ORB_atomic_lm.{cpp,h} → orb_atomic_lm.{cpp,h}
- ORB_gaunt_table.{cpp,h} → orb_gaunt_table.{cpp,h}
- ORB_nonlocal.{cpp,h} → orb_nonlocal.{cpp,h}
- ORB_nonlocal_lm.{cpp,h} → orb_nonlocal_lm.{cpp,h}
- ORB_read.{cpp,h} → orb_read.{cpp,h}
- ORB_{atomic_lm,nonlocal_lm,nonlocal,read}_test.cpp → orb_{...}_test.cpp
- ORB_unittest.{cpp,h} → orb_unittest.{cpp,h}

Update all #include references, CMakeLists.txt, Makefile.Objects,
and README. Class names, header guards, and CMake target identifiers
preserved unchanged.
@mohanchen
mohanchen requested a review from AsTonyshment August 10, 2026 11:14
@mohanchen mohanchen added Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0 labels Aug 10, 2026
abacus_fixer added 9 commits August 10, 2026 19:37
Rename 21 files, add module suffixes for force files, and
update header guards:

Correction abbreviation:
- H_correction_pw.cpp → h_corr_pw.cpp

Hamiltonian uppercase prefixes (H_* → h_*):
- H_Ewald_pw.{cpp,h} → h_ewald_pw.{cpp,h}
- H_Hartree_pw.{cpp,h} → h_hartree_pw.{cpp,h}
- H_TDDFT_pw.{cpp,h} → h_tddft_pw.{cpp,h}

LCAO force files (FORCE_* → force_lcao_*, FORCE_STRESS → force_stress_lcao):
- FORCE.h → force_lcao.h
- FORCE_gamma.cpp → force_lcao_gamma.cpp
- FORCE_k.cpp → force_lcao_k.cpp
- FORCE_STRESS.{cpp,h} → force_stress_lcao.{cpp,h}

PW force files (forces_* → force_pw_*, distinguish from LCAO):
- forces.{cpp,h} → force_pw.{cpp,h}
- forces_nl.cpp → force_pw_nl.cpp
- forces_onsite.cpp → force_pw_onsite.cpp
- forces_scc.cpp → force_pw_scc.cpp
- forces_us.cpp → force_pw_us.cpp
- forces_cc.cpp → force_pw_cc.cpp

Test files:
- opt_CG_test.cpp → opt_cg_test.cpp
- opt_TN_test.cpp → opt_tn_test.cpp

Header guards updated: HHARTREEPW_H → H_HARTREE_PW_H,
FORCES_H → FORCE_PW_H. Update all #include references,
CMakeLists.txt, and Makefile.Objects. Class/variable names preserved.
Rename 24 files to lowercase in source_lcao/module_ri/:
- Matrix_Orbs{11,21,22}.{cpp,h,hpp} → matrix_orbs{11,21,22}.{cpp,h,hpp}
- Mix_DMk_2D.{cpp,h} → mix_dmk_2d.{cpp,h}
- RI_2D_Comm.{cpp,h,hpp} → ri_2d_comm.{cpp,h,hpp}
- RI_Util.{h,hpp} → ri_util.{h,hpp}
- RPA_LRI.{h,hpp} → rpa_lri.{h,hpp}
- LRI_CV.{h,hpp} → lri_cv.{h,hpp}
- LRI_CV_Tools.{h,hpp} → lri_cv_tools.{h,hpp}
- make_gaunt_table-unittest.h → make_gaunt_table_unittest.h

Update all #include references, CMakeLists.txt, and Makefile.Objects.
Class names, namespace names, and header guards preserved unchanged.
Rename 22 files, replacing '-' with '_' and normalizing case:
- ABFs_Construct-PCA.{cpp,h} → abfs_construct_pca.{cpp,h}
- abfs-vector3_order.{h} → abfs_vector3_order.{h}
- abfs-vector3_order_test.cpp → abfs_vector3_order_test.cpp
- center2_orb-orb{11,21,22}.{cpp,h} → center2_orb_orb{11,21,22}.{cpp,h}
- exx_abfs-io.{cpp,h} → exx_abfs_io.{cpp,h}
- exx_abfs-jle.{cpp,h} → exx_abfs_jle.{cpp,h}
- exx_opt_orb-print.cpp → exx_opt_orb_print.cpp
- exx_abfs-construct_orbs-test.h → exx_abfs_construct_orbs_test.h
- gram_schmidt_orth-inl.h → gram_schmidt_orth_inl.h
- matrix-inl.h → matrix_inl.h
- scalapack-test.cpp → scalapack_test.cpp
- element_basis_index-{test.h,unittest.cpp} → element_basis_index_{test.h,unittest.cpp}
- Inverse_Matrix-test.h → invmat_ri_test.h

Update all #include references, CMakeLists.txt, Makefile.Objects,
and code comments. Class names and header guards preserved unchanged.
Rename 44 files, converting uppercase letters to lowercase:
- Cblacs.h → cblacs.h
- cal_pLpR.{cpp,h} → cal_plpr.{cpp,h}
- cal_r_overlap_R.{cpp,h} → cal_r_overlap_r.{cpp,h}
- ewald_Vq.{h,hpp} → ewald_vq.{h,hpp}
- ExxLriDetail.{cpp,h} → exx_lri_detail.{cpp,h}
- Exx_LRI.{h,hpp} → exx_lri.{h,hpp}
- Exx_LRI_interface.{h,hpp} → exx_lri_interface.{h,hpp}
- fR_overlap.{cpp,h} → fr_overlap.{cpp,h}
- Inverse_Matrix.{h,hpp} → invmat_ri.{h,hpp}
- opt_TN.hpp → opt_tn.hpp
- single_R_io.{cpp,h} → single_r_io.{cpp,h}
- symmetry_rotation_R{,_hcontainer}.hpp → symmetry_rotation_r{,_hcontainer}.hpp
- write_dH{,_terms}.{cpp,h} → write_dh{,_terms}.{cpp,h}
- write_HS{,_R,_sparse}.{cpp,h} → write_hs{,_r,_sparse}.{cpp,h}
- write_H_terms.{cpp,h} → write_h_terms.{cpp,h}
- pw_basis_{C2C,C2R}.cpp → pw_basis_{c2c,c2r}.cpp
- pw_basis_k_C2C.cpp → pw_basis_k_c2c.cpp
- test_T_NL_cd.cpp → test_t_nl_cd.cpp
- test-{big,other}.cpp → test_{big,other}.cpp
- test_hcontainer_readCSR.cpp → test_hcontainer_read_csr.cpp
- test_{cal_dm_R,dm_R_init}.cpp → test_{cal_dm_r,dm_r_init}.cpp

Update all #include references, CMakeLists.txt, Makefile.Objects,
CMake target names, and code comments. Class names, function names,
namespace names, and header guards preserved unchanged.
Rename 6 test files to match their already-renamed source files:
- spherical_bessel_transformer_test → sph_bessel_tf_test
- gint_precision_controller_test → gint_prec_ctrl_test
- snap_psibeta_half_tddft_test → snap_psb_half_tddft_test
- lattice_change_methods_test → lat_change_method_test
- symmetry_rotation_spin_test → symm_rot_spin_test
- symmetry_rho_soc_test → symm_rho_soc_test

Update CMakeLists.txt entries and log file references accordingly.
Apply KISS abbreviation rules to 15 test files:
- construct→ctor, radial→rad, interpolation→interp
- integrator→integ, initializer→init, recursive→rec
- clebsch_gordan→cg (math standard), element→elem, index→idx
- vector3→vec3, algorithms→algo, helper→hlp
- system→sys, variable→var, chebyshev→cheby
- operator→op

Update CMakeLists.txt entries, #include paths, and header guards accordingly.
Rename 42 numbered test files in source_basis/module_pw/test/:
- test1-1-1.cpp → test1_1_1.cpp
- test1-2.cpp → test1_2.cpp
- ... (all test*-*.cpp files)

Update CMakeLists.txt references accordingly.
Follows project naming convention: filenames must use underscores, not dashes.
- source_base: lowercase opt_CG/opt_DCsrch → opt_cg/opt_dcsrch (4 files)
- symmetry modules: unify symmetry_ → symm_ prefix (16 renamed,
  61 total files updated across source_cell/symmetry, source_estate,
  source_lcao/module_ri/module_exx_symmetry, and all call sites;
  module entry points symmetry.h / symmetry.cpp unchanged, class
  names Symmetry_Basic / Symmetry_rho / Symmetry_rotation preserved)
- source_cell: unify read_pseudo → read_pp_ucell to match read_pp
  series (2 renamed, 18 total files updated across CMake targets,
  Makefile.Objects, and callers; function names untouched)
- test files: unify _unittest suffix → _test (4 files: orb_test,
  element_basis_index_test, make_gaunt_table_test; include paths
  and header guards synced)
- source_lcao: disambiguate duplicate dftu_lcao name — rename
  dftu_lcao.{cpp,h} → setup_dftu_lcao.{cpp,h} (init/finish helpers);
  module_operator_lcao/dftu_lcao (DFTU operator implementation)
  retains original name
@mohanchen
mohanchen requested a review from Critsium-xy August 10, 2026 15:16

@AsTonyshment AsTonyshment left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There are some conflicts need to be resolved.

Comment thread source/source_basis/module_pw/test/Makefile Outdated
abacus_fixer added 2 commits August 11, 2026 11:56
Sync with latest upstream develop to resolve conflicts with PR deepmodeling#7797.
All conflicts auto-resolved.
@mohanchen mohanchen changed the title refactor: normalize and shorten source filenames for consistency Refactor: normalize and shorten source filenames for consistency Aug 11, 2026
abacus_fixer added 3 commits August 11, 2026 12:33
Resolve conflicts:
- Keep HEAD file renaming (psi_init_atom_rand instead of psi_init_atomic_random)
- Use correct include paths (sph_bessel_tf.h and psi_base.h)
- Keep psi_init_unit_test.cpp as the test file name
- Resolve rename/rename conflict by keeping HEAD's psi_init_unit_test.cpp
- Update initialize() signature to match psi_init_atomic's new interface
- Use this->npol_ instead of PARAM.globalv.npol
- Remove unnecessary includes (vnl_pw.h, parameter.h)
abacus_fixer added 5 commits August 11, 2026 17:03
The init_psig() method accesses pw_wfc_->npwk_max which requires the
complete type of ModulePW::PW_Basis_K, not just the forward declaration.
Resolve conflicts caused by both branches moving files from source_io
to source_base/source_cell and renaming filenames to lowercase.

Resolution strategy:
- Keep our lowercase filename renames (write_hs.h, write_hs_r.h, etc.)
- Use upstream's correct include paths for moved files
  (source_base/module_out/, source_cell/)
- Remove duplicate entries in Makefile.Objects for files already
  moved to OBJS_BASE/OBJS_CELL
- Remove unnecessary explicit source compilation of orb_io.cpp and
  sparse_matrix.cpp in tests (now provided by base library)
@mohanchen
mohanchen merged commit 3b22343 into deepmodeling:develop Aug 13, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants