Exemple #1
0
def main():
    # add some program options
    parser = OptionParser(usage = "usage: %prog [options] storage")
        
    parser.add_option("--write-disconnect",
                      dest="writeDPS", action="store_true",
                      help="generate min.dat and ts.dat to use with disconnectDPS")
    parser.add_option("-m",
                      dest="writeMinima", action="store_true",
                      help="dump minima to screen")
    parser.add_option("-t",
                      dest="writeTS", action="store_true",
                      help="dump transition states to screen")
    parser.add_option("--cif",
                  dest="writeCIF", action="store_true",
                  help="export cif files")
    parser.add_option("--cif-dir",
                  dest="cifDir", default=".", action="store",type="string",
                  help="directory to write cifs to")

    (options, args) = parser.parse_args()
    
    # print help if no input file is given
    if(len(args) != 1):
        parser.print_help()
        exit(-1)
        
    db = Database(db=args[0])

    if(options.writeMinima):
        print "List of minima:"
        print "---------------"
        for m in db.minima():
            print "%f\t\tid %d"%(m.energy, m._id)
        print "END\n"
    
    if(options.writeTS):
        print "List of transition states:"
        print "--------------------------"
        for ts in db.transition_states():
            print "%d\t<->\t%d\tid %d\tenergies %f %f %f"%\
                (ts.minimum1._id, ts.minimum2._id, ts._id, ts.minimum1.energy, ts.energy, ts.minimum2.energy)
        print "END\n"
        
    if(options.writeDPS):
        writeDPS(db)
        
    if(options.writeCIF):
        GMIN.initialize()
        i=0
        for m in db.minima():
            i+=1
            filename = options.cifDir+"/lowest%03d.cif"%(i)
            print "minimum",i, "energy",m.energy,"to",filename
            GMIN.writeCIF(filename, m.coords, "E"+str(m.energy))
Exemple #2
0
step = group.Reseeding(step1, reseed, maxnoimprove=maxnoimprove)

#save = pickle.load(open("storage"))
#save.nsave = 1000
save = savenlowest.SaveN(nsave=100, accuracy=1e-3)
save.compareMinima = dmagmin.compareMinima

opt = bh.BasinHopping(coords, pot, takeStep=step, 
                      quenchRoutine=dmagmin.quenchCrystal,
                      temperature=temperature, storage=save,
                      quenchParameters=quenchParameters)
addColdFusionCheck(opt)

# create cif directory if it does not exist
import os, errno
try:
    os.makedirs('cif')
except OSError, e:
    if e.errno != errno.EEXIST:
        raise


for i in xrange(1,nsteps/dump_frequency):
    opt.run(dump_frequency)
    #pickle.dump(save, open("storage."+str(i), "w"))
    pickle.dump(save, open("storage", "w"))
    i=0
    for m in save.data:
        i+=1
        GMIN.writeCIF("cif/lowest%03d.cif"%(i), m.coords, "E"+str(m.energy))
Exemple #3
0
parser.add_option("--cif",
                  dest="writeCIF", action="store_true",
                  help="export cif files")
parser.add_option("--cif-dir",
                  dest="cifDir", default=".", action="store",type="string",
                  help="directory to write cifs to")

(options, args) = parser.parse_args()

# print help if no input file is given
if(len(args) != 1):
    parser.print_help()
    exit(-1)

def compareMinima():
    pass

if(options.writeCIF):
    GMIN.initialize()

save = pickle.load(open(args[0]))

i=0
for m in save.data:
    i+=1
    print "minimum",i, "energy",m.E
    if(options.writeCIF):
        filename = options.cifDir+"/lowest%03d.cif"%(i)
        print "writing",filename
        GMIN.writeCIF(filename, m.coords, "E"+str(m.E))
Exemple #4
0
                  default=".",
                  action="store",
                  type="string",
                  help="directory to write cifs to")

(options, args) = parser.parse_args()

# print help if no input file is given
if (len(args) != 1):
    parser.print_help()
    exit(-1)


def compareMinima():
    pass


if (options.writeCIF):
    GMIN.initialize()

save = pickle.load(open(args[0]))

i = 0
for m in save.data:
    i += 1
    print "minimum", i, "energy", m.E
    if (options.writeCIF):
        filename = options.cifDir + "/lowest%03d.cif" % (i)
        print "writing", filename
        GMIN.writeCIF(filename, m.coords, "E" + str(m.E))