1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 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 221 222 223 224 225 226 227 228 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 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 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 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
|
Simulation
================================================================================
.. currentmodule:: ost.mol.mm
The simulation finally connects a :class:`Topology` with an
:class:`EntityHandle`. While applying minimization or
md tasks, the current positions of the simulation object can be
mapped back to the attached structure at any time.
.. class:: Simulation(entity, settings)
First constructor that takes an :class:`ost.mol.EntityHandle` as an input
and automatically constructs an internal :class:`Topology` according
to the provided **settings**. Be aware, that the **entity** will be altered
depending on hydrogen/termini definitions in the :class:`Forcefield` attached
to the **settings**
:param entity: Entity from which a default
:class:`Topology` will be created according to the
**settings**
:param settings: Controls the parametrization of
the :class:`Simulation` and the buildup of the
internal :class:`Topology`
:type entity: :class:`EntityHandle`
:type settings: :class:`Settings`
:raises: :class:`RuntimeError` when construction of
:class:`Topology` fails
.. class:: Simulation(topology,entity,settings)
:noindex:
Second constructor that takes a :class:`Topology`, a consistent
:class:`ost.mol.EntityHandle` and a :class:`Settings` as input.
:param topology: Topology to initialize the :class:`Simulation`
:param entity: Entity that is consistent with
the provided **topology**
:param settings: Controls the parametrization of
the :class:`Simulation`
:type topology: :class:`Topology`
:type entity: :class:`EntityHandle`
:type settings: :class:`Settings`
:raises: :class:`RuntimeException` when number of atoms in
**entity** is not equal the number of particles
in **topology**
.. method:: Save(filename, settings)
Dumps current status of the simulation with its connected **entity** onto
disk. All informations from the **entity** except plain chains, residues,
atoms and bonds are lost.
:param filename: Filename
:type filename: :class:`str`
.. staticmethod:: Load(filename)
Loads a dumped simulation from disk. You have to make sure, that the provided
settings are consistent with those from the saved simulation. Undefined
behaviour must be expected otherwise.
:param filename: Filename
:param settings: Settings to reparametrize loaded simulation
:type filename: :class:`str`
:type settings: :class:`Settings`
.. staticmethod:: IsPlatformAvailable(settings)
:return: True, if platform defined in *settings* is available. Otherwise,
construction of a simulation object will fail with these settings.
:rtype: :class:`bool`
:param settings: Controls the parametrization of this class.
Only :attr:`Settings.openmm_plugin_directory`,
:attr:`Settings.custom_plugin_directory` and
:attr:`Settings.platform` are relevant.
:type settings: :class:`Settings`
.. method:: ApplyLBFGS([tolerance=1.0,max_iterations=1000])
Run minimization using the Limited-memory Broyden–Fletcher–Goldfarb–Shanno
(L-BFGS) method.
:param tolerance: Tolerance describing abort criteria of minimization.
The tolerance is interpreted as the root mean square
value of all force components.
:param max_iterations: Maximum number of minimization iterations
:type tolerance: :class:`float`
:type max_iterations: :class:`int`
.. method:: ApplySD([tolerance=100,max_iterations=1000])
Run minimization using the steepest descend method.
:param tolerance: Tolerance describing abort criteria of minimization.
The tolerance is interpreted as the norm of the maximum
force acting onto the particles.
:param max_iterations: Maximum number of minimization iterations
:type tolerance: :class:`float`
:type max_iterations: :class:`int`
:returns: :class:`bool` whether tolerance has been reached
.. method:: Steps(steps)
Runs the simulation for **steps** number of steps.
:param steps: Number of steps to perform
:type steps: :class:`int`
.. method:: GetPositions([enforce_periodic_box = false, in_angstrom = true])
:param enforce_periodic_box: True if periodic box has to be enforced
:param in_angstrom: True if positions should be in Angstrom, they're in nm
otherwise
:type enforce_periodic_box: :class:`bool`
:type in_angstrom: :class:`bool`
:returns: A :class:`ost.geom.Vec3List` of all the positions of the atoms in the Entity.
.. method:: SetPositions(positions,[,in_angstrom = true])
:param positions: Positions to be set
:param in_angstrom: True if **positions** are in Angstrom, they're expected
to be in nm otherwise
:type positions: :class:`ost.geom.Vec3List`
:type in_angstrom: :class:`bool`
.. method:: UpdatePositions([enforce_periodic_box=false])
Sets the positions of the atoms in the :class:`EntityHandle` to the current positions of the simulation.
:param enforce_periodic_box: True if periodic box should be enforced
:type enforce_periodic_box: :class:`bool`
.. method:: GetVelocities()
:returns: A :class:`~ost.geom.Vec3List` of all the velocities of the atoms in the Entity.
.. method:: GetForces()
:returns: A :class:`~ost.geom.Vec3List` of all the resulting forces for each atom in the Entity.
.. method:: SetVelocities(velocities)
:param velocities: Velocities to be set
:type velocities: :class:`ost.geom.Vec3List`
.. method:: GetEntity()
:returns: :class:`EntityHandle` attached to the simulation
.. method:: GetEnergy()
:returns: :class:`float` *Potential + Kinetic* energy in kJ/mol of current
simulation state
.. method:: GetPotentialEnergy()
:returns: :class:`float` *Potential* energy in kJ/mol of current simulation
state
.. method:: GetKineticEnergy()
:returns: :class:`float` *Kinetic* energy in kJ/mol of current simulation
state
.. method:: GetTopology()
:returns: :class:`Topology` attached to the simulation
.. method:: GetPeriodicBoxExtents()
:returns: :class:`~ost.geom.Vec3` Extents of the periodic box
.. method:: SetPeriodicBoxExtents(vec)
:param vec: Periodic box extents in A
:type vec: :class:`ost.geom.Vec3`
.. method:: Register(observer)
Adds an observer to the simulation object. This can be used for example to write out the trajectory during the simulation.
:param observer: Observer to be attached
:type observer: :class:`Observer`
.. method:: AddPositionConstraint(index)
Fixes the position of the particle with index given in the argument.
This requires to reinitialize the internal openmm Context
(this is expensive!). Positions, velocities, forces, energies etc.
are properly preserved but e.g. states of random number generators etc.
might be lost.
:param index: Particle to be fixed
:type index: :class:`int`
:raises: :class:`RuntimeError` when **index** exceeds
number of particles
.. method:: AddPositionConstraints(indices)
Fixes the position of the atoms with the indices given in in the argument.
This requires to reinitialize the internal openmm Context
(this is expensive!). Positions, velocities, forces, energies etc.
are properly preserved but e.g. states of random number generators etc.
might be lost.
:param indices: Particles to be fixed
:type indices: :class:`list`
:raises: :class:`RuntimeError` when an index in **indices**
exceeds number of particles
.. method:: ResetPositionConstraints()
Removes all position constraints.
This requires to reinitialize the internal openmm Context
(this is expensive!). Positions, velocities, forces, energies etc.
are properly preserved but e.g. states of random number generators etc.
might be lost.
.. method:: ResetHarmonicBond(index, bond_length, force_constant)
Update of the harmonic bond parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Harmonic Bond to be reset
:param bond_length: New bond length in nm
:param force_constant: New force constant in kJ/mol/nm^2
:type index: :class:`int`
:type bond_length: :class:`float`
:type force_constant: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of harmonic bonds
.. method:: ResetHarmonicAngle()
Update of the harmonic angle parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Harmonic Angle to be reset
:param angle: New Angle in radians
:param force_constant: New force constant in kJ/mol/radian^2
:type index: :class:`int`
:type angle: :class:`float`
:type force_constant: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of harmonic angles
.. method:: ResetUreyBradleyAngle(index, angle, angle_force_constant, bond_length, bond_force_constant)
Update of the Urey-Bradley angle parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Urey-Bradley angle that has to be reset
:param angle: New angle in radians
:param angle_force_constant: New angle force constant kJ/mol/radian^2
:param bond_length: New bond length in nm
:param bond_force_constant: New bond force constant in kJ/mol/nm^2
:type index: :class:`int`
:type angle: :class:`float`
:type angle_force_constant: :class:`float`
:type bond_length: :class:`float`
:type bond_force_constant: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of urey-bradley angles
.. method:: ResetPeriodicDihedral(index, multiplicity, phase, force_constant)
Update of the periodic dihedral parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Periodic dihedral to be reset
:param multiplicity: New Multiplicity
:param phase: New phase in radians
:param force_constant: New force constant in kJ/mol/radian^2
:type index: :class:`int`
:type multiplicity: :class:`int`
:type phase: :class:`float`
:type force_constant: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of periodic dihedrals
.. method:: ResetPeriodicImproper(index, multiplicity, phase, force_constant)
Update of the periodic improper parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Periodic improper to be reset
:param multiplicity: New multiplicity
:param phase: New phase in radians
:param force_constant: New force constant kJ/mol/radian^2
:type index: :class:`int`
:type multiplicity: :class:`int`
:type phase: :class:`float`
:type force_constant: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of periodic impropers
.. method:: ResetHarmonicImproper(index, phase, force_constant)
Update of the harmonic improper parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Harmonic improper to be reset
:param phase: New phase in radians
:param force_constant: New force constant kJ/mol/radian^2
:type index: :class:`int`
:type phase: :class:`float`
:type force_constant: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of harmonic impropers
.. method:: ResetLJPair(index,sigma,epsilon)
Update of the LJ pair parameters in the simulation **and**
in the attached :class:`Topology`
:param index: LJ pair to be reset
:param sigma: New sigma in nm
:param epsilon: New epsilon in kJ/mol
:type index: :class:`int`
:type sigma: :class:`float`
:type epsilon: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of LJ pairs
.. method:: ResetDistanceConstraint(index, constraint_length)
Update of the distance constraint parameters in the simulation **and**
in the attached :class:`Topology`.
This requires to reinitialize the internal openmm Context
(this is expensive!). Positions, velocities, forces, energies etc.
are properly preserved but e.g. states of random number generators etc.
might be lost.
:param index: Distance constraint to be reset
:param constraint_length: New constraint length in nm
:type index: :class:`int`
:type constraint_length: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of distance constraints
.. method:: ResetHarmonicPositionRestraint(index,ref_position, force_constant,x_scale,y_scale,z_scale)
Update of the harmonic position restraint parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Harmonic position restraint to be reset
:param ref_position: New reference position in nm
:param force_constant: New force constant in kJ/mol/nm^2
:param x_scale: New x-scale
:param y_scale: New y-scale
:param z_scale: New z-scale
:type index: :class:`int`
:type ref_position: :class:`ost.geom.Vec3`
:type force_constant: :class:`float`
:type x_scale: :class:`float`
:type y_scale: :class:`float`
:type z_scale: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of harmonic position restraints
.. method:: ResetHarmonicDistanceRestraint(index, length, force_constant)
Update of the harmonic distance restraint parameters in the simulation **and**
in the attached :class:`Topology`
:param index: Harmonic distance restraint to be reset
:param length: New restraint length in nm
:param force_constant: New force constant kJ/mol/nm^2
:type index: :class:`int`
:type length: :class:`float`
:type force_constant: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of harmonic distance restraints
.. method:: ResetLJ(index,sigma,epsilon)
Update of the lj parameters in the simulation **and**
in the attached :class:`Topology`
:param index: LJ to be reset
:param sigma: New sigma in nm
:param epsilon: New epsilon in kJ/mol
:type index: :class:`int`
:type sigma: :class:`float`
:type epsilon: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of particles
.. method:: ResetGBSA(index,radius,scaling)
Update of the GBSA parameters in the simulation **and**
in the attached :class:`Topology`
:param index: : GB to be reset
:param radius: New radius in nm
:param scaling: New OBC scaling
:type index: :class:`int`
:type radius: :class:`float`
:type scaling: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of particles
.. method:: ResetCharge(index,charge)
Update of the charge in the simulation **and**
in the attached :class:`Topology`
:param index: Charge to be reset
:param charge: New Charge
:type index: :class:`int`
:type charge: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of particles
.. method:: ResetMass(index,mass)
Update of the mass in the simulation **and**
in the attached :class:`Topology`
This requires to reinitialize the internal openmm Context
(this is expensive!). Positions, velocities, forces, energies etc.
are properly preserved but e.g. states of random number generators etc.
might be lost.
:param index: Mass to be reset
:param mass: New mass
:type index: :class:`int`
:type mass: :class:`float`
:raises: :class:`RuntimeError` when **index** exceeds
number of particles
|