graph2mat.tools.server.api_client

Simple HTTP client to interact with the server.

Classes

ServerClient([url, host, port])

Client to interact easily with the e3nn server.

class graph2mat.tools.server.api_client.ServerClient(url: str | None = None, host: str | None = 'localhost', port: int | None = 56000)[source]

Bases: object

Client to interact easily with the e3nn server.

Parameters:
  • url (str or None, optional) –

    Root url where the server is running.

    If it is set to None, the environment variable E3MAT_SERVER_URL will be used if present.

    If it is set to None and the environment variable is not present, the url will be constructed from the values of host and port.

  • host (str or None, optional) –

    Host where the server is running.

    If it is set to None, the environment variable E3MAT_SERVER_HOST will be used if present, otherwise the default value of host will be used.

  • port (int, optional) –

    Port where the server is listening.

    If it is set to None, the environment variable E3MAT_SERVER_PORT will be used if present, otherwise the default value of port will be used.

__init__(url: str | None = None, host: str | None = 'localhost', port: int | None = 56000)[source]
avail_models() List[str][source]

Returns the models that are available in the server.

host: str | None
port: int | None
predict(geometry: str | Path | Geometry, output: str | Path | Type[SparseOrbital], model: str, local: bool = False) Path | SparseOrbital[source]

Predicts the matrix for a given geometry.

Parameters:
  • geometry (Union[str, sisl.Geometry]) – Either the path to the geometry file or the geometry itself.

  • output (Union[str, Type[sisl.SparseOrbital]]) – Either the path to the file where the prediction should be saved or the type of the object to be returned.

  • model (str) – Name of the model to use for the prediction. This model must be available in the server. You can check the available models with the avail_models method.

  • local (bool) – Whether the paths (if given) are in the local filesystem.

root_url: str