vasp-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.
- vasp_util-0.0.0/LICENSE +201 -0
- vasp_util-0.0.0/PKG-INFO +56 -0
- vasp_util-0.0.0/README.md +28 -0
- vasp_util-0.0.0/pyproject.toml +54 -0
- vasp_util-0.0.0/setup.cfg +4 -0
- vasp_util-0.0.0/src/vasp_util/__init__.py +17 -0
- vasp_util-0.0.0/src/vasp_util/config.py +102 -0
- vasp_util-0.0.0/src/vasp_util/util/__init__.py +22 -0
- vasp_util-0.0.0/src/vasp_util/util/cell_geometry.py +130 -0
- vasp_util-0.0.0/src/vasp_util/util/copy_contcar_to_vasp.py +37 -0
- vasp_util-0.0.0/src/vasp_util/util/copy_vasp_to_poscar.py +40 -0
- vasp_util-0.0.0/src/vasp_util/util/ensure_vasp5_format.py +70 -0
- vasp_util-0.0.0/src/vasp_util/util/make_potcar.py +26 -0
- vasp_util-0.0.0/src/vasp_util/util/poscar2cfg.py +345 -0
- vasp_util-0.0.0/src/vasp_util/util/xdatcar2poscar.py +102 -0
- vasp_util-0.0.0/src/vasp_util/vasp.py +704 -0
- vasp_util-0.0.0/src/vasp_util/vasp_incar.py +394 -0
- vasp_util-0.0.0/src/vasp_util/vasp_kpoints.py +341 -0
- vasp_util-0.0.0/src/vasp_util/vasp_log.py +335 -0
- vasp_util-0.0.0/src/vasp_util/vasp_outcar.py +473 -0
- vasp_util-0.0.0/src/vasp_util/vasp_poscar.py +569 -0
- vasp_util-0.0.0/src/vasp_util/vasp_poscar_analyzer.py +631 -0
- vasp_util-0.0.0/src/vasp_util/vasp_potcar.py +223 -0
- vasp_util-0.0.0/src/vasp_util.egg-info/PKG-INFO +56 -0
- vasp_util-0.0.0/src/vasp_util.egg-info/SOURCES.txt +26 -0
- vasp_util-0.0.0/src/vasp_util.egg-info/dependency_links.txt +1 -0
- vasp_util-0.0.0/src/vasp_util.egg-info/requires.txt +18 -0
- vasp_util-0.0.0/src/vasp_util.egg-info/top_level.txt +1 -0
vasp_util-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
vasp_util-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vasp-util
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: rmc_dft is a Python package for performing Reverse Monte Carlo modeling and ab initio molecular dynamics / relaxation using VASP code.
|
|
5
|
+
Author-email: Kengo NAKADA <kengo.nakada@email.com>, Kentaro Kobayashi <kobayashi@mat.shimane-u.ac.jp>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: xlogger-py
|
|
10
|
+
Requires-Dist: packmol-util
|
|
11
|
+
Requires-Dist: rmc-util
|
|
12
|
+
Requires-Dist: pymatgen
|
|
13
|
+
Requires-Dist: dataclasses
|
|
14
|
+
Requires-Dist: coloredlogs
|
|
15
|
+
Requires-Dist: colorlog
|
|
16
|
+
Requires-Dist: pytest
|
|
17
|
+
Requires-Dist: pytest-asyncio
|
|
18
|
+
Requires-Dist: pyyaml
|
|
19
|
+
Requires-Dist: toml
|
|
20
|
+
Requires-Dist: nest_asyncio
|
|
21
|
+
Requires-Dist: sphinx
|
|
22
|
+
Requires-Dist: myst-parser
|
|
23
|
+
Requires-Dist: sphinx-autobuild
|
|
24
|
+
Requires-Dist: sphinx-rtd-theme
|
|
25
|
+
Requires-Dist: sphinxcontrib-napoleon
|
|
26
|
+
Requires-Dist: linkify-it-py
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# vasp_util
|
|
30
|
+
|
|
31
|
+
[](https://github.com/ohara-lab-su/vasp_util/blob/main/README.md)
|
|
32
|
+
[](https://github.com/ohara-lab-su/vasp_util/blob/main/README.ja.md)
|
|
33
|
+
|
|
34
|
+
Yet another tool for making VASP easier to use, among the countless tools already out there.
|
|
35
|
+
|
|
36
|
+
This library was originally part of the [RMC-DFT](https://github.com/ohara-lab-su/rmc_dft/) package. It brings together VASP-related utilities that were used internally there and makes them available as a standalone library.
|
|
37
|
+
|
|
38
|
+
In many cases, pymatgen or ASE may be more convenient. Still, there are plenty of situations where having my own tools works better for me, so here I am, building another one.
|
|
39
|
+
|
|
40
|
+
## Background
|
|
41
|
+
|
|
42
|
+
Around 2010–2015, I developed [sae](https://github.com/ohara-lab-su/sae), a fairly comprehensive collection of tools for crystal structures, including VASP-related functionality. Much of the VASP know-how I accumulated back then forms the basis of my current tools.
|
|
43
|
+
|
|
44
|
+
However, as I kept adding features, sae grew rather large. Combined with my limited understanding of Python at the time, this led to various design problems.
|
|
45
|
+
|
|
46
|
+
Meanwhile, pymatgen and ASE had become remarkably useful. As a result, sae gradually lost much of its reason for existing and ended up sitting on the shelf for years.
|
|
47
|
+
|
|
48
|
+
Even so, whenever I developed new tools involving VASP, I often found myself wishing I had something like sae—especially when I simply wanted to manipulate structures described in POSCAR files.
|
|
49
|
+
|
|
50
|
+
I worked around this by implementing similar functionality separately in each tool, but that eventually left me with nearly identical code scattered across multiple projects.
|
|
51
|
+
|
|
52
|
+
Redesigning sae from scratch would have been a substantial undertaking. Instead, I started small, creating a minimal set of classes for handling VASP-related operations within RMC-DFT.
|
|
53
|
+
|
|
54
|
+
Those classes have now been extracted into a standalone package, `vasp_util`, so they can be reused more easily in other projects.
|
|
55
|
+
|
|
56
|
+
In the end, this may look much like other libraries already available. Nevertheless, I hope to gradually consolidate the functionality I have repeatedly implemented across my various tools into this package.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# vasp_util
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ohara-lab-su/vasp_util/blob/main/README.md)
|
|
4
|
+
[](https://github.com/ohara-lab-su/vasp_util/blob/main/README.ja.md)
|
|
5
|
+
|
|
6
|
+
Yet another tool for making VASP easier to use, among the countless tools already out there.
|
|
7
|
+
|
|
8
|
+
This library was originally part of the [RMC-DFT](https://github.com/ohara-lab-su/rmc_dft/) package. It brings together VASP-related utilities that were used internally there and makes them available as a standalone library.
|
|
9
|
+
|
|
10
|
+
In many cases, pymatgen or ASE may be more convenient. Still, there are plenty of situations where having my own tools works better for me, so here I am, building another one.
|
|
11
|
+
|
|
12
|
+
## Background
|
|
13
|
+
|
|
14
|
+
Around 2010–2015, I developed [sae](https://github.com/ohara-lab-su/sae), a fairly comprehensive collection of tools for crystal structures, including VASP-related functionality. Much of the VASP know-how I accumulated back then forms the basis of my current tools.
|
|
15
|
+
|
|
16
|
+
However, as I kept adding features, sae grew rather large. Combined with my limited understanding of Python at the time, this led to various design problems.
|
|
17
|
+
|
|
18
|
+
Meanwhile, pymatgen and ASE had become remarkably useful. As a result, sae gradually lost much of its reason for existing and ended up sitting on the shelf for years.
|
|
19
|
+
|
|
20
|
+
Even so, whenever I developed new tools involving VASP, I often found myself wishing I had something like sae—especially when I simply wanted to manipulate structures described in POSCAR files.
|
|
21
|
+
|
|
22
|
+
I worked around this by implementing similar functionality separately in each tool, but that eventually left me with nearly identical code scattered across multiple projects.
|
|
23
|
+
|
|
24
|
+
Redesigning sae from scratch would have been a substantial undertaking. Instead, I started small, creating a minimal set of classes for handling VASP-related operations within RMC-DFT.
|
|
25
|
+
|
|
26
|
+
Those classes have now been extracted into a standalone package, `vasp_util`, so they can be reused more easily in other projects.
|
|
27
|
+
|
|
28
|
+
In the end, this may look much like other libraries already available. Nevertheless, I hope to gradually consolidate the functionality I have repeatedly implemented across my various tools into this package.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=71.0", "coloredlogs"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vasp-util"
|
|
7
|
+
version = "0.0.0"
|
|
8
|
+
|
|
9
|
+
description = "rmc_dft is a Python package for performing Reverse Monte Carlo modeling and ab initio molecular dynamics / relaxation using VASP code."
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Kengo NAKADA", email = "kengo.nakada@email.com" },
|
|
12
|
+
{ name = "Kentaro Kobayashi", email = "kobayashi@mat.shimane-u.ac.jp" }
|
|
13
|
+
]
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
# requires-python = ">=3.8"
|
|
16
|
+
requires-python = ">=3.10"
|
|
17
|
+
dependencies = [
|
|
18
|
+
# my-modules
|
|
19
|
+
#"x_logger",
|
|
20
|
+
"xlogger-py",
|
|
21
|
+
"packmol-util",
|
|
22
|
+
"rmc-util",
|
|
23
|
+
# fnc
|
|
24
|
+
"pymatgen",
|
|
25
|
+
# basic
|
|
26
|
+
"dataclasses",
|
|
27
|
+
"coloredlogs",
|
|
28
|
+
"colorlog",
|
|
29
|
+
"pytest",
|
|
30
|
+
"pytest-asyncio",
|
|
31
|
+
"pyyaml",
|
|
32
|
+
"toml",
|
|
33
|
+
# "grpcio",
|
|
34
|
+
"nest_asyncio",
|
|
35
|
+
# pages
|
|
36
|
+
"sphinx",
|
|
37
|
+
"myst-parser",
|
|
38
|
+
"sphinx-autobuild",
|
|
39
|
+
"sphinx-rtd-theme",
|
|
40
|
+
"sphinxcontrib-napoleon",
|
|
41
|
+
"linkify-it-py"
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[tool.pytest.ini_options]
|
|
45
|
+
pythonpath = ["src"]
|
|
46
|
+
|
|
47
|
+
# ここでpytestのiniと同じようにオプションが書ける
|
|
48
|
+
# 例えばテストマーク、フィルタ、カバレッジなども追記可能
|
|
49
|
+
|
|
50
|
+
[tool.black]
|
|
51
|
+
line-length = 88
|
|
52
|
+
|
|
53
|
+
[tool.isort]
|
|
54
|
+
profile = "black"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
K.NAKADA, kengo.nakada@gmail.com
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from vasp_util.vasp import Vasp
|
|
6
|
+
from vasp_util.vasp_incar import VaspIncar
|
|
7
|
+
from vasp_util.vasp_kpoints import VaspKpoints
|
|
8
|
+
from vasp_util.vasp_potcar import VaspPotcarBuilder
|
|
9
|
+
from vasp_util.vasp_log import VaspLog
|
|
10
|
+
from vasp_util.vasp_outcar import VaspOutcar
|
|
11
|
+
|
|
12
|
+
from vasp_util.vasp_poscar import VaspPoscar
|
|
13
|
+
from vasp_util.vasp_poscar_analyzer import VaspPoscarAnalyzer
|
|
14
|
+
|
|
15
|
+
# from .vasp import Vasp
|
|
16
|
+
# from .collect_result import VaspLog
|
|
17
|
+
# from . import util
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""
|
|
2
|
+
K.NAKADA, kengo.nakada@gmail.com (1st, 3rd varsion)
|
|
3
|
+
K.KOBAYASHI (2nd version)
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, List, Optional, Union, Tuple, Callable, Sequence
|
|
7
|
+
import yaml
|
|
8
|
+
import os
|
|
9
|
+
|
|
10
|
+
from x_logger import XLogger
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Config:
|
|
14
|
+
|
|
15
|
+
# VASP parameter mirror
|
|
16
|
+
vasp_incar_tags: Dict[str, Any] = {}
|
|
17
|
+
vasp_kpoints_mode: Optional[str] = None
|
|
18
|
+
vasp_kpoints_grid: Optional[Tuple[int, int, int]] = None
|
|
19
|
+
vasp_kpoints_shift: Optional[Tuple[int, int, int]] = None
|
|
20
|
+
vasp_kpoints_comment: Optional[str] = None
|
|
21
|
+
|
|
22
|
+
# ------- DFT (VASP) --------
|
|
23
|
+
dft_code: str = "Vasp"
|
|
24
|
+
dft_log_dir: str = "vasp_log"
|
|
25
|
+
vasp_name: str = "aaa" # aaa.vasp
|
|
26
|
+
run_mode: str = "local"
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
# VASP path
|
|
30
|
+
#
|
|
31
|
+
# dft_bin = f"/home/hpc/vasp/bin/vasp-gamma"
|
|
32
|
+
# dft_bin = f"/home/k/Downloads/vasp.6.4.2/bin/vasp_gam"
|
|
33
|
+
# dft_bin = "/home/hpc/vasp/bin/vasp"
|
|
34
|
+
dft_bin: Optional[str] = f"vasp_gam"
|
|
35
|
+
|
|
36
|
+
num_procs: Optional[int] = 1
|
|
37
|
+
|
|
38
|
+
mpi_cmd: Optional[str] = "mpirun"
|
|
39
|
+
# mpi = f"mpirun -np {num_procs} {os.path.expanduser('/home/hpc/vasp/bin/vasp')}"
|
|
40
|
+
|
|
41
|
+
mpi_flag: Optional[str] = "-np"
|
|
42
|
+
|
|
43
|
+
dft_omp_num_threads: Optional[int] = None
|
|
44
|
+
|
|
45
|
+
# default job_name
|
|
46
|
+
job_cmd: Optional[str] = "qsub job_hpcs2024_node2.sh"
|
|
47
|
+
|
|
48
|
+
# 自動セーブ
|
|
49
|
+
auto_write: bool = True
|
|
50
|
+
|
|
51
|
+
def __init__(
|
|
52
|
+
self,
|
|
53
|
+
yaml_path: Optional[str] = None,
|
|
54
|
+
*,
|
|
55
|
+
logger: Optional[XLogger] = XLogger(),
|
|
56
|
+
):
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
yaml_path (str):
|
|
61
|
+
logger (XLogger):
|
|
62
|
+
"""
|
|
63
|
+
self._logger = logger
|
|
64
|
+
|
|
65
|
+
# インスタンスで使いたいときだけ、ここで個別設定
|
|
66
|
+
if yaml_path:
|
|
67
|
+
self._load_yaml(yaml_path)
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def load_yaml(cls, yaml_path=None):
|
|
71
|
+
if yaml_path is None:
|
|
72
|
+
yaml_path = os.environ.get("RMC_DFT_CONFIG_YAML")
|
|
73
|
+
if yaml_path is None:
|
|
74
|
+
return
|
|
75
|
+
# with open(yaml_path, "r") as f:
|
|
76
|
+
with open(yaml_path, "r", encoding="utf-8") as f:
|
|
77
|
+
data = yaml.safe_load(f)
|
|
78
|
+
for k, v in data.items():
|
|
79
|
+
if hasattr(cls, k):
|
|
80
|
+
setattr(cls, k, v)
|
|
81
|
+
else:
|
|
82
|
+
print("NO SUCH VAR:", k)
|
|
83
|
+
|
|
84
|
+
def _load_yaml(self, yaml_path=None):
|
|
85
|
+
# インスタンス用:インスタンスdictにのみ上書き
|
|
86
|
+
self._logger.info(f"load_yaml: {yaml_path}")
|
|
87
|
+
if yaml_path is None:
|
|
88
|
+
yaml_path = os.environ.get("RMC_DFT_CONFIG_YAML")
|
|
89
|
+
if yaml_path is None:
|
|
90
|
+
return
|
|
91
|
+
yaml_path = os.path.abspath(yaml_path)
|
|
92
|
+
self._logger.info(f"abspath: {yaml_path}")
|
|
93
|
+
with open(yaml_path, "r") as f:
|
|
94
|
+
data = yaml.safe_load(f)
|
|
95
|
+
for k, v in data.items():
|
|
96
|
+
setattr(self, k, v)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
config = Config("config.yml")
|
|
101
|
+
print(config.num_procs)
|
|
102
|
+
print(type(config.num_procs))
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from rmc_dft.vasp.util.poscar2cfg import (
|
|
2
|
+
vasp2cfg,
|
|
3
|
+
poscar2cfg,
|
|
4
|
+
contcar2cfg,
|
|
5
|
+
convert_to_cfg,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
from rmc_dft.vasp.util.cell_geometry import (
|
|
9
|
+
_lattice,
|
|
10
|
+
cell_volume,
|
|
11
|
+
cartesian_to_direct,
|
|
12
|
+
wrap_direct,
|
|
13
|
+
wrap_cartesian,
|
|
14
|
+
minimum_image_vector,
|
|
15
|
+
periodic_distance,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from rmc_dft.vasp.util.copy_contcar_to_vasp import copy_contcar_to_vasp
|
|
19
|
+
from rmc_dft.vasp.util.copy_vasp_to_poscar import copy_vasp_to_poscar
|
|
20
|
+
from rmc_dft.vasp.util.ensure_vasp5_format import ensure_vasp5_format
|
|
21
|
+
from rmc_dft.vasp.util.xdatcar2poscar import xdatcar2poscar
|
|
22
|
+
from rmc_dft.vasp.util.make_potcar import VaspPotcarBuilder
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""周期結晶セルの汎用幾何操作。格子ベクトルは3x3行列の行に格納する。
|
|
2
|
+
|
|
3
|
+
POSCARの読み込みは既存の rmc_dft.vasp.vasp_poscar.VaspPoscar を使用する。
|
|
4
|
+
本モジュールはファイル入出力やRMC/ænet固有の構造生成を行わない。
|
|
5
|
+
最短画像は整数格子シフトを列挙して直交座標ノルムで判定する。
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from itertools import product
|
|
9
|
+
from typing import List, Dict, Optional, Tuple
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _lattice(
|
|
14
|
+
cell: np.ndarray,
|
|
15
|
+
) -> np.ndarray:
|
|
16
|
+
"""格子行列を検査し、float64の3x3行列として返す。"""
|
|
17
|
+
lattice = np.asarray(cell, dtype=float)
|
|
18
|
+
if lattice.shape != (3, 3):
|
|
19
|
+
raise ValueError("cell must be a 3x3 matrix")
|
|
20
|
+
if abs(float(np.linalg.det(lattice))) < 1.0e-12:
|
|
21
|
+
raise ValueError("cell is singular")
|
|
22
|
+
return lattice
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def cell_volume(
|
|
26
|
+
cell: np.ndarray,
|
|
27
|
+
) -> float:
|
|
28
|
+
"""周期セルの体積を返す(格子がÅならų)。"""
|
|
29
|
+
return abs(float(np.linalg.det(_lattice(cell))))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def direct_to_cartesian(
|
|
33
|
+
coords: np.ndarray,
|
|
34
|
+
cell: np.ndarray,
|
|
35
|
+
) -> np.ndarray:
|
|
36
|
+
"""分率座標 (...,3) を直交座標へ変換する。"""
|
|
37
|
+
return np.asarray(coords, dtype=float) @ _lattice(cell)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def cartesian_to_direct(
|
|
41
|
+
coords: np.ndarray,
|
|
42
|
+
cell: np.ndarray,
|
|
43
|
+
) -> np.ndarray:
|
|
44
|
+
"""直交座標 (...,3) を分率座標へ変換する。"""
|
|
45
|
+
return np.asarray(coords, dtype=float) @ np.linalg.inv(_lattice(cell))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def wrap_direct(
|
|
49
|
+
coords: np.ndarray,
|
|
50
|
+
) -> np.ndarray:
|
|
51
|
+
"""分率座標を [0,1) に折り返す。入力は変更しない。"""
|
|
52
|
+
return np.mod(np.asarray(coords, dtype=float), 1.0)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def wrap_cartesian(
|
|
56
|
+
coords: np.ndarray,
|
|
57
|
+
cell: np.ndarray,
|
|
58
|
+
) -> np.ndarray:
|
|
59
|
+
"""直交座標を周期セル内に折り返す。"""
|
|
60
|
+
return direct_to_cartesian(wrap_direct(cartesian_to_direct(coords, cell)), cell)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def minimum_image_vector(
|
|
64
|
+
a: np.ndarray,
|
|
65
|
+
b: np.ndarray,
|
|
66
|
+
cell: np.ndarray,
|
|
67
|
+
search_radius: int = 1,
|
|
68
|
+
) -> np.ndarray:
|
|
69
|
+
"""aからbへの最短周期変位(直交座標、Å)を返す。
|
|
70
|
+
|
|
71
|
+
分率差を最近整数で中心化した後、[-search_radius,+search_radius]^3
|
|
72
|
+
の画像を探索する。強く歪んだセルでは探索範囲の拡大が必要。
|
|
73
|
+
"""
|
|
74
|
+
if search_radius < 0:
|
|
75
|
+
raise ValueError("search_radius must be nonnegative")
|
|
76
|
+
lattice = _lattice(cell)
|
|
77
|
+
delta = cartesian_to_direct(
|
|
78
|
+
np.asarray(b, dtype=float) - np.asarray(a, dtype=float), lattice
|
|
79
|
+
)
|
|
80
|
+
if delta.shape != (3,):
|
|
81
|
+
raise ValueError("a and b must be 3-vectors")
|
|
82
|
+
delta = delta - np.round(delta)
|
|
83
|
+
best = None
|
|
84
|
+
best_squared = float("inf")
|
|
85
|
+
for shift in product(range(-search_radius, search_radius + 1), repeat=3):
|
|
86
|
+
vec = (delta + np.asarray(shift, dtype=float)) @ lattice
|
|
87
|
+
squared = float(vec @ vec)
|
|
88
|
+
if squared < best_squared:
|
|
89
|
+
best = vec
|
|
90
|
+
best_squared = squared
|
|
91
|
+
if best is None:
|
|
92
|
+
raise RuntimeError("周期画像の探索に失敗しました")
|
|
93
|
+
return best
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def periodic_distance(
|
|
97
|
+
a: np.ndarray,
|
|
98
|
+
b: np.ndarray,
|
|
99
|
+
cell: np.ndarray,
|
|
100
|
+
search_radius: int = 1,
|
|
101
|
+
) -> float:
|
|
102
|
+
"""2点の周期最短距離(Å)。"""
|
|
103
|
+
return float(np.linalg.norm(minimum_image_vector(a, b, cell, search_radius)))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def check_pair_distances(
|
|
107
|
+
symbols: List[str],
|
|
108
|
+
positions: np.ndarray,
|
|
109
|
+
cell: np.ndarray,
|
|
110
|
+
minimums: Dict[str, float],
|
|
111
|
+
fallback: Optional[float] = None,
|
|
112
|
+
) -> Tuple[bool, float]:
|
|
113
|
+
"""周期距離に基づき、全原子対の下限距離を検証する。"""
|
|
114
|
+
shortest = float("inf")
|
|
115
|
+
for i in range(len(symbols)):
|
|
116
|
+
for j in range(i + 1, len(symbols)):
|
|
117
|
+
key = "-".join(sorted((symbols[i], symbols[j])))
|
|
118
|
+
if key in minimums:
|
|
119
|
+
threshold = minimums[key]
|
|
120
|
+
elif fallback is not None:
|
|
121
|
+
threshold = fallback
|
|
122
|
+
else:
|
|
123
|
+
raise ValueError(f"距離閾値が未設定です: {key}")
|
|
124
|
+
distance = periodic_distance(positions[i], positions[j], cell)
|
|
125
|
+
shortest = min(shortest, distance)
|
|
126
|
+
if not np.isfinite(distance):
|
|
127
|
+
return False, shortest
|
|
128
|
+
if distance < threshold:
|
|
129
|
+
return False, shortest
|
|
130
|
+
return True, shortest
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
K.NAKADA, kengo.nakada@gmail.com
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, List, Optional, Union, Tuple, Callable, Sequence
|
|
7
|
+
|
|
8
|
+
import shutil
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from x_logger import XLogger
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def copy_contcar_to_vasp(
|
|
14
|
+
vasp_name: str,
|
|
15
|
+
logger: Optional[XLogger] = XLogger(),
|
|
16
|
+
) -> bool:
|
|
17
|
+
"""
|
|
18
|
+
CONTCAR ファイルを {name}.vasp にコピーする
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
vasp_name (str): 出力ファイル名(拡張子なし)
|
|
22
|
+
logger (XLogger):
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
bool:
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
src = Path("CONTCAR")
|
|
29
|
+
dst = Path(f"{vasp_name}.vasp")
|
|
30
|
+
|
|
31
|
+
if not src.exists():
|
|
32
|
+
logger.error("Error: CONTCAR ファイルが見つかりません。")
|
|
33
|
+
return False
|
|
34
|
+
|
|
35
|
+
shutil.copyfile(src, dst)
|
|
36
|
+
logger.info(f"{src} --> {dst} にコピーしました")
|
|
37
|
+
return True
|