PolTensor

This module defines the PolTensor workflow.

class mybigdft.workflows.poltensor.PolTensor(ground_state, ef_amplitudes=None, order=1)[source]

Bases: mybigdft.workflows.workflow.AbstractWorkflow

This workflow allows to compute the (electronic) polarizability tensor of a given system.

The polarizability tensor represents the response of the charges of a system (its dipole) to the application of an external electric field.

To compute this polarizability tensor, some BigDFT calculations are performed, where the system is subject to an external electric field along each direction of space (\(x\), \(y\) and \(z\)). The elements of the polarizability tensor are then defined by the ratio of the delta of the dipole in one direction and the delta of the electric field amplitudes:

\[\alpha_{ij} = \frac{\Delta D_i}{\Delta E_j}\]

where \(i, j \in \{x, y, z\}\), \(\Delta D_i\) is the variation of the dipole along the \(i\) direction and \(\Delta E_j\) is the variation of the electric field amplitude along the \(j\) direction.

A PolTensor workflow is initialized by the job of the ground- state of the system and three electric field amplitudes.

Parameters
  • ground_state (Job) – Job used to compute the ground state of the system under consideration.

  • ef_amplitudes (list or numpy array of length 3) – Amplitude of the electric field to be applied in the three directions of space (\(x\), \(y\), \(z\)).

  • order (int) – Order of the numerical differentiation used to compute the polarizability tensor. If second order (resp. first), then six (resp. three) calculations per atom are to be performed.

property ground_state
Returns

Job of the ground state of the system under consideration.

Return type

Job

property ef_amplitudes
Returns

Amplitude of the electric field to be applied in the three directions of space (\(x\), \(y\), \(z\)).

Return type

list or numpy array of length 3

property order
Returns

order – Order of the numerical differentiation used to compute the polarizability tensor. If second order (resp. first), then six (resp. three) calculations per atom are to be performed.

Return type

int

property pol_tensor
Returns

Polarizability tensor of the system (units: atomic).

Return type

numpy.array

property mean_polarizability
Returns

Mean (electronic) polarizability of the system (units: atomic).

Return type

float

property efields
Returns

Electric fields the system must undergo before computing the polarizability tensor as post-processing. There are three or six of them (one or two per space coordinate, depending on the order of the numerical derivative procedure) if the forward or central difference scheme is used, respectively.

Return type

OrderedDict of length 3 or 6

post_proc()[source]

Compute the polarisability tensor and set its value (you can access its value via the attribute pol_tensor).

property is_completed
Returns

True if all the post-processing attributes are no longer set to their default value.

Return type

bool

property logfiles
Returns

A dictionary of all the logfiles of the workflow, with the name of the associated job as key.

Return type

dict

property queue
Returns

All the jobs of the workflow.

Return type

list

run(nmpi=1, nomp=1, force_run=False, dry_run=False, restart_if_incomplete=False, timeout=None)

Run all the calculations if the post-processing was not already performed.

Warning

If force_run or dry_run is set to True, then any previous value of the post-processing attributes is deleted and set back to their default value, so that the post-processing is not considered as being performed.

Parameters
  • nmpi (int) – Number of MPI tasks.

  • nomp (int) – Number of OpenMP tasks.

  • force_run (bool) – If True, the calculations are run even though a logfile already exists.

  • dry_run (bool) – If True, the input files are written on disk, but the bigdft-tool command is run instead of the bigdft one.

  • restart_if_incomplete (bool) – If True, the job is restarted if the existing logfile is incomplete.

  • timeout (float or int or None) – Number of minutes after which each job must be stopped.

Warns

UserWarning – If the post-processing was already completed.

class mybigdft.workflows.poltensor.ElectricField[source]

Bases: mybigdft.workflows.poltensor.ElectricField

This class defines an electric field from the coordinate index and the amplitude of the electric field in that direction.

Create new instance of ElectricField(i_coord, amplitude)

property vector
Returns

ElectricField vector.

Return type

list

property amplitude

Alias for field number 1

count()

Return number of occurrences of value.

property i_coord

Alias for field number 0

index()

Return first index of value.

Raises ValueError if the value is not present.