예제 #1
0
def protein_assign_charges_and_radii(obj_name, _self=cmd):
    cmd = _self

    from chempy.champ import assign

    # apply a few kludges

    # convent Seleno-methionine to methionine

    cmd.alter(obj_name + "///MSE/SE", "elem='S';name='SD'", quiet=1)
    cmd.alter(obj_name + "///MSE/", "resn='MET'", quiet=1)
    cmd.flag("ignore", obj_name, "clear")

    # remove alternate conformers

    cmd.remove(obj_name + " and not alt ''+A")
    cmd.alter(obj_name, "alt=''")
    cmd.sort(obj_name)
    cmd.fix_chemistry(obj_name, obj_name, 1)

    # make sure all atoms are included...
    cmd.alter(obj_name, "q=1.0", quiet=1)

    print(" Util: Fixing termini and assigning formal charges...")

    assign.missing_c_termini(obj_name, quiet=1, _self=_self)

    while not assign.formal_charges(obj_name, quiet=1, _self=_self):
        print(
            " WARNING: unrecognized or incomplete residues are being deleted:")
        cmd.iterate(
            "(byres (" + obj_name + " and flag 23)) and flag 31",
            'print("  "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+"/")',
            quiet=1)
        cmd.remove(
            "byres (" + obj_name +
            " and flag 23)")  # get rid of residues that weren't assigned
        assign.missing_c_termini(obj_name, quiet=1, _self=_self)

    print(" Util: Assigning Amber 99 charges and radii...")

    cmd.h_add(obj_name)
    if not assign.amber99(obj_name, quiet=1, _self=_self):
        print(" WARNING: some unassigned atoms are being deleted:")
        cmd.iterate(
            "byres (" + obj_name + " and flag 23)",
            'print("  "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+"/"+name+"? ["+elem+"]")',
            quiet=1)
        cmd.remove(
            obj_name +
            " and flag 23")  # get rid of any atoms that weren't assigned

    # show the user what the net charges are...

    formal = sum_formal_charges(obj_name, quiet=0, _self=_self)
    partial = sum_partial_charges(obj_name, quiet=0, _self=_self)
    if round(formal) != round(partial):
        print(
            " WARNING: formal and partial charge sums don't match -- there is a problem!"
        )
예제 #2
0
파일: place.py 프로젝트: jchodera/pymol
def test_random():
    '''
    This is a simple test function which drops most coordinates from a
    polypeptide and tries to reposition them with simple_unknowns().

    Works fine to position hydrogens, fails to position other atoms.
    '''
    import random
    from pymol import cmd
    from chempy.champ import assign
    cmd.fab('ACDEFGHIKLMNPQRSTVWY', 'm0')
    assign.amber99()
    for i in xrange(100):
        m = cmd.get_model('m0').convert_to_connected()
        for a in m.atom:
            if random.random() < 0.8:
                del a.coord
        simple_unknowns(m)
        cmd.load_model(m.convert_to_indexed(), 'm' + str(i + 1))
예제 #3
0
파일: util.py 프로젝트: Almad/pymol
def protein_assign_charges_and_radii(obj_name,_self=cmd):
    pymol=_self._pymol
    cmd=_self

    from chempy.champ import assign

    # apply a few kludges
    
    # convent Seleno-methionine to methionine

    cmd.alter(obj_name+"///MSE/SE","elem='S';name='SD'",quiet=1)
    cmd.alter(obj_name+"///MSE/","resn='MET'",quiet=1)
    cmd.flag("ignore",obj_name,"clear")

    # remove alternate conformers

    cmd.remove(obj_name+" and not alt ''+A")
    cmd.alter(obj_name,"alt=''")
    cmd.sort(obj_name)
    cmd.fix_chemistry(obj_name,obj_name,1)
    
    # make sure all atoms are included...
    cmd.alter(obj_name,"q=1.0",quiet=1)
    
    print " Util: Fixing termini and assigning formal charges..."
    
    assign.missing_c_termini(obj_name,quiet=1,_self=_self)

    while not assign.formal_charges(obj_name,quiet=1,_self=_self):
        print " WARNING: unrecognized or incomplete residues are being deleted:"
        cmd.iterate("(byres ("+obj_name+" and flag 23)) and flag 31",
                        'print "  "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+"/"',quiet=1)
        cmd.remove("byres ("+obj_name+" and flag 23)") # get rid of residues that weren't assigned
        assign.missing_c_termini(obj_name,quiet=1,_self=_self)
        
    print " Util: Assigning Amber 99 charges and radii..."
    
    cmd.h_add(obj_name)
    if not assign.amber99(obj_name,quiet=1,_self=_self):
        print " WARNING: some unassigned atoms are being deleted:"
        cmd.iterate("byres ("+obj_name+" and flag 23)",
                        'print "  "+model+"/"+segi+"/"+chain+"/"+resn+"`"+resi+"/"+name+"? ["+elem+"]"',quiet=1)
        cmd.remove(obj_name+" and flag 23") # get rid of any atoms that weren't assigned
        
    # show the user what the net charges are...
        
    formal = sum_formal_charges(obj_name,quiet=0,_self=_self)
    partial = sum_partial_charges(obj_name,quiet=0,_self=_self)
    if round(formal)!=round(partial):
        print " WARNING: formal and partial charge sums don't match -- there is a problem!"