コード例 #1
0
    def get_angles(self):

        rdmol_copy = self.rdkit_molecule

        angle_list = []
        for atom1 in rdmol_copy.GetAtoms():
            for atom2 in atom1.GetNeighbors():
                for atom3 in atom2.GetNeighbors():
                    if atom1.GetIdx() == atom3.GetIdx():
                        continue

                    to_add = (atom1.GetIdx(), atom2.GetIdx(), atom3.GetIdx())
                    if (to_add in angle_list) or (tuple(reversed(to_add))
                                                  in angle_list):
                        continue
                    angle_list.append(to_add)

        angles = []
        for indices in angle_list:
            i, j, k = indices

            degree = self.ase_molecule.get_angle(i, j, k)
            ang = Angle(indices=indices,
                        degree=degree,
                        left_mask=[],
                        right_mask=[])
            left_mask = self.get_left_mask(ang)
            right_mask = self.get_right_mask(ang)

            reaction_center = "No"

            angles.append(
                Angle(indices, degree, left_mask, right_mask, reaction_center))
        self.angles = angles
        return self.angles
コード例 #2
0
    def get_ts_angles(self):

        rdmol_copy = self.create_pseudo_geometry()

        angle_list = []
        for atom1 in rdmol_copy.GetAtoms():
            for atom2 in atom1.GetNeighbors():
                for atom3 in atom2.GetNeighbors():
                    if atom1.GetIdx() == atom3.GetIdx():
                        continue

                    to_add = (atom1.GetIdx(), atom2.GetIdx(), atom3.GetIdx())
                    if (to_add in angle_list) or (tuple(reversed(to_add))
                                                  in angle_list):
                        continue
                    angle_list.append(to_add)

        angles = []
        for indices in angle_list:
            i, j, k = indices

            degree = self.ase_ts.get_angle(i, j, k)
            ang = Angle(indices=indices,
                        degree=degree,
                        left_mask=[],
                        right_mask=[])
            left_mask = self.get_ts_left_mask(ang)
            right_mask = self.get_ts_right_mask(ang)

            reaction_center = "No"

            if (self.rmg_ts.atoms[i].label != ""
                    and self.rmg_ts.atoms[j].label != ""
                    and self.rmg_ts.atoms[k].label != ""):

                reaction_center = "Yes"
            elif ((self.rmg_ts.atoms[i].label != ""
                   and self.rmg_ts.atoms[j].label != "")
                  or (self.rmg_ts.atoms[j].label != ""
                      and self.rmg_ts.atoms[k].label != "")):

                reaction_center = "Close"

            angles.append(
                Angle(indices, degree, left_mask, right_mask, reaction_center))
        self.angles = angles
        return self.angles
コード例 #3
0
ファイル: species.py プロジェクト: rwest/AutoTST
    def get_angles(self, rdkit_molecule=None, ase_molecule=None):
        """
        A method for identifying all of the angles in a conforemr
        """
        if not rdkit_molecule:
            rdkit_molecule = self.rdkit_molecule
        rdmol_copy = rdkit_molecule

        if not ase_molecule:
            ase_molecule = self.ase_molecule

        angle_list = []
        for atom1 in rdmol_copy.GetAtoms():
            for atom2 in atom1.GetNeighbors():
                for atom3 in atom2.GetNeighbors():
                    if atom1.GetIdx() == atom3.GetIdx():
                        continue

                    to_add = (atom1.GetIdx(), atom2.GetIdx(), atom3.GetIdx())
                    if (to_add in angle_list) or (tuple(reversed(to_add))
                                                  in angle_list):
                        continue
                    angle_list.append(to_add)

        angles = []
        for index, indices in enumerate(angle_list):
            i, j, k = indices

            degree = ase_molecule.get_angle(i, j, k)
            ang = Angle(index=index,
                        atom_indices=indices,
                        degree=degree,
                        mask=[])
            mask = self.get_mask(ang, rdmol_copy, ase_molecule)
            reaction_center = False

            angles.append(
                Angle(index=index,
                      atom_indices=indices,
                      degree=degree,
                      mask=mask,
                      reaction_center=reaction_center))
        self.angles = angles
        return self.angles
コード例 #4
0
ファイル: geometryTest.py プロジェクト: nateharms/AutoTST
 def setUp(self):
     self.angle = Angle(index=1,
                        atom_indices=[1, 2],
                        degree=90.0,
                        reaction_center=True,
                        mask=[True, True, True])