-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d8e70d
commit 0c961c4
Showing
4 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ | |
from .pdb_file import PDBFile | ||
|
||
from .si_file import SIFile | ||
|
||
from .point_charge import PointCharge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import numpy as np | ||
|
||
class PointCharge(): | ||
""" | ||
Represents a point charge. | ||
Attributes: | ||
coordinates (np.ndarray): 3-element ndarray | ||
charge (float): charge | ||
""" | ||
|
||
def __init__(self, coordinates, charge): | ||
assert isinstance(coordinates, (np.ndarray, list)), "coordinates must be list or ndarray!" | ||
assert len(coordinates) == 3, "coordinates must have len 3!" | ||
self.coordinates = np.array(coordinates) | ||
|
||
assert isinstance(charge, (float, int)), "charge must be numeric" | ||
self.charge = float(charge) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters