コード例 #1
0
def main_conceptual_local(args):
    """Build LocalConceptualDFT class and dump a cube file of local descriptor."""
    # load molecule & cubic grid
    mol, cube = load_molecule_and_grid(args.fname, args.cube)

    # build model
    model = LocalConceptualDFT.from_molecule(args.fname, args.model,
                                             cube.points)
    # check whether local property exists
    if not hasattr(model, args.prop):
        raise ValueError("The {0} local conceptual DFT class does not contain "
                         "{1} attribute.".format(args.model, args.prop))
    if callable(getattr(model, args.prop)):
        raise ValueError(
            "The {0} argument is a method, please provide an attribute of "
            "{1} local conceptual DFT.".format(args.prop, args.model))

    # name of files
    cubfname = "{0}.cube".format(args.output)
    vmdfname = "{0}.vmd".format(args.output)
    # dump cube file of local property
    cube.generate_cube(cubfname, getattr(model, args.prop))
    # generate VMD scripts for visualizing iso-surface with VMD
    print_vmd_script_isosurface(vmdfname,
                                cubfname,
                                isosurf=args.isosurface,
                                material="BlownGlass")
コード例 #2
0
def main_mot(args):
    """Build MOTBasedTool model and dump VMD script and cube files for visualizing MO."""
    if args.info:
        mol = Molecule.from_file(args.fname)
    else:
        mol, cube = load_molecule_and_grid(args.fname, args.cube)

    hia, hib = np.array(mol.homo_index) - 1
    lia, lib = np.array(mol.lumo_index) - 1
    ea, eb = mol.energy
    print("")
    print(("File: {0}".format(args.fname)))
    # print("Charge      : % 5f" % np.sum(mol.numbers) - np.sum(ne))
    # print("Multiplicity: % 5d" % np.max(ne) - np.min(ne) + 1)
    print("")
    print("Atomic number and coordinates:")
    for index, num in enumerate(mol.numbers):
        coord = mol.coordinates[index, :]
        print(("% 2i   %10.6f   %10.6f   %10.6f" %
               (num, coord[0], coord[1], coord[2])))
    print("")
    print("Information on alpha & beta electrons:")
    print(("# electrons  :  % 3.3f       % 3.3f" % mol.mo.nelectrons))
    print(("H**O index   : % 3d        % 5d" % mol.homo_index))
    print("")
    print(("LUMO+2 index : %10.6f   %10.6f" % (ea[lia + 2], eb[lib + 2])))
    print(("LUMO+1 energy: %10.6f   %10.6f" % (ea[lia + 1], eb[lib + 1])))
    print(("LUMO   energy: %10.6f   %10.6f" % mol.lumo_energy))
    print(("H**O   energy: %10.6f   %10.6f" % mol.homo_energy))
    print(("H**O-1 energy: %10.6f   %10.6f" % (ea[hia - 1], eb[hib - 1])))
    print(("H**O-2 energy: %10.6f   %10.6f" % (ea[hia - 2], eb[hib - 2])))
    print("")

    if args.info:
        return

    index = args.index
    if index is not None:
        index = [int(item) for item in index.split(",")]
        if len(index) == 1:
            index = index[0]

    # build model
    mot = OrbPart.from_molecule(mol)

    # dump files for visualization
    if args.output is None:
        args.output = args.fname.rsplit(".")[0]
    mot.generate_scripts(args.output,
                         spin=args.spin,
                         index=index,
                         grid=cube,
                         isosurf=args.isosurface)
コード例 #3
0
def main_lol(args):
    """Build LOL model and dump VMD script and cube files for visualizing LOL."""
    # load molecule & cubic grid
    mol, cube = load_molecule_and_grid(args.fname, args.cube)

    # build model
    lol = LOL.from_molecule(mol, grid=cube, trans=args.trans, trans_k=args.trans_k,
                            trans_a=args.trans_a, denscut=args.denscut)

    # dump files for visualization
    output = args.output
    if output is None:
        output = args.fname.split(".")[0]
    lol.generate_scripts(output, isosurf=args.isosurface)
コード例 #4
0
def main_esp(args):
    """Generate VMD script and cube files for visualizing ESP on electron density iso-surface."""
    # load molecule & cubic grid
    mol, cube = load_molecule_and_grid(args.fname, args.cube)

    # dump files for visualization
    output = args.output
    if output is None:
        output = args.fname.split(".")[0]
    espname = output + "_esp.cube"
    rhoname = output + "_dens.cube"
    vmdname = output + ".vmd"

    cube.generate_cube(rhoname, mol.compute_density(cube.points))
    cube.generate_cube(espname, mol.compute_esp(cube.points))
    print_vmd_script_isosurface(vmdname, rhoname, colorfile=espname, isosurf=args.isosurface,
                                scalemin=args.scalemin, scalemax=args.scalemax)
コード例 #5
0
def main_nci(args):
    """Build NCI model and dump VMD script and cube files for visualizing NCI with VMD."""
    # load molecule & cubic grid
    mol, cube = load_molecule_and_grid(args.fname, args.cube)

    # build model
    nci = NCI.from_molecule(mol, grid=cube)

    # dump files for visualization
    output = args.output
    if output is None:
        output = args.fname.split(".")[0]
    nci.generate_scripts(output, isosurf=args.isosurface, denscut=args.denscut)

    # plot reduced density gradient vs. signed density
    if args.plot:
        nci.generate_plot(output, color=args.color)