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
atomict/io/cif.py ADDED
@@ -0,0 +1,138 @@
1
+ import logging
2
+
3
+ try:
4
+ import ase.io
5
+ import spglib
6
+ except ImportError:
7
+ raise ImportError(
8
+ "The 'ase' and 'spglib' packages are required for CIF operations. "
9
+ "To install the optional dependency, use atomict[utils]"
10
+ )
11
+
12
+
13
+ class CIFAnalyzer:
14
+ def __init__(self, file_path):
15
+ self.file_path = file_path
16
+ self.atoms = None
17
+ self._load_structure()
18
+
19
+ def _load_structure(self):
20
+ try:
21
+ self.atoms = ase.io.read(self.file_path, format='cif')
22
+ if self.atoms is None:
23
+ raise ValueError('Could not parse CIF file structure')
24
+ except Exception as e:
25
+ raise ValueError(f'Not a valid CIF file: {str(e)}')
26
+
27
+ def analyze(self):
28
+ """Performs complete analysis of the CIF structure"""
29
+ analysis = {}
30
+
31
+ # Basic structure info
32
+ analysis.update(self._get_basic_info())
33
+
34
+ # Cell parameters
35
+ analysis.update(self._get_cell_parameters())
36
+
37
+ # Atomic information
38
+ analysis.update(self._get_atomic_info())
39
+
40
+ # Symmetry analysis
41
+ analysis.update(self._get_symmetry_info())
42
+
43
+ return analysis
44
+
45
+ def _get_basic_info(self):
46
+ info = {}
47
+ try:
48
+ info['chemical_formula'] = self.atoms.get_chemical_formula()
49
+ except Exception as e:
50
+ info['chemical_formula'] = 'Unknown'
51
+ logging.warning(f'Could not determine chemical formula: {str(e)}')
52
+
53
+ try:
54
+ info['volume'] = float(self.atoms.get_volume())
55
+ except Exception:
56
+ info['volume'] = None
57
+
58
+ return info
59
+
60
+ def _get_cell_parameters(self):
61
+ try:
62
+ cell_angles = self.atoms.cell.angles()
63
+ return {
64
+ 'cell_parameters': {
65
+ 'a': float(self.atoms.cell[0][0]) if self.atoms.cell[0][0] else None,
66
+ 'b': float(self.atoms.cell[1][1]) if self.atoms.cell[1][1] else None,
67
+ 'c': float(self.atoms.cell[2][2]) if self.atoms.cell[2][2] else None,
68
+ 'alpha': float(cell_angles[0]) if cell_angles[0] else None,
69
+ 'beta': float(cell_angles[1]) if cell_angles[1] else None,
70
+ 'gamma': float(cell_angles[2]) if cell_angles[2] else None,
71
+ }
72
+ }
73
+ except Exception as e:
74
+ logging.warning(f'Could not determine cell parameters: {str(e)}')
75
+ return {'cell_parameters': None}
76
+
77
+ def _get_atomic_info(self):
78
+ try:
79
+ info = {
80
+ 'num_atoms': len(self.atoms),
81
+ 'atomic_numbers': self.atoms.numbers.tolist(),
82
+ 'chemical_symbols': self.atoms.get_chemical_symbols(),
83
+ 'positions': self.atoms.positions.tolist(),
84
+ 'cell': self.atoms.cell.tolist(),
85
+ 'pbc': self.atoms.pbc.tolist()
86
+ }
87
+
88
+ # Get unique elements and their counts
89
+ unique_elements = {}
90
+ for symbol in self.atoms.get_chemical_symbols():
91
+ unique_elements[symbol] = unique_elements.get(symbol, 0) + 1
92
+ info['element_counts'] = unique_elements
93
+
94
+ return info
95
+ except Exception as e:
96
+ logging.warning(f'Could not get complete atomic information: {str(e)}')
97
+ return {
98
+ 'num_atoms': 0,
99
+ 'atomic_numbers': [],
100
+ 'chemical_symbols': [],
101
+ 'positions': [],
102
+ 'cell': None,
103
+ 'pbc': None,
104
+ 'element_counts': {}
105
+ }
106
+
107
+ def _get_symmetry_info(self):
108
+ try:
109
+ cell = (self.atoms.cell, self.atoms.get_scaled_positions(), self.atoms.numbers)
110
+ dataset = spglib.get_symmetry_dataset(cell, symprec=1e-5)
111
+ primitive_cell = spglib.find_primitive(cell, symprec=1e-5)
112
+
113
+ if dataset:
114
+ unique_equiv = set(dataset.equivalent_atoms)
115
+ wyckoff_multiplicities = {
116
+ letter: list(dataset.wyckoffs).count(letter)
117
+ for letter in set(dataset.wyckoffs)
118
+ }
119
+
120
+ return {
121
+ 'symmetry': {
122
+ 'space_group_number': dataset.number,
123
+ 'space_group_international': dataset.international,
124
+ 'hall_symbol': dataset.hall,
125
+ 'primitive_atoms': len(primitive_cell[2]) if primitive_cell else len(self.atoms),
126
+ 'conventional_atoms': len(self.atoms),
127
+ 'wyckoff_letters': dataset.wyckoffs,
128
+ 'equivalent_atoms': dataset.equivalent_atoms.tolist(),
129
+ 'transformation_matrix': dataset.transformation_matrix.tolist(),
130
+ 'origin_shift': dataset.origin_shift.tolist(),
131
+ 'asymmetric_unit_atoms': len(unique_equiv),
132
+ 'wyckoff_multiplicities': wyckoff_multiplicities
133
+ }
134
+ }
135
+ except Exception as e:
136
+ logging.warning(f'Could not determine symmetry information: {str(e)}')
137
+
138
+ return {'symmetry': None}
atomict/io/fhiaims.py ADDED
@@ -0,0 +1,30 @@
1
+ try:
2
+ from ase.io.aims import check_convergence, get_aims_out_chunks, get_header_chunk
3
+ from ase.utils import reader
4
+ except ImportError:
5
+ raise ImportError(
6
+ "The 'ase' package is required for FHI-aims operations. "
7
+ "To install the optional dependency, use atomict[utils]"
8
+ )
9
+
10
+
11
+ # We have to write our own function because he read_aims_output function inside ASE only supports
12
+ # reading a single image from the output file. We want to support reading all images.
13
+ @reader
14
+ def read_aims_output(fd, index=None, non_convergence_ok=False):
15
+ """Import FHI-aims output files with all data available, i.e.
16
+ relaxations, MD information, force information etc etc etc."""
17
+ header_chunk = get_header_chunk(fd)
18
+ chunks = list(get_aims_out_chunks(fd, header_chunk))
19
+ check_convergence(chunks, non_convergence_ok)
20
+
21
+ # Relaxations have an additional footer chunk due to how it is split
22
+ if header_chunk.is_relaxation:
23
+ images = [chunk.atoms for chunk in chunks[:-1]]
24
+ else:
25
+ images = [chunk.atoms for chunk in chunks]
26
+
27
+ if index is None:
28
+ return images
29
+ else:
30
+ return images[index]
atomict/io/json.py ADDED
@@ -0,0 +1,28 @@
1
+ import io
2
+ import json
3
+
4
+ try:
5
+ from ase import Atoms
6
+ from ase.io import read, write
7
+ except ImportError:
8
+ raise ImportError(
9
+ "The 'ase' package is required for JSON operations with Atoms objects. "
10
+ "To install the optional dependency, use atomict[utils]"
11
+ )
12
+
13
+
14
+ def atoms_to_json(atoms: Atoms) -> str:
15
+ with io.StringIO() as buf:
16
+ write(buf, atoms, format="json")
17
+ return buf.getvalue()
18
+
19
+
20
+ def atoms_to_dict(atoms: Atoms) -> dict:
21
+ with io.StringIO() as buf:
22
+ write(buf, atoms, format="json")
23
+ return json.loads(buf.getvalue())
24
+
25
+
26
+ def json_to_atoms(json_str: str) -> Atoms:
27
+ with io.StringIO(json_str) as buf:
28
+ return read(buf, format="json")
atomict/io/utils.py ADDED
@@ -0,0 +1,11 @@
1
+
2
+
3
+ def human_filesize(size):
4
+ """
5
+ Convert a file size in bytes to a human readable format
6
+ """
7
+ for unit in ["bytes", "KB", "MB", "GB", "TB"]:
8
+ if size < 1024.0:
9
+ return f"{size:.1f} {unit}"
10
+ size /= 1024.0
11
+ return f"{size:.1f} PB"
atomict/ml/__init__.py ADDED
File without changes
atomict/ml/model.py ADDED
@@ -0,0 +1,13 @@
1
+ from atomict.api import get
2
+
3
+
4
+ def get_model(model_name: str):
5
+ return get(f"api/ml-model/?short_desc={model_name}")
6
+
7
+
8
+ def get_model_by_id(model_id: str):
9
+ return get(f"api/ml-model/{model_id}/?include_weights=true")
10
+
11
+
12
+ def get_hot_models():
13
+ return get("ml-models/hot/")
@@ -0,0 +1 @@
1
+ from .project import *
@@ -0,0 +1,26 @@
1
+ from atomict.api import post, delete
2
+
3
+
4
+ def create_object_link(
5
+ project_id: str, src_object_id: str, dst_object_id: str) -> dict:
6
+ """
7
+ Create a link between an object and a project
8
+ """
9
+ payload = {
10
+ "project": project_id,
11
+ "src_id": src_object_id,
12
+ "dst_id": dst_object_id
13
+ }
14
+
15
+ response = post(
16
+ "api/object-link/", payload, extra_headers={"Content-Type": "application/json"}
17
+ )
18
+ return response
19
+
20
+
21
+ def delete_object_link(link_id: str) -> dict:
22
+ """
23
+ Delete a link between an object and a project
24
+ """
25
+ response = delete(f"api/object-link/{link_id}/")
26
+ return response
@@ -0,0 +1,18 @@
1
+ from atomict.api import post
2
+
3
+
4
+ def create_project_note(
5
+ project_id: str, title: str, content: str, show_description: bool = True
6
+ ) -> dict:
7
+
8
+ payload = {
9
+ "project": project_id,
10
+ "title": title,
11
+ "content_html": content,
12
+ "show_description": show_description,
13
+ }
14
+
15
+ response = post(
16
+ "api/project-note/", payload, extra_headers={"Content-Type": "application/json"}
17
+ )
18
+ return response
@@ -0,0 +1,32 @@
1
+ from atomict.api import delete, get, post
2
+
3
+
4
+ def create_project(name: str, description: str = None, thumbnail_smiles: str = None) -> dict:
5
+
6
+ payload = {
7
+ "name": name,
8
+ "description_html": description,
9
+ "thumbnail_smiles": thumbnail_smiles,
10
+ }
11
+
12
+ response = post(
13
+ "api/project/", payload, extra_headers={"Content-Type": "application/json"})
14
+ return response
15
+
16
+
17
+ def delete_project(project_id: str) -> dict:
18
+ response = delete(f"api/project/{project_id}/")
19
+
20
+ return response
21
+
22
+
23
+ def project_exists(name: str) -> bool:
24
+ response = get(f"api/project/?name={name}")
25
+
26
+ return response['count'] > 0
27
+
28
+
29
+ def get_project_by_name(name: str) -> dict:
30
+ response = get(f"api/project/?name={name}")
31
+
32
+ return response['results'][0]
@@ -0,0 +1,48 @@
1
+ from atomict.api import get, post
2
+
3
+ VALID_TAG_COLOURS = [
4
+ "bg-success",
5
+ "bg-primary",
6
+ "bg-secondary",
7
+ "bg-danger",
8
+ "bg-warning",
9
+ "bg-info",
10
+ "bg-light",
11
+ "bg-dark"
12
+ ]
13
+
14
+ def create_tag(name: str, tag_color: str) -> int:
15
+
16
+ if tag_color not in VALID_TAG_COLOURS:
17
+ raise ValueError(f"Invalid tag color: {tag_color}, choose from {VALID_TAG_COLOURS}")
18
+
19
+ response = post(
20
+ "api/project-tag/", {"tag": name, "color": tag_color}, extra_headers={"Content-Type": "application/json"})
21
+ return response
22
+
23
+
24
+ def get_tag_by_name(tag: str) -> dict:
25
+ response = get(f"api/project-tag/?tag={tag}")
26
+
27
+ return response['results'][0]
28
+
29
+
30
+ def tag_exists(tag: str) -> bool:
31
+ response = get(f"api/project-tag/?tag={tag}")
32
+
33
+ return response['count'] > 0
34
+
35
+
36
+ def create_project_tag(project_id: str, tag_id: str) -> dict:
37
+ response = post(
38
+ "api/project-tag-project/",
39
+ {"project": project_id, "project_tag": tag_id},
40
+ extra_headers={"Content-Type": "application/json"},
41
+ )
42
+ return response
43
+
44
+
45
+ def project_tag_exists(project_id: str, tag_id: str) -> bool:
46
+ response = get(f"api/project-tag-project/?project={project_id}&project_tag={tag_id}")
47
+
48
+ return response['count'] > 0
@@ -0,0 +1,6 @@
1
+ from atomict.api import get
2
+
3
+
4
+ def get_workbench(project_id: str) -> dict:
5
+ response = get(f"simulation/workbench/?project_id={project_id}")
6
+ return response
File without changes
@@ -0,0 +1,5 @@
1
+ from atomict.api import get
2
+
3
+
4
+ def get_bulk(bulk_id: str):
5
+ return get(f"oqmd/structure/{bulk_id}/")
@@ -0,0 +1,5 @@
1
+ from atomict.api import get
2
+
3
+
4
+ def get_slab(slab_id: str):
5
+ return get(f"simulation/slabs/download/{slab_id}/")
File without changes
@@ -0,0 +1,35 @@
1
+ import json
2
+
3
+ from atomict.api import get, post
4
+
5
+
6
+ def get_simulation(simulation_id: str):
7
+ return get(f"api/cantera-simulation/{simulation_id}/")
8
+
9
+
10
+ def post_reaction(ct_reaction: dict):
11
+
12
+ for json_prop in ['input_data', 'reactants', 'products']:
13
+
14
+ if isinstance(ct_reaction[json_prop], dict):
15
+ ct_reaction[json_prop] = json.dumps(ct_reaction[json_prop])
16
+
17
+ return post("api/ct-reaction/", ct_reaction)
18
+
19
+
20
+ def post_species(ct_species: dict):
21
+
22
+ for json_prop in ["input_data", ]:
23
+
24
+ if isinstance(ct_species[json_prop], dict):
25
+ ct_species[json_prop] = json.dumps(ct_species[json_prop])
26
+
27
+ return post("api/ct-species/", ct_species)
28
+
29
+
30
+ def post_observation(ct_observation: dict):
31
+ return post("api/ct-observation/", ct_observation)
32
+
33
+
34
+ def post_thermo(ct_thermo: dict):
35
+ return post("api/ct-thermo/", ct_thermo)
@@ -0,0 +1,20 @@
1
+ from atomict.api import get, post
2
+
3
+
4
+ def get_exploration(exploration_id: str):
5
+ return get(f"api/catalysis-exploration/{exploration_id}/")
6
+
7
+
8
+ def get_simulation(simulation_id: str):
9
+ return get(f"api/catalysis-simulation/{simulation_id}/")
10
+
11
+
12
+ def upload_simulation_results(results, traj_file_path, log_file_path):
13
+ url = "simulation/catalysis/mlacc/results_upload/"
14
+
15
+ files = {
16
+ "traj": ("simulation.traj", open(traj_file_path, "rb")),
17
+ "logs": ("simulation.log", open(log_file_path, "rb")),
18
+ }
19
+
20
+ return post(url, results, files=files)
@@ -0,0 +1,28 @@
1
+ from atomict.api import get, post
2
+
3
+
4
+ def get_simulation(simulation_id: str):
5
+ return get(f"api/cf-run/{simulation_id}/")
6
+
7
+
8
+ def create_simulation(data: dict):
9
+ return post("api/cf-run/", data=data)
10
+
11
+
12
+ def create_cf_sample_space_example(payload: dict, extra_headers={}):
13
+
14
+ return post(
15
+ "api/cf-sample-space-example/", payload=payload, extra_headers=extra_headers
16
+ )
17
+
18
+
19
+ def create_cf_counterfactual(payload: dict, extra_headers={}):
20
+
21
+ return post("api/cf-counterfactual/", payload=payload, extra_headers=extra_headers)
22
+
23
+
24
+ def create_cf_lime_explanation(payload: dict, extra_headers={}):
25
+
26
+ return post(
27
+ "api/cf-lime-explanation/", payload=payload, extra_headers=extra_headers
28
+ )
@@ -0,0 +1,64 @@
1
+ from atomict.api import get, post
2
+
3
+
4
+ def get_ea_exploration(exploration_id: str):
5
+ return get(f"api/ea-exploration/{exploration_id}/")
6
+
7
+
8
+ def get_ea_exploration_sample(sample_id: str):
9
+ return get(f"api/ea-exploration-sample/{sample_id}/")
10
+
11
+
12
+ def get_ea_exploration_samples(exploration_id: str):
13
+ return get(f"api/ea-exploration-sample/?exploration={exploration_id}")
14
+
15
+
16
+ def get_ea_exploration_analysis(analysis_id: str):
17
+ return get(f"api/ea-exploration-analysis/{analysis_id}/")
18
+
19
+
20
+ def get_ea_exploration_analysis_file(analysis_file_id: str):
21
+ return get(f"api/ea-exploration-analysis-file/{analysis_file_id}/")
22
+
23
+
24
+ def associate_user_upload_with_ea_exploration(user_upload_id: str, analysis_id: str):
25
+ return post(
26
+ "api/ea-exploration-analysis-file/",
27
+ payload={"user_upload_id": user_upload_id, "analysis_id": analysis_id},
28
+ )
29
+
30
+
31
+ def create_exploration_sample(
32
+ exploration_id: str,
33
+ simulation_id: str = None,
34
+ mlrelax_id: str = None,
35
+ strain: float = None,
36
+ matrix: int = None,
37
+ ):
38
+ """
39
+ Create an exploration sample
40
+
41
+ exploration_id: str - The ID of the exploration to associate the sample with
42
+ simulation_id: str - The ID of the simulation to associate with the exploration
43
+ strain: float - The strain to associate with the sample
44
+ matrix: int - The matrix to associate with the sample
45
+ """
46
+
47
+ if simulation_id is None and mlrelax_id is None:
48
+ raise ValueError("Either simulation_id or mlrelax_id must be provided")
49
+
50
+ payload = {
51
+ "exploration_id": exploration_id,
52
+ "strain": strain,
53
+ "matrix": matrix,
54
+ }
55
+
56
+ if simulation_id:
57
+ payload["simulation_id"] = simulation_id
58
+ elif mlrelax_id:
59
+ payload["mlrelax_id"] = mlrelax_id
60
+
61
+ return post(
62
+ "api/ea-exploration-sample/",
63
+ payload=payload,
64
+ )
@@ -0,0 +1,72 @@
1
+ from atomict.api import delete, get, post
2
+
3
+
4
+ def create_simulation(
5
+ project_id: str,
6
+ control_file: str,
7
+ geometry_file: str,
8
+ action: str,
9
+ name: str = None,
10
+ description: str = None,
11
+ extra_simulation_kwargs: dict = None,
12
+ ) -> dict:
13
+
14
+ if action not in ["DRAFT", "LAUNCH"]:
15
+ raise ValueError("Action must be 'DRAFT' or 'LAUNCH'")
16
+
17
+ payload = {
18
+ "project_id": project_id,
19
+ "control_file": control_file,
20
+ "geometry_file": geometry_file,
21
+ "action": action,
22
+ "name": name,
23
+ "description": description,
24
+ }
25
+
26
+ if extra_simulation_kwargs:
27
+ payload.update(extra_simulation_kwargs)
28
+
29
+ result = post(
30
+ "api/fhiaims-simulation/",
31
+ payload,
32
+ extra_headers={"Content-Type": "application/json"},
33
+ )
34
+
35
+ return result
36
+
37
+
38
+ def get_simulation(simulation_id: str):
39
+ """
40
+ Get a FHI aims simulation
41
+ """
42
+ result = get(f"api/fhiaims-simulation/{simulation_id}/")
43
+ return result
44
+
45
+
46
+ def delete_simulation(simulation_id):
47
+ """
48
+ Delete a FHI aims simulation
49
+ """
50
+ result = delete(f"api/fhiaims-simulation/{simulation_id}/")
51
+ return result
52
+
53
+
54
+ def associate_user_upload_with_fhiaims_simulation(
55
+ user_upload_id: str, fhi_simulation_id: str
56
+ ):
57
+ """
58
+ Associate a user upload with a FHI-aims simulation
59
+ """
60
+ result = post(
61
+ "api/fhiaims-simulation-file/",
62
+ payload={"user_upload_id": user_upload_id, "simulation_id": fhi_simulation_id},
63
+ )
64
+ return result
65
+
66
+
67
+ def get_simulation_files(simulation_id: str):
68
+ """
69
+ Get the files associated with a FHI-aims simulation
70
+ """
71
+ result = get(f"api/fhiaims-simulation-file/?simulation__id={simulation_id}")
72
+ return result
@@ -0,0 +1,74 @@
1
+ from atomict.api import get, post, patch
2
+
3
+
4
+ def get_kpoint_exploration(simulation_id: str):
5
+ """
6
+ Get kpoints for a simulation
7
+ """
8
+ result = get(f"api/kpoint-exploration/{simulation_id}/")
9
+ return result
10
+
11
+
12
+ def update_kpoint_exploration(exploration_id: str, fields: dict):
13
+ """
14
+ Update KPoint exploration
15
+ """
16
+ result = patch(f"api/kpoint-exploration/{exploration_id}/", payload=fields)
17
+ return result
18
+
19
+
20
+ def get_kpoint_simulation_list(exploration_id: str):
21
+ """
22
+ Get kpoints for a simulation
23
+ """
24
+ result = get(f"api/kpoint-simulation/?exploration__id={exploration_id}")
25
+ return result
26
+
27
+
28
+ def get_kpoint_simulation(simulation_id: str):
29
+ """
30
+ Get KPoint simulation
31
+ """
32
+ result = get(f"api/kpoint-simulation/{simulation_id}/")
33
+ return result
34
+
35
+
36
+ def create_kpoint_simulation(
37
+ exploration_id: str, simulation_id: str, k_points: list[float]
38
+ ):
39
+ """
40
+ Create KPoint simulation
41
+ """
42
+ result = post(
43
+ "api/kpoint-simulation/",
44
+ payload={
45
+ "exploration_id": exploration_id,
46
+ "simulation_id": simulation_id,
47
+ "k_points": k_points,
48
+ },
49
+ )
50
+ return result
51
+
52
+
53
+ def update_kpoint_simulation(simulation_id: str, fields: dict):
54
+ """
55
+ Update KPoint simulation
56
+ """
57
+ result = patch(f"api/kpoint-simulation/{simulation_id}/", payload=fields)
58
+ return result
59
+
60
+
61
+ def get_kpoint_analysis(analysis_id: str):
62
+ """
63
+ Get KPoint analysis
64
+ """
65
+ result = get(f"api/kpoint-analysis/{analysis_id}/")
66
+ return result
67
+
68
+
69
+ def update_kpoint_analysis(analysis_id: str, fields: dict):
70
+ """
71
+ Update KPoint analysis
72
+ """
73
+ result = patch(f"api/kpoint-analysis/{analysis_id}/", payload=fields)
74
+ return result