atomict 1.2.19__tar.gz → 1.2.21__tar.gz
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-1.2.19 → atomict-1.2.21}/PKG-INFO +2 -1
- {atomict-1.2.19 → atomict-1.2.21}/README.md +1 -0
- atomict-1.2.21/atomict/__version__.py +1 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/atoms.py +2 -1
- atomict-1.2.21/atomict/io/formats/__init__.py +15 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/formats/atraj.py +4 -4
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/formats/tess.py +215 -21
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/formats/traj.py +2 -2
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/mlrelax.py +4 -23
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/phonon.py +0 -3
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/utils.py +5 -4
- {atomict-1.2.19 → atomict-1.2.21}/atomict.egg-info/PKG-INFO +2 -1
- {atomict-1.2.19 → atomict-1.2.21}/atomict.egg-info/SOURCES.txt +1 -0
- atomict-1.2.19/atomict/__version__.py +0 -1
- {atomict-1.2.19 → atomict-1.2.21}/LICENSE +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/api.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/ase/atatoms.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/auth.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/adsorbate.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/ai_assist.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/catalysis.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/common.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/exploration/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/exploration/soec.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/exploration/sqs.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/helpers.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/k8s.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/login.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/organization.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/project.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/simulation/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/simulation/catalysis.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/simulation/fhiaims.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/simulation/kpoint.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/simulation/vibes.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/simulation.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/task.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/token.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/traj.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/upload.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/commands/user.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/core/client.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/core/config.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/core/utils.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/ext/custom_classes.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/cli/main.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/env.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/exceptions.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/infra/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/infra/distwork/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/infra/distwork/environment.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/infra/distwork/task.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/infra/logging.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/cif.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/fhiaims.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/io/utils.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/ml/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/ml/model.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/project/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/project/link.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/project/note.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/project/project.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/project/tags.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/project/workbench.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/reality/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/reality/oqmd.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/reality/slabs.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/cantera.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/catalysis.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/counterfactual.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/defect.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/ea.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/fhi_aims.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/impact.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/kpoint.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/mattergen.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/md.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/models.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/qe.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/sh.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/simulation/sqs.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/user/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/user/files.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/user/workspace.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/utils/fhiaims/__init__.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/utils/fhiaims/geometry.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/utils/tenacity.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict/utils/traj.py +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict.egg-info/dependency_links.txt +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict.egg-info/entry_points.txt +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict.egg-info/requires.txt +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/atomict.egg-info/top_level.txt +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/pyproject.toml +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/requirements.txt +0 -0
- {atomict-1.2.19 → atomict-1.2.21}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: atomict
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.21
|
|
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
|
|
@@ -124,3 +124,4 @@ Tab completion is available. Run the hidden command:
|
|
|
124
124
|
```tess completion```
|
|
125
125
|
|
|
126
126
|
This will print out the instructions for enabling tab completion for your shell.
|
|
127
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.21"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
from typing import List
|
|
1
2
|
import numpy as np
|
|
2
3
|
from ase import Atoms
|
|
3
4
|
from ase.constraints import dict2constraint
|
|
4
5
|
from ase.calculators.singlepoint import SinglePointCalculator
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
def atoms_to_dict(atoms_list, selective=False):
|
|
8
|
+
def atoms_to_dict(atoms_list: List[Atoms], selective: bool = False):
|
|
8
9
|
"""Extract all properties from ASE Atoms objects into a standardized dictionary.
|
|
9
10
|
|
|
10
11
|
Parameters:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from atomict.io.formats.atraj import (
|
|
2
|
+
read_atraj,
|
|
3
|
+
write_atraj,
|
|
4
|
+
)
|
|
5
|
+
from atomict.io.formats.tess import (
|
|
6
|
+
read_tess,
|
|
7
|
+
write_tess,
|
|
8
|
+
)
|
|
9
|
+
from atomict.io.formats.traj import (
|
|
10
|
+
read_traj,
|
|
11
|
+
write_traj,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
__all__ = [read_atraj, write_atraj, read_tess, write_tess, read_traj, write_traj]
|
|
@@ -8,14 +8,14 @@ if TYPE_CHECKING:
|
|
|
8
8
|
def write_atraj(atoms: Union['ase.Atoms', List['ase.Atoms']], filename: str, metadata: Dict = None):
|
|
9
9
|
"""Save atoms to a mpv1 file."""
|
|
10
10
|
|
|
11
|
-
from atomict.io.
|
|
11
|
+
from atomict.io.atoms import atoms_to_dict
|
|
12
12
|
|
|
13
13
|
try:
|
|
14
14
|
import msgpack
|
|
15
15
|
import msgpack_numpy as m
|
|
16
16
|
from ase import Atoms
|
|
17
17
|
except ImportError:
|
|
18
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use
|
|
18
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
19
19
|
|
|
20
20
|
# Enable numpy array serialization
|
|
21
21
|
m.patch()
|
|
@@ -46,13 +46,13 @@ def write_atraj(atoms: Union['ase.Atoms', List['ase.Atoms']], filename: str, met
|
|
|
46
46
|
def read_atraj(filename: str) -> Union['ase.Atoms', List['ase.Atoms']]:
|
|
47
47
|
|
|
48
48
|
"""Load atoms from a mpv1 file."""
|
|
49
|
-
from atomict.io.
|
|
49
|
+
from atomict.io.atoms import dict_to_atoms
|
|
50
50
|
|
|
51
51
|
try:
|
|
52
52
|
import msgpack
|
|
53
53
|
import msgpack_numpy as m
|
|
54
54
|
except ImportError:
|
|
55
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use
|
|
55
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
56
56
|
|
|
57
57
|
# Enable numpy array deserialization
|
|
58
58
|
m.patch()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from concurrent.futures import ThreadPoolExecutor
|
|
2
|
-
from typing import Dict, List, Optional, Tuple, Union, TYPE_CHECKING
|
|
2
|
+
from typing import Dict, List, Optional, Tuple, Union, TYPE_CHECKING, Any, cast
|
|
3
3
|
|
|
4
4
|
if TYPE_CHECKING:
|
|
5
5
|
from ase import Atoms
|
|
@@ -31,7 +31,7 @@ def write_tess(
|
|
|
31
31
|
import lz4.block
|
|
32
32
|
import numpy as np
|
|
33
33
|
except ImportError:
|
|
34
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use
|
|
34
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
35
35
|
|
|
36
36
|
# Enable numpy array serialization
|
|
37
37
|
m.patch()
|
|
@@ -67,14 +67,106 @@ def write_tess(
|
|
|
67
67
|
positions_list = [a.get_positions().astype(np.float32) for a in frames_list]
|
|
68
68
|
if cell_changes:
|
|
69
69
|
cells_list = [np.array(a.get_cell(), dtype=np.float32) for a in frames_list]
|
|
70
|
+
|
|
71
|
+
# Ensure constant atom count and species across frames for tess format
|
|
72
|
+
first_numbers = np.asarray(frames_list[0].get_atomic_numbers())
|
|
73
|
+
for a in frames_list[1:]:
|
|
74
|
+
if len(a) != len(frames_list[0]) or not np.array_equal(np.asarray(a.get_atomic_numbers()), first_numbers):
|
|
75
|
+
raise ValueError("tess format requires constant atom count and species across frames")
|
|
76
|
+
|
|
77
|
+
# Determine static vs per-frame ASE arrays
|
|
78
|
+
first_tags = np.asarray(frames_list[0].get_tags())
|
|
79
|
+
tags_static = all(np.array_equal(np.asarray(a.get_tags()), first_tags) for a in frames_list)
|
|
80
|
+
|
|
81
|
+
first_init_charges = np.asarray(frames_list[0].get_initial_charges())
|
|
82
|
+
init_charges_static = all(np.array_equal(np.asarray(a.get_initial_charges()), first_init_charges) for a in frames_list)
|
|
83
|
+
|
|
84
|
+
first_init_magmoms = np.asarray(frames_list[0].get_initial_magnetic_moments())
|
|
85
|
+
init_magmoms_static = all(np.array_equal(np.asarray(a.get_initial_magnetic_moments()), first_init_magmoms) for a in frames_list)
|
|
86
|
+
|
|
87
|
+
# Per-frame dynamic arrays/props presence checks
|
|
88
|
+
has_any_momenta = any(np.any(np.abs(a.get_momenta()) > 1e-10) for a in frames_list)
|
|
89
|
+
has_any_forces = any('forces' in a.arrays for a in frames_list)
|
|
90
|
+
has_any_stress = any(hasattr(a, 'stress') and getattr(a, 'stress') is not None for a in frames_list)
|
|
91
|
+
|
|
92
|
+
# Helper to extract calculator results per frame (aligned with atoms_to_dict)
|
|
93
|
+
def _calc_results_for(a):
|
|
94
|
+
calc_data = {}
|
|
95
|
+
calc_found = False
|
|
96
|
+
if hasattr(a, 'calc') and a.calc is not None:
|
|
97
|
+
calc_found = True
|
|
98
|
+
calc_data['name'] = a.calc.__class__.__name__
|
|
99
|
+
for prop in ['energy', 'free_energy', 'forces', 'stress', 'dipole', 'charges', 'magmom', 'magmoms']:
|
|
100
|
+
try:
|
|
101
|
+
if hasattr(a.calc, 'results') and prop in a.calc.results:
|
|
102
|
+
calc_data[prop] = a.calc.results[prop]
|
|
103
|
+
else:
|
|
104
|
+
value = a.calc.get_property(prop, a)
|
|
105
|
+
if value is not None:
|
|
106
|
+
calc_data[prop] = value
|
|
107
|
+
except Exception:
|
|
108
|
+
pass
|
|
109
|
+
if not calc_found and hasattr(a, 'info'):
|
|
110
|
+
calc_name = a.info.get('_calc_name')
|
|
111
|
+
if calc_name:
|
|
112
|
+
calc_data['name'] = calc_name
|
|
113
|
+
for key, value in a.info.items():
|
|
114
|
+
if key.startswith('_calc_') and key != '_calc_name':
|
|
115
|
+
calc_data[key[6:]] = value
|
|
116
|
+
return calc_data if len(calc_data) > 0 else None
|
|
117
|
+
|
|
118
|
+
has_any_calc = any(_calc_results_for(a) is not None for a in frames_list)
|
|
119
|
+
|
|
120
|
+
# Helper to serialize info dict values (to_dict/todict if available)
|
|
121
|
+
def _serialize_info(info: Dict) -> Dict:
|
|
122
|
+
out = {}
|
|
123
|
+
for k, v in (info or {}).items():
|
|
124
|
+
if hasattr(v, 'to_dict') and callable(v.to_dict):
|
|
125
|
+
out[k] = v.to_dict()
|
|
126
|
+
elif hasattr(v, 'todict') and callable(v.todict):
|
|
127
|
+
out[k] = v.todict()
|
|
128
|
+
else:
|
|
129
|
+
out[k] = v
|
|
130
|
+
return out
|
|
70
131
|
|
|
71
132
|
# Optimized frame serialization - pack only essential per-frame data
|
|
72
133
|
def _pack_frame(i: int) -> bytes:
|
|
73
134
|
# Only pack data that changes between frames
|
|
135
|
+
a = frames_list[i]
|
|
74
136
|
frame_dict = {'positions': positions_list[i]}
|
|
75
137
|
if cell_changes:
|
|
76
138
|
frame_dict['cell'] = cells_list[i]
|
|
77
|
-
|
|
139
|
+
# Per-frame arrays
|
|
140
|
+
if has_any_momenta:
|
|
141
|
+
frame_dict['momenta'] = a.get_momenta()
|
|
142
|
+
if not tags_static:
|
|
143
|
+
frame_dict['tags'] = a.get_tags()
|
|
144
|
+
if not init_charges_static:
|
|
145
|
+
frame_dict['initial_charges'] = a.get_initial_charges()
|
|
146
|
+
if not init_magmoms_static:
|
|
147
|
+
frame_dict['initial_magmoms'] = a.get_initial_magnetic_moments()
|
|
148
|
+
# Forces/stress
|
|
149
|
+
if has_any_forces and 'forces' in a.arrays:
|
|
150
|
+
frame_dict['forces'] = a.arrays['forces']
|
|
151
|
+
if has_any_stress and hasattr(a, 'stress') and getattr(a, 'stress') is not None:
|
|
152
|
+
frame_dict['stress'] = np.asarray(getattr(a, 'stress'), dtype=np.float64)
|
|
153
|
+
# Calculator results
|
|
154
|
+
if has_any_calc:
|
|
155
|
+
calc_data = _calc_results_for(a)
|
|
156
|
+
if calc_data is not None:
|
|
157
|
+
frame_dict['calc_results'] = calc_data
|
|
158
|
+
# Info dict
|
|
159
|
+
if hasattr(a, 'info') and a.info:
|
|
160
|
+
frame_dict['info'] = _serialize_info(a.info)
|
|
161
|
+
# Custom arrays
|
|
162
|
+
standard_arrays = {'numbers', 'positions', 'momenta', 'masses', 'tags', 'charges', 'forces'}
|
|
163
|
+
custom_arrays = {}
|
|
164
|
+
for key, value in a.arrays.items():
|
|
165
|
+
if key not in standard_arrays:
|
|
166
|
+
custom_arrays[key] = value
|
|
167
|
+
if custom_arrays:
|
|
168
|
+
frame_dict['custom_arrays'] = custom_arrays
|
|
169
|
+
return cast(bytes, msgpack.packb(frame_dict, use_bin_type=True))
|
|
78
170
|
|
|
79
171
|
with open(filename, 'wb', buffering=1024*1024) as f:
|
|
80
172
|
frame_offsets: List[Tuple[int, int]] = []
|
|
@@ -121,8 +213,8 @@ def write_tess(
|
|
|
121
213
|
symbols_idx = np.array([unique_symbols_lookup[s] for s in symbols], dtype=np.uint16)
|
|
122
214
|
|
|
123
215
|
# Write header
|
|
124
|
-
header_dict: Dict[str,
|
|
125
|
-
'format_version':
|
|
216
|
+
header_dict: Dict[str, Any] = {
|
|
217
|
+
'format_version': 5,
|
|
126
218
|
'metadata': dict(metadata or {}),
|
|
127
219
|
'unique_symbols': unique_symbols,
|
|
128
220
|
'num_frames': len(frames_list),
|
|
@@ -138,14 +230,20 @@ def write_tess(
|
|
|
138
230
|
'cell_changes': cell_changes,
|
|
139
231
|
}
|
|
140
232
|
}
|
|
233
|
+
# Add static arrays when invariant across frames
|
|
234
|
+
if tags_static:
|
|
235
|
+
header_dict['static_data']['tags'] = first_tags
|
|
236
|
+
if init_charges_static:
|
|
237
|
+
header_dict['static_data']['initial_charges'] = first_init_charges
|
|
238
|
+
if init_magmoms_static:
|
|
239
|
+
header_dict['static_data']['initial_magmoms'] = first_init_magmoms
|
|
141
240
|
if compression_mode != 'none':
|
|
142
|
-
|
|
143
|
-
'type': compression_mode,
|
|
144
|
-
}
|
|
241
|
+
comp_dict: Dict[str, Any] = {'type': compression_mode}
|
|
145
242
|
if compression_mode == 'zlib':
|
|
146
|
-
|
|
243
|
+
comp_dict['level'] = int(compression_level)
|
|
244
|
+
header_dict['compression'] = comp_dict
|
|
147
245
|
header_dict['frame_uncompressed_lengths'] = uncompressed_lengths
|
|
148
|
-
header_bytes = msgpack.packb(header_dict, use_bin_type=True)
|
|
246
|
+
header_bytes = cast(bytes, msgpack.packb(header_dict, use_bin_type=True))
|
|
149
247
|
header_start = f.tell()
|
|
150
248
|
f.write(header_bytes)
|
|
151
249
|
|
|
@@ -163,8 +261,10 @@ def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tupl
|
|
|
163
261
|
import mmap
|
|
164
262
|
import zlib
|
|
165
263
|
import lz4.block
|
|
264
|
+
import numpy as np
|
|
265
|
+
from ase.calculators.singlepoint import SinglePointCalculator
|
|
166
266
|
except ImportError:
|
|
167
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use
|
|
267
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
168
268
|
|
|
169
269
|
# Enable numpy array deserialization
|
|
170
270
|
m.patch()
|
|
@@ -185,7 +285,7 @@ def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tupl
|
|
|
185
285
|
header = msgpack.unpackb(header_bytes, raw=False, strict_map_key=False)
|
|
186
286
|
|
|
187
287
|
format_version = header.get('format_version', 1)
|
|
188
|
-
if format_version not in {2, 3, 4}:
|
|
288
|
+
if format_version not in {2, 3, 4, 5}:
|
|
189
289
|
raise ValueError("Invalid format version")
|
|
190
290
|
|
|
191
291
|
compression_info = header.get('compression')
|
|
@@ -218,10 +318,10 @@ def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tupl
|
|
|
218
318
|
filtered_offsets = [(i, offset) for i, offset in enumerate(frame_offsets)]
|
|
219
319
|
|
|
220
320
|
# Pre-allocate the result list based on requested frames
|
|
221
|
-
atoms_list = [None] * len(frames_to_load)
|
|
321
|
+
atoms_list: List[Optional[Atoms]] = [None] * len(frames_to_load)
|
|
222
322
|
|
|
223
|
-
# Handle format version 4 with static data
|
|
224
|
-
if format_version
|
|
323
|
+
# Handle format version 4/5 with static data
|
|
324
|
+
if format_version in {4, 5}:
|
|
225
325
|
static_data = header.get('static_data', {})
|
|
226
326
|
unique_symbols = header['unique_symbols']
|
|
227
327
|
symbols_idx = static_data['symbols']
|
|
@@ -231,13 +331,21 @@ def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tupl
|
|
|
231
331
|
pbc = static_data['pbc']
|
|
232
332
|
static_cell = static_data.get('cell')
|
|
233
333
|
cell_changes = static_data.get('cell_changes', True)
|
|
334
|
+
static_tags = static_data.get('tags')
|
|
335
|
+
static_init_charges = static_data.get('initial_charges')
|
|
336
|
+
static_init_magmoms = static_data.get('initial_magmoms')
|
|
234
337
|
|
|
235
338
|
# Create a template Atoms object to clone for efficiency
|
|
236
|
-
import numpy as np
|
|
237
339
|
template_atoms = Atoms(numbers=numbers, pbc=pbc)
|
|
238
340
|
template_atoms.set_masses(masses)
|
|
239
341
|
if static_cell is not None:
|
|
240
342
|
template_atoms.set_cell(static_cell)
|
|
343
|
+
if static_tags is not None:
|
|
344
|
+
template_atoms.set_tags(static_tags)
|
|
345
|
+
if static_init_charges is not None:
|
|
346
|
+
template_atoms.set_initial_charges(static_init_charges)
|
|
347
|
+
if static_init_magmoms is not None:
|
|
348
|
+
template_atoms.set_initial_magnetic_moments(static_init_magmoms)
|
|
241
349
|
else:
|
|
242
350
|
convert = dict_to_atoms
|
|
243
351
|
static_data = None
|
|
@@ -263,12 +371,42 @@ def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tupl
|
|
|
263
371
|
frame_dict = msgpack.unpackb(
|
|
264
372
|
frame_bytes, raw=False, strict_map_key=False
|
|
265
373
|
)
|
|
266
|
-
if format_version
|
|
267
|
-
# Fast path for v4: clone template and update
|
|
374
|
+
if format_version in {4, 5}:
|
|
375
|
+
# Fast path for v4/v5: clone template and update changing data
|
|
268
376
|
atoms = template_atoms.copy()
|
|
269
377
|
atoms.set_positions(frame_dict['positions'])
|
|
270
378
|
if cell_changes and 'cell' in frame_dict:
|
|
271
379
|
atoms.set_cell(frame_dict['cell'])
|
|
380
|
+
# v5: restore additional properties if present
|
|
381
|
+
if format_version == 5:
|
|
382
|
+
if 'tags' in frame_dict:
|
|
383
|
+
atoms.set_tags(frame_dict['tags'])
|
|
384
|
+
if 'initial_charges' in frame_dict:
|
|
385
|
+
atoms.set_initial_charges(frame_dict['initial_charges'])
|
|
386
|
+
if 'initial_magmoms' in frame_dict:
|
|
387
|
+
atoms.set_initial_magnetic_moments(frame_dict['initial_magmoms'])
|
|
388
|
+
if 'momenta' in frame_dict:
|
|
389
|
+
atoms.set_momenta(frame_dict['momenta'])
|
|
390
|
+
if 'forces' in frame_dict:
|
|
391
|
+
atoms.arrays['forces'] = frame_dict['forces']
|
|
392
|
+
if 'info' in frame_dict and isinstance(frame_dict['info'], dict):
|
|
393
|
+
atoms.info.update(frame_dict['info'])
|
|
394
|
+
if 'custom_arrays' in frame_dict and isinstance(frame_dict['custom_arrays'], dict):
|
|
395
|
+
for k, v in frame_dict['custom_arrays'].items():
|
|
396
|
+
atoms.arrays[k] = v
|
|
397
|
+
# Calculator results (merge stress if present)
|
|
398
|
+
calc_data = {}
|
|
399
|
+
if 'calc_results' in frame_dict and isinstance(frame_dict['calc_results'], dict):
|
|
400
|
+
calc_data = dict(frame_dict['calc_results'])
|
|
401
|
+
if 'stress' in frame_dict:
|
|
402
|
+
calc_data['stress'] = frame_dict['stress']
|
|
403
|
+
if len(calc_data) > 0:
|
|
404
|
+
calc = SinglePointCalculator(atoms)
|
|
405
|
+
for key, value in calc_data.items():
|
|
406
|
+
if key != 'name':
|
|
407
|
+
calc.results[key] = value
|
|
408
|
+
if calc.results:
|
|
409
|
+
atoms.calc = calc
|
|
272
410
|
atoms_list[chunk_start + result_idx] = atoms
|
|
273
411
|
else:
|
|
274
412
|
atoms_list[chunk_start + result_idx] = convert(frame_dict)[0]
|
|
@@ -291,11 +429,39 @@ def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tupl
|
|
|
291
429
|
frame_dict = msgpack.unpackb(
|
|
292
430
|
frame_bytes, raw=False, strict_map_key=False
|
|
293
431
|
)
|
|
294
|
-
if format_version
|
|
432
|
+
if format_version in {4, 5}:
|
|
295
433
|
atoms = template_atoms.copy()
|
|
296
434
|
atoms.set_positions(frame_dict['positions'])
|
|
297
435
|
if cell_changes and 'cell' in frame_dict:
|
|
298
436
|
atoms.set_cell(frame_dict['cell'])
|
|
437
|
+
if format_version == 5:
|
|
438
|
+
if 'tags' in frame_dict:
|
|
439
|
+
atoms.set_tags(frame_dict['tags'])
|
|
440
|
+
if 'initial_charges' in frame_dict:
|
|
441
|
+
atoms.set_initial_charges(frame_dict['initial_charges'])
|
|
442
|
+
if 'initial_magmoms' in frame_dict:
|
|
443
|
+
atoms.set_initial_magnetic_moments(frame_dict['initial_magmoms'])
|
|
444
|
+
if 'momenta' in frame_dict:
|
|
445
|
+
atoms.set_momenta(frame_dict['momenta'])
|
|
446
|
+
if 'forces' in frame_dict:
|
|
447
|
+
atoms.arrays['forces'] = frame_dict['forces']
|
|
448
|
+
if 'info' in frame_dict and isinstance(frame_dict['info'], dict):
|
|
449
|
+
atoms.info.update(frame_dict['info'])
|
|
450
|
+
if 'custom_arrays' in frame_dict and isinstance(frame_dict['custom_arrays'], dict):
|
|
451
|
+
for k, v in frame_dict['custom_arrays'].items():
|
|
452
|
+
atoms.arrays[k] = v
|
|
453
|
+
calc_data = {}
|
|
454
|
+
if 'calc_results' in frame_dict and isinstance(frame_dict['calc_results'], dict):
|
|
455
|
+
calc_data = dict(frame_dict['calc_results'])
|
|
456
|
+
if 'stress' in frame_dict:
|
|
457
|
+
calc_data['stress'] = frame_dict['stress']
|
|
458
|
+
if len(calc_data) > 0:
|
|
459
|
+
calc = SinglePointCalculator(atoms)
|
|
460
|
+
for key, value in calc_data.items():
|
|
461
|
+
if key != 'name':
|
|
462
|
+
calc.results[key] = value
|
|
463
|
+
if calc.results:
|
|
464
|
+
atoms.calc = calc
|
|
299
465
|
atoms_list[chunk_start + result_idx] = atoms
|
|
300
466
|
else:
|
|
301
467
|
atoms_list[chunk_start + result_idx] = convert(frame_dict)[0]
|
|
@@ -305,15 +471,43 @@ def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tupl
|
|
|
305
471
|
frame_dict = msgpack.unpackb(
|
|
306
472
|
frame_slice, raw=False, strict_map_key=False
|
|
307
473
|
)
|
|
308
|
-
if format_version
|
|
474
|
+
if format_version in {4, 5}:
|
|
309
475
|
atoms = template_atoms.copy()
|
|
310
476
|
atoms.set_positions(frame_dict['positions'])
|
|
311
477
|
if cell_changes and 'cell' in frame_dict:
|
|
312
478
|
atoms.set_cell(frame_dict['cell'])
|
|
479
|
+
if format_version == 5:
|
|
480
|
+
if 'tags' in frame_dict:
|
|
481
|
+
atoms.set_tags(frame_dict['tags'])
|
|
482
|
+
if 'initial_charges' in frame_dict:
|
|
483
|
+
atoms.set_initial_charges(frame_dict['initial_charges'])
|
|
484
|
+
if 'initial_magmoms' in frame_dict:
|
|
485
|
+
atoms.set_initial_magnetic_moments(frame_dict['initial_magmoms'])
|
|
486
|
+
if 'momenta' in frame_dict:
|
|
487
|
+
atoms.set_momenta(frame_dict['momenta'])
|
|
488
|
+
if 'forces' in frame_dict:
|
|
489
|
+
atoms.arrays['forces'] = frame_dict['forces']
|
|
490
|
+
if 'info' in frame_dict and isinstance(frame_dict['info'], dict):
|
|
491
|
+
atoms.info.update(frame_dict['info'])
|
|
492
|
+
if 'custom_arrays' in frame_dict and isinstance(frame_dict['custom_arrays'], dict):
|
|
493
|
+
for k, v in frame_dict['custom_arrays'].items():
|
|
494
|
+
atoms.arrays[k] = v
|
|
495
|
+
calc_data = {}
|
|
496
|
+
if 'calc_results' in frame_dict and isinstance(frame_dict['calc_results'], dict):
|
|
497
|
+
calc_data = dict(frame_dict['calc_results'])
|
|
498
|
+
if 'stress' in frame_dict:
|
|
499
|
+
calc_data['stress'] = frame_dict['stress']
|
|
500
|
+
if len(calc_data) > 0:
|
|
501
|
+
calc = SinglePointCalculator(atoms)
|
|
502
|
+
for key, value in calc_data.items():
|
|
503
|
+
if key != 'name':
|
|
504
|
+
calc.results[key] = value
|
|
505
|
+
if calc.results:
|
|
506
|
+
atoms.calc = calc
|
|
313
507
|
atoms_list[result_idx] = atoms
|
|
314
508
|
else:
|
|
315
509
|
atoms_list[result_idx] = convert(frame_dict)[0]
|
|
316
510
|
finally:
|
|
317
511
|
mm.close()
|
|
318
512
|
|
|
319
|
-
return atoms_list, metadata
|
|
513
|
+
return cast(List[Atoms], atoms_list), metadata
|
|
@@ -19,7 +19,7 @@ def write_traj(atoms: Union['ase.Atoms', List['ase.Atoms']], filename: str, meta
|
|
|
19
19
|
from ase.io.trajectory import TrajectoryWriter
|
|
20
20
|
from ase import Atoms
|
|
21
21
|
except ImportError:
|
|
22
|
-
raise ImportError("You need to install
|
|
22
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
23
23
|
|
|
24
24
|
# Single atoms case - convert to list
|
|
25
25
|
if isinstance(atoms, Atoms):
|
|
@@ -46,7 +46,7 @@ def read_traj(filename: str) -> tuple[List['ase.Atoms'], Dict]:
|
|
|
46
46
|
try:
|
|
47
47
|
from ase.io.trajectory import TrajectoryReader
|
|
48
48
|
except ImportError:
|
|
49
|
-
raise ImportError("You need to install
|
|
49
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
50
50
|
|
|
51
51
|
atoms_list = []
|
|
52
52
|
metadata = {}
|
|
@@ -65,26 +65,6 @@ def create_mlrelaxation(
|
|
|
65
65
|
"Invalid computation type. Please use atomict.simulation.mlrelax.COMPUTATION_TYPE_RELAXATION or atomict.simulation.mlrelax.COMPUTATION_TYPE_SINGLE_POINT."
|
|
66
66
|
)
|
|
67
67
|
|
|
68
|
-
# backwards compat
|
|
69
|
-
if calculator:
|
|
70
|
-
if calculator not in [
|
|
71
|
-
MODEL_ORB_V3_CONSERVATIVE,
|
|
72
|
-
MODEL_ESEN_30M_OAM,
|
|
73
|
-
MODEL_UMA
|
|
74
|
-
]:
|
|
75
|
-
raise ValueError(
|
|
76
|
-
"Invalid model. Please use atomict.simulation.models.MODEL_ORB_V3_CONSERVATIVE, or atomict.simulation.models.MODEL_ESEN_30M_OAM, or atomict.simulation.models.MODEL_UMA."
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
else:
|
|
80
|
-
if model not in [
|
|
81
|
-
MODEL_ORB_V3_CONSERVATIVE,
|
|
82
|
-
MODEL_ESEN_30M_OAM,
|
|
83
|
-
]:
|
|
84
|
-
raise ValueError(
|
|
85
|
-
"Invalid model. Please use atomict.simulation.models.MODEL_ORB_V3_CONSERVATIVE, or atomict.simulation.models.MODEL_ESEN_30M_OAM, or atomict.simulation.models.MODEL_UMA."
|
|
86
|
-
)
|
|
87
|
-
|
|
88
68
|
payload = {
|
|
89
69
|
"project": project_id,
|
|
90
70
|
"source_geometry_id": source_geometry_id,
|
|
@@ -95,11 +75,12 @@ def create_mlrelaxation(
|
|
|
95
75
|
"f_max": f_max,
|
|
96
76
|
}
|
|
97
77
|
|
|
98
|
-
# backwards compat
|
|
99
|
-
|
|
78
|
+
# backwards compat - accept 'model' param but always send 'calculator' to API
|
|
79
|
+
# (model field was renamed to calculator in the backend)
|
|
80
|
+
if calculator is not None:
|
|
100
81
|
payload["calculator"] = calculator
|
|
101
82
|
else:
|
|
102
|
-
payload["
|
|
83
|
+
payload["calculator"] = model
|
|
103
84
|
|
|
104
85
|
if extra_simulation_kwargs:
|
|
105
86
|
payload.update(extra_simulation_kwargs)
|
|
@@ -64,9 +64,6 @@ def create_phonon_run(project_id: str, source_geometry_id: str, action: str, nam
|
|
|
64
64
|
name: str - The name of the Phonon Run
|
|
65
65
|
"""
|
|
66
66
|
|
|
67
|
-
if model not in [MODEL_ORB_D3_V2, MODEL_MATTERSIM_1_0_0_5M, MODEL_ORB_V3_CONSERVATIVE, MODEL_ESEN_30M_OAM]:
|
|
68
|
-
raise ValueError(f"Invalid model: {model}")
|
|
69
|
-
|
|
70
67
|
if action not in ["LAUNCH", "DRAFT"]:
|
|
71
68
|
raise ValueError(f"Invalid action: {action} (must be 'LAUNCH' or 'DRAFT')")
|
|
72
69
|
|
|
@@ -10,7 +10,8 @@ except ImportError:
|
|
|
10
10
|
import logging
|
|
11
11
|
import os
|
|
12
12
|
|
|
13
|
-
from atomict.io.msgpack import load_msgpack_trajectory
|
|
13
|
+
# from atomict.io.msgpack import load_msgpack_trajectory
|
|
14
|
+
from atomict.io.formats.atraj import read_atraj
|
|
14
15
|
from atomict.io.fhiaims import read_aims_output
|
|
15
16
|
from atomict.io.utils import human_filesize
|
|
16
17
|
from atomict.simulation.mlrelax import get_mlrelax, get_mlrelax_files
|
|
@@ -28,7 +29,7 @@ def fetch_source_geometry(sim: dict, workbench_dir: str) -> Atoms:
|
|
|
28
29
|
download_file(sim["source_geometry"]["id"], workbench_dir + f"/geometry.{extension}")
|
|
29
30
|
|
|
30
31
|
if extension == "atraj":
|
|
31
|
-
atoms, _ =
|
|
32
|
+
atoms, _ = read_atraj(workbench_dir + f"/geometry.{extension}")
|
|
32
33
|
else:
|
|
33
34
|
atoms = read(workbench_dir + f"/geometry.{extension}")
|
|
34
35
|
|
|
@@ -93,7 +94,7 @@ def fetch_relaxed_geometry(sim: dict, workbench_dir: str) -> Atoms:
|
|
|
93
94
|
atraj_file = os.path.join(mlrelax_dir, "relax.atraj")
|
|
94
95
|
|
|
95
96
|
if os.path.exists(atraj_file):
|
|
96
|
-
atoms, _ =
|
|
97
|
+
atoms, _ = read_atraj(atraj_file)
|
|
97
98
|
else:
|
|
98
99
|
atoms = read(traj_file)
|
|
99
100
|
|
|
@@ -110,7 +111,7 @@ def fetch_relaxed_geometry(sim: dict, workbench_dir: str) -> Atoms:
|
|
|
110
111
|
download_file(sim["starting_structure_userupload"]["id"], workbench_dir + f"/geometry.{extension}")
|
|
111
112
|
|
|
112
113
|
if extension == "atraj":
|
|
113
|
-
atoms, _ =
|
|
114
|
+
atoms, _ = read_atraj(workbench_dir + f"/geometry.{extension}")
|
|
114
115
|
else:
|
|
115
116
|
atoms = read(workbench_dir + f"/geometry.{extension}")
|
|
116
117
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: atomict
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.21
|
|
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
|
|
@@ -124,3 +124,4 @@ Tab completion is available. Run the hidden command:
|
|
|
124
124
|
```tess completion```
|
|
125
125
|
|
|
126
126
|
This will print out the instructions for enabling tab completion for your shell.
|
|
127
|
+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.19"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|