mdkits 0.1.13__py3-none-any.whl → 1.2.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.
- mdkits/build_cli/adsorbate.py +2 -1
- mdkits/build_cli/build_bulk.py +2 -1
- mdkits/build_cli/build_interface.py +5 -0
- mdkits/build_cli/build_solution.py +48 -4
- mdkits/build_cli/build_surface.py +2 -5
- mdkits/build_cli/cut_surface.py +1 -1
- mdkits/build_cli/supercell.py +1 -1
- mdkits/cli/convert.py +1 -1
- mdkits/cli/extract.py +29 -18
- mdkits/{cli → dft_cli/.back}/pdos.py +1 -0
- mdkits/dft_cli/check_neb.py +0 -0
- mdkits/{cli → dft_cli}/cube.py +3 -2
- mdkits/dft_cli/dft_cli.py +23 -0
- mdkits/dft_cli/fix.py +54 -0
- mdkits/dft_cli/pdos.py +119 -0
- mdkits/md_cli/angle.py +122 -0
- mdkits/{cli → md_cli}/density.py +24 -19
- mdkits/md_cli/dipole.py +124 -0
- mdkits/md_cli/hb_distribution.py +185 -0
- mdkits/md_cli/md_cli.py +32 -0
- mdkits/md_cli/monitor.py +104 -0
- mdkits/md_cli/msd.py +44 -0
- mdkits/md_cli/rdf.py +53 -0
- mdkits/md_cli/setting.py +14 -0
- mdkits/md_cli/vac.py +65 -0
- mdkits/{cli → md_cli}/wrap.py +4 -3
- mdkits/mdkits.py +5 -9
- mdkits/util/.fig_operation.py.swp +0 -0
- mdkits/util/arg_type.py +18 -8
- mdkits/util/cp2k_input_parsing.py +5 -1
- mdkits/util/encapsulated_ase.py +28 -7
- mdkits/util/encapsulated_mda.py +4 -1
- mdkits/util/numpy_geo.py +10 -5
- mdkits/util/os_operation.py +3 -1
- mdkits/util/out_err.py +18 -6
- mdkits-1.2.3.dist-info/METADATA +370 -0
- mdkits-1.2.3.dist-info/RECORD +51 -0
- mdkits/cli/,hb_distribution_down.py +0 -114
- mdkits/cli/hartree_potential.py +0 -59
- mdkits/cli/hartree_potential_ave.py +0 -84
- mdkits/cli/hb.py +0 -101
- mdkits/cli/hb_distribution.py +0 -126
- mdkits/cli/packmol_input.py +0 -76
- mdkits-0.1.13.dist-info/METADATA +0 -226
- mdkits-0.1.13.dist-info/RECORD +0 -43
- {mdkits-0.1.13.dist-info → mdkits-1.2.3.dist-info}/LICENSE +0 -0
- {mdkits-0.1.13.dist-info → mdkits-1.2.3.dist-info}/WHEEL +0 -0
- {mdkits-0.1.13.dist-info → mdkits-1.2.3.dist-info}/entry_points.txt +0 -0
mdkits/cli/hb.py
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
import argparse, multiprocessing, os
|
|
4
|
-
import numpy as np
|
|
5
|
-
from util import (
|
|
6
|
-
structure_parsing,
|
|
7
|
-
numpy_geo,
|
|
8
|
-
os_operation,
|
|
9
|
-
cp2k_input_parsing,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def hb_count(chunk, index, cell, filename, hb_distance=3.5, hb_angle=35):
|
|
14
|
-
groups = structure_parsing.chunk_to_groups(chunk)
|
|
15
|
-
groups_hb_list = []
|
|
16
|
-
coefficients = numpy_geo.cell_to_wrap_coefficients(cell)
|
|
17
|
-
for group in groups:
|
|
18
|
-
group_hb_array = np.zeros((3, 1))
|
|
19
|
-
present_index = index
|
|
20
|
-
o_present = group[present_index].split()
|
|
21
|
-
if o_present[0] == 'O':
|
|
22
|
-
o_present = np.array(o_present[1:], dtype=np.float64)
|
|
23
|
-
group_hb_array[2, 0] += 1
|
|
24
|
-
for other_index in range(2, len(group)):
|
|
25
|
-
o_other = group[other_index].split()
|
|
26
|
-
if o_other[0] == 'O':
|
|
27
|
-
o_other = np.array(o_other[1:], dtype=np.float64)
|
|
28
|
-
oo_distance, o_other = numpy_geo.unwrap(o_present, o_other, coefficients, max=0)
|
|
29
|
-
if oo_distance < hb_distance and oo_distance > 1:
|
|
30
|
-
_, o_present_h1 = numpy_geo.unwrap(o_present, np.array(group[present_index+1].split()[1:], dtype=np.float64), coefficients)
|
|
31
|
-
_, o_present_h2 = numpy_geo.unwrap(o_present, np.array(group[present_index+2].split()[1:], dtype=np.float64), coefficients)
|
|
32
|
-
_, o_other_h1 = numpy_geo.unwrap(o_other, np.array(group[other_index+1].split()[1:], dtype=np.float64), coefficients)
|
|
33
|
-
_, o_other_h2 = numpy_geo.unwrap(o_other, np.array(group[other_index+2].split()[1:], dtype=np.float64), coefficients)
|
|
34
|
-
|
|
35
|
-
o_present_o_other_h1_angle = numpy_geo.vector_vector_angle(o_present-o_other, o_other_h1-o_other)
|
|
36
|
-
o_present_o_other_h2_angle = numpy_geo.vector_vector_angle(o_present-o_other, o_other_h2-o_other)
|
|
37
|
-
if o_present_o_other_h1_angle < hb_angle or o_present_o_other_h2_angle < hb_angle:
|
|
38
|
-
group_hb_array[0, 0] += 1
|
|
39
|
-
o_other_o_present_h1_angle = numpy_geo.vector_vector_angle(o_other-o_present, o_present_h1-o_present)
|
|
40
|
-
o_other_o_present_h2_angle = numpy_geo.vector_vector_angle(o_other-o_present, o_present_h2-o_present)
|
|
41
|
-
if o_other_o_present_h1_angle < hb_angle or o_other_o_present_h2_angle < hb_angle:
|
|
42
|
-
group_hb_array[1, 0] += 1
|
|
43
|
-
groups_hb_list.append(group_hb_array)
|
|
44
|
-
groups_hb_array = np.vstack(groups_hb_list)
|
|
45
|
-
group_hb_acc_array = np.sum(groups_hb_array[0::3], axis=0).reshape(1, -1)
|
|
46
|
-
group_hb_don_array = np.sum(groups_hb_array[1::3], axis=0).reshape(1, -1)
|
|
47
|
-
group_hb_num_array = np.sum(groups_hb_array[2::3], axis=0).reshape(1, -1)
|
|
48
|
-
group_hb_array = np.vstack([group_hb_acc_array, group_hb_don_array, group_hb_num_array])
|
|
49
|
-
np.save(filename, group_hb_array)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def parse_data(s):
|
|
53
|
-
return [float(x) for x in s.replace(',', ' ').split()]
|
|
54
|
-
|
|
55
|
-
def parse_argument():
|
|
56
|
-
parser = argparse.ArgumentParser(description="analysis an O atom's hydrogen bond in water")
|
|
57
|
-
parser.add_argument('index', type=int, help='index of target atom in coord.xyz, or all of hb distribution on z')
|
|
58
|
-
parser.add_argument('input_file_name', type=str, nargs='?', help='input file name', default=os_operation.default_file_name('wraped.xyz', last=True))
|
|
59
|
-
parser.add_argument('--cp2k_input_file', type=str, help='input file name of cp2k, default is "input.inp"', default='input.inp')
|
|
60
|
-
parser.add_argument('--cell', type=parse_data, help='set cell, a list of lattice, --cell x,y,z or x,y,z,a,b,c')
|
|
61
|
-
parser.add_argument('--hb_param', type=parse_data, help='[hb_distance, hb_angle], default is [3.5, 35]', default=[3.5, 35])
|
|
62
|
-
parser.add_argument('--process', type=int, help='paralle process number default is 28', default=28)
|
|
63
|
-
parser.add_argument('--temp', help='keep temp file', action='store_false')
|
|
64
|
-
|
|
65
|
-
return parser.parse_args()
|
|
66
|
-
|
|
67
|
-
def main():
|
|
68
|
-
args = parse_argument()
|
|
69
|
-
output = f'./hb_{args.index}.dat'
|
|
70
|
-
cell = cp2k_input_parsing.get_cell(args.cp2k_input_file, args.cell)
|
|
71
|
-
chunks = structure_parsing.xyz_to_chunks(args.input_file_name, args.process)
|
|
72
|
-
temp_dir = f'{os.environ.get("TEMP_DIR")}/{os.getpid()}'
|
|
73
|
-
os_operation.make_temp_dir(temp_dir, delete=args.temp)
|
|
74
|
-
|
|
75
|
-
for index, chunk in enumerate(chunks):
|
|
76
|
-
t = multiprocessing.Process(target=hb_count, args=[chunk, args.index, cell, f'{temp_dir}/chunk_{index}.temp'])
|
|
77
|
-
t.start()
|
|
78
|
-
|
|
79
|
-
for t in multiprocessing.active_children():
|
|
80
|
-
t.join()
|
|
81
|
-
|
|
82
|
-
chunks_array_list = []
|
|
83
|
-
for i in range(len(chunks)):
|
|
84
|
-
chunk_array = np.load(f'{temp_dir}/chunk_{i}.temp.npy')
|
|
85
|
-
chunks_array_list.append(chunk_array)
|
|
86
|
-
chunks_array = np.vstack(chunks_array_list)
|
|
87
|
-
chunks_array = np.mean(chunks_array, axis=1)
|
|
88
|
-
|
|
89
|
-
with open(output, 'w') as f:
|
|
90
|
-
f.write(f"# {args.index}\n")
|
|
91
|
-
f.write(f"accepter : {chunks_array[0]:.2f}\n")
|
|
92
|
-
f.write(f"donor : {chunks_array[1]:.2f}\n")
|
|
93
|
-
f.write(f"total : {chunks_array[0]+chunks_array[1]:.2f}\n")
|
|
94
|
-
print(f"# {args.index}")
|
|
95
|
-
print(f"accepter : {chunks_array[0]:.2f}")
|
|
96
|
-
print(f"donor : {chunks_array[1]:.2f}")
|
|
97
|
-
print(f"total : {chunks_array[0]+chunks_array[1]:.2f}")
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if __name__ == '__main__':
|
|
101
|
-
main()
|
mdkits/cli/hb_distribution.py
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
import argparse
|
|
5
|
-
import MDAnalysis
|
|
6
|
-
from MDAnalysis import Universe
|
|
7
|
-
from MDAnalysis.analysis.base import AnalysisBase
|
|
8
|
-
from util import cp2k_input_parsing
|
|
9
|
-
import warnings
|
|
10
|
-
warnings.filterwarnings("ignore")
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Hb_distribution(AnalysisBase):
|
|
14
|
-
def __init__(self, filename, cell, surface, dt=0.001, hb_distance=3.5, hb_angle=35, bin_size=0.2):
|
|
15
|
-
u = Universe(filename)
|
|
16
|
-
u.trajectory.ts.dt = dt
|
|
17
|
-
u.dimensions = cell
|
|
18
|
-
self.u = u
|
|
19
|
-
self.atomgroup = u.select_atoms("all")
|
|
20
|
-
self.hb_distance = hb_distance
|
|
21
|
-
self.hb_angle = hb_angle
|
|
22
|
-
self.bin_size = bin_size
|
|
23
|
-
self.surface = surface
|
|
24
|
-
self.frame_count = 0
|
|
25
|
-
super(Hb_distribution, self).__init__(self.atomgroup.universe.trajectory, verbose=True)
|
|
26
|
-
|
|
27
|
-
def _prepare(self):
|
|
28
|
-
bin_num = int(self.u.dimensions[2] / self.bin_size) + 2
|
|
29
|
-
self.accepter = np.zeros(bin_num, dtype=np.float64)
|
|
30
|
-
self.donor = np.zeros(bin_num, dtype=np.float64)
|
|
31
|
-
|
|
32
|
-
def _append(self, hb_d, hb_a):
|
|
33
|
-
bins_d = np.floor(hb_d / self.bin_size).astype(int) + 1
|
|
34
|
-
bins_a = np.floor(hb_a / self.bin_size).astype(int) + 1
|
|
35
|
-
|
|
36
|
-
bins_d = bins_d[bins_d < len(self.donor)]
|
|
37
|
-
bins_a = bins_a[bins_a < len(self.accepter)]
|
|
38
|
-
|
|
39
|
-
np.add.at(self.donor, bins_d, 1)
|
|
40
|
-
np.add.at(self.accepter, bins_a, 1)
|
|
41
|
-
|
|
42
|
-
self.frame_count += 1
|
|
43
|
-
|
|
44
|
-
def _single_frame(self):
|
|
45
|
-
o_group = self.atomgroup.select_atoms("name O")
|
|
46
|
-
o_pair = MDAnalysis.lib.distances.capped_distance(o_group.positions, o_group.positions, min_cutoff=0, max_cutoff=self.hb_distance, box=self.u.dimensions, return_distances=False)
|
|
47
|
-
|
|
48
|
-
o0 = o_group[o_pair[:, 0]]
|
|
49
|
-
o1 = o_group[o_pair[:, 1]]
|
|
50
|
-
|
|
51
|
-
o0h1 = self.atomgroup[o0.indices + 1]
|
|
52
|
-
o0h2 = self.atomgroup[o0.indices + 2]
|
|
53
|
-
o1h1 = self.atomgroup[o1.indices + 1]
|
|
54
|
-
o1h2 = self.atomgroup[o1.indices + 2]
|
|
55
|
-
|
|
56
|
-
angle_o0h1_o0_o1 = np.degrees(
|
|
57
|
-
MDAnalysis.lib.distances.calc_angles(o0h1.positions, o0.positions, o1.positions, box=self.u.dimensions)
|
|
58
|
-
)
|
|
59
|
-
angle_o0h2_o0_o1 = np.degrees(
|
|
60
|
-
MDAnalysis.lib.distances.calc_angles(o0h2.positions, o0.positions, o1.positions, box=self.u.dimensions)
|
|
61
|
-
)
|
|
62
|
-
angle_o1h1_o1_o0 = np.degrees(
|
|
63
|
-
MDAnalysis.lib.distances.calc_angles(o1h1.positions, o1.positions, o0.positions, box=self.u.dimensions)
|
|
64
|
-
)
|
|
65
|
-
angle_o1h2_o1_o0 = np.degrees(
|
|
66
|
-
MDAnalysis.lib.distances.calc_angles(o1h2.positions, o1.positions, o0.positions, box=self.u.dimensions)
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
condition_d = (angle_o0h1_o0_o1 < self.hb_angle) | (angle_o0h2_o0_o1 < self.hb_angle)
|
|
70
|
-
condition_a = (angle_o1h1_o1_o0 < self.hb_angle) | (angle_o1h2_o1_o0 < self.hb_angle)
|
|
71
|
-
|
|
72
|
-
hb_d = (o0.positions[:, 2][condition_d] + o1.positions[:, 2][condition_d]) / 2
|
|
73
|
-
hb_a = (o0.positions[:, 2][condition_a] + o1.positions[:, 2][condition_a]) / 2
|
|
74
|
-
|
|
75
|
-
self._append(hb_d, hb_a)
|
|
76
|
-
|
|
77
|
-
def _conclude(self):
|
|
78
|
-
if self.frame_count > 0:
|
|
79
|
-
average_donor = self.donor / self.frame_count
|
|
80
|
-
average_accepter = self.accepter / self.frame_count
|
|
81
|
-
average_sum = average_donor + average_accepter
|
|
82
|
-
|
|
83
|
-
bins_z = np.arange(len(self.donor)) * self.bin_size
|
|
84
|
-
|
|
85
|
-
lower_z, upper_z = self.surface
|
|
86
|
-
mask = (bins_z >= lower_z) & (bins_z <= upper_z)
|
|
87
|
-
filtered_bins_z = bins_z[mask] - lower_z
|
|
88
|
-
filtered_average_accepter = average_accepter[mask]
|
|
89
|
-
filtered_average_donor = average_donor[mask]
|
|
90
|
-
filtered_average_sum = average_sum[mask]
|
|
91
|
-
|
|
92
|
-
combined_data = np.column_stack((filtered_bins_z, filtered_average_accepter, filtered_average_donor, filtered_average_sum))
|
|
93
|
-
|
|
94
|
-
np.savetxt("hb_distribution.dat", combined_data, header="Z\tAccepter\tDonor\tAccepter+Donor", fmt='%.5f', delimiter='\t')
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def parse_data(s):
|
|
98
|
-
return [float(x) for x in s.replace(',', ' ').split()]
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def parse_r(s):
|
|
102
|
-
return [int(x) for x in s.replace(':', ' ').split()]
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def parse_argument():
|
|
106
|
-
parser = argparse.ArgumentParser(description="analysis hb distribution")
|
|
107
|
-
parser.add_argument('filename', type=str, help='filename to analysis')
|
|
108
|
-
parser.add_argument('--cp2k_input_file', type=str, help='input file name of cp2k, default is "input.inp"', default='input.inp')
|
|
109
|
-
parser.add_argument('-r', type=parse_r, help='range of analysis', default=[0, -1, 1])
|
|
110
|
-
parser.add_argument('--cell', type=parse_data, help='set cell, a list of lattice, --cell x,y,z or x,y,z,a,b,c')
|
|
111
|
-
parser.add_argument('--surface', type=parse_data, help='[down_surface_z, up_surface_z]')
|
|
112
|
-
parser.add_argument('--hb_param', type=parse_data, help='[hb_distance, hb_angle], default is [3.5, 35]', default=[3.5, 35])
|
|
113
|
-
|
|
114
|
-
return parser.parse_args()
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def main():
|
|
118
|
-
args = parse_argument()
|
|
119
|
-
cell = cp2k_input_parsing.get_cell(args.cp2k_input_file, args.cell)
|
|
120
|
-
|
|
121
|
-
hb_dist = Hb_distribution(args.filename, cell, args.surface, hb_distance=args.hb_param[0], hb_angle=args.hb_param[1])
|
|
122
|
-
hb_dist.run(start=args.r[0], stop=args.r[1], step=args.r[2])
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if __name__ == '__main__':
|
|
126
|
-
main()
|
mdkits/cli/packmol_input.py
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def parse_cell(s):
|
|
5
|
-
return [float(x) for x in s.replace(',', ' ').split()]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def parse_argument():
|
|
9
|
-
parser = argparse.ArgumentParser(description='generate packmol input file with give parameter')
|
|
10
|
-
parser.add_argument('--size', type=int, help='water size default is 30', default=30)
|
|
11
|
-
parser.add_argument('--cell', type=parse_cell, help='input box size(a,b,c)')
|
|
12
|
-
parser.add_argument('--addwat', type=int, help='add some additional water, default is 0', default=0)
|
|
13
|
-
parser.add_argument('--ioncon', type=float, help='concentration of sol box, default is 0.0', default=0.0)
|
|
14
|
-
parser.add_argument('--tolerance', type=float, help='tolerance of packmol, default is 2.5', default=2.5)
|
|
15
|
-
parser.add_argument('--watpath', type=str, help='water xyz file path', default='C:\\home\\.can\\temp\\packmol\\default\\water.xyz')
|
|
16
|
-
parser.add_argument('--ionpath', type=str, help='ion xyz file path')
|
|
17
|
-
parser.add_argument('-o', type=str, help='output file name, default is "input.pm"', default='input.pm')
|
|
18
|
-
parser.add_argument('--output', type=str, help='output file name of packmol, default is "solbox.xyz"', default='solbox.xyz')
|
|
19
|
-
|
|
20
|
-
return parser.parse_args()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def get_water_number():
|
|
24
|
-
water_number = water_volume / water_size
|
|
25
|
-
|
|
26
|
-
return int(round(water_number, 0))
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def get_ion_number(concentration):
|
|
30
|
-
ion_number = ( (concentration * avogadro) / 1e+27 ) * water_volume
|
|
31
|
-
|
|
32
|
-
return int(round(ion_number, 0))
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def main():
|
|
36
|
-
global water_volume, water_size, avogadro
|
|
37
|
-
args = parse_argument()
|
|
38
|
-
water_volume = args.cell[0] * args.cell[1] * args.cell[2]
|
|
39
|
-
water_size = args.size
|
|
40
|
-
avogadro = 6.02214179e+23
|
|
41
|
-
water_number = get_water_number() + args.addwat
|
|
42
|
-
ion_number = get_ion_number(args.ioncon)
|
|
43
|
-
|
|
44
|
-
if ion_number == 0:
|
|
45
|
-
packmol_input_str = f"""
|
|
46
|
-
tolerance {args.tolerance}
|
|
47
|
-
filetype xyz
|
|
48
|
-
output {args.output}
|
|
49
|
-
pbc {args.cell[3]} {args.cell[4]} {args.cell[5]}
|
|
50
|
-
structure {args.watpath}
|
|
51
|
-
number {water_number}
|
|
52
|
-
inside box 2. 2. 2. {args.cell[0]-2} {args.cell[1]-2} {args.cell[2]-2}
|
|
53
|
-
end structure
|
|
54
|
-
"""
|
|
55
|
-
else:
|
|
56
|
-
packmol_input_str = f"""
|
|
57
|
-
tolerance {args.tolerance}
|
|
58
|
-
filetype xyz
|
|
59
|
-
output {args.output}
|
|
60
|
-
pbc {args.cell[3]} {args.cell[4]} {args.cell[5]}
|
|
61
|
-
structure {args.watpath}
|
|
62
|
-
number {water_number}
|
|
63
|
-
inside box 2. 2. 2. {args.cell[0]-2} {args.cell[1]-2} {args.cell[2]-2}
|
|
64
|
-
end structure
|
|
65
|
-
structure {args.ionpath}
|
|
66
|
-
number {ion_number}
|
|
67
|
-
inside box 2. 2. 2. {args.cell[0]-2} {args.cell[1]-2} {args.cell[2]-2}
|
|
68
|
-
end structure
|
|
69
|
-
"""
|
|
70
|
-
|
|
71
|
-
with open(args.o, 'w') as f:
|
|
72
|
-
f.write(packmol_input_str)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if __name__ == '__main__':
|
|
76
|
-
main()
|
mdkits-0.1.13.dist-info/METADATA
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: mdkits
|
|
3
|
-
Version: 0.1.13
|
|
4
|
-
Summary: kits for md or dft
|
|
5
|
-
License: MIT
|
|
6
|
-
Keywords: molecular dynamics,density functional theory
|
|
7
|
-
Author: jxxcr
|
|
8
|
-
Author-email: jixxcr@qq.com
|
|
9
|
-
Requires-Python: >=3.11,<4.0
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Requires-Dist: Cp2kData (>=0.7.2,<0.8.0)
|
|
17
|
-
Requires-Dist: MDAnalysis (>=2.8.0,<3.0.0)
|
|
18
|
-
Requires-Dist: ase (>=3.22.1,<4.0.0)
|
|
19
|
-
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
20
|
-
Requires-Dist: julia (>=0.6.2,<0.7.0)
|
|
21
|
-
Requires-Dist: matplotlib (>=3.9.0,<4.0.0)
|
|
22
|
-
Requires-Dist: numpy (>=1.26.4,<2.0.0)
|
|
23
|
-
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
24
|
-
Project-URL: Repository, https://github.com/jxxcr/mdkits
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
|
|
27
|
-
# MD 轨迹分析脚本
|
|
28
|
-
`mdkits` 提供了多种工具, 安装脚本:
|
|
29
|
-
```bash
|
|
30
|
-
pip install mdkits --upgrade
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### 密度分布
|
|
34
|
-
`density`用于分析体系中的某种元素沿z轴的密度分布, 如分析体系中的`O`元素沿z轴的密度分布, `--element`选项指定元素使用`MDAnalysis`的[选择语言](https://userguide.mdanalysis.org/stable/selections.html):
|
|
35
|
-
```bash
|
|
36
|
-
mdkits density [FILENAME] --element="name H" --cell [FILENAME]
|
|
37
|
-
```
|
|
38
|
-
这样会输出一个文件名为`density_name_H.dat`的文件, 第一列为z轴坐标, 第二列为浓度分布, 单位为 mol/L. 如果想输出为单位为 $g/cm^3$ 的密度分布, 可以指定`--atomic_mass` 选项, 如:
|
|
39
|
-
```bash
|
|
40
|
-
mdkits density [FILENAME] --element="name H" --cell [FILENAME] --atomic_mass=1.00784
|
|
41
|
-
```
|
|
42
|
-
则输出单位为 $g/cm^3$ 的密度分布. 可以指定表面原子来将密度分布归一化到表面, 如:
|
|
43
|
-
```bash
|
|
44
|
-
mdkits density [FILENAME] --element="name O" --cell 10,10,10 --atomic_mass=18.01528 --surface="name Pt and name Ru"
|
|
45
|
-
```
|
|
46
|
-
这样会将密度分布归一化到表面, 同时以O原子的位置作为水分子的位置分析处理水分子的密度分布. 对于体系中存在 $OH^-$ 离子的体系可以使用`--update_water`的选项在每一帧更新水分子的位置, 不需要额外指定元素, 如:
|
|
47
|
-
```bash
|
|
48
|
-
mdkits density [FILENAME] --update_water --cell 10,10,10 --atomic_mass=18.01528 --surface="name Pt and name Ru"
|
|
49
|
-
```
|
|
50
|
-
输出的文件名为`density_water.dat`.
|
|
51
|
-
|
|
52
|
-
### 氢键
|
|
53
|
-
|
|
54
|
-
#### 单个水分子
|
|
55
|
-
|
|
56
|
-
#### 氢键分布
|
|
57
|
-
|
|
58
|
-
### 角度
|
|
59
|
-
|
|
60
|
-
#### 与表面法向量夹角分布
|
|
61
|
-
|
|
62
|
-
#### ion - O - ion 夹角分布
|
|
63
|
-
|
|
64
|
-
#### $\cos \phi \rho_{H_2 O}$ 分布
|
|
65
|
-
|
|
66
|
-
### RDF
|
|
67
|
-
|
|
68
|
-
### 位置归一化
|
|
69
|
-
`wrap`用于将轨迹文件中的原子位置进行归一化处理, 如将`[FILENAME]`中的原子位置归一化到晶胞中, 并输出为`wrapped.xyz`, 默认从`cp2k`的输出文件`input_inp`中读取`ABC`和`ALPHA_BETA_GAMMA`信息作为晶胞参数:
|
|
70
|
-
```bash
|
|
71
|
-
mdkits wrap [FILENAME]
|
|
72
|
-
```
|
|
73
|
-
或指定`cp2k`的输入文件:
|
|
74
|
-
```bash
|
|
75
|
-
mdkits wrap [FILENAME] --cp2k_input_file setting.inp
|
|
76
|
-
```
|
|
77
|
-
或指定晶胞参数:
|
|
78
|
-
```bash
|
|
79
|
-
mdkits wrap [FILENAME] --cell 10,10,10
|
|
80
|
-
```
|
|
81
|
-
默认的`[FILENAME]`为`*-pos-1.xyz`
|
|
82
|
-
|
|
83
|
-
## DFT 性质分析脚本
|
|
84
|
-
### PDOS
|
|
85
|
-
`pdos`用于分析体系中的pdos, 分析[FILENAME]的d轨道的dos:
|
|
86
|
-
```bash
|
|
87
|
-
mdkits pdos [FILENAME] -t d
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### CUBE 文件
|
|
91
|
-
`cube`用于处理[`cube`格式](https://paulbourke.net/dataformats/cube/)的文件, 将其在z轴上进行平均:
|
|
92
|
-
```bash
|
|
93
|
-
mdkits cube [FILENAME]
|
|
94
|
-
```
|
|
95
|
-
分析好的数据会输出为`cube.out`, 可以同时计算一个区域内的平均值:
|
|
96
|
-
```bash
|
|
97
|
-
mdkits cube [FILENAME] -b 1 2
|
|
98
|
-
```
|
|
99
|
-
会将平均值打印在屏幕上, 同时记录在`cube.out`中的注释行.
|
|
100
|
-
|
|
101
|
-
## 建模
|
|
102
|
-
`build`为界面的工具, 其中包含多个建模工具
|
|
103
|
-
|
|
104
|
-
### 构建体相模型
|
|
105
|
-
`bulk`用于构建体相模型, 如构建`Pt`的`fcc`体相模型:
|
|
106
|
-
```bash
|
|
107
|
-
mdkits build_bulk Pt fcc
|
|
108
|
-
```
|
|
109
|
-
构建为常胞模型:
|
|
110
|
-
```bash
|
|
111
|
-
mdkits build_bulk Pt fcc --cubic
|
|
112
|
-
```
|
|
113
|
-
构建一个`Caesium chloride`结构的模型:
|
|
114
|
-
```bash
|
|
115
|
-
mdkits build_bulk CsCl cesiumchloride -a 4.123
|
|
116
|
-
```
|
|
117
|
-
构建一个`fluorite `结构的模型:
|
|
118
|
-
```bash
|
|
119
|
-
mdkits build_bulk BaF2 fluorite -a 6.196
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### 构建表面模型
|
|
123
|
-
`surface`用于构建常见的表面模型, 骑用法为:
|
|
124
|
-
```bash
|
|
125
|
-
mdkits build surface [ELEMENT] [SURFACE_TYPE] [SIZE]
|
|
126
|
-
```
|
|
127
|
-
如构建`Pt`的`fcc111`表面模型:
|
|
128
|
-
```bash
|
|
129
|
-
mdkits build surface Pt fcc111 2 2 3 --vacuum 15
|
|
130
|
-
```
|
|
131
|
-
构建石墨烯表面:
|
|
132
|
-
```bash
|
|
133
|
-
mdkits build surface C2 graphene 3 3 1 --vacuum 15
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## 其他
|
|
137
|
-
### 轨迹提取
|
|
138
|
-
`extract`用于提取轨迹文件中的特定的帧, 如从`frames.xyz`中提取第 1000 帧到第 2000 帧的轨迹文件, 并输出为`1000-2000.xyz`, `-r`选项的参数与`Python`的切片语法一致:
|
|
139
|
-
```bash
|
|
140
|
-
mdkits extract frames.xyz -r 1000:2000 -o 1000-2000.xyz
|
|
141
|
-
```
|
|
142
|
-
或从`cp2k`的默认输出的轨迹文件`*-pos-1.xyz`文件中提取最后一帧输出为`extracted.xyz`(`extract`的默认行为):
|
|
143
|
-
```bash
|
|
144
|
-
mdkits extract
|
|
145
|
-
```
|
|
146
|
-
或每50帧输出一个结构到`./coord`目录中, 同时调整输出格式为`cp2k`的`@INCLUDE coord.xyz`的形式:
|
|
147
|
-
```bash
|
|
148
|
-
mdkits extract -cr ::50
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### 结构文件转换
|
|
152
|
-
`convert`用于将结构文件从一种格式转换为另一种格式, 如将`structure.xyz`转换为`out.cif`(默认文件名为`out`), 对于不储存周期性边界条件的文件, 可以使用`--cell`选项指定`PBC`:
|
|
153
|
-
```bash
|
|
154
|
-
mdkits convert -c structure.xyz --cell 10,10,10
|
|
155
|
-
```
|
|
156
|
-
将`structure.cif`转换为`POSCAR`:
|
|
157
|
-
```bash
|
|
158
|
-
mdkits convert -v structure.cif
|
|
159
|
-
```
|
|
160
|
-
将`structure.cif`转换为`structure_xyz.xyz`:
|
|
161
|
-
```bash
|
|
162
|
-
mdkits convert -c structure.cif -o structure_xyz
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### 数据处理
|
|
166
|
-
`data`用于对数据进行处理如:
|
|
167
|
-
1. `--nor`: 对数据进行归一化处理
|
|
168
|
-
2. `--gaus`: 对数据进行高斯过滤
|
|
169
|
-
3. `--fold`: 堆数据进行折叠平均
|
|
170
|
-
4. `--err`: 计算数据的误差棒
|
|
171
|
-
等
|
|
172
|
-
|
|
173
|
-
### 绘图工具
|
|
174
|
-
`plot`用于绘制数据图, `plot`需要读取`yaml`格式的配置文件进行绘图, `yaml`文件的形式如下:
|
|
175
|
-
```yaml
|
|
176
|
-
# plot mode 1
|
|
177
|
-
figure1:
|
|
178
|
-
data:
|
|
179
|
-
legend1: ./data1.dat
|
|
180
|
-
legend2: ./data2.dat
|
|
181
|
-
x:
|
|
182
|
-
0: x-axis
|
|
183
|
-
y:
|
|
184
|
-
1: y-axis
|
|
185
|
-
x_range:
|
|
186
|
-
- 5
|
|
187
|
-
- 15
|
|
188
|
-
|
|
189
|
-
# plot mode 2
|
|
190
|
-
figure2:
|
|
191
|
-
data:
|
|
192
|
-
y-xais: ./data.dat
|
|
193
|
-
x:
|
|
194
|
-
0: x-axis
|
|
195
|
-
y:
|
|
196
|
-
1: legend1
|
|
197
|
-
2: legend2
|
|
198
|
-
3: legend3
|
|
199
|
-
4: legend4
|
|
200
|
-
5: legend5
|
|
201
|
-
y_range:
|
|
202
|
-
- 0.5
|
|
203
|
-
- 6
|
|
204
|
-
legend_fontsize: 12
|
|
205
|
-
|
|
206
|
-
# plot mode error
|
|
207
|
-
12_dp_e_error:
|
|
208
|
-
data:
|
|
209
|
-
legend: ./error.dat
|
|
210
|
-
x:
|
|
211
|
-
0: x-axis
|
|
212
|
-
y:
|
|
213
|
-
1: y-axis
|
|
214
|
-
fold: dp
|
|
215
|
-
legend_fontsize: 12
|
|
216
|
-
```
|
|
217
|
-
如上`plot`支持三种绘图模式, `mode 1`, `mode 2`和`mode error`. `mode 1`用于绘制多组数据文件的同一列数据对比, `mode 2`用于绘制同一数据文件的不同列数据对比, `mode error`用于绘制均方根误差图.
|
|
218
|
-
|
|
219
|
-
`plot`可以同时处理多个`yaml`文件, 每个`yaml`文件可以包含多个绘图配置, `mode 1`和`mode 2`的绘图配置可以自动识别, 但是`error`模式需要而外指定, 如:
|
|
220
|
-
```bash
|
|
221
|
-
mdkits plot *.yaml
|
|
222
|
-
```
|
|
223
|
-
和:
|
|
224
|
-
```bash
|
|
225
|
-
mdkits plot *.yaml --error
|
|
226
|
-
```
|
mdkits-0.1.13.dist-info/RECORD
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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=sqjnq5aHWLYLbNzN5SORkEYeYaewLagFuSvspJxyh7E,725
|
|
6
|
-
mdkits/build_cli/build_interface.py,sha256=3EDxUb-vGHFuat1Ex_wojVsN8PtzHiGrnDQIEa9WZ60,2448
|
|
7
|
-
mdkits/build_cli/build_solution.py,sha256=An-aeqB0g2LRaWJgc1p10r-5F5MfGs9WK1EAhQzZr6U,3750
|
|
8
|
-
mdkits/build_cli/build_surface.py,sha256=cBEQ-KR_6j-Mcsxrwvzyl6p1SiY_chIytrCu7MS3q08,2794
|
|
9
|
-
mdkits/build_cli/cut_surface.py,sha256=R0Snr-y23SYLfNhdBC5VgT4KFY1SOGn5hZlVvX5CUvw,2757
|
|
10
|
-
mdkits/build_cli/supercell.py,sha256=3iTTt3DHaERWDFonhBRS0oqWhjFh6pbS5SpIR-O1gYg,1034
|
|
11
|
-
mdkits/build_cli/water.xyz,sha256=ByLDz-rYhw_wLPBU78lIQHe4s4Xf5Ckjft-Dus3czIc,171
|
|
12
|
-
"mdkits/cli/,hb_distribution_down.py",sha256=i3NguzGebqCgy4uuVBeFajZRZnXtjhsJBPDGDdumlWA,4733
|
|
13
|
-
mdkits/cli/convert.py,sha256=OmQ-7hmw0imgfgCJaWFEy3ePixsU7VKf0mGuJ6jRpn0,1795
|
|
14
|
-
mdkits/cli/cube.py,sha256=G-QNup8W6J1-LCcEl1EHsV3nstd23byePDOcE_95t18,1176
|
|
15
|
-
mdkits/cli/data.py,sha256=FGA4S9Cfo6WUJBSPWKOJrrZXHo_Qza-jNG1P_Dw7yi4,3262
|
|
16
|
-
mdkits/cli/density.py,sha256=Y4grT8p7CsxggGYo_nGE9z_wlkJeQS5eYWKJQcoA014,5559
|
|
17
|
-
mdkits/cli/extract.py,sha256=bqqJBmSaVyPYyEseGpUJcMBufIfDLTNRdmUfJ0txE5E,2498
|
|
18
|
-
mdkits/cli/hartree_potential.py,sha256=XcJfsJ5Y2d5MQfD45p06_gV1fTJbDSrNhCnZ3Sz2Vb0,2233
|
|
19
|
-
mdkits/cli/hartree_potential_ave.py,sha256=25oy3QsgIdxrTFpTqpnGvLAheb-d6poeLMN7iuGT3Xk,3335
|
|
20
|
-
mdkits/cli/hb.py,sha256=lADr4tlctbtQ3_f_UpznkLnSI0MJlAT-pknEf_dwrnU,5330
|
|
21
|
-
mdkits/cli/hb_distribution.py,sha256=VpTyOhU9oucWUnqUSmLgZfMb5g0tR0q7vrxakLSrKxI,5120
|
|
22
|
-
mdkits/cli/packmol_input.py,sha256=76MjjMMRDaW2q459B5mEpXDYSSn14W-JXudOOsx-8E4,2849
|
|
23
|
-
mdkits/cli/pdos.py,sha256=ALAZ5uOaoT0UpCyKYleWxwmk569HMzKTTK-lMJeicM8,1411
|
|
24
|
-
mdkits/cli/plot.py,sha256=1yh5dq5jnQDuyWlxV_9g5ztsnuFHVu4ouYQ9VJYSrUU,8938
|
|
25
|
-
mdkits/cli/wrap.py,sha256=AUxGISuiCfEjdMYl-TKc2VMCPHSybWKrMIOTn_6kSp0,1043
|
|
26
|
-
mdkits/config/__init__.py,sha256=ZSwmnPK02LxJLMgcYmNb-tIOk8fEuHf5jpqD3SDHWLg,1039
|
|
27
|
-
mdkits/config/settings.yml,sha256=PY7u0PbFLuxSnd54H5tI9oMjUf-mzyADqSZtm99BwG0,71
|
|
28
|
-
mdkits/mdkits.py,sha256=7yZHo13dn_Nn5K7BNIrEXFN44WoZoWD_MqgRQGhTJEU,627
|
|
29
|
-
mdkits/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
-
mdkits/util/arg_type.py,sha256=VVIc3PSeIiyq2-s20KMem2feU0hI2v3fX7MBKpHsolw,2544
|
|
31
|
-
mdkits/util/cp2k_input_parsing.py,sha256=7NMVOYEGycarokLJlhLoWWilciM7sd8MWp5FVTF7hqI,1223
|
|
32
|
-
mdkits/util/encapsulated_ase.py,sha256=uhqIhsALxzwJYuFrfOYGGC6U0QLm_dcZNridvfl_XGc,4339
|
|
33
|
-
mdkits/util/encapsulated_mda.py,sha256=td3H24u3eHOIS2nwPucfIaMxeaVxI77oFI8nnNhw7vo,2217
|
|
34
|
-
mdkits/util/fig_operation.py,sha256=FwffNUtXorMl6qE04FipgzcVljEQii7wrNJUCJMyY3E,1045
|
|
35
|
-
mdkits/util/numpy_geo.py,sha256=1Op8THoQeyqybSZAi7hVxohYCr4SzY6ndZC8_gAGXDA,3619
|
|
36
|
-
mdkits/util/os_operation.py,sha256=ErN2ExjX9vZRfPe3ypsj4eyoQTEePqzlEX0Xm1N4lL4,980
|
|
37
|
-
mdkits/util/out_err.py,sha256=b4eFz9kqqNReK9UCHak9k5tBlEj9yHAIADDTRbaNaNk,693
|
|
38
|
-
mdkits/util/structure_parsing.py,sha256=mRPMJeih3O-ST7HeETDvBEkfV-1psT-XgxyYgDadV0U,4152
|
|
39
|
-
mdkits-0.1.13.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
|
|
40
|
-
mdkits-0.1.13.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
|
|
41
|
-
mdkits-0.1.13.dist-info/METADATA,sha256=m46S3Gbvpa5H0bQdHLA_V3JfJuA2F1AKOy2KIfMkbaY,6907
|
|
42
|
-
mdkits-0.1.13.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
43
|
-
mdkits-0.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|