mdkits 0.1.8__tar.gz → 0.1.10__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.
Potentially problematic release.
This version of mdkits might be problematic. Click here for more details.
- {mdkits-0.1.8 → mdkits-0.1.10}/PKG-INFO +1 -2
- {mdkits-0.1.8 → mdkits-0.1.10}/pyproject.toml +1 -2
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/build_cli/build_bulk.py +4 -2
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/build_cli/build_cli.py +6 -0
- mdkits-0.1.10/src/mdkits/build_cli/build_interface.py +74 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/build_cli/build_solution.py +5 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/build_cli/build_surface.py +5 -1
- mdkits-0.1.10/src/mdkits/build_cli/cut_surface.py +78 -0
- mdkits-0.1.10/src/mdkits/build_cli/supercell.py +41 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/arg_type.py +1 -1
- mdkits-0.1.10/src/mdkits/util/out_err.py +22 -0
- mdkits-0.1.8/src/mdkits/build_cli/build_interface.py +0 -86
- mdkits-0.1.8/src/mdkits/build_cli/cut_surface.py +0 -38
- mdkits-0.1.8/src/mdkits/cli/supercell.py +0 -72
- mdkits-0.1.8/src/mdkits/util/out_err.py +0 -17
- {mdkits-0.1.8 → mdkits-0.1.10}/LICENSE +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/README.md +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/__init__.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/build_cli/__init__.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/build_cli/adsorbate.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/build_cli/water.xyz +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/,hb_distribution_down.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/convert.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/cube.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/data.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/density.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/extract.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/hartree_potential.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/hartree_potential_ave.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/hb.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/hb_distribution.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/packmol_input.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/pdos.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/plot.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/cli/wrap.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/config/__init__.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/config/settings.yml +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/mdkits.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/__init__.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/cp2k_input_parsing.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/encapsulated_ase.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/encapsulated_mda.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/fig_operation.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/numpy_geo.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/os_operation.py +0 -0
- {mdkits-0.1.8 → mdkits-0.1.10}/src/mdkits/util/structure_parsing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: mdkits
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Summary: kits for md or dft
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: molecular dynamics,density functional theory
|
|
@@ -17,7 +17,6 @@ Requires-Dist: Cp2kData (>=0.7.2,<0.8.0)
|
|
|
17
17
|
Requires-Dist: MDAnalysis (>=2.8.0,<3.0.0)
|
|
18
18
|
Requires-Dist: ase (>=3.22.1,<4.0.0)
|
|
19
19
|
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
20
|
-
Requires-Dist: dynaconf (>=3.1.12,<4.0.0)
|
|
21
20
|
Requires-Dist: julia (>=0.6.2,<0.7.0)
|
|
22
21
|
Requires-Dist: matplotlib (>=3.9.0,<4.0.0)
|
|
23
22
|
Requires-Dist: numpy (>=1.26.4,<2.0.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "mdkits"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.10"
|
|
4
4
|
description = "kits for md or dft"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = ["jxxcr <jixxcr@qq.com>"]
|
|
@@ -14,7 +14,6 @@ repository = "https://github.com/jxxcr/mdkits"
|
|
|
14
14
|
|
|
15
15
|
[tool.poetry.dependencies]
|
|
16
16
|
python = "^3.11"
|
|
17
|
-
dynaconf = "^3.1.12"
|
|
18
17
|
click = "^8.1.3"
|
|
19
18
|
MDAnalysis = "^2.8.0"
|
|
20
19
|
ase = "^3.22.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
|
|
3
|
-
import click
|
|
3
|
+
import click, os
|
|
4
4
|
from ase.build import bulk
|
|
5
5
|
import numpy as np
|
|
6
6
|
|
|
@@ -27,7 +27,9 @@ def main(symbol, cs, a, b, c, alpha, covera, u, orth, cubic):
|
|
|
27
27
|
# a = args.a
|
|
28
28
|
atoms = bulk(symbol, cs, a=a, b=b, c=c, alpha=alpha, covera=covera, u=u, orthorhombic=orth, cubic=cubic)
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
o = f"{symbol}_{cs}.cif"
|
|
31
|
+
atoms.write(o, format='cif')
|
|
32
|
+
print(os.path.abspath(o))
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
if __name__ == '__main__':
|
|
@@ -9,6 +9,9 @@ from mdkits.build_cli import (
|
|
|
9
9
|
build_surface,
|
|
10
10
|
adsorbate,
|
|
11
11
|
build_solution,
|
|
12
|
+
cut_surface,
|
|
13
|
+
supercell,
|
|
14
|
+
build_interface,
|
|
12
15
|
)
|
|
13
16
|
|
|
14
17
|
|
|
@@ -23,6 +26,9 @@ cli_build.add_command(build_bulk.main)
|
|
|
23
26
|
cli_build.add_command(build_surface.main)
|
|
24
27
|
cli_build.add_command(adsorbate.main)
|
|
25
28
|
cli_build.add_command(build_solution.main)
|
|
29
|
+
cli_build.add_command(cut_surface.main)
|
|
30
|
+
cli_build.add_command(supercell.main)
|
|
31
|
+
cli_build.add_command(build_interface.main)
|
|
26
32
|
|
|
27
33
|
if __name__ == '__main__':
|
|
28
34
|
cli_build()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from mdkits.util import arg_type, out_err
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@click.command(name="interface")
|
|
6
|
+
@click.option('--slab', type=arg_type.Structure, help='surface')
|
|
7
|
+
@click.option('--sol', type=arg_type.Structure, help='solution')
|
|
8
|
+
@click.option('--interval', type=float, help='interval between surface and sol', default=2, show_default=True)
|
|
9
|
+
@click.option('--cap', type=click.Choice(['ne', 'slab']), help='build slab interface')
|
|
10
|
+
@click.option('--vacuum', type=float, help='vacuum length', default=0, show_default=True)
|
|
11
|
+
def main(slab, sol, interval, cap, vacuum):
|
|
12
|
+
"""build interface"""
|
|
13
|
+
out_err.check_cell(slab)
|
|
14
|
+
out_err.check_cell(sol)
|
|
15
|
+
|
|
16
|
+
o = f"{slab.filename.split('.')[-2]}_{sol.filename.split('.')[-2]}.cif"
|
|
17
|
+
|
|
18
|
+
slab.set_pbc(True)
|
|
19
|
+
slab.center()
|
|
20
|
+
slab_cell = slab.cell.cellpar()
|
|
21
|
+
init_slab_cell = slab.cell.cellpar()
|
|
22
|
+
if cap == 'slab':
|
|
23
|
+
slab_copy = slab.copy()
|
|
24
|
+
|
|
25
|
+
sol_cell = sol.cell.cellpar()
|
|
26
|
+
sol.set_pbc(True)
|
|
27
|
+
sol.center()
|
|
28
|
+
sol.positions[:, 2] += slab_cell[2] + interval
|
|
29
|
+
|
|
30
|
+
slab.extend(sol)
|
|
31
|
+
slab_cell[2] += 2 * interval + sol_cell[2]
|
|
32
|
+
slab.set_cell(slab_cell)
|
|
33
|
+
slab.center()
|
|
34
|
+
|
|
35
|
+
if cap is None:
|
|
36
|
+
slab.positions[:, 2] -= 0.5 * init_slab_cell[2]
|
|
37
|
+
elif cap == 'ne':
|
|
38
|
+
from ase import Atoms
|
|
39
|
+
ne_interval = 4
|
|
40
|
+
lenx = init_slab_cell[0]
|
|
41
|
+
leny = init_slab_cell[1]
|
|
42
|
+
ne_cell = [lenx, leny, 2, 90, 90, 90]
|
|
43
|
+
ne_position = []
|
|
44
|
+
ne_symbols = []
|
|
45
|
+
ne_site = [int(lenx//ne_interval), int(leny//ne_interval)]
|
|
46
|
+
for i in range(ne_site[0]):
|
|
47
|
+
for j in range(ne_site[1]):
|
|
48
|
+
ne_position.append((i*ne_interval, j*ne_interval, 0))
|
|
49
|
+
ne_symbols.append('Ne')
|
|
50
|
+
ne_atoms = Atoms(symbols=ne_symbols, positions=ne_position, cell=ne_cell)
|
|
51
|
+
ne_atoms.center()
|
|
52
|
+
|
|
53
|
+
slab.positions[:, 2] += -(slab_cell[2] + interval)
|
|
54
|
+
slab.extend(ne_atoms)
|
|
55
|
+
slab_cell[2] += ne_cell[2]
|
|
56
|
+
slab.set_cell(slab_cell)
|
|
57
|
+
slab.center()
|
|
58
|
+
elif cap == 'slab':
|
|
59
|
+
slab.positions[:, 2] += -(slab_cell[2] + interval)
|
|
60
|
+
slab.extend(slab_copy)
|
|
61
|
+
slab_cell[2] += slab_copy.cell.cellpar()[2]
|
|
62
|
+
slab.set_cell(slab_cell)
|
|
63
|
+
slab.center()
|
|
64
|
+
|
|
65
|
+
if vacuum > 0:
|
|
66
|
+
slab_cell[2] += vacuum
|
|
67
|
+
slab.set_cell(slab_cell)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
slab.write(o)
|
|
71
|
+
out_err.path_output(o)
|
|
72
|
+
|
|
73
|
+
if __name__ == '__main__':
|
|
74
|
+
main()
|
|
@@ -2,6 +2,7 @@ import click, os
|
|
|
2
2
|
from julia import Pkg, Main
|
|
3
3
|
from mdkits.util import arg_type
|
|
4
4
|
from importlib import resources
|
|
5
|
+
from mdkits.cli import convert
|
|
5
6
|
import tempfile
|
|
6
7
|
|
|
7
8
|
|
|
@@ -77,6 +78,10 @@ def main(filename, infile, install, water_number, n, tolerance, cell, gap):
|
|
|
77
78
|
if os.path.exists(temp_file.name):
|
|
78
79
|
os.remove(temp_file.name)
|
|
79
80
|
|
|
81
|
+
print("="*15)
|
|
82
|
+
print(total_input)
|
|
83
|
+
print("="*15)
|
|
84
|
+
convert.main([output_filename, "-c", "--cell", ",".join([str(a) for a in cell])], standalone_mode=False)
|
|
80
85
|
Main.exit()
|
|
81
86
|
|
|
82
87
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import click, os
|
|
4
4
|
from ase import build
|
|
5
5
|
import numpy as np
|
|
6
|
+
from mdkits.util import out_err
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def surface_check(obj, surface_type):
|
|
@@ -19,7 +20,7 @@ def surface_check(obj, surface_type):
|
|
|
19
20
|
@click.option('-c', type=float, help='extra hcp lattice constant. if specified, it overrides the expermental lattice constant of the element. Default is ideal ratio: sqrt(8/3)', default=np.sqrt(8/3), show_default=True)
|
|
20
21
|
@click.option('--thickness', type=float, help='Thickness of the layer, for mx2 and graphene')
|
|
21
22
|
@click.option('--orth', is_flag=True, help='if specified and true, forces the creation of a unit cell with orthogonal basis vectors. if the default is such a unit cell, this argument is not supported')
|
|
22
|
-
@click.option('--vacuum', type=float, help='designate vacuum of surface, default is None', default=0.
|
|
23
|
+
@click.option('--vacuum', type=float, help='designate vacuum of surface, default is None', default=0.1, show_default=True)
|
|
23
24
|
def main(symbol, surface, size, kind, a, c, thickness, orth, vacuum):
|
|
24
25
|
#if args.primitive:
|
|
25
26
|
# a = args.a * 0.7071 * 2
|
|
@@ -29,6 +30,8 @@ def main(symbol, surface, size, kind, a, c, thickness, orth, vacuum):
|
|
|
29
30
|
vacuum = vacuum / 2
|
|
30
31
|
build_surface = surface_check(build, surface)
|
|
31
32
|
out_filename = f"{symbol}_{surface}_{size[0]}{size[1]}{size[2]}.cif"
|
|
33
|
+
if surface in ['fcc100']:
|
|
34
|
+
orth = True
|
|
32
35
|
|
|
33
36
|
if surface in ['hcp0001', 'hcp10m10']:
|
|
34
37
|
atoms = build_surface(symbol, size, a=a, c=c, vacuum=vacuum, orthogonal=orth)
|
|
@@ -48,6 +51,7 @@ def main(symbol, surface, size, kind, a, c, thickness, orth, vacuum):
|
|
|
48
51
|
else:
|
|
49
52
|
atoms = build_surface(symbol, size, a=a, vacuum=vacuum, orthogonal=orth)
|
|
50
53
|
|
|
54
|
+
out_err.check_cell(atoms)
|
|
51
55
|
atoms.write(out_filename)
|
|
52
56
|
print(os.path.abspath(out_filename))
|
|
53
57
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
from ase import build
|
|
4
|
+
import click, os
|
|
5
|
+
from mdkits.util import arg_type, out_err
|
|
6
|
+
from mdkits.build_cli import supercell
|
|
7
|
+
import numpy as np
|
|
8
|
+
import ase.visualize
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def find_vector(atoms):
|
|
12
|
+
position = atoms.positions
|
|
13
|
+
max_z = np.max(position[:, 2])
|
|
14
|
+
highest_points = position[position[:, 2] == max_z]
|
|
15
|
+
|
|
16
|
+
shortest_vector = None
|
|
17
|
+
min_distance = float('inf')
|
|
18
|
+
x_axis = np.array([1, 0, 0])
|
|
19
|
+
|
|
20
|
+
for i in range(len(highest_points)):
|
|
21
|
+
for j in range(i + 1, len(highest_points)):
|
|
22
|
+
point1 = highest_points[i]
|
|
23
|
+
point2 = highest_points[j]
|
|
24
|
+
vector = point2 - point1
|
|
25
|
+
|
|
26
|
+
cos_angle = np.dot(vector, x_axis) / (np.linalg.norm(vector) * np.linalg.norm(x_axis))
|
|
27
|
+
angle = np.arccos(cos_angle)
|
|
28
|
+
|
|
29
|
+
if angle <= np.pi / 2:
|
|
30
|
+
distance = np.linalg.norm(vector)
|
|
31
|
+
if distance < min_distance:
|
|
32
|
+
min_distance = distance
|
|
33
|
+
shortest_vector = vector
|
|
34
|
+
|
|
35
|
+
return shortest_vector
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@click.command(name='cut')
|
|
39
|
+
@click.argument('atoms', type=arg_type.Structure)
|
|
40
|
+
@click.option('--face', type=click.Tuple([int, int, int]), help='face index')
|
|
41
|
+
@click.option('--size', type=click.Tuple([int, int, int]), help='surface size')
|
|
42
|
+
@click.option('--vacuum', type=float, help='designate vacuum of surface, default is None', default=0.0, show_default=True)
|
|
43
|
+
@click.option('--cell', type=arg_type.Cell, help='set xyz file cell, --cell x,y,z,a,b,c')
|
|
44
|
+
@click.option('--orth', is_flag=True, help='orthogonalize cell')
|
|
45
|
+
def main(atoms, face, vacuum, size, cell, orth):
|
|
46
|
+
"""cut surface"""
|
|
47
|
+
out_err.check_cell(atoms, cell)
|
|
48
|
+
o = f"{atoms.filename.split('.')[-2]}_{face[0]}{face[1]}{face[2]}_{size[0]}{size[1]}{size[2]}.cif"
|
|
49
|
+
|
|
50
|
+
surface = build.surface(atoms, face, size[2], vacuum=vacuum/2)
|
|
51
|
+
|
|
52
|
+
if orth:
|
|
53
|
+
#vector = surface[-2].position - surface[-1].position
|
|
54
|
+
#vector = find_vector(surface)
|
|
55
|
+
surface_cell = surface.cell.cellpar()
|
|
56
|
+
ase.visualize.view(surface)
|
|
57
|
+
gamma = surface_cell[-1]
|
|
58
|
+
if gamma != 90:
|
|
59
|
+
a = np.sin(np.radians(gamma)) * surface_cell[0]
|
|
60
|
+
b = surface_cell[1]
|
|
61
|
+
surface_cell[1] = a
|
|
62
|
+
surface_cell[0] = b
|
|
63
|
+
surface_cell[-1] = 90
|
|
64
|
+
#surface.rotate(vector, np.array([1, 0, 0]))
|
|
65
|
+
surface.rotate(-gamma, 'z')
|
|
66
|
+
surface.set_cell(surface_cell)
|
|
67
|
+
surface.wrap()
|
|
68
|
+
o = f"{atoms.filename.split('.')[-2]}_{face[0]}{face[1]}{face[2]}_{size[0]}{size[1]}{size[2]}_orth.cif"
|
|
69
|
+
|
|
70
|
+
super_surface = supercell.supercell(surface, size[0], size[1], 1)
|
|
71
|
+
|
|
72
|
+
super_surface.write(o)
|
|
73
|
+
out_err.cell_output(super_surface.cell.cellpar())
|
|
74
|
+
out_err.path_output(o)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if __name__ == '__main__':
|
|
78
|
+
main()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
from ase.io import read
|
|
4
|
+
import click, os
|
|
5
|
+
import numpy as np
|
|
6
|
+
from ase.build import make_supercell
|
|
7
|
+
from mdkits.util import (
|
|
8
|
+
structure_parsing,
|
|
9
|
+
encapsulated_ase,
|
|
10
|
+
cp2k_input_parsing,
|
|
11
|
+
arg_type,
|
|
12
|
+
out_err,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def supercell(atom, x, y, z):
|
|
17
|
+
P = [ [x, 0, 0], [0, y, 0], [0, 0, z] ]
|
|
18
|
+
super_atom = make_supercell(atom, P)
|
|
19
|
+
return super_atom
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@click.command(name='supercell')
|
|
23
|
+
@click.argument('atoms', type=arg_type.Structure)
|
|
24
|
+
@click.argument('super', type=click.Tuple([int, int, int]), default=(1, 1, 1))
|
|
25
|
+
@click.option('--cell', type=arg_type.Cell, help='set cell, a list of lattice, --cell x,y,z or x,y,z,a,b,c')
|
|
26
|
+
def main(atoms, super, cell):
|
|
27
|
+
"""make a supercell"""
|
|
28
|
+
|
|
29
|
+
out_err.check_cell(atoms, cell)
|
|
30
|
+
|
|
31
|
+
atoms.set_pbc(True)
|
|
32
|
+
atoms.wrap()
|
|
33
|
+
super_atom = supercell(atoms, super[0], super[1], super[2])
|
|
34
|
+
|
|
35
|
+
o = f"{atoms.filename.split('.')[-2]}_{super[0]}{super[1]}{super[2]}.cif"
|
|
36
|
+
super_atom.write(o)
|
|
37
|
+
print(os.path.abspath(o))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if __name__ == '__main__':
|
|
41
|
+
main()
|
|
@@ -52,7 +52,7 @@ class StructureType(click.ParamType):
|
|
|
52
52
|
cell = cp2k_input_parsing.parse_cell()
|
|
53
53
|
atoms.set_cell(cell)
|
|
54
54
|
|
|
55
|
-
atoms.filename = value.replace('./', '').replace('.\\', '')
|
|
55
|
+
atoms.filename = value.replace('./', '').replace('.\\', '').split('/')[-1]
|
|
56
56
|
return atoms
|
|
57
57
|
else:
|
|
58
58
|
self.fail(f"{value} is not exists", param, ctx)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
output and error for cli
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import sys, os
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def cell_output(cell):
|
|
10
|
+
print(f"system cell: x = {cell[0]}, y = {cell[1]}, z = {cell[2]}, a = {cell[3]}\u00B0, b = {cell[4]}\u00B0, c = {cell[5]}\u00B0")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def path_output(file: str):
|
|
14
|
+
print(os.path.abspath(file))
|
|
15
|
+
|
|
16
|
+
def check_cell(atoms, cell=None):
|
|
17
|
+
if not np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])):
|
|
18
|
+
cell_output(atoms.cell.cellpar())
|
|
19
|
+
elif np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])) and cell is not None:
|
|
20
|
+
atoms.set_cell(cell)
|
|
21
|
+
else:
|
|
22
|
+
raise ValueError("can't parse cell please use --cell set cell")
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
from ase.io import write, read
|
|
2
|
-
import argparse
|
|
3
|
-
from ase.geometry import cell_to_cellpar, cellpar_to_cell
|
|
4
|
-
import math
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def parse_argument():
|
|
8
|
-
parser = argparse.ArgumentParser(description='combain solbox and surface to a interface')
|
|
9
|
-
parser.add_argument('--surface', type=str, help='surface path')
|
|
10
|
-
parser.add_argument('--sol', type=str, help='solbox path')
|
|
11
|
-
parser.add_argument('--move', type=float, help='move at z, default = 0', default=0)
|
|
12
|
-
parser.add_argument('--interval', type=float, help='interval between surface to sol, default is 2', default=2)
|
|
13
|
-
parser.add_argument('--vacuum', type=float, help='vacuum of structure, default is 0', default=0)
|
|
14
|
-
parser.add_argument('--symmetry', help='two side interface, default is false', action='store_true')
|
|
15
|
-
parser.add_argument('--ne', help='two side interface, one side is Ne atom, default is false', action='store_true')
|
|
16
|
-
parser.add_argument('-o', type=str, help='output file name', default='interface')
|
|
17
|
-
|
|
18
|
-
return parser.parse_args()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def chformat(input_filename, output_filename, format):
|
|
22
|
-
atoms = read(input_filename)
|
|
23
|
-
write(output_filename, atoms, format=format)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def main():
|
|
27
|
-
args = parse_argument()
|
|
28
|
-
surface = read(args.surface)
|
|
29
|
-
surface.set_pbc(True)
|
|
30
|
-
surface.center()
|
|
31
|
-
sy_surface = surface.copy()
|
|
32
|
-
cell = surface.get_cell()
|
|
33
|
-
[lenx, leny, lenz, anga, angb, angc] = cell_to_cellpar(cell)
|
|
34
|
-
|
|
35
|
-
solbox = read(args.sol)
|
|
36
|
-
solbox_cell = solbox.cell.cellpar()
|
|
37
|
-
solbox.set_pbc(True)
|
|
38
|
-
solbox.center()
|
|
39
|
-
tmp_list = solbox.get_positions()
|
|
40
|
-
tmp_list[:, 2] += lenz + args.interval
|
|
41
|
-
solbox.set_positions(tmp_list)
|
|
42
|
-
|
|
43
|
-
surface.extend(solbox)
|
|
44
|
-
surface.cell = [lenx, leny, (lenz + args.interval + solbox_cell[2] + args.interval), anga, angb, angc]
|
|
45
|
-
surface.center()
|
|
46
|
-
|
|
47
|
-
if args.symmetry:
|
|
48
|
-
tmp_list = surface.get_positions()
|
|
49
|
-
tmp_list[:, 2] += -(lenz + args.interval + solbox_cell[2] + args.interval)
|
|
50
|
-
surface.set_positions(tmp_list)
|
|
51
|
-
surface.extend(sy_surface)
|
|
52
|
-
surface.cell = [lenx, leny, (lenz + args.interval + solbox_cell[2] + args.interval + lenz + args.vacuum), anga, angb, angc]
|
|
53
|
-
surface.center()
|
|
54
|
-
elif args.ne:
|
|
55
|
-
from ase import Atoms
|
|
56
|
-
ne_interval = 4 # adjust water density
|
|
57
|
-
ne_cell = [lenx, leny, 2, 90, 90, 90]
|
|
58
|
-
ne_position = []
|
|
59
|
-
ne_symbols = []
|
|
60
|
-
ne_site = [int(lenx//ne_interval), int(leny//ne_interval)]
|
|
61
|
-
for i in range(ne_site[0]):
|
|
62
|
-
for j in range(ne_site[1]):
|
|
63
|
-
ne_position.append((i*ne_interval, j*ne_interval, 0))
|
|
64
|
-
ne_symbols.append('Ne')
|
|
65
|
-
ne_atoms = Atoms(symbols=ne_symbols, positions=ne_position, cell=ne_cell)
|
|
66
|
-
ne_atoms.center()
|
|
67
|
-
tmp_list = surface.get_positions()
|
|
68
|
-
tmp_list[:, 2] += -(lenz + args.interval + solbox_cell[2])
|
|
69
|
-
surface.set_positions(tmp_list)
|
|
70
|
-
surface.extend(ne_atoms)
|
|
71
|
-
surface.cell = [lenx, leny, (lenz + args.interval + solbox_cell[2] + args.interval + 2 + args.vacuum), anga, angb, angc]
|
|
72
|
-
surface.center()
|
|
73
|
-
else:
|
|
74
|
-
surface.set_pbc(True)
|
|
75
|
-
tmp_list = surface.get_positions()
|
|
76
|
-
#tmp_list[:, 2] -= lenz
|
|
77
|
-
tmp_list[:, 2] -= args.move
|
|
78
|
-
surface.set_positions(tmp_list)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
write(args.o + '.xyz', surface, format='extxyz')
|
|
82
|
-
write(args.o + '.cif', surface, format='cif')
|
|
83
|
-
#chformat(args.o + '.cif', args.o + '.xyz', format='xyz')
|
|
84
|
-
|
|
85
|
-
if __name__ == '__main__':
|
|
86
|
-
main()
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from ase import io, build
|
|
4
|
-
import argparse
|
|
5
|
-
from util import encapsulated_ase
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def parse_size(s):
|
|
9
|
-
return [int(x) for x in s.replace(',', ' ').split()]
|
|
10
|
-
|
|
11
|
-
def parse_size1(s):
|
|
12
|
-
return [float(x) for x in s.replace(',', ' ').split()]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def parse_argument():
|
|
16
|
-
parser = argparse.ArgumentParser(description='cut surface of structure')
|
|
17
|
-
parser.add_argument('filename', type=str, help='init structure filename')
|
|
18
|
-
parser.add_argument('--face', type=parse_size, help='face index')
|
|
19
|
-
parser.add_argument('--vacuum', type=float, help='designate vacuum of surface, default is None', default=0.0)
|
|
20
|
-
parser.add_argument('--size', type=parse_size, help='surface size')
|
|
21
|
-
parser.add_argument('--coord', help='coord format', action='store_true')
|
|
22
|
-
parser.add_argument('--cell', type=parse_size1, help='set xyz file cell, --cell x,y,z,a,b,c')
|
|
23
|
-
|
|
24
|
-
return parser.parse_args()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def main():
|
|
28
|
-
args = parse_argument()
|
|
29
|
-
atoms = encapsulated_ase.atoms_read_with_cell(args.filename, cell=args.cell, coord_mode=args.coord)
|
|
30
|
-
surface = build.surface(atoms, args.face, args.size[2], vacuum=args.vacuum/2)
|
|
31
|
-
super_cell = [[args.size[0], 0, 0], [0, args.size[1], 0], [0, 0, 1]]
|
|
32
|
-
super_surface = build.make_supercell(surface, super_cell)
|
|
33
|
-
|
|
34
|
-
super_surface.write(f"{args.filename.split('.')[-2].split('/')[-1]}_{args.face[0]}{args.face[1]}{args.face[2]}.cif")
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if __name__ == '__main__':
|
|
38
|
-
main()
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from ase.io import read
|
|
4
|
-
import argparse, os
|
|
5
|
-
import numpy as np
|
|
6
|
-
from ase.build import make_supercell
|
|
7
|
-
from util import (
|
|
8
|
-
structure_parsing,
|
|
9
|
-
encapsulated_ase,
|
|
10
|
-
cp2k_input_parsing
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def supercell(atom, x, y, z):
|
|
15
|
-
P = [ [x, 0, 0], [0, y, 0], [0, 0, z] ]
|
|
16
|
-
super_atom = make_supercell(atom, P)
|
|
17
|
-
return super_atom
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def parse_cell(s):
|
|
21
|
-
return [float(x) for x in s.replace(',', ' ').split()]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def super_cell(s):
|
|
25
|
-
super_cell = [int(x) for x in s.replace(',', ' ').split()]
|
|
26
|
-
leng = len(super_cell)
|
|
27
|
-
if leng == 2:
|
|
28
|
-
super_cell.append(1)
|
|
29
|
-
elif leng == 3:
|
|
30
|
-
pass
|
|
31
|
-
else:
|
|
32
|
-
print('wrong super cell size')
|
|
33
|
-
exit(1)
|
|
34
|
-
|
|
35
|
-
return super_cell
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def parse_argument():
|
|
39
|
-
parser = argparse.ArgumentParser(description='make a supercell')
|
|
40
|
-
|
|
41
|
-
parser.add_argument('input_file_name', type=str, help='input file name')
|
|
42
|
-
parser.add_argument('super', type=super_cell, help='super cell size, a,b,c')
|
|
43
|
-
parser.add_argument('-o', type=str, help='output file name, default is "super.cif"', default='super.cif')
|
|
44
|
-
parser.add_argument('--cp2k_input_file', type=str, help='input file name of cp2k, default is "input.inp"', default='input.inp')
|
|
45
|
-
parser.add_argument('--coord', help='coord format', action='store_true')
|
|
46
|
-
parser.add_argument('--cell', type=parse_cell, help='set cell, a list of lattice, --cell x,y,z or x,y,z,a,b,c')
|
|
47
|
-
|
|
48
|
-
return parser.parse_args()
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def main():
|
|
52
|
-
args = parse_argument()
|
|
53
|
-
if args.input_file_name == None:
|
|
54
|
-
print('give a xyz file')
|
|
55
|
-
sys.exit()
|
|
56
|
-
|
|
57
|
-
atom = encapsulated_ase.atoms_read_with_cell(args.input_file_name, cell=args.cell, coord_mode=args.coord)
|
|
58
|
-
atom.set_pbc(True)
|
|
59
|
-
atom.wrap()
|
|
60
|
-
super_atom = supercell(atom, args.super[0], args.super[1], args.super[2])
|
|
61
|
-
|
|
62
|
-
suffix = args.o.split('.')[-1]
|
|
63
|
-
if suffix == 'data':
|
|
64
|
-
super_atom.write(f'{args.o}', format='lammps-data', atom_style='atomic')
|
|
65
|
-
else:
|
|
66
|
-
super_atom.write(f'{args.o}')
|
|
67
|
-
|
|
68
|
-
print(os.path.abspath(args.o))
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if __name__ == '__main__':
|
|
72
|
-
main()
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
output and error for cli
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import numpy as np
|
|
6
|
-
import sys
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def cell_output(cell: list):
|
|
10
|
-
print(f"system cell: x = {cell[0]}, y = {cell[1]}, z = {cell[2]}, a = {cell[3]}\u00B0, b = {cell[4]}\u00B0, c = {cell[5]}\u00B0")
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def check_cell(atoms, cell):
|
|
14
|
-
if np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])) and cell is not None:
|
|
15
|
-
atoms.set_cell(cell)
|
|
16
|
-
else:
|
|
17
|
-
raise ValueError("can't parse cell please use --cell set cell")
|
|
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
|