Abstract Molecules¶
- class manim_chemistry.molecule.abstract_molecule.AbstractMolecule(*args, **kwargs)[source]¶
Abstract molecule class used as a template to create all the other molecule classes.
- group_class¶
alias of
VGroup
- abstract classmethod mc_molecule_to_atoms_and_bonds(mc_molecule: MCMolecule) Tuple[Dict, Dict] [source]¶
Transforms the structure of a mc_molecule to a (vertices, edges) tuple with the following structure: - Vertices: {<atom_index>: MCAtom} - Edges: {(<from_atom_index>, <to_atom_index>): MCBond}
- Args:
mc_molecule (MCMolecule): _description_
- Returns:
Tuple[Dict, Dict]: _description_
- classmethod molecule_from_file(filepath, ignore_hydrogens: bool = True, ignore_all_hydrogens: bool = False, *args, **kwargs)[source]¶
Reads a file and returns a single molecule from that file.
By default retrieves the first molecule generated by the file.
- Args:
filepath (_type_): Pathlike or str
- Returns:
GraphMolecule: GraphMolecule from the file
- classmethod molecule_from_pubchem(cid: str | None = None, name: str | None = None, smiles: str | None = None, inchi: str | None = None, three_d: bool = False, *args, **kwargs)[source]¶
Generates a GraphMolecule from an identifier using PubChem API.
- Args:
cid (Optional[str], optional): Molecule cid. Defaults to None. name (Optional[str], optional): Molecule name. Defaults to None. smiles (Optional[str], optional): Molecule SMILES. Defaults to None. inchi (Optional[str], optional): Molecule InChi. Defaults to None.
- Returns:
GraphMolecule: GraphMolecule
- classmethod molecule_from_string(string: str, format: str = 'json', ignore_hydrogens: bool = True, ignore_all_hydrogens: bool = False, *args, **kwargs)[source]¶
Reads a file and returns a single molecule from that file.
By default retrieves the first molecule generated by the file.
- Args:
filepath (_type_): Pathlike or str label (bool, optional): Add a label such as element symbol or number. Defaults to False.
- Returns:
ThreeDMolecule: ThreeDMolecule from the string
- classmethod multiple_molecules_from_file(filepath, ignore_hydrogens: bool = True, ignore_all_hydrogens: bool = False, *args, **kwargs) OpenGLGroup | VGroup [source]¶
Reads a file and returns a collection of molecules from that file as a OpenGLGroup or VGroup.
- Args:
filepath (str | Pathlike): Path to the molecule
- Raises:
Exception: In case the mc_molecules parsed is not a list.
- Returns:
OpenGLGroup: OpenGLGroup with the molecules inside.
- classmethod multiple_molecules_from_string(string: str, format: str = 'json', ignore_hydrogens: bool = True, ignore_all_hydrogens: bool = False, *args, **kwargs) OpenGLGroup [source]¶
Reads a file and returns a collection of molecules from that file as a OpenGLGroup.
- Args:
filepath (str | Pathlike): Path to the molecule label (bool, optional): Wether or not add a label.. Defaults to False.
- Raises:
Exception: In case the mc_molecules parsed is not a list.
- Returns:
OpenGLGroup: OpenGLGroup with the molecules inside.