atomict 1.2.17__py3-none-any.whl → 1.2.20__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 +1 -1
- atomict/cli/main.py +30 -29
- atomict/io/{msgpack.py → atoms.py} +89 -238
- atomict/io/formats/__init__.py +15 -0
- atomict/io/formats/atraj.py +99 -0
- atomict/io/formats/tess.py +319 -0
- atomict/io/formats/traj.py +62 -0
- atomict/simulation/fhi_aims.py +5 -4
- atomict/simulation/mlrelax.py +11 -10
- atomict/simulation/models.py +2 -1
- atomict/simulation/phonon.py +0 -3
- atomict/simulation/utils.py +5 -4
- {atomict-1.2.17.dist-info → atomict-1.2.20.dist-info}/METADATA +3 -1
- {atomict-1.2.17.dist-info → atomict-1.2.20.dist-info}/RECORD +18 -15
- atomict/io/trajectory.py +0 -437
- {atomict-1.2.17.dist-info → atomict-1.2.20.dist-info}/WHEEL +0 -0
- {atomict-1.2.17.dist-info → atomict-1.2.20.dist-info}/entry_points.txt +0 -0
- {atomict-1.2.17.dist-info → atomict-1.2.20.dist-info}/licenses/LICENSE +0 -0
- {atomict-1.2.17.dist-info → atomict-1.2.20.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
2
|
+
from typing import Dict, List, Optional, Tuple, Union, TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from ase import Atoms
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _max_workers(task_count: int) -> int:
|
|
9
|
+
if task_count <= 1:
|
|
10
|
+
return 1
|
|
11
|
+
return max(1, min(task_count, 24))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _chunk_size(max_workers: int) -> int:
|
|
15
|
+
return max(1, max_workers * 4)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def write_tess(
|
|
19
|
+
atoms: Union['Atoms', List['Atoms']],
|
|
20
|
+
filename: str,
|
|
21
|
+
metadata: Optional[Dict] = None,
|
|
22
|
+
compression: Optional[str] = 'none',
|
|
23
|
+
compression_level: int = 0,
|
|
24
|
+
) -> None:
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
import msgpack
|
|
28
|
+
import msgpack_numpy as m
|
|
29
|
+
from ase import Atoms
|
|
30
|
+
import zlib
|
|
31
|
+
import lz4.block
|
|
32
|
+
import numpy as np
|
|
33
|
+
except ImportError:
|
|
34
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
35
|
+
|
|
36
|
+
# Enable numpy array serialization
|
|
37
|
+
m.patch()
|
|
38
|
+
|
|
39
|
+
if isinstance(atoms, Atoms):
|
|
40
|
+
frames_list = [atoms]
|
|
41
|
+
else:
|
|
42
|
+
frames_list = list(atoms)
|
|
43
|
+
|
|
44
|
+
compression_mode = (compression or 'none').lower()
|
|
45
|
+
if compression_mode not in {'none', 'zlib', 'lz4'}:
|
|
46
|
+
raise ValueError(
|
|
47
|
+
f"Unsupported compression mode '{compression_mode}' for tess format"
|
|
48
|
+
)
|
|
49
|
+
if compression_mode == 'zlib' and not (0 <= compression_level <= 9):
|
|
50
|
+
raise ValueError("compression_level must be between 0 and 9 for zlib compression")
|
|
51
|
+
|
|
52
|
+
# Collect global unique_symbols
|
|
53
|
+
unique_symbols_set = set()
|
|
54
|
+
for a in frames_list:
|
|
55
|
+
unique_symbols_set.update(a.get_chemical_symbols())
|
|
56
|
+
unique_symbols = sorted(list(unique_symbols_set))
|
|
57
|
+
unique_symbols_lookup = {s: i for i, s in enumerate(unique_symbols)}
|
|
58
|
+
|
|
59
|
+
# Check if cell changes across frames
|
|
60
|
+
first_cell = np.array(frames_list[0].get_cell(), dtype=np.float32)
|
|
61
|
+
cell_changes = any(
|
|
62
|
+
not np.allclose(np.array(a.get_cell(), dtype=np.float32), first_cell, rtol=1e-6)
|
|
63
|
+
for a in frames_list[1:20] # Sample first 20 frames
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Pre-extract positions as float32 arrays for all frames
|
|
67
|
+
positions_list = [a.get_positions().astype(np.float32) for a in frames_list]
|
|
68
|
+
if cell_changes:
|
|
69
|
+
cells_list = [np.array(a.get_cell(), dtype=np.float32) for a in frames_list]
|
|
70
|
+
|
|
71
|
+
# Optimized frame serialization - pack only essential per-frame data
|
|
72
|
+
def _pack_frame(i: int) -> bytes:
|
|
73
|
+
# Only pack data that changes between frames
|
|
74
|
+
frame_dict = {'positions': positions_list[i]}
|
|
75
|
+
if cell_changes:
|
|
76
|
+
frame_dict['cell'] = cells_list[i]
|
|
77
|
+
return msgpack.packb(frame_dict, use_bin_type=True)
|
|
78
|
+
|
|
79
|
+
with open(filename, 'wb', buffering=1024*1024) as f:
|
|
80
|
+
frame_offsets: List[Tuple[int, int]] = []
|
|
81
|
+
uncompressed_lengths: List[int] = []
|
|
82
|
+
if compression_mode == 'zlib' or compression_mode == 'lz4':
|
|
83
|
+
# Pre-pack all frames (fast operation)
|
|
84
|
+
packed_frames = [_pack_frame(i) for i in range(len(frames_list))]
|
|
85
|
+
|
|
86
|
+
worker_count = _max_workers(len(packed_frames))
|
|
87
|
+
|
|
88
|
+
def _compress_frame(packed: bytes) -> bytes:
|
|
89
|
+
if compression_mode == 'zlib':
|
|
90
|
+
return zlib.compress(packed, compression_level)
|
|
91
|
+
else: # lz4
|
|
92
|
+
return lz4.block.compress(packed, store_size=True)
|
|
93
|
+
|
|
94
|
+
initial = f.tell()
|
|
95
|
+
current = initial
|
|
96
|
+
|
|
97
|
+
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
|
98
|
+
compressed_frames = list(executor.map(_compress_frame, packed_frames))
|
|
99
|
+
|
|
100
|
+
# Write all compressed frames
|
|
101
|
+
for packed, compressed in zip(packed_frames, compressed_frames):
|
|
102
|
+
f.write(compressed)
|
|
103
|
+
frame_offsets.append((current, len(compressed)))
|
|
104
|
+
uncompressed_lengths.append(len(packed))
|
|
105
|
+
current += len(compressed)
|
|
106
|
+
|
|
107
|
+
else:
|
|
108
|
+
# Write frames directly without intermediate buffer
|
|
109
|
+
initial = f.tell()
|
|
110
|
+
current = initial
|
|
111
|
+
for i in range(len(frames_list)):
|
|
112
|
+
packed = _pack_frame(i)
|
|
113
|
+
l = len(packed)
|
|
114
|
+
f.write(packed)
|
|
115
|
+
frame_offsets.append((current, l))
|
|
116
|
+
current += l
|
|
117
|
+
|
|
118
|
+
# Store static data in header (data that's the same for all frames)
|
|
119
|
+
first_frame = frames_list[0]
|
|
120
|
+
symbols = first_frame.get_chemical_symbols()
|
|
121
|
+
symbols_idx = np.array([unique_symbols_lookup[s] for s in symbols], dtype=np.uint16)
|
|
122
|
+
|
|
123
|
+
# Write header
|
|
124
|
+
header_dict: Dict[str, object] = {
|
|
125
|
+
'format_version': 4,
|
|
126
|
+
'metadata': dict(metadata or {}),
|
|
127
|
+
'unique_symbols': unique_symbols,
|
|
128
|
+
'num_frames': len(frames_list),
|
|
129
|
+
'frame_offsets': frame_offsets,
|
|
130
|
+
# Static frame data stored once in header
|
|
131
|
+
'static_data': {
|
|
132
|
+
'n_atoms': len(first_frame),
|
|
133
|
+
'symbols': symbols_idx,
|
|
134
|
+
'numbers': first_frame.get_atomic_numbers(),
|
|
135
|
+
'masses': first_frame.get_masses(),
|
|
136
|
+
'pbc': first_frame.get_pbc(),
|
|
137
|
+
'cell': first_cell,
|
|
138
|
+
'cell_changes': cell_changes,
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if compression_mode != 'none':
|
|
142
|
+
header_dict['compression'] = {
|
|
143
|
+
'type': compression_mode,
|
|
144
|
+
}
|
|
145
|
+
if compression_mode == 'zlib':
|
|
146
|
+
header_dict['compression']['level'] = compression_level
|
|
147
|
+
header_dict['frame_uncompressed_lengths'] = uncompressed_lengths
|
|
148
|
+
header_bytes = msgpack.packb(header_dict, use_bin_type=True)
|
|
149
|
+
header_start = f.tell()
|
|
150
|
+
f.write(header_bytes)
|
|
151
|
+
|
|
152
|
+
# Write header offset
|
|
153
|
+
f.write(header_start.to_bytes(8, 'little'))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tuple[List['Atoms'], Dict]:
|
|
157
|
+
|
|
158
|
+
try:
|
|
159
|
+
import msgpack
|
|
160
|
+
import msgpack_numpy as m
|
|
161
|
+
from atomict.io.atoms import dict_to_atoms
|
|
162
|
+
from ase import Atoms
|
|
163
|
+
import mmap
|
|
164
|
+
import zlib
|
|
165
|
+
import lz4.block
|
|
166
|
+
except ImportError:
|
|
167
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
168
|
+
|
|
169
|
+
# Enable numpy array deserialization
|
|
170
|
+
m.patch()
|
|
171
|
+
|
|
172
|
+
with open(filename, 'rb') as f:
|
|
173
|
+
# Use mmap with larger read-ahead hint
|
|
174
|
+
mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
|
|
175
|
+
try:
|
|
176
|
+
# Advise the kernel we'll read sequentially
|
|
177
|
+
if hasattr(mm, 'madvise'):
|
|
178
|
+
import mmap as mmap_module
|
|
179
|
+
if hasattr(mmap_module, 'MADV_SEQUENTIAL'):
|
|
180
|
+
mm.madvise(mmap_module.MADV_SEQUENTIAL)
|
|
181
|
+
|
|
182
|
+
file_size = mm.size()
|
|
183
|
+
header_start = int.from_bytes(mm[file_size - 8:file_size], 'little')
|
|
184
|
+
header_bytes = mm[header_start:file_size - 8]
|
|
185
|
+
header = msgpack.unpackb(header_bytes, raw=False, strict_map_key=False)
|
|
186
|
+
|
|
187
|
+
format_version = header.get('format_version', 1)
|
|
188
|
+
if format_version not in {2, 3, 4}:
|
|
189
|
+
raise ValueError("Invalid format version")
|
|
190
|
+
|
|
191
|
+
compression_info = header.get('compression')
|
|
192
|
+
if isinstance(compression_info, dict):
|
|
193
|
+
compression_type = compression_info.get('type', 'none')
|
|
194
|
+
elif isinstance(compression_info, str):
|
|
195
|
+
compression_type = compression_info
|
|
196
|
+
else:
|
|
197
|
+
compression_type = 'none'
|
|
198
|
+
compression_type = (compression_type or 'none').lower()
|
|
199
|
+
if compression_type not in {'none', 'zlib', 'lz4'}:
|
|
200
|
+
raise ValueError(f"Unsupported compression type '{compression_type}' in tess file")
|
|
201
|
+
|
|
202
|
+
metadata = header.get('metadata', {})
|
|
203
|
+
frame_offsets = [tuple(offset) for offset in header['frame_offsets']]
|
|
204
|
+
num_frames = len(frame_offsets)
|
|
205
|
+
|
|
206
|
+
# Determine which frames to load
|
|
207
|
+
if frames_indices is not None:
|
|
208
|
+
# Validate and normalize indices
|
|
209
|
+
frames_to_load = []
|
|
210
|
+
for idx in frames_indices:
|
|
211
|
+
if idx < 0 or idx >= num_frames:
|
|
212
|
+
raise IndexError(f"Frame index {idx} out of range [0, {num_frames})")
|
|
213
|
+
frames_to_load.append(idx)
|
|
214
|
+
# Filter offsets to only requested frames
|
|
215
|
+
filtered_offsets = [(i, frame_offsets[i]) for i in frames_to_load]
|
|
216
|
+
else:
|
|
217
|
+
frames_to_load = list(range(num_frames))
|
|
218
|
+
filtered_offsets = [(i, offset) for i, offset in enumerate(frame_offsets)]
|
|
219
|
+
|
|
220
|
+
# Pre-allocate the result list based on requested frames
|
|
221
|
+
atoms_list = [None] * len(frames_to_load)
|
|
222
|
+
|
|
223
|
+
# Handle format version 4 with static data
|
|
224
|
+
if format_version == 4:
|
|
225
|
+
static_data = header.get('static_data', {})
|
|
226
|
+
unique_symbols = header['unique_symbols']
|
|
227
|
+
symbols_idx = static_data['symbols']
|
|
228
|
+
symbols = [unique_symbols[i] for i in symbols_idx]
|
|
229
|
+
numbers = static_data['numbers']
|
|
230
|
+
masses = static_data['masses']
|
|
231
|
+
pbc = static_data['pbc']
|
|
232
|
+
static_cell = static_data.get('cell')
|
|
233
|
+
cell_changes = static_data.get('cell_changes', True)
|
|
234
|
+
|
|
235
|
+
# Create a template Atoms object to clone for efficiency
|
|
236
|
+
import numpy as np
|
|
237
|
+
template_atoms = Atoms(numbers=numbers, pbc=pbc)
|
|
238
|
+
template_atoms.set_masses(masses)
|
|
239
|
+
if static_cell is not None:
|
|
240
|
+
template_atoms.set_cell(static_cell)
|
|
241
|
+
else:
|
|
242
|
+
convert = dict_to_atoms
|
|
243
|
+
static_data = None
|
|
244
|
+
cell_changes = True
|
|
245
|
+
|
|
246
|
+
# Process frames with minimal overhead
|
|
247
|
+
if compression_type == 'zlib' and len(filtered_offsets) > 0:
|
|
248
|
+
|
|
249
|
+
def _decompress(idx_offset: Tuple[int, Tuple[int, int]]) -> Tuple[int, bytes]:
|
|
250
|
+
orig_idx, (start, length) = idx_offset
|
|
251
|
+
compressed = mm[start:start + length]
|
|
252
|
+
return orig_idx, zlib.decompress(compressed)
|
|
253
|
+
|
|
254
|
+
worker_count = _max_workers(len(filtered_offsets))
|
|
255
|
+
chunk_size = _chunk_size(worker_count)
|
|
256
|
+
|
|
257
|
+
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
|
258
|
+
for chunk_start in range(0, len(filtered_offsets), chunk_size):
|
|
259
|
+
offset_chunk = filtered_offsets[chunk_start:chunk_start + chunk_size]
|
|
260
|
+
for result_idx, (orig_idx, frame_bytes) in enumerate(
|
|
261
|
+
executor.map(_decompress, offset_chunk), start=0
|
|
262
|
+
):
|
|
263
|
+
frame_dict = msgpack.unpackb(
|
|
264
|
+
frame_bytes, raw=False, strict_map_key=False
|
|
265
|
+
)
|
|
266
|
+
if format_version == 4:
|
|
267
|
+
# Fast path for v4: clone template and update only changing data
|
|
268
|
+
atoms = template_atoms.copy()
|
|
269
|
+
atoms.set_positions(frame_dict['positions'])
|
|
270
|
+
if cell_changes and 'cell' in frame_dict:
|
|
271
|
+
atoms.set_cell(frame_dict['cell'])
|
|
272
|
+
atoms_list[chunk_start + result_idx] = atoms
|
|
273
|
+
else:
|
|
274
|
+
atoms_list[chunk_start + result_idx] = convert(frame_dict)[0]
|
|
275
|
+
elif compression_type == 'lz4' and len(filtered_offsets) > 0:
|
|
276
|
+
|
|
277
|
+
def _decompress(idx_offset: Tuple[int, Tuple[int, int]]) -> Tuple[int, bytes]:
|
|
278
|
+
orig_idx, (start, length) = idx_offset
|
|
279
|
+
compressed = mm[start:start + length]
|
|
280
|
+
return orig_idx, lz4.block.decompress(compressed)
|
|
281
|
+
|
|
282
|
+
worker_count = _max_workers(len(filtered_offsets))
|
|
283
|
+
chunk_size = _chunk_size(worker_count)
|
|
284
|
+
|
|
285
|
+
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
|
286
|
+
for chunk_start in range(0, len(filtered_offsets), chunk_size):
|
|
287
|
+
offset_chunk = filtered_offsets[chunk_start:chunk_start + chunk_size]
|
|
288
|
+
for result_idx, (orig_idx, frame_bytes) in enumerate(
|
|
289
|
+
executor.map(_decompress, offset_chunk), start=0
|
|
290
|
+
):
|
|
291
|
+
frame_dict = msgpack.unpackb(
|
|
292
|
+
frame_bytes, raw=False, strict_map_key=False
|
|
293
|
+
)
|
|
294
|
+
if format_version == 4:
|
|
295
|
+
atoms = template_atoms.copy()
|
|
296
|
+
atoms.set_positions(frame_dict['positions'])
|
|
297
|
+
if cell_changes and 'cell' in frame_dict:
|
|
298
|
+
atoms.set_cell(frame_dict['cell'])
|
|
299
|
+
atoms_list[chunk_start + result_idx] = atoms
|
|
300
|
+
else:
|
|
301
|
+
atoms_list[chunk_start + result_idx] = convert(frame_dict)[0]
|
|
302
|
+
else:
|
|
303
|
+
for result_idx, (orig_idx, (start, length)) in enumerate(filtered_offsets):
|
|
304
|
+
frame_slice = mm[start:start + length]
|
|
305
|
+
frame_dict = msgpack.unpackb(
|
|
306
|
+
frame_slice, raw=False, strict_map_key=False
|
|
307
|
+
)
|
|
308
|
+
if format_version == 4:
|
|
309
|
+
atoms = template_atoms.copy()
|
|
310
|
+
atoms.set_positions(frame_dict['positions'])
|
|
311
|
+
if cell_changes and 'cell' in frame_dict:
|
|
312
|
+
atoms.set_cell(frame_dict['cell'])
|
|
313
|
+
atoms_list[result_idx] = atoms
|
|
314
|
+
else:
|
|
315
|
+
atoms_list[result_idx] = convert(frame_dict)[0]
|
|
316
|
+
finally:
|
|
317
|
+
mm.close()
|
|
318
|
+
|
|
319
|
+
return atoms_list, metadata
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from typing import Union, List, Dict, TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
if TYPE_CHECKING:
|
|
4
|
+
import ase
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def write_traj(atoms: Union['ase.Atoms', List['ase.Atoms']], filename: str, metadata: Dict = None, properties: List[str] = None):
|
|
8
|
+
"""Save atoms to an ASE trajectory file.
|
|
9
|
+
|
|
10
|
+
Parameters:
|
|
11
|
+
atoms: Single Atoms object or list of Atoms objects to write
|
|
12
|
+
filename: Output trajectory filename
|
|
13
|
+
metadata: Optional metadata to add to frames
|
|
14
|
+
properties: List of calculator properties to save (e.g., ['energy', 'forces', 'stress'])
|
|
15
|
+
If None, all available properties are saved
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
from ase.io.trajectory import TrajectoryWriter
|
|
20
|
+
from ase import Atoms
|
|
21
|
+
except ImportError:
|
|
22
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
23
|
+
|
|
24
|
+
# Single atoms case - convert to list
|
|
25
|
+
if isinstance(atoms, Atoms):
|
|
26
|
+
atoms_list = [atoms]
|
|
27
|
+
else:
|
|
28
|
+
atoms_list = atoms
|
|
29
|
+
|
|
30
|
+
# Use TrajectoryWriter for better control over properties
|
|
31
|
+
with TrajectoryWriter(filename, mode='w', properties=properties) as traj:
|
|
32
|
+
for atoms_frame in atoms_list:
|
|
33
|
+
if metadata:
|
|
34
|
+
# Only copy if we need to add metadata to avoid modifying original
|
|
35
|
+
frame_copy = atoms_frame.copy()
|
|
36
|
+
frame_copy.info.update(metadata)
|
|
37
|
+
traj.write(frame_copy)
|
|
38
|
+
else:
|
|
39
|
+
# Write directly without copying if no metadata
|
|
40
|
+
traj.write(atoms_frame)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def read_traj(filename: str) -> tuple[List['ase.Atoms'], Dict]:
|
|
44
|
+
"""Load atoms from an ASE trajectory file."""
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
from ase.io.trajectory import TrajectoryReader
|
|
48
|
+
except ImportError:
|
|
49
|
+
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
50
|
+
|
|
51
|
+
atoms_list = []
|
|
52
|
+
metadata = {}
|
|
53
|
+
|
|
54
|
+
# Read trajectory using TrajectoryReader for better control
|
|
55
|
+
with TrajectoryReader(filename) as traj:
|
|
56
|
+
for atoms_frame in traj:
|
|
57
|
+
atoms_list.append(atoms_frame)
|
|
58
|
+
# Extract metadata from the first frame's info
|
|
59
|
+
if not metadata and atoms_frame.info:
|
|
60
|
+
metadata = dict(atoms_frame.info)
|
|
61
|
+
|
|
62
|
+
return atoms_list, metadata
|
atomict/simulation/fhi_aims.py
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
from atomict.api import delete, get, post
|
|
2
|
+
from atomict.infra.distwork.task import SimulationAction
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
def create_simulation(
|
|
5
6
|
project_id: str,
|
|
6
7
|
control_file: str,
|
|
7
8
|
geometry_file: str,
|
|
8
|
-
action:
|
|
9
|
+
action: SimulationAction,
|
|
9
10
|
name: str = None,
|
|
10
11
|
description: str = None,
|
|
11
12
|
extra_simulation_kwargs: dict = None,
|
|
12
13
|
) -> dict:
|
|
13
14
|
|
|
14
|
-
if action not in [
|
|
15
|
-
raise ValueError("Action must be '
|
|
15
|
+
if action not in [SimulationAction.SAVE_DRAFT, SimulationAction.LAUNCH]:
|
|
16
|
+
raise ValueError("Action must be 'SimulationAction.SAVE_DRAFT' or 'SimulationAction.LAUNCH'")
|
|
16
17
|
|
|
17
18
|
payload = {
|
|
18
19
|
"project_id": project_id,
|
|
19
20
|
"control_file": control_file,
|
|
20
21
|
"geometry_file": geometry_file,
|
|
21
|
-
"action": action,
|
|
22
|
+
"action": action.value,
|
|
22
23
|
"name": name,
|
|
23
24
|
"description": description,
|
|
24
25
|
}
|
atomict/simulation/mlrelax.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
1
3
|
from atomict.api import get, post
|
|
2
4
|
from atomict.infra.distwork.task import SimulationAction
|
|
3
|
-
from atomict.simulation.models import MODEL_ORB_V3_CONSERVATIVE, MODEL_ESEN_30M_OAM
|
|
5
|
+
from atomict.simulation.models import MODEL_ORB_V3_CONSERVATIVE, MODEL_ESEN_30M_OAM, MODEL_UMA
|
|
4
6
|
|
|
5
7
|
COMPUTATION_TYPE_RELAXATION = 0
|
|
6
8
|
COMPUTATION_TYPE_SINGLE_POINT = 1
|
|
@@ -45,6 +47,7 @@ def create_mlrelaxation(
|
|
|
45
47
|
computation_type: int = COMPUTATION_TYPE_RELAXATION,
|
|
46
48
|
f_max: float = None,
|
|
47
49
|
model: int = MODEL_ESEN_30M_OAM,
|
|
50
|
+
calculator: Union[int, None] = None,
|
|
48
51
|
extra_simulation_kwargs: dict = None,
|
|
49
52
|
):
|
|
50
53
|
"""
|
|
@@ -62,14 +65,6 @@ def create_mlrelaxation(
|
|
|
62
65
|
"Invalid computation type. Please use atomict.simulation.mlrelax.COMPUTATION_TYPE_RELAXATION or atomict.simulation.mlrelax.COMPUTATION_TYPE_SINGLE_POINT."
|
|
63
66
|
)
|
|
64
67
|
|
|
65
|
-
if model not in [
|
|
66
|
-
MODEL_ORB_V3_CONSERVATIVE,
|
|
67
|
-
MODEL_ESEN_30M_OAM,
|
|
68
|
-
]:
|
|
69
|
-
raise ValueError(
|
|
70
|
-
"Invalid model. Please use atomict.simulation.models.MODEL_ORB_V3_CONSERVATIVE, or atomict.simulation.models.MODEL_ESEN_30M_OAM."
|
|
71
|
-
)
|
|
72
|
-
|
|
73
68
|
payload = {
|
|
74
69
|
"project": project_id,
|
|
75
70
|
"source_geometry_id": source_geometry_id,
|
|
@@ -78,9 +73,15 @@ def create_mlrelaxation(
|
|
|
78
73
|
"description": description,
|
|
79
74
|
"computation_type": computation_type,
|
|
80
75
|
"f_max": f_max,
|
|
81
|
-
"model": model,
|
|
82
76
|
}
|
|
83
77
|
|
|
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:
|
|
81
|
+
payload["calculator"] = calculator
|
|
82
|
+
else:
|
|
83
|
+
payload["calculator"] = model
|
|
84
|
+
|
|
84
85
|
if extra_simulation_kwargs:
|
|
85
86
|
payload.update(extra_simulation_kwargs)
|
|
86
87
|
|
atomict/simulation/models.py
CHANGED
atomict/simulation/phonon.py
CHANGED
|
@@ -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
|
|
atomict/simulation/utils.py
CHANGED
|
@@ -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.20
|
|
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
|
|
@@ -23,6 +23,7 @@ Requires-Dist: httpx
|
|
|
23
23
|
Requires-Dist: click~=8.0
|
|
24
24
|
Requires-Dist: rich~=13.0
|
|
25
25
|
Requires-Dist: deepdiff
|
|
26
|
+
Requires-Dist: lz4
|
|
26
27
|
Provides-Extra: utils
|
|
27
28
|
Requires-Dist: ase>=3.23.0; extra == "utils"
|
|
28
29
|
Requires-Dist: spglib==2.5.0; extra == "utils"
|
|
@@ -123,3 +124,4 @@ Tab completion is available. Run the hidden command:
|
|
|
123
124
|
```tess completion```
|
|
124
125
|
|
|
125
126
|
This will print out the instructions for enabling tab completion for your shell.
|
|
127
|
+
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
atomict/__init__.py,sha256=nMXg9GFsk8gCcyBnh1MAeUPvo4Zcuv3sdwGHZrxfpPE,36
|
|
2
|
-
atomict/__version__.py,sha256=
|
|
2
|
+
atomict/__version__.py,sha256=nQtXpLTEUbMtAPecTV_hZAJZb9EhWc8glRv6hgKyvG4,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=
|
|
9
|
+
atomict/cli/main.py,sha256=F-lhRCsTFwyiBuNlAsOW4t-yAzUcfxl9DL6ku2Mpes4,8906
|
|
10
10
|
atomict/cli/commands/adsorbate.py,sha256=fdu6m5Kx2fkQXA--BsvU5QWcq0-PKFi7bGaLJZnnqag,5836
|
|
11
11
|
atomict/cli/commands/ai_assist.py,sha256=IgZyoeL5mdwkcwxKWD7y0Enjus-wSlrYee-keyacOOY,3449
|
|
12
12
|
atomict/cli/commands/catalysis.py,sha256=raBRBttv3R2ZQvZBnyIlnBXJyZbpISL_5_WWXHg3X_s,5502
|
|
@@ -40,11 +40,14 @@ atomict/infra/distwork/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
40
40
|
atomict/infra/distwork/environment.py,sha256=joydS9wA2pgWafXh_Wqgg95InaxhsusohaeWc9IOgwA,909
|
|
41
41
|
atomict/infra/distwork/task.py,sha256=kflMllczaUQHDa8AAUTsLi5RJivckr1LKHAUZwqIKio,1182
|
|
42
42
|
atomict/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
|
+
atomict/io/atoms.py,sha256=kdMnto7eyiY2zmoOvLlzbuTGUCIp4ViQGwLmf2m9fGU,13144
|
|
43
44
|
atomict/io/cif.py,sha256=o7oe6alug5ais2QnJhv88X7sAbZSbTkEWhHa-4Dkw1E,6040
|
|
44
45
|
atomict/io/fhiaims.py,sha256=4Z5oImjZuP-k8AudrMrXqvsO0IHajDy__h5NmLr1LGY,1197
|
|
45
|
-
atomict/io/msgpack.py,sha256=n4rBSAdnXCueNu-byrk7yFOiPCyoZTwK-tlsiOL9u10,18376
|
|
46
|
-
atomict/io/trajectory.py,sha256=iLNLBB6YotcDv9acQyDbyo-Z-Ah4HdOwLhy12_b6344,16068
|
|
47
46
|
atomict/io/utils.py,sha256=ncA8XchNN3lJT8EhJK6tLJE9TvmHmPlxizTnY5ASvEc,272
|
|
47
|
+
atomict/io/formats/__init__.py,sha256=_wKNHpV0VZKh7mzO6kRfaETYPxg_DYbrJwH4kqduD9Q,300
|
|
48
|
+
atomict/io/formats/atraj.py,sha256=2aqS5Gcr_SzE-d-wG9FLr_ckyKFkLHSAqhZUR9cXyR4,3355
|
|
49
|
+
atomict/io/formats/tess.py,sha256=frQYIdNWE8NQL19F6BWV_lW6nJ9WwMX-yBrx_xmtSUA,14044
|
|
50
|
+
atomict/io/formats/traj.py,sha256=AaojyrUzTMiobt2Nhyc7UCjNX1efGnvhV6z1avPtK-4,2273
|
|
48
51
|
atomict/ml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
52
|
atomict/ml/model.py,sha256=Ug6IyRNNQ5_SHnQabFHnCCAGTHa9jxrRAUAkBsdcjgo,279
|
|
50
53
|
atomict/project/__init__.py,sha256=nqVivok-9G0mZr_kOxA-5dsk5p9xPdkUSyNvB-xbveI,23
|
|
@@ -62,18 +65,18 @@ atomict/simulation/catalysis.py,sha256=NT7r1qPoYWxVcWQHuAaYWBOprLbZukZLezBHxqIIz
|
|
|
62
65
|
atomict/simulation/counterfactual.py,sha256=8-Kf4wGxPvImDr0j2grmBLLwFQ4JpjhBBxIksIwblIQ,708
|
|
63
66
|
atomict/simulation/defect.py,sha256=uvYLR_Ng0PFV9A_EE_EgB2SK8jqUpJtvuwLKL02Am3c,691
|
|
64
67
|
atomict/simulation/ea.py,sha256=bYvYnw59F7QCuV-airnX0Wu8fqZHKlsdywgoK7pwNso,3610
|
|
65
|
-
atomict/simulation/fhi_aims.py,sha256=
|
|
68
|
+
atomict/simulation/fhi_aims.py,sha256=FRIqmZ_2AMpjFW_ow6vfe611vgElrENNOGmgIzXj908,2037
|
|
66
69
|
atomict/simulation/impact.py,sha256=b5RL--cFeg6gPtxN5xwX_M4LkvYn_lRLi1OWz-uimPA,1161
|
|
67
70
|
atomict/simulation/kpoint.py,sha256=8Dc1F9xqubK1HBCQa7GeRtIhs28302sRnuUK0Rns9Q4,1739
|
|
68
71
|
atomict/simulation/mattergen.py,sha256=ybzJy0nwIAZhG8IIuhlmi-_J6lLyci3aVo35h2ni_w0,488
|
|
69
72
|
atomict/simulation/md.py,sha256=C32Sh2sv9PQ1lyGaWYFmG5evKk3Jqw0wel2ml4uPnJw,770
|
|
70
|
-
atomict/simulation/mlrelax.py,sha256=
|
|
71
|
-
atomict/simulation/models.py,sha256=
|
|
72
|
-
atomict/simulation/phonon.py,sha256=
|
|
73
|
+
atomict/simulation/mlrelax.py,sha256=ZS9WoO9efHeSNXM-MxuqQMSWN54qDKLscBgxL4monfI,2841
|
|
74
|
+
atomict/simulation/models.py,sha256=RSVLldNurx7F-ijlrLuVyljMS06bsZCBFMXNcdzdOuU,115
|
|
75
|
+
atomict/simulation/phonon.py,sha256=Mmk0LveKHGkw0Jo7GJCphKXsxbZCFZE9tKRkGGwNcUs,2785
|
|
73
76
|
atomict/simulation/qe.py,sha256=3PpqpA0Pn3FCGEgjaMnCidguhopGxFUDMaxwfIQF2FE,1700
|
|
74
77
|
atomict/simulation/sh.py,sha256=YymnH9q8aD_THiielicTKgPGcRunsAcoV5bZKu__L0w,609
|
|
75
78
|
atomict/simulation/sqs.py,sha256=1neQRVUy21R_UVusML6ocz6RVwxGUVh81CMr2TljGbw,1132
|
|
76
|
-
atomict/simulation/utils.py,sha256=
|
|
79
|
+
atomict/simulation/utils.py,sha256=V7_Un6pTKUfWtdtTzFuGofDSl9m50b0swEwc7niXlK8,4433
|
|
77
80
|
atomict/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
78
81
|
atomict/user/files.py,sha256=eRIxC4OeyTMwF-pu2En82qd5VtA4RM_dA1N1YgbLgZ8,964
|
|
79
82
|
atomict/user/workspace.py,sha256=ihM9TTaxlQC9HYbL7qKBM6PdNRUFZn1EZRUd6CuTXlI,3921
|
|
@@ -81,9 +84,9 @@ atomict/utils/tenacity.py,sha256=phc6YPEk7idqiFFeHeK-ngiAaqVOZFYp8S7dX1k-YXc,998
|
|
|
81
84
|
atomict/utils/traj.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
82
85
|
atomict/utils/fhiaims/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
83
86
|
atomict/utils/fhiaims/geometry.py,sha256=3Ap6gO7UsLFXBl9Ohv8Vmfpvwu0fohpzgdxOFGg6Tmc,2281
|
|
84
|
-
atomict-1.2.
|
|
85
|
-
atomict-1.2.
|
|
86
|
-
atomict-1.2.
|
|
87
|
-
atomict-1.2.
|
|
88
|
-
atomict-1.2.
|
|
89
|
-
atomict-1.2.
|
|
87
|
+
atomict-1.2.20.dist-info/licenses/LICENSE,sha256=fzvTkxUzi2u1cea_aRtmg5_mRk6ZyLWJJRr49K28qKg,1075
|
|
88
|
+
atomict-1.2.20.dist-info/METADATA,sha256=Sk30hOT87B04NfvZjw-rYasA_Xkf03tA_swSWn2aH3A,3359
|
|
89
|
+
atomict-1.2.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
90
|
+
atomict-1.2.20.dist-info/entry_points.txt,sha256=PozguIUgJUHgS65PSZBHNPUiwYGDwXa4vLZ7hde3aq8,47
|
|
91
|
+
atomict-1.2.20.dist-info/top_level.txt,sha256=CCo525YmAj7ZbToMmQcVKQ-JiIiFKiq3GmhIYCG2gaM,8
|
|
92
|
+
atomict-1.2.20.dist-info/RECORD,,
|