pwdata 0.2.18__tar.gz → 0.3.0__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 (39) hide show
  1. {pwdata-0.2.18 → pwdata-0.3.0}/PKG-INFO +1 -1
  2. pwdata-0.3.0/pwdata/check_envs.py +5 -0
  3. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/deepmd.py +5 -1
  4. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/dump.py +3 -2
  5. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/image.py +2 -2
  6. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/main.py +56 -40
  7. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/pwmlff.py +7 -3
  8. pwdata-0.3.0/pwdata/test.py +18 -0
  9. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata.egg-info/PKG-INFO +1 -1
  10. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata.egg-info/SOURCES.txt +2 -0
  11. {pwdata-0.2.18 → pwdata-0.3.0}/setup.py +1 -1
  12. {pwdata-0.2.18 → pwdata-0.3.0}/LICENSE +0 -0
  13. {pwdata-0.2.18 → pwdata-0.3.0}/README.md +0 -0
  14. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/__init__.py +0 -0
  15. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/atomconfig.py +0 -0
  16. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/build/__init__.py +0 -0
  17. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/build/cell.py +0 -0
  18. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/build/geometry.py +0 -0
  19. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/build/supercells.py +0 -0
  20. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/build/write_struc.py +0 -0
  21. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/calculators/__init__.py +0 -0
  22. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/calculators/const.py +0 -0
  23. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/calculators/unitconvert_lmps.py +0 -0
  24. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/calculators/units.py +0 -0
  25. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/cp2kdata.py +0 -0
  26. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/datasets_saver.py +0 -0
  27. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/extendedxyz.py +0 -0
  28. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/lammpsdata.py +0 -0
  29. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/lmps.py +0 -0
  30. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/movement.py +0 -0
  31. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/movement_saver.py +0 -0
  32. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/outcar.py +0 -0
  33. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/pertub/__init__.py +0 -0
  34. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/pertub/perturbation.py +0 -0
  35. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/pertub/scale.py +0 -0
  36. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata/poscar.py +0 -0
  37. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata.egg-info/dependency_links.txt +0 -0
  38. {pwdata-0.2.18 → pwdata-0.3.0}/pwdata.egg-info/top_level.txt +0 -0
  39. {pwdata-0.2.18 → pwdata-0.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.2.18
3
+ Version: 0.3.0
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
@@ -0,0 +1,5 @@
1
+ def print_cmd():
2
+ cmd_infos()
3
+
4
+ def cmd_infos():
5
+ print("In functional development, please refer to the link\n\t\thttp://doc.lonxun.com/PWMLFF/Appendix-2/")
@@ -103,7 +103,11 @@ class DPRAW(object):
103
103
  box, coord, energy, force, virial, image_nums = self.load_raw(raw_files, atom_nums)
104
104
 
105
105
  for i in range(image_nums):
106
- image = Image(lattice=box[i], position=coord[i], force=force[i], Ep=energy[i], virial=virial[i],
106
+ try:
107
+ virial_image = virial[i]
108
+ except Exception as e:
109
+ virial_image = None
110
+ image = Image(lattice=box[i], position=coord[i], force=force[i], Ep=energy[i], virial=virial_image,
107
111
  atom_type=atom_type, atom_nums=atom_nums, atom_types_image=atom_types_image, atom_type_num=atom_type_num,
108
112
  cartesian=True, image_nums=i)
109
113
  atomic_energy, _, _, _ = np.linalg.lstsq([atom_type_num], np.array([image.Ep]), rcond=1e-3)
@@ -68,7 +68,8 @@ class DUMP(object):
68
68
  image.atom_type_num = info["atom_type_num"]
69
69
  image.atom_types_image = info["atom_types_image"]
70
70
  image.position = info["positions"]
71
- image.force = info["forces"]
71
+ if "forces" in info.keys():
72
+ image.force = info["forces"]
72
73
  image.pbc = pbc
73
74
  image.cartesian = True
74
75
 
@@ -193,4 +194,4 @@ class DUMP(object):
193
194
  all["lattice_disp"] = lattice_disp
194
195
 
195
196
  return all
196
-
197
+
@@ -47,7 +47,7 @@ class Image(object):
47
47
  self.scf = scf
48
48
  self.image_nums = image_nums
49
49
  self.lattice = lattice if lattice is not None else []
50
- self.virial = virial if virial is not None else []
50
+ self.virial = virial
51
51
  self.position = position if position is not None else [] # this position can be fractional coordinates or cartesian coordinates
52
52
  self.force = force if force is not None else []
53
53
  self.atomic_energy = atomic_energy if atomic_energy is not None else []
@@ -305,4 +305,4 @@ def cart2frac(position, lattice):
305
305
  """
306
306
  position = np.array(position).reshape(-1, 3)
307
307
  lattice = np.array(lattice).reshape(3, 3)
308
- return np.dot(position, np.linalg.inv(lattice))
308
+ return np.dot(position, np.linalg.inv(lattice))
@@ -279,46 +279,62 @@ def string2index(string: str) -> Union[int, slice, str]:
279
279
  i += (3 - len(i)) * [None]
280
280
  return slice(*i)
281
281
 
282
+ def run_cmd():
283
+ from check_envs import print_cmd
284
+ if len(sys.argv) == 1 or "-h".upper() == sys.argv[1].upper() or \
285
+ "help".upper() == sys.argv[1].upper() or "-help".upper() == sys.argv[1].upper() or "--help".upper() == sys.argv[1].upper():
286
+ print_cmd()
287
+
288
+ elif "convert_config".upper() == sys.argv[1].upper():
289
+ pass
290
+
291
+
282
292
  if __name__ == "__main__":
283
- import argparse
284
- SUPERCELL_MATRIX = [[2, 0, 0], [0, 2, 0], [0, 0, 2]]
285
- data_file = "/data/home/hfhuang/2_MLFF/2-DP/19-json-version/8-Si2/atom.config"
286
- # data_file = "/data/home/hfhuang/9_cp2k/1-SiO2/cp2k.out"
287
- # data_file = "/data/home/hfhuang/software/mlff/Si/Si64-vasprun.xml"
288
- # data_file = "/data/home/hfhuang/2_MLFF/3-outcar2movement/0/OUTCARC3N4"
289
- output_path = "/data/home/hfhuang/2_MLFF/2-DP/19-json-version/8-Si2/mlff/"
290
- output_file = "supercell.config"
291
- format = "config"
292
- pbc = [1, 1, 1]
293
- # config = Config.read(format, data_file, atom_names=["Si"], index=-1) # read dump
294
- config = Config.read(format, data_file)
295
- Config.to(file_path = output_path,
296
- file_name = output_file,
297
- file_format = 'config',
298
- direct = True,
299
- sort = False)
300
- parser = argparse.ArgumentParser(description='Convert and build structures.')
301
- parser.add_argument('--format', type=str, required=False, help='Format of the input file', default="outcar")
302
- parser.add_argument('--save_format', type=str, required=False, help='Format of the output file', default="config")
303
- parser.add_argument('--outcar_file', type=str, required=False, help='Path to the OUTCAR file')
304
- parser.add_argument('--movement_file', type=str, required=False, help='Path to the MOVEMENT file')
305
- parser.add_argument('--output_path', type=str, required=False, help='Path to the output directory', default="./")
306
- parser.add_argument('--output_file', type=str, required=False, help='Name of the output file', default="MOVEMENT")
307
- parser.add_argument('--supercell_matrix', type=list, required=False, help='Supercell matrix', default=[[1, 0, 0], [0, 1, 0], [0, 0, 1]])
308
- parser.add_argument('--pbc', type=list, required=False, help='Periodic boundary conditions flags', default=[1, 1, 1])
309
- parser.add_argument('--direct', type=bool, required=False, help='Whether to write the positions in direct (frac) coordinates', default=True)
310
- parser.add_argument('--sort', type=bool, required=False, help='Whether to sort the atoms by atomic number', default=True)
311
- parser.add_argument('--pert_num', type=int, required=False, help='Number of perturbed structures', default=50)
312
- parser.add_argument('--cell_pert_fraction', type=float, required=False, help='Fraction of the cell perturbation', default=0.03)
313
- parser.add_argument('--atom_pert_distance', type=float, required=False, help='Distance of the atom perturbation', default=0.01)
314
- parser.add_argument('--retain_raw', type=bool, required=False, help='Whether to retain raw data', default=False)
315
- parser.add_argument('--train_ratio', type=float, required=False, help='Ratio of training data', default=0.8)
316
- parser.add_argument('--random', type=bool, required=False, help='Whether to shuffle the data', default=True)
317
- parser.add_argument('--scale_factor', type=float, required=False, help='Scale factor of the lattice', default=1.0)
318
- parser.add_argument('--seed', type=int, required=False, help='Random seed', default=2024)
319
- parser.add_argument('--index', type=Union[int, slice, str], required=False, help='Index of the configuration', default=-1)
320
- parser.add_argument('--atom_names', type=list, required=False, help='Names of the atoms', default=["H"])
321
- parser.add_argument('--style', type=str, required=False, help='Style of the lammps input file', default="atomic")
293
+ # import argparse
294
+ # SUPERCELL_MATRIX = [[2, 0, 0], [0, 2, 0], [0, 0, 2]]
295
+ # data_file = "/data/home/hfhuang/2_MLFF/2-DP/19-json-version/8-Si2/atom.config"
296
+ # # data_file = "/data/home/hfhuang/9_cp2k/1-SiO2/cp2k.out"
297
+ # # data_file = "/data/home/hfhuang/software/mlff/Si/Si64-vasprun.xml"
298
+ # # data_file = "/data/home/hfhuang/2_MLFF/3-outcar2movement/0/OUTCARC3N4"
299
+ # output_path = "/data/home/hfhuang/2_MLFF/2-DP/19-json-version/8-Si2/mlff/"
300
+ # output_file = "supercell.config"
301
+ # format = "config"
302
+ # pbc = [1, 1, 1]
303
+ # # config = Config.read(format, data_file, atom_names=["Si"], index=-1) # read dump
304
+ # config = Config.read(format, data_file)
305
+ # Config.to(file_path = output_path,
306
+ # file_name = output_file,
307
+ # file_format = 'config',
308
+ # direct = True,
309
+ # sort = False)
310
+ # parser = argparse.ArgumentParser(description='Convert and build structures.')
311
+ # parser.add_argument('--format', type=str, required=False, help='Format of the input file', default="outcar")
312
+ # parser.add_argument('--save_format', type=str, required=False, help='Format of the output file', default="config")
313
+ # parser.add_argument('--outcar_file', type=str, required=False, help='Path to the OUTCAR file')
314
+ # parser.add_argument('--movement_file', type=str, required=False, help='Path to the MOVEMENT file')
315
+ # parser.add_argument('--output_path', type=str, required=False, help='Path to the output directory', default="./")
316
+ # parser.add_argument('--output_file', type=str, required=False, help='Name of the output file', default="MOVEMENT")
317
+ # parser.add_argument('--supercell_matrix', type=list, required=False, help='Supercell matrix', default=[[1, 0, 0], [0, 1, 0], [0, 0, 1]])
318
+ # parser.add_argument('--pbc', type=list, required=False, help='Periodic boundary conditions flags', default=[1, 1, 1])
319
+ # parser.add_argument('--direct', type=bool, required=False, help='Whether to write the positions in direct (frac) coordinates', default=True)
320
+ # parser.add_argument('--sort', type=bool, required=False, help='Whether to sort the atoms by atomic number', default=True)
321
+ # parser.add_argument('--pert_num', type=int, required=False, help='Number of perturbed structures', default=50)
322
+ # parser.add_argument('--cell_pert_fraction', type=float, required=False, help='Fraction of the cell perturbation', default=0.03)
323
+ # parser.add_argument('--atom_pert_distance', type=float, required=False, help='Distance of the atom perturbation', default=0.01)
324
+ # parser.add_argument('--retain_raw', type=bool, required=False, help='Whether to retain raw data', default=False)
325
+ # parser.add_argument('--train_ratio', type=float, required=False, help='Ratio of training data', default=0.8)
326
+ # parser.add_argument('--random', type=bool, required=False, help='Whether to shuffle the data', default=True)
327
+ # parser.add_argument('--scale_factor', type=float, required=False, help='Scale factor of the lattice', default=1.0)
328
+ # parser.add_argument('--seed', type=int, required=False, help='Random seed', default=2024)
329
+ # parser.add_argument('--index', type=Union[int, slice, str], required=False, help='Index of the configuration', default=-1)
330
+ # parser.add_argument('--atom_names', type=list, required=False, help='Names of the atoms', default=["H"])
331
+ # parser.add_argument('--style', type=str, required=False, help='Style of the lammps input file', default="atomic")
322
332
 
323
- args = parser.parse_args()
333
+ # args = parser.parse_args()
324
334
 
335
+ run_cmd()
336
+
337
+ config = Config.read("vasp/outcar",
338
+ "/data/home/wuxingxing/datas/al_dir/si_4_vasp/init_bulk/temp_init_bulk_work/aimd/init_config_0/0.9_scale/3_aimd/OUTCAR")
339
+ print()
340
+
@@ -24,7 +24,8 @@ class PWNPY(object):
24
24
  coord = coord.reshape(-1, atom_nums, 3)
25
25
  force = force.reshape(-1, atom_nums, 3)
26
26
  for i in tqdm(range(image_nums), desc="Loading data"):
27
- image = Image(lattice=lattice[i], position=coord[i], force=force[i], Ep=Ep[i], virial=virial[i],
27
+ _virail = virial[i] if virial is not None else None
28
+ image = Image(lattice=lattice[i], position=coord[i], force=force[i], Ep=Ep[i], virial=virial[i] if virial is not None else None,
28
29
  cartesian=False, image_nums=i, atom_nums=atom_nums,
29
30
  atomic_energy=atomic_energy[i], atom_type=atom_type, atom_types_image=atom_types_image)
30
31
  self.image_list.append(image)
@@ -55,7 +56,10 @@ class PWNPY(object):
55
56
  coord = np.load(npy_file) if coord is None else np.concatenate((coord, np.load(npy_file)))
56
57
 
57
58
  image_nums = len(Ep)
58
- atom_nums = len(atom_types_image)
59
+ if isinstance(atom_types_image.tolist(), int):
60
+ atom_nums = 1
61
+ else:
62
+ atom_nums = len(atom_types_image)
59
63
  virial = virial.reshape(-1, 3, 3) if virial is not None else None
60
64
 
61
- return atom_type, atomic_energy, Ep.squeeze(), force, atom_types_image, lattice, coord, virial, image_nums, atom_nums
65
+ return atom_type, atomic_energy, Ep, force, atom_types_image, lattice, coord, virial, image_nums, atom_nums
@@ -0,0 +1,18 @@
1
+ import os, sys, glob
2
+ from main import Save_Data
3
+
4
+ def test():
5
+ work_dir = "/data/home/wuxingxing/datas/PWMLFF_library_data/HfO2/hfo2_dpgen/HfO2_liutheory"
6
+ init_dir = glob.glob(os.path.join(work_dir, "sys.*"))
7
+ init_dir = sorted(init_dir, key=lambda x: int(x.split(".")[-1]))
8
+ for i, d in enumerate(init_dir):
9
+ print(i, d)
10
+ Save_Data(data_path=d,
11
+ datasets_path=os.path.join(work_dir, "new_pwdata"),
12
+ train_ratio = 0.2,
13
+ random=False,
14
+ format="deepmd/npy"
15
+ )
16
+
17
+ if __name__ == "__main__":
18
+ test()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.2.18
3
+ Version: 0.3.0
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
@@ -3,6 +3,7 @@ README.md
3
3
  setup.py
4
4
  pwdata/__init__.py
5
5
  pwdata/atomconfig.py
6
+ pwdata/check_envs.py
6
7
  pwdata/cp2kdata.py
7
8
  pwdata/datasets_saver.py
8
9
  pwdata/deepmd.py
@@ -17,6 +18,7 @@ pwdata/movement_saver.py
17
18
  pwdata/outcar.py
18
19
  pwdata/poscar.py
19
20
  pwdata/pwmlff.py
21
+ pwdata/test.py
20
22
  pwdata.egg-info/PKG-INFO
21
23
  pwdata.egg-info/SOURCES.txt
22
24
  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.2.18",
8
+ version="0.3.0",
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.",
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