qn-util 0.0.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.
- qn_util-0.0.0/PKG-INFO +88 -0
- qn_util-0.0.0/README.md +63 -0
- qn_util-0.0.0/pyproject.toml +52 -0
- qn_util-0.0.0/setup.cfg +4 -0
- qn_util-0.0.0/src/qn_util/__init__.py +11 -0
- qn_util-0.0.0/src/qn_util/config_error.py +11 -0
- qn_util-0.0.0/src/qn_util/install.py +49 -0
- qn_util-0.0.0/src/qn_util/qn_network_analysis.py +1215 -0
- qn_util-0.0.0/src/qn_util/qn_network_builder.py +100 -0
- qn_util-0.0.0/src/qn_util/rmc_constraint_writer.py +695 -0
- qn_util-0.0.0/src/qn_util/vasp_structure.py +163 -0
- qn_util-0.0.0/src/qn_util.egg-info/PKG-INFO +88 -0
- qn_util-0.0.0/src/qn_util.egg-info/SOURCES.txt +14 -0
- qn_util-0.0.0/src/qn_util.egg-info/dependency_links.txt +1 -0
- qn_util-0.0.0/src/qn_util.egg-info/requires.txt +17 -0
- qn_util-0.0.0/src/qn_util.egg-info/top_level.txt +1 -0
qn_util-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qn-util
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Qn network Tools
|
|
5
|
+
Author-email: Kengo NAKADA <kengo.nakada@email.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: xlogger-py
|
|
9
|
+
Requires-Dist: packmol-util
|
|
10
|
+
Requires-Dist: pymatgen
|
|
11
|
+
Requires-Dist: dataclasses
|
|
12
|
+
Requires-Dist: coloredlogs
|
|
13
|
+
Requires-Dist: colorlog
|
|
14
|
+
Requires-Dist: pytest
|
|
15
|
+
Requires-Dist: pytest-asyncio
|
|
16
|
+
Requires-Dist: pyyaml
|
|
17
|
+
Requires-Dist: toml
|
|
18
|
+
Requires-Dist: nest_asyncio
|
|
19
|
+
Requires-Dist: sphinx
|
|
20
|
+
Requires-Dist: myst-parser
|
|
21
|
+
Requires-Dist: sphinx-autobuild
|
|
22
|
+
Requires-Dist: sphinx-rtd-theme
|
|
23
|
+
Requires-Dist: sphinxcontrib-napoleon
|
|
24
|
+
Requires-Dist: linkify-it-py
|
|
25
|
+
|
|
26
|
+
# Qn-Util — Qn Network Analysis and RMC Constraint Generation
|
|
27
|
+
|
|
28
|
+
[](https://github.com/ohara-lab-su/qn_util/blob/main/README.md)
|
|
29
|
+
[](https://github.com/ohara-lab-su/qn_util/blob/main/README.ja.md)
|
|
30
|
+
|
|
31
|
+
[](https://github.com/ohara-lab-su/qn_util/)
|
|
32
|
+
[](https://ohara-lab-su.github.io/qn_util/ja/)
|
|
33
|
+
[](https://ohara-lab-su.github.io/index.ja.html)
|
|
34
|
+
|
|
35
|
+
Qn-Util is a Python library for constructing and analyzing Qn networks and generating constraint files for RMC_POT, using VASP POSCAR/CONTCAR structures and JSON configuration files as input. It outputs Qn distributions, network connectivity information, and analysis reports.
|
|
36
|
+
|
|
37
|
+
The library is primarily intended for generating RMC_POT constraint files and is used for research and study purposes.
|
|
38
|
+
|
|
39
|
+
## Main Components
|
|
40
|
+
|
|
41
|
+
- `VaspStructure`: Reads POSCAR files and calculates distances and angles under periodic boundary conditions.
|
|
42
|
+
- `QnNetworkAnalysis`: Builds networks from JSON configurations, counts Qn species, and outputs connectivity information and analysis results.
|
|
43
|
+
- `RmcConstraintWriter`: Generates FNC=3 constraint files, unit definitions, and network topology files for RMC_POT.
|
|
44
|
+
- `QnNetworkBuilder`: A facade that preserves existing calling conventions and provides combined access to analysis and output functions.
|
|
45
|
+
- `ConfigError`: An exception for configuration and input validation errors.
|
|
46
|
+
|
|
47
|
+
## Input and Output
|
|
48
|
+
|
|
49
|
+
Inputs are structural files in POSCAR/CONTCAR format and JSON configuration files. Outputs include `*_qn.csv`, `*_network_bonds.csv`, `*_report.txt`, `*_rmc_fnc3.fnc`, and `*_rmc_unit.top`. See the tutorials for required configuration parameters and the meaning of the constraints.
|
|
50
|
+
|
|
51
|
+
## Python API Example
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from qn_util.qn_network_builder import QnNetworkBuilder
|
|
55
|
+
|
|
56
|
+
builder = QnNetworkBuilder.from_poscar("POSCAR", "qn_config.json")
|
|
57
|
+
print(builder.get_qn_counts())
|
|
58
|
+
builder.write_analysis("sample")
|
|
59
|
+
builder.write_all("sample")
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`write_all` generates analysis results and RMC input files. See `scripts/` for concrete configuration examples.
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install qn-util
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Installing Example Scripts
|
|
71
|
+
|
|
72
|
+
After installing the package, run the following command in your working directory to copy the files bundled under `scripts/` (Python scripts and `qn_config.json`) into the current directory.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
qn_util install
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If files with the same names already exist, the command exits with an error without overwriting them. Specify `--force` only when you want to overwrite existing files.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
qn_util install --force
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Documentation
|
|
85
|
+
|
|
86
|
+
The tutorials cover Qn networks, FNC, topology, JSON configuration, and future development. The API Reference is generated from source docstrings.
|
|
87
|
+
|
|
88
|
+
[日本語](https://ohara-lab-su.github.io/qn_util/ja/) / [English](https://ohara-lab-su.github.io/qn_util/en/)
|
qn_util-0.0.0/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Qn-Util — Qn Network Analysis and RMC Constraint Generation
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ohara-lab-su/qn_util/blob/main/README.md)
|
|
4
|
+
[](https://github.com/ohara-lab-su/qn_util/blob/main/README.ja.md)
|
|
5
|
+
|
|
6
|
+
[](https://github.com/ohara-lab-su/qn_util/)
|
|
7
|
+
[](https://ohara-lab-su.github.io/qn_util/ja/)
|
|
8
|
+
[](https://ohara-lab-su.github.io/index.ja.html)
|
|
9
|
+
|
|
10
|
+
Qn-Util is a Python library for constructing and analyzing Qn networks and generating constraint files for RMC_POT, using VASP POSCAR/CONTCAR structures and JSON configuration files as input. It outputs Qn distributions, network connectivity information, and analysis reports.
|
|
11
|
+
|
|
12
|
+
The library is primarily intended for generating RMC_POT constraint files and is used for research and study purposes.
|
|
13
|
+
|
|
14
|
+
## Main Components
|
|
15
|
+
|
|
16
|
+
- `VaspStructure`: Reads POSCAR files and calculates distances and angles under periodic boundary conditions.
|
|
17
|
+
- `QnNetworkAnalysis`: Builds networks from JSON configurations, counts Qn species, and outputs connectivity information and analysis results.
|
|
18
|
+
- `RmcConstraintWriter`: Generates FNC=3 constraint files, unit definitions, and network topology files for RMC_POT.
|
|
19
|
+
- `QnNetworkBuilder`: A facade that preserves existing calling conventions and provides combined access to analysis and output functions.
|
|
20
|
+
- `ConfigError`: An exception for configuration and input validation errors.
|
|
21
|
+
|
|
22
|
+
## Input and Output
|
|
23
|
+
|
|
24
|
+
Inputs are structural files in POSCAR/CONTCAR format and JSON configuration files. Outputs include `*_qn.csv`, `*_network_bonds.csv`, `*_report.txt`, `*_rmc_fnc3.fnc`, and `*_rmc_unit.top`. See the tutorials for required configuration parameters and the meaning of the constraints.
|
|
25
|
+
|
|
26
|
+
## Python API Example
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from qn_util.qn_network_builder import QnNetworkBuilder
|
|
30
|
+
|
|
31
|
+
builder = QnNetworkBuilder.from_poscar("POSCAR", "qn_config.json")
|
|
32
|
+
print(builder.get_qn_counts())
|
|
33
|
+
builder.write_analysis("sample")
|
|
34
|
+
builder.write_all("sample")
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`write_all` generates analysis results and RMC input files. See `scripts/` for concrete configuration examples.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install qn-util
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Installing Example Scripts
|
|
46
|
+
|
|
47
|
+
After installing the package, run the following command in your working directory to copy the files bundled under `scripts/` (Python scripts and `qn_config.json`) into the current directory.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
qn_util install
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If files with the same names already exist, the command exits with an error without overwriting them. Specify `--force` only when you want to overwrite existing files.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
qn_util install --force
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
The tutorials cover Qn networks, FNC, topology, JSON configuration, and future development. The API Reference is generated from source docstrings.
|
|
62
|
+
|
|
63
|
+
[日本語](https://ohara-lab-su.github.io/qn_util/ja/) / [English](https://ohara-lab-su.github.io/qn_util/en/)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=71.0","coloredlogs"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "qn-util"
|
|
7
|
+
version = "0.0.0"
|
|
8
|
+
|
|
9
|
+
description = "Qn network Tools"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name="Kengo NAKADA", email="kengo.nakada@email.com" },
|
|
12
|
+
]
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
# requires-python = ">=3.8"
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
dependencies = [
|
|
17
|
+
# my-modules
|
|
18
|
+
# "x_logger",
|
|
19
|
+
"xlogger-py",
|
|
20
|
+
"packmol-util" ,
|
|
21
|
+
# fnc
|
|
22
|
+
"pymatgen",
|
|
23
|
+
# basic
|
|
24
|
+
"dataclasses",
|
|
25
|
+
"coloredlogs",
|
|
26
|
+
"colorlog",
|
|
27
|
+
"pytest",
|
|
28
|
+
"pytest-asyncio",
|
|
29
|
+
"pyyaml",
|
|
30
|
+
"toml",
|
|
31
|
+
# "grpcio",
|
|
32
|
+
"nest_asyncio",
|
|
33
|
+
# pages
|
|
34
|
+
"sphinx",
|
|
35
|
+
"myst-parser",
|
|
36
|
+
"sphinx-autobuild",
|
|
37
|
+
"sphinx-rtd-theme",
|
|
38
|
+
"sphinxcontrib-napoleon",
|
|
39
|
+
"linkify-it-py"
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[tool.pytest.ini_options]
|
|
43
|
+
pythonpath = ["src"]
|
|
44
|
+
|
|
45
|
+
# ここでpytestのiniと同じようにオプションが書ける
|
|
46
|
+
# 例えばテストマーク、フィルタ、カバレッジなども追記可能
|
|
47
|
+
|
|
48
|
+
[tool.black]
|
|
49
|
+
line-length = 88
|
|
50
|
+
|
|
51
|
+
[tool.isort]
|
|
52
|
+
profile = "black"
|
qn_util-0.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# from rmc_dft.rmc_pot.qn.config_error import ConfigError
|
|
2
|
+
# from rmc_dft.rmc_pot.qn.qn_network_analysis import QnNetworkAnalysis
|
|
3
|
+
# from rmc_dft.rmc_pot.qn.qn_network_builder import QnNetworkBuilder
|
|
4
|
+
# from rmc_dft.rmc_pot.qn.rmc_constraint_writer import RmcConstraintWriter
|
|
5
|
+
# from rmc_dft.rmc_pot.qn.vasp_structure import VaspStructure
|
|
6
|
+
|
|
7
|
+
from qn.config_error import ConfigError
|
|
8
|
+
from qn.qn_network_analysis import QnNetworkAnalysis
|
|
9
|
+
from qn.qn_network_builder import QnNetworkBuilder
|
|
10
|
+
from qn.rmc_constraint_writer import RmcConstraintWriter
|
|
11
|
+
from qn.vasp_structure import VaspStructure
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""qn_util に付属するサンプルスクリプトを作業ディレクトリへ配置する。"""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import shutil
|
|
5
|
+
from importlib.resources import files
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def install(force: bool = False, destination: Path | None = None) -> list[Path]:
|
|
10
|
+
"""同梱 scripts の全ファイルを指定先(既定はカレント)へコピーする。"""
|
|
11
|
+
target = Path.cwd() if destination is None else Path(destination)
|
|
12
|
+
source = files("qn_util").joinpath("scripts")
|
|
13
|
+
if not source.is_dir():
|
|
14
|
+
raise FileNotFoundError("パッケージ内に scripts がありません。配布設定を確認してください。")
|
|
15
|
+
items = list(source.iterdir())
|
|
16
|
+
conflicts = [target / item.name for item in items if (target / item.name).exists()]
|
|
17
|
+
if conflicts and not force:
|
|
18
|
+
names = ", ".join(str(x) for x in conflicts)
|
|
19
|
+
raise FileExistsError(f"同名ファイルが存在します: {names}(上書きには --force を指定)")
|
|
20
|
+
copied = []
|
|
21
|
+
for item in items:
|
|
22
|
+
dst = target / item.name
|
|
23
|
+
if item.is_dir():
|
|
24
|
+
shutil.copytree(str(item), dst, dirs_exist_ok=force)
|
|
25
|
+
else:
|
|
26
|
+
with item.open("rb") as src, dst.open("wb") as out:
|
|
27
|
+
shutil.copyfileobj(src, out)
|
|
28
|
+
copied.append(dst)
|
|
29
|
+
return copied
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def main() -> None:
|
|
33
|
+
"""qn_util コマンドのエントリーポイント。"""
|
|
34
|
+
parser = argparse.ArgumentParser(prog="qn_util")
|
|
35
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
36
|
+
cmd = sub.add_parser("install", help="付属スクリプトをカレントディレクトリへコピー")
|
|
37
|
+
cmd.add_argument("--force", action="store_true", help="同名ファイルを上書き")
|
|
38
|
+
args = parser.parse_args()
|
|
39
|
+
if args.command == "install":
|
|
40
|
+
try:
|
|
41
|
+
copied = install(force=args.force)
|
|
42
|
+
except (FileExistsError, FileNotFoundError) as exc:
|
|
43
|
+
parser.exit(1, f"エラー: {exc}\n")
|
|
44
|
+
for path in copied:
|
|
45
|
+
print(f"コピー: {path}")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
main()
|