pyiron.sphinx.base module¶
-
class
pyiron.sphinx.base.
Group
(*args, **kw)[source]¶ Bases:
dict
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.
-
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
-
class
pyiron.sphinx.base.
InputWriter
[source]¶ Bases:
object
The Sphinx Input writer is called to write the Sphinx specific input files.
-
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)
-
property
-
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/pyiron-0.2.17/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_struct
(file_name='energy-structOpt.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:
-
-
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=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]¶ Setup the hamiltonian to perform ionic relaxations.
The convergence goal can be set using either the ionic_energy as a limit for fluctuations in energy or the ionic_forces.
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 (float) – convergence goal in terms of energy (optional)
ionic_forces (float) – convergence goal in terms of forces (optional)
-
calc_static
(electronic_steps=None, 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.
-
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)
-
property
exchange_correlation_functional
¶
-
property
fix_spin_constraint
¶
-
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_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
-
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_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 GenericParameters (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=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/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