pyiron.sphinx.base module

class pyiron.sphinx.base.Input(input_file_name=None, table_name='input')[source]

Bases: pyiron.base.generic.parameters.GenericParameters

class to control the generic input for a Sphinx calculation.

Parameters:
  • input_file_name (str) – name of the input file
  • table_name (str) – name of the GenericParameters table
load_default()[source]

Loads the default file content

class pyiron.sphinx.base.InputWriter[source]

Bases: object

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

static get_main(enable_kjxc=False, spin_constraint_enabled=False, job_name=None)[source]
id_pyi_to_spx
id_spx_to_pyi
pot_path_dict = {'LDA': 'paw-lda', 'PBE': 'paw-gga-pbe'}
write_basis(file_name='basis.sx', cwd=None, basis_str=None, save_memory=False)[source]

Write the Sphinx bases set configuration file named basis.sx

Parameters:
  • file_name (str) – name of the file to be written (optional)
  • cwd (str) – the current working directory (optinal)
  • basis_str (str) – the input to write, if no input is given the default input will be written. (optinal)
write_control(file_name='control.sx', cwd=None, control_str=None)[source]

Write the Sphinx control script named control.sx

Parameters:
  • file_name (str) – name of the file to be written (optional)
  • cwd (str) – the current working directory (optinal)
  • control_str (OrderedDict) – the input to write, if no input is given the default input will be written.
write_guess(file_name='guess.sx', cwd=None, guess_str=None, restart_file_str=[], write_waves=False)[source]

Write the Sphinx initial guess configuration file named guess.sx

Parameters:
  • file_name (str) – name of the file to be written (optional)
  • cwd (str) – the current working directory (optinal)
  • guess_str (str) – the input to write, if no input is given the default input will be written. (optinal)
write_hamilton(file_name='hamilton.sx', cwd=None, hamilston_str=None)[source]

Write the Sphinx hamilton configuration file named hamilton.sx

Parameters:
  • file_name (str) – name of the file to be written (optional)
  • cwd (str) – the current working directory (optinal)
  • hamilston_str (list) – the input to write, if no input is given the default input will be written. (optinal)
write_main(file_name='input.sx', cwd=None, main_str=None, spin_constraint_enabled=False, enable_kjxc=False, job_name=None)[source]

Write the main Sphinx script named input.sx.

Parameters:
  • file_name (str) – name of the file to be written (optional)
  • cwd (str) – the current working directory (optinal)
  • main_str (str) – the input to write; if no input is given, the default input will be written. (optinal)
write_potentials(file_name='potentials.sx', cwd=None, species_str=None, check_overlap=True, xc=None)[source]

Write the Sphinx potential configuration named potentials.sx.

Parameters:
  • file_name (str) – name of the file to be written (optional)
  • cwd (str) – the current working directory (optional)
  • species_str (str) – the input to write, if no input is given the default input will be written. (optional)
write_spins_constraints(file_name='spins.in', cwd=None, spins_str=None)[source]

Write a text file containing a list of all spins named spin.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_str (str) – the input to write, if no input is given the default input will be written. (optinal)
write_structure(file_name='structure.sx', cwd=None, structure_str=None, symmetry_enabled=True, keep_angstrom=False)[source]

Write the Sphinx structure file named structure.sx

Parameters:
  • file_name (str) – name of the file to be written (optional)
  • cwd (str) – the current working directory (optinal)
  • structure_str (str) – the input to write, if no input is given the default input will be written. (optinal)
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_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 which is a derivative of pyiron_atomistics.job.generic.GenericJob. The functions in these modules are written in such the function names and attributes are very generic (get_structure(), molecular_dynamics(), version) but the functions are written to handle Sphinx specific input and output.

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=None, ionic_steps=None, max_iter=None, pressure=None, algorithm=None, retain_charge_density=False, retain_electrostatic_potential=False, ionic_energy=None, ionic_forces=None, volume_only=False)[source]

Function to setup the hamiltonian to perform ionic relaxations using DFT. The convergence goal can be set using either the iconic_energy as an limit for fluctuations in energy or the iconic_forces. :param retain_electrostatic_potential: :param retain_charge_density: :param algorithm: :param pressure: :param max_iter: :param electronic_steps: maximum number of electronic steps per electronic convergence :type electronic_steps: int :param ionic_steps: maximum number of ionic steps :type ionic_steps: int :param ionic_energy: convergence goal in terms of energy (optional) :type ionic_energy: float :param ionic_forces: convergence goal in terms of forces (optional) :type ionic_forces: float

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

Function to setup the hamiltonian to perform static SCF DFT runs

Parameters:
  • retain_electrostatic_potential
  • retain_charge_density
  • algorithm (str) – CCG or blockCCG (not implemented)
  • electronic_steps (int) – 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.

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]

Validate the convergence of the calculation.

Returns:If the calculation is converged
Return type:(bool)
exchange_correlation_functional
fix_spin_constraint
from_directory(directory)[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_n_ir_reciprocal_points(is_time_reversal=True, symprec=1e-05, ignore_magmoms=False)[source]
id_pyi_to_spx
id_spx_to_pyi
plane_wave_cutoff
restart(snapshot=-1, 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 snapshot: Snapshot of the calculations which would be the initial structure of the new job :type snapshot: int :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_from_charge_density(job_name=None)[source]

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

Parameters:job_name (str) – Job name (full path required)
Returns:None (currently the SPHInX implementation does not allow for a restart via return value)
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=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 (float) – Ionic energy convergence precision (eV)
  • electronic_energy (float) – Electronic energy convergence precision (eV)
  • ionic_forces (float) – Ionic force convergence precision (eV/A)
set_empty_states(n_empty_states=None)[source]

Function to set the number of empty states.

Parameters:n_empty_states (int or 'auto') – Number of empty states. ‘auto’ if the default value is to be used.
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 implement 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 si 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 even if it returns False

write_input()[source]

The write_input function is called when the job is executed to generate all the required input files for the calculation of the Sphinx job.