mdkits 0.1.8__py3-none-any.whl → 0.1.9__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,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
@@ -1,37 +1,27 @@
1
1
  #!/usr/bin/env python3
2
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")
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))
35
25
 
36
26
 
37
27
  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
@@ -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,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,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
4
+ mdkits/build_cli/build_bulk.py,sha256=o3SFov5Ggk-qKcy6-NBoIYKvZV24OhcH3-du1d0U6H4,1593
5
+ mdkits/build_cli/build_cli.py,sha256=lQ2Nk360vTnTzU97dttugf-1_AVLM_eSQRdJknXP37I,658
6
6
  mdkits/build_cli/build_interface.py,sha256=i1YE5iwazKVsTdQ_DXalNYeA8oflORWFePgJin1AJM4,3537
7
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
8
+ mdkits/build_cli/build_surface.py,sha256=iJ5oslhvh9R-hHBOswq07Vrq4Ts2PH53tWZo0aUKdMU,2682
9
+ mdkits/build_cli/cut_surface.py,sha256=1XDoW73TwD3wUiIBuJWuDGvPzvuVU9UpvRT4d3i_g-g,1034
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=vQ3DB1M-Ce19uR9n6fr_jZnqcv7FcOB3Fy0jY7US7y8,625
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.9.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
40
+ mdkits-0.1.9.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
41
+ mdkits-0.1.9.dist-info/METADATA,sha256=UnvRvhhkPrJXquurP0DHimAVZUUmxzwBKBOMLPQ3Pz4,6948
42
+ mdkits-0.1.9.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
43
+ mdkits-0.1.9.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()
File without changes