Exemple #1
0
def _check_confs(testCase, idx, jdata):
    md_dir = os.path.join('iter.%06d' % idx, '01.model_devi')
    tasks = glob.glob(os.path.join(md_dir, 'task.*'))
    tasks.sort()
    cur_job = jdata['model_devi_jobs'][idx]
    sys_idx = cur_job['sys_idx']
    sys_configs = jdata['sys_configs']
    poscars = []
    for ii in sys_idx:
        sys_poscars = []
        for ss in sys_configs[ii]:
            tmp_poscars = glob.glob(ss)
            sys_poscars += tmp_poscars
        sys_poscars.sort()
        poscars.append(sys_poscars)
    for ii in tasks:
        conf_file = os.path.join(ii, 'conf.lmp')
        l_conf_file = os.path.basename(os.readlink(conf_file))
        poscar_file = poscars[int(l_conf_file.split('.')[0])][int(
            l_conf_file.split('.')[1])]
        sys_0 = dpdata.System(conf_file, type_map=jdata['type_map'])
        sys_1 = dpdata.System(poscar_file)
        test_atom_names(testCase, sys_0, sys_1)
        test_atom_types(testCase, sys_0, sys_1)
        test_cell(testCase, sys_0, sys_1)
        test_coord(testCase, sys_0, sys_1)
Exemple #2
0
def _check_poscars(testCase, idx, fp_task_max, type_map):
    fp_path = os.path.join('iter.%06d' % idx, '02.fp')
    candi_files = glob.glob(os.path.join(fp_path, 'candidate.shuffled.*.out'))
    candi_files.sort()
    sys_idx = [str(os.path.basename(ii).split('.')[2]) for ii in candi_files]
    for sidx, ii in zip(sys_idx, candi_files):
        md_task = []
        f_idx = []
        with open(ii) as fp:
            for ii in fp:
                md_task.append(ii.split()[0])
                f_idx.append(ii.split()[1])
        md_task = md_task[:fp_task_max]
        f_idx = f_idx[:fp_task_max]
        cc = 0
        for tt, ff in zip(md_task, f_idx):
            traj_file = os.path.join(tt, 'traj', '%d.lammpstrj' % int(ff))
            poscar_file = os.path.join(fp_path,
                                       'task.%03d.%06d' % (int(sidx), cc),
                                       'POSCAR')
            cc += 1
            sys0 = dpdata.System(traj_file,
                                 fmt='lammps/dump',
                                 type_map=type_map)
            sys1 = dpdata.System(poscar_file, fmt='vasp/poscar')
            test_atom_names(testCase, sys0, sys1)