nonbonded
#
Convert non-bonded potentials to OpenMM forces.
Modules:
-
smee
–Differentiably evaluate energies of molecules using SMIRNOFF force fields
Functions:
-
convert_custom_vdw_potential
–Converts an arbitrary vdW potential to OpenMM forces.
-
convert_lj_potential
–Convert a Lennard-Jones potential to an OpenMM force.
-
convert_dexp_potential
–Convert a DEXP potential to OpenMM forces.
-
convert_coulomb_potential
–Convert a Coulomb potential to an OpenMM force.
convert_custom_vdw_potential
#
convert_custom_vdw_potential(
potential: TensorPotential,
system: TensorSystem,
energy_fn: str,
mixing_fn: dict[str, str],
) -> tuple[CustomNonbondedForce, CustomBondForce]
Converts an arbitrary vdW potential to OpenMM forces.
The intermolecular interactions are described by a custom nonbonded force, while the intramolecular interactions are described by a custom bond force.
If the potential has custom mixing rules (i.e. exceptions), a lookup table will be used to store the parameters. Otherwise, the mixing rules will be applied directly in the energy function.
Parameters:
-
potential
(TensorPotential
) –The potential to convert.
-
system
(TensorSystem
) –The system the potential belongs to.
-
energy_fn
(str
) –The energy function of the potential, written in OpenMM's custom energy function syntax.
-
mixing_fn
(dict[str, str]
) –A dictionary of mixing rules for each parameter of the potential. The keys are the parameter names, and the values are the mixing rules.
The mixing rules should be a single expression that can be evaluated using OpenMM's energy function syntax, and should not contain any assignments.
Examples:
For a Lennard-Jones potential using Lorentz-Berthelot mixing rules:
>>> energy_fn = "4*epsilon*x6*(x6 - 1.0);x6=x4*x2;x4=x2*x2;x2=x*x;x=sigma/r;"
>>> mixing_fn = {
... "epsilon": "sqrt(epsilon1 * epsilon2)",
... "sigma": "0.5 * (sigma1 + sigma2)",
... }
Source code in smee/converters/openmm/nonbonded.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
|
convert_lj_potential
#
convert_lj_potential(
potential: TensorPotential, system: TensorSystem
) -> (
NonbondedForce
| list[CustomNonbondedForce | CustomBondForce]
)
Convert a Lennard-Jones potential to an OpenMM force.
If the potential has custom mixing rules (i.e. exceptions), the interactions will be split into an inter- and intra-molecular force.
Source code in smee/converters/openmm/nonbonded.py
convert_dexp_potential
#
convert_dexp_potential(
potential: TensorPotential, system: TensorSystem
) -> tuple[CustomNonbondedForce, CustomBondForce]
Convert a DEXP potential to OpenMM forces.
The intermolcular interactions are described by a custom nonbonded force, while the intramolecular interactions are described by a custom bond force.
If the potential has custom mixing rules (i.e. exceptions), a lookup table will be used to store the parameters. Otherwise, the mixing rules will be applied directly in the energy function.
Source code in smee/converters/openmm/nonbonded.py
convert_coulomb_potential
#
convert_coulomb_potential(
potential: TensorPotential, system: TensorSystem
) -> NonbondedForce
Convert a Coulomb potential to an OpenMM force.