예제 #1
0
 def test_makefep(self):
     libs = ["data/qmakefep/3hp.lib", "data/qmakefep/3h2.lib"]
     fep_file_str = make_fep("data/qmakefep/3hp.qmap",
                             "data/qmakefep/3hp_start.pdb", "oplsaa", [
                                 "data/qmakefep/3hp.prm",
                             ], libs)
     fep_file_str = re.sub("(\*|\!|#).*", "", fep_file_str)
     ref_fep = open("data/qmakefep/3hp.fep.tmplt.gen").read()
     assert fep_file_str == ref_fep
예제 #2
0
    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)

    args = parser.parse_args()

    for k, v in six.iteritems(vars(args)):
        if k in ["pdb", "parms", "libs", "qmap"]:
            for fn in v:
                if not os.path.lexists(fn):
                    print("File '{}' doesn't exist.".format(fn))
                    sys.exit(1)

    try:
        fepstr = make_fep(args.qmap[0],
                          args.pdb[0],
                          args.forcefield,
                          args.prms,
                          args.libs,
                          ignore_errors=args.ignore_errors)
    except QMakeFepError as err:
        print("\nFATAL!\n{}\n".format(err))
        sys.exit(1)

    output_file = args.outfile[0]
    backup = backup_file(output_file)
    if backup:
        print("\n# Backed up '{}' to '{}'".format(output_file, backup))
    open(output_file, 'w').write(fepstr)
    print("Wrote '{}'... ".format(output_file))