@@ -75,9 +75,9 @@ def __init__(self):
75
75
# didn't have many S-H hits, so guesstimate them
76
76
self .bond_length_limits [("H" ,"S" )] = (1.2 ,1.3 ,1.4 ,1.5 )
77
77
78
- # make inverse atom order
79
- for key , value in self .bond_length_limits .items ():
80
- self .bond_length_limits [key [::- 1 ]] = value
78
+ ## make inverse atom order
79
+ # for key, value in self.bond_length_limits.items():
80
+ # self.bond_length_limits[key[::-1]] = value
81
81
82
82
# Number of bonds each atom type commonly form
83
83
# Doubles as list of atom types implemented
@@ -89,17 +89,54 @@ def __init__(self):
89
89
"H" : np .asarray ( [1 ] , dtype = int ) ,
90
90
"I" : np .asarray ( [1 ] , dtype = int ) ,
91
91
"N" : np .asarray ( [1 ,2 ,3 ,4 ], dtype = int ) ,
92
- "O" : np .asarray ( [1 ,2 ,3 ] , dtype = int ) ,
92
+ "O" : np .asarray ( [1 ,2 ,3 ] , dtype = int ) ,
93
93
"P" : np .asarray ( [3 ] , dtype = int ) ,
94
94
"S" : np .asarray ( [1 ,2 ,3 ,4 ], dtype = int )
95
95
}
96
- # charge states
97
- se
98
-
99
96
# monovalent atoms
100
97
self .monovalent = ["Br" ,"Cl" ,"F" ,"H" ,"D" ,"I" ]
101
98
102
- class Settings (object ):
99
+ # Properties of different sybyl atom types for bonding
100
+ # This is for very internal use. Basically the properties are
101
+ # {num_bonds: (no. pi electrons, participating lone pairs, base charge)}
102
+ # (num_bonds + no_pi - charge) should equal the valency
103
+ # monovalent atoms is {1: (0,0,0)}
104
+ # TODO find a molecule with S.2 so I can understand how it works
105
+ self .sybyl_bonds = {
106
+ "C.3" : {4 : (0 ,0 ,0 )},
107
+ "C.2" : {3 : (1 ,0 ,0 )},
108
+ "C.1" : {2 : (2 ,0 ,0 )},
109
+ "O.co2" : {1 : (1 ,1 ,0 )},
110
+ "O.3" : {2 : (0 ,0 ,0 ), 3 : (0 ,0 ,+ 1 )},
111
+ "O.2" : {1 : (1 ,1 ,0 )},
112
+ "N.4" : {4 : (0 ,0 ,+ 1 )},
113
+ "N.3" : {3 : (0 ,0 ,0 )},
114
+ "N.2" : {2 : (1 ,0 ,0 )},
115
+ "N.am" : {3 : (1 ,1 ,+ 1 )},
116
+ "N.pl3" : {3 : (1 ,1 ,+ 1 )},
117
+ "N.1" : {1 : (2 ,0 ,0 ), 2 : (2 ,0 ,+ 1 )},
118
+ "S.o" : {3 : (0 ,0 ,+ 1 )},
119
+ "S.o2" : {4 : (2 ,0 ,0 )},
120
+ "S.3" : {2 : (0 ,0 ,0 )},
121
+ "Br" : {1 : (0 ,0 ,0 )},
122
+ "Cl" : {1 : (0 ,0 ,0 )},
123
+ "F" : {1 : (0 ,0 ,0 )},
124
+ "I" : {1 : (0 ,0 ,0 )},
125
+ "H" : {1 : (0 ,0 ,0 )},
126
+ }
127
+
128
+ def get_bond_length_limits (self , element1 , element2 ):
129
+ if element1 > element2 :
130
+ element1 , element2 = element2 , element1
131
+
132
+ if (element1 , element2 ) in self .bond_length_limits :
133
+ return self .bond_length_limits [(element1 , element2 )]
134
+
135
+ # Return limits such that no bonds are formed
136
+ # if the elements are not in self.bond_length_limits
137
+ return (0 ,0 ,0 ,0 )
138
+
139
+ class Settings (object ):
103
140
"""
104
141
Settings()
105
142
@@ -120,7 +157,10 @@ def __init__(self):
120
157
self .product_filenames = [None ]
121
158
self .print_level = 1
122
159
self .file_format = None
123
- self .simple_rotate = False
160
+ self .method = None
161
+ self .create_atoms = False
162
+ self .rotation_objective = False
163
+ self .bond_objective = False
124
164
125
165
def update (self , args ):
126
166
"""
@@ -132,4 +172,35 @@ def update(self, args):
132
172
self .product_filenames = args .products
133
173
self .print_level = args .print_level
134
174
self .file_format = args .format
135
- self .simple_rotate = args .simple_rotate
175
+ self .method = args .method
176
+
177
+ # Sets flags needed to define the pipeline of the method
178
+ self .construct_pipeline ()
179
+
180
+ def construct_pipeline (self ):
181
+ """
182
+ Sets flags needed to define the pipeline of the method
183
+
184
+ """
185
+
186
+ if self .method == "rotate" :
187
+ self .create_atoms = False
188
+ self .rotation_objective = True
189
+ self .bond_objective = False
190
+
191
+ elif self .method == "full" :
192
+ self .create_atoms = True
193
+ self .rotation_objective = True
194
+ self .bond_objective = True
195
+
196
+ elif self .method == "info" :
197
+ self .create_atoms = True
198
+ self .rotation_objective = False
199
+ self .bond_objective = False
200
+
201
+ # sanity check override
202
+ if self .bond_objective == True :
203
+ self .create_atoms = True
204
+
205
+
206
+ # TODO add parameters in ordering algorithm
0 commit comments