Ejemplo n.º 1
0
def sep_xyz(n):
    if not os.path.exists("conf"):
        os.mkdir("conf")
        shutil.copy("movie.xyz", "conf")
        os.chdir("conf")
        xyzBlock("movie.xyz", n+2, )
        os.remove("movie.xyz")
        os.chdir("..")
Ejemplo n.º 2
0
def sep_xyz(n):
    if not os.path.exists("conf"):
        os.mkdir("conf")
        shutil.copy("movie.xyz", "conf")
        os.chdir("conf")
        xyzBlock(
            "movie.xyz",
            n + 2,
        )
        os.remove("movie.xyz")
        os.chdir("..")
Ejemplo n.º 3
0
def replicate(xyz_info, args):
    fname = args.f[0]
    nlines = xyz_info.natoms + 2
    nframe = xyzBlock(fname, nlines)

    na, nb, nc = args.nbox
    if nframe >= 0:
        for i in range(nframe + 1):
            if not xyz_info.restart:
                a = Xyz("output%05d.xyz" % i)
                b = a.parser()
                b.pbc = xyz_info.pbc
                b.step = i
                toPdb(b, "output%05d.pdb" % i)
            # replicate the box using external code (genconf in Gromacs)
            subprocess.Popen([
                "gmx", "genconf", "-f",
                "output%05d.pdb" % i, "-o",
                "s_%05d.pdb" % i, "-nbox",
                "%d" % na,
                "%d" % nb,
                "%d" % nc
            ],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
    subprocess.Popen(["cat s_*.pdb > movie_%d_%d_%d.pdb" % (na, nb, nc)],
                     shell=True)
    # clear up
    o = open("clear.sh", "w")
    o.write("rm output*.xyz\n")
    o.write("rm output*.pdb\n")
    o.write("rm s_*.pdb\n")
    o.close()
    st = os.stat('clear.sh')
    os.chmod('clear.sh', st.st_mode | stat.S_IEXEC)
Ejemplo n.º 4
0
def replicate(xyz_info, args):
    fname = args.f[0]
    nlines = xyz_info.natoms + 2
    nframe = xyzBlock(fname, nlines)

    na, nb, nc = args.nbox
    if nframe >= 0:
        for i in range(nframe+1):
            if not xyz_info.restart:
                a = Xyz("output%05d.xyz"%i)
                b = a.parser()
                b.pbc = xyz_info.pbc
                b.step = i
                toPdb(b, "output%05d.pdb"%i)
            # replicate the box using external code (genconf in Gromacs)
            subprocess.Popen(["genconf", "-f", "output%05d.pdb"%i, 
                              "-o", "s_%05d.pdb"%i, "-nbox",
                                "%d"%na, "%d"%nb, "%d"%nc],
                             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    subprocess.Popen(["cat s_*.pdb > movie_%d_%d_%d.pdb"%(na, nb, nc)],
                     shell=True)
    # clear up
    o = open("clear.sh", "w")
    o.write("rm output*.xyz\n")
    o.write("rm output*.pdb\n")
    o.write("rm s_*.pdb\n")
    o.close()
    st = os.stat('clear.sh')
    os.chmod('clear.sh', st.st_mode | stat.S_IEXEC)
Ejemplo n.º 5
0
def main():
    print "Reading the xyz file ..."
    shutil.copy("movie.xyz", "conf")
    if not os.path.exists("conf"):
        os.mkdir("conf")
    os.chdir("conf")
    n = 192
    xyzBlock("movie.xyz", n, )
    os.remove("movie.xyz")
    os.chdir("..")

    rlist = []
    f = open("rxn.log", "r")
    for i in f:
        if i.strip().startswith("#"):
            pass
        else:
            tokens = i.strip().split()
            if len(tokens) > 1:
                rxn = tokens[0]
                rlist.append(rxn)
    f.close()
    for i in rlist:
        find_rxn(i)
Ejemplo n.º 6
0
""" read the geo file and output to data (LAMMPS), geo and xyz file.
"""
from mytype import System, Molecule, Atom
from xyz import Xyz
from output_conf import toDump
from block import xyzBlock

nframe = xyzBlock("movie.xyz", 194)

if nframe > 1:
    for i in range(nframe):
        a = Xyz("output%05d.xyz"%i)
        b = a.parser()
        b.pbc = [10.739, 11.747, 13.083, 90.00, 95.77, 90.00] 
        b.step = i
        toDump(b, "output%05d.dump"%i)
    o = open("total.dump", "w")
    for i in range(nframe):
        f = open("output%05d.dump"%i, "r")
        for j in f:
            o.write(j)
        f.close()
    o.close()
        
"""
testfile = "out.pdb"
a = Pdb(testfile)
b = a.parser()
toDump(b)
"""