Exemplo n.º 1
0
def save_configs(TA, blob, Drange, theta, phi, outdir, blobnum="0"):
    for d in Drange:
        xyzname = "run_blob_" + blobnum + "_d" + str(d) + ".xyz"
        xyzpath = os.path.join(outdir, xyzname)
        dist = np.array([[d, 0, 0]])
        dist = Atoms(["A"], dist)
        dist.rotate(theta, phi)
        dist = dist.coords[0].round(2)
        blob.shift(dist)
        TA_blob = triflic + blob
        blob.shift(-dist)  # STUPID TRICK
        TA_blob.save(xyzpath)
Exemplo n.º 2
0
    sys.exit()

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"
Exemplo n.º 3
0
    --sigma <s>      Gaussian sigma [default: 0.1]
    --seed <seed>    Random seed [default: 123]
    --all            Wiggle all atoms randomly
    --bymol          Wiggle each water molecule separately

[email protected], 14/08/15
"""
from docopt import docopt
import numpy as np
from xyzlib import Atoms

args = docopt(__doc__)
#print args
np.random.seed(int(args["--seed"]))
sigma = float(args["--sigma"])
A = Atoms().read(args["<infile>"])

if args["--all"]:
    noise = np.random.randn(len(A), 3) * sigma
    A.coords += noise

if args["--bymol"]:
    Nmols = len(A) / 3
    for i in range(Nmols):
        mol = Atoms(names=A.names[3 * i:3 * (i + 1)],
                    coords=A.coords[3 * i:3 * (i + 1), :])
        tempshift = mol.coords[0]
        #mol.shift(-tempshift)   # put oxygen at [0,0,0]
        theta = np.random.randn() * sigma
        phi = np.random.randn() * sigma
        mol.rotate(theta, phi)
Exemplo n.º 4
0

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)