sparc.quicktest module

A simple test module for sparc python api Usage: python -m sparc.quicktest

class sparc.quicktest.ApiTest[source]

Bases: BaseTest

Check if the API can be loaded, and store the Schema version.

# TODO: consider change to schema instead of api # TODO: allow config to change json file path Error handling: - Check if default JSON schema exists in

<sparc-x-api-root>/sparc_json_api/parameters.json

  • Use $SPARC_DOC_PATH to specify the raw LaTeX files

display_name = 'JSON API'
make_test()[source]

Each class should implement ways to update result and info

class sparc.quicktest.BaseTest[source]

Bases: object

Base class for all tests providing functionalities

Each child class will implement its own run_test method to update the result, error_handling and info fields.

If you wish to include a simple error handling message for each child class, add a line starting Error handling follows by the helper message at the end of the docstring

property dislay_name
display_docstring()[source]

Convert the class’s docstring to error handling

make_test()[source]

Each class should implement ways to update result and info

run_test()[source]

Run test and update result etc. If result is False, update the error handling message

class sparc.quicktest.CommandTest[source]

Bases: BaseTest

Check validity of command to run SPARC calculation. This test also checks sparc version and socket compatibility

# TODO: check ase 3.23 config with separate binary Error handling: - The command prefix to run SPARC calculation should look like

<mpi instructions> <sparc binary>

  • Use $ASE_SPARC_COMMAND to set the command string

  • Check HPC resources and compatibility (e.g. srun on a login node)

display_name = 'SPARC Command'
make_test()[source]

Each class should implement ways to update result and info

class sparc.quicktest.FileIOCalcTest[source]

Bases: BaseTest

Run a simple calculation in File IO mode.

# TODO: check ase 3.23 config Error handling: - Check if settings for pseudopotential files are correct - Check if SPARC binary exists and functional - Check if specific HPC requirements are met:

(module files, libraries, parallel settings, resources)

display_name = 'Calculation (File I/O)'
make_test()[source]

Each class should implement ways to update result and info

class sparc.quicktest.ImportTest[source]

Bases: BaseTest

Check if external io format sparc can be registered in ASE

Error handling: - Make sure SPARC-X-API is installed via conda / pip / setuptools - If you wish to work on SPARC-X-API source code, use pip install -e

instead of setting up $PYTHON_PATH

display_name = 'Import'
make_test()[source]

Each class should implement ways to update result and info

class sparc.quicktest.PspTest[source]

Bases: BaseTest

Check at least one directory of Pseudopotential files exist info[psp_dir] contains the first psp dir found on system # TODO: check if all psp files can be located #TODO: update to the ASE 3.23 config method

Error handling: - Default version of psp files can be downloaded by

python -m sparc.download_data

  • Alternatively, specify the variable $SPARC_PSP_PATH to the custom pseudopotential files

display_name = 'Pseudopotential'
make_test()[source]

Each class should implement ways to update result and info

class sparc.quicktest.SocketCalcTest[source]

Bases: BaseTest

Run a simple calculation in Socket mode (UNIX socket).

# TODO: check ase 3.23 config Error handling: - The same as error handling in file I/O calculation test - Check if SPARC binary supports socket

display_name = 'Calculation (UNIX socket)'
make_test()[source]

Each class should implement ways to update result and info

sparc.quicktest.main()[source]