Molecule¶
AutoPoly.models.molecule
¶
Molecule Definition Module
This module provides the Molecule class for defining small molecule structures for molecular dynamics simulations.
The Molecule class handles: - Small molecule definitions (water, benzene, ethanol, etc.) - Molecule count and concentration control - Integration with Polymer class for mixed systems - SMILES validation for non-polymer molecules
Created on 2025 @author: zwu
Classes:
| Name | Description |
|---|---|
Molecule |
Molecule class for defining small molecule structures. |
Molecule
¶
Molecule class for defining small molecule structures.
This class manages small molecule definitions for molecular dynamics simulations. It follows the same API pattern as the Polymer class but is designed for non-polymer molecules using regular SMILES (without wildcards).
Attributes:
| Name | Type | Description |
|---|---|---|
Count |
int
|
Number of molecules to generate |
Smiles |
str
|
SMILES string WITHOUT wildcards (e.g., "O", "CCO", "c1ccccc1") |
molecule_name |
str
|
Name for the molecule |
sequenceSet |
list
|
List of molecule identifiers for each molecule instance |
sequenceName |
list
|
List of molecule names for each molecule instance |
merSet |
list
|
Single-element list containing the molecule name |
DOP |
int
|
Always 1 for molecules (for pipeline compatibility) |
_is_molecule |
bool
|
Type detection flag (always True for Molecule class) |
Example
water = Molecule(Count=100, Smiles="O", Name="water") benzene = Molecule(Count=50, Smiles="c1ccccc1", Name="benzene")
Methods:
| Name | Description |
|---|---|
get_count |
Get the number of molecules. |
get_smiles |
Get the SMILES string. |
get_name |
Get the molecule name. |
get_sequence_set |
Get the sequence set for all molecule instances. |
get_sequence_names |
Get the sequence names for all molecule instances. |
get_mer_set |
Get the unique set of molecules (always single-element list). |
get_molecule_info |
Get comprehensive information about the molecule. |
Source code in AutoPoly/models/molecule.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
get_count() -> int
¶
get_smiles() -> str
¶
get_name() -> str
¶
get_sequence_set() -> List[List[str]]
¶
Get the sequence set for all molecule instances.
This method mirrors Polymer.get_sequence_set() for compatibility.
Returns:
| Type | Description |
|---|---|
List[List[str]]
|
List[List[str]]: List of molecule identifiers for each instance |
Source code in AutoPoly/models/molecule.py
get_sequence_names() -> List[List[str]]
¶
Get the sequence names for all molecule instances.
This method mirrors Polymer.get_sequence_names() for compatibility.
Returns:
| Type | Description |
|---|---|
List[List[str]]
|
List[List[str]]: List of molecule names for each instance |
Source code in AutoPoly/models/molecule.py
get_mer_set() -> List[str]
¶
Get the unique set of molecules (always single-element list).
This method mirrors Polymer.get_mer_set() for compatibility.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Single-element list containing the molecule name |
Source code in AutoPoly/models/molecule.py
get_molecule_info() -> Dict[str, Union[int, str, List]]
¶
Get comprehensive information about the molecule.
This method mirrors Polymer.get_chain_info() for compatibility.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dict[str, Union[int, str, List]]
|
Dictionary containing molecule properties including: - count: Number of molecules - smiles: SMILES string - name: Molecule name - dop: Degree of polymerization (always 1) - mer_set: List of molecule names - sequence_set: List of molecule identifiers - sequence_names: List of molecule names |