コード例 #1
0
def Get_atom_list(filename,crd_file=""):
    '''
    Read in a structure file like pdb,gro. return a Simple_atom class dict.
    rewrite from Get_Simple_atom_list, use dict but not list. for the bug
    which may happen when the atom serial in pdb file not start from 1.
    '''
    atom_list=list()
    if filename.endswith(".pdb"):
        atom_list=PDB.Get_Atom_list(filename)
    elif filename.endswith(".gro"):
        atom_list=GRO.Get_Atom_list(filename)
    elif filename.endswith(".top"):
        if crd_file == "":
            atom_list=amber_top.Read_top(filename)
        else:
            atom_list=amber_top.Read_crd(filename,crd_file)
    else:
        print "file name %s in invalid." %filename
        return []

    simple_list=dict()
    for atom in atom_list:
        simple=unit_atom.unit_atom(atom_name=atom.atom_name,\
                atom_serial=atom.atom_serial,\
                residue_name=atom.residue_name,\
                residue_serial=atom.residue_serial,\
                atom_coor_x=atom.atom_coor_x,\
                atom_coor_y=atom.atom_coor_y,\
                atom_coor_z=atom.atom_coor_z)
        simple_list[simple.atom_serial]=simple

    return simple_list
コード例 #2
0
def Get_atom_list(filename, crd_file=""):
    '''
    Read in a structure file like pdb,gro. return a Simple_atom class dict.
    rewrite from Get_Simple_atom_list, use dict but not list. for the bug
    which may happen when the atom serial in pdb file not start from 1.
    '''
    atom_list = list()
    if filename.endswith(".pdb"):
        atom_list = PDB.Get_Atom_list(filename)
    elif filename.endswith(".gro"):
        atom_list = GRO.Get_Atom_list(filename)
    elif filename.endswith(".top"):
        if crd_file == "":
            atom_list = amber_top.Read_top(filename)
        else:
            atom_list = amber_top.Read_crd(filename, crd_file)
    else:
        print "file name %s in invalid." % filename
        return []

    simple_list = dict()
    for atom in atom_list:
        simple=unit_atom.unit_atom(atom_name=atom.atom_name,\
                atom_serial=atom.atom_serial,\
                residue_name=atom.residue_name,\
                residue_serial=atom.residue_serial,\
                atom_coor_x=atom.atom_coor_x,\
                atom_coor_y=atom.atom_coor_y,\
                atom_coor_z=atom.atom_coor_z)
        simple_list[simple.atom_serial] = simple

    return simple_list
コード例 #3
0
def Get_Simple_atom_list(filename,crd_file=""):
    '''
    Read in a structure file like pdb,gro. return a Simple_atom class list.
    '''
    atom_list=[]
    if filename.endswith(".pdb"):
        atom_list=PDB.Get_Atom_list(filename)
    elif filename.endswith(".gro"):
        atom_list=GRO.Get_Atom_list(filename)
    elif filename.endswith(".top"):
        if crd_file == "":
            atom_list=amber_top.Read_top(filename)
        else:
            atom_list=amber_top.Read_crd(filename,crd_file)
    else:
        print "file name %s in invalid." %filename
        return []

    simple_list=[]
    for atom in atom_list:
        simple=unit_atom.unit_atom(atom_name=atom.atom_name,\
                atom_serial=atom.atom_serial,\
                residue_name=atom.residue_name,\
                residue_serial=atom.residue_serial,\
                atom_coor_x=atom.atom_coor_x,\
                atom_coor_y=atom.atom_coor_y,\
                atom_coor_z=atom.atom_coor_z)
        simple_list.append(simple)

    return simple_list
コード例 #4
0
def Get_Simple_atom_list(filename, crd_file=""):
    '''
    Read in a structure file like pdb,gro. return a Simple_atom class list.
    '''
    atom_list = []
    if filename.endswith(".pdb"):
        atom_list = PDB.Get_Atom_list(filename)
    elif filename.endswith(".gro"):
        atom_list = GRO.Get_Atom_list(filename)
    elif filename.endswith(".top"):
        if crd_file == "":
            atom_list = amber_top.Read_top(filename)
        else:
            atom_list = amber_top.Read_crd(filename, crd_file)
    else:
        print "file name %s in invalid." % filename
        return []

    simple_list = []
    for atom in atom_list:
        simple=unit_atom.unit_atom(atom_name=atom.atom_name,\
                atom_serial=atom.atom_serial,\
                residue_name=atom.residue_name,\
                residue_serial=atom.residue_serial,\
                atom_coor_x=atom.atom_coor_x,\
                atom_coor_y=atom.atom_coor_y,\
                atom_coor_z=atom.atom_coor_z)
        simple_list.append(simple)

    return simple_list