mdkits 0.1.1__tar.gz → 0.1.2__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 (38) hide show
  1. {mdkits-0.1.1 → mdkits-0.1.2}/PKG-INFO +11 -4
  2. {mdkits-0.1.1 → mdkits-0.1.2}/README.md +10 -3
  3. {mdkits-0.1.1 → mdkits-0.1.2}/pyproject.toml +1 -1
  4. mdkits-0.1.2/src/mdkits/cli/cube.py +39 -0
  5. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/mdkits.py +3 -1
  6. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/encapsulated_ase.py +4 -4
  7. mdkits-0.1.1/src/mdkits/cli/cube.py +0 -59
  8. {mdkits-0.1.1 → mdkits-0.1.2}/LICENSE +0 -0
  9. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/__init__.py +0 -0
  10. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/,hb_distribution_down.py +0 -0
  11. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/adsorbate.py +0 -0
  12. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/build_bulk.py +0 -0
  13. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/build_interface.py +0 -0
  14. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/build_surface.py +0 -0
  15. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/convert.py +0 -0
  16. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/cut_surface.py +0 -0
  17. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/data.py +0 -0
  18. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/density.py +0 -0
  19. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/extract.py +0 -0
  20. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/hartree_potential.py +0 -0
  21. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/hartree_potential_ave.py +0 -0
  22. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/hb.py +0 -0
  23. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/hb_distribution.py +0 -0
  24. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/packmol_input.py +0 -0
  25. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/pdos.py +0 -0
  26. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/plot.py +0 -0
  27. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/supercell.py +0 -0
  28. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/cli/wrap.py +0 -0
  29. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/config/__init__.py +0 -0
  30. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/config/settings.yml +0 -0
  31. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/__init__.py +0 -0
  32. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/arg_type.py +0 -0
  33. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/cp2k_input_parsing.py +0 -0
  34. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/encapsulated_mda.py +0 -0
  35. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/fig_operation.py +0 -0
  36. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/numpy_geo.py +0 -0
  37. {mdkits-0.1.1 → mdkits-0.1.2}/src/mdkits/util/os_operation.py +0 -0
  38. {mdkits-0.1.1 → mdkits-0.1.2}/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.1
3
+ Version: 0.1.2
4
4
  Summary: tools for md or dft
5
5
  License: MIT
6
6
  Keywords: molecular dynamics,density functional theory
@@ -82,9 +82,16 @@ mdkits wrap [FILENAME] --cell 10,10,10
82
82
  ## DFT 性质分析脚本
83
83
  ### PDOS
84
84
 
85
- ### 静电势
86
-
87
- ### 电荷差分
85
+ ### CUBE 文件
86
+ `cube`用于处理[`cube`格式](https://paulbourke.net/dataformats/cube/)的文件, 将其在z轴上进行平均:
87
+ ```bash
88
+ mdkits cube [FILENAME]
89
+ ```
90
+ 分析好的数据会输出为`cube.out`, 可以同时计算一个区域内的平均值:
91
+ ```bash
92
+ mdkits cube [FILENAME] -b 1 2
93
+ ```
94
+ 会将平均值打印在屏幕上, 同时记录在`cube.out`中的注释行.
88
95
 
89
96
  ## 其他
90
97
  ### 轨迹提取
@@ -57,9 +57,16 @@ mdkits wrap [FILENAME] --cell 10,10,10
57
57
  ## DFT 性质分析脚本
58
58
  ### PDOS
59
59
 
60
- ### 静电势
61
-
62
- ### 电荷差分
60
+ ### CUBE 文件
61
+ `cube`用于处理[`cube`格式](https://paulbourke.net/dataformats/cube/)的文件, 将其在z轴上进行平均:
62
+ ```bash
63
+ mdkits cube [FILENAME]
64
+ ```
65
+ 分析好的数据会输出为`cube.out`, 可以同时计算一个区域内的平均值:
66
+ ```bash
67
+ mdkits cube [FILENAME] -b 1 2
68
+ ```
69
+ 会将平均值打印在屏幕上, 同时记录在`cube.out`中的注释行.
63
70
 
64
71
  ## 其他
65
72
  ### 轨迹提取
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mdkits"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "tools for md or dft"
5
5
  readme = "README.md"
6
6
  authors = ["jxxcr <jixxcr@qq.com>"]
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import numpy as np
4
+ import click
5
+ from mdkits.util import encapsulated_ase, os_operation
6
+
7
+
8
+ def ave_cube_data(cube_data, range):
9
+ mask = (cube_data[:,0] >= range[0]) & (cube_data[:,0] <=range[1])
10
+ bulk_cube_data = cube_data[mask]
11
+ ave_cube_data = np.mean(bulk_cube_data[:,1])
12
+ return ave_cube_data
13
+
14
+
15
+ @click.command(name='cube')
16
+ @click.argument('filename', type=click.Path(exists=True), default=os_operation.default_file_name('*.cube', last=True))
17
+ @click.option('-b', '--bulk_range', type=(float, float), help='parameter to calculate mean value of bulk', default=None)
18
+ @click.option('-o', type=str, help='output file name, default is "cube.out"', default='cube.out', show_default=True)
19
+ def main(filename, bulk_range, o):
20
+ """
21
+ analysis cube file
22
+ """
23
+
24
+ cube_data = encapsulated_ase.ave_cube(filename)
25
+
26
+ ## if bulk range is exit, out put a difference of cube_data
27
+ if bulk_range is not None:
28
+ bulk_cube_data = ave_cube_data(cube_data, bulk_range)
29
+ print(bulk_cube_data)
30
+ np.savetxt(o, cube_data, header=f'Z\tcube_data\t area average is: {bulk_cube_data}')
31
+
32
+ else:
33
+ np.savetxt(o, cube_data, header='Z\tcube_data')
34
+
35
+
36
+
37
+
38
+ if __name__ == '__main__':
39
+ main()
@@ -5,7 +5,8 @@ from mdkits.cli import (
5
5
  extract,
6
6
  data,
7
7
  plot,
8
- density
8
+ density,
9
+ cube,
9
10
  )
10
11
 
11
12
 
@@ -23,6 +24,7 @@ cli.add_command(extract.main)
23
24
  cli.add_command(data.main)
24
25
  cli.add_command(plot.main)
25
26
  cli.add_command(density.main)
27
+ cli.add_command(cube.main)
26
28
 
27
29
 
28
30
  if __name__ == '__main__':
@@ -65,13 +65,13 @@ def rdf(chunk, cell, bin_size, name, parallel=True):
65
65
  ana.clear_cache()
66
66
 
67
67
 
68
- def ave_potential(filepath):
68
+ def ave_cube(filepath):
69
69
  """
70
70
  function: average hartree file in z_coordinate
71
71
  parameter:
72
72
  filepath: hartree cube file path
73
73
  return:
74
- z_potential: a list of potential alone z axes
74
+ z_cube_data: a list of cube data alone z axes
75
75
  z_coordinates: a list of coordinates of z axes
76
76
  """
77
77
  # read data from filepath
@@ -81,8 +81,8 @@ def ave_potential(filepath):
81
81
  step_size = atoms.cell[2, 2] / ( npoints - 1 )
82
82
  # average hartree file, and calculate z_coordinates
83
83
  z_coordinates = [i * step_size for i in range(npoints)]
84
- z_potential = 27.2114 * data[:, :, :].sum(axis=(0, 1)) / ( data.shape[0] * data.shape[1] )
85
- return z_potential, z_coordinates
84
+ z_cube_data = data[:, :, :].sum(axis=(0, 1)) / ( data.shape[0] * data.shape[1] )
85
+ return np.column_stack((z_coordinates, z_cube_data))
86
86
 
87
87
 
88
88
  def atoms_read_with_cell(file_name, cell=None, coord_mode=False, default_cell=np.array([0., 0., 0., 90., 90., 90.])):
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- ################################################
4
- # averange cp2k output(or some else file correspond to ase.io.read_cube_data) hartree.cube to z coordinate with python
5
- ## file path is need to pay attention
6
- ## cycle parameter is need to pay attention
7
- ## buck range is need to pay attention
8
- ################################################
9
-
10
- from numpy import empty, array, mean, append, concatenate
11
- from argparse import ArgumentParser
12
- from util import encapsulated_ase, os_operation
13
-
14
-
15
- def array_type(string):
16
- number_list = string.split(',')
17
- number_array = array(number_list, dtype=float)
18
- return number_array
19
-
20
-
21
- def buck_potential(xaxe, potential, range):
22
- mix = concatenate((xaxe.reshape(-1, 1), potential.reshape(-1, 1)), axis=1)
23
- mask = (mix[:,0] >= range[0]) & (mix[:,0] <=range[1])
24
- buck_potential = mix[mask]
25
- ave_potential = mean(buck_potential[:,1])
26
- return ave_potential
27
-
28
-
29
- # set argument
30
- parser = ArgumentParser(description='to handle cp2k output file hartree cube, name should be "hartree-*.cube"')
31
- parser.add_argument('file_name', type=str, nargs='?', help='hartree cube file', default=os_operation.default_file_name('*-v_hartree-1_*.cube', last=True))
32
- parser.add_argument('-b', '--buck_range', type=array_type, help='parameter to calculate mean value of buck', default=None)
33
- parser.add_argument('-o', type=str, help='output file name, default is "out.put"', default='hartree.out')
34
-
35
- args = parser.parse_args()
36
-
37
-
38
- ## init output potential file's shape, and define a z axe
39
- init_array = encapsulated_ase.ave_potential(args.file_name)
40
- potential = empty((0, init_array[0].shape[0]))
41
- z_coordinates = array((init_array[1])).reshape(-1, 1)
42
-
43
- potential = encapsulated_ase.ave_potential(args.file_name)[0]
44
-
45
- aved = mean(potential, axis=0)
46
- total_potential = append(z_coordinates, potential.reshape(-1, 1), axis=1)
47
-
48
- ## if buck range is exit, out put a difference of potential
49
- if args.buck_range is not None:
50
- buck_potential = buck_potential(z_coordinates, potential, args.buck_range)
51
- print(buck_potential)
52
- with open('hartree_potential.dat', 'w') as f:
53
- f.write(f"{buck_potential}" + '\n')
54
-
55
- ## write output
56
- with open(args.o, 'w') as f:
57
- for value in total_potential:
58
- f.write(" ".join(map(str, value)) + '\n')
59
-
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