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.
- atomict/__init__.py +1 -1
- atomict/__version__.py +1 -0
- atomict/api.py +182 -0
- atomict/auth.py +47 -0
- atomict/cli/commands/adsorbate.py +183 -0
- atomict/cli/commands/ai_assist.py +111 -0
- atomict/cli/commands/catalysis.py +171 -0
- atomict/cli/commands/common.py +57 -0
- atomict/cli/commands/exploration/__init__.py +7 -0
- atomict/cli/commands/exploration/soec.py +564 -0
- atomict/cli/commands/exploration/sqs.py +440 -0
- atomict/cli/commands/helpers.py +74 -0
- atomict/cli/commands/k8s.py +211 -0
- atomict/cli/commands/login.py +34 -0
- atomict/cli/commands/organization.py +76 -0
- atomict/cli/commands/project.py +876 -0
- atomict/cli/commands/simulation/__init__.py +20 -0
- atomict/cli/commands/simulation/catalysis.py +223 -0
- atomict/cli/commands/simulation/fhiaims.py +279 -0
- atomict/cli/commands/simulation/kpoint.py +380 -0
- atomict/cli/commands/simulation/vibes.py +161 -0
- atomict/cli/commands/simulation.py +176 -0
- atomict/cli/commands/task.py +181 -0
- atomict/cli/commands/upload.py +89 -0
- atomict/cli/commands/user.py +201 -0
- atomict/cli/core/client.py +202 -0
- atomict/cli/core/config.py +43 -0
- atomict/cli/core/utils.py +32 -0
- atomict/cli/main.py +130 -0
- atomict/env.py +79 -0
- atomict/exceptions.py +12 -0
- atomict/infra/distwork/environment.py +26 -0
- atomict/infra/distwork/task.py +49 -0
- atomict/infra/logging.py +22 -0
- atomict/io/cif.py +138 -0
- atomict/io/fhiaims.py +30 -0
- atomict/io/json.py +28 -0
- atomict/io/utils.py +11 -0
- atomict/ml/__init__.py +0 -0
- atomict/ml/model.py +13 -0
- atomict/project/__init__.py +1 -0
- atomict/project/link.py +26 -0
- atomict/project/note.py +18 -0
- atomict/project/project.py +32 -0
- atomict/project/tags.py +48 -0
- atomict/project/workbench.py +6 -0
- atomict/reality/__init__.py +0 -0
- atomict/reality/oqmd.py +5 -0
- atomict/reality/slabs.py +5 -0
- atomict/simulation/__init__.py +0 -0
- atomict/simulation/cantera.py +35 -0
- atomict/simulation/catalysis.py +20 -0
- atomict/simulation/counterfactual.py +28 -0
- atomict/simulation/ea.py +64 -0
- atomict/simulation/fhi_aims.py +72 -0
- atomict/simulation/kpoint.py +74 -0
- atomict/simulation/mattergen.py +20 -0
- atomict/simulation/mlrelax.py +83 -0
- atomict/simulation/phonon.py +12 -0
- atomict/simulation/qe.py +74 -0
- atomict/simulation/sqs.py +24 -0
- atomict/simulation/utils.py +90 -0
- atomict/user/__init__.py +0 -0
- atomict/user/files.py +31 -0
- atomict/user/workspace.py +112 -0
- atomict/utils/fhiaims/__init__.py +0 -0
- atomict/utils/fhiaims/geometry.py +73 -0
- atomict/utils/tenacity.py +36 -0
- {atomict-0.1.2.dist-info → atomict-0.2.4.dist-info}/LICENSE +0 -0
- atomict-0.2.4.dist-info/METADATA +109 -0
- atomict-0.2.4.dist-info/RECORD +78 -0
- {atomict-0.1.2.dist-info → atomict-0.2.4.dist-info}/WHEEL +1 -1
- atomict-0.2.4.dist-info/entry_points.txt +2 -0
- {atomict-0.1.2.dist-info → atomict-0.2.4.dist-info}/top_level.txt +0 -1
- atomict/__main__.py +0 -3
- atomict/cli.py +0 -59
- atomict/datasets/__init__.py +0 -25
- atomict/datasets/io.py +0 -47
- atomict/datasets/public.py +0 -32
- atomict/utils/requests.py +0 -19
- atomict/version.py +0 -2
- atomict-0.1.2.dist-info/METADATA +0 -97
- atomict-0.1.2.dist-info/RECORD +0 -19
- atomict-0.1.2.dist-info/entry_points.txt +0 -2
- tests/test_sdk.py +0 -16
- /atomict/{auth → cli}/__init__.py +0 -0
- /atomict/{utils → infra}/__init__.py +0 -0
- {tests → atomict/infra/distwork}/__init__.py +0 -0
- /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
|