forked from duartegroup/autodE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
point_charges.py
37 lines (30 loc) · 1.06 KB
/
point_charges.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from typing import Sequence, Optional
from autode.atoms import DummyAtom
from autode.values import Coordinate
class PointCharge(DummyAtom):
def __init__(
self,
charge: float,
x: float = 0.0,
y: float = 0.0,
z: float = 0.0,
coord: Optional[Sequence] = None,
):
"""
Point charge
-----------------------------------------------------------------------
Arguments:
charge (float): Charge in units of e
Keyword Arguments:
x (float): x coordinate (Å)
y (float): y coordinate (Å)
z (float): z coordinate (Å)
coord (np.ndarray | None): Length 3 array of x, y, z coordinates
or None
"""
super().__init__(x, y, z)
self.charge = float(charge)
if coord is not None:
assert len(coord) == 3, "Coordinate much have 3 components: x,y,z"
x, y, z = coord[0], coord[1], coord[2]
self._coord = Coordinate(float(x), float(y), float(z))