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)
Example #2
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)
Example #3
0
def gen_water(shift=np.zeros(3), shiftPt=np.zeros(3), theta=0.0, phi=0.0):
    """Init water molecule, already optimised using 6-311G**"""
    coords = np.zeros((3,3))
    coords[1, 1] += 0.757009
    coords[2, 1] += -0.757009
    coords[1:3, 2] += 0.593565
    names = ["O", "H", "H"]
    mol = Atoms(names, coords)
    mol.rotate(theta, phi)
    mol.shift(np.dot(Pt_basis(), shiftPt))
    mol.shift(shift)
    return mol
    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"
Example #5
0
[email protected] 02/10/15
"""
import numpy as np
from numpy.linalg import norm
from numpy.matlib import repmat
from scipy.linalg import expm
from math import sqrt, acos, radians
from xyzlib import Atoms
from docopt import docopt


if __name__ == "__main__":
    args = docopt(__doc__,version=1.0)
#    print args
    A = Atoms().read(args["<file>"])

    if args["--centre"]:
         n = int(args["--centre"])
         s = -A.coords[n-1]
         A.shift(s)
   
    if args["--align"]:
        n1, n2 = [int(i) for i in args["--align"].split()]
        if n1 != n2:
            A.align(n1, n2)

    if args["--flip"]:
        n1, n2 = [int(i) for i in args["--flip"].split()]
        if n1 == n2:
            print "Please choose two different atoms."
Example #6
0
    if args["water"]:
        mol = gen_water(shift=shift, shiftPt=posPt, theta=theta, phi=phi)
        print mol
        if args["--save"]:
            mol.save(args["--save"])    # "water.xyz"
    elif args["Pt"]:
        cluster = args["<cluster>"]
        mol = gen_Pt(cluster=cluster, shift=shift)
        print mol
        if args["--save"]:
            mol.save(args["--save"])    # "Pt.xyz"
    elif args["carbon"]:
        a = 1.42
        Nh, Nv = int(args["<Nh>"]), int(args["<Nv>"])
        mol = gen_carbon(Nh, Nv, shift=shift)
        if args["--addH"]: 
            b = float(args["--Ha"])
            mol += add_hydrogens(mol.coords, a, b)
        print mol
        if args["--save"]:
            mol.save(args["--save"])
    else:                   # single atom
        name = args["--atom"]
        coords = [0, 0, 0]
        xyz = Atoms(name, coords)
        print xyz
        if args["--save"]:
            xyz.save(args["--save"])


Example #7
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"

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)
Example #9
0
    --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)
        #mol.shift(tempshift)
Example #10
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)
Example #11
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)