pyiron.sphinx.base module

class pyiron.sphinx.base.Group(*args, **kwargs)[source]

Bases: pyiron_base.generic.inputlist.InputList

Dictionary-like object to store SPHInX inputs.

Attributes (sub-groups, parameters, & flags) can be set and accessed via dot notation, or as standard dictionary key/values.

to_{job_type} converts the Group to the format expected by the given DFT code in its input files.

remove(name)[source]
set(name, content)[source]
set_flag(flag, val=True)[source]
set_group(name, content=None)[source]
set_parameter(parameter, val)[source]
to_sphinx(content='__self__', indent=0)[source]
class pyiron.sphinx.base.InputWriter[source]

Bases: object

The Sphinx Input writer is called to write the Sphinx specific input files.

copy_potentials(potformat='JTH', xc=None, cwd=None, pot_path_dict=None)[source]
property id_pyi_to_spx
property id_spx_to_pyi
write_spin_constraints(file_name='spins.in', cwd=None, spins_list=None)[source]

Write a text file containing a list of all spins named spins.in - which is used for the external control scripts.

Parameters
  • file_name (str) – name of the file to be written (optional)

  • cwd (str) – the current working directory (optinal)

  • spins_list (list) – the input to write, if no input is given the default input will be written. (optional)

class pyiron.sphinx.base.Output(job)[source]

Bases: object

Handles the output from a Sphinx simulation.

collect(directory='/home/docs/checkouts/readthedocs.org/user_builds/pyiron/checkouts/latest/docs')[source]

The collect function, collects all the output from a Sphinx simulation.

Parameters

directory (str) – the directory to collect the output from.

collect_charge_density(file_name, cwd)[source]
collect_electrostatic_potential(file_name, cwd)[source]
collect_energy_dat(file_name='energy.dat', cwd=None)[source]
Parameters
  • file_name

  • cwd

Returns:

collect_energy_struct(file_name='energy-structOpt.dat', cwd=None)[source]
Parameters
  • file_name

  • cwd

Returns:

collect_eps_dat(file_name='eps.dat', cwd=None)[source]
Parameters
  • file_name

  • cwd

Returns:

collect_relaxed_hist(file_name='relaxHist.sx', cwd=None)[source]
Parameters
  • file_name

  • cwd

Returns:

collect_residue_dat(file_name='residue.dat', cwd=None)[source]
Parameters
  • file_name

  • cwd

Returns:

collect_sphinx_log(file_name='sphinx.log', cwd=None, check_consistency=True)[source]
Parameters
  • file_name

  • cwd

Returns:

collect_spins_dat(file_name='spins.dat', cwd=None)[source]
Parameters
  • file_name

  • cwd

Returns:

from_hdf(hdf)[source]

Load output from an HDF5 file

static splitter(arr, counter)[source]
to_hdf(hdf, force_update=False)[source]

Store output in an HDF5 file

Parameters
  • hdf – HDF5 group

  • force_update (bool) –

class pyiron.sphinx.base.SphinxBase(project, job_name)[source]

Bases: pyiron.dft.job.generic.GenericDFTJob

Class to setup and run Sphinx simulations.

Inherits pyiron_atomistics.job.generic.GenericJob. The functions in these modules are written such that the function names and attributes are very Pyiron-generic (get_structure(), molecular_dynamics(), version) but internally handle Sphinx specific input and output.

Alternatively, because SPHInX inputs are built on a group-based format, users have the option to set specific groups and parameters directly, e.g.

`python # Modify/add a new parameter via job.input.PAWHamiltonian.nEmptyStates = 15 job.input.PAWHamiltonian.dipoleCorrection = True # or job.input.PAWHamiltonian.set("nEmptyStates", 15) job.input.PAWHamiltonian.set("dipoleCorrection", True) # Modify/add a sub-group via job.input.initialGuess.rho.charged = {"charge": 2, "z": 25} # or job.input.initialGuess.rho.set("charged", {"charge": 2, "z": 25}) `

Parameters
  • project – Project object (defines path where job will be created and stored)

  • job_name (str) – name of the job (must be unique within this project path)

calc_md(temperature=None, n_ionic_steps=1000, n_print=1, time_step=1.0, retain_charge_density=False, retain_electrostatic_potential=False, **kwargs)[source]
calc_minimize(electronic_steps=60, ionic_steps=None, max_iter=None, pressure=None, algorithm=None, retain_charge_density=False, retain_electrostatic_potential=False, ionic_energy=None, ionic_forces=None, ionic_energy_tolerance=0.0, ionic_force_tolerance=0.01, volume_only=False)[source]

Setup the hamiltonian to perform ionic relaxations.

The convergence goal can be set using either the ionic_energy_tolerance as a limit for fluctuations in energy or the ionic_force_tolerance.

Loads defaults for all Sphinx input groups, including a ricQN-based main Group.

Parameters
  • retain_electrostatic_potential

  • retain_charge_density

  • algorithm

  • pressure

  • max_iter

  • electronic_steps (int) – maximum number of electronic steps per electronic convergence

  • ionic_steps (int) – maximum number of ionic steps

  • ionic_energy_tolerance (float) – convergence goal in terms of energy (optional)

  • ionic_force_tolerance (float) – convergence goal in terms of forces (optional)

calc_static(electronic_steps=100, algorithm=None, retain_charge_density=False, retain_electrostatic_potential=False)[source]

Setup the hamiltonian to perform a static SCF run.

Loads defaults for all Sphinx input groups, including a static main Group.

Parameters
  • electronic_steps (int) – max # of electronic steps

  • retain_electrostatic_potential

  • retain_charge_density

  • algorithm (str) – CCG or blockCCG (not implemented)

  • electronic_steps – maximum number of electronic steps which can be used to achieve convergence

check_setup()[source]

Checks whether certain parameters (such as plane wave cutoff radius in DFT) are changed from the pyiron standard values to allow for a physically meaningful results. This function is called manually or only when the job is submitted to the queueing system.

static check_vasp_potentials()[source]
collect_errors()[source]

Collects errors from the Sphinx run

collect_logfiles()[source]

Collect errors and warnings.

collect_output(force_update=False)[source]

Collects the outputs and stores them to the hdf file

collect_warnings()[source]

Collects warnings from the Sphinx run

compress(files_to_compress=None)[source]

Compress the output files of a job object.

Parameters

files_to_compress (list) – A list of files to compress (optional)

convergence_check()[source]

Checks if job has converged according to given cutoffs.

property exchange_correlation_functional
property fix_spin_constraint
from_directory(directory, file_name='structure.sx')[source]
from_hdf(hdf=None, group_name=None)[source]

Recreates instance from the hdf5 file

Parameters
  • hdf (str) – Path to the hdf5 file

  • group_name (str) – Name of the group which contains the object

get_charge_density()[source]

Gets the charge density from the hdf5 file. This value is normalized by the volume

Returns

pyiron.atomistics.volumetric.generic.VolumetricData

get_electrostatic_potential()[source]

Gets the electrostatic potential from the hdf5 file.

Returns

pyiron.atomistics.volumetric.generic.VolumetricData

get_n_ir_reciprocal_points(is_time_reversal=True, symprec=1e-05, ignore_magmoms=False)[source]
get_scf_group(maxSteps=None, keepRhoFixed=False, dEnergy=None, algorithm='blockCCG')[source]

SCF group setting for SPHInX for all args refer to calc_static or calc_minimize

get_structure_group(keep_angstrom=False)[source]

create a Sphinx Group object based on self.structure

Parameters

keep_angstrom (bool) – Store distances in Angstroms or Bohr

get_version_float()[source]
property id_pyi_to_spx
property id_spx_to_pyi
load_basis_group()[source]

Load the basis Group.

The group is populated using setdefault to avoid overwriting values that were previously (intentionally) modified.

load_default_groups()[source]

Populates input groups with the default values.

Nearly every default simply points to a variable stored in self.input.

Does not load job.input.structure or job.input.pawPot. These groups should usually be modified via job.structure, in which case they will be set at the last minute when the job is run. These groups can be synced to job.structure at any time using job.load_structure_group() and job.load_species_group().

load_default_input()[source]

Set defaults for generic parameters and create sphinx input groups.

load_guess_group(update_spins=True)[source]

Load the initialGuess Group.

The group is populated using setdefault to avoid overwriting values that were previously (intentionally) modified.

Parameters

update_spins (bool) – whether or not to reload the atomicSpin groups based on the latest structure. Defaults to True.

load_hamilton_group()[source]

Load the PAWHamiltonian Group.

The group is populated using setdefault to avoid overwriting values that were previously (intentionally) modified.

load_main_group()[source]

Load the main Group.

The group is populated based on the type of calculation and settings in the self.input.

load_species_group(check_overlap=True, potformat='VASP')[source]

Build the species Group object based on self.structure

Parameters
  • check_overlap (bool) – Whether to check overlap (see set_check_overlap)

  • potformat (str) – type of pseudopotentials that will be read. Options are JTH or VASP.

load_structure_group(keep_angstrom=False)[source]

Build + load the structure group based on self.structure

Parameters

keep_angstrom (bool) – Store distances in Angstroms or Bohr

property plane_wave_cutoff
restart(job_name=None, job_type=None, from_charge_density=True, from_wave_functions=True)[source]

Restart a new job created from an existing calculation. :param project: Project instance at which the new job should be created :type project: pyiron.project.Project instance :param job_name: Job name :type job_name: str :param job_type: Job type :type job_type: str

Returns

New job

Return type

new_ham

restart_for_band_structure_calculations(job_name=None)[source]

Restart a new job created from an existing calculation by reading the charge density for band structures.

Parameters

job_name (str/None) – Job name

Returns

new job instance

Return type

pyiron.sphinx.sphinx.sphinx

restart_from_charge_density(job_name=None, job_type='Sphinx', band_structure_calc=False)[source]

Restart a new job created from an existing calculation by reading the charge density.

Parameters
  • job_name (str/None) – Job name

  • job_type (str/None) – Job type. If not specified a Sphinx job type is assumed (actually this is all that’s currently supported)

  • band_structure_calc (bool) – has to be True for band structure calculations.

Returns

new job instance

Return type

pyiron.sphinx.sphinx.sphinx

restart_from_wave_functions(job_name=None, job_type='Sphinx')[source]

Restart a new job created from an existing calculation by reading the wave functions.

Parameters
  • job_name (str) – Job name

  • job_type (str) – Job type. If not specified a Sphinx job type is assumed (actually this is all that’s currently supported.)

Returns

new job instance

Return type

pyiron.sphinx.sphinx.sphinx

set_check_overlap(check_overlap=True)[source]
Parameters

check_overlap (bool) – Whether to check overlap

Comments:

Certain PAW-pseudo-potentials have an intrinsic pathology: their PAW overlap operator is not generally positive definite (i.e., the PAW-corrected norm of a wavefunction could become negative). SPHInX usually refuses to use such problematic potentials. This behavior can be overridden by setting check_overlap to False.

set_convergence_precision(ionic_energy_tolerance=None, ionic_force_tolerance=None, ionic_energy=None, electronic_energy=None, ionic_forces=None)[source]

Sets the electronic and ionic convergence precision.

For ionic convergence either the energy or the force precision is required.

Parameters
  • ionic_energy_tolerance (float) – Ionic energy convergence precision

  • electronic_energy (float) – Electronic energy convergence precision

  • ionic_force_tolerance (float) – Ionic force convergence precision

set_empty_states(n_empty_states=None)[source]

Function to set the number of empty states.

Parameters
  • n_empty_states (int/None) – Number of empty states.

  • None (If) –

  • it to 'auto'. (sets) –

Comments:

If this number is too low, the algorithm will not be able to able to swap wave functions near the chemical potential. If the number is too high, computation time will be wasted for the higher energy states and potentially lead to a memory problem.

In contrast to VASP, this function sets only the number of empty states and not the number of total states.

The default value is 0.5*NIONS+3 for non-magnetic systems and 1.5*NIONS+3 for magnetic systems

set_input_to_read_only()[source]

This function enforces read-only mode for the input classes, but it has to be implemented in the individual classes.

set_mixing_parameters(method=None, n_pulay_steps=None, density_mixing_parameter=None, spin_mixing_parameter=None)[source]
Parameters
  • method ('PULAY' or 'LINEAR') – mixing method (default: PULAY)

  • n_pulay_steps (int) – number of previous densities to use for the Pulay mixing (default: 7)

  • density_mixing_parameter (float) –

    mixing proportion m defined by

    rho^n = (m-1)*rho^(n-1)+m*preconditioner*rho_(opt) (default: 1)

  • spin_mixing_parameter (float) – linear mixing parameter for spin densities (default: 1)

comments:

A low value of density mixing parameter may lead to a more stable convergence, but will slow down the calculation if set too low.

Further information can be found on the website: https://sxrepo.mpie.de

set_occupancy_smearing(smearing=None, width=None)[source]

Set how the finite temperature smearing is applied in determining partial occupancies

Parameters
  • smearing (str) – Type of smearing (only fermi is implemented anything else will be ignored)

  • width (float) – Smearing width (eV) (default: 0.2)

to_hdf(hdf=None, group_name=None)[source]

Stores the instance attributes into the hdf5 file

Parameters
  • hdf (str) – Path to the hdf5 file

  • group_name (str) – Name of the group which contains the object

validate_ready_to_run()[source]

Checks whether parameters are set appropriately. It does not mean the simulation won’t run if it returns False.

write_input()[source]

Generate all the required input files for the Sphinx job.

Creates: structure.sx: structure associated w/ job all pseudopotential files spins.in (if necessary): constrained spin moments input.sx: main input file with all sub-groups

Automatically called by job.run()