forked from Ericwang6/tyk2_dp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog2dp.py
More file actions
27 lines (23 loc) · 807 Bytes
/
Copy pathlog2dp.py
File metadata and controls
27 lines (23 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import dpdata
import os, glob
from functools import reduce
from collections import Iterable
import numpy as np
def log2dp(logs, system_dir=None, type_map=None):
systs = []
if not isinstance(logs, str):
for log in logs:
ss = dpdata.LabeledSystem(log, fmt='gaussian/log', type_map=type_map)
systs.append(ss)
all_syst = reduce(lambda x, y: x+y, systs)
else:
all_syst = dpdata.LabeledSystem(logs, fmt='gaussian/log', type_map=type_map)
if system_dir:
all_syst.to_deepmd_npy(system_dir)
return all_syst
if __name__ == "__main__":
ligs = np.loadtxt("SYSTEMS.txt", dtype=np.str)
for lig in ligs:
logs = glob.glob(f"gaussian/{lig}/*log")
syst = log2dp(logs, f"data/{lig}")
print(lig, syst.get_nframes())