mdkits 0.1.10__tar.gz → 0.1.12__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.
- {mdkits-0.1.10 → mdkits-0.1.12}/PKG-INFO +1 -1
- {mdkits-0.1.10 → mdkits-0.1.12}/pyproject.toml +1 -1
- mdkits-0.1.12/src/mdkits/build_cli/build_solution.py +90 -0
- mdkits-0.1.10/src/mdkits/build_cli/build_solution.py +0 -89
- {mdkits-0.1.10 → mdkits-0.1.12}/LICENSE +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/README.md +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/__init__.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/__init__.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/adsorbate.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/build_bulk.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/build_cli.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/build_interface.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/build_surface.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/cut_surface.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/supercell.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/build_cli/water.xyz +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/,hb_distribution_down.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/convert.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/cube.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/data.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/density.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/extract.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/hartree_potential.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/hartree_potential_ave.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/hb.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/hb_distribution.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/packmol_input.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/pdos.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/plot.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/cli/wrap.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/config/__init__.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/config/settings.yml +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/mdkits.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/__init__.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/arg_type.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/cp2k_input_parsing.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/encapsulated_ase.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/encapsulated_mda.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/fig_operation.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/numpy_geo.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/os_operation.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/out_err.py +0 -0
- {mdkits-0.1.10 → mdkits-0.1.12}/src/mdkits/util/structure_parsing.py +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import click, os
|
|
2
|
+
from mdkits.util import arg_type
|
|
3
|
+
from importlib import resources
|
|
4
|
+
from mdkits.cli import convert
|
|
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
|
+
else:
|
|
28
|
+
from julia import Pkg, Main
|
|
29
|
+
|
|
30
|
+
if cell is None:
|
|
31
|
+
raise ValueError("cell should be provided")
|
|
32
|
+
|
|
33
|
+
if len(filename) == 0 and water_number == 0:
|
|
34
|
+
raise ValueError("at least one file should be provided, or water_number should be greater than 0")
|
|
35
|
+
|
|
36
|
+
while True:
|
|
37
|
+
try:
|
|
38
|
+
Main.using("Packmol")
|
|
39
|
+
break
|
|
40
|
+
except Exception:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
if infile:
|
|
44
|
+
for file in filename:
|
|
45
|
+
Main.run_packmol(file)
|
|
46
|
+
else:
|
|
47
|
+
if len(n) != len(filename):
|
|
48
|
+
raise ValueError("number of -n should be equal to number of files")
|
|
49
|
+
|
|
50
|
+
temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
|
|
51
|
+
backslash = "\\"
|
|
52
|
+
|
|
53
|
+
structure_input = {}
|
|
54
|
+
output_filenames = []
|
|
55
|
+
if len(filename) > 0:
|
|
56
|
+
for index, file in enumerate(filename):
|
|
57
|
+
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"
|
|
58
|
+
|
|
59
|
+
output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
|
|
60
|
+
|
|
61
|
+
if water_number > 0:
|
|
62
|
+
water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
|
|
63
|
+
|
|
64
|
+
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"
|
|
65
|
+
|
|
66
|
+
output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
|
|
67
|
+
|
|
68
|
+
output_filename = "-".join(output_filenames) + ".xyz"
|
|
69
|
+
head_input = f"tolerance {tolerance}\nfiletype xyz\noutput {os.path.join(os.getcwd(), output_filename)}\npbc {cell[0]} {cell[1]} {cell[2]}\n"
|
|
70
|
+
|
|
71
|
+
total_input = head_input + "\n".join(structure_input.values())
|
|
72
|
+
|
|
73
|
+
temp_file.write(total_input)
|
|
74
|
+
temp_file.flush()
|
|
75
|
+
temp_file.close()
|
|
76
|
+
|
|
77
|
+
Main.run_packmol(temp_file.name)
|
|
78
|
+
|
|
79
|
+
if os.path.exists(temp_file.name):
|
|
80
|
+
os.remove(temp_file.name)
|
|
81
|
+
|
|
82
|
+
print("="*15)
|
|
83
|
+
print(total_input)
|
|
84
|
+
print("="*15)
|
|
85
|
+
convert.main([output_filename, "-c", "--cell", ",".join([str(a) for a in cell])], standalone_mode=False)
|
|
86
|
+
Main.exit()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
main()
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import click, os
|
|
2
|
-
from julia import Pkg, Main
|
|
3
|
-
from mdkits.util import arg_type
|
|
4
|
-
from importlib import resources
|
|
5
|
-
from mdkits.cli import convert
|
|
6
|
-
import tempfile
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@click.command(name="solution")
|
|
10
|
-
@click.argument("filename", type=click.Path(exists=True), nargs=-1)
|
|
11
|
-
@click.option('--infile', is_flag=True, help="read input mode")
|
|
12
|
-
@click.option('--install', is_flag=True, help="install julia and packmol")
|
|
13
|
-
@click.option('--water_number', type=int, help="number of water molecules", default=0, show_default=True)
|
|
14
|
-
@click.option('-n', type=int, multiple=True, help="number of molecules")
|
|
15
|
-
@click.option('--tolerance', type=float, help="tolerance of solution", default=3.5, show_default=True)
|
|
16
|
-
@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")
|
|
17
|
-
@click.option('--gap', type=float, help="gap between solution and cell", default=1, show_default=True)
|
|
18
|
-
def main(filename, infile, install, water_number, n, tolerance, cell, gap):
|
|
19
|
-
"""
|
|
20
|
-
build solution model
|
|
21
|
-
"""
|
|
22
|
-
if install:
|
|
23
|
-
import julia
|
|
24
|
-
julia.install()
|
|
25
|
-
Pkg.activate("Packmol", shared=True)
|
|
26
|
-
Pkg.add("Packmol")
|
|
27
|
-
Main.exit()
|
|
28
|
-
|
|
29
|
-
if cell is None:
|
|
30
|
-
raise ValueError("cell should be provided")
|
|
31
|
-
|
|
32
|
-
if len(filename) == 0 and water_number == 0:
|
|
33
|
-
raise ValueError("at least one file should be provided, or water_number should be greater than 0")
|
|
34
|
-
|
|
35
|
-
while True:
|
|
36
|
-
try:
|
|
37
|
-
Main.using("Packmol")
|
|
38
|
-
break
|
|
39
|
-
except Exception:
|
|
40
|
-
pass
|
|
41
|
-
|
|
42
|
-
if infile:
|
|
43
|
-
for file in filename:
|
|
44
|
-
Main.run_packmol(file)
|
|
45
|
-
else:
|
|
46
|
-
if len(n) != len(filename):
|
|
47
|
-
raise ValueError("number of -n should be equal to number of files")
|
|
48
|
-
|
|
49
|
-
temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
|
|
50
|
-
backslash = "\\"
|
|
51
|
-
|
|
52
|
-
structure_input = {}
|
|
53
|
-
output_filenames = []
|
|
54
|
-
if len(filename) > 0:
|
|
55
|
-
for index, file in enumerate(filename):
|
|
56
|
-
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"
|
|
57
|
-
|
|
58
|
-
output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
|
|
59
|
-
|
|
60
|
-
if water_number > 0:
|
|
61
|
-
water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
|
|
62
|
-
|
|
63
|
-
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"
|
|
64
|
-
|
|
65
|
-
output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
|
|
66
|
-
|
|
67
|
-
output_filename = "-".join(output_filenames) + ".xyz"
|
|
68
|
-
head_input = f"tolerance {tolerance}\nfiletype xyz\noutput {os.path.join(os.getcwd(), output_filename)}\npbc {cell[0]} {cell[1]} {cell[2]}\n"
|
|
69
|
-
|
|
70
|
-
total_input = head_input + "\n".join(structure_input.values())
|
|
71
|
-
|
|
72
|
-
temp_file.write(total_input)
|
|
73
|
-
temp_file.flush()
|
|
74
|
-
temp_file.close()
|
|
75
|
-
|
|
76
|
-
Main.run_packmol(temp_file.name)
|
|
77
|
-
|
|
78
|
-
if os.path.exists(temp_file.name):
|
|
79
|
-
os.remove(temp_file.name)
|
|
80
|
-
|
|
81
|
-
print("="*15)
|
|
82
|
-
print(total_input)
|
|
83
|
-
print("="*15)
|
|
84
|
-
convert.main([output_filename, "-c", "--cell", ",".join([str(a) for a in cell])], standalone_mode=False)
|
|
85
|
-
Main.exit()
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if __name__ == "__main__":
|
|
89
|
-
main()
|
|
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
|
|
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
|
|
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
|
|
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
|