mdkits 0.1.8__py3-none-any.whl → 0.1.10__py3-none-any.whl

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.

@@ -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
- atoms.write(f"{symbol}_{cs}.cif", format='cif')
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()
@@ -1,59 +1,44 @@
1
- from ase.io import write, read
2
- import argparse
3
- from ase.geometry import cell_to_cellpar, cellpar_to_cell
4
- import math
1
+ import click
2
+ from mdkits.util import arg_type, out_err
5
3
 
6
4
 
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')
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)
17
15
 
18
- return parser.parse_args()
16
+ o = f"{slab.filename.split('.')[-2]}_{sol.filename.split('.')[-2]}.cif"
19
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()
20
24
 
21
- def chformat(input_filename, output_filename, format):
22
- atoms = read(input_filename)
23
- write(output_filename, atoms, format=format)
25
+ sol_cell = sol.cell.cellpar()
26
+ sol.set_pbc(True)
27
+ sol.center()
28
+ sol.positions[:, 2] += slab_cell[2] + interval
24
29
 
30
+ slab.extend(sol)
31
+ slab_cell[2] += 2 * interval + sol_cell[2]
32
+ slab.set_cell(slab_cell)
33
+ slab.center()
25
34
 
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:
35
+ if cap is None:
36
+ slab.positions[:, 2] -= 0.5 * init_slab_cell[2]
37
+ elif cap == 'ne':
55
38
  from ase import Atoms
56
- ne_interval = 4 # adjust water density
39
+ ne_interval = 4
40
+ lenx = init_slab_cell[0]
41
+ leny = init_slab_cell[1]
57
42
  ne_cell = [lenx, leny, 2, 90, 90, 90]
58
43
  ne_position = []
59
44
  ne_symbols = []
@@ -64,23 +49,26 @@ def main():
64
49
  ne_symbols.append('Ne')
65
50
  ne_atoms = Atoms(symbols=ne_symbols, positions=ne_position, cell=ne_cell)
66
51
  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)
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)
79
68
 
80
69
 
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')
70
+ slab.write(o)
71
+ out_err.path_output(o)
84
72
 
85
73
  if __name__ == '__main__':
86
- 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)
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
 
@@ -1,37 +1,77 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- from ase import io, build
4
- import argparse
5
- from util import encapsulated_ase
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
6
9
 
7
10
 
8
- def parse_size(s):
9
- return [int(x) for x in s.replace(',', ' ').split()]
11
+ def find_vector(atoms):
12
+ position = atoms.positions
13
+ max_z = np.max(position[:, 2])
14
+ highest_points = position[position[:, 2] == max_z]
10
15
 
11
- def parse_size1(s):
12
- return [float(x) for x in s.replace(',', ' ').split()]
16
+ shortest_vector = None
17
+ min_distance = float('inf')
18
+ x_axis = np.array([1, 0, 0])
13
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
14
25
 
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')
26
+ cos_angle = np.dot(vector, x_axis) / (np.linalg.norm(vector) * np.linalg.norm(x_axis))
27
+ angle = np.arccos(cos_angle)
23
28
 
24
- return parser.parse_args()
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
25
34
 
35
+ return shortest_vector
26
36
 
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
37
 
34
- super_surface.write(f"{args.filename.split('.')[-2].split('/')[-1]}_{args.face[0]}{args.face[1]}{args.face[2]}.cif")
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)
35
75
 
36
76
 
37
77
  if __name__ == '__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()
mdkits/util/arg_type.py CHANGED
@@ -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)
mdkits/util/out_err.py CHANGED
@@ -3,15 +3,20 @@ 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):
14
- if np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])) and cell is not None:
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:
15
20
  atoms.set_cell(cell)
16
21
  else:
17
22
  raise ValueError("can't parse cell please use --cell set cell")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mdkits
3
- Version: 0.1.8
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,12 +1,13 @@
1
1
  mdkits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  mdkits/build_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  mdkits/build_cli/adsorbate.py,sha256=Zp21i-miFv5zQlYjZnZuVpMxvNVT-6RtdlaoWDMwaOg,1900
4
- mdkits/build_cli/build_bulk.py,sha256=mOjoHHBui5fTYASabD96l6zBoKlQukT-LOyR2FZNzM4,1549
5
- mdkits/build_cli/build_cli.py,sha256=pH9g6OonxxEpLTJCVwk_EwhLtFrmrL51jjyCjmIXU2o,544
6
- mdkits/build_cli/build_interface.py,sha256=i1YE5iwazKVsTdQ_DXalNYeA8oflORWFePgJin1AJM4,3537
7
- mdkits/build_cli/build_solution.py,sha256=jqbrrLopBn9LaTO7UELQTqxu0NTcg1PYkf5cdT1qZnc,3359
8
- mdkits/build_cli/build_surface.py,sha256=LZtE3DMNgriOUb_sfPGbpYfZEf9b7sRWeKooaETsp2M,2663
9
- mdkits/build_cli/cut_surface.py,sha256=D1naCWj0QJE3AiInzy3SeGO37butothE3BS1rZsZ5MU,1425
4
+ mdkits/build_cli/build_bulk.py,sha256=o3SFov5Ggk-qKcy6-NBoIYKvZV24OhcH3-du1d0U6H4,1593
5
+ mdkits/build_cli/build_cli.py,sha256=sqjnq5aHWLYLbNzN5SORkEYeYaewLagFuSvspJxyh7E,725
6
+ mdkits/build_cli/build_interface.py,sha256=3EDxUb-vGHFuat1Ex_wojVsN8PtzHiGrnDQIEa9WZ60,2448
7
+ mdkits/build_cli/build_solution.py,sha256=r-2Yt62lEyPuPuQvjj3B7HXmAZ42cxVhzvGWhfjUj2Y,3563
8
+ mdkits/build_cli/build_surface.py,sha256=cBEQ-KR_6j-Mcsxrwvzyl6p1SiY_chIytrCu7MS3q08,2794
9
+ mdkits/build_cli/cut_surface.py,sha256=R0Snr-y23SYLfNhdBC5VgT4KFY1SOGn5hZlVvX5CUvw,2757
10
+ mdkits/build_cli/supercell.py,sha256=3iTTt3DHaERWDFonhBRS0oqWhjFh6pbS5SpIR-O1gYg,1034
10
11
  mdkits/build_cli/water.xyz,sha256=ByLDz-rYhw_wLPBU78lIQHe4s4Xf5Ckjft-Dus3czIc,171
11
12
  "mdkits/cli/,hb_distribution_down.py",sha256=i3NguzGebqCgy4uuVBeFajZRZnXtjhsJBPDGDdumlWA,4733
12
13
  mdkits/cli/convert.py,sha256=OmQ-7hmw0imgfgCJaWFEy3ePixsU7VKf0mGuJ6jRpn0,1795
@@ -21,23 +22,22 @@ mdkits/cli/hb_distribution.py,sha256=VpTyOhU9oucWUnqUSmLgZfMb5g0tR0q7vrxakLSrKxI
21
22
  mdkits/cli/packmol_input.py,sha256=76MjjMMRDaW2q459B5mEpXDYSSn14W-JXudOOsx-8E4,2849
22
23
  mdkits/cli/pdos.py,sha256=ALAZ5uOaoT0UpCyKYleWxwmk569HMzKTTK-lMJeicM8,1411
23
24
  mdkits/cli/plot.py,sha256=1yh5dq5jnQDuyWlxV_9g5ztsnuFHVu4ouYQ9VJYSrUU,8938
24
- mdkits/cli/supercell.py,sha256=r5iddLw1NNzj7NTFlR2j_jpD1AMfrsxhA08bPwQvVvg,2059
25
25
  mdkits/cli/wrap.py,sha256=AUxGISuiCfEjdMYl-TKc2VMCPHSybWKrMIOTn_6kSp0,1043
26
26
  mdkits/config/__init__.py,sha256=ZSwmnPK02LxJLMgcYmNb-tIOk8fEuHf5jpqD3SDHWLg,1039
27
27
  mdkits/config/settings.yml,sha256=PY7u0PbFLuxSnd54H5tI9oMjUf-mzyADqSZtm99BwG0,71
28
28
  mdkits/mdkits.py,sha256=7yZHo13dn_Nn5K7BNIrEXFN44WoZoWD_MqgRQGhTJEU,627
29
29
  mdkits/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- mdkits/util/arg_type.py,sha256=r744Q-Rau3F6BDRrS2Naygb4pLsOwcoSbVrAKIME6qc,2550
30
+ mdkits/util/arg_type.py,sha256=VQS9pMYr5CmVTy-BDSAaPrRNWnzC6up-vpoW0io8jYQ,2565
31
31
  mdkits/util/cp2k_input_parsing.py,sha256=7NMVOYEGycarokLJlhLoWWilciM7sd8MWp5FVTF7hqI,1223
32
32
  mdkits/util/encapsulated_ase.py,sha256=uhqIhsALxzwJYuFrfOYGGC6U0QLm_dcZNridvfl_XGc,4339
33
33
  mdkits/util/encapsulated_mda.py,sha256=td3H24u3eHOIS2nwPucfIaMxeaVxI77oFI8nnNhw7vo,2217
34
34
  mdkits/util/fig_operation.py,sha256=FwffNUtXorMl6qE04FipgzcVljEQii7wrNJUCJMyY3E,1045
35
35
  mdkits/util/numpy_geo.py,sha256=1Op8THoQeyqybSZAi7hVxohYCr4SzY6ndZC8_gAGXDA,3619
36
36
  mdkits/util/os_operation.py,sha256=ErN2ExjX9vZRfPe3ypsj4eyoQTEePqzlEX0Xm1N4lL4,980
37
- mdkits/util/out_err.py,sha256=K_vKJAfshamAeHIXcy3_mWYsuP5-DRjUO1ADeTn2D9Q,491
37
+ mdkits/util/out_err.py,sha256=b4eFz9kqqNReK9UCHak9k5tBlEj9yHAIADDTRbaNaNk,693
38
38
  mdkits/util/structure_parsing.py,sha256=mRPMJeih3O-ST7HeETDvBEkfV-1psT-XgxyYgDadV0U,4152
39
- mdkits-0.1.8.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
40
- mdkits-0.1.8.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
41
- mdkits-0.1.8.dist-info/METADATA,sha256=gpFmw5LOizLVQjlzU12d2--EF0gkvJxIQVJyKrhJ3n8,6948
42
- mdkits-0.1.8.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
43
- mdkits-0.1.8.dist-info/RECORD,,
39
+ mdkits-0.1.10.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
40
+ mdkits-0.1.10.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
41
+ mdkits-0.1.10.dist-info/METADATA,sha256=H4xU8A7CelB-t7-r7JVdDRlW_SnBRAxRNQUpbW_KZVo,6907
42
+ mdkits-0.1.10.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
43
+ mdkits-0.1.10.dist-info/RECORD,,
mdkits/cli/supercell.py DELETED
@@ -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()