pwdata 0.4.1__tar.gz → 0.4.3__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 pwdata might be problematic. Click here for more details.

Files changed (66) hide show
  1. {pwdata-0.4.1 → pwdata-0.4.3}/PKG-INFO +1 -1
  2. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/convert_files.py +15 -9
  3. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/main.py +9 -4
  4. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/meta.py +3 -3
  5. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata.egg-info/PKG-INFO +1 -1
  6. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata.egg-info/SOURCES.txt +0 -1
  7. {pwdata-0.4.1 → pwdata-0.4.3}/setup.py +1 -1
  8. pwdata-0.4.1/pwdata/test.py +0 -164
  9. {pwdata-0.4.1 → pwdata-0.4.3}/LICENSE +0 -0
  10. {pwdata-0.4.1 → pwdata-0.4.3}/README.md +0 -0
  11. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/__init__.py +0 -0
  12. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/atomconfig.py +0 -0
  13. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/build/__init__.py +0 -0
  14. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/build/cell.py +0 -0
  15. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/build/geometry.py +0 -0
  16. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/build/supercells.py +0 -0
  17. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/build/write_struc.py +0 -0
  18. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/calculators/__init__.py +0 -0
  19. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/calculators/const.py +0 -0
  20. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/calculators/unitconvert_lmps.py +0 -0
  21. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/calculators/units.py +0 -0
  22. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/check_envs.py +0 -0
  23. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/config.py +0 -0
  24. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/cp2kdata.py +0 -0
  25. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/datasets_saver.py +0 -0
  26. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/deepmd.py +0 -0
  27. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/dump.py +0 -0
  28. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/extendedxyz.py +0 -0
  29. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/__init__.py +0 -0
  30. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/common/__init__.py +0 -0
  31. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/common/registry.py +0 -0
  32. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/common/typing.py +0 -0
  33. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/common/utils.py +0 -0
  34. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/__init__.py +0 -0
  35. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/_utils.py +0 -0
  36. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/ase_datasets.py +0 -0
  37. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/base_dataset.py +0 -0
  38. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/embeddings/__init__.py +0 -0
  39. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/embeddings/atomic_radii.py +0 -0
  40. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/embeddings/continuous_embeddings.py +0 -0
  41. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/embeddings/khot_embeddings.py +0 -0
  42. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/embeddings/qmof_khot_embeddings.py +0 -0
  43. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/lmdb_database.py +0 -0
  44. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/datasets/target_metadata_guesser.py +0 -0
  45. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/modules/__init__.py +0 -0
  46. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/modules/transforms.py +0 -0
  47. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/fairchem/preprocessing/__init__.py +0 -0
  48. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/image.py +0 -0
  49. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/lammpsdata.py +0 -0
  50. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/lmps.py +0 -0
  51. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/movement.py +0 -0
  52. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/movement_saver.py +0 -0
  53. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/outcar.py +0 -0
  54. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/pertub/__init__.py +0 -0
  55. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/pertub/perturbation.py +0 -0
  56. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/pertub/scale.py +0 -0
  57. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/poscar.py +0 -0
  58. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/pwmlff.py +0 -0
  59. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/test/__init__.py +0 -0
  60. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/utils/__init__.py +0 -0
  61. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata/utils/constant.py +0 -0
  62. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata.egg-info/dependency_links.txt +0 -0
  63. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata.egg-info/entry_points.txt +0 -0
  64. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata.egg-info/requires.txt +0 -0
  65. {pwdata-0.4.1 → pwdata-0.4.3}/pwdata.egg-info/top_level.txt +0 -0
  66. {pwdata-0.4.1 → pwdata-0.4.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: pwdata is a data pre-processing tool for PWMLFF, which can be used to extract features and labels. It also provides convenient interfaces for data conversion between different software.
5
5
  Home-page: https://github.com/LonxunQuantum/pwdata
6
6
  Author: LonxunQuantum
@@ -277,18 +277,25 @@ def load_files(input_dict:dict, input_format:str=None, atom_types:list[str]=None
277
277
  tmp_image_data = Config(input_format, metapaths, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
278
278
  image_data.images.extend(tmp_image_data.images)
279
279
  print("There are a total of {} aselmdb, and the current progress has been loaded {} %".format(lmdb_nums, np.round(idx*chunk_size/lmdb_nums, 2)))
280
-
281
280
  else:
282
281
  if len(input_dict[FORMAT.traj]) > 0:# the input is traj files
283
- for data_path in input_dict[FORMAT.traj]:
284
- image_data = Config(input_format, data_path, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
285
- if not isinstance(image_data.images, list): # for the first pwmlff/npy dir only has one picture
286
- image_data.images = [image_data.images]
282
+ for data_path in tqdm(input_dict[FORMAT.traj], total=len(input_dict[FORMAT.traj])):
283
+ if image_data is None:
284
+ image_data = Config(input_format, data_path, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
285
+ if not isinstance(image_data.images, list): # for the first pwmlff/npy dir only has one picture
286
+ image_data.images = [image_data.images]
287
+ else:
288
+ tmp_image_data = Config(input_format, data_path, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
289
+ image_data.images.extend(tmp_image_data.images)
287
290
  else:
288
291
  for data_path in tqdm(input_dict[input_format], total=len(input_dict[input_format])):
289
- image_data = Config(input_format, data_path, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
290
- if not isinstance(image_data.images, list): # for the first pwmlff/npy dir only has one picture
291
- image_data.images = [image_data.images]
292
+ if image_data is None:
293
+ image_data = Config(input_format, data_path, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
294
+ if not isinstance(image_data.images, list): # for the first pwmlff/npy dir only has one picture
295
+ image_data.images = [image_data.images]
296
+ else:
297
+ tmp_image_data = Config(input_format, data_path, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
298
+ image_data.images.extend(tmp_image_data.images)
292
299
  return image_data
293
300
 
294
301
  else:
@@ -308,7 +315,6 @@ def load_files(input_dict:dict, input_format:str=None, atom_types:list[str]=None
308
315
  tmp_image_data = Config(input_format, metapaths, atom_names=atom_types, query=query, cpu_nums=cpu_nums)
309
316
  image_data.images.extend(tmp_image_data.images)
310
317
  # print("There are a total of {} aselmdb, and the current progress has been loaded {} %".format(lmdb_nums, np.round(idx*chunk_size/lmdb_nums, 2)))
311
-
312
318
  else:
313
319
  for data_path in tqdm(data_list, total=len(data_list)):
314
320
  if image_data is None:
@@ -297,7 +297,8 @@ def main(cmd_list:list=None):
297
297
  cmd_list = sys.argv
298
298
  if len(cmd_list) == 2 and '.json' in cmd_list[1].lower():
299
299
  json_dict = json.load(open(cmd_list[1]))
300
- format = json_dict['format']
300
+ format = json_dict['format'] if 'format' in json_dict.keys() else None
301
+ save_format = json_dict['save_format'] if 'save_format' in json_dict.keys() else None
301
302
  raw_files = json_dict['raw_files']
302
303
  if not isinstance(raw_files, list):
303
304
  raw_files = [raw_files]
@@ -307,9 +308,13 @@ def main(cmd_list:list=None):
307
308
  cmd_list = ['pwdata', 'convert_configs']
308
309
  cmd_list.append('-i')
309
310
  cmd_list.extend(raw_files)
310
- cmd_list.extend(['-f', format])
311
+ if format is not None:
312
+ cmd_list.extend(['-f', format])
311
313
  cmd_list.extend(['-s', save_dir])
312
- cmd_list.extend(['-o', 'pwmlff/npy'])
314
+ if save_format is not None:
315
+ cmd_list.extend(['-o', save_format])
316
+ else:
317
+ cmd_list.extend(['-o', 'pwmlff/npy'])
313
318
  cmd_list.extend(['-p', '{}'.format(train_valid_ratio)])
314
319
  if shuffle:
315
320
  cmd_list.append('-r')
@@ -460,7 +465,7 @@ def run_convert_configs(cmd_list:list[str]):
460
465
  parser.add_argument('-m', '--merge', type=int, required=False, default=1, help="if '-m 1' the output config files will save into one xyzfile. Otherwise, the out configs will be saved separately according to the structural element types. The default value is 1")
461
466
  parser.add_argument('-g', '--gap', help='Take a config every gap steps from the middle of the trajectory, default is 1', type=int, default=1)
462
467
  parser.add_argument('-q', '--query', type=str, required=False, help='For meta data, advanced query statement, filter Mata data based on query criteria, detailed usage reference http://doc.lonxun.com/PWMLFF/Appendix-2', default=None)
463
- parser.add_argument('-n', '--cpu_nums', type=int, required=False, help='For meta data, parallel reading of meta databases using kernel count, default to using all available cores', default=None)
468
+ parser.add_argument('-n', '--cpu_nums', type=int, default=1, required=False, help='For meta data, parallel reading of meta databases using kernel count, default to using all available cores')
464
469
  parser.add_argument('-t', '--atom_types', type=str, required=False, nargs='+', help="For 'lammps/lmp', 'lammps/dump': the atom type list of lammps lmp/dump file, the order is same as lammps dump file.\nFor meta data: Query structures that only exist for that element type", default=None)
465
470
 
466
471
  args = parser.parse_args(cmd_list)
@@ -158,9 +158,9 @@ def to_image(Atoms):
158
158
  image.Ep = Atoms.energy
159
159
 
160
160
  # 计算 Atomic-Energy
161
- atomic_energy, _, _, _ = np.linalg.lstsq([image.atom_type_num], np.array([image.Ep]), rcond=1e-3)
162
- atomic_energy = np.repeat(atomic_energy, image.atom_type_num)
163
- image.atomic_energy = atomic_energy.tolist()
161
+ # atomic_energy, _, _, _ = np.linalg.lstsq([image.atom_type_num], np.array([image.Ep]), rcond=1e-3)
162
+ # atomic_energy = np.repeat(atomic_energy, image.atom_type_num)
163
+ # image.atomic_energy = atomic_energy.tolist()
164
164
 
165
165
  vol = Atoms.volume
166
166
  virial = (-np.array(Atoms.stress) * vol)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: pwdata is a data pre-processing tool for PWMLFF, which can be used to extract features and labels. It also provides convenient interfaces for data conversion between different software.
5
5
  Home-page: https://github.com/LonxunQuantum/pwdata
6
6
  Author: LonxunQuantum
@@ -21,7 +21,6 @@ pwdata/movement_saver.py
21
21
  pwdata/outcar.py
22
22
  pwdata/poscar.py
23
23
  pwdata/pwmlff.py
24
- pwdata/test.py
25
24
  pwdata.egg-info/PKG-INFO
26
25
  pwdata.egg-info/SOURCES.txt
27
26
  pwdata.egg-info/dependency_links.txt
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="pwdata",
8
- version="0.4.1",
8
+ version="0.4.3",
9
9
  author="LonxunQuantum",
10
10
  author_email="lonxun@pwmat.com",
11
11
  description="pwdata is a data pre-processing tool for PWMLFF, which can be used to extract features and labels. It also provides convenient interfaces for data conversion between different software.",
@@ -1,164 +0,0 @@
1
- import os
2
- from main import main
3
- import json
4
- from pwdata.utils.constant import FORMAT
5
- from pwdata.convert_files import search_images
6
-
7
- # scale_cell super_cell pertub convert_config convert_images
8
- def test_convert_config():
9
- res_list = []
10
- configs = json.load(open("./config.json"))["convert_image"]
11
- save_dir = "./test_workdir"
12
- for config in configs:
13
- config_file = config["input_file"]
14
- config_format= config["input_format"]
15
- if "atom_types" in config.keys():
16
- atom_types = config["atom_types"]
17
- else:
18
- atom_types = None
19
- for format in ["pwmat/config","vasp/poscar","lammps/lmp"]:
20
- cmd_list = ["", "cvt_config", "-i", config_file, "-f", config_format, "-s", os.path.join(save_dir, "{}_{}".format("cvtcnf", FORMAT.get_filename_by_format(format))), "-o", format, "-c"]
21
- if atom_types is not None:
22
- cmd_list.append("-t")
23
- cmd_list.extend(atom_types)
24
- main(cmd_list)
25
- res_list.append(cmd_list)
26
- return res_list
27
-
28
- def test_scale_cell():
29
- res_list = []
30
- configs = json.load(open("./config.json"))["convert_image"]
31
- save_dir = "./test_workdir"
32
- for idi, config in enumerate(configs):
33
- config_file = config["input_file"]
34
- config_format= config["input_format"]
35
- if "atom_types" in config.keys():
36
- atom_types = config["atom_types"]
37
- else:
38
- atom_types = None
39
- for idj, format in enumerate(["pwmat/config","vasp/poscar","lammps/lmp"]):
40
- save_path = os.path.join(save_dir, "scale_{}_{}_{}".format(idi, idj, FORMAT.get_filename_by_format(format)))
41
- cmd_list = ["", "scale_cell", "-r", "0.98", "0.99", "0.97", "0.95", "-i", config_file, "-s", save_path, "-o", format, "-c"]#"-f", config_format,
42
- if atom_types is not None:
43
- cmd_list.append("-t")
44
- cmd_list.extend(atom_types)
45
- main(cmd_list)
46
- res_list.append(cmd_list)
47
- return res_list
48
-
49
- def test_super_cell():
50
- res_list = []
51
- configs = json.load(open("./config.json"))["convert_image"]
52
- save_dir = "./test_workdir"
53
- for idi, config in enumerate(configs):
54
- config_file = config["input_file"]
55
- config_format= config["input_format"]
56
- if "atom_types" in config.keys():
57
- atom_types = config["atom_types"]
58
- else:
59
- atom_types = None
60
- for idj, format in enumerate(["pwmat/config","vasp/poscar","lammps/lmp"]):
61
- save_path = os.path.join(save_dir, "super_{}_{}_{}".format(idi, idj, FORMAT.get_filename_by_format(format)))
62
- cmd_list = ["", "super_cell", "-m", "2", "3", "4", "-i", config_file, "-s", save_path, "-o", format, "-c"]# "-f", config_format,
63
- if atom_types is not None:
64
- cmd_list.append("-t")
65
- cmd_list.extend(atom_types)
66
- main(cmd_list)
67
- res_list.append(cmd_list)
68
- return res_list
69
-
70
- def test_pertub():
71
- res_list = []
72
- configs = json.load(open("./config.json"))["convert_image"]
73
- save_dir = "./test_workdir"
74
- for idi, config in enumerate(configs):
75
- config_file = config["input_file"]
76
- config_format= config["input_format"]
77
- if "atom_types" in config.keys():
78
- atom_types = config["atom_types"]
79
- else:
80
- atom_types = None
81
- for idj, format in enumerate(["pwmat/config","vasp/poscar","lammps/lmp"]):
82
- save_path = os.path.join(save_dir, "perturb_{}_{}_{}".format(idi, idj, FORMAT.get_filename_by_format(format).split('.')[0]))
83
- cmd_list = ["", "perturb", "-e", "0.01", "-d", "0.04", "-n", "20", "-i", config_file, "-s", save_path, "-o", format, "-c"]#"-f", config_format,
84
- if atom_types is not None:
85
- cmd_list.append("-t")
86
- cmd_list.extend(atom_types)
87
- main(cmd_list)
88
- res_list.append(cmd_list)
89
- return res_list
90
-
91
- def test_convert_configs():
92
- res_list = []
93
- configs = json.load(open("./config.json"))["convert_configs"]
94
- save_dir = "./test_workdir"
95
- for idi, config in enumerate(configs):
96
- config_file = config["input_file"]
97
- if isinstance(config_file, str):
98
- config_file = [config_file]
99
-
100
- for _ in config_file:
101
- if not os.path.exists(_):
102
- print("{} not exists".format(_))
103
- config_format= config["input_format"]
104
- if "atom_types" in config.keys():
105
- atom_types = config["atom_types"]
106
- else:
107
- atom_types = None
108
-
109
- # res = search_images(config_file, config_format)
110
- # print(res)
111
- # if config_format == FORMAT.meta:
112
- # print()
113
- for idj, format in enumerate([FORMAT.pwmlff_npy, FORMAT.extxyz]):
114
- save_path = os.path.join(save_dir, "{}_{}_{}_{}".format(idi, idj, config_format.replace('/','_'), FORMAT.get_filename_by_format(format).split('.')[0]))
115
- cmd_list = ["", "convert_configs"]
116
- cmd_list.append("-i")
117
- cmd_list.extend(config_file)
118
- cmd_list.extend([ "-s", save_path, "-o", format, "-p", "1.0", "-r", "-g", "1", "-m", '1'])#"-f", config_format,
119
- if atom_types is not None:
120
- cmd_list.append("-t")
121
- cmd_list.extend(atom_types)
122
- main(cmd_list)
123
- res_list.append(cmd_list)
124
- return res_list
125
-
126
- def test_meata_data():
127
- res_list = []
128
- # res = search_images(config_file, config_format)
129
- # print(res)
130
- atom_types = ["Pt", "Ge"]
131
- save_dir = "./test_workdir"
132
- for idj, format in enumerate([FORMAT.extxyz]):
133
- save_path = os.path.join(save_dir, "test_{}_meta_{}".format(idj, FORMAT.get_filename_by_format(format).split('.')[0]))
134
- cmd_list = ["", "convert_configs"]
135
- cmd_list.append("-i")
136
- cmd_list.append("./meta_data.json")
137
- cmd_list.extend([ "-s", save_path, "-o", format, "-p", "0.8", "-r"])#, "-c", "10" , "-q", "HfGeH" "-f", "meta",
138
- if atom_types is not None:
139
- cmd_list.append("-t")
140
- cmd_list.extend(atom_types)
141
- main(cmd_list)
142
- res_list.append(cmd_list)
143
- for res in res_list:
144
- print(" ".join(res))
145
-
146
- if __name__ == "__main__":
147
- # run_cmd(["", "-h"])
148
- # run_cmd(["", "cvt_config", "-h"])
149
- # run_cmd(["", "scale_cell", "-h"])
150
- # run_cmd(["", "super_cell", "-h"])
151
- # run_cmd(["", "perturb", "-h"])
152
- # run_cmd(["", "cvt_configs", "-h"])
153
- os.chdir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "examples"))
154
- cmd_list = []
155
- cmd_list.extend(test_scale_cell())
156
- cmd_list.extend(test_super_cell())
157
- cmd_list.extend(test_pertub())
158
- cmd_list.extend(test_convert_config())
159
- cmd_list.extend(test_convert_configs())
160
-
161
- for cmd in cmd_list:
162
- print(" ".join(cmd))
163
-
164
- # test_meata_data()
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