示例#1
0
    def save_to_ligand(self, mol_input, name=None, input_type='input'):
        """
        Public access to private file_handlers.py file.
        Users shouldn't ever need to interface with file_handlers.py directly.
        All parameters will be set from a file (or other input) via this public method.

        Don't bother updating name, topology or atoms if they are already stored.
        Do bother updating coords and rdkit_mol

        :param mol_input:
        :param name:
        :param input_type: "input", "mm", "qm", "traq", or "temp"
        """

        ligand = ReadInput(mol_input, name)

        if ligand.name is not None and self.name is None:
            self.name = ligand.name
        if ligand.topology is not None and self.topology is None:
            self.topology = ligand.topology
        if ligand.atoms is not None and self.atoms is None:
            self.atoms = ligand.atoms
        if ligand.coords is not None:
            self.coords[input_type] = ligand.coords
        if ligand.rdkit_mol is not None:
            self.rdkit_mol = ligand.rdkit_mol
示例#2
0
    def save_to_protein(self, mol_input, name=None, input_type='input'):
        """
        Public access to private file_handlers.py file.
        Users shouldn't ever need to interface with file_handlers.py directly.
        All parameters will be set from a file (or other input) via this public method.
            * Don't bother updating name, topology or atoms if they are already stored.
            * Do bother updating coords, rdkit_mol, residues, Residues, pdb_names
        """

        protein = ReadInput(mol_input, name, is_protein=True)

        if protein.name is not None and self.name is None:
            self.name = protein.name
        if protein.topology is not None and self.topology is None:
            self.topology = protein.topology
        if protein.atoms is not None and self.atoms is None:
            self.atoms = protein.atoms

        if protein.coords is not None:
            self.coords[input_type] = protein.coords
        if protein.rdkit_mol is not None:
            self.rdkit_mol = protein.rdkit_mol
        if protein.residues is not None:
            self.residues = protein.residues
        if protein.Residues is not None:
            self.Residues = protein.Residues
        if protein.pdb_names is not None:
            self.pdb_names = protein.pdb_names

        if not self.topology.edges:
            print(
                'No connections found in pdb file; topology will be inferred by OpenMM.'
            )
            return

        self.find_angles()
        self.find_dihedrals()
        self.find_rotatable_dihedrals()
        self.find_impropers()
        self.get_dihedral_values(input_type)
        self.find_bond_lengths(input_type)
        self.get_angle_values(input_type)
        # this creates the dictionary of terms that should be symmetrise
        self.symmetrise_from_topology()