If one has a collection \(Q=\int\rho d^3x>0\) of positive charge \(\rho>0\) in some region of space, then the electric dipole moment \(\textbf p\) of \(Q\) may be viewed as \(\textbf p=Q\textbf X\), where \(\textbf X=\frac{1}{Q}\int\textbf x\rho d^3x\) is the center of charge in \(Q\) in direct analogy with the center of mass. On the other hand, for regions of negative charge \(\rho<0\), one can reflect the location of the charge across the origin and turn it into positive charge \(\rho(\textbf x)\mapsto-\rho(-\textbf x)\). Then one again recovers the center of charge interpretation of the electric dipole moment. Clearly, this operation (notably the reflection) in general depends on where one selects the origin to be. However, if the system of charges is neutral overall \(Q=0\), then the electric dipole moment \(\textbf p\) turns out to be origin independent. This \(Q=0\) neutral case is exemplified with the classic point electric dipole consisting of \(+q\) and \(-q\) charges separated by a displacement vector \(\Delta\textbf x\) pointing from \(-q\) to \(+q\). In this case, it is possible to convince oneself that it doesn’t matter where one places the origin, one always ends up with the result \(\textbf p=q\Delta\textbf x\). In this case, taking the dipole limit \(\lim_{q\to\infty,\Delta\textbf x\to\textbf 0,\textbf p=\text{constant}}\), one has the following equations governing how the dipole interacts with an external electric field \(\textbf E_{\text{ext}}\) (assuming \(\textbf B=\textbf 0\)). The external force is:
\[\textbf F_{\text{ext}}=\left(\textbf p\cdot\frac{\partial}{\partial\textbf x}\right)\textbf E_{\text{ext}}=\frac{\partial\textbf E_{\text{ext}}}{\partial\textbf x}\textbf p\]
The external couple is:
\[\boldsymbol{\tau}_{\text{ext}}=\textbf p\times\textbf E_{\text{ext}}\]
And the external electric potential energy relative to the configuration where the electric dipole is orthogonal to the external electric field \(\textbf p\cdot\textbf E_{\text{ext}}=0\) is then just (note the physical significance of the negative sign):
\[V_{\text{ext}}=-\textbf p\cdot\textbf E_{\text{ext}}\]
which satisfies \(\textbf F_{\text{ext}}=-\frac{\partial V_{\text{ext}}}{\partial\textbf x}\) thanks to standard vector calculus identities. Note also that \(\textbf E_{\text{ext}}\) in all these expressions is to be evaluated at the location \(\textbf x\) of the point electric dipole. Finally, note that in chemistry the electric dipole moment is defined in the opposite direction \(\textbf p_{\text{chemistry}}=-\textbf p\). For instance in a formula unit of \(\text{NaCl}\), the electric dipole moment \(\textbf p_{\text{chemistry}}\) would be considered to point from the \(\text{Na}^+\) cation to the \(\text{Cl}^-\) anion. This is because \(\textbf p_{\text{chemistry}}\) indicates the direction of greatest \(e^-\) density \(\rho_{e^-}<0\) which makes intuitive sense as electrons are the mobile charge carriers are in the case of \(\text{NaCl}\) they would be polarized towards the more electronegative \(\text{Cl}^-\). So ultimately this all goes back to Benjamin Franklin’s unwise choice of conventional current being the opposite of the actual direction of \(e^-\) flow.
Finally, a note that identical formulas hold for magnetic dipoles with \(\textbf p\mapsto\boldsymbol{\mu}\) and \(\textbf E_{\text{ext}}\mapsto\textbf B_{\text{ext}}\). Somewhat similarly to the electric dipole moment, the magnetic dipole moment is defined via \[\boldsymbol{\mu}:=\frac{1}{2}\iiint_{\textbf x\in\textbf R^3}\textbf x\times\textbf J(\textbf x)d^3x\].