pwdata 0.2.9__tar.gz → 0.2.11__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.9 → pwdata-0.2.11}/PKG-INFO +1 -1
  2. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/build/write_struc.py +22 -24
  3. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/image.py +10 -2
  4. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/outcar.py +14 -12
  5. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/pwmlff.py +1 -1
  6. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata.egg-info/PKG-INFO +1 -1
  7. {pwdata-0.2.9 → pwdata-0.2.11}/setup.py +1 -1
  8. {pwdata-0.2.9 → pwdata-0.2.11}/LICENSE +0 -0
  9. {pwdata-0.2.9 → pwdata-0.2.11}/README.md +0 -0
  10. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/__init__.py +0 -0
  11. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/atomconfig.py +0 -0
  12. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/build/__init__.py +0 -0
  13. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/build/cell.py +0 -0
  14. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/build/geometry.py +0 -0
  15. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/build/supercells.py +0 -0
  16. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/calculators/__init__.py +0 -0
  17. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/calculators/const.py +0 -0
  18. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/calculators/unitconvert_lmps.py +0 -0
  19. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/calculators/units.py +0 -0
  20. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/cp2kdata.py +0 -0
  21. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/datasets_saver.py +0 -0
  22. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/deepmd.py +0 -0
  23. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/dump.py +0 -0
  24. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/extendedxyz.py +0 -0
  25. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/lammpsdata.py +0 -0
  26. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/lmps.py +0 -0
  27. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/main.py +0 -0
  28. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/movement.py +0 -0
  29. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/movement_saver.py +0 -0
  30. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/pertub/__init__.py +0 -0
  31. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/pertub/perturbation.py +0 -0
  32. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/pertub/scale.py +0 -0
  33. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata/poscar.py +0 -0
  34. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata.egg-info/SOURCES.txt +0 -0
  35. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata.egg-info/dependency_links.txt +0 -0
  36. {pwdata-0.2.9 → pwdata-0.2.11}/pwdata.egg-info/top_level.txt +0 -0
  37. {pwdata-0.2.9 → pwdata-0.2.11}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.2.9
3
+ Version: 0.2.11
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
@@ -2,7 +2,6 @@ import numpy as np
2
2
  import os
3
3
  from collections import Counter
4
4
  from pwdata.build.cell import cell_to_cellpar
5
- from pwdata.lmps import Box2l
6
5
  from pwdata.calculators.const import elements, ELEMENTMASSTABLE
7
6
 
8
7
 
@@ -163,7 +162,7 @@ def write_vasp(image,
163
162
  raise RuntimeError(
164
163
  'Lattice vectors must be finite and not coincident. '
165
164
  'At least one lattice length or angle is zero.')
166
-
165
+
167
166
  # Write atom positions in scaled or cartesian coordinates
168
167
  if direct and image.cartesian: # cartesian -> direct
169
168
  coord = image.get_scaled_positions(wrap=wrap)
@@ -292,12 +291,13 @@ def write_lammps(image,
292
291
  'At least one lattice length or angle is zero.')
293
292
 
294
293
  # Write atom positions in cartesian coordinates
295
- if direct and image.cartesian: # cartesian -> direct
294
+ if image.cartesian: # cartesian -> direct
296
295
  coord = image.get_scaled_positions(wrap=wrap)
297
- elif not direct and not image.cartesian: # direct -> cartesian
296
+ image._set_orthorhombic()
297
+ else: # direct -> cartesian
298
+ image._set_orthorhombic()
298
299
  coord = image._set_cartesian().position
299
- else: # get cartesian/direct
300
- coord = image.position
300
+
301
301
 
302
302
  if sort:
303
303
  if len(image.get_atomic_numbers()) == 0:
@@ -324,8 +324,6 @@ def write_lammps(image,
324
324
  atom_type = image.atom_type
325
325
  atom_type_num = image.atom_type_num
326
326
 
327
- lmps_box = Box2l(image.lattice)
328
-
329
327
  p = 1
330
328
  atype = []
331
329
  # atom num & type list
@@ -344,24 +342,24 @@ def write_lammps(image,
344
342
  # output preparation
345
343
  # return [xx,xy,yy,xz,yz,zz]
346
344
  xlo = 0.0
347
- xhi = lmps_box[0]
345
+ xhi = image.lattice[0][0]
348
346
  ylo = 0.0
349
- yhi = lmps_box[2]
347
+ yhi = image.lattice[1][1]
350
348
  zlo = 0.0
351
- zhi = lmps_box[5]
352
- xy = lmps_box[1]
353
- xz = lmps_box[3]
354
- yz = lmps_box[4]
349
+ zhi = image.lattice[2][2]
350
+ xy = image.lattice[1][0]
351
+ xz = image.lattice[2][0]
352
+ yz = image.lattice[2][1]
355
353
 
356
354
  LX = np.zeros([atom_nums,3],dtype=float)
357
355
  A = np.zeros([3,3],dtype=float)
358
356
 
359
- A[0,0] = lmps_box[0]
360
- A[0,1] = lmps_box[1]
361
- A[1,1] = lmps_box[2]
362
- A[0,2] = lmps_box[3]
363
- A[1,2] = lmps_box[4]
364
- A[2,2] = lmps_box[5]
357
+ A[0,0] = image.lattice[0][0]
358
+ A[1,0] = image.lattice[1][0]
359
+ A[1,1] = image.lattice[1][1]
360
+ A[2,0] = image.lattice[2][0]
361
+ A[2,1] = image.lattice[2][1]
362
+ A[2,2] = image.lattice[2][2]
365
363
 
366
364
  print("converted LAMMPS upper trangualr box:")
367
365
 
@@ -372,11 +370,11 @@ def write_lammps(image,
372
370
  # A.T x = LX
373
371
  # LX = A*x in LAMMPS. see https://docs.lammps.org/Howto_triclinic.html
374
372
 
375
- if direct:
373
+ if not image.cartesian:
376
374
  for i in range(atom_nums):
377
- LX[i,0] = A[0,0]*x[i,0] + A[0,1]*x[i,1] + A[0,2]*x[i,2]
378
- LX[i,1] = A[1,0]*x[i,0] + A[1,1]*x[i,1] + A[1,2]*x[i,2]
379
- LX[i,2] = A[2,0]*x[i,0] + A[2,1]*x[i,1] + A[2,2]*x[i,2]
375
+ LX[i,0] = A[0,0]*x[i,0] + A[1,0]*x[i,1] + A[2,0]*x[i,2]
376
+ LX[i,1] = A[0,1]*x[i,0] + A[1,1]*x[i,1] + A[2,1]*x[i,2]
377
+ LX[i,2] = A[0,2]*x[i,0] + A[1,2]*x[i,1] + A[2,2]*x[i,2]
380
378
  else:
381
379
  for i in range(atom_nums):
382
380
  LX[i,0] = x[i,0]
@@ -5,6 +5,7 @@ from pwdata.build.write_struc import write_config, write_vasp, write_lammps
5
5
  from pwdata.calculators.const import elements
6
6
  from pwdata.build.geometry import wrap_positions
7
7
  from pwdata.build.cell import scaled_positions
8
+ from pwdata.lmps import Box2l
8
9
  # 1. initial the image class
9
10
  class Image(object):
10
11
  def __init__(self,
@@ -176,7 +177,6 @@ class Image(object):
176
177
  plane."""
177
178
 
178
179
  fractional = scaled_positions(self.lattice, self.position)
179
-
180
180
  if wrap:
181
181
  for i, periodic in enumerate(self.pbc):
182
182
  if periodic:
@@ -184,7 +184,7 @@ class Image(object):
184
184
  # See the scaled_positions.py test.
185
185
  fractional[:, i] %= 1.0
186
186
  fractional[:, i] %= 1.0
187
-
187
+ self.cartesian = False
188
188
  return fractional
189
189
 
190
190
  def get_atomic_numbers(self):
@@ -195,6 +195,14 @@ class Image(object):
195
195
  """Return reference to positions-array for in-place manipulations."""
196
196
  return self.arrays['position']
197
197
 
198
+ def _set_orthorhombic(self):
199
+ """Set the cell to be orthorhombic."""
200
+ lattice = Box2l(self.lattice)
201
+ xx = [lattice[0], 0, 0]
202
+ yy = [lattice[1], lattice[2], 0]
203
+ zz = [lattice[3], lattice[4], lattice[5]]
204
+ self.lattice = [xx, yy, zz]
205
+
198
206
  def _set_cartesian(self):
199
207
  """Set positions in Cartesian coordinates."""
200
208
  self.position = frac2cart(self.position, self.lattice)
@@ -29,8 +29,8 @@ class OUTCAR(object):
29
29
  atom_names.append(_ii.split('_')[0])
30
30
  else:
31
31
  atom_name = _ii
32
- if atom_name not in atom_names:
33
- atom_names.append(atom_name)
32
+ if atom_name not in atom_names:
33
+ atom_names.append(atom_name)
34
34
  elif 'ions per type' in ii:
35
35
  atom_type_num_ = [int(s) for s in ii.split()[4:]]
36
36
  if atom_type_num is None:
@@ -52,24 +52,26 @@ class OUTCAR(object):
52
52
 
53
53
  max_scf_idx = 0
54
54
  prev_idx = 0
55
- # temp_images = {}
56
55
  converged_images = []
57
56
  max_insw = -1
58
57
  for idx, ii in tqdm(enumerate(outcar_contents), total=len(outcar_contents), desc="Processing data"):
59
- if "Ionic step" in ii:
60
- if prev_idx == 0:
61
- prev_idx = idx
62
- # continue
63
- else:
64
- # temp_images[idx] = outcar_contents[prev_idx:idx]
65
- if max_insw < nelm:
66
- converged_images.append(outcar_contents[max_scf_idx:idx])
67
- max_insw = 0
58
+ # if "Ionic step" in ii:
59
+ # if prev_idx == 0:
60
+ # prev_idx = idx
61
+ # else:
62
+ # if max_insw < nelm:
63
+ # converged_images.append(outcar_contents[max_scf_idx:idx])
64
+ # max_insw = 0
68
65
  if "Iteration" in ii:
69
66
  scf_index = int(ii.split()[3][:-1])
67
+ if scf_index == 1 and prev_idx != 0:
68
+ if max_insw < nelm:
69
+ converged_images.append(outcar_contents[max_scf_idx:idx])
70
+ max_insw = 0
70
71
  if scf_index > max_insw:
71
72
  max_insw = scf_index
72
73
  max_scf_idx = idx
74
+ prev_idx = idx
73
75
  if "Elapsed time (sec):" in ii:
74
76
  if max_insw < nelm:
75
77
  converged_images.append(outcar_contents[max_scf_idx:idx])
@@ -24,7 +24,7 @@ class PWNPY(object):
24
24
  coord = coord.reshape(-1, atom_nums, 3)
25
25
  for i in tqdm(range(image_nums), desc="Loading data"):
26
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,
27
+ cartesian=False, image_nums=i, atom_nums=atom_nums,
28
28
  atomic_energy=atomic_energy[i], atom_type=atom_type, atom_types_image=atom_types_image)
29
29
  self.image_list.append(image)
30
30
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pwdata
3
- Version: 0.2.9
3
+ Version: 0.2.11
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.9",
8
+ version="0.2.11",
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