pack-mm 0.1.3__py3-none-any.whl → 0.1.11__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.
- pack_mm/cli/packmm.py +8 -0
- pack_mm/core/core.py +46 -60
- {pack_mm-0.1.3.dist-info → pack_mm-0.1.11.dist-info}/METADATA +2 -2
- pack_mm-0.1.11.dist-info/RECORD +8 -0
- pack_mm-0.1.3.dist-info/RECORD +0 -8
- {pack_mm-0.1.3.dist-info → pack_mm-0.1.11.dist-info}/WHEEL +0 -0
- {pack_mm-0.1.3.dist-info → pack_mm-0.1.11.dist-info}/entry_points.txt +0 -0
- {pack_mm-0.1.3.dist-info → pack_mm-0.1.11.dist-info}/licenses/LICENSE +0 -0
pack_mm/cli/packmm.py
CHANGED
@@ -124,6 +124,12 @@ def packmm(
|
|
124
124
|
cell_b: float = Option(20.0, help="Side of the empty box along the y-axis in Å."),
|
125
125
|
cell_c: float = Option(20.0, help="Side of the empty box along the z-axis in Å."),
|
126
126
|
fmax: float = Option(0.1, help="force tollerance for optimisation if needed."),
|
127
|
+
threshold: float = Option(
|
128
|
+
0.92,
|
129
|
+
help="""percentage of the single molecule energy above which
|
130
|
+
the acceptance energy difference must
|
131
|
+
be considered for acceptance.""",
|
132
|
+
),
|
127
133
|
geometry: bool = Option(True, help="Perform geometry optimization at the end."),
|
128
134
|
out_path: str = Option(".", help="path to save various outputs."),
|
129
135
|
):
|
@@ -149,6 +155,7 @@ def packmm(
|
|
149
155
|
print(f"{device=}")
|
150
156
|
print(f"{temperature=}")
|
151
157
|
print(f"{fmax=}")
|
158
|
+
print(f"{threshold=}")
|
152
159
|
print(f"{geometry=}")
|
153
160
|
print(f"{out_path=}")
|
154
161
|
print(f"{every=}")
|
@@ -188,6 +195,7 @@ def packmm(
|
|
188
195
|
temperature=temperature,
|
189
196
|
ntries=ntries,
|
190
197
|
fmax=fmax,
|
198
|
+
threshold=threshold,
|
191
199
|
geometry=geometry,
|
192
200
|
cell_a=cell_a,
|
193
201
|
cell_b=cell_b,
|
pack_mm/core/core.py
CHANGED
@@ -189,9 +189,9 @@ def pack_molecules(
|
|
189
189
|
system: str | Atoms = None,
|
190
190
|
molecule: str = "H2O",
|
191
191
|
nmols: int = -1,
|
192
|
-
arch: str = "
|
193
|
-
model: str = "
|
194
|
-
device: str = "
|
192
|
+
arch: str = "mace_mp",
|
193
|
+
model: str = "medium-omat-0",
|
194
|
+
device: str = "cpu",
|
195
195
|
where: str = "anywhere",
|
196
196
|
center: tuple[float, float, float] = None,
|
197
197
|
radius: float = None,
|
@@ -204,6 +204,7 @@ def pack_molecules(
|
|
204
204
|
ntries: int = 50,
|
205
205
|
geometry: bool = False,
|
206
206
|
fmax: float = 0.1,
|
207
|
+
threshold: float = 0.92,
|
207
208
|
cell_a: float = None,
|
208
209
|
cell_b: float = None,
|
209
210
|
cell_c: float = None,
|
@@ -243,6 +244,9 @@ def pack_molecules(
|
|
243
244
|
md_temperature (float): Temperature in Kelvin for MD.
|
244
245
|
md_steps (int): Number of steps for MD.
|
245
246
|
md_timestep (float): Timestep in fs for MD.
|
247
|
+
fmax (float): Max force for geometry optimisation.
|
248
|
+
threshold (float): Percentage of the single molecule energy above which
|
249
|
+
the move is to be considered for acceptance.
|
246
250
|
insert_strategy (str): Insert strategy, "random" or "md"
|
247
251
|
relax_strategy (str): Relax strategy, "geometry_optimisation" or "md"
|
248
252
|
|
@@ -298,6 +302,10 @@ def pack_molecules(
|
|
298
302
|
|
299
303
|
e = sys.get_potential_energy() if len(sys) > 0 else 0.0
|
300
304
|
|
305
|
+
mol = load_molecule(molecule)
|
306
|
+
mol.calc = calc
|
307
|
+
emol = mol.get_potential_energy()
|
308
|
+
|
301
309
|
csys = sys.copy()
|
302
310
|
i = 0
|
303
311
|
while i < nmols:
|
@@ -316,7 +324,7 @@ def pack_molecules(
|
|
316
324
|
|
317
325
|
if every > 0 and _itry / every == 0:
|
318
326
|
tsys = save_the_day(
|
319
|
-
|
327
|
+
struct=tsys,
|
320
328
|
device=device,
|
321
329
|
arch=arch,
|
322
330
|
model=model,
|
@@ -336,7 +344,7 @@ def pack_molecules(
|
|
336
344
|
u = random.random()
|
337
345
|
print(f"Old energy={e}, new energy={en}, {de=}, {acc=}, random={u}")
|
338
346
|
|
339
|
-
if u <= acc:
|
347
|
+
if abs(de / emol) > threshold and u <= acc:
|
340
348
|
accept = True
|
341
349
|
break
|
342
350
|
if accept:
|
@@ -367,13 +375,13 @@ def pack_molecules(
|
|
367
375
|
# Perform final geometry optimization if requested
|
368
376
|
if geometry:
|
369
377
|
energy_final, csys = optimize_geometry(
|
370
|
-
Path(out_path) / f"{sysname}{nmols}{Path(molecule).stem}.cif",
|
371
|
-
device,
|
372
|
-
arch,
|
373
|
-
model,
|
374
|
-
fmax,
|
375
|
-
out_path,
|
376
|
-
True,
|
378
|
+
struct=Path(out_path) / f"{sysname}{nmols}{Path(molecule).stem}.cif",
|
379
|
+
device=device,
|
380
|
+
arch=arch,
|
381
|
+
model=model,
|
382
|
+
fmax=fmax,
|
383
|
+
out_path=out_path,
|
384
|
+
opt_cell=True,
|
377
385
|
)
|
378
386
|
return (energy_final, csys)
|
379
387
|
|
@@ -418,7 +426,7 @@ def rotate_molecule(mol):
|
|
418
426
|
|
419
427
|
|
420
428
|
def save_the_day(
|
421
|
-
|
429
|
+
struct: str | Atoms,
|
422
430
|
device: str = "",
|
423
431
|
arch: str = "",
|
424
432
|
model: str = "",
|
@@ -432,7 +440,7 @@ def save_the_day(
|
|
432
440
|
"""Geometry optimisation or MD to get a better structure."""
|
433
441
|
if relax_strategy == "geometry_optimisation":
|
434
442
|
_, a = optimize_geometry(
|
435
|
-
|
443
|
+
struct,
|
436
444
|
device,
|
437
445
|
arch,
|
438
446
|
model,
|
@@ -442,13 +450,13 @@ def save_the_day(
|
|
442
450
|
return a
|
443
451
|
if relax_strategy == "md":
|
444
452
|
return run_md_nve(
|
445
|
-
|
453
|
+
struct, md_temperature, md_steps, md_timestep, arch, model, device
|
446
454
|
)
|
447
455
|
return None
|
448
456
|
|
449
457
|
|
450
458
|
def run_md_nve(
|
451
|
-
|
459
|
+
struct: str | Atoms,
|
452
460
|
temp: float = 100.0,
|
453
461
|
steps: int = 10,
|
454
462
|
timestep: float = 1.0,
|
@@ -457,34 +465,22 @@ def run_md_nve(
|
|
457
465
|
device: str = "",
|
458
466
|
) -> Atoms:
|
459
467
|
"""Run nve simulation."""
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
)
|
471
|
-
else:
|
472
|
-
md = NVE(
|
473
|
-
struct_path=struct_path,
|
474
|
-
temp=temp,
|
475
|
-
device=device,
|
476
|
-
arch=arch,
|
477
|
-
calc_kwargs={"model_paths": model},
|
478
|
-
stats_every=1,
|
479
|
-
steps=steps,
|
480
|
-
timestep=timestep,
|
481
|
-
)
|
468
|
+
md = NVE(
|
469
|
+
struct=struct,
|
470
|
+
temp=temp,
|
471
|
+
device=device,
|
472
|
+
arch=arch,
|
473
|
+
calc_kwargs={"model_paths": model},
|
474
|
+
stats_every=1,
|
475
|
+
steps=steps,
|
476
|
+
timestep=timestep,
|
477
|
+
)
|
482
478
|
md.run()
|
483
479
|
return md.struct
|
484
480
|
|
485
481
|
|
486
482
|
def optimize_geometry(
|
487
|
-
|
483
|
+
struct: str | Atoms,
|
488
484
|
device: str,
|
489
485
|
arch: str,
|
490
486
|
model: str,
|
@@ -493,25 +489,15 @@ def optimize_geometry(
|
|
493
489
|
opt_cell: bool = False,
|
494
490
|
) -> tuple(float, Atoms):
|
495
491
|
"""Optimize the geometry of a structure."""
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
geo = GeomOpt(
|
508
|
-
struct_path=struct_path,
|
509
|
-
device=device,
|
510
|
-
arch=arch,
|
511
|
-
fmax=fmax,
|
512
|
-
calc_kwargs={"model_paths": model},
|
513
|
-
filter_kwargs={"hydrostatic_strain": opt_cell},
|
514
|
-
)
|
515
|
-
geo.run()
|
516
|
-
write(Path(out_path) / f"{Path(struct_path).stem}-opt.cif", geo.struct)
|
492
|
+
geo = GeomOpt(
|
493
|
+
struct=struct,
|
494
|
+
device=device,
|
495
|
+
arch=arch,
|
496
|
+
fmax=fmax,
|
497
|
+
calc_kwargs={"model_paths": model},
|
498
|
+
filter_kwargs={"hydrostatic_strain": opt_cell},
|
499
|
+
)
|
500
|
+
geo.run()
|
501
|
+
if isinstance(struct, Path):
|
502
|
+
write(Path(out_path) / f"{struct.stem}-opt.cif", geo.struct)
|
517
503
|
return (geo.struct.get_potential_energy(), geo.struct)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pack-mm
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.11
|
4
4
|
Summary: packing materials and molecules in boxes using for machine learnt interatomic potentials
|
5
5
|
Author: Alin M. Elena
|
6
6
|
Classifier: Programming Language :: Python
|
@@ -14,7 +14,7 @@ Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Project-URL: Repository, https://github.com/ddmms/pack-mm/
|
15
15
|
Project-URL: Documentation, https://ddmms.github.io/pack-mm/
|
16
16
|
Requires-Python: >=3.10
|
17
|
-
Requires-Dist: janus-core>=0.7.2
|
17
|
+
Requires-Dist: janus-core[mace]>=0.7.2
|
18
18
|
Requires-Dist: typer<1.0.0,>=0.12.5
|
19
19
|
Requires-Dist: typer-config<2.0.0,>=1.4.2
|
20
20
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1,8 @@
|
|
1
|
+
pack_mm-0.1.11.dist-info/METADATA,sha256=o4IdCZX_1an8XCAIN4a2qD2oI9QCp2loR9oNRkZM5lg,15589
|
2
|
+
pack_mm-0.1.11.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
pack_mm-0.1.11.dist-info/entry_points.txt,sha256=ajKA2oehIa_LCVCP2XTRxV0VNgjGl9c2wYkwk0BasrQ,66
|
4
|
+
pack_mm-0.1.11.dist-info/licenses/LICENSE,sha256=ZOYkPdn_vQ8wYJqZnjesow79F_grMbVlHcJ9V91G1pE,1100
|
5
|
+
pack_mm/__init__.py,sha256=ct7qfCmTDwhLYip6JKYWRLasmmaGYt0ColbK0CpvYZk,150
|
6
|
+
pack_mm/cli/packmm.py,sha256=B_GtIfSMxxCuo7077hSnGFY4Jql0EliFCAewmBhyvoU,6584
|
7
|
+
pack_mm/core/core.py,sha256=Zn3kFof9Gkz0C70iOC4WLZkckyC92NWuXQUhieN02vU,15567
|
8
|
+
pack_mm-0.1.11.dist-info/RECORD,,
|
pack_mm-0.1.3.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
pack_mm-0.1.3.dist-info/METADATA,sha256=O1R3mqp12KVeizVU372ZInNl8ljidaVsKCPmv64QQR4,15582
|
2
|
-
pack_mm-0.1.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
-
pack_mm-0.1.3.dist-info/entry_points.txt,sha256=ajKA2oehIa_LCVCP2XTRxV0VNgjGl9c2wYkwk0BasrQ,66
|
4
|
-
pack_mm-0.1.3.dist-info/licenses/LICENSE,sha256=ZOYkPdn_vQ8wYJqZnjesow79F_grMbVlHcJ9V91G1pE,1100
|
5
|
-
pack_mm/__init__.py,sha256=ct7qfCmTDwhLYip6JKYWRLasmmaGYt0ColbK0CpvYZk,150
|
6
|
-
pack_mm/cli/packmm.py,sha256=2WJRReS9BSmLadWPU6_m-0MPl1AHnKHZmDruD8aXBDQ,6303
|
7
|
-
pack_mm/core/core.py,sha256=lFDFIVrt_WAb45c0da_8Sey7Ku21oJqXCUIEtK6j-po,15885
|
8
|
-
pack_mm-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|