Skip to content

Add monopole electrostatic potential and field with unit tests#2

Open
chinmaybhardwaj711 wants to merge 1 commit intotheochem:mainfrom
chinmaybhardwaj711:feature/electrostatic-monopole
Open

Add monopole electrostatic potential and field with unit tests#2
chinmaybhardwaj711 wants to merge 1 commit intotheochem:mainfrom
chinmaybhardwaj711:feature/electrostatic-monopole

Conversation

@chinmaybhardwaj711
Copy link
Copy Markdown

This PR introduces initial support for electrostatic monopole contributions in the electrostatics module.

Added:

  • monopole_potential(q,r_vec)
  • monopole_field(q, r_vec)

Features:

  • Uses atomic units
  • Handles r -> 0 safely
  • Fully tested

Tests:

  • Added test_electrostatics.py
  • All existing test passed (9 passed)

@chinmaybhardwaj711
Copy link
Copy Markdown
Author

@FarnazH @ccastilloo
Happy to implement dipole contributions next in a separate PR if this approach aligns with the project.

rahulbalaji13 added a commit to rahulbalaji13/ffprime that referenced this pull request Mar 8, 2026
Implements dipole_potential() and dipole_field() following the same vectorized NumPy pattern as the monopole functions. Includes proper handling of edge cases (r->0) and comprehensive docstrings with physics formulas.

Builds on PR theochem#2 to extend electrostatics module toward full multipole support.
@harshjha15335
Copy link
Copy Markdown

Thanks for the clean implementation! One thing worth discussing for future compatibility: this function handles a single charge q and single position r_vec, but as we extend toward a full multipole engine, we'll likely need to evaluate potentials from N atoms at M field points simultaneously. PR #5's dipole/quadrupole functions use a vectorized (N, 3) shape for positions. Would it be worth aligning this monopole implementation to the same convention now — e.g., r_vec of shape (M, 3) and q of shape (N,) — so all multipole terms compose consistently?

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