Dmin = float(args["<dmin>"]) Dmax = float(args["<dmax>"]) N = int(args["<N>"]) Drange = np.linspace(Dmin, Dmax, N).round(2) print "Range of distances: ", Drange for c in combinations(blobnums, 2): combdirname = "Blobs_" + str(c[0]) + "_" + str(c[1]) combdir = os.path.join(maindir, combdirname) if not os.path.isdir(combdir): # create list of subdirs by combination os.makedirs(combdir) print "Created new directory", combdirname blob1 = Atoms().read(blobdir + "/waterblob_" + str(c[0]) + ".xyz") blob2 = Atoms().read(blobdir + "/waterblob_" + str(c[1]) + ".xyz") blob1.shift_com() blob2.shift_com() for d in Drange: # in each combdir, create xyz and gjf files for each blob dist xyzname = "waterblobs_d" + str(d) + ".xyz" xyzpath = os.path.join(combdir, xyzname) if not os.path.exists(xyzpath): blob2.shift([0, 0, d]) blob12 = blob1 + blob2 blob2.shift([0, 0, -d]) # BAD SOLUTION, FIX THIS blob12.save(xyzpath) # header = gen_g09_header(params=g09params) #FIX THIS header = "%nproc=16\n#T B3LYP/6-31G* Test\n\nSome silly text\n\n" output = header + str(blob12) + "\n\n" gjfname = "run_blobs_d" + str(d) + ".gjf"
args = docopt(__doc__) #print args try: pos = args["<pos>"] except int(pos) not in range(1, 7): print "Allowed position numbers are 1...6, see README." sys.exit() maindir = os.path.expanduser("~/DPDcoeffs/TA_WaterBlob") blobdir = os.path.expanduser("~/DPDcoeffs/Files/Waterblobs") blobnum = args["--blobnum"] # blob number used, default is 0 blobfile = os.path.join(blobdir, "waterblob_" + blobnum + ".xyz") outdir = maindir + "/Pos_" + pos blob = Atoms().read(blobfile) blob.shift_com() triflic = Atoms().read(os.path.expanduser("~/DPDcoeffs/Files/triflic.xyz")) if args["--counterpoise"]: triflic.names = [i + "(fragment=1)" for i in triflic.names] blob.names = [i + "(fragment=2)" for i in blob.names] outdir = maindir + "/Pos_" + pos + "_CP" if not os.path.exists(outdir): os.mkdir(outdir) Dmin = float(args["<dmin>"]) Dmax = float(args["<dmax>"]) delta = float(args["<delta>"]) Drange = np.arange(Dmin, Dmax, delta).round(2) print "Blob position:", pos, "\nDistances: ", Drange