pwdata 0.2.8__tar.gz → 0.2.9__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 (37) hide show
  1. {pwdata-0.2.8 → pwdata-0.2.9}/PKG-INFO +1 -1
  2. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/main.py +5 -1
  3. pwdata-0.2.9/pwdata/pwmlff.py +59 -0
  4. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata.egg-info/PKG-INFO +1 -1
  5. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata.egg-info/SOURCES.txt +1 -0
  6. {pwdata-0.2.8 → pwdata-0.2.9}/setup.py +1 -1
  7. {pwdata-0.2.8 → pwdata-0.2.9}/LICENSE +0 -0
  8. {pwdata-0.2.8 → pwdata-0.2.9}/README.md +0 -0
  9. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/__init__.py +0 -0
  10. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/atomconfig.py +0 -0
  11. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/build/__init__.py +0 -0
  12. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/build/cell.py +0 -0
  13. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/build/geometry.py +0 -0
  14. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/build/supercells.py +0 -0
  15. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/build/write_struc.py +0 -0
  16. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/calculators/__init__.py +0 -0
  17. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/calculators/const.py +0 -0
  18. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/calculators/unitconvert_lmps.py +0 -0
  19. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/calculators/units.py +0 -0
  20. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/cp2kdata.py +0 -0
  21. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/datasets_saver.py +0 -0
  22. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/deepmd.py +0 -0
  23. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/dump.py +0 -0
  24. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/extendedxyz.py +0 -0
  25. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/image.py +0 -0
  26. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/lammpsdata.py +0 -0
  27. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/lmps.py +0 -0
  28. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/movement.py +0 -0
  29. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/movement_saver.py +0 -0
  30. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/outcar.py +0 -0
  31. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/pertub/__init__.py +0 -0
  32. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/pertub/perturbation.py +0 -0
  33. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/pertub/scale.py +0 -0
  34. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata/poscar.py +0 -0
  35. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata.egg-info/dependency_links.txt +0 -0
  36. {pwdata-0.2.8 → pwdata-0.2.9}/pwdata.egg-info/top_level.txt +0 -0
  37. {pwdata-0.2.8 → pwdata-0.2.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.2.8
3
+ Version: 0.2.9
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
@@ -1,7 +1,6 @@
1
1
  import numpy as np
2
2
  import os, sys, glob
3
3
  from math import ceil
4
- from collections import Counter
5
4
  from typing import (List, Union, Optional)
6
5
  # import time
7
6
  # os.chdir(os.path.dirname(os.path.abspath(__file__)))
@@ -15,6 +14,7 @@ from pwdata.dump import DUMP
15
14
  from pwdata.lammpsdata import LMP
16
15
  from pwdata.cp2kdata import CP2KMD, CP2KSCF
17
16
  from pwdata.deepmd import DPNPY, DPRAW
17
+ from pwdata.pwmlff import PWNPY
18
18
  from pwdata.movement_saver import save_to_movement
19
19
  from pwdata.extendedxyz import save_to_extxyz
20
20
  from pwdata.datasets_saver import save_to_dataset, get_pw, save_to_raw, save_to_npy
@@ -58,6 +58,8 @@ class Save_Data(object):
58
58
  self.image_data = DPNPY(data_path)
59
59
  elif format.lower() == 'deepmd/raw':
60
60
  self.image_data = DPRAW(data_path)
61
+ elif format.lower() == 'pwmlff/npy':
62
+ self.image_data = PWNPY(data_path)
61
63
  self.lattice, self.position, self.energies, self.ei, self.forces, self.virials, self.atom_type, self.atom_types_image, self.image_nums = get_pw(self.image_data.get())
62
64
 
63
65
  if train_ratio is not None: # inference 时不存数据
@@ -184,6 +186,8 @@ class Config(object):
184
186
  image = DPNPY(data_path).image_list[index]
185
187
  elif format.lower() == 'deepmd/raw':
186
188
  image = DPRAW(data_path).image_list[index]
189
+ elif format.lower() == 'pwmlff/npy':
190
+ image = PWNPY(data_path).image_list[index]
187
191
  else:
188
192
  raise Exception("Error! The format of the input file is not supported!")
189
193
  return image
@@ -0,0 +1,59 @@
1
+ import numpy as np
2
+ import os, glob
3
+ from tqdm import tqdm
4
+ from pwdata.image import Image
5
+
6
+ class PWNPY(object):
7
+ def __init__(self, files):
8
+ self.image_list:list[Image] = []
9
+ self.load_files(files)
10
+
11
+ assert len(self.image_list) > 0, "No data loaded!"
12
+
13
+ def get(self):
14
+ return self.image_list
15
+
16
+ def load_files(self, files):
17
+ # Search for .npy files in the current directory
18
+ npy_files = glob.glob(os.path.join(files, "*.npy"))
19
+ if not npy_files:
20
+ npy_files = glob.glob(os.path.join(files, "*/*.npy"))
21
+
22
+ atom_type, atomic_energy, Ep, force, atom_types_image, lattice, coord, stress, image_nums, atom_nums = self.load_npy(npy_files)
23
+ lattice = lattice.reshape(-1, 3, 3)
24
+ coord = coord.reshape(-1, atom_nums, 3)
25
+ for i in tqdm(range(image_nums), desc="Loading data"):
26
+ image = Image(lattice=lattice[i], position=coord[i], force=force[i], Ep=Ep[i], stress=stress[i],
27
+ cartesian=True, image_nums=i, atom_nums=atom_nums,
28
+ atomic_energy=atomic_energy[i], atom_type=atom_type, atom_types_image=atom_types_image)
29
+ self.image_list.append(image)
30
+
31
+ def load_npy(self, npy_files):
32
+ atomic_energy = None
33
+ Ep = None
34
+ force = None
35
+ lattice = None
36
+ stress = None
37
+ coord = None
38
+ for npy_file in npy_files:
39
+ if "atom_type" in npy_file:
40
+ atom_type = np.load(npy_file).squeeze()
41
+ elif "ei" in npy_file:
42
+ atomic_energy = np.load(npy_file) if atomic_energy is None else np.concatenate((atomic_energy, np.load(npy_file)))
43
+ elif "energies" in npy_file:
44
+ Ep = np.load(npy_file) if Ep is None else np.concatenate((Ep, np.load(npy_file)))
45
+ elif "forces" in npy_file:
46
+ force = np.load(npy_file) if force is None else np.concatenate((force, np.load(npy_file)))
47
+ elif "image_type" in npy_file:
48
+ atom_types_image = np.load(npy_file).squeeze()
49
+ elif "lattice" in npy_file:
50
+ lattice = np.load(npy_file) if lattice is None else np.concatenate((lattice, np.load(npy_file)))
51
+ elif "virials" in npy_file:
52
+ stress = np.load(npy_file) if stress is None else np.concatenate((stress, np.load(npy_file)))
53
+ elif "position" in npy_file:
54
+ coord = np.load(npy_file) if coord is None else np.concatenate((coord, np.load(npy_file)))
55
+
56
+ image_nums = len(Ep)
57
+ atom_nums = len(atom_types_image)
58
+
59
+ return atom_type, atomic_energy.squeeze(), Ep.squeeze(), force.squeeze(), atom_types_image, lattice.squeeze(), coord.squeeze(), stress.squeeze(), image_nums, atom_nums
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.2.8
3
+ Version: 0.2.9
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
@@ -16,6 +16,7 @@ pwdata/movement.py
16
16
  pwdata/movement_saver.py
17
17
  pwdata/outcar.py
18
18
  pwdata/poscar.py
19
+ pwdata/pwmlff.py
19
20
  pwdata.egg-info/PKG-INFO
20
21
  pwdata.egg-info/SOURCES.txt
21
22
  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.8",
8
+ version="0.2.9",
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
File without changes
File without changes
File without changes
File without changes