Exemplo n.º 1
0
import os, sys
import argparse as ap
import numpy as np

parser = ap.ArgumentParser(description = "Add Molecule on surrounding sphere")
parser.add_argument("-i", "--infile", help="Infile from previous step, xyz format")
parser.add_argument("-a", "--add_molecule", help="Molecule to add, xyz format")
parser.add_argument("-o", "--outfile", help="Outfile, xyz format")

group = parser.add_mutually_exclusive_group()
group.add_argument("-r", "--radius_outer", type=float, help="radius from outmost atom to add new molecule at")
group.add_argument("-R", "--radius_center", type=float, help="radius from center to add new molecule at")

args = parser.parse_args()

iterin = xyzt.GetXYZIter(args.infile)
iteradd = xyzt.GetXYZIter(args.add_molecule)

inframe = iterin.get_last_frame()
addframe = iteradd.get_last_frame()

inframe = xyzt.Center(inframe)
addframe = xyzt.Center(addframe)

if args.radius_outer != None:
    radius = xyzt.get_extreme_value(inframe['coordinates']) + args.radius_outer
else:
    radius = args.radius_center

positioning_vector = np.multiply(np.array([1.0,0.0,0.0]), radius)
Exemplo n.º 2
0
parser = ap.ArgumentParser(description="Generate RDF from pairs")
parser.add_argument("-i", "--input", help="Input File, xyz", required=True)
parser.add_argument("-a", "--setaname", help="Set A atom names", nargs="+")
parser.add_argument("-b", "--setbname", help="Set B atom names", nargs="+")
parser.add_argument("-m",
                    "--setanum",
                    help="Set A atom indices, zero-based",
                    nargs="+")
parser.add_argument("-n",
                    "--setbnum",
                    help="Set B atom indices, zero-based",
                    nargs="+")
#parser.add_argument("-f", "--filter" , help="filter function", required=True)
args = parser.parse_args()

xyz_iter = xyzt.GetXYZIter(args.input)


def filter(ec, seta, setb):
    outpairs = []

    for a in seta:
        for b in setb:
            if b != (a - 1):
                outpairs.append(a)
                outpairs.append(b)

    return outpairs


seta = []
Exemplo n.º 3
0
                    elem[0], [float(elem[1]),
                              float(elem[2]),
                              float(elem[3])]
                ])


#            elif len(elem) == 0:
#                pass
            else:
                raise IOError(
                    "Line " + str(n) + " in File " + filename +
                    " : Malformed line. 4 fields (str, float, float, float) expected, "
                    + len(elem) + " found.")
    inf.close()
    return outarray

xyz_iter = xyzt.GetXYZIter(args.Infile)

for n, ec in enumerate(xyz_iter):

    if args.box != None:
        boxsize = args.box

    else:
        boxsize = ec['boxvector'][0]

    print ec
    data = zip(ec['elements'], ec['coordinates'])

    write_file(args.Outfile, data, boxsize)  #, ElementDict)
Exemplo n.º 4
0
#!/usr/bin/env python

import xyzt
import os, sys
import argparse as ap
import numpy as np

parser = ap.ArgumentParser(description = "Define molecule type - Dummy")

parser.add_argument("-i", "--infile",  help="infile, xyz format")

args = parser.parse_args()

frame = xyzt.Filter(xyzt.GetXYZIter(args.infile).get_last_frame(), keep=["NN"])

outstring = "1 " * len(frame['elements'])

print outstring
Exemplo n.º 5
0
    "molecule to center on. Zero-based index, negative indices permitted, default 0",
    type=int,
    default=None)
group2.add_argument("-C",
                    "--center_on_coordinates",
                    help="coordinates to center on. 3 values required",
                    type=float,
                    nargs=3,
                    default=None)

args = parser.parse_args()

#print args
#exit()

frameiterator = xyzt.GetXYZIter(args.input)

moleculespecs = [[]]

if args.types:
    for a in args.types:
        if a is ",":
            moleculespecs.append([])
        else:
            moleculespecs[-1].append(a)
    args.types = moleculespecs

print args.types
#exit()

for f in frameiterator:
Exemplo n.º 6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, sys
import xyzt 
import argparse as ap

parser = ap.ArgumentParser(description="Center a configuration in its bounding box and output minimum box dimensions")

parser.add_argument("-i", "--infile", help="XYZ input file")
parser.add_argument("-o", "--outfile", help="XYZ output file")

args = parser.parse_args()

xyz_in = xyzt.GetXYZIter(args.infile)

for ec in xyz_in:
    xyzt.Write_XYZ(ec, args.outfile, append=True)

Exemplo n.º 7
0
#!/usr/bin/env python

import xyzt
import numpy as np
np.set_printoptions(suppress=True)
ipf = xyzt.GetXYZIter("unitvector.xyz")
lf = ipf.get_last_frame()
#print lf
rx = xyzt.rotate_around_origin(lf.copy(), 90, 0, 0)
#print xyzt.rotate_around_origin(lf, 180, 180, 0)
ry = xyzt.rotate_around_origin(lf.copy(), 0, 90, 0)
rz = xyzt.rotate_around_origin(lf.copy(), 0, 0, 90)

print lf['coordinates'][0],
print lf['coordinates'][1],
print lf['coordinates'][2]

print rx['coordinates'][0],
print rx['coordinates'][1],
print rx['coordinates'][2]

print ry['coordinates'][0],
print ry['coordinates'][1],
print ry['coordinates'][2]

print rz['coordinates'][0],
print rz['coordinates'][1],
print rz['coordinates'][2]

print xyzt.get_extreme_value(lf['coordinates'])