pwdata 0.2.17__tar.gz → 0.2.18__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.
- {pwdata-0.2.17 → pwdata-0.2.18}/PKG-INFO +1 -1
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/cp2kdata.py +4 -4
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/datasets_saver.py +2 -2
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/deepmd.py +2 -2
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/extendedxyz.py +8 -8
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/image.py +18 -9
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/movement.py +4 -4
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/movement_saver.py +3 -2
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/outcar.py +1 -1
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/pwmlff.py +6 -6
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata.egg-info/PKG-INFO +1 -1
- {pwdata-0.2.17 → pwdata-0.2.18}/setup.py +1 -1
- {pwdata-0.2.17 → pwdata-0.2.18}/LICENSE +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/README.md +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/__init__.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/atomconfig.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/build/__init__.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/build/cell.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/build/geometry.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/build/supercells.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/build/write_struc.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/calculators/__init__.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/calculators/const.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/calculators/unitconvert_lmps.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/calculators/units.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/dump.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/lammpsdata.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/lmps.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/main.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/pertub/__init__.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/pertub/perturbation.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/pertub/scale.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata/poscar.py +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata.egg-info/SOURCES.txt +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata.egg-info/dependency_links.txt +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/pwdata.egg-info/top_level.txt +0 -0
- {pwdata-0.2.17 → pwdata-0.2.18}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pwdata
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.18
|
|
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
|
|
@@ -53,8 +53,8 @@ class CP2KMD(object):
|
|
|
53
53
|
self.image_list.append(image)
|
|
54
54
|
elif "STRESS| Analytical stress tensor" in ii:
|
|
55
55
|
stress_info = parse_stress(stdout_contents[idx+2:idx+5])
|
|
56
|
-
|
|
57
|
-
image.
|
|
56
|
+
virial = gpa2ev(stress_info["stress"], volume)
|
|
57
|
+
image.virial = virial
|
|
58
58
|
|
|
59
59
|
def read_pdb(self, traj_file):
|
|
60
60
|
with open(traj_file, "r") as f:
|
|
@@ -208,8 +208,8 @@ class CP2KSCF(object):
|
|
|
208
208
|
image.force = force_info["force"]
|
|
209
209
|
elif "STRESS| Analytical stress tensor" in ii:
|
|
210
210
|
stress_info = parse_stress(stdout_contents[idx+2:idx+5])
|
|
211
|
-
|
|
212
|
-
image.
|
|
211
|
+
virial = gpa2ev(stress_info["stress"], volume)
|
|
212
|
+
image.virial = virial
|
|
213
213
|
|
|
214
214
|
def parse_position(self, position_content):
|
|
215
215
|
position = [[float(_) for _ in atom.split()[4:7]] for atom in position_content]
|
|
@@ -173,8 +173,8 @@ def get_pw(image_data):
|
|
|
173
173
|
all_energies.append(image.Ep)
|
|
174
174
|
all_forces.append(image.force)
|
|
175
175
|
all_ei.append(image.atomic_energy)
|
|
176
|
-
if len(image.
|
|
177
|
-
all_virials.append(image.
|
|
176
|
+
if len(image.virial) != 0:
|
|
177
|
+
all_virials.append(image.virial)
|
|
178
178
|
image_nums = len(image_data)
|
|
179
179
|
atom_type = np.array(image.atom_type).reshape(1, -1)
|
|
180
180
|
atom_types_image = np.array(image.atom_types_image)
|
|
@@ -41,7 +41,7 @@ class DPNPY(object):
|
|
|
41
41
|
|
|
42
42
|
for i in range(image_nums):
|
|
43
43
|
virial_image = virial[i] if virial is not None else None
|
|
44
|
-
image = Image(lattice=box[i], position=coord[i], force=force[i], Ep=energy[i],
|
|
44
|
+
image = Image(lattice=box[i], position=coord[i], force=force[i], Ep=energy[i], virial=virial_image,
|
|
45
45
|
atom_type=atom_type, atom_nums=atom_nums, atom_types_image=atom_types_image, atom_type_num=atom_type_num,
|
|
46
46
|
cartesian=True, image_nums=i)
|
|
47
47
|
atomic_energy, _, _, _ = np.linalg.lstsq([atom_type_num], np.array([image.Ep]), rcond=1e-3)
|
|
@@ -103,7 +103,7 @@ 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],
|
|
106
|
+
image = Image(lattice=box[i], position=coord[i], force=force[i], Ep=energy[i], virial=virial[i],
|
|
107
107
|
atom_type=atom_type, atom_nums=atom_nums, atom_types_image=atom_types_image, atom_type_num=atom_type_num,
|
|
108
108
|
cartesian=True, image_nums=i)
|
|
109
109
|
atomic_energy, _, _, _ = np.linalg.lstsq([atom_type_num], np.array([image.Ep]), rcond=1e-3)
|
|
@@ -41,7 +41,7 @@ class EXTXYZ(object):
|
|
|
41
41
|
pass
|
|
42
42
|
else:
|
|
43
43
|
# virial = -stress * volume
|
|
44
|
-
image.
|
|
44
|
+
image.virial = - Atoms[i].get_volume() * stress
|
|
45
45
|
image.format = 'extxyz'
|
|
46
46
|
self.image_list.append(image)
|
|
47
47
|
else:
|
|
@@ -67,7 +67,7 @@ class EXTXYZ(object):
|
|
|
67
67
|
except AttributeError:
|
|
68
68
|
pass
|
|
69
69
|
else:
|
|
70
|
-
image.
|
|
70
|
+
image.virial = - Atoms.get_volume() * stress
|
|
71
71
|
image.format = 'extxyz'
|
|
72
72
|
self.image_list.append(image)
|
|
73
73
|
|
|
@@ -84,12 +84,12 @@ def save_to_extxyz(image_data_all: list, output_path: str, data_name: str, write
|
|
|
84
84
|
output_extended = (image_data.lattice[0][0], image_data.lattice[0][1], image_data.lattice[0][2],
|
|
85
85
|
image_data.lattice[1][0], image_data.lattice[1][1], image_data.lattice[1][2],
|
|
86
86
|
image_data.lattice[2][0], image_data.lattice[2][1], image_data.lattice[2][2])
|
|
87
|
-
if image_data.
|
|
88
|
-
output_head += '
|
|
89
|
-
|
|
90
|
-
output_extended += (
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
if image_data.virial is not None:
|
|
88
|
+
output_head += 'virial="%.8f %.8f %.8f %.8f %.8f %.8f %.8f %.8f %.8f"'
|
|
89
|
+
virial = image_data.get_virial()
|
|
90
|
+
output_extended += (virial[0][0], virial[0][1], virial[0][2],
|
|
91
|
+
virial[1][0], virial[1][1], virial[1][2],
|
|
92
|
+
virial[2][0], virial[2][1], virial[2][2])
|
|
93
93
|
output_head += '\n'
|
|
94
94
|
data_name.write(output_head % output_extended)
|
|
95
95
|
for j in range(image_data.atom_nums):
|
|
@@ -8,10 +8,10 @@ from pwdata.build.cell import scaled_positions
|
|
|
8
8
|
from pwdata.lmps import Box2l
|
|
9
9
|
# 1. initial the image class
|
|
10
10
|
class Image(object):
|
|
11
|
-
def __init__(self, formula = None,
|
|
11
|
+
def __init__(self, formula = None,
|
|
12
12
|
atom_type = None, atom_type_num = None, atom_nums = None, atom_types_image = None,
|
|
13
13
|
iteration = None, Etot = None, Ep = None, Ek = None, scf = None, lattice = None,
|
|
14
|
-
|
|
14
|
+
virial = None, position = None, force = None, atomic_energy = None,
|
|
15
15
|
content = None, image_nums = None, pbc = None, cartesian = None):
|
|
16
16
|
"""
|
|
17
17
|
Represents an image in a AIMD trajectory.
|
|
@@ -27,7 +27,7 @@ class Image(object):
|
|
|
27
27
|
Ek (float): The kinetic energy.
|
|
28
28
|
scf (float): The index of the self-consistent field.
|
|
29
29
|
lattice (list): The lattice vectors.
|
|
30
|
-
|
|
30
|
+
virial (list): The virial tensor.
|
|
31
31
|
position (list): The atomic positions.
|
|
32
32
|
force (list): The atomic forces.
|
|
33
33
|
atomic_energy (list): The atomic energies.
|
|
@@ -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.
|
|
50
|
+
self.virial = virial if virial is not None else []
|
|
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 []
|
|
@@ -69,7 +69,7 @@ class Image(object):
|
|
|
69
69
|
for name, a in prim_dict.items():
|
|
70
70
|
atoms.arrays[name] = a.copy()
|
|
71
71
|
return atoms
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
def to(self, output_path, data_name = None, save_format = None, direct = True, sort = False, wrap = False):
|
|
74
74
|
"""
|
|
75
75
|
Write atoms object to a new file.
|
|
@@ -192,13 +192,22 @@ class Image(object):
|
|
|
192
192
|
"""Get integer array of atomic numbers."""
|
|
193
193
|
return self.arrays['atom_types_image'].copy()
|
|
194
194
|
|
|
195
|
+
def get_virial(self):
|
|
196
|
+
"""Get virial tensor."""
|
|
197
|
+
return self._get_virial()
|
|
198
|
+
|
|
199
|
+
def _get_virial(self):
|
|
200
|
+
virial = np.array(self.virial).reshape(3, 3)
|
|
201
|
+
return virial
|
|
202
|
+
|
|
195
203
|
def get_stress(self):
|
|
196
204
|
"""Get stress tensor."""
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
def _get_stress(self):
|
|
200
|
-
stress = np.array(self.stress).reshape(3, 3)
|
|
205
|
+
stress = self.get_virial() / - self.get_volume()
|
|
201
206
|
return stress
|
|
207
|
+
|
|
208
|
+
def get_volume(self):
|
|
209
|
+
"""Get volume of the unit cell."""
|
|
210
|
+
return np.abs(np.linalg.det(self.lattice))
|
|
202
211
|
|
|
203
212
|
def _get_positions(self):
|
|
204
213
|
"""Return reference to positions-array for in-place manipulations."""
|
|
@@ -27,7 +27,7 @@ class MOVEMENT(object):
|
|
|
27
27
|
elif "Lattice" in ii:
|
|
28
28
|
lattice_stress = self.parse_lattice_stress(mvm_contents[idx+1:idx+4])
|
|
29
29
|
image.lattice = lattice_stress["lattice"]
|
|
30
|
-
image.
|
|
30
|
+
image.virial = lattice_stress["virial"]
|
|
31
31
|
elif " Position" in ii:
|
|
32
32
|
position = self.parse_position(mvm_contents[idx+1:idx+image.atom_nums+1])
|
|
33
33
|
image.position = position["position"]
|
|
@@ -71,11 +71,11 @@ class MOVEMENT(object):
|
|
|
71
71
|
lattice2 = [float(_) for _ in self.number_pattern.findall(lattice_content[1])]
|
|
72
72
|
lattice3 = [float(_) for _ in self.number_pattern.findall(lattice_content[2])]
|
|
73
73
|
if "stress" in lattice_content[0]:
|
|
74
|
-
|
|
74
|
+
virial = [lattice1[3:], lattice2[3:], lattice3[3:]]
|
|
75
75
|
else:
|
|
76
|
-
|
|
76
|
+
virial = []
|
|
77
77
|
lattice = [lattice1[:3], lattice2[:3], lattice3[:3]]
|
|
78
|
-
return {"lattice": lattice, "
|
|
78
|
+
return {"lattice": lattice, "virial": virial}
|
|
79
79
|
|
|
80
80
|
def parse_position(self, position_content):
|
|
81
81
|
atom_types_image = []
|
|
@@ -19,8 +19,9 @@ def save_to_movement(image_data_all: list, output_path: str, data_name: str):
|
|
|
19
19
|
data_name.write(" ******* \n")
|
|
20
20
|
data_name.write("Lattice vector (Angstrom)\n")
|
|
21
21
|
for j in range(3):
|
|
22
|
-
if image_data.
|
|
23
|
-
|
|
22
|
+
if image_data.virial is not None:
|
|
23
|
+
virial = image_data.get_virial()
|
|
24
|
+
data_name.write(" %16.10E %16.10E %16.10E stress (eV): %16.10E %16.10E %16.10E\n" % (image_data.lattice[j][0], image_data.lattice[j][1], image_data.lattice[j][2], virial[j][0], virial[j][1], virial[j][2]))
|
|
24
25
|
else:
|
|
25
26
|
data_name.write(" %16.10E %16.10E %16.10E\n" % (image_data.lattice[j][0], image_data.lattice[j][1], image_data.lattice[j][2]))
|
|
26
27
|
data_name.write(" Position (normalized), move_x, move_y, move_z\n")
|
|
@@ -87,7 +87,7 @@ class OUTCAR(object):
|
|
|
87
87
|
image.scf = int(line.split()[3][:-1])
|
|
88
88
|
elif "in kB" in line:
|
|
89
89
|
virial_info = self.parse_virial_info(converged_image[idx - 1])
|
|
90
|
-
image.
|
|
90
|
+
image.virial = virial_info["virial"]
|
|
91
91
|
elif "VOLUME and BASIS" in line:
|
|
92
92
|
lattice_info = self.parse_lattice(converged_image[idx+5:idx+8])
|
|
93
93
|
image.lattice = lattice_info["lattice"]
|
|
@@ -19,12 +19,12 @@ class PWNPY(object):
|
|
|
19
19
|
if not npy_files:
|
|
20
20
|
npy_files = glob.glob(os.path.join(files, "*/*.npy"))
|
|
21
21
|
|
|
22
|
-
atom_type, atomic_energy, Ep, force, atom_types_image, lattice, coord,
|
|
22
|
+
atom_type, atomic_energy, Ep, force, atom_types_image, lattice, coord, virial, image_nums, atom_nums = self.load_npy(npy_files)
|
|
23
23
|
lattice = lattice.reshape(-1, 3, 3)
|
|
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],
|
|
27
|
+
image = Image(lattice=lattice[i], position=coord[i], force=force[i], Ep=Ep[i], virial=virial[i],
|
|
28
28
|
cartesian=False, image_nums=i, atom_nums=atom_nums,
|
|
29
29
|
atomic_energy=atomic_energy[i], atom_type=atom_type, atom_types_image=atom_types_image)
|
|
30
30
|
self.image_list.append(image)
|
|
@@ -34,7 +34,7 @@ class PWNPY(object):
|
|
|
34
34
|
Ep = None
|
|
35
35
|
force = None
|
|
36
36
|
lattice = None
|
|
37
|
-
|
|
37
|
+
virial = None
|
|
38
38
|
coord = None
|
|
39
39
|
for npy_file in npy_files:
|
|
40
40
|
if "atom_type" in npy_file:
|
|
@@ -50,12 +50,12 @@ class PWNPY(object):
|
|
|
50
50
|
elif "lattice" in npy_file:
|
|
51
51
|
lattice = np.load(npy_file) if lattice is None else np.concatenate((lattice, np.load(npy_file)))
|
|
52
52
|
elif "virials" in npy_file:
|
|
53
|
-
|
|
53
|
+
virial = np.load(npy_file) if virial is None else np.concatenate((virial, np.load(npy_file)))
|
|
54
54
|
elif "position" in npy_file:
|
|
55
55
|
coord = np.load(npy_file) if coord is None else np.concatenate((coord, np.load(npy_file)))
|
|
56
56
|
|
|
57
57
|
image_nums = len(Ep)
|
|
58
58
|
atom_nums = len(atom_types_image)
|
|
59
|
-
|
|
59
|
+
virial = virial.reshape(-1, 3, 3) if virial is not None else None
|
|
60
60
|
|
|
61
|
-
return atom_type, atomic_energy, Ep.squeeze(), force, atom_types_image, lattice, coord,
|
|
61
|
+
return atom_type, atomic_energy, Ep.squeeze(), force, atom_types_image, lattice, coord, virial, image_nums, atom_nums
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pwdata
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.18
|
|
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.2.
|
|
8
|
+
version="0.2.18",
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|