phonons
This module, 'phonons.py', contains recipes for performing phonon calculations using the ph.x binary from Quantum ESPRESSO via the quacc library.
The recipes provided in this module are jobs and flows that can be used to perform phonon calculations in different fashion.
PhononDosSchema ¶
dvscf_q2r_job ¶
dvscf_q2r_job(
copy_files: (
SourceDirectory
| list[SourceDirectory]
| dict[SourceDirectory, Filenames]
| None
) = None,
prev_outdir: SourceDirectory | None = None,
parallel_info: dict[str] | None = None,
**calc_kwargs
) -> RunSchema
Function to carry out a basic dvscf_q2r calculation allowing phonon potential interpolation from coarse to fine q-point grids using Fourier interpolation. It should allow you to use all the features of the dvscf_q2r binary which does not have an official documentation.
To use this, run a quacc.recipes.espresso.phonons.phonon_job on a coarse q-point
grid, dvscf_q2r.x can then be used to inverse Fourier transform the phonon potentials
to a real-space supercell, you can later run an additional
quacc.recipes.espresso.phonons.phonon_job with ldvscf_interpolation = True
to Fourier transform the potentials to desired q points.
Only one card, &input:
prefix : Prepended to input/output filenames, default: 'pwscf' outdir : Directory containing input, output, and scratch files. In quacc this is always set to the current working directory. fildyn : File where the dynamical matrix is written. In quacc this should always be set to 'matdyn'. fildvscf : File where the potential variation is written. In quacc this should always be set to 'dvscf'. (character, Default: 'dvscf') wpot_dir : Directory where the w_pot binary files are written. In quacc this is always set to outdir / w_pot do_long_range : If .true., subtract the long-range part of the potential before interpolation. Requires epsilon and Born effective charge data in _ph0/prefix.phsave/tensor.xml. default: .false. do_charge_neutral : If .true., renormalize phonon potential to impose neutrality of Born effective charges. default: .false. verbosity : If 'high', write more information to stdout.
Parameters:
-
copy_files
(SourceDirectory | list[SourceDirectory] | dict[SourceDirectory, Filenames] | None
, default:None
) –Source directory or directories to copy files from. If a
SourceDirectory
or a list ofSourceDirectory
is provided, this interface will automatically guess which files have to be copied over by looking at the binary andinput_data
. If a dict is provided, the mode is manual, keys are source directories and values are relative path to files or directories to copy. Glob patterns are supported. -
prev_outdir
(SourceDirectory | None
, default:None
) –The output directory of a previous calculation. If provided, Quantum Espresso will directly read the necessary files from this directory, eliminating the need to manually copy files. The directory will be ungzipped if necessary.
-
parallel_info
(dict[str] | None
, default:None
) –Dictionary containing information about the parallelization of the calculation. See the ASE documentation for more information.
-
**calc_kwargs
–Additional keyword arguments to pass to the Espresso calculator. Set a value to
quacc.Remove
to remove a pre-existing key entirely. See the docstring of quacc.calculators.espresso.espresso.Espresso for more information.
Returns:
-
RunSchema
–Dictionary of results from quacc.schemas.ase.summarize_run. See the type-hint for the data structure.
Source code in quacc/recipes/espresso/phonons.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
grid_phonon_flow ¶
grid_phonon_flow(
atoms: Atoms,
nblocks: int = 1,
job_params: dict[str, Any] | None = None,
job_decorators: (
dict[str, Callable | None] | None
) = None,
) -> RunSchema
This function performs grid parallelization of a ph.x calculation. Each representation of each q-point is calculated in a separate job, allowing for distributed computation across different machines and times.
The grid parallelization is a technique to make phonon calculation embarrassingly parallel. This function should return similar results to quacc.recipes.espresso.phonons.phonon_job. If you don't know about grid parallelization please consult the Quantum Espresso user manual and exemples.
This approach requires the data of the pw.x calculation to be copied to each job, leading to a total data size on the disk of n*m times the size of the pw.x calculation, where: - n is the number of q-points - m is the number of representations
In addition to the data produced by each ph.x calculation. This can result in large data sizes for systems with many atoms.
To mitigate this, an optional "nblocks" argument can be provided. This groups multiple representations together in a single job, reducing the data size by a factor of nblocks, but also reducing the level of parallelization. In the case of nblocks = 0, each job will contain all the representations for each q-point.
Consists of following jobs that can be modified:
-
pw.x relaxation
- name: "relax_job"
- job: quacc.recipes.espresso.core.relax_job
-
ph.x calculation test_run
- name: "ph_init_job"
- job: quacc.recipes.espresso.phonons.phonon_job
-
(n * m) / nblocks ph.x calculations
- name: "ph_job"
- job: quacc.recipes.espresso.phonons.phonon_job
-
ph.x calculation to gather data and diagonalize each dynamical matrix
- name: "ph_recover_job"
- job: quacc.recipes.espresso.phonons.phonon_job
Parameters:
-
atoms
(Atoms
) –Atoms object
-
nblocks
(int
, default:1
) –The number of representations to group together in a single job. This will reduce the amount of data produced by a factor of nblocks. If nblocks = 0, each job will contain all the representations for a single q-point.
-
job_params
(dict[str, Any] | None
, default:None
) –Custom parameters to pass to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are dictionaries of parameters.
-
job_decorators
(dict[str, Callable | None] | None
, default:None
) –Custom decorators to apply to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are decorators.
Returns:
-
RunSchema
–Dictionary of results from quacc.schemas.ase.summarize_run. See the type-hint for the data structure.
Source code in quacc/recipes/espresso/phonons.py
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 |
|
matdyn_job ¶
matdyn_job(
copy_files: (
SourceDirectory
| list[SourceDirectory]
| dict[SourceDirectory, Filenames]
| None
) = None,
parallel_info: dict[str] | None = None,
**calc_kwargs
) -> RunSchema
Function to carry out a basic matdyn.x
calculation. It should allow you to use
all the features of the matdyn.x binary
This program calculates the phonon frequencies for a list of generic
q vectors starting from the interatomic force constants generated
from the dynamical matrices as written by DFPT phonon code through
the program q2r.x
Parameters:
-
copy_files
(SourceDirectory | list[SourceDirectory] | dict[SourceDirectory, Filenames] | None
, default:None
) –Source directory or directories to copy files from. If a
SourceDirectory
or a list ofSourceDirectory
is provided, this interface will automatically guess which files have to be copied over by looking at the binary andinput_data
. If a dict is provided, the mode is manual, keys are source directories and values are relative path to files or directories to copy. Glob patterns are supported. -
parallel_info
(dict[str] | None
, default:None
) –Dictionary containing information about the parallelization of the calculation. See the ASE documentation for more information.
-
**calc_kwargs
–Additional keyword arguments to pass to the Espresso calculator. Set a value to
quacc.Remove
to remove a pre-existing key entirely. See the docstring of quacc.calculators.espresso.espresso.Espresso for more information.
Returns:
-
RunSchema
–Dictionary of results from quacc.schemas.ase.summarize_run. See the type-hint for the data structure.
Source code in quacc/recipes/espresso/phonons.py
phonon_dos_flow ¶
phonon_dos_flow(
atoms: Atoms,
job_params: dict[str, Any] | None = None,
job_decorators: (
dict[str, Callable | None] | None
) = None,
) -> PhononDosSchema
Function to carry out a phonon DOS calculation. The phonon calculation is carried out on a coarse q-grid, the force constants are calculated and extrapolated to a finer q-grid, and the phonon DOS is calculated.
Consists of following jobs that can be modified:
- pw.x relaxation
- name: "relax_job"
- job: quacc.recipes.espresso.core.relax_job
- ph.x calculation
- name: "phonon_job"
- job: quacc.recipes.espresso.phonons.phonon_job
- q2r.x calculation
- name: "q2r_job"
- job: quacc.recipes.espresso.phonons.q2r_job
- matdyn.x calculation
- name: "matdyn_job"
- job: quacc.recipes.espresso.phonons.matdyn_job
Parameters:
-
atoms
(Atoms
) –Atoms object to calculate the phonon DOS.
-
job_params
(dict[str, Any] | None
, default:None
) –Custom parameters to pass to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are dictionaries of parameters.
-
job_decorators
(dict[str, Callable | None] | None
, default:None
) –Custom decorators to apply to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are decorators.
Returns:
-
RunSchema
–Dictionary of results from quacc.schemas.ase.summarize_run. See the type-hint for the data structure.
Source code in quacc/recipes/espresso/phonons.py
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 |
|
phonon_job ¶
phonon_job(
copy_files: (
SourceDirectory
| list[SourceDirectory]
| dict[SourceDirectory, Filenames]
| None
) = None,
prev_outdir: SourceDirectory | None = None,
parallel_info: dict[str] | None = None,
test_run: bool = False,
use_phcg: bool = False,
**calc_kwargs
) -> RunSchema
Function to carry out a basic ph.x calculation. It should allow you to use all the features of the ph.x binary
ph.x
calculates the dynamical matrix at a set of q-points within the Density
Functional Perturbation Theory (DFPT) framework. The dynamical matrix is used to calculate the phonon frequencies and eigenvectors. Various other properties can be
calculated using other post-processing tools.
Parameters:
-
copy_files
(SourceDirectory | list[SourceDirectory] | dict[SourceDirectory, Filenames] | None
, default:None
) –Source directory or directories to copy files from. If a
SourceDirectory
or a list ofSourceDirectory
is provided, this interface will automatically guess which files have to be copied over by looking at the binary andinput_data
. If a dict is provided, the mode is manual, keys are source directories and values are relative path to files or directories to copy. Glob patterns are supported. -
prev_outdir
(SourceDirectory | None
, default:None
) –The output directory of a previous calculation. If provided, Quantum Espresso will directly read the necessary files from this directory, eliminating the need to manually copy files. The directory will be ungzipped if necessary.
-
parallel_info
(dict[str] | None
, default:None
) –Dictionary containing information about the parallelization of the calculation. See the ASE documentation for more information.
-
test_run
(bool
, default:False
) –If True, a test run is performed to check that the calculation input_data is correct or to generate some files/info if needed.
-
use_phcg
(bool
, default:False
) –If True, the calculation is performed using the
phcg.x
code which uses a faster algorithm. It can be used only if you sample the Brillouin Zone at Gamma and you only need the phonon modes at Gamma (molecules typically). It cannot be used with spin-polarization, USPP and PAW. -
**calc_kwargs
–Additional keyword arguments to pass to the Espresso calculator. Set a value to
quacc.Remove
to remove a pre-existing key entirely. See the docstring of quacc.calculators.espresso.espresso.Espresso for more information.
Returns:
-
RunSchema
–Dictionary of results from quacc.schemas.ase.summarize_run. See the type-hint for the data structure.
Source code in quacc/recipes/espresso/phonons.py
postahc_job ¶
postahc_job(
copy_files: (
SourceDirectory
| list[SourceDirectory]
| dict[SourceDirectory, Filenames]
| None
) = None,
prev_outdir: SourceDirectory | None = None,
parallel_info: dict[str] | None = None,
**calc_kwargs
) -> RunSchema
Function to carry out a basic postahc calculation. It should allow you to use all the features of the postahc.x binary
Calculate the phonon-induced electron self-energy in the full matrix form
at a given temperature. This requires the results of a previous ph.x calculation
with electron_phonon='ahc'
self energies calculated and printed by postahc.x
- Total self-energy in the on-shell approximation (OSA)
- Debye-Waller self-energy in the RIA
- Total Fan self-energy in the OSA
- Upper Fan self-energy
- Lower Fan self-energy in the OSA
Parameters:
-
copy_files
(SourceDirectory | list[SourceDirectory] | dict[SourceDirectory, Filenames] | None
, default:None
) –Source directory or directories to copy files from. If a
SourceDirectory
or a list ofSourceDirectory
is provided, this interface will automatically guess which files have to be copied over by looking at the binary andinput_data
. If a dict is provided, the mode is manual, keys are source directories and values are relative path to files or directories to copy. Glob patterns are supported. -
prev_outdir
(SourceDirectory | None
, default:None
) –The output directory of a previous calculation. If provided, Quantum Espresso will directly read the necessary files from this directory, eliminating the need to manually copy files. The directory will be ungzipped if necessary.
-
parallel_info
(dict[str] | None
, default:None
) –Dictionary containing information about the parallelization of the calculation. See the ASE documentation for more information.
-
**calc_kwargs
–Additional keyword arguments to pass to the Espresso calculator. Set a value to
quacc.Remove
to remove a pre-existing key entirely. See the docstring of quacc.calculators.espresso.espresso.Espresso for more information.
Returns:
-
RunSchema
–Dictionary of results from quacc.schemas.ase.summarize_run. See the type-hint for the data structure.
Source code in quacc/recipes/espresso/phonons.py
q2r_job ¶
q2r_job(
copy_files: (
SourceDirectory
| list[SourceDirectory]
| dict[SourceDirectory, Filenames]
| None
) = None,
parallel_info: dict[str] | None = None,
**calc_kwargs
) -> RunSchema
Function to carry out a basic q2r.x calculation. It should allow you to use all the features of the q2r.x binary
q2r.x
reads force constant matrices C(q) produced by the ph.x
code
for a grid of q-points and calculates the corresponding set
of interatomic force constants (IFC), C(R)
Parameters:
-
copy_files
(SourceDirectory | list[SourceDirectory] | dict[SourceDirectory, Filenames] | None
, default:None
) –Source directory or directories to copy files from. If a
SourceDirectory
or a list ofSourceDirectory
is provided, this interface will automatically guess which files have to be copied over by looking at the binary andinput_data
. If a dict is provided, the mode is manual, keys are source directories and values are relative path to files or directories to copy. Glob patterns are supported. -
parallel_info
(dict[str] | None
, default:None
) –Dictionary containing information about the parallelization of the calculation. See the ASE documentation for more information.
-
**calc_kwargs
–Additional keyword arguments to pass to the Espresso calculator. Set a value to
quacc.Remove
to remove a pre-existing key entirely. See the docstring of quacc.calculators.espresso.espresso.Espresso for more information.
Returns:
-
RunSchema
–Dictionary of results from quacc.schemas.ase.summarize_run. See the type-hint for the data structure.