atomict 0.1.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. atomict/__init__.py +1 -1
  2. atomict/__version__.py +1 -0
  3. atomict/api.py +182 -0
  4. atomict/auth.py +47 -0
  5. atomict/cli/commands/adsorbate.py +183 -0
  6. atomict/cli/commands/ai_assist.py +111 -0
  7. atomict/cli/commands/catalysis.py +171 -0
  8. atomict/cli/commands/common.py +57 -0
  9. atomict/cli/commands/exploration/__init__.py +7 -0
  10. atomict/cli/commands/exploration/soec.py +564 -0
  11. atomict/cli/commands/exploration/sqs.py +440 -0
  12. atomict/cli/commands/helpers.py +74 -0
  13. atomict/cli/commands/k8s.py +211 -0
  14. atomict/cli/commands/login.py +34 -0
  15. atomict/cli/commands/organization.py +76 -0
  16. atomict/cli/commands/project.py +876 -0
  17. atomict/cli/commands/simulation/__init__.py +20 -0
  18. atomict/cli/commands/simulation/catalysis.py +223 -0
  19. atomict/cli/commands/simulation/fhiaims.py +279 -0
  20. atomict/cli/commands/simulation/kpoint.py +380 -0
  21. atomict/cli/commands/simulation/vibes.py +161 -0
  22. atomict/cli/commands/simulation.py +176 -0
  23. atomict/cli/commands/task.py +181 -0
  24. atomict/cli/commands/upload.py +89 -0
  25. atomict/cli/commands/user.py +201 -0
  26. atomict/cli/core/client.py +202 -0
  27. atomict/cli/core/config.py +43 -0
  28. atomict/cli/core/utils.py +32 -0
  29. atomict/cli/main.py +130 -0
  30. atomict/env.py +79 -0
  31. atomict/exceptions.py +12 -0
  32. atomict/infra/distwork/environment.py +26 -0
  33. atomict/infra/distwork/task.py +49 -0
  34. atomict/infra/logging.py +22 -0
  35. atomict/io/cif.py +138 -0
  36. atomict/io/fhiaims.py +30 -0
  37. atomict/io/json.py +28 -0
  38. atomict/io/utils.py +11 -0
  39. atomict/ml/__init__.py +0 -0
  40. atomict/ml/model.py +13 -0
  41. atomict/project/__init__.py +1 -0
  42. atomict/project/link.py +26 -0
  43. atomict/project/note.py +18 -0
  44. atomict/project/project.py +32 -0
  45. atomict/project/tags.py +48 -0
  46. atomict/project/workbench.py +6 -0
  47. atomict/reality/__init__.py +0 -0
  48. atomict/reality/oqmd.py +5 -0
  49. atomict/reality/slabs.py +5 -0
  50. atomict/simulation/__init__.py +0 -0
  51. atomict/simulation/cantera.py +35 -0
  52. atomict/simulation/catalysis.py +20 -0
  53. atomict/simulation/counterfactual.py +28 -0
  54. atomict/simulation/ea.py +64 -0
  55. atomict/simulation/fhi_aims.py +72 -0
  56. atomict/simulation/kpoint.py +74 -0
  57. atomict/simulation/mattergen.py +20 -0
  58. atomict/simulation/mlrelax.py +83 -0
  59. atomict/simulation/phonon.py +12 -0
  60. atomict/simulation/qe.py +74 -0
  61. atomict/simulation/sqs.py +24 -0
  62. atomict/simulation/utils.py +90 -0
  63. atomict/user/__init__.py +0 -0
  64. atomict/user/files.py +31 -0
  65. atomict/user/workspace.py +112 -0
  66. atomict/utils/fhiaims/__init__.py +0 -0
  67. atomict/utils/fhiaims/geometry.py +73 -0
  68. atomict/utils/tenacity.py +36 -0
  69. {atomict-0.1.2.dist-info → atomict-0.2.4.dist-info}/LICENSE +0 -0
  70. atomict-0.2.4.dist-info/METADATA +109 -0
  71. atomict-0.2.4.dist-info/RECORD +78 -0
  72. {atomict-0.1.2.dist-info → atomict-0.2.4.dist-info}/WHEEL +1 -1
  73. atomict-0.2.4.dist-info/entry_points.txt +2 -0
  74. {atomict-0.1.2.dist-info → atomict-0.2.4.dist-info}/top_level.txt +0 -1
  75. atomict/__main__.py +0 -3
  76. atomict/cli.py +0 -59
  77. atomict/datasets/__init__.py +0 -25
  78. atomict/datasets/io.py +0 -47
  79. atomict/datasets/public.py +0 -32
  80. atomict/utils/requests.py +0 -19
  81. atomict/version.py +0 -2
  82. atomict-0.1.2.dist-info/METADATA +0 -97
  83. atomict-0.1.2.dist-info/RECORD +0 -19
  84. atomict-0.1.2.dist-info/entry_points.txt +0 -2
  85. tests/test_sdk.py +0 -16
  86. /atomict/{auth → cli}/__init__.py +0 -0
  87. /atomict/{utils → infra}/__init__.py +0 -0
  88. {tests → atomict/infra/distwork}/__init__.py +0 -0
  89. /tests/test_cli.py → /atomict/io/__init__.py +0 -0
@@ -0,0 +1,20 @@
1
+ from atomict.api import get, post
2
+
3
+
4
+ def get_mattergen(id: str):
5
+ """
6
+ Get MatterGen
7
+ """
8
+ result = get(f"api/mattergen-exploration/{id}/")
9
+ return result
10
+
11
+
12
+ def associate_user_upload_with_mattergen(user_upload_id: str, exploration_id: str):
13
+ """
14
+ Associate a user upload with a MatterGen
15
+ """
16
+ result = post(
17
+ "api/mattergen-exploration-file/",
18
+ payload={"user_upload_id": user_upload_id, "exploration_id": exploration_id},
19
+ )
20
+ return result
@@ -0,0 +1,83 @@
1
+ from atomict.api import get, post
2
+
3
+ COMPUTATION_TYPE_RELAXATION = 0
4
+ COMPUTATION_TYPE_SINGLE_POINT = 1
5
+
6
+ MODEL_ORB_D3_V2 = 0
7
+ MODEL_MATTERSIM_1_0_0_5M = 1
8
+
9
+
10
+ def get_mlrelax(id: str):
11
+ """
12
+ Get MLRelaxation
13
+ """
14
+ result = get(f"api/mlrelax/{id}/")
15
+ return result
16
+
17
+
18
+ def associate_user_upload_with_mlrelaxation(user_upload_id: str, mlrelax_id: str):
19
+ """
20
+ Associate a user upload with a MLRelaxation
21
+ """
22
+ result = post(
23
+ "api/mlrelax-file/",
24
+ payload={"user_upload_id": user_upload_id, "mlrelax_id": mlrelax_id},
25
+ )
26
+ return result
27
+
28
+
29
+ def create_mlrelaxation(
30
+ project_id: str,
31
+ source_geometry_id: str,
32
+ action: str,
33
+ name: str = None,
34
+ description: str = None,
35
+ computation_type: int = COMPUTATION_TYPE_RELAXATION,
36
+ f_max: float = None,
37
+ model: int = MODEL_ORB_D3_V2,
38
+ extra_simulation_kwargs: dict = None,
39
+ ):
40
+ """
41
+ Create a MLRelaxation
42
+ """
43
+
44
+ if action not in ["DRAFT", "LAUNCH"]:
45
+ raise ValueError("Action must be 'DRAFT' or 'LAUNCH'")
46
+
47
+ if computation_type not in [
48
+ COMPUTATION_TYPE_RELAXATION,
49
+ COMPUTATION_TYPE_SINGLE_POINT,
50
+ ]:
51
+ raise ValueError(
52
+ "Invalid computation type. Please use COMPUTATION_TYPE_RELAXATION (0) or COMPUTATION_TYPE_SINGLE_POINT (1)."
53
+ )
54
+
55
+ if model not in [MODEL_ORB_D3_V2, MODEL_MATTERSIM_1_0_0_5M]:
56
+ raise ValueError(
57
+ "Invalid model. Please use MODEL_ORB_D3_V2 (0) or MODEL_MATTERSIM_1_0_0_5M (1)."
58
+ )
59
+
60
+ payload = {
61
+ "project": project_id,
62
+ "source_geometry_id": source_geometry_id,
63
+ "action": action,
64
+ "name": name,
65
+ "description": description,
66
+ "computation_type": computation_type,
67
+ "f_max": f_max,
68
+ "model": model,
69
+ }
70
+
71
+ if extra_simulation_kwargs:
72
+ payload.update(extra_simulation_kwargs)
73
+
74
+ result = post("api/mlrelax/", payload)
75
+ return result
76
+
77
+
78
+ def get_mlrelax_files(mlrelax_id: str):
79
+ """
80
+ Get the files associated with a MLRelaxation
81
+ """
82
+ result = get(f"api/mlrelax-file/?mlrelax__id={mlrelax_id}")
83
+ return result
@@ -0,0 +1,12 @@
1
+ from atomict.api import post
2
+
3
+
4
+ def associate_user_upload_with_phonon_analysis(user_upload_id: str, pa_id: str):
5
+ """
6
+ Associate a user upload with a Phonon Analysis
7
+ """
8
+ result = post(
9
+ "api/phonon-analysis-file/",
10
+ payload={"user_upload_id": user_upload_id, "analysis_id": pa_id},
11
+ )
12
+ return result
@@ -0,0 +1,74 @@
1
+ from atomict.api import delete, get, post
2
+
3
+
4
+ def create_simulation(
5
+ project_id: str,
6
+ input_file: str,
7
+ action: str,
8
+ name: str = None,
9
+ description: str = None,
10
+ **kwargs,
11
+ ) -> dict:
12
+
13
+ if action not in ["DRAFT", "LAUNCH"]:
14
+ raise ValueError("Action must be 'DRAFT' or 'LAUNCH'")
15
+
16
+ payload = {
17
+ "project": project_id,
18
+ "input_file": input_file,
19
+ "action": action,
20
+ "name": name,
21
+ "description": description,
22
+ }
23
+
24
+ payload.update(kwargs)
25
+
26
+ result = post(
27
+ "api/qe-simulation/",
28
+ payload,
29
+ extra_headers={"Content-Type": "application/json"},
30
+ )
31
+
32
+ return result
33
+
34
+
35
+ def get_simulation_by_name(name: str) -> dict:
36
+ result = get(f"api/qe-simulation/?name={name}")
37
+ return result["results"][0]
38
+
39
+
40
+ def get_simulation(simulation_id: str):
41
+ """
42
+ Get a Quantum Espresso simulation
43
+ """
44
+ result = get(f"api/qe-simulation/{simulation_id}/")
45
+ return result
46
+
47
+
48
+ def delete_simulation(simulation_id):
49
+ """
50
+ Delete a Quantum Espresso simulation
51
+ """
52
+ result = delete(f"api/qe-simulation/{simulation_id}/")
53
+ return result
54
+
55
+
56
+ def associate_user_upload_with_qe_simulation(
57
+ user_upload_id: str, qe_simulation_id: str
58
+ ):
59
+ """
60
+ Associate a user upload with a Quantum Espresso simulation
61
+ """
62
+ result = post(
63
+ "api/qe-simulation-file/",
64
+ payload={"user_upload_id": user_upload_id, "simulation_id": qe_simulation_id},
65
+ )
66
+ return result
67
+
68
+
69
+ def get_simulation_files(simulation_id: str):
70
+ """
71
+ Get the files associated with a Quantum Espresso simulation
72
+ """
73
+ result = get(f"api/qe-simulation-file/?simulation_uuid={simulation_id}")
74
+ return result
@@ -0,0 +1,24 @@
1
+ from atomict.api import get, post
2
+
3
+
4
+ def get_simulation(simulation_id: str, full: bool = False):
5
+ """
6
+ Get a SQS simulation
7
+ """
8
+ if full:
9
+ result = get(f"api/sqs-exploration/{simulation_id}/?full=true")
10
+ else:
11
+ result = get(f"api/sqs-exploration/{simulation_id}/")
12
+
13
+ return result
14
+
15
+
16
+ def associate_user_upload_with_sqs_simulation(user_upload_id: str, exploration_id: str):
17
+ """
18
+ Associate a user upload with a SQS simulation
19
+ """
20
+ result = post(
21
+ "api/sqs-simulation-file/",
22
+ payload={"user_upload_id": user_upload_id, "exploration_id": exploration_id},
23
+ )
24
+ return result
@@ -0,0 +1,90 @@
1
+ try:
2
+ from ase import Atoms
3
+ from ase.io import read
4
+ except ImportError:
5
+ raise ImportError(
6
+ "The 'ase' package is required for JSON operations with Atoms objects. "
7
+ "To install the optional dependency, use atomict[utils]"
8
+ )
9
+
10
+ import logging
11
+ import os
12
+
13
+ from atomict.io.fhiaims import read_aims_output
14
+ from atomict.io.utils import human_filesize
15
+ from atomict.simulation.mlrelax import get_mlrelax, get_mlrelax_files
16
+ from atomict.simulation.fhi_aims import get_simulation as fhi_get_simulation
17
+ from atomict.simulation.fhi_aims import get_simulation_files as fhi_get_simulation_files
18
+ from atomict.user.files import download_file
19
+ from atomict.user.workspace import download_workspace
20
+
21
+
22
+ def fetch_relaxed_geometry(sim: dict, workbench_dir: str) -> Atoms:
23
+
24
+ """
25
+ Fetch the relaxed geometry from the simulation
26
+ sim can be any of these: FHIAimsSimulation, MLRelaxation, UserUpload
27
+
28
+ returns: Atoms object
29
+ """
30
+
31
+ if sim["starting_structure"]:
32
+ previous_simulation = fhi_get_simulation(sim["starting_structure"]["id"])
33
+ logging.info(f"Previous simulation: {previous_simulation['id']}")
34
+ files = fhi_get_simulation_files(previous_simulation["id"])
35
+
36
+ total_size = 0
37
+ for file in files["results"]:
38
+ total_size += file["user_upload"]["size"]
39
+
40
+ logging.info(
41
+ f"Previous simulation: Downloading {len(files['results'])} files, Total size: {human_filesize(total_size)}"
42
+ )
43
+
44
+ prev_sim_dir = os.path.join(workbench_dir, "previous_simulation")
45
+ os.makedirs(prev_sim_dir, exist_ok=True)
46
+ download_workspace(files["results"], prev_sim_dir)
47
+ atoms = read_aims_output(
48
+ os.path.join(prev_sim_dir, f"{previous_simulation['id']}.out")
49
+ )
50
+
51
+ return atoms[-1]
52
+
53
+ elif sim["starting_structure_mlrelax"]:
54
+
55
+ previous_mlrelax = get_mlrelax(sim["starting_structure_mlrelax"]["id"])
56
+ logging.info(f"Previous MLRelaxation: {previous_mlrelax['id']}")
57
+ files = get_mlrelax_files(previous_mlrelax["id"])
58
+
59
+ total_size = 0
60
+ for file in files["results"]:
61
+ total_size += file["user_upload"]["size"]
62
+
63
+ logging.info(
64
+ f"Previous MLRelaxation: Downloading {len(files['results'])} files, Total size: {human_filesize(total_size)}"
65
+ )
66
+
67
+ mlrelax_dir = os.path.join(workbench_dir, "previous_mlrelax")
68
+ os.makedirs(mlrelax_dir, exist_ok=True)
69
+ download_workspace(files["results"], mlrelax_dir)
70
+
71
+ traj_file = os.path.join(mlrelax_dir, "relax.traj")
72
+ atoms = read(traj_file)
73
+
74
+ if isinstance(atoms, list):
75
+ return atoms[-1]
76
+ else:
77
+ return atoms
78
+
79
+ elif sim["starting_structure_userupload"]:
80
+ logging.info(f"Previous UserUpload: {sim['starting_structure_userupload']['uuid']}")
81
+
82
+ download_file(sim["starting_structure_userupload"]["uuid"], workbench_dir + "/relaxed.cif")
83
+ atoms = read(workbench_dir + "/relaxed.cif")
84
+
85
+ if isinstance(atoms, list):
86
+ return atoms[-1]
87
+ else:
88
+ return atoms
89
+ else:
90
+ raise ValueError("No relaxed structure simulation found")
File without changes
atomict/user/files.py ADDED
@@ -0,0 +1,31 @@
1
+ import os
2
+
3
+ from atomict.api import get, post
4
+
5
+
6
+ def upload_single_file(full_path: str, file_name: str, project_uuid: str = None):
7
+
8
+ payload = {
9
+ 'users_name': file_name
10
+ }
11
+
12
+ if project_uuid:
13
+ payload['project_uuid'] = project_uuid
14
+
15
+ with open(full_path, "rb") as f:
16
+ result = post("user/file_upload/", files={file_name: f}, payload=payload)
17
+ return result
18
+
19
+
20
+ def download_file(user_upload_uuid: str, destination_path: str):
21
+ content = get(f"user/file_upload_get/{user_upload_uuid}/")
22
+
23
+ # Write the content to the destination path
24
+ # if there's a directory path in the destination path, create the directory
25
+ destination_dir = os.path.dirname(destination_path)
26
+ if destination_dir:
27
+ os.makedirs(destination_dir, exist_ok=True)
28
+
29
+ with open(destination_path, "wb") as f:
30
+ f.write(content)
31
+ return content
@@ -0,0 +1,112 @@
1
+ import logging
2
+ import os
3
+ import shutil
4
+
5
+ from atomict.infra.distwork.task import TaskStatus, update_task_status
6
+ from atomict.io.utils import human_filesize
7
+ from atomict.user.files import download_file, upload_single_file
8
+
9
+
10
+ def display_name(user_upload):
11
+ if "users_name" in user_upload and user_upload["users_name"] not in ["", None]:
12
+ return user_upload["users_name"]
13
+ return user_upload["orig_name"]
14
+
15
+
16
+ def clear_workspace(sim, base_path: str = "./workspace"):
17
+
18
+ target_dir = os.path.join(base_path, sim["id"])
19
+
20
+ if os.path.exists(target_dir):
21
+ logging.warning(f"Removing existing workspace folder {target_dir}")
22
+ shutil.rmtree(target_dir)
23
+
24
+
25
+ def download_workspace(workspace_files, target_directory: str):
26
+ """Download a workspace to a target directory
27
+
28
+ Args:
29
+ workspace_files list of UserUpload objects: List of files to download
30
+ target_directory (str): The directory to download the files to
31
+ """
32
+
33
+ os.makedirs(target_directory, exist_ok=True)
34
+
35
+ total_bytes = sum([f["user_upload"]["size"] for f in workspace_files])
36
+ finished_bytes = 0
37
+ for sim_file in workspace_files:
38
+ logging.info(
39
+ f"Downloading file {display_name(sim_file['user_upload'])} ({human_filesize(sim_file['user_upload']['size'])})"
40
+ )
41
+
42
+ download_file(
43
+ sim_file["user_upload"]["uuid"],
44
+ f"{target_directory}/{sim_file['user_upload']['users_name']}",
45
+ )
46
+
47
+ finished_bytes += sim_file["user_upload"]["size"]
48
+ logging.info(
49
+ f"Downloaded {human_filesize(finished_bytes)} of {human_filesize(total_bytes)} ({finished_bytes/total_bytes*100:.1f}%)"
50
+ )
51
+
52
+
53
+ def upload_workspace(
54
+ sim, associate_function, workspace_folder: str, starting_percent: int = 80
55
+ ):
56
+ """
57
+ Uploads a workspace folder to the Atomic platform, and associates the uploaded files with the given simulation.
58
+
59
+ Args:
60
+ sim: The simulation object to associate the uploaded files with
61
+ associate_function: The function to associate the uploaded files with the simulation (e.g. associate_user_upload_with_qe_simulation)
62
+ workspace_folder: The folder to upload
63
+ starting_percent: The starting percentage to use when updating the task status
64
+ """
65
+
66
+ simulation_id = sim["id"]
67
+
68
+ total_size = sum(
69
+ os.path.getsize(os.path.join(root, file))
70
+ for root, _, files in os.walk(workspace_folder)
71
+ for file in files
72
+ )
73
+ uploaded_size = 0
74
+ last_update_percent = starting_percent
75
+
76
+ update_task_status(
77
+ sim["task"]["id"],
78
+ TaskStatus.RUNNING,
79
+ percent=last_update_percent,
80
+ progress_indeterminate=False,
81
+ )
82
+
83
+ for root, _, files in os.walk(workspace_folder):
84
+ for file in files:
85
+ file_path = os.path.join(root, file)
86
+ inner_workspace = file_path.replace(workspace_folder, "")
87
+ file_size = os.path.getsize(file_path)
88
+
89
+ try:
90
+ result = upload_single_file(file_path, inner_workspace)
91
+ if result["status"] != "OK":
92
+ logging.error(f"Failed to upload {inner_workspace}")
93
+ logging.error(result)
94
+ raise Exception(f"Failed to upload {inner_workspace} {result}")
95
+ else:
96
+ logging.info(f"Uploaded {inner_workspace} OK")
97
+ except Exception as e:
98
+ logging.error(f"Failed to upload {inner_workspace}")
99
+ logging.error(e)
100
+ raise
101
+
102
+ associate_function(result["UserUpload"]["id"], simulation_id)
103
+
104
+ uploaded_size += file_size
105
+ current_percent = 80 + int((uploaded_size / total_size) * 20)
106
+
107
+ # Update status if at least 2% has changed
108
+ if current_percent - last_update_percent >= 2:
109
+ update_task_status(
110
+ sim["task"]["id"], TaskStatus.RUNNING, percent=current_percent
111
+ )
112
+ last_update_percent = current_percent
File without changes
@@ -0,0 +1,73 @@
1
+ import os
2
+ import logging
3
+
4
+ try:
5
+ from ase import Atoms
6
+ from ase.io import read
7
+ from ase.io.formats import UnknownFileTypeError
8
+ except ImportError:
9
+ raise ImportError(
10
+ "The 'ase' package is required for JSON operations with Atoms objects. "
11
+ "To install the optional dependency, use atomict[utils]"
12
+ )
13
+
14
+ from atomict.io.fhiaims import read_aims_output
15
+
16
+
17
+ def read_final_geometry(workspace_dir: str, simulation_id: str):
18
+ """Read the starting structure from the workspace directory
19
+
20
+ Args:
21
+ workspace_dir (str): The workspace directory
22
+ """
23
+ next_step_path = f"{workspace_dir}/starting_structure/geometry.in.next_step"
24
+ if os.path.exists(next_step_path):
25
+ try:
26
+ return read(next_step_path, foramt='aims')
27
+ except UnknownFileTypeError:
28
+ logging.warning(f"Could not read {next_step_path}, falling back to output file")
29
+
30
+ return read_aims_output(
31
+ f"{workspace_dir}/starting_structure/{simulation_id}.out"
32
+ )[-1]
33
+
34
+
35
+ def fhi_to_ase(geometry_file):
36
+ """
37
+ Convert FHI-aims geometry.in to ASE atoms object.
38
+ Handles both periodic and non-periodic systems.
39
+
40
+ Args:
41
+ geometry_file (str): Path to FHI-aims geometry.in file
42
+
43
+ Returns:
44
+ ase.Atoms: ASE atoms object with appropriate periodicity
45
+ """
46
+ lattice_vectors = []
47
+ positions = []
48
+ symbols = []
49
+
50
+ with open(geometry_file, 'r') as f:
51
+ for line in f:
52
+ if line.startswith('lattice_vector'):
53
+ vec = [float(x) for x in line.split()[1:4]]
54
+ lattice_vectors.append(vec)
55
+ elif line.startswith('atom'):
56
+ parts = line.split()
57
+ pos = [float(x) for x in parts[1:4]]
58
+ symbol = parts[4]
59
+ positions.append(pos)
60
+ symbols.append(symbol)
61
+
62
+ # Check if the system is periodic (has lattice vectors)
63
+ if lattice_vectors:
64
+ atoms = Atoms(symbols=symbols,
65
+ positions=positions,
66
+ cell=lattice_vectors,
67
+ pbc=True)
68
+ else:
69
+ atoms = Atoms(symbols=symbols,
70
+ positions=positions,
71
+ pbc=False)
72
+
73
+ return atoms
@@ -0,0 +1,36 @@
1
+
2
+ import typing
3
+
4
+ from tenacity import _utils
5
+
6
+ if typing.TYPE_CHECKING:
7
+ import logging
8
+
9
+ from tenacity import RetryCallState
10
+
11
+
12
+ def before_log(
13
+ logger: "logging.Logger", log_level: int
14
+ ) -> typing.Callable[["RetryCallState"], None]:
15
+ """
16
+ Before call strategy that logs to some logger the attempt.
17
+
18
+ This one is a copy of the tenacity.before_log function, but it doesnt log the first
19
+ attempt because that generates a lot of noise.
20
+ """
21
+
22
+ def log_it(retry_state: "RetryCallState") -> None:
23
+ if retry_state.fn is None:
24
+ # NOTE(sileht): can't really happen, but we must please mypy
25
+ fn_name = "<unknown>"
26
+ else:
27
+ fn_name = _utils.get_callback_name(retry_state.fn)
28
+
29
+ if retry_state.attempt_number > 1:
30
+ logger.log(
31
+ log_level,
32
+ f"Starting call to '{fn_name}', "
33
+ f"this is the {_utils.to_ordinal(retry_state.attempt_number)} time calling it.",
34
+ )
35
+
36
+ return log_it
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.2
2
+ Name: atomict
3
+ Version: 0.2.4
4
+ Summary: The client application for the https://atomictessellator.com/
5
+ Author-email: Steven Anderson <steven@atomictessellator.com>, Alain Richardt <alain@atomictessellator.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/AtomicTessellator/atomic_cli
8
+ Keywords: atomic,tessellator,cli,client,fhi-aims,kpoint,sqs,adsorbate
9
+ Classifier: Topic :: Scientific/Engineering :: Physics
10
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
11
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: requests
21
+ Requires-Dist: tenacity~=9.0
22
+ Requires-Dist: httpx
23
+ Requires-Dist: click~=8.0
24
+ Requires-Dist: rich~=13.0
25
+ Provides-Extra: utils
26
+ Requires-Dist: ase==3.23.0; extra == "utils"
27
+ Requires-Dist: spglib==2.5.0; extra == "utils"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest~=8.0; extra == "dev"
30
+ Requires-Dist: black; extra == "dev"
31
+ Requires-Dist: isort; extra == "dev"
32
+ Requires-Dist: mypy; extra == "dev"
33
+ Requires-Dist: flake8; extra == "dev"
34
+
35
+ # Atomic Tessellator - CLI package
36
+
37
+ ## Installation
38
+ ```
39
+ pip install atomict
40
+
41
+ # install utils package with scientific extensions (ase, spglib)
42
+ pip install atomict[utils]
43
+ ```
44
+
45
+ ## Installation for devs
46
+ ```
47
+ pip install -e ".[dev]"
48
+ ```
49
+
50
+ Enable verbose logging for debugging:
51
+
52
+ ```
53
+ export AT_DEBUG=enabled
54
+ ```
55
+
56
+ # CLI Usage
57
+
58
+ ## Get a list of available commands
59
+
60
+ ```$ at```
61
+
62
+ ![Alt text](img/at.png?raw=true "at")
63
+
64
+ You can get help for each command with `at <command> --help`. This will print the command-specific help and options.
65
+ ## Log in and store authentication token
66
+
67
+ ```$ at login```
68
+
69
+ This will prompt you for your username and password.
70
+
71
+
72
+ ## Get a list of available projects
73
+
74
+ ```$ at project get```
75
+
76
+ ![Alt text](img/at_project_get.png?raw=true "at project get")
77
+
78
+
79
+ ## Get a list of adsorbates
80
+
81
+ ```$ at adsorbate get```
82
+
83
+ ![Alt text](img/at_adsorbate_get.png?raw=true "at adsorbate get")
84
+
85
+ ## Search objects for substrings
86
+
87
+ ```$ at adsorbate get --search NH3```
88
+
89
+ ![Alt text](img/at_adsorbate_get_search.png?raw=true "at adsorbate get --search")
90
+
91
+ ## Get a list of tasks
92
+
93
+ ```$ at task get```
94
+
95
+ ![Alt text](img/at_task_get.png?raw=true "at task get")
96
+
97
+ ## Get tasks with a specific status
98
+
99
+ ```$ at task get --status completed```
100
+
101
+ ![Alt text](img/at_task_get_completed.png?raw=true "at task get --status completed")
102
+
103
+ ## Configuration
104
+
105
+ Tab completion is available. Run the hidden command:
106
+
107
+ ```at completion```
108
+
109
+ This will print out the instructions for enabling tab completion for your shell.