principia_materia.phonon_id.finite_displacements module

class principia_materia.phonon_id.finite_displacements.FiniteDisplacements(structure, supa, fdtype='c', tol=1e-06)

Bases: object

Finite difference on atomic displacements.

This class serves as core finite displacement engine for the package.

Parameters:
  • structure (CrystalFTG object or a structure file of CrystalFTG) – The crystal structure.

  • supa (array of int, shape(dim, dim)) – Supercell matrix.

  • fdtype (str, choice of ["c", "f", "b"]) – Type of finite displacement.

  • tol (float, optional, default to 1.0E-6) – Error tolerence.

add_delta(delta)
compute_finite_displacements(fill=0.0)

Compuzeroste fintie displacements derivatives.

Parameters:

fill (float, optional, default to 0.0) – The fill value for the steps having zero displacements.

create_jobs(job_handler, prefix=None, config_file='finite_displacements.yml', append=False, dry_run=False)

Create compute jobs for the finite displacements calculations.

Parameters:
  • job_handler (ComputeJobSeries or JobsDB) – The interface to create and collect result from compute jobs or a database.

  • prefix (str, optional, default to None) – Prefix to the jobnames.

  • config_file (str, optional, default to "finite_displacements.yml") – The name of the finite displacements configuration file.

  • dry_run (bool, optional, default to False) – If True, don’t actually create the job.

property delta

The displacement amplitutes.

property get_jobname

Return a jobname template function.

If attribute “_jobname_template” is set, return the value in the attribute, otherwise, return the default template.

set_delta(delta, overwrite=False)

Set the deltas to compute for the finite displacements calculations.

Parameters:

delta (float or array of float) – The displacement amplitute.

set_displacement_vectors(dispvecs, displabels, order=None)

Setup displacement vectors for the finite displacement calculation.

Parameters:
  • dispvecs (array of float, shape(N, natoms, dim)) – Displacement vectors.

  • displabels (list, lenth of N) – The name of the displacements.

  • order (tuple of int, length of N) – The order of derivatives.

set_jobname_template(template)

Set custom jobname template

Must be def template(job_id, prefix, index_pad): …

Parameters:

template (callable, with parameters (job_id, prefix, index_pad)) – The jobname template function.

set_jobs(jobname_prefix='', skip_zero=False)
Parameters:

jobname_prefix (str) – Prefix for jobnames.

set_raw_results(source, data_type=None, prefix=None)
Parameters:
  • source (ComputeJobSeries or JobsDB or Numpy array) – Either a ComputeJobSeries or a JobsDB object as the interface to the jobs. Or an Numpy array that is the output of the finite displacements jobs.

  • data_type (str) – The type of data to retrieve.

  • prefix (str, optional, default to None) – Prefix to the jobnames.

property uniq_displacements

The displacement amplitutes that are unique.

principia_materia.phonon_id.finite_displacements.get_FD_from_configuration(config_file, file_type='yaml', tol=1e-06)

Read data from configuration file and construct a FiniteDisplacements object.

Parameters:
  • config_file (str) – Path to configuration file.

  • file_type (str, optional, default to "yaml") – The type of the configuration file.

  • tol (float, optional, default to 1.0E-6) – Error tolerance.

principia_materia.phonon_id.finite_displacements.get_fd_config_hdf5_wrapper()

HDF5 data wrapper for FiniteDifference class.

principia_materia.phonon_id.finite_displacements.get_fd_config_yaml_wrapper(title='Finite Displacements Configuration')

YAML data wrapper for FiniteDisplacements class.

principia_materia.phonon_id.finite_displacements.get_fd_results_hdf5_wrapper()

HDF5 data wrapper for FiniteDifference class.

principia_materia.phonon_id.finite_displacements.get_fd_results_yaml_wrapper(title='Finite Displacements Results')
principia_materia.phonon_id.finite_displacements.save_FD_config_to_hdf5(obj, directory, filename='finite_displacements.hdf5', overwrite=False)

Save finite displacements configuration in HDF5

Parameters:
  • directory (str) – The directory of the finite displacements dft jobs.

  • filename (str, optional, default to "finite_displacements.hdf5") – The name of the configuration file.

  • overwrite (bool, optional, default to False) – When the file exists, whether to replace the content of the file with the content to be saved.

principia_materia.phonon_id.finite_displacements.save_FD_config_to_yaml(obj, directory, filename='finite_displacements.yml', overwrite=False)

Save finite displacements configuration in HDF5

Parameters:
  • directory (str) – The directory of the finite displacements dft jobs.

  • filename (str, optional, default to "finite_displacements.yml") – The name of the configuration file.

  • overwrite (bool, optional, default to False) – When the file exists, whether to replace the content of the file with the content to be saved.