create_types
#
Create new tagged SMARTS parameter types for molecules of interest.
Functions:
-
add_types_to_forcefield–Add bespoke types to a force field based on multiple molecules and type generation settings.
_add_parameter_with_overwrite
#
_add_parameter_with_overwrite(
handler: ParameterHandler,
parameter_dict: Mapping[str, str | Quantity],
) -> None
Add a parameter to a handler, overwriting any existing parameter with the same smirks.
Source code in presto/create_types.py
_create_smarts
#
Create a mapped SMARTS representation of a molecule.
Crucially, this uses MergeQueryHs to merge non-mapped hydrogens into their heavy atom. This dramatically increases the speed of SMARTS matching in RDKit for complex SMARTS patterns (thanks to Niels Maeder for suggesting this!).
Parameters:
-
mol(Molecule) –The molecule to create SMARTS for.
-
idxs(tuple[int, ...]) –Indices of the atoms to map (and from which to extend).
-
max_extend_distance(int, default:-1) –Maximum number of bonds to extend from the mapped atoms. If -1, include the entire molecule.
Returns:
str The SMARTS pattern with atom maps.
Source code in presto/create_types.py
_remove_redundant_smarts
#
_remove_redundant_smarts(
mols: Molecule | list[Molecule],
force_field: ForceField,
id_substring: str | None = None,
) -> ForceField
Remove redundant SMARTS parameters that are not used by any molecule.
This function labels all molecules with the force field and identifies which parameters are actually applied. Parameters that are not used by any molecule and have an ID containing the specified substring are removed. This works because the a given substructure should always be matched by the last equivalent mapped-SMARTS in the force field.
Parameters:
-
mols(Molecule | list[Molecule]) –Molecule or list of molecules to check parameter usage against
-
force_field(ForceField) –Force field to remove redundant parameters from
-
id_substring(str | None, default:None) –Only remove parameters whose ID contains this substring. If None, no parameters are removed.
Returns:
openff.toolkit.ForceField Force field with redundant parameters removed
Source code in presto/create_types.py
_remove_stereochemical_information
#
Return a copy of mol with atom and bond stereochemistry removed.
Source code in presto/create_types.py
add_types_to_forcefield
#
add_types_to_forcefield(
mols: Molecule | list[Molecule],
force_field: ForceField,
type_generation_settings: dict[
NonLinearValenceType, TypeGenerationSettings
],
) -> ForceField
Add bespoke types to a force field based on multiple molecules and type generation settings.
Parameters:
-
mols(Molecule | list[Molecule]) –Molecule or list of molecules to parameterize
-
force_field(ForceField) –The base force field to add bespoke parameters to
-
type_generation_settings(dict[NonLinearValenceType, TypeGenerationSettings]) –Settings for generating tagged SMARTS types for each valence type
Returns:
openff.toolkit.ForceField Force field with bespoke parameters added, deduplicated across all molecules
Source code in presto/create_types.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |