File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 1- import warnings
1+ import os , warnings , fnmatch
22import numpy as np
33from deepmd .env import tf
44
@@ -152,3 +152,9 @@ def get_activation_func(activation_fn):
152152 raise RuntimeError (activation_fn + " is not a valid activation function" )
153153 return activation_fn_dict [activation_fn ]
154154
155+ def expand_sys_str (root_dir ):
156+ matches = []
157+ for root , dirnames , filenames in os .walk (root_dir , followlinks = True ):
158+ for filename in fnmatch .filter (filenames , 'type.raw' ):
159+ matches .append (root )
160+ return matches
Original file line number Diff line number Diff line change 77import numpy as np
88
99from deepmd .Data import DeepmdData
10+ from deepmd .common import expand_sys_str
1011from deepmd import DeepEval
1112from deepmd import DeepPot
1213from deepmd import DeepDipole
1617
1718def test (args ):
1819 de = DeepEval (args .model )
19- all_sys = []
20- from pathlib import Path
21- for filename in Path (args .system ).rglob ('type.raw' ):
22- all_sys .append (os .path .dirname (filename ))
20+ all_sys = expand_sys_str (args .system )
2321 for ii in all_sys :
2422 args .system = ii
2523 print ("# ---------------output of dp test--------------- " )
Original file line number Diff line number Diff line change 1010from deepmd .RunOptions import RunOptions
1111from deepmd .DataSystem import DeepmdDataSystem
1212from deepmd .Trainer import NNPTrainer
13- from deepmd .common import data_requirement
13+ from deepmd .common import data_requirement , expand_sys_str
1414from deepmd .DataModifier import DipoleChargeModifier
1515
1616def create_done_queue (cluster_spec , task_index ):
@@ -80,13 +80,6 @@ def train (args) :
8080 # serial training
8181 _do_work (jdata , run_opt )
8282
83- def expand_sys_str (root_dir ):
84- all_sys = []
85- from pathlib import Path
86- for filename in Path (root_dir ).rglob ('type.raw' ):
87- all_sys .append (os .path .dirname (filename ))
88- return all_sys
89-
9083def _do_work (jdata , run_opt ):
9184 # init the model
9285 model = NNPTrainer (jdata , run_opt = run_opt )
You can’t perform that action at this time.
0 commit comments