mdkits 0.1.11__py3-none-any.whl → 0.1.13__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.
@@ -27,63 +27,63 @@ def main(filename, infile, install, water_number, n, tolerance, cell, gap):
27
27
  else:
28
28
  from julia import Pkg, Main
29
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")
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
49
42
 
50
- temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
51
- backslash = "\\"
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")
52
49
 
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"
50
+ temp_file = tempfile.NamedTemporaryFile(mode='w+t', delete=False)
51
+ backslash = "\\"
58
52
 
59
- output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
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"
60
58
 
61
- if water_number > 0:
62
- water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
59
+ output_filenames.append(f"{file.replace(backslash, '/').split('.')[-2].split('/')[-1]}_{n[index]}")
63
60
 
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"
61
+ if water_number > 0:
62
+ water_path = resources.files('mdkits.build_cli').joinpath('water.xyz')
65
63
 
66
- output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
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"
67
65
 
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"
66
+ output_filenames.append(f"{str(water_path).replace(backslash, '/').split('.')[-2].split('/')[-1]}_{water_number}")
70
67
 
71
- total_input = head_input + "\n".join(structure_input.values())
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
72
 
73
- temp_file.write(total_input)
74
- temp_file.flush()
75
- temp_file.close()
73
+ temp_file.write(total_input)
74
+ temp_file.flush()
75
+ temp_file.close()
76
76
 
77
- Main.run_packmol(temp_file.name)
77
+ Main.run_packmol(temp_file.name)
78
78
 
79
- if os.path.exists(temp_file.name):
80
- os.remove(temp_file.name)
79
+ if os.path.exists(temp_file.name):
80
+ os.remove(temp_file.name)
81
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()
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
87
 
88
88
 
89
89
  if __name__ == "__main__":
mdkits/util/arg_type.py CHANGED
@@ -62,9 +62,8 @@ class StructureType(click.ParamType):
62
62
  class MoleculeType(click.Choice):
63
63
  name = "mocular type"
64
64
  def __init__(self):
65
- super().__init__(self)
66
65
  g2.names.append(click.Path(exists=True))
67
- self.choices = tuple(g2.names)
66
+ super().__init__(choices=tuple(g2.names))
68
67
 
69
68
  class AdsSiteType(click.Choice):
70
69
  name = "adsorption site"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mdkits
3
- Version: 0.1.11
3
+ Version: 0.1.13
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=dsbI_gOS8Cz89Bv-UNxy9FziDoNBOIiddqL3bKmAe60,3582
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
@@ -27,7 +27,7 @@ mdkits/config/__init__.py,sha256=ZSwmnPK02LxJLMgcYmNb-tIOk8fEuHf5jpqD3SDHWLg,103
27
27
  mdkits/config/settings.yml,sha256=PY7u0PbFLuxSnd54H5tI9oMjUf-mzyADqSZtm99BwG0,71
28
28
  mdkits/mdkits.py,sha256=7yZHo13dn_Nn5K7BNIrEXFN44WoZoWD_MqgRQGhTJEU,627
29
29
  mdkits/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- mdkits/util/arg_type.py,sha256=VQS9pMYr5CmVTy-BDSAaPrRNWnzC6up-vpoW0io8jYQ,2565
30
+ mdkits/util/arg_type.py,sha256=VVIc3PSeIiyq2-s20KMem2feU0hI2v3fX7MBKpHsolw,2544
31
31
  mdkits/util/cp2k_input_parsing.py,sha256=7NMVOYEGycarokLJlhLoWWilciM7sd8MWp5FVTF7hqI,1223
32
32
  mdkits/util/encapsulated_ase.py,sha256=uhqIhsALxzwJYuFrfOYGGC6U0QLm_dcZNridvfl_XGc,4339
33
33
  mdkits/util/encapsulated_mda.py,sha256=td3H24u3eHOIS2nwPucfIaMxeaVxI77oFI8nnNhw7vo,2217
@@ -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.11.dist-info/entry_points.txt,sha256=xoWWZ_yL87S501AzCO2ZjpnVuYkElC6z-8J3tmuIGXQ,44
40
- mdkits-0.1.11.dist-info/LICENSE,sha256=VLaqyB0r_H7y3hUntfpPWcE3OATTedHWI983htLftcQ,1081
41
- mdkits-0.1.11.dist-info/METADATA,sha256=50idwtQfdNsEeSS0OZciphe82WaevI_wpsx5j-dsRSA,6907
42
- mdkits-0.1.11.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
43
- mdkits-0.1.11.dist-info/RECORD,,
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,,