@@ -75,18 +75,20 @@ def get(cls, a1, a2):
75
75
class Atom :
76
76
"""
77
77
Attributes:
78
- element str
79
- coords np.array(float)
80
- flag bool true if frozen, false if relaxed
81
- name str form of \d+(\.\d+)*
82
- tags set
83
- charge float
84
- connected set(Atom)
85
- constraint set(Atom) for determining constrained bonds
86
- _rank
87
- _radii float for calculating if bonded
88
- _connectivity int max connections without hypervalence
89
- _saturation int max connections without hypervalence or charges
78
+
79
+ * element str
80
+ * coords np.array(float)
81
+ * flag bool true if frozen, false if relaxed
82
+ * name str form of \d+(\.\d+)*
83
+ * tags set
84
+ * charge float
85
+ * connected set(Atom)
86
+ * constraint set(Atom) for determining constrained bonds
87
+ * _rank
88
+ * _radii float for calculating if bonded
89
+ * _connectivity int max connections without hypervalence
90
+ * _saturation int max connections without hypervalence or charges
91
+
90
92
"""
91
93
92
94
LOG = None
@@ -96,6 +98,16 @@ class Atom:
96
98
def __init__ (
97
99
self , element = "" , coords = None , flag = False , name = "" , tags = None , charge = None , mass = None
98
100
):
101
+ """
102
+ :param element str: element symbol
103
+ :param coords np.ndarray: position
104
+ :param flag: whether atom is frozen
105
+ :param name str: name of atom
106
+ :param tags list: misc. data
107
+ :param charge float: partial charge of atom
108
+ :param mass float: mass of atom
109
+ """
110
+
99
111
super ().__setattr__ ("_hashed" , False )
100
112
if coords is None :
101
113
coords = []
@@ -242,7 +254,9 @@ def _set_vdw(self):
242
254
return
243
255
244
256
def _set_connectivity (self ):
245
- """Sets theoretical maximum connectivity.
257
+ """
258
+ Sets theoretical maximum connectivity.
259
+
246
260
If # connections > self._connectivity, then atom is hyper-valent
247
261
"""
248
262
try :
@@ -255,7 +269,9 @@ def _set_connectivity(self):
255
269
return
256
270
257
271
def _set_saturation (self ):
258
- """Sets theoretical maximum connectivity without the atom having a formal charge.
272
+ """
273
+ Sets theoretical maximum connectivity without the atom having a formal charge.
274
+
259
275
If # connections > self._saturation, then atom is hyper-valent or has a non-zero formal charge
260
276
"""
261
277
try :
@@ -298,13 +314,14 @@ def add_tag(self, *args):
298
314
299
315
def get_invariant (self ):
300
316
"""
301
- gets initial invariant
302
- (1) number of non-hydrogen connections (\d{1}): nconn
303
- (2) sum of bond order of non-hydrogen bonds * 10 (\d{2}): nB
304
- (3) atomic number (\d{3}): z
305
- #(4) sign of charge (\d{1})
306
- #(5) absolute charge (\d{1})
307
- (6) number of attached hydrogens (\d{1}): nH
317
+ gets initial invariant, which is formulated using:
318
+
319
+ # number of non-hydrogen connections (\d{1}): nconn
320
+ # sum of bond order of non-hydrogen bonds * 10 (\d{2}): nB
321
+ # atomic number (\d{3}): z
322
+ # sign of charge (\d{1}) (not used)
323
+ # absolute charge (\d{1}) (not used)
324
+ # number of attached hydrogens (\d{1}): nH
308
325
"""
309
326
heavy = set ([x for x in self .connected if x .element != "H" ])
310
327
# number of non-hydrogen connections:
@@ -381,7 +398,8 @@ def is_connected(self, other, tolerance=None):
381
398
def dist_is_connected (self , other , dist_to_other , tolerance ):
382
399
"""
383
400
determines if distance between atoms is small enough to be bonded
384
- used to optimize connected checks when distances can be quickly precalculated
401
+
402
+ used to optimize connected checks when distances can be quickly precalculated,
385
403
like with scipy.spatial.distance_matrix
386
404
"""
387
405
if tolerance is None :
@@ -464,51 +482,55 @@ def bond_order(self, other):
464
482
465
483
@classmethod
466
484
def get_shape (cls , shape_name ):
467
- """returns dummy atoms in an idealized vsepr geometry
485
+ """
486
+ returns dummy atoms in an idealized vsepr geometry
487
+
468
488
shape_name can be:
469
- point
470
- linear 1
471
- linear 2
472
- bent 2 tetrahedral
473
- bent 2 planar
474
- trigonal planar
475
- bent 3 tetrahedral
476
- t shaped
477
- tetrahedral
478
- sawhorse
479
- seesaw
480
- square planar
481
- trigonal pyramidal
482
- trigonal bipyramidal
483
- square pyramidal
484
- pentagonal
485
- hexagonal
486
- trigonal prismatic
487
- pentagonal pyramidal
488
- octahedral
489
- capped octahedral
490
- hexagonal pyramidal
491
- pentagonal bipyramidal
492
- capped trigonal prismatic
493
- heptagonal
494
- hexagonal bipyramidal
495
- heptagonal pyramidal
496
- octagonal
497
- square antiprismatic
498
- trigonal dodecahedral
499
- capped cube
500
- biaugmented trigonal prismatic
501
- cubic
502
- elongated trigonal bipyramidal
503
- capped square antiprismatic
504
- enneagonal
505
- heptagonal bipyramidal
506
- hula-hoop
507
- triangular cupola
508
- tridiminished icosahedral
509
- muffin
510
- octagonal pyramidal
511
- tricapped trigonal prismatic
489
+
490
+ * point
491
+ * linear 1
492
+ * linear 2
493
+ * bent 2 tetrahedral
494
+ * bent 2 planar
495
+ * trigonal planar
496
+ * bent 3 tetrahedral
497
+ * t shaped
498
+ * tetrahedral
499
+ * sawhorse
500
+ * seesaw
501
+ * square planar
502
+ * trigonal pyramidal
503
+ * trigonal bipyramidal
504
+ * square pyramidal
505
+ * pentagonal
506
+ * hexagonal
507
+ * trigonal prismatic
508
+ * pentagonal pyramidal
509
+ * octahedral
510
+ * capped octahedral
511
+ * hexagonal pyramidal
512
+ * pentagonal bipyramidal
513
+ * capped trigonal prismatic
514
+ * heptagonal
515
+ * hexagonal bipyramidal
516
+ * heptagonal pyramidal
517
+ * octagonal
518
+ * square antiprismatic
519
+ * trigonal dodecahedral
520
+ * capped cube
521
+ * biaugmented trigonal prismatic
522
+ * cubic
523
+ * elongated trigonal bipyramidal
524
+ * capped square antiprismatic
525
+ * enneagonal
526
+ * heptagonal bipyramidal
527
+ * hula-hoop
528
+ * triangular cupola
529
+ * tridiminished icosahedral
530
+ * muffin
531
+ * octagonal pyramidal
532
+ * tricapped trigonal prismatic
533
+
512
534
"""
513
535
if shape_name == "point" :
514
536
return cls .linear_shape ()[0 :1 ]
@@ -983,12 +1005,15 @@ def tricapped_trigonal_prismatic_shape(cls):
983
1005
984
1006
@staticmethod
985
1007
def new_shape (old_shape , new_connectivity , bond_change ):
986
- """returns the name of the expected vsepr geometry when the number of bonds
1008
+ """
1009
+ returns the name of the expected vsepr geometry when the number of bonds
987
1010
changes by +/- 1
988
1011
989
- old_shape - :str: vsepr geometry name
990
- new_connectivity - :int: connectivity (see Atom._connectivity)
991
- bond_change - :int: +1 or -1, indicating that the number of bonds is changing by 1"""
1012
+ :param old_shape str: vsepr geometry name
1013
+ :param new_connectivity int: connectivity (see Atom._connectivity)
1014
+ :param bond_change int: +1 or -1, indicating that the number of bonds is changing by 1
1015
+
1016
+ """
992
1017
if old_shape == "point" :
993
1018
if bond_change == 1 :
994
1019
return "linear 1"
@@ -1072,10 +1097,15 @@ def new_shape(old_shape, new_connectivity, bond_change):
1072
1097
raise RuntimeError ("no shape method is defined for %s" % old_shape )
1073
1098
1074
1099
def get_vsepr (self ):
1075
- """determine vsepr geometry around an atom
1076
- returns shape as a string and the score assigned to that shape
1077
- returns None if self has > 6 bonds
1100
+ """
1101
+ determine vsepr geometry around an atom
1102
+
1103
+ :returns:
1104
+ * :shape, score: as a string and the score assigned to that shape
1105
+ * :None: if self has > 6 bonds
1106
+
1078
1107
scores > 0.5 are generally questionable
1108
+
1079
1109
see atom.get_shape for a list of shapes
1080
1110
"""
1081
1111
0 commit comments