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.

@@ -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
- if cell is None:
30
- raise ValueError("cell should be provided")
30
+ if cell is None:
31
+ raise ValueError("cell should be provided")
31
32
 
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")
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
- while True:
36
- try:
37
- Main.using("Packmol")
38
- break
39
- except Exception:
40
- pass
36
+ while True:
37
+ try:
38
+ Main.using("Packmol")
39
+ break
40
+ except Exception:
41
+ pass
41
42
 
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")
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
- temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
50
- backslash = "\\"
50
+ temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
51
+ backslash = "\\"
51
52
 
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"
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
- output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
59
+ output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
59
60
 
60
- if water_number > 0:
61
- water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
61
+ if water_number > 0:
62
+ water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
62
63
 
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
+ 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
- output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
66
+ output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
66
67
 
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"
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
- total_input = head_input + "\n".join(structure_input.values())
71
+ total_input = head_input + "\n".join(structure_input.values())
71
72
 
72
- temp_file.write(total_input)
73
- temp_file.flush()
74
- temp_file.close()
73
+ temp_file.write(total_input)
74
+ temp_file.flush()
75
+ temp_file.close()
75
76
 
76
- Main.run_packmol(temp_file.name)
77
+ Main.run_packmol(temp_file.name)
77
78
 
78
- if os.path.exists(temp_file.name):
79
- os.remove(temp_file.name)
79
+ if os.path.exists(temp_file.name):
80
+ os.remove(temp_file.name)
80
81
 
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()
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__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mdkits
3
- Version: 0.1.10
3
+ Version: 0.1.12
4
4
  Summary: kits for md or dft
5
5
  License: MIT
6
6
  Keywords: molecular dynamics,density functional theory
@@ -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=r-2Yt62lEyPuPuQvjj3B7HXmAZ42cxVhzvGWhfjUj2Y,3563
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.10.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
40
- mdkits-0.1.10.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
41
- mdkits-0.1.10.dist-info/METADATA,sha256=H4xU8A7CelB-t7-r7JVdDRlW_SnBRAxRNQUpbW_KZVo,6907
42
- mdkits-0.1.10.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
43
- mdkits-0.1.10.dist-info/RECORD,,
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,,