def assign(sele, preserve=0): from molobj import MolObj from typer import Typer, Rules import rules global state global model result = 1 state = State() model = cmd.get_model(sele) # now assign atom types ruleSet = Rules() # ruleSet.fromList(rules.amber_types) ruleSet.fromList(rules.simple_types) mobj = MolObj() mobj.fromChemPyModel(model) typed = Typer(molObj=mobj) print(" realtime: assigning atom types") typed.applyRules(ruleSet) c = 0 for a in typed.getNamedTypes(): at = model.atom[c] if (at.text_type == '??') or (not preserve): if a == '': print(" warning: unable to assign atom type to atom %d" % c) result = 0 else: cmd.alter("((%s) and (index %s))" % (sele, at.index), "text_type ='%s'" % a) if feedback['tinker']: print(" " + str(__name__) + ': %s is a %s' % (at.name, a)) at.text_type = a c = c + 1 sm = 0 for a in model.atom: a.resi = str(a.resi_number) sm = sm + a.partial_charge print(" lig: net charge on ligand is %8.4f\n" % sm) return result
def assign(sele,preserve=0): from molobj import MolObj from typer import Typer,Rules import rules global state global model result = 1 state = State() model = cmd.get_model(sele) # now assign atom types ruleSet = Rules() # ruleSet.fromList(rules.amber_types) ruleSet.fromList(rules.simple_types) mobj = MolObj() mobj.fromChemPyModel(model) typed = Typer(molObj = mobj) print(" realtime: assigning atom types") typed.applyRules(ruleSet) c = 0 for a in typed.getNamedTypes(): at = model.atom[c] if (at.text_type == '??') or (not preserve): if a=='': print(" warning: unable to assign atom type to atom %d"%c) result = 0 else: cmd.alter("((%s) and (index %s))" % (sele,at.index), "text_type ='%s'" % a) if feedback['tinker']: print(" "+str(__name__)+': %s is a %s' % (at.name,a)) at.text_type = a c = c + 1 sm = 0 for a in model.atom: a.resi = str(a.resi_number) sm = sm + a.partial_charge print(" lig: net charge on ligand is %8.4f\n" % sm) return result
def assign(sele,preserve=0): from molobj import MolObj from typer import Typer,Rules import rules result = 1 state = State() model = cmd.get_model(sele) # now assign atom types ruleSet = Rules() ruleSet.fromList(rules.mmff_types) ruleSet.mappingFromList(rules.mmff_mapping) mobj = MolObj() mobj.fromChemPyModel(model) typed = Typer(molObj = mobj) print " realtime: assigning atom types" typed.applyRules(ruleSet) c = 0 for a in typed.getTypes(): at = model.atom[c] if (at.text_type == '??') or (not preserve): if a==-99: print " warning: unable to assign atom type to atom %d"%c result = 0 else: cmd.alter("((%s) and (index %s))" % (sele,at.index), "numeric_type ='%s'" % a) if feedback['tinker']: print " "+str(__name__)+': %s is a %s' % (at.name,a) at.numeric_type = a c = c + 1 sm = 0 for a in model.atom: a.resi = str(a.resi_number) sm = sm + a.partial_charge return result