@@ -92,6 +92,7 @@ class Protein:
9292 def __init__ (
9393 self ,
9494 pdb_filepath : str ,
95+ atoms_size : float = 0.1 ,
9596 helices_thickness : float = 4 ,
9697 coils_thickness : float = 1 ,
9798 chains_smoothness : float = 3 ,
@@ -105,6 +106,7 @@ def __init__(
105106
106107 Args:
107108 pdb_filepath: Path to the PDB file.
109+ atoms_size: Size of individual atoms in the atoms mesh (default: 0.1).
108110 helices_thickness: Thickness of helix meshes (default: 4).
109111 coils_thickness: Thickness of coil meshes (default: 1).
110112 chains_smoothness: Smoothness factor for chain rendering (default: 3).
@@ -120,7 +122,7 @@ def __init__(
120122 structure_center_of_mass = self .structure .center_of_mass ()
121123
122124 self .atoms_entity = Entity (
123- model = self .compute_atoms_mesh (atom_element_color_map ),
125+ model = self .compute_atoms_mesh (atoms_size , atom_element_color_map ),
124126 origin = structure_center_of_mass ,
125127 * args ,
126128 ** kwargs ,
@@ -144,14 +146,17 @@ def __init__(
144146
145147 self .entities = [self .atoms_entity , self .helices_entity , self .coils_entity ]
146148
147- def compute_atoms_mesh (self , element_color_map : dict [str , Color ]) -> Mesh :
149+ def compute_atoms_mesh (
150+ self , atoms_size : float , element_color_map : dict [str , Color ]
151+ ) -> Mesh :
148152 """
149153 Compute the mesh of atoms in the protein structure.
150154
151155 This method creates an icosahedron for each atom in the protein structure
152156 and assigns colors based on the element type, combining them into one mesh.
153157
154158 Args:
159+ atoms_size: Size of individual atoms.
155160 element_color_map: Color mapping for atom elements.
156161
157162 Returns:
@@ -166,7 +171,7 @@ def compute_atoms_mesh(self, element_color_map: dict[str, Color]) -> Mesh:
166171 for index , atom in enumerate (self .structure .get_atoms ()):
167172 # Vertices
168173 verts .extend (
169- [(vert * 0.1 ) + atom .get_coord () for vert in ICOSAHEDRON_VERTS ]
174+ [(vert * atoms_size ) + atom .get_coord () for vert in ICOSAHEDRON_VERTS ]
170175 )
171176
172177 # Faces (triangles)
0 commit comments