atomict 1.2.24__py3-none-any.whl → 1.2.25__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/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.2.24"
1
+ __version__ = "1.2.25"
@@ -0,0 +1,117 @@
1
+ # cli/commands/workspace.py
2
+ import base64
3
+ import os
4
+ from pathlib import Path
5
+ from typing import Optional
6
+
7
+ import click
8
+ from rich.console import Console
9
+ from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
10
+
11
+ from atomict.cli.commands.common import create_table
12
+ from atomict.cli.commands.helpers import format_datetime
13
+ from atomict.cli.core.client import get_client
14
+
15
+ console = Console()
16
+
17
+
18
+ @click.group(name="workspace")
19
+ def workspace_group():
20
+ """Manage workspace simulations and files"""
21
+ pass
22
+
23
+
24
+ @workspace_group.command()
25
+ @click.argument('uuid', type=str)
26
+ @click.argument('path', type=str, default=".", required=False)
27
+ def cp(uuid: str, path: str = "."):
28
+ """Download simulation files by UUID to a directory
29
+
30
+ Example:
31
+ tess workspace cp 8f328887-62ae-4ace-b37b-2c31640baa47 .
32
+ """
33
+ client = get_client()
34
+
35
+ # Fetch simulation metadata
36
+ try:
37
+ result = client.get(f"/simulation/lookup/{uuid}/")
38
+ except Exception as e:
39
+ console.print(f"[red]Error fetching simulation: {e}[/red]")
40
+ return
41
+
42
+ sim_type = result.get("type", "Unknown")
43
+ simulation = result.get("simulation", {})
44
+ files = result.get("files", [])
45
+
46
+ # Display simulation info
47
+ console.print(f"\n[bold cyan]Simulation Type:[/bold cyan] {sim_type}")
48
+ console.print(f"[bold cyan]ID:[/bold cyan] {simulation.get('id', 'N/A')}")
49
+ console.print(f"[bold cyan]Name:[/bold cyan] {simulation.get('name') or '(unnamed)'}")
50
+
51
+ if not files:
52
+ console.print("\n[yellow]No files found for this simulation[/yellow]")
53
+ return
54
+
55
+ # Create output directory
56
+ output_path = Path(path)
57
+ output_path.mkdir(parents=True, exist_ok=True)
58
+
59
+ console.print(f"\n[bold green]Downloading {len(files)} file(s) to: {output_path.absolute()}[/bold green]\n")
60
+
61
+ # Download files with progress bar
62
+ with Progress(
63
+ SpinnerColumn(),
64
+ TextColumn("[progress.description]{task.description}"),
65
+ BarColumn(),
66
+ TaskProgressColumn(),
67
+ console=console
68
+ ) as progress:
69
+
70
+ download_task = progress.add_task("[cyan]Downloading files...", total=len(files))
71
+ download_ct = 0
72
+ for file_info in files:
73
+ # Extract user_upload info (handle nested structure)
74
+ user_upload = file_info.get('user_upload', {})
75
+ if isinstance(user_upload, dict):
76
+ file_id = user_upload.get('id')
77
+ filename = user_upload.get('orig_name', f"file-{file_id}")
78
+ else:
79
+ # If user_upload is an ID string
80
+ file_id = user_upload
81
+ filename = f"file-{file_id}"
82
+
83
+ if not file_id:
84
+ console.print(f"[yellow]Skipping file with no ID[/yellow]")
85
+ progress.advance(download_task)
86
+ continue
87
+
88
+ progress.update(download_task, description=f"[cyan]Downloading: {filename}")
89
+
90
+ try:
91
+ # Fetch file with content
92
+ file_data = client.get(
93
+ f"/api/user-upload/{file_id}/",
94
+ params={"include_content": "true"}
95
+ )
96
+
97
+ file_content_b64 = file_data.get("file_content_base64")
98
+ if not file_content_b64:
99
+ console.print(f"[red]✗ No content received for: {filename}[/red]")
100
+ progress.advance(download_task)
101
+ continue
102
+
103
+ # Decode and save file
104
+ file_path = output_path / filename
105
+ with open(file_path, "wb") as f:
106
+ f.write(base64.b64decode(file_content_b64))
107
+
108
+ progress.advance(download_task)
109
+
110
+ except Exception as e:
111
+ console.print(f"[red]✗ Error downloading {filename}: {e}[/red]")
112
+ progress.advance(download_task)
113
+
114
+ download_ct += 1
115
+
116
+ console.print(f"\n[bold {'green' if download_ct else 'red'}]Downloaded {download_ct} file(s)[/bold {'green' if download_ct else 'red'}]")
117
+
atomict/cli/main.py CHANGED
@@ -7,7 +7,7 @@ import click
7
7
  from rich.console import Console
8
8
 
9
9
  from atomict.__version__ import __version__
10
- from atomict.cli.commands import login, token, user
10
+ from atomict.cli.commands import login, token, user, workspace
11
11
  from .commands import k8s, project, task, traj, upload, convert
12
12
  from .commands.exploration import soec, sqs
13
13
  from .commands.simulation import fhiaims, kpoint
@@ -101,6 +101,7 @@ cli.add_command(sqs.sqs_group)
101
101
  cli.add_command(soec.soecexploration_group)
102
102
  cli.add_command(traj.traj)
103
103
  cli.add_command(user.user_group)
104
+ cli.add_command(workspace.workspace_group)
104
105
  cli.add_command(login._login)
105
106
  cli.add_command(token._token)
106
107
 
atomict/io/trajectory.py CHANGED
@@ -123,7 +123,25 @@ class TrajectoryWriter:
123
123
  raise TypeError('Unsupported atoms-like object; expected ASE Atoms or compatible wrapper')
124
124
  plain = Atoms(numbers=numbers, positions=positions, cell=cell, pbc=pbc)
125
125
  # Make a copy to avoid all frames pointing to the same object after in-place modifications
126
- self._buffer.append(plain.copy())
126
+ copied = plain.copy()
127
+
128
+ # Preserve calculator results using SinglePointCalculator
129
+ # (ASE's Atoms.copy() intentionally does not copy the calculator)
130
+ if plain.calc is not None:
131
+ from ase.calculators.singlepoint import SinglePointCalculator
132
+
133
+ results = {}
134
+ for prop in ['energy', 'forces', 'stress', 'dipole', 'charges', 'magmom', 'magmoms']:
135
+ try:
136
+ val = plain.calc.get_property(prop, plain, allow_calculation=False)
137
+ if val is not None:
138
+ results[prop] = val
139
+ except Exception:
140
+ pass
141
+ if results:
142
+ copied.calc = SinglePointCalculator(copied, **results)
143
+
144
+ self._buffer.append(copied)
127
145
 
128
146
  def close(self) -> None:
129
147
  """Flush buffered frames and/or close backend."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atomict
3
- Version: 1.2.24
3
+ Version: 1.2.25
4
4
  Summary: The client application for the https://atomictessellator.com/
5
5
  Author-email: Steven Anderson <steven@atomictessellator.com>, Alain Richardt <alain@atomictessellator.com>
6
6
  License: MIT
@@ -1,12 +1,12 @@
1
1
  atomict/__init__.py,sha256=nMXg9GFsk8gCcyBnh1MAeUPvo4Zcuv3sdwGHZrxfpPE,36
2
- atomict/__version__.py,sha256=rRcFnLqwG22zZ399qswskAE5L_if50hEsd_TKzGcrZ4,23
2
+ atomict/__version__.py,sha256=9j001fhDZzLSWs6YCbGQFuK5ERX5EUWz3RKLN8l5JS8,23
3
3
  atomict/api.py,sha256=1aI2qPMm6V9VY4PLR8LBMm2WwVCBB9pAL7sEowvjhtc,6706
4
4
  atomict/auth.py,sha256=yMEaxaSg44tSDxr4x-bjwjjn9zIsqw_bVoKd01Zd9LU,987
5
5
  atomict/env.py,sha256=RqK5SUfCDJ6aMGtCPhNmSrwsNZSjlGaDQYYk41oeBDc,2115
6
6
  atomict/exceptions.py,sha256=-PT-Bw-2SoPAME0ELXCXRBsU7tBOAbHTscnvnGRto-4,146
7
7
  atomict/ase/atatoms.py,sha256=I0RnhHMi_tkl22lcuJKlyXv26rSdzXYeqkzTsCBFgrE,27737
8
8
  atomict/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- atomict/cli/main.py,sha256=mRGjZBWHW-8Z-LXpwshaJGAB72tjCwFNNKjn9jXaqVk,3518
9
+ atomict/cli/main.py,sha256=wasnTCE1VFQSes3m2qVRjk-jIFMjYt_Zeurd0812e3E,3572
10
10
  atomict/cli/commands/ai_assist.py,sha256=IgZyoeL5mdwkcwxKWD7y0Enjus-wSlrYee-keyacOOY,3449
11
11
  atomict/cli/commands/common.py,sha256=NG8hiLxUGtk-fW5uVs30nKqVciireghoczT7YsGoR1w,1630
12
12
  atomict/cli/commands/convert.py,sha256=5cRtaYLnYK9Yc3462ydMCk7GLGld1RCkVEohIF-CJs8,4608
@@ -20,6 +20,7 @@ atomict/cli/commands/token.py,sha256=yTyH0J2xStO2cly9iifMHd8QTvHVPHL0owe4r6XUJ5s
20
20
  atomict/cli/commands/traj.py,sha256=SIgBYKKIFJ-_C37abefEO2Qzoql4GFYuIGgPmCykoj0,1675
21
21
  atomict/cli/commands/upload.py,sha256=U7OW4mrYeqfoMHXPIBNTHDTOvx_-rGiY82Sj72y8N-Q,2823
22
22
  atomict/cli/commands/user.py,sha256=7jja2At19hrMoTaRx7PrAZRS0C48BJjIN9WEmzN7Xxc,6486
23
+ atomict/cli/commands/workspace.py,sha256=tAchOx4ycIwHsV-9uIAXdIyCz0Umdf5mBO38fy7jO28,4169
23
24
  atomict/cli/commands/exploration/__init__.py,sha256=LTuDJsRPL62w-YYXx-X_GgsuD2Dovj74h-G5tTw5DaE,169
24
25
  atomict/cli/commands/exploration/soec.py,sha256=ZkKJKHz97OaswLS0hptyEquQyyATkfb8T6EI3ngkg68,18888
25
26
  atomict/cli/commands/exploration/sqs.py,sha256=AVyiU25SvOv1I-lYfCqgnnaEmCiFNDggsP1GLcmliS8,14593
@@ -37,7 +38,7 @@ atomict/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
38
  atomict/io/atoms.py,sha256=kdMnto7eyiY2zmoOvLlzbuTGUCIp4ViQGwLmf2m9fGU,13144
38
39
  atomict/io/cif.py,sha256=s4ThgriM_yyqKUZ8_RIPHm7lz7U5-hX8Jv96JNU2QVo,5793
39
40
  atomict/io/fhiaims.py,sha256=Zh_HAsv6128acSwzSeTrGN1Ra1I_RvDwJsubRODovaY,958
40
- atomict/io/trajectory.py,sha256=8ggVQ0zPbdicQ_sPqY7KN-TWjaN8nCfTYs5s8qQoMeo,9895
41
+ atomict/io/trajectory.py,sha256=YPse0IQROaWGXY1LzKNVAzwWhMHzvq17bSkhHUxZYco,10701
41
42
  atomict/io/utils.py,sha256=ncA8XchNN3lJT8EhJK6tLJE9TvmHmPlxizTnY5ASvEc,272
42
43
  atomict/io/formats/__init__.py,sha256=_wKNHpV0VZKh7mzO6kRfaETYPxg_DYbrJwH4kqduD9Q,300
43
44
  atomict/io/formats/atraj.py,sha256=GUw_Ic7N2msD6U2LjjR-qR55ASFdALuDmkYxOmCPGlk,3051
@@ -78,9 +79,9 @@ atomict/utils/tenacity.py,sha256=phc6YPEk7idqiFFeHeK-ngiAaqVOZFYp8S7dX1k-YXc,998
78
79
  atomict/utils/traj.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
80
  atomict/utils/fhiaims/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
81
  atomict/utils/fhiaims/geometry.py,sha256=Dr8g-xTqiH5tTFncn1wZmSnbetvvDylgxL3LldtdFD0,2022
81
- atomict-1.2.24.dist-info/licenses/LICENSE,sha256=fzvTkxUzi2u1cea_aRtmg5_mRk6ZyLWJJRr49K28qKg,1075
82
- atomict-1.2.24.dist-info/METADATA,sha256=3Mb-XYJVCrYn1T3MEh9KZFoM_4P1T34Ma-knyN-jO_o,2938
83
- atomict-1.2.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
- atomict-1.2.24.dist-info/entry_points.txt,sha256=PozguIUgJUHgS65PSZBHNPUiwYGDwXa4vLZ7hde3aq8,47
85
- atomict-1.2.24.dist-info/top_level.txt,sha256=CCo525YmAj7ZbToMmQcVKQ-JiIiFKiq3GmhIYCG2gaM,8
86
- atomict-1.2.24.dist-info/RECORD,,
82
+ atomict-1.2.25.dist-info/licenses/LICENSE,sha256=fzvTkxUzi2u1cea_aRtmg5_mRk6ZyLWJJRr49K28qKg,1075
83
+ atomict-1.2.25.dist-info/METADATA,sha256=O0F0BhL-KI0M3koXlP_MDc8AwuljEj0PqlvYt23pBd0,2938
84
+ atomict-1.2.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
+ atomict-1.2.25.dist-info/entry_points.txt,sha256=PozguIUgJUHgS65PSZBHNPUiwYGDwXa4vLZ7hde3aq8,47
86
+ atomict-1.2.25.dist-info/top_level.txt,sha256=CCo525YmAj7ZbToMmQcVKQ-JiIiFKiq3GmhIYCG2gaM,8
87
+ atomict-1.2.25.dist-info/RECORD,,