pwdata 0.2.5__tar.gz → 0.2.7__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.5 → pwdata-0.2.7}/PKG-INFO +1 -1
- pwdata-0.2.7/pwdata/deepmd.py +142 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/main.py +9 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata.egg-info/PKG-INFO +1 -1
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata.egg-info/SOURCES.txt +1 -1
- {pwdata-0.2.5 → pwdata-0.2.7}/setup.py +1 -1
- pwdata-0.2.5/pwdata/configop.py +0 -209
- {pwdata-0.2.5 → pwdata-0.2.7}/LICENSE +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/README.md +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/__init__.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/atomconfig.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/build/__init__.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/build/cell.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/build/geometry.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/build/supercells.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/build/write_struc.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/calculators/__init__.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/calculators/const.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/calculators/unitconvert_lmps.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/calculators/units.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/cp2kdata.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/datasets_saver.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/dump.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/extendedxyz.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/image.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/lammpsdata.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/lmps.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/movement.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/movement_saver.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/outcar.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/pertub/__init__.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/pertub/perturbation.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/pertub/scale.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata/poscar.py +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata.egg-info/dependency_links.txt +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/pwdata.egg-info/top_level.txt +0 -0
- {pwdata-0.2.5 → pwdata-0.2.7}/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.7
|
|
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,142 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import os, glob
|
|
3
|
+
from tqdm import tqdm
|
|
4
|
+
from collections import Counter
|
|
5
|
+
from pwdata.image import Image
|
|
6
|
+
from pwdata.calculators.const import ELEMENTTABLE
|
|
7
|
+
|
|
8
|
+
class DPNPY(object):
|
|
9
|
+
def __init__(self, dp_file):
|
|
10
|
+
self.image_list:list[Image] = []
|
|
11
|
+
self.load_dp_file(dp_file)
|
|
12
|
+
|
|
13
|
+
assert len(self.image_list) > 0, "No data loaded!"
|
|
14
|
+
|
|
15
|
+
def get(self):
|
|
16
|
+
return self.image_list
|
|
17
|
+
|
|
18
|
+
def load_dp_file(self, dp_file):
|
|
19
|
+
type_map_raw = os.path.join(dp_file, "type_map.raw")
|
|
20
|
+
type_raw = os.path.join(dp_file, "type.raw")
|
|
21
|
+
|
|
22
|
+
# Search for .npy files in the current directory
|
|
23
|
+
npy_files = glob.glob(os.path.join(dp_file, "*.npy"))
|
|
24
|
+
if not npy_files:
|
|
25
|
+
npy_files = glob.glob(os.path.join(dp_file, "*/*.npy"))
|
|
26
|
+
|
|
27
|
+
with open(type_map_raw, 'r') as f:
|
|
28
|
+
type_map = f.read().splitlines()
|
|
29
|
+
_atom_type = [ELEMENTTABLE[atom] for atom in type_map]
|
|
30
|
+
|
|
31
|
+
with open(type_raw, 'r') as f:
|
|
32
|
+
type = f.read().splitlines()
|
|
33
|
+
atom_nums = len(type)
|
|
34
|
+
atom_types_image = [_atom_type[int(atom)] for atom in type]
|
|
35
|
+
sc = Counter(atom_types_image)
|
|
36
|
+
atom_type = list(sc.keys())
|
|
37
|
+
atom_type_num = list(sc.values())
|
|
38
|
+
# atom_type_num = [atom_types_image.count(atom) for atom in set(atom_types_image)]
|
|
39
|
+
|
|
40
|
+
box, coord, energy, force, virial, image_nums = self.load_npy(npy_files, atom_nums)
|
|
41
|
+
|
|
42
|
+
for i in range(image_nums):
|
|
43
|
+
image = Image(lattice=box[i], position=coord[i], force=force[i], Ep=energy[i], stress=virial[i],
|
|
44
|
+
atom_type=atom_type, atom_nums=atom_nums, atom_types_image=atom_types_image, atom_type_num=atom_type_num,
|
|
45
|
+
cartesian=True, image_nums=i)
|
|
46
|
+
atomic_energy, _, _, _ = np.linalg.lstsq([atom_type_num], np.array([image.Ep]), rcond=1e-3)
|
|
47
|
+
atomic_energy = np.repeat(atomic_energy, atom_type_num)
|
|
48
|
+
image.atomic_energy = atomic_energy.tolist()
|
|
49
|
+
self.image_list.append(image)
|
|
50
|
+
|
|
51
|
+
def load_npy(self, npy_files, atom_nums):
|
|
52
|
+
for npy_file in tqdm(npy_files, desc="Loading data"):
|
|
53
|
+
if "box" in npy_file:
|
|
54
|
+
box = np.load(npy_file).reshape(-1, 3, 3)
|
|
55
|
+
elif "coord" in npy_file:
|
|
56
|
+
coord = np.load(npy_file).reshape(-1, atom_nums, 3)
|
|
57
|
+
elif "energy" in npy_file:
|
|
58
|
+
energy = np.load(npy_file)
|
|
59
|
+
elif "force" in npy_file:
|
|
60
|
+
force = np.load(npy_file).reshape(-1, atom_nums, 3)
|
|
61
|
+
elif "virial" in npy_file:
|
|
62
|
+
virial = np.load(npy_file).reshape(-1, 3, 3)
|
|
63
|
+
|
|
64
|
+
image_nums = len(box)
|
|
65
|
+
print("Load data %s successfully! \t\t\t\t Image nums: %d" % (npy_files, image_nums))
|
|
66
|
+
return box, coord, energy, force, virial, image_nums
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class DPRAW(object):
|
|
70
|
+
def __init__(self, dp_file):
|
|
71
|
+
self.image_list:list[Image] = []
|
|
72
|
+
self.load_dp_file(dp_file)
|
|
73
|
+
|
|
74
|
+
assert len(self.image_list) > 0, "No data loaded!"
|
|
75
|
+
|
|
76
|
+
def get(self):
|
|
77
|
+
return self.image_list
|
|
78
|
+
|
|
79
|
+
def load_dp_file(self, dp_file):
|
|
80
|
+
type_map_raw = os.path.join(dp_file, "type_map.raw")
|
|
81
|
+
type_raw = os.path.join(dp_file, "type.raw")
|
|
82
|
+
|
|
83
|
+
# Search for .raw files in the current directory
|
|
84
|
+
raw_files = glob.glob(os.path.join(dp_file, "*.raw"))
|
|
85
|
+
raw_files.remove(type_map_raw)
|
|
86
|
+
raw_files.remove(type_raw)
|
|
87
|
+
|
|
88
|
+
with open(type_map_raw, 'r') as f:
|
|
89
|
+
type_map = f.read().splitlines()
|
|
90
|
+
_atom_type = [ELEMENTTABLE[atom] for atom in type_map]
|
|
91
|
+
|
|
92
|
+
with open(type_raw, 'r') as f:
|
|
93
|
+
type = f.read().splitlines()
|
|
94
|
+
atom_nums = len(type)
|
|
95
|
+
atom_types_image = [_atom_type[int(atom)] for atom in type]
|
|
96
|
+
sc = Counter(atom_types_image)
|
|
97
|
+
atom_type = list(sc.keys())
|
|
98
|
+
atom_type_num = list(sc.values())
|
|
99
|
+
# atom_type_num = [atom_types_image.count(atom) for atom in set(atom_types_image)]
|
|
100
|
+
|
|
101
|
+
box, coord, energy, force, virial, image_nums = self.load_raw(raw_files, atom_nums)
|
|
102
|
+
|
|
103
|
+
for i in range(image_nums):
|
|
104
|
+
image = Image(lattice=box[i], position=coord[i], force=force[i], Ep=energy[i], stress=virial[i],
|
|
105
|
+
atom_type=atom_type, atom_nums=atom_nums, atom_types_image=atom_types_image, atom_type_num=atom_type_num,
|
|
106
|
+
cartesian=True, image_nums=i)
|
|
107
|
+
atomic_energy, _, _, _ = np.linalg.lstsq([atom_type_num], np.array([image.Ep]), rcond=1e-3)
|
|
108
|
+
atomic_energy = np.repeat(atomic_energy, atom_type_num)
|
|
109
|
+
image.atomic_energy = atomic_energy.tolist()
|
|
110
|
+
self.image_list.append(image)
|
|
111
|
+
|
|
112
|
+
def load_raw(self, raw_files, atom_nums):
|
|
113
|
+
file_keys_to_load = {
|
|
114
|
+
"box": (process_line, (-1, 3, 3)),
|
|
115
|
+
"coord": (process_line, (-1, atom_nums, 3)),
|
|
116
|
+
"force": (process_line, (-1, atom_nums, 3)),
|
|
117
|
+
"energy": (process_single_line, None),
|
|
118
|
+
"virial": (process_line, (-1, 3, 3))
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
data = {}
|
|
122
|
+
for raw_file in tqdm(raw_files, desc="Loading data"):
|
|
123
|
+
with open(raw_file, 'r') as f:
|
|
124
|
+
lines = f.read().splitlines()
|
|
125
|
+
|
|
126
|
+
for key, (func, shape) in file_keys_to_load.items():
|
|
127
|
+
if key in raw_file:
|
|
128
|
+
if shape is None:
|
|
129
|
+
data[key] = func(lines)
|
|
130
|
+
else:
|
|
131
|
+
data[key] = func(lines, shape)
|
|
132
|
+
|
|
133
|
+
image_nums = len(data['box'])
|
|
134
|
+
print("Load data %s successfully! \t\t\t\t Image nums: %d" % (raw_files, image_nums))
|
|
135
|
+
return data['box'], data['coord'], data['energy'], data['force'], data['virial'], image_nums
|
|
136
|
+
|
|
137
|
+
def process_line(line, shape):
|
|
138
|
+
return np.array([list(map(float, line.split())) for line in line]).reshape(*shape)
|
|
139
|
+
|
|
140
|
+
def process_single_line(line):
|
|
141
|
+
return np.array([float(line) for line in line])
|
|
142
|
+
|
|
@@ -14,6 +14,7 @@ from pwdata.atomconfig import CONFIG
|
|
|
14
14
|
from pwdata.dump import DUMP
|
|
15
15
|
from pwdata.lammpsdata import LMP
|
|
16
16
|
from pwdata.cp2kdata import CP2KMD, CP2KSCF
|
|
17
|
+
from pwdata.deepmd import DPNPY, DPRAW
|
|
17
18
|
from pwdata.movement_saver import save_to_movement
|
|
18
19
|
from pwdata.extendedxyz import save_to_extxyz
|
|
19
20
|
from pwdata.datasets_saver import save_to_dataset, get_pw, save_to_raw, save_to_npy
|
|
@@ -53,6 +54,10 @@ class Save_Data(object):
|
|
|
53
54
|
self.image_data = CP2KMD(data_path)
|
|
54
55
|
elif format.lower() == 'cp2k/scf':
|
|
55
56
|
self.image_data = CP2KSCF(data_path)
|
|
57
|
+
elif format.lower() == 'deepmd/npy':
|
|
58
|
+
self.image_data = DPNPY(data_path)
|
|
59
|
+
elif format.lower() == 'deepmd/raw':
|
|
60
|
+
self.image_data = DPRAW(data_path)
|
|
56
61
|
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())
|
|
57
62
|
|
|
58
63
|
if train_ratio is not None: # inference 时不存数据
|
|
@@ -175,6 +180,10 @@ class Config(object):
|
|
|
175
180
|
image = CP2KMD(data_path).image_list[index]
|
|
176
181
|
elif format.lower() == 'cp2k/scf':
|
|
177
182
|
image = CP2KSCF(data_path).image_list[0]
|
|
183
|
+
elif format.lower() == 'deepmd/npy':
|
|
184
|
+
image = DPNPY(data_path).image_list[index]
|
|
185
|
+
elif format.lower() == 'deepmd/raw':
|
|
186
|
+
image = DPRAW(data_path).image_list[index]
|
|
178
187
|
else:
|
|
179
188
|
raise Exception("Error! The format of the input file is not supported!")
|
|
180
189
|
return image
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pwdata
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
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.7",
|
|
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.",
|
pwdata-0.2.5/pwdata/configop.py
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from pwdata.poscar import POSCAR
|
|
4
|
-
from pwdata.atomconfig import CONFIG
|
|
5
|
-
from pwdata.build.supercells import make_supercell
|
|
6
|
-
from pwdata.pertub.perturbation import BatchPerturbStructure
|
|
7
|
-
from pwdata.pertub.scale import BatchScaleCell
|
|
8
|
-
from pwdata import Config
|
|
9
|
-
from pwdata.lammpsdata import LMP
|
|
10
|
-
from pwdata.dump import DUMP
|
|
11
|
-
|
|
12
|
-
def extract_config(config_path:str, format:str, pbc:list[int]=[1,1,1], atom_names: list[str] = None):
|
|
13
|
-
if format.lower() == "config" or format.lower() == "pwmat":
|
|
14
|
-
image = CONFIG(config_path, pbc).image_list[0]
|
|
15
|
-
elif format.lower() == "poscar" or format.lower() == "vasp":
|
|
16
|
-
image = POSCAR(config_path, pbc).image_list[0]
|
|
17
|
-
elif format.lower() == "lmp" or format.lower() == "lammps":
|
|
18
|
-
image = LMP(config_path).image_list[0]
|
|
19
|
-
elif format.lower() == "dump":# for lammps single structure traj file
|
|
20
|
-
image = DUMP(dump_file=config_path, atom_names=atom_names).image_list[0]
|
|
21
|
-
else:
|
|
22
|
-
raise ValueError("Invalid format")
|
|
23
|
-
return image
|
|
24
|
-
|
|
25
|
-
def save_config(config, input_format:str = None, wrap = False, direct = True, sort = True, \
|
|
26
|
-
save_format:str=None, save_path:str=None, save_name:str=None, atom_names: list[str] = None):
|
|
27
|
-
if isinstance(config, str):
|
|
28
|
-
config = extract_config(config_path=config, format=input_format, atom_names=atom_names)
|
|
29
|
-
|
|
30
|
-
config.to(output_path=save_path,
|
|
31
|
-
data_name =save_name,
|
|
32
|
-
save_format=save_format,
|
|
33
|
-
direct =direct,
|
|
34
|
-
sort =sort,
|
|
35
|
-
wrap =wrap
|
|
36
|
-
)
|
|
37
|
-
return os.path.join(save_path, save_name)
|
|
38
|
-
|
|
39
|
-
def do_super_cell(config, input_format:str=None, supercell_matrix:list[int]=None, pbc:list[int]=[1, 1, 1], direct = True, sort = True, \
|
|
40
|
-
save_format:str=None, save_path:str=None, save_name:str=None):
|
|
41
|
-
if isinstance(config, str):
|
|
42
|
-
config = extract_config(config_path=config, format=input_format)
|
|
43
|
-
# Make a supercell
|
|
44
|
-
supercell = make_supercell(config, supercell_matrix, pbc)
|
|
45
|
-
# Write out the structure
|
|
46
|
-
supercell.to(output_path = save_path,
|
|
47
|
-
data_name = save_name,
|
|
48
|
-
save_format = save_format,
|
|
49
|
-
direct = direct,
|
|
50
|
-
sort = sort)
|
|
51
|
-
return os.path.join(save_path, save_name)
|
|
52
|
-
|
|
53
|
-
def do_scale(config, input_format:str=None, scale_factor:float=None,
|
|
54
|
-
direct:bool=True, sort:bool=True, save_format:str=None, save_path:str=None, save_name:str=None):
|
|
55
|
-
if isinstance(config, str):
|
|
56
|
-
config = extract_config(config_path=config, format=input_format)
|
|
57
|
-
scaled_struct = BatchScaleCell.batch_scale(config, scale_factor)
|
|
58
|
-
scaled_struct.to(output_path = save_path,
|
|
59
|
-
data_name = save_name,
|
|
60
|
-
save_format = save_format,
|
|
61
|
-
direct = direct,
|
|
62
|
-
sort = sort)
|
|
63
|
-
return os.path.join(save_path, save_name)
|
|
64
|
-
|
|
65
|
-
def do_pertub(config, input_format:str=None, pert_num:int=None, cell_pert_fraction:float=None, atom_pert_distance:float=None, \
|
|
66
|
-
direct:bool=True, sort:bool=True, save_format:str=None, save_path:str=None, save_name:str=None):
|
|
67
|
-
if isinstance(config, str):
|
|
68
|
-
config = extract_config(config_path=config, format=input_format)
|
|
69
|
-
|
|
70
|
-
if not os.path.exists(save_path):
|
|
71
|
-
os.makedirs(save_path)
|
|
72
|
-
perturbed_structs = BatchPerturbStructure.batch_perturb(config, pert_num, cell_pert_fraction, atom_pert_distance)
|
|
73
|
-
for tmp_perturbed_idx, tmp_pertubed_struct in enumerate(perturbed_structs):
|
|
74
|
-
tmp_pertubed_struct.to(output_path = save_path,
|
|
75
|
-
data_name = "{}_{}".format(tmp_perturbed_idx, save_name),
|
|
76
|
-
save_format = save_format,
|
|
77
|
-
direct = direct,
|
|
78
|
-
sort = sort)
|
|
79
|
-
print("pertub {} done!".format(os.path.join(save_path, "{}_{}".format(tmp_perturbed_idx, save_name))))
|
|
80
|
-
|
|
81
|
-
'''
|
|
82
|
-
description:
|
|
83
|
-
if merge is ture, save pwdata to datasets_path/data_name ...
|
|
84
|
-
else:
|
|
85
|
-
save pwdata to datasets_path/data_name/train or valid
|
|
86
|
-
return {*}
|
|
87
|
-
author: wuxingxing
|
|
88
|
-
'''
|
|
89
|
-
def extract_pwdata(data_list:list[str],
|
|
90
|
-
data_format:str="movement",
|
|
91
|
-
datasets_path="PWdata",
|
|
92
|
-
train_valid_ratio:float=0.8,
|
|
93
|
-
data_shuffle:bool=True,
|
|
94
|
-
merge_data:bool=False
|
|
95
|
-
):
|
|
96
|
-
data_name = None
|
|
97
|
-
if merge_data:
|
|
98
|
-
data_name = os.path.basename(datasets_path)
|
|
99
|
-
if not os.path.isabs(datasets_path):
|
|
100
|
-
# data_name = datasets_path
|
|
101
|
-
datasets_path = os.path.dirname(os.path.join(os.getcwd(), datasets_path))
|
|
102
|
-
else:
|
|
103
|
-
datasets_path = os.path.dirname(datasets_path)
|
|
104
|
-
multi_data = []
|
|
105
|
-
for data_path in data_list:
|
|
106
|
-
image_data = Config.read(data_format, data_path)
|
|
107
|
-
multi_data += image_data
|
|
108
|
-
get_all = Config.get(multi_data)
|
|
109
|
-
Config.save(image_data_dict=get_all,
|
|
110
|
-
datasets_path=datasets_path,
|
|
111
|
-
train_data_path="train",
|
|
112
|
-
valid_data_path="valid",
|
|
113
|
-
train_ratio = train_valid_ratio,
|
|
114
|
-
random=data_shuffle,
|
|
115
|
-
seed = 2024,
|
|
116
|
-
retain_raw = False,
|
|
117
|
-
data_name = data_name
|
|
118
|
-
)
|
|
119
|
-
else:
|
|
120
|
-
for data_path in data_list:
|
|
121
|
-
image_data = Config.read(data_format, data_path)
|
|
122
|
-
get_all = Config.get(image_data)
|
|
123
|
-
Config.save(image_data_dict=get_all,
|
|
124
|
-
datasets_path=datasets_path,
|
|
125
|
-
train_data_path="train",
|
|
126
|
-
valid_data_path="valid",
|
|
127
|
-
train_ratio = train_valid_ratio,
|
|
128
|
-
random=data_shuffle,
|
|
129
|
-
seed = 2024,
|
|
130
|
-
retain_raw = False
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
if __name__ == "__main__":
|
|
134
|
-
# in_config = "/data/home/wuxingxing/datas/al_dir/si_5_pwmat/sys_config/structures/1.config"
|
|
135
|
-
# save_path = "/data/home/wuxingxing/datas/al_dir/si_5_pwmat/sys_config/structures"
|
|
136
|
-
# image = extract_config(config_path=in_config, format="pwmat")
|
|
137
|
-
|
|
138
|
-
# save_config(image, wrap=False, direct=True, sort=True,\
|
|
139
|
-
# save_format="pwmat", save_path=save_path, save_name="temp_atom.config")
|
|
140
|
-
# save_config(image, wrap=False, direct=True, sort=True,\
|
|
141
|
-
# save_format="vasp", save_path=save_path, save_name="temp_poscar")
|
|
142
|
-
|
|
143
|
-
# do_super_cell(config=image,
|
|
144
|
-
# supercell_matrix=[[2,0,0], [0,2,0], [0,0,2]],
|
|
145
|
-
# pbc=[1, 1, 1],
|
|
146
|
-
# direct = True,
|
|
147
|
-
# sort = True, \
|
|
148
|
-
# save_format="pwmat", save_path=save_path, save_name="temp_super_atom.config")
|
|
149
|
-
|
|
150
|
-
# do_super_cell(config="/data/home/wuxingxing/datas/al_dir/si_5_pwmat/sys_config/structures/44_POSCAR",
|
|
151
|
-
# input_format="vasp",
|
|
152
|
-
# supercell_matrix=[[2,0,0], [0,2,0], [0,0,2]],
|
|
153
|
-
# pbc=[1, 1, 1],
|
|
154
|
-
# direct = True,
|
|
155
|
-
# sort = True, \
|
|
156
|
-
# save_format="pwmat", save_path=save_path, save_name="temp_super_atom_from_poscar.config")
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
# do_super_cell(config="/data/home/wuxingxing/datas/al_dir/si_5_pwmat/sys_config/structures/44_POSCAR",
|
|
160
|
-
# input_format="vasp",
|
|
161
|
-
# supercell_matrix=[[2,0,0], [0,2,0], [0,0,2]],
|
|
162
|
-
# pbc=[1, 1, 1],
|
|
163
|
-
# direct = True,
|
|
164
|
-
# sort = True, \
|
|
165
|
-
# save_format="vasp", save_path=save_path, save_name="temp_super_poscar")
|
|
166
|
-
|
|
167
|
-
# do_scale(config=image,
|
|
168
|
-
# scale_factor=0.99,
|
|
169
|
-
# direct=True,
|
|
170
|
-
# sort=True,
|
|
171
|
-
# save_format="pwmat", save_path=save_path, save_name="temp_scale_atom.config")
|
|
172
|
-
|
|
173
|
-
# do_scale(config=image,
|
|
174
|
-
# scale_factor=0.99,
|
|
175
|
-
# direct=True,
|
|
176
|
-
# sort=True,
|
|
177
|
-
# save_format="vasp", save_path=save_path, save_name="temp_scale_poscar")
|
|
178
|
-
|
|
179
|
-
# save_path = "/data/home/wuxingxing/datas/al_dir/si_5_pwmat/sys_config/structures/temp_pwmat_pertub"
|
|
180
|
-
# do_pertub(config=image,
|
|
181
|
-
# pert_num=50,
|
|
182
|
-
# cell_pert_fraction=0.01,
|
|
183
|
-
# atom_pert_distance=0.04,
|
|
184
|
-
# direct=True,
|
|
185
|
-
# sort=True,
|
|
186
|
-
# save_format="pwmat", save_path=save_path, save_name="pertub.config")
|
|
187
|
-
|
|
188
|
-
# save_path = "/data/home/wuxingxing/datas/al_dir/si_5_pwmat/sys_config/structures/temp_vasp_pertub"
|
|
189
|
-
# do_pertub(config=image,
|
|
190
|
-
# pert_num=50,
|
|
191
|
-
# cell_pert_fraction=0.01,
|
|
192
|
-
# atom_pert_distance=0.04,
|
|
193
|
-
# direct=True,
|
|
194
|
-
# sort=True,
|
|
195
|
-
# save_format="vasp", save_path=save_path, save_name="pertub.poscar")
|
|
196
|
-
|
|
197
|
-
# convert trajs to config for model_deviation calculate
|
|
198
|
-
import glob
|
|
199
|
-
traj_dir = "/data/home/wuxingxing/datas/al_dir/si_5_pwmat/iter.0000/temp_run_iter_work/explore/md/md.000.sys.000/md.000.sys.000.t.000/traj"
|
|
200
|
-
save_dir = "/data/home/wuxingxing/datas/al_dir/si_5_pwmat/iter.0000/temp_run_iter_work/explore/md/md.000.sys.000/md.000.sys.000.t.000/traj2config"
|
|
201
|
-
if not os.path.exists(save_dir):
|
|
202
|
-
os.makedirs(save_dir)
|
|
203
|
-
trajs = glob.glob(os.path.join(traj_dir, "*.lammpstrj"))
|
|
204
|
-
trajs = sorted(trajs)
|
|
205
|
-
for traj in trajs:
|
|
206
|
-
save_name = "{}.config".format(os.path.basename(traj).split('.')[0])
|
|
207
|
-
save_config(traj, input_format="dump", wrap=False, direct=True, sort=True,\
|
|
208
|
-
save_format="pwmat", save_path=save_dir, save_name=save_name)
|
|
209
|
-
print("{} to {} done!".format(traj, save_name))
|
|
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
|
|
File without changes
|
|
File without changes
|