UppASD_AiiDA.utils package
Submodules
UppASD_AiiDA.utils.inpsd_parser module
Utilties to convert between inpsd text format, Python dict, and JSON output
- UppASD_AiiDA.utils.inpsd_parser.autoconvert(s)[source]
Convert values to optimal(…) type.
- Parameters
s – data to be converted to proper type
Credit: Stack Exchange
- UppASD_AiiDA.utils.inpsd_parser.d2e(d)[source]
Convert Fortran double precision exponents to Python single
- Parameters
d – string containing exponent
- UppASD_AiiDA.utils.inpsd_parser.dict_to_JSON(inpdict, f=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]
Print dict on JSON format
Hand-written routine is preferred since the standard implementation has issues with numpy arrays and insists on line-breaking lists ad nauseum
The function prints either to the screen or to a file if defined
- Parameters
inpdict – The dict that will be printed
f – file handle for writing to file (optional parameter)
- UppASD_AiiDA.utils.inpsd_parser.dict_to_inpsd(inpdict, f=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]
Print dict as UppASD input format
The function prints either to the screen or to a file if defined
- Parameters
inpdict – The dict that will be printed
f – file handle for writing to file (optional parameter)
- UppASD_AiiDA.utils.inpsd_parser.dq(s)[source]
Add double quotes around strings for JSON
- Parameters
s – string to be decorated with double quotes
- UppASD_AiiDA.utils.inpsd_parser.inpsd_to_dict(f)[source]
Read UppASD input to Python dict
The function defaults to single value for every key but exceptions are handled by the pre-defined lists “vecarg_list” and “special_list”. Currently all keywords except spatial temperature gradients are supported.
- Parameters
f – file handle to read from