mdkits 0.1.9__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.

Files changed (44) hide show
  1. {mdkits-0.1.9 → mdkits-0.1.10}/PKG-INFO +1 -2
  2. {mdkits-0.1.9 → mdkits-0.1.10}/pyproject.toml +1 -2
  3. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/build_cli.py +2 -0
  4. mdkits-0.1.10/src/mdkits/build_cli/build_interface.py +74 -0
  5. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/build_solution.py +5 -0
  6. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/build_surface.py +5 -1
  7. mdkits-0.1.10/src/mdkits/build_cli/cut_surface.py +78 -0
  8. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/out_err.py +6 -3
  9. mdkits-0.1.9/src/mdkits/build_cli/build_interface.py +0 -86
  10. mdkits-0.1.9/src/mdkits/build_cli/cut_surface.py +0 -28
  11. {mdkits-0.1.9 → mdkits-0.1.10}/LICENSE +0 -0
  12. {mdkits-0.1.9 → mdkits-0.1.10}/README.md +0 -0
  13. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/__init__.py +0 -0
  14. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/__init__.py +0 -0
  15. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/adsorbate.py +0 -0
  16. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/build_bulk.py +0 -0
  17. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/supercell.py +0 -0
  18. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/build_cli/water.xyz +0 -0
  19. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/,hb_distribution_down.py +0 -0
  20. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/convert.py +0 -0
  21. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/cube.py +0 -0
  22. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/data.py +0 -0
  23. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/density.py +0 -0
  24. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/extract.py +0 -0
  25. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/hartree_potential.py +0 -0
  26. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/hartree_potential_ave.py +0 -0
  27. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/hb.py +0 -0
  28. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/hb_distribution.py +0 -0
  29. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/packmol_input.py +0 -0
  30. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/pdos.py +0 -0
  31. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/plot.py +0 -0
  32. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/cli/wrap.py +0 -0
  33. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/config/__init__.py +0 -0
  34. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/config/settings.yml +0 -0
  35. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/mdkits.py +0 -0
  36. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/__init__.py +0 -0
  37. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/arg_type.py +0 -0
  38. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/cp2k_input_parsing.py +0 -0
  39. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/encapsulated_ase.py +0 -0
  40. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/encapsulated_mda.py +0 -0
  41. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/fig_operation.py +0 -0
  42. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/numpy_geo.py +0 -0
  43. {mdkits-0.1.9 → mdkits-0.1.10}/src/mdkits/util/os_operation.py +0 -0
  44. {mdkits-0.1.9 → 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.9
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.9"
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"
@@ -11,6 +11,7 @@ from mdkits.build_cli import (
11
11
  build_solution,
12
12
  cut_surface,
13
13
  supercell,
14
+ build_interface,
14
15
  )
15
16
 
16
17
 
@@ -27,6 +28,7 @@ cli_build.add_command(adsorbate.main)
27
28
  cli_build.add_command(build_solution.main)
28
29
  cli_build.add_command(cut_surface.main)
29
30
  cli_build.add_command(supercell.main)
31
+ cli_build.add_command(build_interface.main)
30
32
 
31
33
  if __name__ == '__main__':
32
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.0, show_default=True)
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()
@@ -3,14 +3,17 @@ output and error for cli
3
3
  """
4
4
 
5
5
  import numpy as np
6
- import sys
6
+ import sys, os
7
7
 
8
8
 
9
- def cell_output(cell: list):
9
+ def cell_output(cell):
10
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
11
 
12
12
 
13
- def check_cell(atoms, cell):
13
+ def path_output(file: str):
14
+ print(os.path.abspath(file))
15
+
16
+ def check_cell(atoms, cell=None):
14
17
  if not np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])):
15
18
  cell_output(atoms.cell.cellpar())
16
19
  elif np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])) and cell is not None:
@@ -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,28 +0,0 @@
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
-
8
-
9
- @click.command(name='cut')
10
- @click.argument('atoms', type=arg_type.Structure)
11
- @click.option('--face', type=click.Tuple([int, int, int]), help='face index')
12
- @click.option('--size', type=click.Tuple([int, int, int]), help='surface size')
13
- @click.option('--vacuum', type=float, help='designate vacuum of surface, default is None', default=0.0, show_default=True)
14
- @click.option('--cell', type=arg_type.Cell, help='set xyz file cell, --cell x,y,z,a,b,c')
15
- def main(atoms, face, vacuum, size, cell):
16
- """cut surface"""
17
- out_err.check_cell(atoms, cell)
18
-
19
- surface = build.surface(atoms, face, size[2], vacuum=vacuum/2)
20
- super_surface = supercell.supercell(surface, size[0], size[1], 1)
21
-
22
- o = f"{atoms.filename.split('.')[-2]}_{face[0]}{face[1]}{face[2]}_{size[0]}{size[1]}{size[2]}.cif"
23
- super_surface.write(o)
24
- print(os.path.abspath(o))
25
-
26
-
27
- if __name__ == '__main__':
28
- main()
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