Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(
        description=desc, formatter_class=argparse.RawDescriptionHelpFormatter)

    parser.add_argument(
        '--ndof',
        help=
        'Number of total degrees of freedom (e.g. 3*number of atoms).  This is simply the length of a coordinates vector.',
        type=int,
        default=1)
    #    parser.add_argument('--Database','-d', help = 'Name of database to write into', type = str, default="optimdb.sqlite")
    #    parser.add_argument('--Mindata','-m', help = 'Name of min.data file', type = str, default="min.data")
    #    parser.add_argument('--Tsdata','-t', help = 'Name of ts.data file', type = str, default="ts.data")
    #    parser.add_argument('--Pointsmin','-p', help = 'Name of points.min file', type = str, default="points.min")
    #    parser.add_argument('--Pointsts','-q', help = 'Name of points.ts file', type = str, default="points.ts")
    #    parser.add_argument('--endianness', help = 'set the endianness of the binary data.  Can be "<" for little-endian or ">" for big-endian', type = str, default="=")
    args = parser.parse_args()

    system = BaseSystem()
    db = system.create_database()
    converter = OptimDBConverter(db,
                                 mindata="min.data",
                                 tsdata="ts.data",
                                 pointsmin="points.min",
                                 pointsts="points.ts",
                                 endianness="=",
                                 assert_coords=False)
    converter.convert_no_coords()

    system.get_ndof = lambda: args.ndof
    run_gui(system, db=db)

    print(db.number_of_minima())
Exemplo n.º 2
0
 def setUp(self):
     from pele.utils.optim_compatibility import OptimDBConverter
     from pele.storage import Database
     ndof = 10 # wrong, but who cares.
     self.db = Database()
     current_dir = os.path.dirname(__file__)
     converter = OptimDBConverter(self.db, ndof=ndof, mindata=current_dir+"/collagen.min.data", 
                                  tsdata=current_dir+"/collagen.ts.data", assert_coords=False)
     converter.convert_no_coords()
Exemplo n.º 3
0
    parser.add_argument("--Tmin", type=float, help="Minimum temperature for the calculation.", default=0.02)
    parser.add_argument("--Tmax", type=float, help="Minimum temperature for the calculation.", default=1.0)
    parser.add_argument("--Tcount", type=int, help="Number of temperature points for the calculation.", default=300)
    parser.add_argument("--OPTIM", action="store_true", help="read data from a min.data file instead."
                        "fname should be the filename of the min.data file")
    args = parser.parse_args()
    print args.fname
    print args
    k = args.k
    
    # get the list of minima
    if args.OPTIM:
        # fname is a min.data file
        db = Database()
        converter = OptimDBConverter(db, mindata=args.fname)
        converter.convert_no_coords()
        minima = db.minima()
    else:
        dbfname = args.fname
        db = Database(dbfname, createdb=False)
        minima = [m for m in db.minima() if m.fvib is not None and m.pgorder is not None]
        if len(minima) == 0:
            print "There are not minima with the necessary thermodynamic information in the database.  Have you computed the normal mode"\
                  " frequencies and point group order for all the minima?  See pele.thermodynamics "\
                  " for more information"
            exit(1)
    print "computing heat capacity from", len(minima), "minima"

    Tmin = args.Tmin
    Tmax = args.Tmax
    nT = args.Tcount
Exemplo n.º 4
0
def main():
    if len(sys.argv) < 2:
        usage()
        exit(1)
    
    
    
    kwargs = {}
    outfile = None
    OPTIM = False

    opts, args = getopt.gnu_getopt(sys.argv[1:], "ho:", 
                                   ["help", "nlevels=", "subgraph_size=", "OPTIM",
                                    "order_by_basin_size", "order_by_energy",
                                    "include_gmin",
                                    "center_gmin",
                                    "Emax=",
                                    ])
    for o, a in opts:
        if o == "-h" or o == "--help":
            usage()
            exit(1)
        if o == "-o":
            outfile = a 
        elif o == "--nlevels":
            kwargs["nlevels"] = int(a)
        elif o == "--Emax":
            kwargs["Emax"] = float(a)
        elif o == "--subgraph_size":
            kwargs["subgraph_size"] = int(a)
        elif o == "--order_by_basin_size":
            kwargs["order_by_basin_size"] = True
        elif o == "--order_by_energy":
            kwargs["order_by_energy"] = True
        elif o == "--includer_gmin":
            kwargs["includer_gmin"] = True
        elif o == "--center_gmin":
            kwargs["center_gmin"] = True
        elif o == "--OPTIM":
            OPTIM = True
        else:
            print "don't understand", o, a
            print ""
            usage()
            exit(1)
    
    
    groups = None
    
    if OPTIM:
        #make database from min.data ts.data
        db = Database()
        converter = OptimDBConverter(db)
        converter.convert_no_coords()
        groups = read_AB(db)
    else:
        if len(args) == 0:
            print "you must specify database file"
            print ""
            usage()
            exit()
        dbfile = args[0]
        if not os.path.exists(dbfile):
            print "database file doesn't exist", dbfile
            exit()
        
        db = Database(dbfile)
        
    if outfile is None and use_gui:
        app = QApplication(sys.argv) 
        kwargs["show_minima"] = False
        md = DGraphDialog(db, params=kwargs)
        md.rebuild_disconnectivity_graph()
        if groups is not None:
            md.dgraph_widget.dg.color_by_group(groups)
            md.dgraph_widget.redraw_disconnectivity_graph()
        md.show()
        sys.exit(app.exec_())
        
    # make graph from database
    t0 = time.time()
    if "Emax" in kwargs and use_gui:
        graph = reduced_db2graph(db, kwargs['Emax'])
    else:
        graph = dg.database2graph(db)
    t1 = time.time()
    print "loading the data into a transition state graph took", t1-t0, "seconds"

    # do the disconnectivity graph analysis
    mydg = dg.DisconnectivityGraph(graph, **kwargs)
    print "doing disconnectivity graph analysis"
    sys.stdout.flush()
    t1 = time.time()
    mydg.calculate()
    t2 = time.time()
    print "d-graph analysis finished in", t2-t1, "seconds"
    print "number of minima:", mydg.tree_graph.number_of_leaves()
    print "plotting disconnectivigy graph"
    sys.stdout.flush()
    
    
    # make the figure and save it
    mydg.plot()
    if outfile is None:
        plt.show()
    else:
        plt.savefig(outfile)
    t3 = time.time()
    print "plotting finished in", t3-t2, "seconds"