mdkits 0.1.8__tar.gz → 0.1.9__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.8 → mdkits-0.1.9}/PKG-INFO +1 -1
  2. {mdkits-0.1.8 → mdkits-0.1.9}/pyproject.toml +1 -1
  3. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/build_bulk.py +4 -2
  4. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/build_cli.py +4 -0
  5. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/build_surface.py +1 -1
  6. mdkits-0.1.9/src/mdkits/build_cli/cut_surface.py +28 -0
  7. mdkits-0.1.9/src/mdkits/build_cli/supercell.py +41 -0
  8. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/arg_type.py +1 -1
  9. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/out_err.py +3 -1
  10. mdkits-0.1.8/src/mdkits/build_cli/cut_surface.py +0 -38
  11. mdkits-0.1.8/src/mdkits/cli/supercell.py +0 -72
  12. {mdkits-0.1.8 → mdkits-0.1.9}/LICENSE +0 -0
  13. {mdkits-0.1.8 → mdkits-0.1.9}/README.md +0 -0
  14. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/__init__.py +0 -0
  15. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/__init__.py +0 -0
  16. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/adsorbate.py +0 -0
  17. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/build_interface.py +0 -0
  18. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/build_solution.py +0 -0
  19. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/build_cli/water.xyz +0 -0
  20. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/,hb_distribution_down.py +0 -0
  21. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/convert.py +0 -0
  22. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/cube.py +0 -0
  23. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/data.py +0 -0
  24. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/density.py +0 -0
  25. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/extract.py +0 -0
  26. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/hartree_potential.py +0 -0
  27. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/hartree_potential_ave.py +0 -0
  28. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/hb.py +0 -0
  29. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/hb_distribution.py +0 -0
  30. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/packmol_input.py +0 -0
  31. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/pdos.py +0 -0
  32. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/plot.py +0 -0
  33. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/cli/wrap.py +0 -0
  34. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/config/__init__.py +0 -0
  35. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/config/settings.yml +0 -0
  36. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/mdkits.py +0 -0
  37. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/__init__.py +0 -0
  38. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/cp2k_input_parsing.py +0 -0
  39. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/encapsulated_ase.py +0 -0
  40. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/encapsulated_mda.py +0 -0
  41. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/fig_operation.py +0 -0
  42. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/numpy_geo.py +0 -0
  43. {mdkits-0.1.8 → mdkits-0.1.9}/src/mdkits/util/os_operation.py +0 -0
  44. {mdkits-0.1.8 → mdkits-0.1.9}/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.8
3
+ Version: 0.1.9
4
4
  Summary: kits for md or dft
5
5
  License: MIT
6
6
  Keywords: molecular dynamics,density functional theory
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mdkits"
3
- version = "0.1.8"
3
+ version = "0.1.9"
4
4
  description = "kits for md or dft"
5
5
  readme = "README.md"
6
6
  authors = ["jxxcr <jixxcr@qq.com>"]
@@ -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,8 @@ from mdkits.build_cli import (
9
9
  build_surface,
10
10
  adsorbate,
11
11
  build_solution,
12
+ cut_surface,
13
+ supercell,
12
14
  )
13
15
 
14
16
 
@@ -23,6 +25,8 @@ cli_build.add_command(build_bulk.main)
23
25
  cli_build.add_command(build_surface.main)
24
26
  cli_build.add_command(adsorbate.main)
25
27
  cli_build.add_command(build_solution.main)
28
+ cli_build.add_command(cut_surface.main)
29
+ cli_build.add_command(supercell.main)
26
30
 
27
31
  if __name__ == '__main__':
28
32
  cli_build()
@@ -19,7 +19,7 @@ def surface_check(obj, surface_type):
19
19
  @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
20
  @click.option('--thickness', type=float, help='Thickness of the layer, for mx2 and graphene')
21
21
  @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)
22
+ @click.option('--vacuum', type=float, help='designate vacuum of surface, default is None', default=0.0, show_default=True)
23
23
  def main(symbol, surface, size, kind, a, c, thickness, orth, vacuum):
24
24
  #if args.primitive:
25
25
  # a = args.a * 0.7071 * 2
@@ -0,0 +1,28 @@
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()
@@ -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)
@@ -11,7 +11,9 @@ def cell_output(cell: list):
11
11
 
12
12
 
13
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:
14
+ if not np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])):
15
+ cell_output(atoms.cell.cellpar())
16
+ elif np.array_equal(atoms.cell.cellpar(), np.array([0., 0., 0., 90., 90., 90.])) and cell is not None:
15
17
  atoms.set_cell(cell)
16
18
  else:
17
19
  raise ValueError("can't parse cell please use --cell set cell")
@@ -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()
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