Externals¶
Optional integrations with third-party tools.
LigParGen (OPLS-AA parameters)¶
mdinterface.externals.ligpargen.refine_large_specie_topology(specie, Nmax=12, ending='H', offset=True, segment_size=200)
¶
Assign OPLS-AA force-field parameters to a Specie via LigParGen using
a segment-and-junction strategy.
The molecule is split into segments of at most segment_size atoms along clean backbone bonds (avoiding rings, heteroatoms, and their immediate neighbours). Each segment is capped with ending atoms and passed to LigParGen independently. A local snippet centred on each cut bond is then refined to correct parameters for atoms adjacent to a cap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specie
|
Specie
|
The molecule to parametrise. Modified in place. |
required |
Nmax
|
int
|
Neighbourhood radius (in bonds) used for junction snippet creation. Default 12. |
12
|
ending
|
str
|
Element used to cap dangling bonds at segment boundaries. Default
|
'H'
|
offset
|
bool
|
If |
True
|
segment_size
|
int
|
Maximum number of atoms per segment. Default 200. Lower values force more splits and are useful for testing. |
200
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
RuntimeError
|
If not enough valid cut bonds can be found. |
Source code in mdinterface/externals/ligpargen.py
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 | |
RESP charges (PySCF)¶
mdinterface.externals.pyscf.calculate_RESP_charges(specie, basis='def2-svpd', xc='b3lyp', calc_type='RKS', gpu=True, optimize=False, maxit=250)
¶
Source code in mdinterface/externals/pyscf.py
Structure relaxation (ASE)¶
mdinterface.externals.optimization.relax_structure(atoms, optimizer='FIRE', fmax=0.05, steps=200, trajectory=None, logfile=None, **kwargs)
¶
Perform structure relaxation using ASE optimizers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atoms
|
Atoms
|
The atomic structure to relax |
required |
optimizer
|
str
|
Optimizer to use ('BFGS', 'LBFGS', 'FIRE') |
'BFGS'
|
fmax
|
float
|
Maximum force threshold for convergence (eV/Å) |
0.05
|
steps
|
int
|
Maximum number of optimization steps |
200
|
trajectory
|
str
|
Path to save optimization trajectory |
None
|
logfile
|
str
|
Path to save optimization log |
None
|
**kwargs
|
Additional arguments passed to the optimizer |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
relaxed_atoms |
Atoms
|
The relaxed atomic structure |
converged |
bool
|
Whether the optimization converged |
Source code in mdinterface/externals/optimization.py
AIMD (FAIRChem)¶
mdinterface.externals.aimd.run_aimd(atoms, timestep=0.5, temperature_K=300, friction=0.1, steps=1000, trajectory=None, logfile=None, **kwargs)
¶
Perform Ab Initio Molecular Dynamics (AIMD) using ASE and FAIRChem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atoms
|
Atoms
|
The atomic structure to run the AIMD on. |
required |
timestep
|
float
|
Time step for the simulation in fs. |
0.1
|
temperature_K
|
float
|
Target temperature for the Langevin dynamics in Kelvin. |
300
|
friction
|
float
|
Frictional damping coefficient in 1/fs. |
0.001
|
steps
|
int
|
Number of time steps to run the AIMD. |
1000
|
trajectory
|
str
|
Path to save the MD trajectory. |
None
|
logfile
|
str
|
Path to save the MD log. |
None
|
**kwargs
|
Additional arguments passed to the Langevin integrator. |
{}
|
Returns:
| Type | Description |
|---|---|
Atoms
|
The atomic structure after AIMD simulation. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If fairchem is not installed. |
ValueError
|
If there's an error loading FAIRChem models. |