GraphAtoms 1.1.2__tar.gz → 1.1.3__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.
- graphatoms-1.1.3/PKG-INFO +105 -0
- graphatoms-1.1.3/README.md +72 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/pyproject.toml +2 -2
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_abc/rtgp.py +1 -1
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/__init__.py +2 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/_moveFB.py +1 -2
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_graph/__init__.py +6 -1
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_graph/_bonds.py +16 -5
- graphatoms-1.1.3/src/graphatoms/system/helper.py +104 -0
- graphatoms-1.1.2/PKG-INFO +0 -36
- graphatoms-1.1.2/README.md +0 -3
- graphatoms-1.1.2/src/graphatoms/system/helper.py +0 -19
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/LICENSE +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/dataclasses/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/dataclasses/_numpydantic.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/dataclasses/_pydantic2pyarrow.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/dataclasses/_pydanticMixin.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/dataclasses/_pydanticModel.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/geometry/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/geometry/_bond_list.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/geometry/_distance_pairs.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/geometry/_inner_outer.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/geometry/_neighbor_list.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/geometry/rotation.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/geometry/sample.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_abc/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_abc/move.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_kmcevent/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_kmcevent/_event.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_kmcevent/adsorption.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_kmcevent/desorption.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_kmcevent/reaction.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/_abc.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/_base.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/_moveSP.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/_moveSwap.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/_simNVT.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/test_mmc.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/test_move.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mcmove/zzz.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_mdwarpper/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_network/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/reaction/_network/_base.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_atoms/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_atoms/_box.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_atoms/_eng.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_atoms/_struct.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_database/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_database/base.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_database/hdf5.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_database/sqliteASE.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_graph/_gasMixin.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_graph/_sysGraph.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_sys/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_sys/_sysCluster.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/system/_sys/_sysGas.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/utils/__init__.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/utils/bytestool.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/utils/logger.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/utils/parser.py +0 -0
- {graphatoms-1.1.2 → graphatoms-1.1.3}/src/graphatoms/utils/rdutils.py +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: graphatoms
|
|
3
|
+
Version: 1.1.3
|
|
4
|
+
Summary: The Chemical Core Class for Graph Theory Analysis.
|
|
5
|
+
Keywords: chemistry,graph theory,reaction,event,KMC
|
|
6
|
+
Author: LiuGaoyong
|
|
7
|
+
Author-email: LiuGaoyong <liugaoyong_88@163.com>
|
|
8
|
+
License-Expression: GPL-3.0-or-later
|
|
9
|
+
License-File: src/LICENSE
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Requires-Dist: ase
|
|
14
|
+
Requires-Dist: pymatgen>2023.6
|
|
15
|
+
Requires-Dist: rdkit>=2025
|
|
16
|
+
Requires-Dist: scikit-learn>=1.5
|
|
17
|
+
Requires-Dist: pyarrow
|
|
18
|
+
Requires-Dist: igraph>=0.11
|
|
19
|
+
Requires-Dist: h5py>=3.16
|
|
20
|
+
Requires-Dist: hydra-core
|
|
21
|
+
Requires-Dist: numpydantic
|
|
22
|
+
Requires-Dist: pydantic>=2.11
|
|
23
|
+
Requires-Dist: python-snappy>=0.7.3
|
|
24
|
+
Requires-Dist: tomli ; python_full_version < '3.11'
|
|
25
|
+
Requires-Dist: tomli-w
|
|
26
|
+
Requires-Dist: typing-extensions
|
|
27
|
+
Requires-Dist: loguru
|
|
28
|
+
Requires-Python: >=3.12
|
|
29
|
+
Project-URL: Homepage, https://github.com/LiuGaoyong/GraphAtoms
|
|
30
|
+
Project-URL: Repository, https://github.com/LiuGaoyong/GraphAtoms
|
|
31
|
+
Project-URL: Issues, https://github.com/LiuGaoyong/GraphAtoms/issues/
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# graphatoms
|
|
35
|
+
|
|
36
|
+
[](https://anaconda.org/conda-forge/graphatoms) [](https://anaconda.org/conda-forge/graphatoms) [](https://pypi.org/project/graphatoms/) [](https://pepy.tech/projects/graphatoms)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
The Chemical Core Class for Graph Theory Analysis & Graph Neural Network.
|
|
40
|
+
|
|
41
|
+
## Overview
|
|
42
|
+
|
|
43
|
+
The `graphatoms` is a Python library designed for chemical graph theory analysis and graph neural network applications. It provides core classes for representing chemical systems and reactions with graph-based data structures.
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- **Graph-based Chemical System Representation**: Represent chemical systems, clusters, and gas molecules using graph theory
|
|
48
|
+
- **Reaction Modeling**: Support for reaction classes, KMC (Kinetic Monte Carlo) events, and MC (Monte Carlo) moves
|
|
49
|
+
- **Geometry Operations**: Bond lists, distance calculations, neighbor lists, rotations, and sampling
|
|
50
|
+
- **Data Storage**: Support for HDF5 and SQLite databases for efficient data persistence
|
|
51
|
+
- **Dataclasses**: Pydantic-based data models for type-safe data handling
|
|
52
|
+
|
|
53
|
+
## Module Structure
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
src/graphatoms/
|
|
57
|
+
├── dataclasses/ # Pydantic-based data models
|
|
58
|
+
├── geometry/ # Geometric operations
|
|
59
|
+
├── reaction/ # Reaction classes and KMC events
|
|
60
|
+
├── system/ # Core system classes (System, Cluster, Gas)
|
|
61
|
+
└── utils/ # Utility functions
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Requirements
|
|
65
|
+
|
|
66
|
+
- Python >= 3.10
|
|
67
|
+
- ase
|
|
68
|
+
- pymatgen > 2023.6
|
|
69
|
+
- rdkit >= 2025
|
|
70
|
+
- scikit-learn >= 1.5
|
|
71
|
+
- pyarrow
|
|
72
|
+
- igraph >= 0.11
|
|
73
|
+
- h5py >= 3.16
|
|
74
|
+
- hydra-core
|
|
75
|
+
- numpydantic
|
|
76
|
+
- pydantic >= 2.11
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install graphatoms
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
For development setup with pixi:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pixi install
|
|
90
|
+
pixi run test
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
GPL-3.0-or-later
|
|
96
|
+
|
|
97
|
+
## Authors
|
|
98
|
+
|
|
99
|
+
- LiuGaoyong (liugaoyong_88@163.com)
|
|
100
|
+
|
|
101
|
+
## Links
|
|
102
|
+
|
|
103
|
+
- Homepage: https://github.com/LiuGaoyong/GraphAtoms
|
|
104
|
+
- Repository: https://github.com/LiuGaoyong/GraphAtoms
|
|
105
|
+
- Issues: https://github.com/LiuGaoyong/GraphAtoms/issues/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# graphatoms
|
|
2
|
+
|
|
3
|
+
[](https://anaconda.org/conda-forge/graphatoms) [](https://anaconda.org/conda-forge/graphatoms) [](https://pypi.org/project/graphatoms/) [](https://pepy.tech/projects/graphatoms)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
The Chemical Core Class for Graph Theory Analysis & Graph Neural Network.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The `graphatoms` is a Python library designed for chemical graph theory analysis and graph neural network applications. It provides core classes for representing chemical systems and reactions with graph-based data structures.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Graph-based Chemical System Representation**: Represent chemical systems, clusters, and gas molecules using graph theory
|
|
15
|
+
- **Reaction Modeling**: Support for reaction classes, KMC (Kinetic Monte Carlo) events, and MC (Monte Carlo) moves
|
|
16
|
+
- **Geometry Operations**: Bond lists, distance calculations, neighbor lists, rotations, and sampling
|
|
17
|
+
- **Data Storage**: Support for HDF5 and SQLite databases for efficient data persistence
|
|
18
|
+
- **Dataclasses**: Pydantic-based data models for type-safe data handling
|
|
19
|
+
|
|
20
|
+
## Module Structure
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
src/graphatoms/
|
|
24
|
+
├── dataclasses/ # Pydantic-based data models
|
|
25
|
+
├── geometry/ # Geometric operations
|
|
26
|
+
├── reaction/ # Reaction classes and KMC events
|
|
27
|
+
├── system/ # Core system classes (System, Cluster, Gas)
|
|
28
|
+
└── utils/ # Utility functions
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
|
|
33
|
+
- Python >= 3.10
|
|
34
|
+
- ase
|
|
35
|
+
- pymatgen > 2023.6
|
|
36
|
+
- rdkit >= 2025
|
|
37
|
+
- scikit-learn >= 1.5
|
|
38
|
+
- pyarrow
|
|
39
|
+
- igraph >= 0.11
|
|
40
|
+
- h5py >= 3.16
|
|
41
|
+
- hydra-core
|
|
42
|
+
- numpydantic
|
|
43
|
+
- pydantic >= 2.11
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install graphatoms
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
For development setup with pixi:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pixi install
|
|
57
|
+
pixi run test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
GPL-3.0-or-later
|
|
63
|
+
|
|
64
|
+
## Authors
|
|
65
|
+
|
|
66
|
+
- LiuGaoyong (liugaoyong_88@163.com)
|
|
67
|
+
|
|
68
|
+
## Links
|
|
69
|
+
|
|
70
|
+
- Homepage: https://github.com/LiuGaoyong/GraphAtoms
|
|
71
|
+
- Repository: https://github.com/LiuGaoyong/GraphAtoms
|
|
72
|
+
- Issues: https://github.com/LiuGaoyong/GraphAtoms/issues/
|
|
@@ -9,13 +9,13 @@ Issues = "https://github.com/LiuGaoyong/GraphAtoms/issues/"
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "graphatoms"
|
|
12
|
-
version = "1.1.
|
|
12
|
+
version = "1.1.3"
|
|
13
13
|
readme = "README.md"
|
|
14
14
|
description = "The Chemical Core Class for Graph Theory Analysis."
|
|
15
15
|
authors = [{ name = "LiuGaoyong", email = "liugaoyong_88@163.com" }]
|
|
16
16
|
license-files = ["src/LICENSE"]
|
|
17
17
|
license = "GPL-3.0-or-later"
|
|
18
|
-
requires-python = ">=3.
|
|
18
|
+
requires-python = ">=3.12"
|
|
19
19
|
keywords = [
|
|
20
20
|
"chemistry", #
|
|
21
21
|
"graph theory",
|
|
@@ -138,7 +138,7 @@ class RTGP(OurFrozenModel, MoveABC):
|
|
|
138
138
|
|
|
139
139
|
@override
|
|
140
140
|
def __call__(self, atoms: Atoms, *args, **kwargs) -> Atoms:
|
|
141
|
-
|
|
141
|
+
self.R.__class__.from_ase(atoms, *args, **kwargs)
|
|
142
142
|
raise NotImplementedError()
|
|
143
143
|
|
|
144
144
|
def __reversed__(self) -> Self: # type: ignore
|
|
@@ -164,7 +164,7 @@ class FBDispC(FBDisp):
|
|
|
164
164
|
atoms0: Atoms = self.atoms.__getitem__(nbrs) # type: ignore
|
|
165
165
|
atoms0.calc = self.calc
|
|
166
166
|
atoms0.calc.reset()
|
|
167
|
-
|
|
167
|
+
atoms0.get_potential_energy()
|
|
168
168
|
f0: np.ndarray = atoms0.get_forces()
|
|
169
169
|
f = f0[nbrs == i].ravel()
|
|
170
170
|
assert f.shape == (3,)
|
|
@@ -176,4 +176,3 @@ class FBDispC(FBDisp):
|
|
|
176
176
|
lambda_param=lambda_param,
|
|
177
177
|
)
|
|
178
178
|
displacement[i, :] = disp_i
|
|
179
|
-
how_to_change = f"Disp({i}),ForceBias"
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"""The graph representation of the system."""
|
|
2
|
+
# ruff: noqa: F401
|
|
2
3
|
|
|
3
|
-
from ._bonds import
|
|
4
|
+
from ._bonds import (
|
|
5
|
+
DEFAULT_WH_HASH_DEPTH,
|
|
6
|
+
DEFAULT_WH_HASH_SIZE,
|
|
7
|
+
BondGraph,
|
|
8
|
+
)
|
|
4
9
|
from ._sysGraph import SysGraph
|
|
5
10
|
|
|
6
11
|
__all__ = ["BondGraph", "SysGraph"]
|
|
@@ -136,12 +136,15 @@ class BondGraph(Matter, OurFrozenModel):
|
|
|
136
136
|
|
|
137
137
|
def get_chordless_cycles(
|
|
138
138
|
self,
|
|
139
|
+
batch_nbr_order: int = 3,
|
|
139
140
|
batch: ArrayLike | list[int | bool] | int | None = None,
|
|
140
141
|
max_ncore: Literal[3, 4, 5, 6] = 3,
|
|
141
142
|
) -> np.ndarray:
|
|
142
143
|
"""Got chordless cycles mask array for specific core numbers.
|
|
143
144
|
|
|
144
145
|
Args:
|
|
146
|
+
batch_nbr_order (int, optional): the max number of neighbors
|
|
147
|
+
of a site. Defaults to 3.
|
|
145
148
|
batch (np.ndarray | list[int | bool] | None, optional):
|
|
146
149
|
the batch atoms of calculation. Default to None.
|
|
147
150
|
max_ncore (Literal[3, 4, 5, 6], optional): The maximum
|
|
@@ -150,7 +153,12 @@ class BondGraph(Matter, OurFrozenModel):
|
|
|
150
153
|
Returns:
|
|
151
154
|
np.ndarray: (n_site, n_atoms) boolean matrix
|
|
152
155
|
"""
|
|
153
|
-
return chordless_cycles(
|
|
156
|
+
return chordless_cycles(
|
|
157
|
+
igraph=self.__IGRAPH,
|
|
158
|
+
batch_nbr_order=batch_nbr_order,
|
|
159
|
+
max_ncore=max_ncore,
|
|
160
|
+
batch=batch,
|
|
161
|
+
)
|
|
154
162
|
|
|
155
163
|
def get_match_mode(
|
|
156
164
|
self,
|
|
@@ -390,17 +398,20 @@ class BondGraph(Matter, OurFrozenModel):
|
|
|
390
398
|
|
|
391
399
|
def chordless_cycles(
|
|
392
400
|
igraph: IGraph,
|
|
393
|
-
batch: ArrayLike | list[int | bool] | int | None = None,
|
|
394
401
|
max_ncore: Literal[3, 4, 5, 6] = 3,
|
|
402
|
+
batch: ArrayLike | list[int | bool] | int | None = None,
|
|
403
|
+
batch_nbr_order: int = 3,
|
|
395
404
|
) -> np.ndarray:
|
|
396
405
|
"""Got chordless cycles mask array for specific core numbers.
|
|
397
406
|
|
|
398
407
|
Args:
|
|
399
408
|
igraph (igraph.Graph): The graph to calculate.
|
|
400
|
-
batch (np.ndarray | list[int | bool] | None, optional):
|
|
401
|
-
the batch atoms of calculation. Default to None.
|
|
402
409
|
max_ncore (Literal[3, 4, 5, 6], optional): The maximum
|
|
403
410
|
number of core atoms in a site. Defaults to 3.
|
|
411
|
+
batch (np.ndarray | list[int | bool] | None, optional):
|
|
412
|
+
the batch atoms of calculation. Default to None.
|
|
413
|
+
batch_nbr_order (int, optional): The order of neighborhood.
|
|
414
|
+
Defaults to 3.
|
|
404
415
|
|
|
405
416
|
Returns:
|
|
406
417
|
np.ndarray: (n_site, n_atoms) boolean matrix
|
|
@@ -420,7 +431,7 @@ def chordless_cycles(
|
|
|
420
431
|
f"Invalid max_ncore value: {max_ncore}."
|
|
421
432
|
" Only 3, 4, 5 and 6 are supported here."
|
|
422
433
|
)
|
|
423
|
-
nbr = igraph.neighborhood(batch, order=
|
|
434
|
+
nbr = igraph.neighborhood(batch, order=batch_nbr_order, mindist=0)
|
|
424
435
|
nbr = np.unique(reduce(np.append, nbr))
|
|
425
436
|
g: IGraph = _subgraph_edges(igraph, nbr)
|
|
426
437
|
if not g.is_simple():
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
from ase import Atoms
|
|
6
|
+
|
|
7
|
+
from ..geometry._inner_outer import check_atom_is_inner
|
|
8
|
+
from ..utils.bytestool import hash_string
|
|
9
|
+
from ._graph import SysGraph
|
|
10
|
+
from ._graph._bonds import DEFAULT_WH_HASH_SIZE
|
|
11
|
+
from ._sys import System
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def get_hash_of_atoms(
|
|
15
|
+
atoms: Atoms,
|
|
16
|
+
parse_bonds: Mapping[str, Any] | None = {"method": "raw"},
|
|
17
|
+
**kwargs,
|
|
18
|
+
) -> str:
|
|
19
|
+
"""A helper function for hash calculation for `ase.Atoms`."""
|
|
20
|
+
return SysGraph.from_ase(
|
|
21
|
+
atoms=atoms,
|
|
22
|
+
parse_bonds=parse_bonds,
|
|
23
|
+
**kwargs,
|
|
24
|
+
).hash
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def analysis(atoms: Atoms, bonds_cfg: Mapping[str, Any] = {}) -> System:
|
|
28
|
+
"""A helper function for analysis of `ase.Atoms`."""
|
|
29
|
+
sys = System.from_ase(
|
|
30
|
+
atoms,
|
|
31
|
+
parse_bonds=bonds_cfg.get("parser", {"method": "raw"}),
|
|
32
|
+
parse_bonds_distance=bonds_cfg.get("parse_distance", False),
|
|
33
|
+
parse_bonds_order=bonds_cfg.get("parse_order", False),
|
|
34
|
+
)
|
|
35
|
+
is_inner = [
|
|
36
|
+
check_atom_is_inner(
|
|
37
|
+
i,
|
|
38
|
+
numbers=sys.numbers,
|
|
39
|
+
geometry=sys.positions,
|
|
40
|
+
adjacency_array=sys.MATRIX[i : i + 1, :],
|
|
41
|
+
cell=atoms.cell,
|
|
42
|
+
)
|
|
43
|
+
for i in range(len(atoms))
|
|
44
|
+
]
|
|
45
|
+
is_outer = np.logical_not(is_inner)
|
|
46
|
+
result = sys.from_dict(sys.to_dict(), is_outer=is_outer)
|
|
47
|
+
result.hash # call hash calculation to set hash & hashes
|
|
48
|
+
return result
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def analysis_site(
|
|
52
|
+
sys: System,
|
|
53
|
+
active: np.ndarray | None = None,
|
|
54
|
+
max_ncore: int = 3,
|
|
55
|
+
) -> np.ndarray:
|
|
56
|
+
"""A helper function for analysis of `graphatoms.system.System`."""
|
|
57
|
+
sys.hash # call hash calculation to set hash & hashes
|
|
58
|
+
assert sys.pair is not None, "Please run analysis first on the System."
|
|
59
|
+
assert sys.hashes is not None, "Please run analysis first on the System."
|
|
60
|
+
assert sys.is_outer is not None, "Please run analysis first on the System."
|
|
61
|
+
if active is None:
|
|
62
|
+
active = sys.is_outer
|
|
63
|
+
else:
|
|
64
|
+
active0 = sys.is_outer
|
|
65
|
+
assert active.shape == active0.shape
|
|
66
|
+
active = active & active0
|
|
67
|
+
arange = np.arange(len(sys))
|
|
68
|
+
|
|
69
|
+
result_1 = np.asarray(
|
|
70
|
+
[
|
|
71
|
+
np.isin(arange, [i])
|
|
72
|
+
for i in arange #
|
|
73
|
+
if active[i]
|
|
74
|
+
]
|
|
75
|
+
+ [
|
|
76
|
+
np.isin(arange, [i, j])
|
|
77
|
+
for i, j in sys.pair #
|
|
78
|
+
if active[i] and active[j]
|
|
79
|
+
]
|
|
80
|
+
)
|
|
81
|
+
result_2 = sys.get_chordless_cycles(
|
|
82
|
+
batch_nbr_order=0,
|
|
83
|
+
max_ncore=max_ncore, # type: ignore
|
|
84
|
+
batch=active,
|
|
85
|
+
)
|
|
86
|
+
# result_2 = [
|
|
87
|
+
# site
|
|
88
|
+
# for site in sys.get_chordless_cycles(
|
|
89
|
+
# batch_nbr_order=0,
|
|
90
|
+
# max_ncore=max_ncore, # type: ignore
|
|
91
|
+
# batch=active,
|
|
92
|
+
# )
|
|
93
|
+
# if np.sum(site) == np.sum(active & site)
|
|
94
|
+
# ]
|
|
95
|
+
result = np.vstack([result_1, result_2])
|
|
96
|
+
hashes = [
|
|
97
|
+
hash_string(
|
|
98
|
+
"-".join([sys.hashes[i] for i in range(len(sys)) if site[i]]),
|
|
99
|
+
digest_size=DEFAULT_WH_HASH_SIZE,
|
|
100
|
+
)
|
|
101
|
+
for site in result
|
|
102
|
+
]
|
|
103
|
+
_, idx = np.unique(hashes, return_index=True)
|
|
104
|
+
return result[idx]
|
graphatoms-1.1.2/PKG-INFO
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: graphatoms
|
|
3
|
-
Version: 1.1.2
|
|
4
|
-
Summary: The Chemical Core Class for Graph Theory Analysis.
|
|
5
|
-
Keywords: chemistry,graph theory,reaction,event,KMC
|
|
6
|
-
Author: LiuGaoyong
|
|
7
|
-
Author-email: LiuGaoyong <liugaoyong_88@163.com>
|
|
8
|
-
License-Expression: GPL-3.0-or-later
|
|
9
|
-
License-File: src/LICENSE
|
|
10
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
-
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
12
|
-
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Requires-Dist: ase
|
|
14
|
-
Requires-Dist: pymatgen>2023.6
|
|
15
|
-
Requires-Dist: rdkit>=2025
|
|
16
|
-
Requires-Dist: scikit-learn>=1.5
|
|
17
|
-
Requires-Dist: pyarrow
|
|
18
|
-
Requires-Dist: igraph>=0.11
|
|
19
|
-
Requires-Dist: h5py>=3.16
|
|
20
|
-
Requires-Dist: hydra-core
|
|
21
|
-
Requires-Dist: numpydantic
|
|
22
|
-
Requires-Dist: pydantic>=2.11
|
|
23
|
-
Requires-Dist: python-snappy>=0.7.3
|
|
24
|
-
Requires-Dist: tomli ; python_full_version < '3.11'
|
|
25
|
-
Requires-Dist: tomli-w
|
|
26
|
-
Requires-Dist: typing-extensions
|
|
27
|
-
Requires-Dist: loguru
|
|
28
|
-
Requires-Python: >=3.10
|
|
29
|
-
Project-URL: Homepage, https://github.com/LiuGaoyong/GraphAtoms
|
|
30
|
-
Project-URL: Repository, https://github.com/LiuGaoyong/GraphAtoms
|
|
31
|
-
Project-URL: Issues, https://github.com/LiuGaoyong/GraphAtoms/issues/
|
|
32
|
-
Description-Content-Type: text/markdown
|
|
33
|
-
|
|
34
|
-
# graphatoms
|
|
35
|
-
|
|
36
|
-
The Chemical Core Class for Graph Theory Analysis & Graph Neural Network.
|
graphatoms-1.1.2/README.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from collections.abc import Mapping
|
|
2
|
-
from typing import Any
|
|
3
|
-
|
|
4
|
-
from ase import Atoms
|
|
5
|
-
|
|
6
|
-
from ._graph import SysGraph
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_hash_of_atoms(
|
|
10
|
-
atoms: Atoms,
|
|
11
|
-
parse_bonds: Mapping[str, Any] | None = {"method": "raw"},
|
|
12
|
-
**kwargs,
|
|
13
|
-
) -> str:
|
|
14
|
-
"""A helper function for hash calculation for `ase.Atoms`."""
|
|
15
|
-
return SysGraph.from_ase(
|
|
16
|
-
atoms=atoms,
|
|
17
|
-
parse_bonds=parse_bonds,
|
|
18
|
-
**kwargs,
|
|
19
|
-
).hash
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|