pack-mm 0.1.1__py3-none-any.whl → 0.1.3__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 CHANGED
@@ -8,7 +8,9 @@ from __future__ import annotations
8
8
 
9
9
  from enum import Enum
10
10
 
11
- import typer
11
+ from janus_core.cli.utils import yaml_converter_callback
12
+ from typer import Exit, Option, Typer
13
+ from typer_config import use_config
12
14
 
13
15
  from pack_mm.core.core import pack_molecules
14
16
 
@@ -41,98 +43,89 @@ class RelaxStrategy(str, Enum):
41
43
  MD = "md"
42
44
 
43
45
 
44
- app = typer.Typer(no_args_is_help=True)
46
+ app = Typer(no_args_is_help=True)
45
47
 
46
48
 
47
49
  @app.command()
50
+ @use_config(yaml_converter_callback)
48
51
  def packmm(
49
- system: str | None = typer.Option(
52
+ system: str | None = Option(
50
53
  None,
51
54
  help="""The original box in which you want to add particles.
52
55
  If not provided, an empty box will be created.""",
53
56
  ),
54
- molecule: str = typer.Option(
57
+ molecule: str = Option(
55
58
  "H2O",
56
59
  help="""Name of the molecule to be processed, ASE-recognizable or
57
60
  ASE-readable file.""",
58
61
  ),
59
- nmols: int = typer.Option(-1, help="Target number of molecules to insert."),
60
- ntries: int = typer.Option(
62
+ nmols: int = Option(-1, help="Target number of molecules to insert."),
63
+ ntries: int = Option(
61
64
  50, help="Maximum number of attempts to insert each molecule."
62
65
  ),
63
- every: int = typer.Option(
66
+ every: int = Option(
64
67
  -1, help="Run MD-NVE or Geometry optimisation everyth insertion."
65
68
  ),
66
- seed: int = typer.Option(2025, help="Random seed for reproducibility."),
67
- md_steps: int = typer.Option(10, help="Number of steps to run MD."),
68
- md_timestep: float = typer.Option(1.0, help="Timestep for MD integration, in fs."),
69
- where: InsertionMethod = typer.Option(
69
+ seed: int = Option(2025, help="Random seed for reproducibility."),
70
+ md_steps: int = Option(10, help="Number of steps to run MD."),
71
+ md_timestep: float = Option(1.0, help="Timestep for MD integration, in fs."),
72
+ where: InsertionMethod = Option(
70
73
  InsertionMethod.ANYWHERE,
71
74
  help="""Where to insert the molecule. Choices: 'anywhere', 'sphere',
72
75
  'box', 'cylinderZ', 'cylinderY', 'cylinderX', 'ellipsoid'.""",
73
76
  ),
74
- insert_strategy: InsertionStrategy = typer.Option(
77
+ insert_strategy: InsertionStrategy = Option(
75
78
  InsertionStrategy.MC,
76
79
  help="""How to insert a new molecule. Choices: 'mc', 'hmc',""",
77
80
  ),
78
- relax_strategy: RelaxStrategy = typer.Option(
81
+ relax_strategy: RelaxStrategy = Option(
79
82
  RelaxStrategy.GEOMETRY_OPTIMISATION,
80
83
  help="""How to relax the system to get more favourable structures.
81
84
  Choices: 'geometry_optimisation', 'md',""",
82
85
  ),
83
- centre: str | None = typer.Option(
86
+ centre: str | None = Option(
84
87
  None,
85
88
  help="""Centre of the insertion zone, coordinates in Å,
86
89
  e.g., '5.0, 5.0, 5.0'.""",
87
90
  ),
88
- radius: float | None = typer.Option(
91
+ radius: float | None = Option(
89
92
  None,
90
93
  help="""Radius of the sphere or cylinder in Å,
91
94
  depending on the insertion volume.""",
92
95
  ),
93
- height: float | None = typer.Option(None, help="Height of the cylinder in Å."),
94
- a: float | None = typer.Option(
96
+ height: float | None = Option(None, help="Height of the cylinder in Å."),
97
+ a: float | None = Option(
95
98
  None,
96
99
  help="""Side of the box or semi-axis of the ellipsoid, in Å,
97
100
  depends on the insertion method.""",
98
101
  ),
99
- b: float | None = typer.Option(
102
+ b: float | None = Option(
100
103
  None,
101
104
  help="""Side of the box or semi-axis of the ellipsoid, in Å,
102
105
  depends on the insertion method.""",
103
106
  ),
104
- c: float | None = typer.Option(
107
+ c: float | None = Option(
105
108
  None,
106
109
  help="""Side of the box or semi-axis of the ellipsoid, in Å,
107
110
  depends on the insertion method.""",
108
111
  ),
109
- device: str = typer.Option(
112
+ device: str = Option(
110
113
  "cpu", help="Device to run calculations on (e.g., 'cpu' or 'cuda')."
111
114
  ),
112
- model: str = typer.Option("medium-omat-0", help="ML model to use."),
113
- arch: str = typer.Option("mace_mp", help="MLIP architecture to use."),
114
- temperature: float = typer.Option(
115
+ model: str = Option("medium-omat-0", help="ML model to use."),
116
+ arch: str = Option("mace_mp", help="MLIP architecture to use."),
117
+ temperature: float = Option(
115
118
  300.0, help="Temperature for the Monte Carlo acceptance rule."
116
119
  ),
117
- md_temperature: float = typer.Option(
120
+ md_temperature: float = Option(
118
121
  100.0, help="Temperature for the Molecular dynamics relaxation."
119
122
  ),
120
- cell_a: float = typer.Option(
121
- 20.0, help="Side of the empty box along the x-axis in Å."
122
- ),
123
- cell_b: float = typer.Option(
124
- 20.0, help="Side of the empty box along the y-axis in Å."
125
- ),
126
- cell_c: float = typer.Option(
127
- 20.0, help="Side of the empty box along the z-axis in Å."
128
- ),
129
- fmax: float = typer.Option(
130
- 0.1, help="force tollerance for optimisation if needed."
131
- ),
132
- geometry: bool = typer.Option(
133
- True, help="Perform geometry optimization at the end."
134
- ),
135
- out_path: str = typer.Option(".", help="path to save various outputs."),
123
+ cell_a: float = Option(20.0, help="Side of the empty box along the x-axis in Å."),
124
+ cell_b: float = Option(20.0, help="Side of the empty box along the y-axis in Å."),
125
+ cell_c: float = Option(20.0, help="Side of the empty box along the z-axis in Å."),
126
+ fmax: float = Option(0.1, help="force tollerance for optimisation if needed."),
127
+ geometry: bool = Option(True, help="Perform geometry optimization at the end."),
128
+ out_path: str = Option(".", help="path to save various outputs."),
136
129
  ):
137
130
  """Pack molecules into a system based on the specified parameters."""
138
131
  print("Script called with following input")
@@ -166,7 +159,7 @@ def packmm(
166
159
  print(f"{md_temperature=}")
167
160
  if nmols == -1:
168
161
  print("nothing to do, no molecule to insert")
169
- raise typer.Exit(0)
162
+ raise Exit(0)
170
163
 
171
164
  center = centre
172
165
  if centre:
pack_mm/core/core.py CHANGED
@@ -210,7 +210,7 @@ def pack_molecules(
210
210
  out_path: str = ".",
211
211
  every: int = -1,
212
212
  relax_strategy: str = "geometry_optimisation",
213
- insert_strategy: str = "random",
213
+ insert_strategy: str = "mc",
214
214
  md_steps: int = 10,
215
215
  md_timestep: float = 1.0,
216
216
  md_temperature: float = 100.0,
@@ -277,7 +277,7 @@ def pack_molecules(
277
277
  sysname = ""
278
278
  elif isinstance(system, Atoms):
279
279
  sys = system.copy()
280
- sysname = sys.get_chemical_formula()
280
+ sysname = sys.get_chemical_formula() + "+"
281
281
  else:
282
282
  sys = read(system)
283
283
  sysname = Path(system).stem + "+"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pack-mm
3
- Version: 0.1.1
3
+ Version: 0.1.3
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
@@ -19,10 +19,13 @@ 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
21
21
 
22
+ [![PyPI version][pypi-badge]][pypi-link]
22
23
  [![Python versions][python-badge]][python-link]
23
24
  [![Build Status][ci-badge]][ci-link]
24
25
  [![Coverage Status][cov-badge]][cov-link]
25
26
  [![License][license-badge]][license-link]
27
+ [![DOI][doi-badge]][doi-link]
28
+ [![Docs status][docs-badge]][docs-link]
26
29
 
27
30
  # what is packmm
28
31
 
@@ -33,12 +36,15 @@ It tries to generate realistic starting configuration by employing machine learn
33
36
  interatomic potential for describing interactions between atoms and Monte Carlo,
34
37
  Molecular Dynamics and hybrid Monte Carlo.
35
38
 
39
+ It is using [janus-core](https://github.com/stfc/janus-core) for MLIPs ([mace mp](https://github.com/ACEsuit/mace-mp) is the default) and for MD and Geometry optimisation
40
+ routines.
41
+
36
42
  It provides both a cli and a python api, with some examples below.
37
43
 
38
44
  ## Quick install
39
45
 
40
46
  ```bash
41
-
47
+ python3 -m pip install pack-mm # or
42
48
  uv pip install pack-mm
43
49
 
44
50
  ```
@@ -46,14 +52,24 @@ or install the latest
46
52
 
47
53
  ```bash
48
54
 
55
+ python3 -m pip install git+https://github.com/ddmms/pack-mm.git # or
49
56
  uv pip install git+https://github.com/ddmms/pack-mm.git
50
57
 
51
58
  ```
52
59
 
60
+ ## Using gpu
61
+
62
+ by default runs on cpu, if you want to use gpus (recommended for big systems) pass --device cuda to cli or device="cuda" to python
63
+ API.
64
+
53
65
  ## Jupyter notebook examples
54
66
 
55
67
 
56
68
  - [Basics](docs/source/tutorials/basics.ipynb) [![badge](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ddmms/pack-mm/blob/main/docs/source/tutorials/basic.ipynb)
69
+ - [Surface](docs/source/tutorials/basics.ipynb) [![badge](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ddmms/pack-mm/blob/main/docs/source/tutorials/surface.ipynb)
70
+ - [Water](docs/source/tutorials/basics.ipynb) [![badge](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ddmms/pack-mm/blob/main/docs/source/tutorials/water.ipynb)
71
+ - [interstitials](docs/source/tutorials/basics.ipynb) [![badge](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ddmms/pack-mm/blob/main/docs/source/tutorials/interstitials.ipynb)
72
+ - [Mof](docs/source/tutorials/basics.ipynb) [![badge](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ddmms/pack-mm/blob/main/docs/source/tutorials/mof.ipynb)
57
73
 
58
74
  ## CLI examples
59
75
 
@@ -248,6 +264,8 @@ after optimisation
248
264
 
249
265
 
250
266
 
267
+ [doi-link]: https://zenodo.org/badge/latestdoi/937083576
268
+ [doi-badge]: https://zenodo.org/badge/937083576.svg
251
269
  [python-badge]: https://img.shields.io/pypi/pyversions/pack-mm.svg
252
270
  [python-link]: https://pypi.org/project/pack-mm/
253
271
  [ci-badge]: https://github.com/ddmms/pack-mm/actions/workflows/build.yml/badge.svg?branch=main
@@ -256,3 +274,7 @@ after optimisation
256
274
  [cov-link]: https://coveralls.io/github/ddmms/pack-mm?branch=main
257
275
  [license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
258
276
  [license-link]: https://opensource.org/license/MIT
277
+ [pypi-badge]: https://badge.fury.io/py/pack-mm.svg
278
+ [pypi-link]: https://pypi.org/project/pack-mm/
279
+ [docs-badge]: https://github.com/ddmms/pack-mm/actions/workflows/python-publish.yml/badge.svg
280
+ [docs-link]: https://ddmms.github.io/pack-mm/
@@ -0,0 +1,8 @@
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,,
@@ -1,8 +0,0 @@
1
- pack_mm-0.1.1.dist-info/METADATA,sha256=-Hv1zI5_LAmH0iJi37Z4d9xAgepWpXxrRM1DIVz3SmM,13804
2
- pack_mm-0.1.1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- pack_mm-0.1.1.dist-info/entry_points.txt,sha256=ajKA2oehIa_LCVCP2XTRxV0VNgjGl9c2wYkwk0BasrQ,66
4
- pack_mm-0.1.1.dist-info/licenses/LICENSE,sha256=ZOYkPdn_vQ8wYJqZnjesow79F_grMbVlHcJ9V91G1pE,1100
5
- pack_mm/__init__.py,sha256=ct7qfCmTDwhLYip6JKYWRLasmmaGYt0ColbK0CpvYZk,150
6
- pack_mm/cli/packmm.py,sha256=E63MmBrxvn9g5GQMK5vlyq6CmHL8hgQ8CICeX2N9z1E,6398
7
- pack_mm/core/core.py,sha256=vLTdnWaqnIOtkhtLBG9911RxhJMn-DWAWe5GzyFWSdc,15883
8
- pack_mm-0.1.1.dist-info/RECORD,,