pwdata 0.4.5__tar.gz → 0.4.7__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.
Files changed (69) hide show
  1. {pwdata-0.4.5 → pwdata-0.4.7}/PKG-INFO +1 -1
  2. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/config.py +7 -1
  3. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/main.py +7 -3
  4. pwdata-0.4.7/pwdata/test/mdtrajs2config.py +42 -0
  5. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/test.py +5 -5
  6. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata.egg-info/PKG-INFO +1 -1
  7. {pwdata-0.4.5 → pwdata-0.4.7}/setup.py +1 -1
  8. pwdata-0.4.5/pwdata/test/mdtrajs2config.py +0 -30
  9. {pwdata-0.4.5 → pwdata-0.4.7}/LICENSE +0 -0
  10. {pwdata-0.4.5 → pwdata-0.4.7}/README.md +0 -0
  11. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/__init__.py +0 -0
  12. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/atomconfig.py +0 -0
  13. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/build/__init__.py +0 -0
  14. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/build/cell.py +0 -0
  15. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/build/geometry.py +0 -0
  16. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/build/supercells.py +0 -0
  17. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/build/write_struc.py +0 -0
  18. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/calculators/__init__.py +0 -0
  19. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/calculators/const.py +0 -0
  20. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/calculators/unitconvert_lmps.py +0 -0
  21. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/calculators/units.py +0 -0
  22. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/check_envs.py +0 -0
  23. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/convert_files.py +0 -0
  24. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/cp2kdata.py +0 -0
  25. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/datasets_saver.py +0 -0
  26. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/deepmd.py +0 -0
  27. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/dump.py +0 -0
  28. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/extendedxyz.py +0 -0
  29. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/__init__.py +0 -0
  30. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/common/__init__.py +0 -0
  31. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/common/registry.py +0 -0
  32. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/common/typing.py +0 -0
  33. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/common/utils.py +0 -0
  34. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/__init__.py +0 -0
  35. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/_utils.py +0 -0
  36. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/ase_datasets.py +0 -0
  37. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/base_dataset.py +0 -0
  38. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/embeddings/__init__.py +0 -0
  39. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/embeddings/atomic_radii.py +0 -0
  40. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/embeddings/continuous_embeddings.py +0 -0
  41. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/embeddings/khot_embeddings.py +0 -0
  42. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/embeddings/qmof_khot_embeddings.py +0 -0
  43. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/lmdb_database.py +0 -0
  44. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/datasets/target_metadata_guesser.py +0 -0
  45. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/modules/__init__.py +0 -0
  46. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/modules/transforms.py +0 -0
  47. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/fairchem/preprocessing/__init__.py +0 -0
  48. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/image.py +0 -0
  49. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/lammpsdata.py +0 -0
  50. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/lmps.py +0 -0
  51. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/meta.py +0 -0
  52. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/movement.py +0 -0
  53. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/movement_saver.py +0 -0
  54. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/outcar.py +0 -0
  55. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/pertub/__init__.py +0 -0
  56. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/pertub/perturbation.py +0 -0
  57. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/pertub/scale.py +0 -0
  58. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/poscar.py +0 -0
  59. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/pwmlff.py +0 -0
  60. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/test/__init__.py +0 -0
  61. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/test/mptraj2lmdb.py +0 -0
  62. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/utils/__init__.py +0 -0
  63. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata/utils/constant.py +0 -0
  64. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata.egg-info/SOURCES.txt +0 -0
  65. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata.egg-info/dependency_links.txt +0 -0
  66. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata.egg-info/entry_points.txt +0 -0
  67. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata.egg-info/requires.txt +0 -0
  68. {pwdata-0.4.5 → pwdata-0.4.7}/pwdata.egg-info/top_level.txt +0 -0
  69. {pwdata-0.4.5 → pwdata-0.4.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.4.5
3
+ Version: 0.4.7
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
@@ -123,7 +123,10 @@ class Config(object):
123
123
  self.atom_names = atom_names
124
124
  self.index = index
125
125
  self.kwargs = kwargs
126
- self.images = self._read()
126
+ if data_path is not None:
127
+ self.images = self._read()
128
+ else:
129
+ self.images = []
127
130
 
128
131
  def _read(self):
129
132
  images, format = Config.read(self.format, self.data_path, self.pbc, self.atom_names, self.index, **self.kwargs)
@@ -199,6 +202,8 @@ class Config(object):
199
202
  image = META(data_path, atom_names, **kwargs).image_list[index]
200
203
  else:
201
204
  raise Exception("Error! The format of the input file is not supported!")
205
+ if not isinstance(image, list):
206
+ image = [image]
202
207
  return image, format.lower()
203
208
 
204
209
  def to(self, output_path, save_format = None, **kwargs):
@@ -271,6 +276,7 @@ class Config(object):
271
276
 
272
277
  def string2index(string: str) -> Union[int, slice, str]:
273
278
  """Convert index string to either int or slice"""
279
+ string = string.replace(" ", "")
274
280
  if ':' not in string:
275
281
  # may contain database accessor
276
282
  try:
@@ -332,10 +332,14 @@ def main(cmd_list:list=None):
332
332
  elif "convert_configs".upper() == cmd_list[1].upper() or "cvt_configs".upper() == cmd_list[1].upper():
333
333
  run_convert_configs(cmd_list[2:])
334
334
  elif "count".upper() == cmd_list[1].upper() or "count_configs".upper() == cmd_list[1].upper():
335
- if '.json' in cmd_list[1].lower():
335
+ if '.json' in cmd_list[2].lower():
336
+ json_dict = json.load(open(cmd_list[2]))
336
337
  format = json_dict['format'] if 'format' in json_dict.keys() else None
337
- raw_files = json_dict['raw_files']
338
- cmd_list = ["count", "-i", cmd_list[1]]
338
+ input = json_dict['datapath'] if 'datapath' in json_dict.keys() else None
339
+ if input is None:
340
+ input = json_dict['raw_files'] if 'raw_files' in json_dict.keys() else None
341
+ cmd_list = ["-i"]
342
+ cmd_list.extend(input)
339
343
  if format is not None:
340
344
  cmd_list.extend(['-f', format])
341
345
  count_configs(cmd_list) # pwdata count extract.json
@@ -0,0 +1,42 @@
1
+ '''
2
+ description:
3
+ Convert various trajectory files ('pwmat/movement','vasp/outcar','cp2k/md', or 'lammps/dump')
4
+ to a single structure format ('pwmat/config', 'vasp/poscar', 'lammps/lmp')
5
+ '''
6
+
7
+ from pwdata import Config
8
+ from pwdata.utils.constant import FORMAT
9
+ from pwdata.config import string2index
10
+ def trajs2config():
11
+ # atom_types = ["Hf", "O"] # for lammps
12
+ input_file = "/data/home/wuxingxing/datas/auto_test_pwmlff/pwdata_test/vasp_data/Si_OUTCAR"
13
+ save_dir = "/data/home/wuxingxing/datas/auto_test_pwmlff/pwdata_test/vasp_data/tmp_test"
14
+ input_format="vasp/outcar"
15
+ save_format = "vasp/poscar"
16
+ index_str="10:" #'start:stop:step' -> '0:10' is '0:10:1'
17
+ image = Config(data_path=input_file, format=input_format, index=index_str, atom_names=None)
18
+ tmp_image_data = image.images
19
+ indexs = string2index(index_str)
20
+ if isinstance(indexs, slice):
21
+ start = 0 if indexs.start is None else indexs.start
22
+ end = len(tmp_image_data) if indexs.stop is None else indexs.stop
23
+ step = 1 if indexs.step is None else indexs.step
24
+ save_list = list(range(start, end, step))
25
+ for id, config in enumerate(tmp_image_data):
26
+ savename = "{}_{}".format(save_list[id], FORMAT.get_filename_by_format(save_format))
27
+ image.iamges = [config]
28
+ image.to(output_path = save_dir,
29
+ data_name = savename,
30
+ save_format = save_format,
31
+ sort = True)
32
+ else:
33
+ savename = "{}_{}".format(indexs, FORMAT.get_filename_by_format(save_format))
34
+ image.to(output_path = save_dir,
35
+ data_name = savename,
36
+ save_format = save_format,
37
+ sort = True)
38
+
39
+ if __name__=="__main__":
40
+ trajs2config()
41
+
42
+
@@ -179,11 +179,11 @@ if __name__ == "__main__":
179
179
  # run_cmd(["", "cvt_configs", "-h"])
180
180
  os.chdir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "examples"))
181
181
  cmd_list = []
182
- # cmd_list.extend(test_scale_cell())
183
- # cmd_list.extend(test_super_cell())
184
- # cmd_list.extend(test_pertub())
185
- # cmd_list.extend(test_convert_config())
186
- # cmd_list.extend(test_convert_configs())
182
+ cmd_list.extend(test_scale_cell())
183
+ cmd_list.extend(test_super_cell())
184
+ cmd_list.extend(test_pertub())
185
+ cmd_list.extend(test_convert_config())
186
+ cmd_list.extend(test_convert_configs())
187
187
  cmd_list.extend(test_count_configs())
188
188
 
189
189
  for cmd in cmd_list:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.4.5
3
+ Version: 0.4.7
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
@@ -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.5",
8
+ version="0.4.7",
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,30 +0,0 @@
1
- '''
2
- description:
3
- Convert various trajectory files ('pwmat/movement','vasp/outcar','cp2k/md', or 'lammps/dump')
4
- to a single structure format ('pwmat/config', 'vasp/poscar', 'lammps/lmp')
5
- '''
6
-
7
- from pwdata import Config
8
- from pwdata.utils.constant import FORMAT
9
-
10
- def trajs2config():
11
- atom_types = ["Hf", "O"] # for lammps
12
- input_file = "/data/home/wuxingxing/codespace/pwdata/examples/lmps_data/HfO2/30.lammpstrj"
13
- input_format="lammps/dump"
14
- save_format = "pwmat/config"
15
-
16
- image = Config(data_path=input_file, format=input_format, atom_names=atom_types)
17
- tmp_image_data = image.images
18
- save_dir = "./tmp_test"
19
- for id, config in enumerate(tmp_image_data):
20
- savename = "{}_{}".format(id, FORMAT.get_filename_by_format(save_format))
21
- image.iamges = [config]
22
- image.to(output_path = save_dir,
23
- data_name = savename,
24
- save_format = save_format,
25
- sort = True)
26
-
27
- if __name__=="__main__":
28
- trajs2config()
29
-
30
-
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