mdkits 0.1.10__py3-none-any.whl → 0.1.12__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/build_cli/build_solution.py +44 -43
- {mdkits-0.1.10.dist-info → mdkits-0.1.12.dist-info}/METADATA +1 -1
- {mdkits-0.1.10.dist-info → mdkits-0.1.12.dist-info}/RECORD +6 -6
- {mdkits-0.1.10.dist-info → mdkits-0.1.12.dist-info}/LICENSE +0 -0
- {mdkits-0.1.10.dist-info → mdkits-0.1.12.dist-info}/WHEEL +0 -0
- {mdkits-0.1.10.dist-info → mdkits-0.1.12.dist-info}/entry_points.txt +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import click, os
|
|
2
|
-
from julia import Pkg, Main
|
|
3
2
|
from mdkits.util import arg_type
|
|
4
3
|
from importlib import resources
|
|
5
4
|
from mdkits.cli import convert
|
|
@@ -25,64 +24,66 @@ def main(filename, infile, install, water_number, n, tolerance, cell, gap):
|
|
|
25
24
|
Pkg.activate("Packmol", shared=True)
|
|
26
25
|
Pkg.add("Packmol")
|
|
27
26
|
Main.exit()
|
|
27
|
+
else:
|
|
28
|
+
from julia import Pkg, Main
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
if cell is None:
|
|
31
|
+
raise ValueError("cell should be provided")
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
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")
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
while True:
|
|
37
|
+
try:
|
|
38
|
+
Main.using("Packmol")
|
|
39
|
+
break
|
|
40
|
+
except Exception:
|
|
41
|
+
pass
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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")
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
|
|
51
|
+
backslash = "\\"
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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"
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
if water_number > 0:
|
|
62
|
+
water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
|
|
62
63
|
|
|
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"
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
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"
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
total_input = head_input + "\n".join(structure_input.values())
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
temp_file.write(total_input)
|
|
74
|
+
temp_file.flush()
|
|
75
|
+
temp_file.close()
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
Main.run_packmol(temp_file.name)
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
if os.path.exists(temp_file.name):
|
|
80
|
+
os.remove(temp_file.name)
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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()
|
|
86
87
|
|
|
87
88
|
|
|
88
89
|
if __name__ == "__main__":
|
|
@@ -4,7 +4,7 @@ mdkits/build_cli/adsorbate.py,sha256=Zp21i-miFv5zQlYjZnZuVpMxvNVT-6RtdlaoWDMwaOg
|
|
|
4
4
|
mdkits/build_cli/build_bulk.py,sha256=o3SFov5Ggk-qKcy6-NBoIYKvZV24OhcH3-du1d0U6H4,1593
|
|
5
5
|
mdkits/build_cli/build_cli.py,sha256=sqjnq5aHWLYLbNzN5SORkEYeYaewLagFuSvspJxyh7E,725
|
|
6
6
|
mdkits/build_cli/build_interface.py,sha256=3EDxUb-vGHFuat1Ex_wojVsN8PtzHiGrnDQIEa9WZ60,2448
|
|
7
|
-
mdkits/build_cli/build_solution.py,sha256=
|
|
7
|
+
mdkits/build_cli/build_solution.py,sha256=An-aeqB0g2LRaWJgc1p10r-5F5MfGs9WK1EAhQzZr6U,3750
|
|
8
8
|
mdkits/build_cli/build_surface.py,sha256=cBEQ-KR_6j-Mcsxrwvzyl6p1SiY_chIytrCu7MS3q08,2794
|
|
9
9
|
mdkits/build_cli/cut_surface.py,sha256=R0Snr-y23SYLfNhdBC5VgT4KFY1SOGn5hZlVvX5CUvw,2757
|
|
10
10
|
mdkits/build_cli/supercell.py,sha256=3iTTt3DHaERWDFonhBRS0oqWhjFh6pbS5SpIR-O1gYg,1034
|
|
@@ -36,8 +36,8 @@ mdkits/util/numpy_geo.py,sha256=1Op8THoQeyqybSZAi7hVxohYCr4SzY6ndZC8_gAGXDA,3619
|
|
|
36
36
|
mdkits/util/os_operation.py,sha256=ErN2ExjX9vZRfPe3ypsj4eyoQTEePqzlEX0Xm1N4lL4,980
|
|
37
37
|
mdkits/util/out_err.py,sha256=b4eFz9kqqNReK9UCHak9k5tBlEj9yHAIADDTRbaNaNk,693
|
|
38
38
|
mdkits/util/structure_parsing.py,sha256=mRPMJeih3O-ST7HeETDvBEkfV-1psT-XgxyYgDadV0U,4152
|
|
39
|
-
mdkits-0.1.
|
|
40
|
-
mdkits-0.1.
|
|
41
|
-
mdkits-0.1.
|
|
42
|
-
mdkits-0.1.
|
|
43
|
-
mdkits-0.1.
|
|
39
|
+
mdkits-0.1.12.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
|
|
40
|
+
mdkits-0.1.12.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
|
|
41
|
+
mdkits-0.1.12.dist-info/METADATA,sha256=Ly_7pZqUZJbgj_qvi2sK2PhiSJTPlOxXxmzqlbhiKZ4,6907
|
|
42
|
+
mdkits-0.1.12.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
43
|
+
mdkits-0.1.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|