pychemia.code.octopus package

Set of classes and functions to manipulate

OCTOPUS ‘inp’ input files

pychemia.code.octopus.coordinates(dirname)[source]

Reads the ‘coordinates’ file and extracts its data as the numpy arrays ‘positions’,’velocities’ and ‘forces’.

Each of those arrays has the following structure:

Args:
dirname:
The path were the octopus data is produced
Returns:
natom:
Number of atoms
iterations:
Array with iterations
times:
Array with times
positions:
positions[0:MaxIteration,0:natom,0:3]
velocities:
velocities[0:MaxIteration,0:natom,0:3]
forces:
forces[0:MaxIteration,0:natom,0:3]
pychemia.code.octopus.energy(dirname)[source]

Reads the ‘energy’ file and extracts its data as the numpy arrays ‘Total’,’Kinetic’, etc.

Args:
dirname:
The directory where the octopus data was produced
Returns:
iterations:
numpy array of iterations recorded
times:
numpy array with time for each iteration
energy_dict:
dictionary of numpy arrays with values of Total, Kinetic (ions), Ion-Ion, Electronic, Eigenvalues, Hartree, Int[n v_xc], Exchange and Correlation

Submodules

pychemia.code.octopus.analysis module

Useful routines to get physical data from octopus TD runs

pychemia.code.octopus.analysis.change_kinetic_energy(dirname, iteration=None)[source]

Change of Kinetic energy respect to initial value

Parameters:
  • dirname – (str) Directory to read
  • iteration – (int) Iteration number to read
Returns:

pychemia.code.octopus.analysis.charge_in_sphere(dirname, iteration=None, radius=4.5, spin=None)[source]

Get the value at a given index of the data stored in the NetCDF file

Parameters:
  • dirname – (str) Directory to read
  • iteration – (int) Number of iteration to read
  • radius – (float) Radius of the sphere to integrate
  • spin – (int) Spin contribution to read
Returns:

pychemia.code.octopus.analysis.deflection(dirname, iteration=None)[source]

Get the deflection angle respect to the initial velocity for all the atoms and for a given iteration and spin.

Args:
dirname:
The directory where the octopus data was produced
iteration:
Iteration to make the difference, if absent the last iteration will be taken
Returns:
A numpy array for the number of atoms with the Hirsfeld charges
pychemia.code.octopus.analysis.dipolx_in_sphere(dirname, iteration=None, radius=4.5, spin=None)[source]

Get the value at a given index of the data stored in the NetCDF file

Parameters:
  • dirname – (str) Directory to read
  • iteration – (int) Number of iteration to read
  • radius – (float) Radius of the sphere to integrate
  • spin – (int) Spin contribution to read
Returns:

pychemia.code.octopus.analysis.get_last_iteration(dirname)[source]

Get the last “td.xxxxxxx” found in dirname

Parameters:dirname – (str) Directory to take last information
Returns:
pychemia.code.octopus.analysis.hirshfeld(dirname, iteration=None, spin=None)[source]

Get the Hirshfeld charge analysis for all the atoms comparing for a given iteration and spin.

Args:
dirname:
The directory where the octopus data was produced
iteration:
Iteration to make the difference, if absent the last iteration will be taken
spin:
Integer with the spin for which the data will be taken, if absent the addition of both spins will be returned
Returns:
A numpy array for the number of atoms with the Hirsfeld charges
pychemia.code.octopus.analysis.magnitude_velocity(dirname, iteration=None)[source]

Magnitude of velocity for each atom

Parameters:
  • dirname – (str) Directory to analyse velocities
  • iteration – (int) Number of iteration to use
Returns:

pychemia.code.octopus.analysis.value_in_sphere(dirname, keys, iteration=None, radius=4.5, spin=None)[source]

Compute the value of a certain scalar quantity inside a sphere of a given radius

Parameters:
  • dirname – (str) Directory to read
  • keys – (list) Variables to read the scalar quantity
  • iteration – (int) Number of iteration to read
  • radius – (float) Radius of the sphere to integrate
  • spin – (int) Spin contribution to read
Returns:

pychemia.code.octopus.input module

Routines anc Classes to manipulate Octopus Inputs

class pychemia.code.octopus.input.InputVariables(filename=None)[source]

Bases: object

Manipulate an octopus input file

write(filename)[source]

Write an input dictionary into a file the variables are sort by kind and written in their respective place

Parameters:filename – (str) Filename for the octopus input that will be created
class pychemia.code.octopus.input.OpenDX(filename)[source]

Bases: object

Manipulate the OpenDX file generated by octopus

integrate_x()[source]

Compute the Integral in the X direction

pychemia.code.octopus.input.execute(basedir, num_threads=1, num_procs=2)[source]

Call octopus in parallel with a given number of threads and MPI process

Parameters:
  • basedir – (str) Working directory for execution
  • num_threads – (int) Number of OpenMP Threads to use
  • num_procs – (int) Number of MPI processes to create
pychemia.code.octopus.input.get_vars()[source]

Get a list of all the variables in octopus

pychemia.code.octopus.merge module

class pychemia.code.octopus.merge.OctopusOccupancies(basedir)[source]

Bases: object

write(filename)[source]
class pychemia.code.octopus.merge.OctopusRestart(basedir)[source]

Bases: object

class pychemia.code.octopus.merge.OctopusStates(basedir)[source]

Bases: object

write(filename)[source]
class pychemia.code.octopus.merge.OctopusStatesFile(basedir)[source]

Bases: object

class pychemia.code.octopus.merge.OctopusWavefunctions(basedir)[source]

Bases: object

write(filename)[source]
pychemia.code.octopus.merge.merge_restart(dir1, dir2, dest, mksym1=True, mksym2=False)[source]

Merge the restart directories (dir1 and dir2) into the destination (dest)

pychemia.code.octopus.merge.oct_merge(res1, res2, basedir, mksym1, mksym2)[source]