manimol 0.2.0__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.
Files changed (73) hide show
  1. manimol-0.2.0/LICENSE +21 -0
  2. manimol-0.2.0/PKG-INFO +185 -0
  3. manimol-0.2.0/README.md +134 -0
  4. manimol-0.2.0/pyproject.toml +65 -0
  5. manimol-0.2.0/setup.cfg +4 -0
  6. manimol-0.2.0/src/args_parse.py +593 -0
  7. manimol-0.2.0/src/candidate_corrector.py +161 -0
  8. manimol-0.2.0/src/candidate_scorer.py +359 -0
  9. manimol-0.2.0/src/dataset/__init__.py +1 -0
  10. manimol-0.2.0/src/dataset/drugdataset.py +644 -0
  11. manimol-0.2.0/src/dataset/manifold.py +237 -0
  12. manimol-0.2.0/src/dataset/sharded_drugdataset.py +124 -0
  13. manimol-0.2.0/src/dataset/smiles2graph.py +217 -0
  14. manimol-0.2.0/src/exputils.py +289 -0
  15. manimol-0.2.0/src/infer1.py +5430 -0
  16. manimol-0.2.0/src/infer_mean_dispersion_torsion.py +1112 -0
  17. manimol-0.2.0/src/infer_torsion.py +752 -0
  18. manimol-0.2.0/src/infer_torsion5.py +1021 -0
  19. manimol-0.2.0/src/manimol/__init__.py +18 -0
  20. manimol-0.2.0/src/manimol/__main__.py +6 -0
  21. manimol-0.2.0/src/manimol/cli.py +36 -0
  22. manimol-0.2.0/src/manimol/full_cli.py +22 -0
  23. manimol-0.2.0/src/manimol/priors.py +60 -0
  24. manimol-0.2.0/src/manimol/runtime.py +116 -0
  25. manimol-0.2.0/src/manimol/selection.py +85 -0
  26. manimol-0.2.0/src/manimol/torsion.py +22 -0
  27. manimol-0.2.0/src/manimol.egg-info/PKG-INFO +185 -0
  28. manimol-0.2.0/src/manimol.egg-info/SOURCES.txt +71 -0
  29. manimol-0.2.0/src/manimol.egg-info/dependency_links.txt +1 -0
  30. manimol-0.2.0/src/manimol.egg-info/entry_points.txt +3 -0
  31. manimol-0.2.0/src/manimol.egg-info/requires.txt +16 -0
  32. manimol-0.2.0/src/manimol.egg-info/top_level.txt +21 -0
  33. manimol-0.2.0/src/manimol_stage1.py +206 -0
  34. manimol-0.2.0/src/mixture_flow/src/__init__.py +1 -0
  35. manimol-0.2.0/src/mixture_flow/src/_path.py +7 -0
  36. manimol-0.2.0/src/mixture_flow/src/infer28_mixture_torsion_flow.py +1093 -0
  37. manimol-0.2.0/src/mixture_flow/src/mixture_torsion_flow.py +291 -0
  38. manimol-0.2.0/src/mixture_flow/src/summarize_mixture_debug.py +80 -0
  39. manimol-0.2.0/src/mixture_flow/src/train28_mixture_torsion_flow.py +583 -0
  40. manimol-0.2.0/src/mixture_torsion_flow.py +7 -0
  41. manimol-0.2.0/src/models/ manifold_learning.py +86 -0
  42. manimol-0.2.0/src/models/__init__.py +8 -0
  43. manimol-0.2.0/src/models/dist.py +273 -0
  44. manimol-0.2.0/src/models/dist2coords.py +23 -0
  45. manimol-0.2.0/src/models/egnn.py +107 -0
  46. manimol-0.2.0/src/models/experimental_backbones.py +364 -0
  47. manimol-0.2.0/src/models/gnnconv.py +512 -0
  48. manimol-0.2.0/src/models/kernel_inversion.py +141 -0
  49. manimol-0.2.0/src/models/kernels.py +427 -0
  50. manimol-0.2.0/src/models/losses.py +154 -0
  51. manimol-0.2.0/src/models/mean_dispersion_bridge.py +119 -0
  52. manimol-0.2.0/src/models/mean_dispersion_torsion_context.py +155 -0
  53. manimol-0.2.0/src/models/model.py +73 -0
  54. manimol-0.2.0/src/models/model0.py +2375 -0
  55. manimol-0.2.0/src/models/vis.py +128 -0
  56. manimol-0.2.0/src/pgraph_controls.py +107 -0
  57. manimol-0.2.0/src/scripts/__init__.py +2 -0
  58. manimol-0.2.0/src/scripts/reference_free_geometry.py +112 -0
  59. manimol-0.2.0/src/torsion_manifold.py +281 -0
  60. manimol-0.2.0/src/train2.py +1631 -0
  61. manimol-0.2.0/src/train5.py +415 -0
  62. manimol-0.2.0/src/trainer.py +1038 -0
  63. manimol-0.2.0/src/utils/__init__.py +7 -0
  64. manimol-0.2.0/src/utils/checkpoint.py +40 -0
  65. manimol-0.2.0/src/utils/device.py +17 -0
  66. manimol-0.2.0/src/utils/helpers.py +98 -0
  67. manimol-0.2.0/src/utils/kabsch.py +29 -0
  68. manimol-0.2.0/src/utils/lookup_table.py +164 -0
  69. manimol-0.2.0/src/utils/metrics.py +50 -0
  70. manimol-0.2.0/src/utils/optuna.py +111 -0
  71. manimol-0.2.0/src/utils/save_mol.py +366 -0
  72. manimol-0.2.0/src/utils/util.py +36 -0
  73. manimol-0.2.0/tests/test_core.py +57 -0
manimol-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MANIMOL developers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
manimol-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: manimol
3
+ Version: 0.2.0
4
+ Summary: MANIMOL ensemble-relational conformer generation and compact-library construction
5
+ Author: MANIMOL developers
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 MANIMOL developers
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Keywords: molecular conformers,conformer generation,chemical informatics
29
+ Classifier: Development Status :: 3 - Alpha
30
+ Classifier: Intended Audience :: Science/Research
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
34
+ Requires-Python: >=3.9
35
+ Description-Content-Type: text/markdown
36
+ License-File: LICENSE
37
+ Requires-Dist: numpy>=1.23
38
+ Provides-Extra: test
39
+ Requires-Dist: pytest>=7; extra == "test"
40
+ Provides-Extra: build
41
+ Requires-Dist: build>=1.0; extra == "build"
42
+ Requires-Dist: twine>=4.0; extra == "build"
43
+ Provides-Extra: full
44
+ Requires-Dist: torch>=2.3; extra == "full"
45
+ Requires-Dist: torch-geometric>=2.5; extra == "full"
46
+ Requires-Dist: rdkit; extra == "full"
47
+ Requires-Dist: scipy>=1.10; extra == "full"
48
+ Requires-Dist: tqdm>=4.66; extra == "full"
49
+ Requires-Dist: pyyaml>=6; extra == "full"
50
+ Dynamic: license-file
51
+
52
+ # MANIMOL
53
+
54
+ MANIMOL predicts ensemble-derived pairwise mean/dispersion relational priors
55
+ from molecular graphs, uses them in torsional proposal generation, and builds
56
+ compact conformer libraries by reference-free selection.
57
+
58
+ The installable software is separated from large research artifacts:
59
+
60
+ - **PyPI:** lightweight numerical utilities and the complete checkpoint-backed
61
+ inference source;
62
+ - **external files:** checkpoints and processed/raw datasets supplied by the
63
+ user or a release;
64
+ - **source repository:** training and paper-specific experiment scripts.
65
+
66
+ No GEOM, Platinum, or PDBbind data and no model checkpoint are redistributed
67
+ by this package.
68
+
69
+ ## Install
70
+
71
+ ```bash
72
+ python -m pip install manimol
73
+ python -m pip install 'manimol[full]'
74
+ ```
75
+
76
+ The base install only needs NumPy. The `full` extra adds PyTorch, PyTorch
77
+ Geometric, RDKit, SciPy, tqdm, and PyYAML. GPU-enabled PyTorch should be
78
+ installed for the user's CUDA environment when needed.
79
+
80
+ ## What is included
81
+
82
+ The wheel contains the existing MANIMOL implementation, including graph
83
+ preprocessing; Stage-I graph and mean/dispersion heads; cross-fragment
84
+ torsional context; dispersion-to-width control; probability-guided and
85
+ noise-conditioned proposal branches; candidate-pool generation and
86
+ oversampling; reference-free selection; ETKDG initialization; MMFF-based
87
+ geometric preparation; filtering and RMSD deduplication; COV/AMR utilities;
88
+ and checkpoint loading.
89
+
90
+ The package is assembled from the repository's real inference modules. It
91
+ does not reimplement a simplified model under a new namespace.
92
+
93
+ ## Full inference
94
+
95
+ `manimol-infer` delegates to the same Stage-I/Stage-II entry point used by the
96
+ project. It requires a compatible checkpoint and the processed/raw dataset
97
+ records expected by that entry point:
98
+
99
+ ```bash
100
+ manimol-infer \
101
+ --base_checkpoint /path/to/stage2_best.pth \
102
+ --denoiser_checkpoint /path/to/denoiser.pth \
103
+ --checkpoint /path/to/stage2_best.pth \
104
+ --dataset Drugs \
105
+ --data_root /path/to/data \
106
+ --raw_prefix geom_drugs \
107
+ --split test \
108
+ --device cuda \
109
+ --use_dispersion_proposal \
110
+ --select_candidates precision2r \
111
+ --output_dir results/manimol
112
+ ```
113
+
114
+ The package default is a 15-fold candidate oversampling factor. Override it
115
+ with `--oversample_factor` for another protocol. The underlying options remain
116
+ available, including P-basin checkpoints, MMFF settings, energy-aware
117
+ selectors, deduplication, RMSD backends, and metric thresholds:
118
+
119
+ ```bash
120
+ manimol-infer --help
121
+ ```
122
+
123
+ The checkpoint family, raw-prefix naming, and preprocessing must match. A
124
+ wheel alone cannot reproduce a paper table without those external artifacts.
125
+
126
+ ## Python API
127
+
128
+ The lightweight numerical utilities remain directly importable:
129
+
130
+ ```python
131
+ import numpy as np
132
+ from manimol import density_centrality_select, ensemble_pairwise_prior
133
+
134
+ conformers = np.load("conformers.npy") # (n_conformers, n_atoms, 3)
135
+ mean, dispersion = ensemble_pairwise_prior(conformers)
136
+ indices = density_centrality_select(conformers, k=20)
137
+ library = conformers[indices]
138
+ ```
139
+
140
+ For the complete model-backed path, `ManiMol` is a thin wrapper around the
141
+ real inference entry point. It uses the benchmark dataset contract rather than
142
+ inventing a separate SMILES-to-PyG adapter:
143
+
144
+ ```python
145
+ from manimol import ManiMol
146
+
147
+ model = ManiMol.from_pretrained(
148
+ "/path/to/stage2_best.pth",
149
+ device="cuda",
150
+ denoiser_checkpoint="/path/to/denoiser.pth",
151
+ )
152
+ model.generate(
153
+ data_root="/path/to/data",
154
+ output_dir="results/manimol",
155
+ dataset="Drugs",
156
+ raw_prefix="geom_drugs",
157
+ split="test",
158
+ select_candidates="precision2r",
159
+ )
160
+ ```
161
+
162
+ Generated SDF/metrics/log artifacts are written to `output_dir`. A direct
163
+ `generate(smiles=...)` adapter is intentionally not claimed in this release:
164
+ the production implementation expects graph, torsion-index, and conformer
165
+ record fields. A future adapter should reuse the exact repository graph
166
+ builder and be validated against this full path first.
167
+
168
+ ## Source layout
169
+
170
+ The runtime modules needed by the real entry point are kept under `src/`,
171
+ including `models/`, `dataset/`, `utils/`, and the inference modules. Training
172
+ and benchmark launchers remain in the source repository and are not needed to
173
+ run a released checkpoint.
174
+
175
+ ## Development checks
176
+
177
+ ```bash
178
+ python -m pip install -e '.[test,build]'
179
+ pytest
180
+ python -m build
181
+ ```
182
+
183
+ The lightweight tests do not require PyTorch, PyTorch Geometric, or RDKit. The
184
+ full path should be smoke-tested in an environment containing the `full`
185
+ dependencies and a compatible checkpoint before release.
@@ -0,0 +1,134 @@
1
+ # MANIMOL
2
+
3
+ MANIMOL predicts ensemble-derived pairwise mean/dispersion relational priors
4
+ from molecular graphs, uses them in torsional proposal generation, and builds
5
+ compact conformer libraries by reference-free selection.
6
+
7
+ The installable software is separated from large research artifacts:
8
+
9
+ - **PyPI:** lightweight numerical utilities and the complete checkpoint-backed
10
+ inference source;
11
+ - **external files:** checkpoints and processed/raw datasets supplied by the
12
+ user or a release;
13
+ - **source repository:** training and paper-specific experiment scripts.
14
+
15
+ No GEOM, Platinum, or PDBbind data and no model checkpoint are redistributed
16
+ by this package.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ python -m pip install manimol
22
+ python -m pip install 'manimol[full]'
23
+ ```
24
+
25
+ The base install only needs NumPy. The `full` extra adds PyTorch, PyTorch
26
+ Geometric, RDKit, SciPy, tqdm, and PyYAML. GPU-enabled PyTorch should be
27
+ installed for the user's CUDA environment when needed.
28
+
29
+ ## What is included
30
+
31
+ The wheel contains the existing MANIMOL implementation, including graph
32
+ preprocessing; Stage-I graph and mean/dispersion heads; cross-fragment
33
+ torsional context; dispersion-to-width control; probability-guided and
34
+ noise-conditioned proposal branches; candidate-pool generation and
35
+ oversampling; reference-free selection; ETKDG initialization; MMFF-based
36
+ geometric preparation; filtering and RMSD deduplication; COV/AMR utilities;
37
+ and checkpoint loading.
38
+
39
+ The package is assembled from the repository's real inference modules. It
40
+ does not reimplement a simplified model under a new namespace.
41
+
42
+ ## Full inference
43
+
44
+ `manimol-infer` delegates to the same Stage-I/Stage-II entry point used by the
45
+ project. It requires a compatible checkpoint and the processed/raw dataset
46
+ records expected by that entry point:
47
+
48
+ ```bash
49
+ manimol-infer \
50
+ --base_checkpoint /path/to/stage2_best.pth \
51
+ --denoiser_checkpoint /path/to/denoiser.pth \
52
+ --checkpoint /path/to/stage2_best.pth \
53
+ --dataset Drugs \
54
+ --data_root /path/to/data \
55
+ --raw_prefix geom_drugs \
56
+ --split test \
57
+ --device cuda \
58
+ --use_dispersion_proposal \
59
+ --select_candidates precision2r \
60
+ --output_dir results/manimol
61
+ ```
62
+
63
+ The package default is a 15-fold candidate oversampling factor. Override it
64
+ with `--oversample_factor` for another protocol. The underlying options remain
65
+ available, including P-basin checkpoints, MMFF settings, energy-aware
66
+ selectors, deduplication, RMSD backends, and metric thresholds:
67
+
68
+ ```bash
69
+ manimol-infer --help
70
+ ```
71
+
72
+ The checkpoint family, raw-prefix naming, and preprocessing must match. A
73
+ wheel alone cannot reproduce a paper table without those external artifacts.
74
+
75
+ ## Python API
76
+
77
+ The lightweight numerical utilities remain directly importable:
78
+
79
+ ```python
80
+ import numpy as np
81
+ from manimol import density_centrality_select, ensemble_pairwise_prior
82
+
83
+ conformers = np.load("conformers.npy") # (n_conformers, n_atoms, 3)
84
+ mean, dispersion = ensemble_pairwise_prior(conformers)
85
+ indices = density_centrality_select(conformers, k=20)
86
+ library = conformers[indices]
87
+ ```
88
+
89
+ For the complete model-backed path, `ManiMol` is a thin wrapper around the
90
+ real inference entry point. It uses the benchmark dataset contract rather than
91
+ inventing a separate SMILES-to-PyG adapter:
92
+
93
+ ```python
94
+ from manimol import ManiMol
95
+
96
+ model = ManiMol.from_pretrained(
97
+ "/path/to/stage2_best.pth",
98
+ device="cuda",
99
+ denoiser_checkpoint="/path/to/denoiser.pth",
100
+ )
101
+ model.generate(
102
+ data_root="/path/to/data",
103
+ output_dir="results/manimol",
104
+ dataset="Drugs",
105
+ raw_prefix="geom_drugs",
106
+ split="test",
107
+ select_candidates="precision2r",
108
+ )
109
+ ```
110
+
111
+ Generated SDF/metrics/log artifacts are written to `output_dir`. A direct
112
+ `generate(smiles=...)` adapter is intentionally not claimed in this release:
113
+ the production implementation expects graph, torsion-index, and conformer
114
+ record fields. A future adapter should reuse the exact repository graph
115
+ builder and be validated against this full path first.
116
+
117
+ ## Source layout
118
+
119
+ The runtime modules needed by the real entry point are kept under `src/`,
120
+ including `models/`, `dataset/`, `utils/`, and the inference modules. Training
121
+ and benchmark launchers remain in the source repository and are not needed to
122
+ run a released checkpoint.
123
+
124
+ ## Development checks
125
+
126
+ ```bash
127
+ python -m pip install -e '.[test,build]'
128
+ pytest
129
+ python -m build
130
+ ```
131
+
132
+ The lightweight tests do not require PyTorch, PyTorch Geometric, or RDKit. The
133
+ full path should be smoke-tested in an environment containing the `full`
134
+ dependencies and a compatible checkpoint before release.
@@ -0,0 +1,65 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "manimol"
7
+ version = "0.2.0"
8
+ description = "MANIMOL ensemble-relational conformer generation and compact-library construction"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "MANIMOL developers" }]
13
+ keywords = ["molecular conformers", "conformer generation", "chemical informatics"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Science/Research",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Scientific/Engineering :: Chemistry",
20
+ ]
21
+ dependencies = ["numpy>=1.23"]
22
+
23
+ [project.optional-dependencies]
24
+ test = ["pytest>=7"]
25
+ build = ["build>=1.0", "twine>=4.0"]
26
+ full = [
27
+ "torch>=2.3",
28
+ "torch-geometric>=2.5",
29
+ "rdkit",
30
+ "scipy>=1.10",
31
+ "tqdm>=4.66",
32
+ "pyyaml>=6",
33
+ ]
34
+
35
+ [project.scripts]
36
+ manimol-select = "manimol.cli:main"
37
+ manimol-infer = "manimol.full_cli:main"
38
+
39
+ [tool.setuptools]
40
+ py-modules = [
41
+ "args_parse",
42
+ "candidate_corrector",
43
+ "candidate_scorer",
44
+ "exputils",
45
+ "infer1",
46
+ "infer_mean_dispersion_torsion",
47
+ "infer_torsion",
48
+ "infer_torsion5",
49
+ "manimol_stage1",
50
+ "mixture_torsion_flow",
51
+ "pgraph_controls",
52
+ "torsion_manifold",
53
+ "train2",
54
+ "train5",
55
+ "trainer",
56
+ ]
57
+
58
+ [tool.setuptools.packages.find]
59
+ where = ["src"]
60
+ include = ["manimol*", "models*", "dataset*", "utils*", "scripts*", "mixture_flow*"]
61
+
62
+ [tool.pytest.ini_options]
63
+ testpaths = ["tests"]
64
+ addopts = "-ra"
65
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+