gulp
gulp_string_to_slab(contents, vacuum=15.0)
Read a Slab from a GULP surface input (svectors and sfractional).
Region 2 atoms are marked fixed; shells are skipped. GULP surfaces have
no third vector, so the slab is placed in a cell with vacuum
Angstroms between images.
Source code in chmpy/fmt/gulp.py
parse_drv_file(drv_path)
Parse GULP .drv file to extract energy, gradients, and stress.
The .drv file format:
Line 1: energy
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drv_path
|
Path
|
Path to the .drv file |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing 'energy', 'gradients', and 'stress_raw' |
Source code in chmpy/fmt/gulp.py
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 | |
parse_elastic_constants(contents)
The elastic constant matrix GULP prints under the property keyword.
GULP computes these analytically, which makes them a reference for a finite-difference calculation rather than another estimate of the same kind.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contents
|
str
|
the text of a GULP output file |
required |
Returns:
| Type | Description |
|---|---|
ndarray | None
|
(6, 6) elastic constants in GPa, or None if the output has none |
Source code in chmpy/fmt/gulp.py
parse_value(string, with_units=False)
parse a value from a GULP output file to its appropriate type e.g. int, float, str etc. Will handle units with a space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
the string containing the value to parse |
required | |
with_uncertainty
|
return a tuple including uncertainty if a numeric type is expected |
required |
Returns:
| Type | Description |
|---|---|
|
the value coerced into the appropriate type |
parse_value("2.3 kj/mol", with_units=True) (2.3, 'kj/mol') parse_value("5 kgm^2", with_units=True) (5, 'kgm^2') parse_value("string help") 'string help' parse_value("3.1415") * 4 12.566
Source code in chmpy/fmt/gulp.py
slab_to_gulp_input(slab, keywords=None, fixed=None, charges=None, additional_keywords=None, bulk_energy=None)
GULP input for a 2D periodic slab.
The surface vectors are given by svectors and positions by
sfractional, with the top of the slab at z = 0. Fixed atoms are
written as region 2, which GULP holds fixed as the underlying bulk and
excludes from the surface energy, so the energy reported is that of the
top face; the rest are region 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slab
|
Slab |
required | |
keywords
|
GULP keywords |
None
|
|
fixed
|
(N,) boolean mask of region 2 atoms; defaults to |
None
|
|
charges
|
optional per atom (or, for cut slabs, per asymmetric unit atom) charges |
None
|
|
additional_keywords
|
dict of extra options written after the coordinates |
None
|
|
bulk_energy
|
energy (eV) of the bulk primitive cell; when given,
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
GULP input contents |