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

File without changes
@@ -5,18 +5,23 @@ import os
5
5
  import click
6
6
  import numpy as np
7
7
  import MDAnalysis
8
- from mdkits.util import arg_type, encapsulated_ase
8
+ from mdkits.util import arg_type, encapsulated_ase, out_err
9
9
 
10
10
 
11
11
  @click.command(name='adsorbate')
12
12
  @click.argument('atoms', type=arg_type.Structure)
13
13
  @click.argument('adsorbate', type=arg_type.Molecule)
14
+ @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')
14
15
  @click.option('--select', type=str, help="select adsorbate position")
15
16
  @click.option('--height', type=float, help='height above the surface')
16
17
  @click.option('--rotate', type=click.Tuple([float, float, float]), help='rotate adsorbate molcule around x, y, z axis', default=(0, 0, 0), show_default=True)
17
18
  @click.option('--offset', type=click.Tuple([float, float]), help='adjust site', default=(0, 0), show_default=True)
18
19
  @click.option("--cover", type=int, help='cover the surface with adsorbate randomly')
19
- def main(atoms, adsorbate, select, height, rotate, offset, cover):
20
+ def main(atoms, adsorbate, cell, select, height, rotate, offset, cover):
21
+ if height is None:
22
+ raise ValueError("height is required")
23
+
24
+ out_err.check_cell(atoms, cell)
20
25
  offset = np.array(offset)
21
26
  u = encapsulated_ase.atoms_to_u(atoms)
22
27
 
@@ -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__':
@@ -0,0 +1,32 @@
1
+ import click
2
+ #from mdkits.cli.build import (
3
+ # build_bulk,
4
+ # build_surface,
5
+ # adsorbate,
6
+ #)
7
+ from mdkits.build_cli import (
8
+ build_bulk,
9
+ build_surface,
10
+ adsorbate,
11
+ build_solution,
12
+ cut_surface,
13
+ supercell,
14
+ )
15
+
16
+
17
+ @click.group(name='build')
18
+ @click.pass_context
19
+ def cli_build(ctx):
20
+ """kits for building"""
21
+ pass
22
+
23
+
24
+ cli_build.add_command(build_bulk.main)
25
+ cli_build.add_command(build_surface.main)
26
+ cli_build.add_command(adsorbate.main)
27
+ cli_build.add_command(build_solution.main)
28
+ cli_build.add_command(cut_surface.main)
29
+ cli_build.add_command(supercell.main)
30
+
31
+ if __name__ == '__main__':
32
+ cli_build()
@@ -0,0 +1,84 @@
1
+ import click, os
2
+ from julia import Pkg, Main
3
+ from mdkits.util import arg_type
4
+ from importlib import resources
5
+ import tempfile
6
+
7
+
8
+ @click.command(name="solution")
9
+ @click.argument("filename", type=click.Path(exists=True), nargs=-1)
10
+ @click.option('--infile', is_flag=True, help="read input mode")
11
+ @click.option('--install', is_flag=True, help="install julia and packmol")
12
+ @click.option('--water_number', type=int, help="number of water molecules", default=0, show_default=True)
13
+ @click.option('-n', type=int, multiple=True, help="number of molecules")
14
+ @click.option('--tolerance', type=float, help="tolerance of solution", default=3.5, show_default=True)
15
+ @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")
16
+ @click.option('--gap', type=float, help="gap between solution and cell", default=1, show_default=True)
17
+ def main(filename, infile, install, water_number, n, tolerance, cell, gap):
18
+ """
19
+ build solution model
20
+ """
21
+ if install:
22
+ import julia
23
+ julia.install()
24
+ Pkg.activate("Packmol", shared=True)
25
+ Pkg.add("Packmol")
26
+ Main.exit()
27
+
28
+ if cell is None:
29
+ raise ValueError("cell should be provided")
30
+
31
+ if len(filename) == 0 and water_number == 0:
32
+ raise ValueError("at least one file should be provided, or water_number should be greater than 0")
33
+
34
+ while True:
35
+ try:
36
+ Main.using("Packmol")
37
+ break
38
+ except Exception:
39
+ pass
40
+
41
+ if infile:
42
+ for file in filename:
43
+ Main.run_packmol(file)
44
+ else:
45
+ if len(n) != len(filename):
46
+ raise ValueError("number of -n should be equal to number of files")
47
+
48
+ temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
49
+ backslash = "\\"
50
+
51
+ structure_input = {}
52
+ output_filenames = []
53
+ if len(filename) > 0:
54
+ for index, file in enumerate(filename):
55
+ structure_input[file] = f"structure {os.path.join(os.getcwd(), file.replace(backslash, '/').replace('./', ''))}\n number {n[index]}\n inside box {gap} {gap} {gap} {cell[0]-gap} {cell[1]-gap} {cell[2]-gap}\nend structure\n"
56
+
57
+ output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
58
+
59
+ if water_number > 0:
60
+ water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
61
+
62
+ structure_input["water"] = f"structure {water_path}\n number {water_number}\n inside box {gap} {gap} {gap} {cell[0]-gap} {cell[1]-gap} {cell[2]-gap}\nend structure\n"
63
+
64
+ output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
65
+
66
+ output_filename = "-".join(output_filenames) + ".xyz"
67
+ head_input = f"tolerance {tolerance}\nfiletype xyz\noutput {os.path.join(os.getcwd(), output_filename)}\npbc {cell[0]} {cell[1]} {cell[2]}\n"
68
+
69
+ total_input = head_input + "\n".join(structure_input.values())
70
+
71
+ temp_file.write(total_input)
72
+ temp_file.flush()
73
+ temp_file.close()
74
+
75
+ Main.run_packmol(temp_file.name)
76
+
77
+ if os.path.exists(temp_file.name):
78
+ os.remove(temp_file.name)
79
+
80
+ Main.exit()
81
+
82
+
83
+ if __name__ == "__main__":
84
+ main()
@@ -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()
@@ -0,0 +1,5 @@
1
+ 3
2
+ water
3
+ O 10.203012 7.603800 12.673000
4
+ H 9.625597 8.420323 12.673000
5
+ H 9.625597 6.787278 12.673000
mdkits/cli/convert.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from ase.io import write
4
4
  import click
5
5
  import os
6
- from mdkits.util import encapsulated_ase, arg_type
6
+ from mdkits.util import out_err, arg_type
7
7
 
8
8
 
9
9
  @click.command(name='convert')
@@ -15,12 +15,14 @@ from mdkits.util import encapsulated_ase, arg_type
15
15
  @click.option('--coord', help='coord format', is_flag=True)
16
16
  @click.option('--cp2k', help='convert to cp2k format(coord + cell)', is_flag=True)
17
17
  @click.option('--center', help='center atoms', is_flag=True)
18
- @click.option('--cell', type=arg_type.Cell, help='set cell from cp2k input file or a list of lattice: --cell x,y,z or x,y,z,a,b,c')
19
- @click.option('-o', type=str, help='specify the output file name without suffix', default='out', show_default=True)
20
- def main(atoms, c, x, d, v, coord, cp2k, center, cell, o):
18
+ @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')
19
+ def main(atoms, c, x, d, v, coord, cp2k, center, cell):
21
20
  """
22
21
  convet structure file in some formats
23
22
  """
23
+ out_err.check_cell(atoms, cell)
24
+ o = atoms.filename.split('.')[-2]
25
+
24
26
 
25
27
  if center:
26
28
  atoms.center()
mdkits/mdkits.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import click
2
+ from mdkits.build_cli import build_cli
2
3
  from mdkits.cli import (
3
4
  convert,
4
5
  wrap,
@@ -8,7 +9,6 @@ from mdkits.cli import (
8
9
  density,
9
10
  cube,
10
11
  pdos,
11
- build_cli,
12
12
  )
13
13
 
14
14
 
mdkits/util/arg_type.py CHANGED
@@ -10,21 +10,17 @@ class CellType(click.ParamType):
10
10
 
11
11
  def convert(self, value, param, ctx):
12
12
  if isinstance(value, str):
13
- if ',' not in value:
14
- cell = cp2k_input_parsing.parse_cell()
13
+ cell = [float(x) for x in value.split(',')]
14
+
15
+ if len(cell) == 3:
16
+ cell += [90, 90, 90]
17
+ out_err.cell_output(cell)
18
+ return cell
19
+ elif len(cell) == 6:
20
+ out_err.cell_output(cell)
15
21
  return cell
16
22
  else:
17
- cell = [float(x) for x in value.split(',')]
18
-
19
- if len(cell) == 3:
20
- cell += [90, 90, 90]
21
- out_err.cell_output(cell)
22
- return cell
23
- elif len(cell) == 6:
24
- out_err.cell_output(cell)
25
- return cell
26
- else:
27
- self.fail(f"{value} is not a valid cell parameter", param, ctx)
23
+ self.fail(f"{value} is not a valid cell parameter", param, ctx)
28
24
 
29
25
 
30
26
  class FrameRangeType(click.ParamType):
@@ -56,7 +52,7 @@ class StructureType(click.ParamType):
56
52
  cell = cp2k_input_parsing.parse_cell()
57
53
  atoms.set_cell(cell)
58
54
 
59
- atoms.filename = value.replace('./', '').replace('.\\', '')
55
+ atoms.filename = value.replace('./', '').replace('.\\', '').split('/')[-1]
60
56
  return atoms
61
57
  else:
62
58
  self.fail(f"{value} is not exists", param, ctx)
@@ -33,7 +33,7 @@ def parse_cell():
33
33
  out_err.cell_output(cell)
34
34
  return cell
35
35
  except FileNotFoundError:
36
- sys.exit(f"cant parse cell information from {','.join(os_operation.default_input())}, assign a cell")
36
+ return [0., 0., 0., 90., 90., 90.]
37
37
 
38
38
 
39
39
  #def get_cell(cp2k_input_file, cell=None):
mdkits/util/out_err.py CHANGED
@@ -2,7 +2,18 @@
2
2
  output and error for cli
3
3
  """
4
4
 
5
+ import numpy as np
6
+ import sys
7
+
5
8
 
6
9
  def cell_output(cell: list):
7
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")
8
11
 
12
+
13
+ def check_cell(atoms, cell):
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:
17
+ atoms.set_cell(cell)
18
+ else:
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.7
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
@@ -18,6 +18,7 @@ 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
20
  Requires-Dist: dynaconf (>=3.1.12,<4.0.0)
21
+ Requires-Dist: julia (>=0.6.2,<0.7.0)
21
22
  Requires-Dist: matplotlib (>=3.9.0,<4.0.0)
22
23
  Requires-Dist: numpy (>=1.26.4,<2.0.0)
23
24
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
@@ -1,13 +1,17 @@
1
1
  mdkits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mdkits/build_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ mdkits/build_cli/adsorbate.py,sha256=Zp21i-miFv5zQlYjZnZuVpMxvNVT-6RtdlaoWDMwaOg,1900
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
+ 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=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
11
+ mdkits/build_cli/water.xyz,sha256=ByLDz-rYhw_wLPBU78lIQHe4s4Xf5Ckjft-Dus3czIc,171
2
12
  "mdkits/cli/,hb_distribution_down.py",sha256=i3NguzGebqCgy4uuVBeFajZRZnXtjhsJBPDGDdumlWA,4733
3
- mdkits/cli/adsorbate.py,sha256=rTj0oXkiUOboaxkfpbBoUicguMsB4-G-hJslsoUlbq0,1669
4
- mdkits/cli/build_bulk.py,sha256=mOjoHHBui5fTYASabD96l6zBoKlQukT-LOyR2FZNzM4,1549
5
- mdkits/cli/build_cli.py,sha256=5fFuq4VoW5sqbqKzRb5pWbNBlXBtuzHP68ur63o8WNo,380
6
- mdkits/cli/build_interface.py,sha256=i1YE5iwazKVsTdQ_DXalNYeA8oflORWFePgJin1AJM4,3537
7
- mdkits/cli/build_surface.py,sha256=LZtE3DMNgriOUb_sfPGbpYfZEf9b7sRWeKooaETsp2M,2663
8
- mdkits/cli/convert.py,sha256=yAMgxPvgKSB94W0PNnjIhXHwAxE8wynPdfnwjG7Fb4U,1871
13
+ mdkits/cli/convert.py,sha256=OmQ-7hmw0imgfgCJaWFEy3ePixsU7VKf0mGuJ6jRpn0,1795
9
14
  mdkits/cli/cube.py,sha256=G-QNup8W6J1-LCcEl1EHsV3nstd23byePDOcE_95t18,1176
10
- mdkits/cli/cut_surface.py,sha256=D1naCWj0QJE3AiInzy3SeGO37butothE3BS1rZsZ5MU,1425
11
15
  mdkits/cli/data.py,sha256=FGA4S9Cfo6WUJBSPWKOJrrZXHo_Qza-jNG1P_Dw7yi4,3262
12
16
  mdkits/cli/density.py,sha256=Y4grT8p7CsxggGYo_nGE9z_wlkJeQS5eYWKJQcoA014,5559
13
17
  mdkits/cli/extract.py,sha256=bqqJBmSaVyPYyEseGpUJcMBufIfDLTNRdmUfJ0txE5E,2498
@@ -18,23 +22,22 @@ mdkits/cli/hb_distribution.py,sha256=VpTyOhU9oucWUnqUSmLgZfMb5g0tR0q7vrxakLSrKxI
18
22
  mdkits/cli/packmol_input.py,sha256=76MjjMMRDaW2q459B5mEpXDYSSn14W-JXudOOsx-8E4,2849
19
23
  mdkits/cli/pdos.py,sha256=ALAZ5uOaoT0UpCyKYleWxwmk569HMzKTTK-lMJeicM8,1411
20
24
  mdkits/cli/plot.py,sha256=1yh5dq5jnQDuyWlxV_9g5ztsnuFHVu4ouYQ9VJYSrUU,8938
21
- mdkits/cli/supercell.py,sha256=r5iddLw1NNzj7NTFlR2j_jpD1AMfrsxhA08bPwQvVvg,2059
22
25
  mdkits/cli/wrap.py,sha256=AUxGISuiCfEjdMYl-TKc2VMCPHSybWKrMIOTn_6kSp0,1043
23
26
  mdkits/config/__init__.py,sha256=ZSwmnPK02LxJLMgcYmNb-tIOk8fEuHf5jpqD3SDHWLg,1039
24
27
  mdkits/config/settings.yml,sha256=PY7u0PbFLuxSnd54H5tI9oMjUf-mzyADqSZtm99BwG0,71
25
- mdkits/mdkits.py,sha256=ASOEhY94G_P902ojOobvqPYu1L3AOFTS_Ooh5LJAjX0,603
28
+ mdkits/mdkits.py,sha256=7yZHo13dn_Nn5K7BNIrEXFN44WoZoWD_MqgRQGhTJEU,627
26
29
  mdkits/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- mdkits/util/arg_type.py,sha256=AbjQpv4CEjJJVV2J34jRHOtUYcvwr0lyy5EI9Su7T0s,2728
28
- mdkits/util/cp2k_input_parsing.py,sha256=Hnp8QEMs3bGID2qusJX1OjXVq6cdVL-d24aAUIMji_U,1290
30
+ mdkits/util/arg_type.py,sha256=VQS9pMYr5CmVTy-BDSAaPrRNWnzC6up-vpoW0io8jYQ,2565
31
+ mdkits/util/cp2k_input_parsing.py,sha256=7NMVOYEGycarokLJlhLoWWilciM7sd8MWp5FVTF7hqI,1223
29
32
  mdkits/util/encapsulated_ase.py,sha256=uhqIhsALxzwJYuFrfOYGGC6U0QLm_dcZNridvfl_XGc,4339
30
33
  mdkits/util/encapsulated_mda.py,sha256=td3H24u3eHOIS2nwPucfIaMxeaVxI77oFI8nnNhw7vo,2217
31
34
  mdkits/util/fig_operation.py,sha256=FwffNUtXorMl6qE04FipgzcVljEQii7wrNJUCJMyY3E,1045
32
35
  mdkits/util/numpy_geo.py,sha256=1Op8THoQeyqybSZAi7hVxohYCr4SzY6ndZC8_gAGXDA,3619
33
36
  mdkits/util/os_operation.py,sha256=ErN2ExjX9vZRfPe3ypsj4eyoQTEePqzlEX0Xm1N4lL4,980
34
- mdkits/util/out_err.py,sha256=5ckrO2_wP5QObBeJ5SJ58u6OtvMii5NsXB6-plHrmpg,207
37
+ mdkits/util/out_err.py,sha256=vQ3DB1M-Ce19uR9n6fr_jZnqcv7FcOB3Fy0jY7US7y8,625
35
38
  mdkits/util/structure_parsing.py,sha256=mRPMJeih3O-ST7HeETDvBEkfV-1psT-XgxyYgDadV0U,4152
36
- mdkits-0.1.7.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
37
- mdkits-0.1.7.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
38
- mdkits-0.1.7.dist-info/METADATA,sha256=2g49Gv9xK-pjNm6S9xCormq10ppXLQQTaCl59y2uY0o,6910
39
- mdkits-0.1.7.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
40
- mdkits-0.1.7.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/build_cli.py DELETED
@@ -1,21 +0,0 @@
1
- import click
2
- from mdkits.cli import (
3
- build_bulk,
4
- build_surface,
5
- adsorbate,
6
- )
7
-
8
-
9
- @click.group(name='build')
10
- @click.pass_context
11
- def cli_build(ctx):
12
- """kits for building"""
13
- pass
14
-
15
-
16
- cli_build.add_command(build_bulk.main)
17
- cli_build.add_command(build_surface.main)
18
- cli_build.add_command(adsorbate.main)
19
-
20
- if __name__ == '__main__':
21
- cli_build()
mdkits/cli/cut_surface.py DELETED
@@ -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()
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
File without changes