def test_one_to_three_dissociation(): r = Reactant(name='tet_int', smiles='CC(OS(Cl)=O)(Cl)O') p1 = Product(name='acyl', smiles='CC(Cl)=[OH+]') p2 = Product(name='so2', smiles='O=S=O') p3 = Product(name='chloride', smiles='[Cl-]') reaction = Reaction(r, p1, p2, p3, solvent_name='thf') assert reaction.type is Dissociation # Generate reactants and product complexes then find the single possible # bond rearrangement reactant, product = get_complexes(reaction) reaction.reactant, reaction.product = reactant, product bond_rearrangs = get_bond_rearrangs(reactant, product, name=str(reaction)) assert len(bond_rearrangs) == 1 os.remove(f'{str(reaction)}_bond_rearrangs.txt') # This dissociation breaks two bonds and forms none bond_rearrangement = bond_rearrangs[0] assert len(bond_rearrangement.fbonds) == 0 assert len(bond_rearrangement.bbonds) == 2 # Ensure there is at least one bond function that could give the TS ts_funcs_params = get_ts_guess_function_and_params(reaction, bond_rearrangement) assert len(list(ts_funcs_params)) > 0
def test_detection(): # F- + H2CCHCH2Cl -> FCH2CHCH2 + Cl- reaction = Reaction(Reactant(name='F-', charge=-1, atoms=[Atom('F')]), Reactant(name='alkeneCl', smiles='C=CCCl'), Product(name='alkeneF', smiles='C=CCF'), Product(name='Cl-', charge=-1, atoms=[Atom('Cl')])) assert reaction.type == Substitution reactant, product = get_complexes(reaction) bond_rearrs = get_bond_rearrangs(reactant, product, name='SN2') # autodE should find both direct SN2 and SN2' pathways assert len(bond_rearrs) == 2 os.remove('SN2_bond_rearrangs.txt')
def find_complexes(self): self.reactant, self.product = get_complexes(reaction=self) return None