當前位置: 首頁>>代碼示例>>Python>>正文


Python AllChem.MMFFGetMoleculeProperties方法代碼示例

本文整理匯總了Python中rdkit.Chem.AllChem.MMFFGetMoleculeProperties方法的典型用法代碼示例。如果您正苦於以下問題:Python AllChem.MMFFGetMoleculeProperties方法的具體用法?Python AllChem.MMFFGetMoleculeProperties怎麽用?Python AllChem.MMFFGetMoleculeProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rdkit.Chem.AllChem的用法示例。


在下文中一共展示了AllChem.MMFFGetMoleculeProperties方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_molecule_force_field

# 需要導入模塊: from rdkit.Chem import AllChem [as 別名]
# 或者: from rdkit.Chem.AllChem import MMFFGetMoleculeProperties [as 別名]
def get_molecule_force_field(self, mol, conf_id=None, **kwargs):
    """
    Get a force field for a molecule.

    Parameters
    ----------
    mol : RDKit Mol
        Molecule.
    conf_id : int, optional
        ID of the conformer to associate with the force field.
    kwargs : dict, optional
        Keyword arguments for force field constructor.
    """
    from rdkit.Chem import AllChem
    if self.force_field == 'uff':
      ff = AllChem.UFFGetMoleculeForceField(mol, confId=conf_id, **kwargs)
    elif self.force_field.startswith('mmff'):
      AllChem.MMFFSanitizeMolecule(mol)
      mmff_props = AllChem.MMFFGetMoleculeProperties(
          mol, mmffVariant=self.force_field)
      ff = AllChem.MMFFGetMoleculeForceField(
          mol, mmff_props, confId=conf_id, **kwargs)
    else:
      raise ValueError("Invalid force_field " +
                       "'{}'.".format(self.force_field))
    return ff 
開發者ID:deepchem,項目名稱:deepchem,代碼行數:28,代碼來源:conformers.py

示例2: calccharges

# 需要導入模塊: from rdkit.Chem import AllChem [as 別名]
# 或者: from rdkit.Chem.AllChem import MMFFGetMoleculeProperties [as 別名]
def calccharges(self, model='gasteiger'):
        """Calculate partial charges for a molecule. By default the Gasteiger
        charge model is used.

        Parameters
        ----------
        model : str (default="gasteiger")
            Method for generating partial charges. Supported models:
            * gasteiger
            * mmff94
        """
        self._clear_cache()
        if model.lower() == 'gasteiger':
            ComputeGasteigerCharges(self.Mol, nIter=50)
        elif model.lower() == 'mmff94':
            fps = AllChem.MMFFGetMoleculeProperties(self.Mol)
            if fps is None:
                raise Exception('Could not charge molecule "%s"' % self.title)
            for i, atom in enumerate(self.Mol.GetAtoms()):
                atom.SetDoubleProp('_MMFF94Charge', fps.GetMMFFPartialCharge(i))
        else:
            raise ValueError('The "%s" is not supported in RDKit backend' %
                             model)
        if np.isnan(self.charges).any() or np.isinf(self.charges).any():
            warnings.warn('Some partial charges for molecule "%s" are not '
                          'finite (NaN, +/-Inf).' % self.title, UserWarning) 
開發者ID:oddt,項目名稱:oddt,代碼行數:28,代碼來源:rdk.py

示例3: get_molecule_force_field

# 需要導入模塊: from rdkit.Chem import AllChem [as 別名]
# 或者: from rdkit.Chem.AllChem import MMFFGetMoleculeProperties [as 別名]
def get_molecule_force_field(self, mol, conf_id=None, **kwargs):
        """Get a force field for a molecule.

        Parameters
        ----------
        mol : RDKit Mol
            Molecule.
        conf_id : int, optional
            ID of the conformer to associate with the force field.
        **kwargs : dict, optional
            Keyword arguments for force field constructor.
        """
        if self.forcefield == "uff":
            ff = AllChem.UFFGetMoleculeForceField(
                mol, confId=conf_id, **kwargs
            )
        elif self.forcefield.startswith("mmff"):
            AllChem.MMFFSanitizeMolecule(mol)
            mmff_props = AllChem.MMFFGetMoleculeProperties(
                mol, mmffVariant=self.forcefield
            )
            ff = AllChem.MMFFGetMoleculeForceField(
                mol, mmff_props, confId=conf_id, **kwargs
            )
        else:
            raise ValueError(
                "Invalid forcefield " + "'{}'.".format(self.forcefield)
            )
        return ff 
開發者ID:keiserlab,項目名稱:e3fp,代碼行數:31,代碼來源:generator.py

示例4: compute

# 需要導入模塊: from rdkit.Chem import AllChem [as 別名]
# 或者: from rdkit.Chem.AllChem import MMFFGetMoleculeProperties [as 別名]
def compute(self, input_data: "AtomicInput", config: "TaskConfig") -> "AtomicResult":
        """
        Runs RDKit in FF typing
        """

        self.found(raise_error=True)
        import rdkit
        from rdkit.Chem import AllChem

        # Failure flag
        ret_data = {"success": False}

        # Build the Molecule
        jmol = input_data.molecule
        mol = self._process_molecule_rdkit(jmol)

        if input_data.model.method.lower() == "uff":
            ff = AllChem.UFFGetMoleculeForceField(mol)
            all_params = AllChem.UFFHasAllMoleculeParams(mol)
        elif input_data.model.method.lower() in ["mmff94", "mmff94s"]:
            props = AllChem.MMFFGetMoleculeProperties(mol, mmffVariant=input_data.model.method)
            ff = AllChem.MMFFGetMoleculeForceField(mol, props)
            all_params = AllChem.MMFFHasAllMoleculeParams(mol)
        else:
            raise InputError("RDKit only supports the UFF, MMFF94, and MMFF94s methods currently.")

        if all_params is False:
            raise InputError("RDKit parameters not found for all atom types in molecule.")

        ff.Initialize()

        ret_data["properties"] = {"return_energy": ff.CalcEnergy() * ureg.conversion_factor("kJ / mol", "hartree")}

        if input_data.driver == "energy":
            ret_data["return_result"] = ret_data["properties"]["return_energy"]
        elif input_data.driver == "gradient":
            coef = ureg.conversion_factor("kJ / mol", "hartree") * ureg.conversion_factor("angstrom", "bohr")
            ret_data["return_result"] = [x * coef for x in ff.CalcGrad()]
        else:
            raise InputError(f"RDKit can only compute energy and gradient driver methods. Found {input_data.driver}.")

        ret_data["provenance"] = Provenance(
            creator="rdkit", version=rdkit.__version__, routine="rdkit.Chem.AllChem.UFFGetMoleculeForceField"
        )

        ret_data["schema_name"] = "qcschema_output"
        ret_data["success"] = True

        # Form up a dict first, then sent to BaseModel to avoid repeat kwargs which don't override each other
        return AtomicResult(**{**input_data.dict(), **ret_data}) 
開發者ID:MolSSI,項目名稱:QCEngine,代碼行數:52,代碼來源:rdkit.py


注:本文中的rdkit.Chem.AllChem.MMFFGetMoleculeProperties方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。