atomict 1.2.23__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 +1 -1
- atomict/cli/commands/convert.py +100 -0
- atomict/cli/commands/traj.py +2 -6
- atomict/cli/commands/workspace.py +117 -0
- atomict/cli/main.py +8 -126
- atomict/io/cif.py +4 -10
- atomict/io/fhiaims.py +2 -8
- atomict/io/formats/atraj.py +5 -13
- atomict/io/formats/tess.py +195 -157
- atomict/io/formats/traj.py +3 -9
- atomict/io/trajectory.py +19 -1
- atomict/simulation/utils.py +7 -8
- atomict/utils/fhiaims/geometry.py +3 -10
- {atomict-1.2.23.dist-info → atomict-1.2.25.dist-info}/METADATA +9 -24
- {atomict-1.2.23.dist-info → atomict-1.2.25.dist-info}/RECORD +19 -25
- atomict/cli/commands/adsorbate.py +0 -183
- atomict/cli/commands/catalysis.py +0 -171
- atomict/cli/commands/simulation/__init__.py +0 -20
- atomict/cli/commands/simulation/catalysis.py +0 -223
- atomict/cli/commands/simulation/vibes.py +0 -161
- atomict/cli/commands/simulation.py +0 -176
- atomict/cli/ext/custom_classes.py +0 -46
- atomict/simulation/catalysis.py +0 -20
- {atomict-1.2.23.dist-info → atomict-1.2.25.dist-info}/WHEEL +0 -0
- {atomict-1.2.23.dist-info → atomict-1.2.25.dist-info}/entry_points.txt +0 -0
- {atomict-1.2.23.dist-info → atomict-1.2.25.dist-info}/licenses/LICENSE +0 -0
- {atomict-1.2.23.dist-info → atomict-1.2.25.dist-info}/top_level.txt +0 -0
atomict/io/formats/tess.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from concurrent.futures import ThreadPoolExecutor
|
|
2
|
-
from typing import Dict, List, Optional, Tuple, Union, TYPE_CHECKING, Any, cast
|
|
2
|
+
from typing import Dict, List, Optional, Tuple, Union, TYPE_CHECKING, Any, cast, IO
|
|
3
|
+
import contextlib
|
|
4
|
+
import os
|
|
3
5
|
|
|
4
6
|
if TYPE_CHECKING:
|
|
5
7
|
from ase import Atoms
|
|
@@ -15,57 +17,49 @@ def _chunk_size(max_workers: int) -> int:
|
|
|
15
17
|
return max(1, max_workers * 4)
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
def
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import msgpack_numpy as m
|
|
23
|
-
import mmap
|
|
24
|
-
except ImportError:
|
|
25
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
26
|
-
|
|
20
|
+
def _parse_tess_header(mm: Any, file_size: int) -> Dict[str, Any]:
|
|
21
|
+
import msgpack
|
|
22
|
+
import msgpack_numpy as m
|
|
23
|
+
|
|
27
24
|
# Enable numpy array deserialization for header contents that may include numpy arrays
|
|
28
25
|
m.patch()
|
|
29
26
|
|
|
27
|
+
header_start = int.from_bytes(mm[file_size - 8:file_size], 'little')
|
|
28
|
+
header_bytes = mm[header_start:file_size - 8]
|
|
29
|
+
header = msgpack.unpackb(header_bytes, raw=False, strict_map_key=False)
|
|
30
|
+
|
|
31
|
+
format_version = header.get('format_version', 1)
|
|
32
|
+
if format_version not in {2, 3, 4, 5}:
|
|
33
|
+
raise ValueError("Invalid format version")
|
|
34
|
+
|
|
35
|
+
# Normalize frame_offsets to a list of tuples for convenience
|
|
36
|
+
if 'frame_offsets' in header and isinstance(header['frame_offsets'], list):
|
|
37
|
+
header['frame_offsets'] = [tuple(offset) for offset in header['frame_offsets']]
|
|
38
|
+
|
|
39
|
+
return header
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _read_tess_header(filename: str) -> Dict[str, Any]:
|
|
43
|
+
|
|
44
|
+
import mmap
|
|
45
|
+
|
|
30
46
|
with open(filename, 'rb') as f:
|
|
31
47
|
mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
|
|
32
48
|
try:
|
|
33
|
-
|
|
34
|
-
if hasattr(mm, 'madvise'):
|
|
35
|
-
import mmap as mmap_module
|
|
36
|
-
if hasattr(mmap_module, 'MADV_SEQUENTIAL'):
|
|
37
|
-
mm.madvise(mmap_module.MADV_SEQUENTIAL)
|
|
38
|
-
|
|
39
|
-
file_size = mm.size()
|
|
40
|
-
header_start = int.from_bytes(mm[file_size - 8:file_size], 'little')
|
|
41
|
-
header_bytes = mm[header_start:file_size - 8]
|
|
42
|
-
header = msgpack.unpackb(header_bytes, raw=False, strict_map_key=False)
|
|
43
|
-
|
|
44
|
-
format_version = header.get('format_version', 1)
|
|
45
|
-
if format_version not in {2, 3, 4, 5}:
|
|
46
|
-
raise ValueError("Invalid format version")
|
|
47
|
-
|
|
48
|
-
# Normalize frame_offsets to a list of tuples for convenience
|
|
49
|
-
if 'frame_offsets' in header and isinstance(header['frame_offsets'], list):
|
|
50
|
-
header['frame_offsets'] = [tuple(offset) for offset in header['frame_offsets']]
|
|
51
|
-
|
|
52
|
-
return header
|
|
49
|
+
return _parse_tess_header(mm, mm.size())
|
|
53
50
|
finally:
|
|
54
51
|
mm.close()
|
|
55
52
|
|
|
56
53
|
|
|
57
54
|
def _decode_frame(frame_bytes: bytes, header: Dict[str, Any], template_atoms: Optional['Atoms'] = None) -> 'Atoms':
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
import lz4.block
|
|
67
|
-
except ImportError:
|
|
68
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
56
|
+
import msgpack
|
|
57
|
+
import msgpack_numpy as m
|
|
58
|
+
from atomict.io.atoms import dict_to_atoms
|
|
59
|
+
from ase import Atoms
|
|
60
|
+
from ase.calculators.singlepoint import SinglePointCalculator
|
|
61
|
+
import zlib
|
|
62
|
+
import lz4.block
|
|
69
63
|
|
|
70
64
|
# Enable numpy array deserialization for any numpy contents
|
|
71
65
|
m.patch()
|
|
@@ -156,21 +150,18 @@ def _decode_frame(frame_bytes: bytes, header: Dict[str, Any], template_atoms: Op
|
|
|
156
150
|
|
|
157
151
|
def write_tess(
|
|
158
152
|
atoms: Union['Atoms', List['Atoms']],
|
|
159
|
-
filename: str,
|
|
153
|
+
filename: Union[str, IO[bytes], os.PathLike],
|
|
160
154
|
metadata: Optional[Dict] = None,
|
|
161
155
|
compression: Optional[str] = 'none',
|
|
162
156
|
compression_level: int = 0,
|
|
163
157
|
) -> None:
|
|
164
158
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
import numpy as np
|
|
172
|
-
except ImportError:
|
|
173
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
159
|
+
import msgpack
|
|
160
|
+
import msgpack_numpy as m
|
|
161
|
+
from ase import Atoms
|
|
162
|
+
import zlib
|
|
163
|
+
import lz4.block
|
|
164
|
+
import numpy as np
|
|
174
165
|
|
|
175
166
|
# Enable numpy array serialization
|
|
176
167
|
m.patch()
|
|
@@ -307,7 +298,19 @@ def write_tess(
|
|
|
307
298
|
frame_dict['custom_arrays'] = custom_arrays
|
|
308
299
|
return cast(bytes, msgpack.packb(frame_dict, use_bin_type=True))
|
|
309
300
|
|
|
310
|
-
|
|
301
|
+
if isinstance(filename, (str, os.PathLike)):
|
|
302
|
+
f_ctx = open(filename, 'wb', buffering=1024*1024)
|
|
303
|
+
f_to_close = True
|
|
304
|
+
else:
|
|
305
|
+
f_ctx = filename
|
|
306
|
+
f_to_close = False
|
|
307
|
+
|
|
308
|
+
with contextlib.ExitStack() as stack:
|
|
309
|
+
if f_to_close:
|
|
310
|
+
f = stack.enter_context(f_ctx)
|
|
311
|
+
else:
|
|
312
|
+
f = f_ctx
|
|
313
|
+
|
|
311
314
|
frame_offsets: List[Tuple[int, int]] = []
|
|
312
315
|
uncompressed_lengths: List[int] = []
|
|
313
316
|
if compression_mode == 'zlib' or compression_mode == 'lz4':
|
|
@@ -390,120 +393,155 @@ def write_tess(
|
|
|
390
393
|
f.write(header_start.to_bytes(8, 'little'))
|
|
391
394
|
|
|
392
395
|
|
|
393
|
-
def read_tess(filename: str, frames_indices: Optional[List[int]] = None) -> Tuple[List['Atoms'], Dict]:
|
|
396
|
+
def read_tess(filename: Union[str, IO[bytes]], frames_indices: Optional[List[int]] = None) -> Tuple[List['Atoms'], Dict]:
|
|
394
397
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
from ase.calculators.singlepoint import SinglePointCalculator
|
|
405
|
-
except ImportError:
|
|
406
|
-
raise ImportError("You need to install with `pip install atomict[utils]` to use the newer formats")
|
|
398
|
+
import msgpack
|
|
399
|
+
import msgpack_numpy as m
|
|
400
|
+
from atomict.io.atoms import dict_to_atoms
|
|
401
|
+
from ase import Atoms
|
|
402
|
+
import mmap
|
|
403
|
+
import zlib
|
|
404
|
+
import lz4.block
|
|
405
|
+
import numpy as np
|
|
406
|
+
from ase.calculators.singlepoint import SinglePointCalculator
|
|
407
407
|
|
|
408
408
|
# Enable numpy array deserialization
|
|
409
409
|
m.patch()
|
|
410
410
|
|
|
411
|
-
#
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
compression_info = header.get('compression')
|
|
416
|
-
if isinstance(compression_info, dict):
|
|
417
|
-
compression_type = compression_info.get('type', 'none')
|
|
418
|
-
elif isinstance(compression_info, str):
|
|
419
|
-
compression_type = compression_info
|
|
411
|
+
# Manage file context
|
|
412
|
+
if isinstance(filename, (str, os.PathLike)):
|
|
413
|
+
f_ctx = open(filename, 'rb')
|
|
414
|
+
f_to_close = True
|
|
420
415
|
else:
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
if compression_type not in {'none', 'zlib', 'lz4'}:
|
|
424
|
-
raise ValueError(f"Unsupported compression type '{compression_type}' in tess file")
|
|
416
|
+
f_ctx = filename
|
|
417
|
+
f_to_close = False
|
|
425
418
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
419
|
+
with contextlib.ExitStack() as stack:
|
|
420
|
+
if f_to_close:
|
|
421
|
+
f = stack.enter_context(f_ctx)
|
|
422
|
+
else:
|
|
423
|
+
f = f_ctx
|
|
429
424
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
#
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
if format_version in {4, 5}:
|
|
459
|
-
static_data = header.get('static_data', {})
|
|
460
|
-
unique_symbols = header['unique_symbols']
|
|
461
|
-
symbols_idx = static_data['symbols']
|
|
462
|
-
symbols = [unique_symbols[i] for i in symbols_idx]
|
|
463
|
-
numbers = static_data['numbers']
|
|
464
|
-
masses = static_data['masses']
|
|
465
|
-
pbc = static_data['pbc']
|
|
466
|
-
static_cell = static_data.get('cell')
|
|
467
|
-
cell_changes = static_data.get('cell_changes', True)
|
|
468
|
-
static_tags = static_data.get('tags')
|
|
469
|
-
static_init_charges = static_data.get('initial_charges')
|
|
470
|
-
static_init_magmoms = static_data.get('initial_magmoms')
|
|
471
|
-
|
|
472
|
-
# Create a template Atoms object to clone for efficiency
|
|
473
|
-
template_atoms = Atoms(numbers=numbers, pbc=pbc)
|
|
474
|
-
template_atoms.set_masses(masses)
|
|
475
|
-
if static_cell is not None:
|
|
476
|
-
template_atoms.set_cell(static_cell)
|
|
477
|
-
if static_tags is not None:
|
|
478
|
-
template_atoms.set_tags(static_tags)
|
|
479
|
-
if static_init_charges is not None:
|
|
480
|
-
template_atoms.set_initial_charges(static_init_charges)
|
|
481
|
-
if static_init_magmoms is not None:
|
|
482
|
-
template_atoms.set_initial_magnetic_moments(static_init_magmoms)
|
|
425
|
+
# Determine view and size
|
|
426
|
+
mm: Any = None
|
|
427
|
+
view: Any = None
|
|
428
|
+
size: int = 0
|
|
429
|
+
|
|
430
|
+
# Try mmap first (efficient for large files)
|
|
431
|
+
if hasattr(f, 'fileno'):
|
|
432
|
+
try:
|
|
433
|
+
mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
|
|
434
|
+
stack.callback(mm.close)
|
|
435
|
+
|
|
436
|
+
# Advise the kernel we'll read sequentially
|
|
437
|
+
if hasattr(mm, 'madvise'):
|
|
438
|
+
import mmap as mmap_module
|
|
439
|
+
if hasattr(mmap_module, 'MADV_SEQUENTIAL'):
|
|
440
|
+
mm.madvise(mmap_module.MADV_SEQUENTIAL)
|
|
441
|
+
|
|
442
|
+
view = mm
|
|
443
|
+
size = mm.size()
|
|
444
|
+
except Exception:
|
|
445
|
+
# Fallback if mmap fails (e.g. pipe)
|
|
446
|
+
pass
|
|
447
|
+
|
|
448
|
+
if view is None:
|
|
449
|
+
# Try getting buffer (BytesIO)
|
|
450
|
+
if hasattr(f, 'getbuffer'):
|
|
451
|
+
view = f.getbuffer()
|
|
452
|
+
size = view.nbytes
|
|
483
453
|
else:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
454
|
+
# Fallback: read all into memory
|
|
455
|
+
if hasattr(f, 'seekable') and f.seekable():
|
|
456
|
+
f.seek(0)
|
|
457
|
+
content = f.read()
|
|
458
|
+
view = content
|
|
459
|
+
size = len(content)
|
|
460
|
+
|
|
461
|
+
# Read header
|
|
462
|
+
header = _parse_tess_header(view, size)
|
|
463
|
+
|
|
464
|
+
format_version = header.get('format_version', 1)
|
|
465
|
+
compression_info = header.get('compression')
|
|
466
|
+
if isinstance(compression_info, dict):
|
|
467
|
+
compression_type = compression_info.get('type', 'none')
|
|
468
|
+
elif isinstance(compression_info, str):
|
|
469
|
+
compression_type = compression_info
|
|
470
|
+
else:
|
|
471
|
+
compression_type = 'none'
|
|
472
|
+
compression_type = (compression_type or 'none').lower()
|
|
473
|
+
if compression_type not in {'none', 'zlib', 'lz4'}:
|
|
474
|
+
raise ValueError(f"Unsupported compression type '{compression_type}' in tess file")
|
|
475
|
+
|
|
476
|
+
metadata = header.get('metadata', {})
|
|
477
|
+
frame_offsets = [tuple(offset) for offset in header['frame_offsets']]
|
|
478
|
+
num_frames = len(frame_offsets)
|
|
479
|
+
|
|
480
|
+
# Determine which frames to load
|
|
481
|
+
if frames_indices is not None:
|
|
482
|
+
# Validate and normalize indices
|
|
483
|
+
frames_to_load = []
|
|
484
|
+
for idx in frames_indices:
|
|
485
|
+
if idx < 0 or idx >= num_frames:
|
|
486
|
+
raise IndexError(f"Frame index {idx} out of range [0, {num_frames})")
|
|
487
|
+
frames_to_load.append(idx)
|
|
488
|
+
# Filter offsets to only requested frames
|
|
489
|
+
filtered_offsets = [(i, frame_offsets[i]) for i in frames_to_load]
|
|
490
|
+
else:
|
|
491
|
+
frames_to_load = list(range(num_frames))
|
|
492
|
+
filtered_offsets = [(i, offset) for i, offset in enumerate(frame_offsets)]
|
|
493
|
+
|
|
494
|
+
# Pre-allocate the result list based on requested frames
|
|
495
|
+
atoms_list: List[Optional[Atoms]] = [None] * len(frames_to_load)
|
|
496
|
+
|
|
497
|
+
# Handle format version 4/5 with static data
|
|
498
|
+
if format_version in {4, 5}:
|
|
499
|
+
static_data = header.get('static_data', {})
|
|
500
|
+
unique_symbols = header['unique_symbols']
|
|
501
|
+
symbols_idx = static_data['symbols']
|
|
502
|
+
symbols = [unique_symbols[i] for i in symbols_idx]
|
|
503
|
+
numbers = static_data['numbers']
|
|
504
|
+
masses = static_data['masses']
|
|
505
|
+
pbc = static_data['pbc']
|
|
506
|
+
static_cell = static_data.get('cell')
|
|
507
|
+
cell_changes = static_data.get('cell_changes', True)
|
|
508
|
+
static_tags = static_data.get('tags')
|
|
509
|
+
static_init_charges = static_data.get('initial_charges')
|
|
510
|
+
static_init_magmoms = static_data.get('initial_magmoms')
|
|
511
|
+
|
|
512
|
+
# Create a template Atoms object to clone for efficiency
|
|
513
|
+
template_atoms = Atoms(numbers=numbers, pbc=pbc)
|
|
514
|
+
template_atoms.set_masses(masses)
|
|
515
|
+
if static_cell is not None:
|
|
516
|
+
template_atoms.set_cell(static_cell)
|
|
517
|
+
if static_tags is not None:
|
|
518
|
+
template_atoms.set_tags(static_tags)
|
|
519
|
+
if static_init_charges is not None:
|
|
520
|
+
template_atoms.set_initial_charges(static_init_charges)
|
|
521
|
+
if static_init_magmoms is not None:
|
|
522
|
+
template_atoms.set_initial_magnetic_moments(static_init_magmoms)
|
|
523
|
+
else:
|
|
524
|
+
convert = dict_to_atoms
|
|
525
|
+
static_data = None
|
|
526
|
+
cell_changes = True
|
|
527
|
+
|
|
528
|
+
# Process frames with minimal overhead
|
|
529
|
+
if len(filtered_offsets) > 0:
|
|
530
|
+
# Unified decode path using helper; still parallelized
|
|
531
|
+
def _decode(idx_offset: Tuple[int, Tuple[int, int]]) -> Tuple[int, 'Atoms']:
|
|
532
|
+
orig_idx, (start, length) = idx_offset
|
|
533
|
+
raw_slice = view[start:start + length]
|
|
534
|
+
return orig_idx, _decode_frame(raw_slice, header, template_atoms if format_version in {4, 5} else None)
|
|
535
|
+
|
|
536
|
+
worker_count = _max_workers(len(filtered_offsets))
|
|
537
|
+
chunk_size = _chunk_size(worker_count)
|
|
538
|
+
|
|
539
|
+
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
|
540
|
+
for chunk_start in range(0, len(filtered_offsets), chunk_size):
|
|
541
|
+
offset_chunk = filtered_offsets[chunk_start:chunk_start + chunk_size]
|
|
542
|
+
for result_idx, (orig_idx, atoms) in enumerate(
|
|
543
|
+
executor.map(_decode, offset_chunk), start=0
|
|
544
|
+
):
|
|
545
|
+
atoms_list[chunk_start + result_idx] = atoms
|
|
508
546
|
|
|
509
547
|
return cast(List[Atoms], atoms_list), metadata
|
atomict/io/formats/traj.py
CHANGED
|
@@ -15,11 +15,8 @@ def write_traj(atoms: Union['ase.Atoms', List['ase.Atoms']], filename: str, meta
|
|
|
15
15
|
If None, all available properties are saved
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
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")
|
|
18
|
+
from ase.io.trajectory import TrajectoryWriter
|
|
19
|
+
from ase import Atoms
|
|
23
20
|
|
|
24
21
|
# Single atoms case - convert to list
|
|
25
22
|
if isinstance(atoms, Atoms):
|
|
@@ -43,10 +40,7 @@ def write_traj(atoms: Union['ase.Atoms', List['ase.Atoms']], filename: str, meta
|
|
|
43
40
|
def read_traj(filename: str) -> tuple[List['ase.Atoms'], Dict]:
|
|
44
41
|
"""Load atoms from an ASE trajectory file."""
|
|
45
42
|
|
|
46
|
-
|
|
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")
|
|
43
|
+
from ase.io.trajectory import TrajectoryReader
|
|
50
44
|
|
|
51
45
|
atoms_list = []
|
|
52
46
|
metadata = {}
|
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
|
-
|
|
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."""
|
atomict/simulation/utils.py
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
from ase.io import read
|
|
4
|
-
except ImportError:
|
|
5
|
-
raise ImportError(
|
|
6
|
-
"The 'ase' package is required for JSON operations with Atoms objects. "
|
|
7
|
-
"To install the optional dependencies such as ase, spglib, pymatgen, use `pip install atomict[utils]`"
|
|
8
|
-
)
|
|
1
|
+
from ase import Atoms
|
|
2
|
+
from ase.io import read
|
|
9
3
|
|
|
10
4
|
import logging
|
|
11
5
|
import os
|
|
12
6
|
|
|
13
7
|
# from atomict.io.msgpack import load_msgpack_trajectory
|
|
14
8
|
from atomict.io.formats.atraj import read_atraj
|
|
9
|
+
from atomict.io.formats.tess import read_tess
|
|
15
10
|
from atomict.io.fhiaims import read_aims_output
|
|
16
11
|
from atomict.io.utils import human_filesize
|
|
17
12
|
from atomict.simulation.mlrelax import get_mlrelax, get_mlrelax_files
|
|
@@ -30,6 +25,8 @@ def fetch_source_geometry(sim: dict, workbench_dir: str) -> Atoms:
|
|
|
30
25
|
|
|
31
26
|
if extension == "atraj":
|
|
32
27
|
atoms, _ = read_atraj(workbench_dir + f"/geometry.{extension}")
|
|
28
|
+
elif extension == "tess":
|
|
29
|
+
atoms, _ = read_tess(workbench_dir + f"/geometry.{extension}")
|
|
33
30
|
else:
|
|
34
31
|
atoms = read(workbench_dir + f"/geometry.{extension}")
|
|
35
32
|
|
|
@@ -112,6 +109,8 @@ def fetch_relaxed_geometry(sim: dict, workbench_dir: str) -> Atoms:
|
|
|
112
109
|
|
|
113
110
|
if extension == "atraj":
|
|
114
111
|
atoms, _ = read_atraj(workbench_dir + f"/geometry.{extension}")
|
|
112
|
+
elif extension == "tess":
|
|
113
|
+
atoms, _ = read_tess(workbench_dir + f"/geometry.{extension}")
|
|
115
114
|
else:
|
|
116
115
|
atoms = read(workbench_dir + f"/geometry.{extension}")
|
|
117
116
|
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import logging
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
from ase.io import read
|
|
7
|
-
from ase.io.formats import UnknownFileTypeError
|
|
8
|
-
except ImportError:
|
|
9
|
-
raise ImportError(
|
|
10
|
-
"The 'ase' package is required for JSON operations with Atoms objects. "
|
|
11
|
-
"To install the optional dependencies such as ase, spglib, pymatgen, use `pip install atomict[utils]`"
|
|
12
|
-
)
|
|
3
|
+
from ase import Atoms
|
|
4
|
+
from ase.io import read
|
|
5
|
+
from ase.io.formats import UnknownFileTypeError
|
|
13
6
|
|
|
14
7
|
from atomict.io.fhiaims import read_aims_output
|
|
15
8
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: atomict
|
|
3
|
-
Version: 1.2.
|
|
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
|
|
7
7
|
Project-URL: Homepage, https://github.com/AtomicTessellator/atomic_cli
|
|
8
|
-
Keywords: atomic,tessellator,cli,client,fhi-aims,kpoint,sqs
|
|
8
|
+
Keywords: atomic,tessellator,cli,client,fhi-aims,kpoint,sqs
|
|
9
9
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
10
10
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
11
11
|
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
@@ -22,14 +22,14 @@ Requires-Dist: tenacity~=9.0
|
|
|
22
22
|
Requires-Dist: httpx
|
|
23
23
|
Requires-Dist: click~=8.0
|
|
24
24
|
Requires-Dist: rich~=13.0
|
|
25
|
+
Requires-Dist: ase>=3.23.0
|
|
26
|
+
Requires-Dist: spglib==2.5.0
|
|
27
|
+
Requires-Dist: pymatgen==2025.3.10
|
|
28
|
+
Requires-Dist: msgpack==1.1.0
|
|
29
|
+
Requires-Dist: msgpack_numpy==0.4.8
|
|
25
30
|
Requires-Dist: deepdiff
|
|
26
31
|
Requires-Dist: lz4
|
|
27
32
|
Provides-Extra: utils
|
|
28
|
-
Requires-Dist: ase>=3.23.0; extra == "utils"
|
|
29
|
-
Requires-Dist: spglib==2.5.0; extra == "utils"
|
|
30
|
-
Requires-Dist: pymatgen==2025.3.10; extra == "utils"
|
|
31
|
-
Requires-Dist: msgpack==1.1.0; extra == "utils"
|
|
32
|
-
Requires-Dist: msgpack_numpy==0.4.8; extra == "utils"
|
|
33
33
|
Provides-Extra: dev
|
|
34
34
|
Requires-Dist: pytest~=8.0; extra == "dev"
|
|
35
35
|
Requires-Dist: black; extra == "dev"
|
|
@@ -44,11 +44,8 @@ Dynamic: license-file
|
|
|
44
44
|
```
|
|
45
45
|
pip install atomict
|
|
46
46
|
|
|
47
|
-
# install utils package with scientific extensions (ase, spglib)
|
|
48
|
-
pip install atomict[utils]
|
|
49
|
-
|
|
50
47
|
# ", with a git url
|
|
51
|
-
pip install git+https://github.com/AtomicTessellator/atomic_cli#egg=atomict
|
|
48
|
+
pip install git+https://github.com/AtomicTessellator/atomic_cli#egg=atomict
|
|
52
49
|
|
|
53
50
|
# Troubleshooting
|
|
54
51
|
If pip install is not working, try:
|
|
@@ -57,6 +54,7 @@ pip install --upgrade setuptools pip wheel
|
|
|
57
54
|
|
|
58
55
|
## Installation for devs
|
|
59
56
|
```
|
|
57
|
+
# installs linting and formatting tools with some general defaults
|
|
60
58
|
pip install -e ".[dev]"
|
|
61
59
|
```
|
|
62
60
|
|
|
@@ -92,19 +90,6 @@ This command prints out your current token.
|
|
|
92
90
|
|
|
93
91
|

|
|
94
92
|
|
|
95
|
-
|
|
96
|
-
## Get a list of adsorbates
|
|
97
|
-
|
|
98
|
-
```$ tess adsorbate get```
|
|
99
|
-
|
|
100
|
-

|
|
101
|
-
|
|
102
|
-
## Search objects for substrings
|
|
103
|
-
|
|
104
|
-
```$ tess adsorbate get --search NH3```
|
|
105
|
-
|
|
106
|
-

|
|
107
|
-
|
|
108
93
|
## Get a list of tasks
|
|
109
94
|
|
|
110
95
|
```$ tess task get```
|