Repository navigation
Conversation
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review of 0c2c11d. No builds or ABACUS runtime tests were run; CI diagnostics were unavailable.
Non-blocking: Please add the exact build/test/comparison commands, executable identity/configuration, MPI ranks and observed outcomes behind the validation table, noting which force/convergence checks remain deferred. Also state the generated INPUT-documentation workflow and whether documentation-generation/CLI checks were run.
Address ABACUS-PR-BOT review of SCCS step 2: no declaration in the header uses std::vector yet.
| const double net_charge = ionic_charge - electron_count; | ||
| if (config.cavity.epsilon_bulk <= 1.0 || std::abs(net_charge) <= 1e-6) { return std::string(); } | ||
| const bool periodic = config.boundary == ModuleSccs::Boundary::Periodic; | ||
| if (!periodic || config.cavity.epsilon_bulk <= 1.0 || std::abs(net_charge) <= 1e-6) { return std::string(); } |
There was a problem hiding this comment.
the 1e-6 seems to be a magic number
| } | ||
| if (std::abs(electron_error) > 1e-6) | ||
| // With PCC the PCC component reports the same mismatch. | ||
| if (config_.boundary == ModuleSccs::Boundary::Periodic && std::abs(electron_error) > 1e-6) |
There was a problem hiding this comment.
same here, the 1e-6 seems to be a magic number
| { | ||
| const bool orthogonal = unitcell::make_orthogonal_cell(cell.latvec, cell.lat0, 1e-10, geometry); | ||
| const bool cubic = orthogonal && make_pcc_0d_parameters(geometry, 1e-10, parameters); | ||
| if (!cubic) { ModuleBase::WARNING_QUIT("pcc_0d_geometry", "PCC 0D requires an equal-edge cubic cell"); } |
There was a problem hiding this comment.
Please do not write one-liner code here. To keep the structure as clear as possible, put each brace on its own line.
| ModuleSccs::gauss_ion_rho(atoms, basis, tpiba, | ||
| ModuleSccs::gaussian_ion_spread, ions); | ||
| std::vector<double> solute_charge(basis.nrxx); | ||
| for (int ir = 0; ir < basis.nrxx; ++ir) { solute_charge[ir] = ions[ir] - density[ir]; } |
There was a problem hiding this comment.
Please do not write one-liner code here. To keep the structure as clear as possible, put each brace on its own line.
| normal = cell.normal; | ||
| parameters = elecstate::make_pcc_2d_parameters(cell); | ||
| ModulePW::grid_positions(basis, lattice, length, positions); | ||
| for (auto& position : positions) |
There was a problem hiding this comment.
try to avoid using auto if possible
| double integrate_product(const std::vector<double>& left, const std::vector<double>& right) const | ||
| { | ||
| double value = 0.0; | ||
| for (int ir = 0; ir < basis.nrxx; ++ir) { value += left[ir] * right[ir]; } |
There was a problem hiding this comment.
Please do not write one-liner code here. To keep the structure as clear as possible, put each brace on its own line.
| TEST_F(SccsPcc2dCoulombTest, ChargedPlanarModeMatchesAnalyticGauge) | ||
| { | ||
| const double density_mean = 1e-3; | ||
| const double amplitude = 2e-4; |
There was a problem hiding this comment.
magic number, maybe adding some notes for this value?
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
Third part of #8052. It follows #8075 (PCC) and #8162 (SCCS Step 1: periodic SCCS).
Remaining follow-up PRs, each stacked on the previous one: lowpass and full cavity → SCF integration → solvent-aware cavity.
What's changed?
imp_sol 2can now be combined withassume_isolated pcc_0dandpcc_2d(O. Andreussi and N. Marzari, Phys. Rev. B 90, 245101 (2014)). This removes the cell-size dependence of charged solvated systems: molecules (pcc_0d) and slabs (pcc_2d, open alongpcc_2d_axis). Neutral periodic SCCS from Step 1 is unchanged.Deliberate difference from Environ (inherited from #8075): for a charged slab,
pcc_2duses the monopole constant −πQL/(3A), whereas Environ uses −πQ/(3L).Cavity derivatives: two paths.
sccs_cav_derivbuilds grad s and lapl s for the dielectric coefficient.deriv_method chain: grad s = s′ grad n and lapl s = s′ lapl n + s″ |grad n|², from FFT derivatives of the density n.deriv_method fft, because the chain coefficient is not converged at the cavity edge.The PCC cases are therefore compared with QE in
fftmode below. Periodic results are unchanged from Step 1.CavityPointgainsd2solute_drho2for the chain path, which is checked against finite differences.Validation against QE 7.6 + Environ 3.1.1
How the comparison was run. (reply to ABACUS-PR-BOT)
Each case directory has an ABACUS INPUT/STRU/KPT and a QE
pw.in+environ.in.One script runs them with
OMP_NUM_THREADS=1:mpirun -np 8 abacus_std_para > run.logmpirun -np 8 pw.x -environ -in pw.in > run.loganalyze.pytakes ΔG from!FINAL_ETOT_IS(ABACUS) and! total energy(QE). It reads the surface and volume from theSCCS_CAVITYline and fromenviron.debug, and the forces fromTOTAL-FORCEand "Forces acting on atoms".Executables:
The ABACUS energies were reproduced bit-for-bit. Since then the code has only been renamed and switched to the ModuleBase SI constants, which moves the solvation energies by about 2×10⁻⁸ eV.
Deferred checks: there are no charged integration cases (CI time; charged energies are validated in the table above). Force accuracy with PCC is addressed by the lowpass filter in the next PR.