Externals¶
Optional integrations with third-party tools.
LigParGen (OPLS-AA parameters)¶
mdinterface.externals.ligpargen.LigParGenError
¶
Bases: RuntimeError
LigParGen configuration, execution, or output-processing failure.
Source code in mdinterface/externals/ligpargen.py
mdinterface.externals.ligpargen.run_ligpargen(system, charge=None, is_snippet=False)
¶
Generate OPLS-AA parameters by running LigParGen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
Atoms
|
Atomic system to parameterize. Stored RDKit chemistry is transferred through MOL files; coordinate-only inputs use XYZ and Open Babel. |
required |
charge
|
int or None
|
Total molecular charge. LigParGen detects it when omitted. |
None
|
is_snippet
|
bool
|
Whether the system is a capped molecular snippet. |
False
|
Returns:
| Type | Description |
|---|---|
tuple
|
Parameterized system, atom types, bonds, angles, dihedrals, and impropers. |
Raises:
| Type | Description |
|---|---|
LigParGenError
|
If LigParGen or BOSS is not configured, execution fails, or the output is missing or unreadable. |
Source code in mdinterface/externals/ligpargen.py
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 | |
mdinterface.externals.ligpargen.refine_large_specie_topology(specie, snippet_radius=12, cap_element='H', charge_correction='none', segment_size=200)
¶
Assign LigParGen parameters atomically; see Specie.parameterize.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specie
|
Specie
|
Species to parameterize without changing its coordinates. |
required |
snippet_radius
|
int
|
Graph radius for junction snippets. |
12
|
cap_element
|
str
|
Neutral monovalent capping element. |
"H"
|
charge_correction
|
(none, uniform)
|
Optional uniform correction to the molecular charge. |
"none"
|
segment_size
|
int
|
Maximum segment size including caps, at most 200. |
200
|
Returns:
| Type | Description |
|---|---|
dict
|
Charge audit. No changes are applied if any calculation fails. |
Source code in mdinterface/externals/ligpargen.py
RESP charges (PySCF)¶
mdinterface.externals.pyscf.calculate_RESP_charges(specie, basis='def2-svpd', xc='b3lyp', calc_type='RKS', gpu=True, optimize=False, maxit=250, charge=None)
¶
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. |