validate_external_potential¶
- psi4.driver.p4util.validate_external_potential(external_potential)[source]¶
Validate and normalize the format of external_potential in preparation for class construction.
- Parameters:
external_potential – Specification for
psi4.core.ExternalPotential
. Can be composed of point charges (Q x y z), diffuse charges (Gaussian s-orbitals at a center; Q x y z width), or (Nao, Nao) potential matrix. If only one of the three specified, it is assumed to be point charges for backwards compatibility. Include diffuse charges as a dictionary with key “diffuse” or as the second item in a list (if no point charges, use placeholder None as first item). Include a matrix as a dictionary with key “matrix” or as the third item in a list. External potential will apply to the whole molecule unless behind another dictionary key (“A”, “B”, or “C”) to apply to portions of the molecule (monomer, monomer, linker) for FI-SAPT. Most sensible formats are accepted: list-of-lists, NumPy array, andpsi4.core.Matrix
. The points or diffuse array should be a list-like structure where each row corresponds to a charge. Lines can be composed ofq, [x, y, z]
orq, x, y, z
(for points) orq, [x, w, z] w
ofq, x, y, z, w
(for diffuse). Locations are in [a0]. See test_extern.py for many examples.- Returns:
After some bounds, dimension, and shape checks, a normalized nested dict is returned with outer keys of fragment labels, inner keys among {“points”, “diffuse”, “matrix”}, and inner keys Python lists.
- Return type:
Examples
>>> # [1] point charges on whole molecule (all equivalent) >>> validate_external_potential([[0.5,0,0,1], [-0.5,0,0,-1]]) >>> validate_external_potential({"points": np.array([[0.5,0,0,1], [-0.5,0,0,-1]])}) >>> validate_external_potential({"C": {"points": psi4.core.Matrix.from_array(np.array([[0.5,0,0,1], [-0.5,0,0,-1]]))}})
>>> # [2] point charges on monoB and linker for FI-SAPT >>> validate_external_potential({"b": [0.01,2,2,2], "c": [[0.5,0,0,1], [-0.5,0,0,-1]]}) >>> validate_external_potential({"B": {"points": np.array([0.01,2,2,2])}, "C": {"points": np.array([[0.5,0,0,1], [-0.5,0,0,-1]])}})