Repository navigation
refactor(cell): replace raw pointer members with std::vector in Symmetry - #8113
Merged
mohanchen merged 1 commit intoOct 10, 2026
Merged
Conversation
mohanchen
approved these changes
Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
No linked issue: this is a small internal refactor with no behavior change.
Unit Tests and/or Case Tests for my changes
cmake --build build -j30(full build with BUILD_TESTING=ON, ENABLE_MPI=ON)OMP_NUM_THREADS=1 ctest --test-dir build -R MODULE_CELL_SYMMETRY(coversanaly_sys/pricell/getgroupand density symmetrization)OMP_NUM_THREADS=1 ctest --test-dir build -R "MODULE_CELL_(klist|qlist|little_group)"(regression: these tests callanaly_sysindirectly)python3 tools/03_code_analysis/agent_governance_check.py --stagedanaly_sysallocates/fills/releases these arrays every call).What's changed?
ModuleSymmetry::Symmetrywithstd::vector:int* na,int* istart->std::vector<int>;double* newpos,double* rotpos->std::vector<double>;int* index->std::vector<int>.analy_sys(symm_analysis.cpp): merged thenew[]+ModuleBase::GlobalFunc::ZEROSpairs intoassign(n, 0)calls (keeping the exact sizes, includingnat + 2forindex), which also re-zeroes correctly whenanaly_sysis called repeatedly (e.g. each ionic step of cell-relax); removed the fivedelete[]at the end of the function..data():lattice_type,pricell,getgroupinsymm_analysis.cpp;getgroupinsymm_magnetic.cpp; two pointer-arithmetic call sites ofatom_ordering_newinsymm_pricell.cpp(index.data() + istart[it],rotpos.data() + istart[it] * 3).set_atom_map(symmetry.cpp): replacedZEROS(pos, nat*3)withstd::fill(this->newpos.begin(), this->newpos.end(), 0.0)per the AGENTS.md rule on vector buffers, and the local aliases use.data().getgroup/checksym/pricell/lattice_typeare unchanged: they still take raw pointers becauseirred_sec_bvk.cppandsymm_magnetic.cpppass non-member local buffers, andlattice_type'snewposargument isnullptrin 4 of its 5 call sites.Governance Notes
docs/parameters.yamlanddocs/advanced/input_files/input-main.mddo not require updates.source_cell/module_symmetry; a tree-wide search confirms no code outside the module accesses these five members, and no test or mock defines theSymmetryconstructor/destructor.GlobalVwarning onsymm_magnetic.cpp:73is migration-neutral (net_delta=0): the editedgetgroupcall line merely re-wraps the existingGlobalV::ofs_runningreference.symmetry.h(#include <vector>) is acceptable: the class holdsstd::vectorvalue members, which require the complete type.