Esempio n. 1
0
def main(argv=None):
    # Read input
    args, ret = parse_cmdline(argv)
    if ret != GOOD_RET:
        return ret

    cfg = args.config

    # Read and process pdb files
    try:
        atom_num_dict = read_csv_dict(cfg[ATOM_REORDER_FILE])
        mol_num_dict = read_csv_dict(cfg[MOL_RENUM_FILE], one_to_one=False)
        element_dict = create_element_dict(cfg[ELEMENT_DICT_FILE], pdb_dict=False)
        radii_dict = create_element_dict(cfg[RADII_DICT_FILE], pdb_dict=False)
        process_psf(cfg, atom_num_dict, mol_num_dict, element_dict, radii_dict)
    except IOError as e:
        warning("Problems reading file:", e)
        return IO_ERROR
    except InvalidDataError as e:
        warning(e)
        return INVALID_DATA

    return GOOD_RET  # success
Esempio n. 2
0
def main(argv=None):
    # Read input
    args, ret = parse_cmdline(argv)
    if ret != GOOD_RET:
        return ret

    cfg = args.config

    # Read and process pdb files
    try:
        atom_num_dict = read_csv_dict(cfg[ATOM_REORDER_FILE])
        mol_num_dict = read_csv_dict(cfg[MOL_RENUM_FILE], one_to_one=False)
        element_dict = create_element_dict(cfg[ELEMENT_DICT_FILE],
                                           pdb_dict=False)
        radii_dict = create_element_dict(cfg[RADII_DICT_FILE], pdb_dict=False)
        process_psf(cfg, atom_num_dict, mol_num_dict, element_dict, radii_dict)
    except IOError as e:
        warning("Problems reading file:", e)
        return IO_ERROR
    except InvalidDataError as e:
        warning(e)
        return INVALID_DATA

    return GOOD_RET  # success
Esempio n. 3
0
def main(argv=None):
    # Read input
    args, ret = parse_cmdline(argv)
    if ret != GOOD_RET or args is None:
        return ret

    # Read template and data files
    cfg = args.config

    try:
        if cfg[PDB_TPL_FILE] is None:
            pdb_tpl_content = None
        else:
            pdb_tpl_content = process_pdb_tpl(cfg[PDB_TPL_FILE])
            # add new row at the beginning for remark
            pdb_tpl_content[HEAD_CONTENT] = [
                "REMARK 450 "
            ] * 3 + pdb_tpl_content[HEAD_CONTENT]
        if cfg[DATA_TPL_FILE] is None:
            data_tpl_content = None
        else:
            data_tpl_content = process_data_tpl(cfg)

        element_dict = create_element_dict(ELEMENT_DICT_FILE, pdb_dict=False)

        print('"file_name","qmmm_energy","opt_complete","job_complete"')
        for cp2k_file in cfg[CP2K_FILES]:
            process_cp2k_file(cfg, cp2k_file, data_tpl_content,
                              pdb_tpl_content, element_dict)

    except IOError as e:
        warning("Problems reading file:", e)
        return IO_ERROR

    except (InvalidDataError, KeyError, ValueError) as e:
        warning("Problems reading data:", e)
        return INVALID_DATA

    return GOOD_RET  # success