atomict 0.1.1__py3-none-any.whl → 0.1.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 (88) 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 +84 -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 +124 -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 +131 -0
  36. atomict/io/fhiaims.py +24 -0
  37. atomict/io/json.py +22 -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/mlrelax.py +83 -0
  58. atomict/simulation/phonon.py +12 -0
  59. atomict/simulation/qe.py +74 -0
  60. atomict/simulation/sqs.py +24 -0
  61. atomict/simulation/utils.py +83 -0
  62. atomict/user/__init__.py +0 -0
  63. atomict/user/files.py +31 -0
  64. atomict/user/workspace.py +112 -0
  65. atomict/utils/fhiaims/__init__.py +0 -0
  66. atomict/utils/fhiaims/geometry.py +65 -0
  67. atomict/utils/tenacity.py +36 -0
  68. {atomict-0.1.1.dist-info → atomict-0.1.4.dist-info}/LICENSE +0 -0
  69. atomict-0.1.4.dist-info/METADATA +105 -0
  70. atomict-0.1.4.dist-info/RECORD +77 -0
  71. {atomict-0.1.1.dist-info → atomict-0.1.4.dist-info}/WHEEL +1 -1
  72. atomict-0.1.4.dist-info/entry_points.txt +2 -0
  73. {atomict-0.1.1.dist-info → atomict-0.1.4.dist-info}/top_level.txt +0 -1
  74. atomict/__main__.py +0 -3
  75. atomict/cli.py +0 -59
  76. atomict/datasets/__init__.py +0 -25
  77. atomict/datasets/io.py +0 -47
  78. atomict/datasets/public.py +0 -32
  79. atomict/utils/requests.py +0 -19
  80. atomict/version.py +0 -2
  81. atomict-0.1.1.dist-info/METADATA +0 -98
  82. atomict-0.1.1.dist-info/RECORD +0 -19
  83. atomict-0.1.1.dist-info/entry_points.txt +0 -2
  84. tests/test_sdk.py +0 -16
  85. /atomict/{auth → cli}/__init__.py +0 -0
  86. /atomict/{utils → infra}/__init__.py +0 -0
  87. {tests → atomict/infra/distwork}/__init__.py +0 -0
  88. /tests/test_cli.py → /atomict/io/__init__.py +0 -0
@@ -0,0 +1,171 @@
1
+ # cli/commands/exploration.py
2
+ from typing import Optional, Tuple
3
+
4
+ import click
5
+ from rich.console import Console
6
+ from rich.panel import Panel
7
+
8
+ from atomict.cli.commands.common import create_table
9
+ from atomict.cli.commands.helpers import format_datetime, get_status_string
10
+ from atomict.cli.core.client import get_client
11
+ from atomict.cli.core.utils import get_pagination_info
12
+
13
+
14
+ @click.group(name="catalysis")
15
+ def catalysis_group():
16
+ """Manage catalysis explorations"""
17
+ pass
18
+
19
+
20
+ @catalysis_group.command()
21
+ @click.argument("id", required=False)
22
+ @click.option("--search", help="Search term")
23
+ @click.option("--ordering", help="Field to order results by")
24
+ @click.option("--filter", "filters", multiple=True, help="Filter in format field=value")
25
+ @click.option("--json-output", is_flag=True, help="Output in JSON format")
26
+ @click.option("--all", "fetch_all", is_flag=True, help="Fetch all results")
27
+ def get(
28
+ id: Optional[str] = None,
29
+ search: Optional[str] = None,
30
+ ordering: Optional[str] = None,
31
+ filters: tuple = (),
32
+ json_output: bool = False,
33
+ fetch_all: bool = False,
34
+ ):
35
+ """Get catalysis exploration details or list all explorations"""
36
+ # WIP
37
+ client = get_client()
38
+ console = Console()
39
+
40
+ if id:
41
+ result = client.get(f"/api/catalysis-exploration/{id}/")
42
+ if json_output:
43
+ console.print_json(data=result)
44
+ return
45
+
46
+ console.print(Panel.fit(f"[bold]Catalysis Exploration Details[/bold]"))
47
+ console.print(f"ID: {result['id']}")
48
+ console.print(f"Name: {result.get('name', 'N/A')}")
49
+ console.print(f"Created: {format_datetime(result.get('created_at'))}")
50
+ console.print(f"Status: {get_status_string(result.get('status', 'N/A'))}")
51
+
52
+ if result.get("target_concentrations"):
53
+ console.print("\n[bold]Target Concentrations[/bold]")
54
+ columns = [
55
+ ("Element", "element", None),
56
+ ("Weight", "weight", None),
57
+ ]
58
+
59
+ table = create_table(
60
+ columns=columns,
61
+ items=result["target_concentrations"],
62
+ title="Target Concentrations",
63
+ )
64
+ console.print(table)
65
+
66
+ if result.get("results"):
67
+ console.print("\n[bold]Exploration Results[/bold]")
68
+ columns = [
69
+ ("Structure ID", "id", None),
70
+ ("Energy", "energy", lambda x: str(x) if x is not None else "N/A"),
71
+ ("Status", "status", get_status_string),
72
+ ]
73
+
74
+ table = create_table(
75
+ columns=columns, items=result["results"], title="Results"
76
+ )
77
+ console.print(table)
78
+ else:
79
+ params = {}
80
+ if search is not None:
81
+ params["search"] = search
82
+ if ordering:
83
+ params["ordering"] = ordering
84
+
85
+ for f in filters:
86
+ try:
87
+ field, value = f.split("=", 1)
88
+ params[field] = value
89
+ except ValueError:
90
+ click.echo(
91
+ f"[red]Invalid filter format: {f}. Use field=value[/red]", err=True
92
+ )
93
+ return
94
+
95
+ if fetch_all:
96
+ results = client.get_all("/api/catalysis-exploration/", params=params)
97
+ else:
98
+ results = client.get("/api/catalysis-exploration/", params=params)
99
+
100
+ if json_output:
101
+ console.print_json(data=results)
102
+ return
103
+
104
+ columns = [
105
+ ("ID", "id", None),
106
+ ("Name", "name", None),
107
+ ("Status", "status", get_status_string),
108
+ ("Created", "created_at", format_datetime),
109
+ ]
110
+
111
+ items, footer_string = get_pagination_info(results)
112
+
113
+ if not items:
114
+ console.print(
115
+ f"[white]No catalysis explorations found with the given criteria:[/white]\n[green]{params}"
116
+ )
117
+ return
118
+
119
+ table = create_table(
120
+ columns=columns,
121
+ items=items,
122
+ title="Catalysis Explorations",
123
+ caption=footer_string,
124
+ )
125
+
126
+ console.print(table)
127
+
128
+
129
+ @catalysis_group.command()
130
+ @click.option("--name", required=True, help="Name of the exploration")
131
+ @click.option("--structure", required=True, help="Starting structure ID")
132
+ @click.option("--project", required=True, help="Project ID")
133
+ @click.option("--element", "elements", multiple=True, help="Target elements")
134
+ @click.option("--weight", "weights", multiple=True, type=float, help="Target weights")
135
+ @click.option("--json-output", is_flag=True, help="Output in JSON format")
136
+ def create(
137
+ name: str,
138
+ structure: str,
139
+ project: str,
140
+ elements: Tuple[str],
141
+ weights: Tuple[float],
142
+ json_output: bool = False,
143
+ ):
144
+ """Create a new catalysis exploration"""
145
+ client = get_client()
146
+ console = Console()
147
+
148
+ if len(elements) != len(weights):
149
+ console.print(
150
+ "[red]Error: Number of elements must match number of weights[/red]"
151
+ )
152
+ return
153
+
154
+ data = {
155
+ "name": name,
156
+ "starting_structure": structure,
157
+ "project": project,
158
+ "target_concentrations": [
159
+ {"element": elem, "weight": weight}
160
+ for elem, weight in zip(elements, weights)
161
+ ],
162
+ }
163
+
164
+ result = client.post("/api/catalysis-exploration/", data)
165
+
166
+ if json_output:
167
+ console.print_json(data=result)
168
+ else:
169
+ console.print(
170
+ f"[green]Created catalysis exploration with ID: {result['id']}[/green]"
171
+ )
@@ -0,0 +1,57 @@
1
+ from typing import Any, Callable, List, Optional, Tuple
2
+
3
+ from rich.box import ASCII_DOUBLE_HEAD
4
+ from rich.table import Table
5
+
6
+
7
+ def create_table(
8
+ columns: List[Tuple[str, str, Optional[Callable]]],
9
+ items: List[dict],
10
+ *,
11
+ title: Optional[str] = None,
12
+ box: Any = ASCII_DOUBLE_HEAD,
13
+ header_style: str = "bold cyan",
14
+ title_style: str = "bold",
15
+ caption: Optional[str] = None,
16
+ ) -> Table:
17
+ """Create a styled Rich table with the given columns and items.
18
+
19
+ Args:
20
+ columns: List of (header, key, formatter) tuples.
21
+ formatter is optional and defaults to str
22
+ items: List of dictionaries containing the data
23
+ title: Optional table title
24
+ box: Rich box style to use
25
+ header_style: Style for header row
26
+ title_style: Style for title
27
+ footer: Optional footer text
28
+ """
29
+ table = Table(
30
+ title=title,
31
+ title_style=title_style,
32
+ title_justify="center",
33
+ box=box,
34
+ caption_justify="center",
35
+ show_header=True,
36
+ header_style=header_style,
37
+ highlight=True,
38
+ )
39
+
40
+ # Add columns
41
+ for header, _, _ in columns:
42
+ table.add_column(header)
43
+
44
+ # Add rows
45
+ for item in items:
46
+ row = []
47
+ for header, key, formatter in columns:
48
+ value = item.get(key, "")
49
+ # Use str as default formatter if none provided
50
+ format_func = formatter if formatter is not None else str
51
+ row.append(format_func(value) if value is not None else "")
52
+ table.add_row(*row)
53
+
54
+ if caption:
55
+ table.caption = caption
56
+
57
+ return table
@@ -0,0 +1,7 @@
1
+ # import click
2
+
3
+ # Use a flattened list of commands for now
4
+ # @click.group(name='exploration')
5
+ # def exploration_group():
6
+ # """Manage exploration tasks"""
7
+ # pass