Exemplo n.º 1
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
Exemplo n.º 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)
Exemplo n.º 3
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.º 4
0
         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."
        else:
            A.flip(n1, n2)
    
    if args["--rotate"]:
        theta, phi = [radians(float(i)) for i in args["--rotate"].split()]
        A.rotate(theta, phi)
    
    if args["--shift"]:
      s = [float(i) for i in args["--shift"].split()]
      A.shift(s)
    
    if args["--save"]:
        fname = args["--save"]
        A.save(fname)
    else:
        print A
   

Exemplo n.º 5
0

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)
        mol.shift(np.random.randn(3, 3)*sigma)
        A.coords[3*i:3*(i+1), :] = np.copy(mol.coords)

if args["--save"]:
    A.save(args["--save"])
else:
    print A

Exemplo n.º 6
0
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)
        mol.shift(np.random.randn(3, 3) * sigma)
        A.coords[3 * i:3 * (i + 1), :] = np.copy(mol.coords)

if args["--save"]:
    A.save(args["--save"])
else:
    print A