entities.Molecule
self, file_path) entities.Molecule(
Abstract base class for representing a molecule.
It associates the atomic data (the array) with the created 3D model inside of Blender (the object). If multiple conformations are imported, then a frames
collection is also instantiated.
The named_attribute()
and store_named_attribute()
methods access and set attributes on object
that is in the Blender scene.
Attributes
Name | Type | Description |
---|---|---|
file_path | str | The file path to the file which stores the atomic coordinates. |
file | Any | The opened file. |
object | bpy.types.Object | The Blender object representing the molecule. |
frames | bpy.types.Collection | The Blender collection which holds the objects making up the frames to animate. |
array | np.ndarray: | The numpy array which stores the atomic coordinates and associated attributes. |
entity_ids | np.ndarray | The entity IDs of the molecule. |
chain_ids | np.ndarray | The chain IDs of the molecule. |
Methods
Name | Description |
---|---|
assemblies | Get the biological assemblies of the molecule. |
create_object | Create a 3D model of the molecule inside of Blender. |
assemblies
=False) entities.Molecule.assemblies(as_array
Get the biological assemblies of the molecule.
Parameters
Name | Type | Description | Default |
---|---|---|---|
as_array | bool | Whether to return the assemblies as an array of quaternions. Default is False. | False |
Returns
Name | Type | Description |
---|---|---|
dict or None | The biological assemblies of the molecule, as a dictionary of transformation matrices, or None if no assemblies are available. |
create_object
entities.Molecule.create_object(='NewMolecule',
name='spheres',
style=None,
selection=False,
build_assembly='',
centre=True,
del_solvent=False,
del_hydrogen=None,
collection=False,
verbose='common',
color )
Create a 3D model of the molecule inside of Blender.
Creates a 3D model with one vertex per atom, and one edge per bond. Each vertex is given attributes which correspond to the atomic data such as atomic_number
for the element and res_name
for the residue name that the atom is associated with.
If multiple conformations of the structure are detected, the collection attribute is also created which will store an object for each conformation, so that the object can interpolate between those conformations.
Parameters
Name | Type | Description | Default |
---|---|---|---|
name | str | The name of the model. Default is ‘NewMolecule’. | 'NewMolecule' |
style | str | The style of the model. Default is ‘spheres’. | 'spheres' |
selection | np.ndarray | The selection of atoms to include in the model. Default is None. | None |
build_assembly | bool | Whether to build the biological assembly. Default is False. | False |
centre | str | Denote method used to determine center of structure. Default is ’’, resulting in no translational motion being removed. Accepted values are centroid or mass . Any other value will result in default behavior. |
'' |
del_solvent | bool | Whether to delete solvent molecules. Default is True. | True |
del_hydrogen | bool | Whether to delete hydrogen atoms. Default is False. | False |
collection | str | The collection to add the model to. Default is None. | None |
verbose | bool | Whether to print verbose output. Default is False. | False |
color | Optional[str] | The color scheme to use for the model. Default is ‘common’. | 'common' |
Returns
Name | Type | Description |
---|---|---|
bpy.types.Object | The created 3D model, as an object in the 3D scene. |