pwdata 0.2.12__tar.gz → 0.2.14__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.12 → pwdata-0.2.14}/PKG-INFO +1 -1
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/build/write_struc.py +48 -40
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/deepmd.py +3 -1
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/extendedxyz.py +1 -1
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/image.py +6 -4
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/outcar.py +4 -1
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/pwmlff.py +1 -1
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata.egg-info/PKG-INFO +1 -1
- {pwdata-0.2.12 → pwdata-0.2.14}/setup.py +1 -1
- {pwdata-0.2.12 → pwdata-0.2.14}/LICENSE +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/README.md +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/__init__.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/atomconfig.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/build/__init__.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/build/cell.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/build/geometry.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/build/supercells.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/calculators/__init__.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/calculators/const.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/calculators/unitconvert_lmps.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/calculators/units.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/cp2kdata.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/datasets_saver.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/dump.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/lammpsdata.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/lmps.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/main.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/movement.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/movement_saver.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/pertub/__init__.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/pertub/perturbation.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/pertub/scale.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata/poscar.py +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata.egg-info/SOURCES.txt +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata.egg-info/dependency_links.txt +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/pwdata.egg-info/top_level.txt +0 -0
- {pwdata-0.2.12 → pwdata-0.2.14}/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.14
|
|
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
|
|
@@ -80,19 +80,6 @@ def write_config(image,
|
|
|
80
80
|
'constraints is parallel with one of the cell axis')
|
|
81
81
|
sflags[constr.a] = ~mask'''
|
|
82
82
|
|
|
83
|
-
if sort:
|
|
84
|
-
if len(image.get_atomic_numbers()) == 0:
|
|
85
|
-
ind = np.argsort(image.atom_types_image)
|
|
86
|
-
symbols = np.array(image.atom_types_image)[ind]
|
|
87
|
-
else:
|
|
88
|
-
ind = np.argsort(image.get_atomic_numbers())
|
|
89
|
-
symbols = np.array(image.get_atomic_numbers())[ind]
|
|
90
|
-
coord = np.array(coord)[ind]
|
|
91
|
-
# if constraints:
|
|
92
|
-
# sflags = sflags[ind]
|
|
93
|
-
else:
|
|
94
|
-
symbols = image.atom_types_image
|
|
95
|
-
|
|
96
83
|
# Create a list sc of (symbol, count) pairs
|
|
97
84
|
if symbol_count:
|
|
98
85
|
# sc = symbol_count
|
|
@@ -105,6 +92,22 @@ def write_config(image,
|
|
|
105
92
|
atom_type = image.atom_type
|
|
106
93
|
atom_type_num = image.atom_type_num
|
|
107
94
|
|
|
95
|
+
atom_types_image = np.array(image.atom_types_image)
|
|
96
|
+
|
|
97
|
+
if sort:
|
|
98
|
+
if len(image.get_atomic_numbers()) == 0:
|
|
99
|
+
indices_dict = {type: np.where(atom_types_image == type)[0] for type in atom_type}
|
|
100
|
+
sorted_indices = np.concatenate([np.sort(indices) for indices in indices_dict.values()])
|
|
101
|
+
symbols = atom_types_image[sorted_indices]
|
|
102
|
+
else:
|
|
103
|
+
sorted_indices = np.argsort(image.get_atomic_numbers())
|
|
104
|
+
symbols = np.array(image.get_atomic_numbers())[sorted_indices]
|
|
105
|
+
coord = np.array(coord)[sorted_indices]
|
|
106
|
+
# if constraints:
|
|
107
|
+
# sflags = sflags[ind]
|
|
108
|
+
else:
|
|
109
|
+
symbols = image.atom_types_image
|
|
110
|
+
|
|
108
111
|
# Write to file
|
|
109
112
|
output_file = open(os.path.join(filepath, data_name), 'w')
|
|
110
113
|
output_file.write('%d\n' % atom_nums)
|
|
@@ -197,19 +200,6 @@ def write_vasp(image,
|
|
|
197
200
|
'constraints is parallel with one of the cell axis')
|
|
198
201
|
sflags[constr.a] = ~mask'''
|
|
199
202
|
|
|
200
|
-
if sort:
|
|
201
|
-
if len(image.get_atomic_numbers()) == 0:
|
|
202
|
-
ind = np.argsort(image.atom_types_image)
|
|
203
|
-
symbols = np.array(image.atom_types_image)[ind]
|
|
204
|
-
else:
|
|
205
|
-
ind = np.argsort(image.get_atomic_numbers())
|
|
206
|
-
symbols = np.array(image.get_atomic_numbers())[ind]
|
|
207
|
-
coord = np.array(coord)[ind]
|
|
208
|
-
# if constraints:
|
|
209
|
-
# sflags = sflags[ind]
|
|
210
|
-
else:
|
|
211
|
-
symbols = image.atom_types_image
|
|
212
|
-
|
|
213
203
|
# Create a list sc of (symbol, count) pairs
|
|
214
204
|
if symbol_count:
|
|
215
205
|
# sc = symbol_count
|
|
@@ -221,6 +211,22 @@ def write_vasp(image,
|
|
|
221
211
|
else:
|
|
222
212
|
atom_type = image.atom_type
|
|
223
213
|
atom_type_num = image.atom_type_num
|
|
214
|
+
|
|
215
|
+
atom_types_image = np.array(image.atom_types_image)
|
|
216
|
+
|
|
217
|
+
if sort:
|
|
218
|
+
if len(image.get_atomic_numbers()) == 0:
|
|
219
|
+
indices_dict = {type: np.where(atom_types_image == type)[0] for type in atom_type}
|
|
220
|
+
sorted_indices = np.concatenate([np.sort(indices) for indices in indices_dict.values()])
|
|
221
|
+
symbols = atom_types_image[sorted_indices]
|
|
222
|
+
else:
|
|
223
|
+
sorted_indices = np.argsort(image.get_atomic_numbers())
|
|
224
|
+
symbols = np.array(image.get_atomic_numbers())[sorted_indices]
|
|
225
|
+
coord = np.array(coord)[sorted_indices]
|
|
226
|
+
# if constraints:
|
|
227
|
+
# sflags = sflags[ind]
|
|
228
|
+
else:
|
|
229
|
+
symbols = image.atom_types_image
|
|
224
230
|
|
|
225
231
|
atom_type = [elements[_] for _ in atom_type]
|
|
226
232
|
# Write to file
|
|
@@ -298,20 +304,6 @@ def write_lammps(image,
|
|
|
298
304
|
image._set_orthorhombic()
|
|
299
305
|
coord = image._set_cartesian().position
|
|
300
306
|
|
|
301
|
-
|
|
302
|
-
if sort:
|
|
303
|
-
if len(image.get_atomic_numbers()) == 0:
|
|
304
|
-
ind = np.argsort(image.atom_types_image)
|
|
305
|
-
symbols = np.array(image.atom_types_image)[ind]
|
|
306
|
-
else:
|
|
307
|
-
ind = np.argsort(image.get_atomic_numbers())
|
|
308
|
-
symbols = np.array(image.get_atomic_numbers())[ind]
|
|
309
|
-
coord = np.array(coord)[ind]
|
|
310
|
-
# if constraints:
|
|
311
|
-
# sflags = sflags[ind]
|
|
312
|
-
else:
|
|
313
|
-
symbols = image.atom_types_image
|
|
314
|
-
|
|
315
307
|
# Create a list sc of (symbol, count) pairs
|
|
316
308
|
if symbol_count:
|
|
317
309
|
# sc = symbol_count
|
|
@@ -324,6 +316,22 @@ def write_lammps(image,
|
|
|
324
316
|
atom_type = image.atom_type
|
|
325
317
|
atom_type_num = image.atom_type_num
|
|
326
318
|
|
|
319
|
+
atom_types_image = np.array(image.atom_types_image)
|
|
320
|
+
|
|
321
|
+
if sort:
|
|
322
|
+
if len(image.get_atomic_numbers()) == 0:
|
|
323
|
+
indices_dict = {type: np.where(atom_types_image == type)[0] for type in atom_type}
|
|
324
|
+
sorted_indices = np.concatenate([np.sort(indices) for indices in indices_dict.values()])
|
|
325
|
+
symbols = atom_types_image[sorted_indices]
|
|
326
|
+
else:
|
|
327
|
+
sorted_indices = np.argsort(image.get_atomic_numbers())
|
|
328
|
+
symbols = np.array(image.get_atomic_numbers())[sorted_indices]
|
|
329
|
+
coord = np.array(coord)[sorted_indices]
|
|
330
|
+
# if constraints:
|
|
331
|
+
# sflags = sflags[ind]
|
|
332
|
+
else:
|
|
333
|
+
symbols = image.atom_types_image
|
|
334
|
+
|
|
327
335
|
p = 1
|
|
328
336
|
atype = []
|
|
329
337
|
# atom num & type list
|
|
@@ -40,7 +40,8 @@ class DPNPY(object):
|
|
|
40
40
|
box, coord, energy, force, virial, image_nums = self.load_npy(npy_files, atom_nums)
|
|
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], stress=virial_image,
|
|
44
45
|
atom_type=atom_type, atom_nums=atom_nums, atom_types_image=atom_types_image, atom_type_num=atom_type_num,
|
|
45
46
|
cartesian=True, image_nums=i)
|
|
46
47
|
atomic_energy, _, _, _ = np.linalg.lstsq([atom_type_num], np.array([image.Ep]), rcond=1e-3)
|
|
@@ -49,6 +50,7 @@ class DPNPY(object):
|
|
|
49
50
|
self.image_list.append(image)
|
|
50
51
|
|
|
51
52
|
def load_npy(self, npy_files, atom_nums):
|
|
53
|
+
virial = None
|
|
52
54
|
for npy_file in tqdm(npy_files, desc="Loading data"):
|
|
53
55
|
if "box" in npy_file:
|
|
54
56
|
box = np.load(npy_file).reshape(-1, 3, 3).astype(np.float64)
|
|
@@ -9,7 +9,7 @@ def save_to_extxyz(image_data_all: list, output_path: str, data_name: str, write
|
|
|
9
9
|
image_data._set_cartesian()
|
|
10
10
|
data_name.write("%d\n" % image_data.atom_nums)
|
|
11
11
|
# data_name.write("Iteration: %s\n" % image_data.iteration)
|
|
12
|
-
output_head = 'Lattice="%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f" Properties=species:S:1:pos:R:3:
|
|
12
|
+
output_head = 'Lattice="%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f" Properties=species:S:1:pos:R:3:forces:R:3:local_energy:R:1 pbc="T T T" energy={}\n'.format(image_data.Ep)
|
|
13
13
|
output_extended = (image_data.lattice[0][0], image_data.lattice[0][1], image_data.lattice[0][2],
|
|
14
14
|
image_data.lattice[1][0], image_data.lattice[1][1], image_data.lattice[1][2],
|
|
15
15
|
image_data.lattice[2][0], image_data.lattice[2][1], image_data.lattice[2][2])
|
|
@@ -239,10 +239,12 @@ def elements_to_order(atom_names, atom_types_image, atom_nums):
|
|
|
239
239
|
Returns:
|
|
240
240
|
list: Updated list of atom types per atom.
|
|
241
241
|
"""
|
|
242
|
-
for idx, name in enumerate(atom_names):
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
242
|
+
# for idx, name in enumerate(atom_names):
|
|
243
|
+
# for ii in range(atom_nums):
|
|
244
|
+
# if name in elements and atom_types_image[ii] == idx+1:
|
|
245
|
+
# atom_types_image[ii] = elements.index(name)
|
|
246
|
+
type_mapping = {idx+1: elements.index(name) for idx, name in enumerate(atom_names)}
|
|
247
|
+
atom_types_image = [type_mapping[atom_type] for atom_type in atom_types_image]
|
|
246
248
|
return atom_types_image
|
|
247
249
|
|
|
248
250
|
def frac2cart(position, lattice):
|
|
@@ -26,7 +26,10 @@ class OUTCAR(object):
|
|
|
26
26
|
# get atom names from POTCAR info, tested only for PAW_PBE ...
|
|
27
27
|
_ii = ii.split()[2]
|
|
28
28
|
if '_' in _ii:
|
|
29
|
-
atom_names.append(_ii.split('_')[0])
|
|
29
|
+
# atom_names.append(_ii.split('_')[0])
|
|
30
|
+
atom_name = _ii.split('_')[0]
|
|
31
|
+
if atom_name not in atom_names:
|
|
32
|
+
atom_names.append(atom_name)
|
|
30
33
|
else:
|
|
31
34
|
atom_name = _ii
|
|
32
35
|
if atom_name not in atom_names:
|
|
@@ -58,4 +58,4 @@ class PWNPY(object):
|
|
|
58
58
|
atom_nums = len(atom_types_image)
|
|
59
59
|
stress = stress.reshape(-1, 3, 3) if stress is not None else None
|
|
60
60
|
|
|
61
|
-
return atom_type, atomic_energy
|
|
61
|
+
return atom_type, atomic_energy, Ep.squeeze(), force, atom_types_image, lattice, coord, stress, 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.14
|
|
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.14",
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|