sparc.calculator module
- class sparc.calculator.SPARC(restart=None, directory='.', *, label=None, atoms=None, command=None, psp_dir=None, log='sparc.log', sparc_json_file=None, sparc_doc_path=None, check_version=False, keep_old_files=True, use_socket=False, socket_params={}, **kwargs)[source]
Bases:
FileIOCalculator
,IOContext
Calculator interface to the SPARC codes via the FileIOCalculator
- ase_objtype = 'sparc_calculator'
- atoms_dict()
- calculate(atoms=None, properties=['energy'], system_changes=['positions', 'numbers', 'cell', 'pbc', 'initial_charges', 'initial_magmoms'])[source]
Perform a calculation step
- check_input_atoms(atoms)[source]
Check if input atoms are valid for SPARC inputs. :raises ValueError: if the atoms structure is not suitable for SPARC input file
- check_state(atoms, tol=1e-08)[source]
Updated check_state method. By default self.atoms (cached from output files) contains the initial_magmoms, so we add a zero magmoms to the atoms for comparison if it does not exist.
reading a result from the .out file has only precision up to 10 digits
- concatinate_output()
- default_params = {'h': 0.25, 'kpts': (1, 1, 1), 'xc': 'pbe'}
- dict_atoms()
- property directory
- estimate_memory(atoms=None, units='GB', **kwargs)[source]
a function to estimate the amount of memory required to run the selected calculation. This function takes in **kwargs, but if none are passed in, it will fall back on the parameters input when the class was instantiated
- execute()[source]
Make a normal SPARC calculation without socket. Note we probably need to use a better handling of background process!
- generate_command(**kwargs)
- get_geometric_steps(**kwargs)
- get_pseudopotential_directory(**kwargs)
- implemented_properties: List[str] = ['energy', 'forces', 'fermi', 'stress']
Properties calculator can handle (energy, forces, …)
- property in_socket_filename
- interpret_downsampling_input(**kwargs)
- interpret_grid_input(**kwargs)
- interpret_kpoint_input(**kwargs)
- interpret_kpoint_shift(**kwargs)
- property label
Rewrite the label from Calculator class, since we don’t want to contain pathsep
- property log
- name = 'sparc'
- parse_MD()
- parse_input_args()
- parse_output()
- parse_relax()
- property pid
The pid for the stored process
- property raw_results
- read_line()
- recover_index_order_from_ion_file()
- property resort
Like Vasp calculator SPARC –> resort –> ASE atoms
- setup_parallel_env(**kwargs)
- property socket_mode
The mode of the socket calculator:
disabled: pure SPARC file IO interface local: Serves as a local SPARC calculator with socket support client: Relay SPARC calculation server: Remote server
- property sort
Like Vasp calculator ASE atoms –> sort –> SPARC
- special_inputs = ['xc', 'h', 'kpts', 'convergence', 'gpts', 'nbands']
- property use_socket