principia_materia.phonon_id.strained_finite_displacements module

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

Bases: FiniteDisplacements

Compute finite difference of strain and displacements.

The class is capable of compute strain derivatives without atomic displacements, as well as derivatives of atomic displacements without strains.

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.

create_jobs(job_handler, prefix=None, config_file='strained_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.

property order
set_delta(delta)

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_finite_difference(overwrite=False)

Initialize the finite difference object.

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=True)
Parameters:

jobname_prefix (str) – Prefix for jobnames.

set_strain(strain, strain_orders=None)

Set strain basis and derivative order of each basis.

Parameters:
  • strain (array of float)

  • strain_orders (int or array of int)

set_strain_delta(strain_delta)

Set the perturbation amplitudes to compute strain derivatives.

Parameters:

strain_delta (float or array of float)

set_strain_internal_displacements(strains, internal_displacements)
property strain_delta
property uniq_strains
principia_materia.phonon_id.strained_finite_displacements.get_StrainedFD_from_configuration(config_file, file_type='yaml', tol=1e-06)

Read data from configuration file and construct a StrainedFiniteDisplacements 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.strained_finite_displacements.get_strain_fd_config_hdf5_wrapper()
principia_materia.phonon_id.strained_finite_displacements.get_strain_fd_config_yaml_wrapper(title='Strained Finite Displacements Configuration')
principia_materia.phonon_id.strained_finite_displacements.save_StrainedFD_config_to_hdf5(obj, directory, filename='strained_finite_displacements.hdf5')

Save strained 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.

principia_materia.phonon_id.strained_finite_displacements.save_StrainedFD_config_to_yaml(obj, directory, filename='strained_finite_displacements.yml', overwrite=False)

Save strained 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.