mdkits 0.1.3__py3-none-any.whl → 0.1.4__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.

mdkits/cli/build_bulk.py CHANGED
@@ -1,53 +1,33 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- import argparse
3
+ import click
4
4
  from ase.build import bulk
5
- from ase.geometry import cell_to_cellpar
6
- from ase.io import write
7
-
8
-
9
- def parse_size(s):
10
- return [int(x) for x in s.replace(',', ' ').split()]
11
-
12
-
13
- def parse_argument():
14
- parser = argparse.ArgumentParser(description='build a surface structure of matel')
15
- parser.add_argument('symbol', type=str, help='designate the symbol of matel')
16
- parser.add_argument('--crystal', type=str, help='designate the crystal of structure')
17
- parser.add_argument('--orth', help='outpue orthorhombic crystal', action='store_true')
18
- parser.add_argument('-a', type=float, help='designate a lattice constant')
19
- parser.add_argument('--primitve', help='designate a lattice constant of real', action='store_true')
20
- parser.add_argument('-o', type=str, help='output structure name', default='bulk.xyz')
21
- parser.add_argument('-c', help='output coord.xyz and cell.inc', action='store_true')
22
- parser.add_argument('-k', help='output kpoint.inc', action='store_true')
23
-
24
- return parser.parse_args()
25
-
26
-
27
- def main():
28
- args = parse_argument()
29
- if args.primitve:
30
- a = args.a * 0.7071 * 2
31
- else:
32
- a = args.a
33
- atoms = bulk(args.symbol, args.crystal, a=a, orthorhombic=args.orth)
34
- if args.c:
35
- atoms.write('coord.xyz', format='xyz')
36
- with open('coord.xyz', 'r') as f:
37
- lines = f.readlines()[2:]
38
- with open('coord.xyz', 'w') as f:
39
- f.writelines(lines)
40
- with open('cell.inc', 'w') as f:
41
- cell = list(cell_to_cellpar(atoms.cell))
42
- f.write('ABC [angstrom] ' + str(cell[0]) + ' ' + str(cell[1]) + ' ' + str(cell[2]) + ' ' + '\n')
43
- f.write('ALPHA_BETA_GAMMA ' + str(cell[3]) + ' ' + str(cell[4]) + ' ' + str(cell[5]) + '\n')
44
- if args.k:
45
- with open('kpoint.inc', 'w') as f:
46
- if True:
47
- if True:
48
- f.write(f"SCHEME MONKHORST-PACK {int(round(30/cell[0]))} {int(round(30/cell[1]))} {int(round(30/cell[2]))}" + "\n")
49
- else:
50
- atoms.write(args.o)
5
+ import numpy as np
6
+
7
+
8
+ @click.command(name='build_bulk')
9
+ @click.argument('symbol', type=str)
10
+ @click.argument('cs', type=click.Choice(['sc', 'fcc', 'bcc', 'tetragonal', 'bct', 'hcp', 'rhombohedral', 'orthorhombic', 'mcl', 'diamond', 'zincblende', 'rocksalt', 'cesiumchloride', 'fluorite', 'wurtzite']))
11
+ @click.option('-a', type=float, help='designate lattice constant a')
12
+ @click.option('-b', type=float, help='designate lattice constant b. if only a and b is given, b will be interpreted as c instead')
13
+ @click.option('-c', type=float, help='designate lattice constant c')
14
+ @click.option('--alpha', type=float, help='angle in degrees for rhombohedral lattice')
15
+ @click.option('--covera', type=float, help='c/a ratio used for hcp. Default is ideal ratio: sqrt(8/3)', default=np.sqrt(8/3), show_default=True)
16
+ @click.option('-u', type=float, help='internal coordinate for Wurtzite structure')
17
+ @click.option('--orth', is_flag=True, help='construct orthorhombic unit cell instead of primitive cell which is the default')
18
+ @click.option('--cubic', is_flag=True, help='construct cubic unit cell if possible')
19
+ def main(symbol, cs, a, b, c, alpha, covera, u, orth, cubic):
20
+ """
21
+ build a bulk structure
22
+ """
23
+
24
+ #if args.primitve:
25
+ # a = args.a * 0.7071 * 2
26
+ #else:
27
+ # a = args.a
28
+ atoms = bulk(symbol, cs, a=a, b=b, c=c, alpha=alpha, covera=covera, u=u, orthorhombic=orth, cubic=cubic)
29
+
30
+ atoms.write(f"{symbol}_{cs}.cif", format='cif')
51
31
 
52
32
 
53
33
  if __name__ == '__main__':
mdkits/mdkits.py CHANGED
@@ -8,6 +8,7 @@ from mdkits.cli import (
8
8
  density,
9
9
  cube,
10
10
  pdos,
11
+ build_bulk,
11
12
  )
12
13
 
13
14
 
@@ -27,6 +28,7 @@ cli.add_command(plot.main)
27
28
  cli.add_command(density.main)
28
29
  cli.add_command(cube.main)
29
30
  cli.add_command(pdos.main)
31
+ cli.add_command(build_bulk.main)
30
32
 
31
33
 
32
34
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mdkits
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: tools for md or dft
5
5
  License: MIT
6
6
  Keywords: molecular dynamics,density functional theory
@@ -97,6 +97,25 @@ mdkits cube [FILENAME] -b 1 2
97
97
  ```
98
98
  会将平均值打印在屏幕上, 同时记录在`cube.out`中的注释行.
99
99
 
100
+ ## 建模
101
+ ### 构建体相模型
102
+ `build_bulk`用于构建体相模型, 如构建`Pt`的`fcc`体相模型:
103
+ ```bash
104
+ mdkits build_bulk Pt fcc
105
+ ```
106
+ 构建为常胞模型:
107
+ ```bash
108
+ mdkits build_bulk Pt fcc --cubic
109
+ ```
110
+ 构建一个`Caesium chloride`结构的模型:
111
+ ```bash
112
+ mdkits build_bulk CsCl cesiumchloride -a 4.123
113
+ ```
114
+ 构建一个`fluorite `结构的模型:
115
+ ```bash
116
+ mdkits build_bulk BaF2 fluorite -a 6.196
117
+ ```
118
+
100
119
  ## 其他
101
120
  ### 轨迹提取
102
121
  `extract`用于提取轨迹文件中的特定的帧, 如从`frames.xyz`中提取第 1000 帧到第 2000 帧的轨迹文件, 并输出为`1000-2000.xyz`, `-r`选项的参数与`Python`的切片语法一致:
@@ -1,7 +1,7 @@
1
1
  mdkits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  "mdkits/cli/,hb_distribution_down.py",sha256=i3NguzGebqCgy4uuVBeFajZRZnXtjhsJBPDGDdumlWA,4733
3
3
  mdkits/cli/adsorbate.py,sha256=6PN6qVSzhOFLxjUal4T2Qk5W5XUWAUn5-JXS8-D0xqo,3126
4
- mdkits/cli/build_bulk.py,sha256=dto5Wj-RcpzaGvyqTamo-3UfjQFQ_6cjy5_lMG0grPk,2117
4
+ mdkits/cli/build_bulk.py,sha256=LJwC7IqDV_dY2cJJHwk9stqLu3wzbXxC87GMbyaalw0,1555
5
5
  mdkits/cli/build_interface.py,sha256=i1YE5iwazKVsTdQ_DXalNYeA8oflORWFePgJin1AJM4,3537
6
6
  mdkits/cli/build_surface.py,sha256=tL9rSv6MROPRtVUu8JiPJbt4YdHFVKTZrEUaSd3rlzI,5657
7
7
  mdkits/cli/convert.py,sha256=s2q2Py7IVGNTctHgpHm66YFj_Rr8srnpuJudrMBI0oM,2014
@@ -21,7 +21,7 @@ mdkits/cli/supercell.py,sha256=r5iddLw1NNzj7NTFlR2j_jpD1AMfrsxhA08bPwQvVvg,2059
21
21
  mdkits/cli/wrap.py,sha256=AUxGISuiCfEjdMYl-TKc2VMCPHSybWKrMIOTn_6kSp0,1043
22
22
  mdkits/config/__init__.py,sha256=ZSwmnPK02LxJLMgcYmNb-tIOk8fEuHf5jpqD3SDHWLg,1039
23
23
  mdkits/config/settings.yml,sha256=PY7u0PbFLuxSnd54H5tI9oMjUf-mzyADqSZtm99BwG0,71
24
- mdkits/mdkits.py,sha256=S4aVIxiS9tcuuELSTGpXlZtOsNhLNyc31uzLV_pEyeE,550
24
+ mdkits/mdkits.py,sha256=cItenwSa9YWtd-YGg49l52VoIBDWqqeZmPIdx6LcqU0,601
25
25
  mdkits/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  mdkits/util/arg_type.py,sha256=YUFhYShTYfUe7xajgUCiCuaeNLH-wxMXvlcMRax4zRM,1469
27
27
  mdkits/util/cp2k_input_parsing.py,sha256=6BFVsbBYxdauaUPrjr5h8JXk_R0bu7V3cbG2DEWWFlQ,1291
@@ -31,8 +31,8 @@ mdkits/util/fig_operation.py,sha256=FwffNUtXorMl6qE04FipgzcVljEQii7wrNJUCJMyY3E,
31
31
  mdkits/util/numpy_geo.py,sha256=1Op8THoQeyqybSZAi7hVxohYCr4SzY6ndZC8_gAGXDA,3619
32
32
  mdkits/util/os_operation.py,sha256=tNRjniDwFqARMy5Rf6MUNmaQGpJlyifCpuN16r8aB2g,828
33
33
  mdkits/util/structure_parsing.py,sha256=mRPMJeih3O-ST7HeETDvBEkfV-1psT-XgxyYgDadV0U,4152
34
- mdkits-0.1.3.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
35
- mdkits-0.1.3.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
36
- mdkits-0.1.3.dist-info/METADATA,sha256=FeNoHay-d-Lp8q4_b_LaifawnqxesqgeZBlnVvEqHEA,6074
37
- mdkits-0.1.3.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
38
- mdkits-0.1.3.dist-info/RECORD,,
34
+ mdkits-0.1.4.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
35
+ mdkits-0.1.4.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
36
+ mdkits-0.1.4.dist-info/METADATA,sha256=i_qFaaji3Kb0FL8KGYaQPLHuhPhskcTM9pizTqIfeTE,6485
37
+ mdkits-0.1.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
38
+ mdkits-0.1.4.dist-info/RECORD,,
File without changes