mdkits 0.1.1__py3-none-any.whl → 0.1.3__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/cube.py +28 -48
- mdkits/cli/pdos.py +31 -30
- mdkits/mdkits.py +5 -1
- mdkits/util/encapsulated_ase.py +4 -4
- {mdkits-0.1.1.dist-info → mdkits-0.1.3.dist-info}/METADATA +15 -4
- {mdkits-0.1.1.dist-info → mdkits-0.1.3.dist-info}/RECORD +9 -9
- {mdkits-0.1.1.dist-info → mdkits-0.1.3.dist-info}/LICENSE +0 -0
- {mdkits-0.1.1.dist-info → mdkits-0.1.3.dist-info}/WHEEL +0 -0
- {mdkits-0.1.1.dist-info → mdkits-0.1.3.dist-info}/entry_points.txt +0 -0
mdkits/cli/cube.py
CHANGED
|
@@ -1,59 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## cycle parameter is need to pay attention
|
|
7
|
-
## buck range is need to pay attention
|
|
8
|
-
################################################
|
|
3
|
+
import numpy as np
|
|
4
|
+
import click
|
|
5
|
+
from mdkits.util import encapsulated_ase, os_operation
|
|
9
6
|
|
|
10
|
-
from numpy import empty, array, mean, append, concatenate
|
|
11
|
-
from argparse import ArgumentParser
|
|
12
|
-
from util import encapsulated_ase, os_operation
|
|
13
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
|
|
14
13
|
|
|
15
|
-
def array_type(string):
|
|
16
|
-
number_list = string.split(',')
|
|
17
|
-
number_array = array(number_list, dtype=float)
|
|
18
|
-
return number_array
|
|
19
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
|
+
"""
|
|
20
23
|
|
|
21
|
-
|
|
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
|
|
24
|
+
cube_data = encapsulated_ase.ave_cube(filename)
|
|
27
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')
|
|
28
34
|
|
|
29
|
-
|
|
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')
|
|
35
|
+
|
|
34
36
|
|
|
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
37
|
|
|
38
|
+
if __name__ == '__main__':
|
|
39
|
+
main()
|
mdkits/cli/pdos.py
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
# caculate pdos
|
|
1
|
+
#!/usr/bin/env python3
|
|
4
2
|
|
|
5
3
|
from cp2kdata import Cp2kPdos
|
|
6
|
-
import
|
|
4
|
+
import click
|
|
7
5
|
import numpy as np
|
|
8
|
-
from util import os_operation
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def to_file(filename, ener, dos):
|
|
12
|
-
to_file = np.column_stack((ener, dos))
|
|
13
|
-
np.savetxt(filename, to_file, delimiter=" ")
|
|
6
|
+
from mdkits.util import os_operation
|
|
14
7
|
|
|
15
8
|
|
|
16
9
|
# set argument
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
print(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
10
|
+
@click.command(name='pdos')
|
|
11
|
+
@click.argument('filename', type=list, default=os_operation.default_file_name('*-k*.pdos'))
|
|
12
|
+
@click.option('-t', '--type', type=str, default='total', show_default=True)
|
|
13
|
+
@click.option('-c', '--clos', type=tuple)
|
|
14
|
+
def main(filename, type, clos):
|
|
15
|
+
if type == 'total':
|
|
16
|
+
dos_obj = Cp2kPdos(filename[0])
|
|
17
|
+
dos, ener = dos_obj.get_raw_dos(dos_type=type)
|
|
18
|
+
print(f"analysis of total dos is done")
|
|
19
|
+
np.savetxt('total.pdos', np.column_stack((ener, dos)), header='energy\tdos')
|
|
20
|
+
else:
|
|
21
|
+
if type:
|
|
22
|
+
for file in filename:
|
|
23
|
+
dos_obj = Cp2kPdos(file)
|
|
24
|
+
dos, ener = dos_obj.get_raw_dos(dos_type=type)
|
|
25
|
+
print(f"analysis of {file}'s {type} dos is done")
|
|
26
|
+
np.savetxt(f'{dos_obj.read_dos_element()}_{type}.pdos', np.column_stack((ener, dos)), header='energy\tdos')
|
|
27
|
+
|
|
28
|
+
if clos:
|
|
29
|
+
for file in filename:
|
|
30
|
+
dos_obj = Cp2kPdos(file)
|
|
31
|
+
dos, ener = dos_obj.get_raw_dos(usecols=clos)
|
|
32
|
+
print(f"analysis of {file}'s {type} dos is done")
|
|
33
|
+
np.savetxt(f'{dos_obj.read_dos_element()}_{"_".join(clos)}.pdos', np.column_stack((ener, dos)), header='energy\tdos')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if __name__ == '__main__':
|
|
37
|
+
main()
|
mdkits/mdkits.py
CHANGED
|
@@ -5,7 +5,9 @@ from mdkits.cli import (
|
|
|
5
5
|
extract,
|
|
6
6
|
data,
|
|
7
7
|
plot,
|
|
8
|
-
density
|
|
8
|
+
density,
|
|
9
|
+
cube,
|
|
10
|
+
pdos,
|
|
9
11
|
)
|
|
10
12
|
|
|
11
13
|
|
|
@@ -23,6 +25,8 @@ cli.add_command(extract.main)
|
|
|
23
25
|
cli.add_command(data.main)
|
|
24
26
|
cli.add_command(plot.main)
|
|
25
27
|
cli.add_command(density.main)
|
|
28
|
+
cli.add_command(cube.main)
|
|
29
|
+
cli.add_command(pdos.main)
|
|
26
30
|
|
|
27
31
|
|
|
28
32
|
if __name__ == '__main__':
|
mdkits/util/encapsulated_ase.py
CHANGED
|
@@ -65,13 +65,13 @@ def rdf(chunk, cell, bin_size, name, parallel=True):
|
|
|
65
65
|
ana.clear_cache()
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
def
|
|
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
|
-
|
|
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
|
-
|
|
85
|
-
return
|
|
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,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: mdkits
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: tools for md or dft
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: molecular dynamics,density functional theory
|
|
@@ -81,10 +81,21 @@ mdkits wrap [FILENAME] --cell 10,10,10
|
|
|
81
81
|
|
|
82
82
|
## DFT 性质分析脚本
|
|
83
83
|
### PDOS
|
|
84
|
+
`pdos`用于分析体系中的pdos, 分析[FILENAME]的d轨道的dos:
|
|
85
|
+
```bash
|
|
86
|
+
mdkits pdos [FILENAME] -t d
|
|
87
|
+
```
|
|
84
88
|
|
|
85
|
-
###
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
### CUBE 文件
|
|
90
|
+
`cube`用于处理[`cube`格式](https://paulbourke.net/dataformats/cube/)的文件, 将其在z轴上进行平均:
|
|
91
|
+
```bash
|
|
92
|
+
mdkits cube [FILENAME]
|
|
93
|
+
```
|
|
94
|
+
分析好的数据会输出为`cube.out`, 可以同时计算一个区域内的平均值:
|
|
95
|
+
```bash
|
|
96
|
+
mdkits cube [FILENAME] -b 1 2
|
|
97
|
+
```
|
|
98
|
+
会将平均值打印在屏幕上, 同时记录在`cube.out`中的注释行.
|
|
88
99
|
|
|
89
100
|
## 其他
|
|
90
101
|
### 轨迹提取
|
|
@@ -5,7 +5,7 @@ mdkits/cli/build_bulk.py,sha256=dto5Wj-RcpzaGvyqTamo-3UfjQFQ_6cjy5_lMG0grPk,2117
|
|
|
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
|
|
8
|
-
mdkits/cli/cube.py,sha256=
|
|
8
|
+
mdkits/cli/cube.py,sha256=G-QNup8W6J1-LCcEl1EHsV3nstd23byePDOcE_95t18,1176
|
|
9
9
|
mdkits/cli/cut_surface.py,sha256=D1naCWj0QJE3AiInzy3SeGO37butothE3BS1rZsZ5MU,1425
|
|
10
10
|
mdkits/cli/data.py,sha256=FGA4S9Cfo6WUJBSPWKOJrrZXHo_Qza-jNG1P_Dw7yi4,3262
|
|
11
11
|
mdkits/cli/density.py,sha256=Y4grT8p7CsxggGYo_nGE9z_wlkJeQS5eYWKJQcoA014,5559
|
|
@@ -15,24 +15,24 @@ mdkits/cli/hartree_potential_ave.py,sha256=25oy3QsgIdxrTFpTqpnGvLAheb-d6poeLMN7i
|
|
|
15
15
|
mdkits/cli/hb.py,sha256=lADr4tlctbtQ3_f_UpznkLnSI0MJlAT-pknEf_dwrnU,5330
|
|
16
16
|
mdkits/cli/hb_distribution.py,sha256=VpTyOhU9oucWUnqUSmLgZfMb5g0tR0q7vrxakLSrKxI,5120
|
|
17
17
|
mdkits/cli/packmol_input.py,sha256=76MjjMMRDaW2q459B5mEpXDYSSn14W-JXudOOsx-8E4,2849
|
|
18
|
-
mdkits/cli/pdos.py,sha256=
|
|
18
|
+
mdkits/cli/pdos.py,sha256=ALAZ5uOaoT0UpCyKYleWxwmk569HMzKTTK-lMJeicM8,1411
|
|
19
19
|
mdkits/cli/plot.py,sha256=1yh5dq5jnQDuyWlxV_9g5ztsnuFHVu4ouYQ9VJYSrUU,8938
|
|
20
20
|
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=
|
|
24
|
+
mdkits/mdkits.py,sha256=S4aVIxiS9tcuuELSTGpXlZtOsNhLNyc31uzLV_pEyeE,550
|
|
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
|
|
28
|
-
mdkits/util/encapsulated_ase.py,sha256=
|
|
28
|
+
mdkits/util/encapsulated_ase.py,sha256=rmL80U3M8SsEU2M6QtLyiam2N1FIbrm5dK3P14p1EPg,4093
|
|
29
29
|
mdkits/util/encapsulated_mda.py,sha256=td3H24u3eHOIS2nwPucfIaMxeaVxI77oFI8nnNhw7vo,2217
|
|
30
30
|
mdkits/util/fig_operation.py,sha256=FwffNUtXorMl6qE04FipgzcVljEQii7wrNJUCJMyY3E,1045
|
|
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.
|
|
35
|
-
mdkits-0.1.
|
|
36
|
-
mdkits-0.1.
|
|
37
|
-
mdkits-0.1.
|
|
38
|
-
mdkits-0.1.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|