"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/chempy/hetatm.py" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

hetatm.py  (pymol-open-source-2.2.0):hetatm.py  (pymol-open-source-2.3.0)
skipping to change at line 19 skipping to change at line 19
#I* Additional authors of this source file include: #I* Additional authors of this source file include:
#-* #-*
#-* #-*
#-* #-*
#Z* ------------------------------------------------------------------- #Z* -------------------------------------------------------------------
# #
# #
# #
import chempy.models
from chempy.neighbor import Neighbor from chempy.neighbor import Neighbor
from chempy.models import Connected from chempy.models import Connected
from chempy import Bond from chempy import Bond
from chempy import place from chempy import place
MAX_BOND_LEN = 2.2 MAX_BOND_LEN = 2.2
PEPT_CUTOFF = 1.7 PEPT_CUTOFF = 1.7
#------------------------------------------------------------------------------- -- #------------------------------------------------------------------------------- --
def generate(model, topology= None, forcefield = None ): def generate(model, topology= None, forcefield = None ):
add_bonds(model,topology=topology,forcefield=forcefield) add_bonds(model,topology=topology,forcefield=forcefield)
connected = model.convert_to_connected() connected = model.convert_to_connected()
add_hydrogens(connected,topology=topology,forcefield=forcefield) add_hydrogens(connected,topology=topology,forcefield=forcefield)
place.simple_unknowns(connected) place.simple_unknowns(connected)
return connected.convert_to_indexed() return connected.convert_to_indexed()
#------------------------------------------------------------------------------- -- #------------------------------------------------------------------------------- --
def assign_types(model, topology = None, forcefield = None ): def assign_types(model, topology = None, forcefield = None ):
if str(model.__class__) != 'chempy.models.Indexed': if not isinstance(model, chempy.models.Indexed):
raise ValueError('model is not an "Indexed" model object') raise ValueError('model is not an "Indexed" model object')
nAtom = model.nAtom nAtom = model.nAtom
if nAtom: if nAtom:
tmpl = topology.normal tmpl = topology.normal
ffld = forcefield.normal ffld = forcefield.normal
res_list = model.get_residues() res_list = model.get_residues()
if len(res_list): if len(res_list):
for a in res_list: for a in res_list:
base = model.atom[a[0]] base = model.atom[a[0]]
resn = base.resn resn = base.resn
skipping to change at line 70 skipping to change at line 71
if forcefield: if forcefield:
k = (resn,at.name) k = (resn,at.name)
if k in ffld: if k in ffld:
at.text_type = ffld[k]['type'] at.text_type = ffld[k]['type']
at.partial_charge = ffld[k]['charge'] at.partial_charge = ffld[k]['charge']
else: else:
raise RuntimeError("no parameters for '"+str(k)+ "'") raise RuntimeError("no parameters for '"+str(k)+ "'")
#------------------------------------------------------------------------------- -- #------------------------------------------------------------------------------- --
def add_bonds(model, topology = None, forcefield = None ): def add_bonds(model, topology = None, forcefield = None ):
if str(model.__class__) != 'chempy.models.Indexed': if not isinstance(model, chempy.models.Indexed):
raise ValueError('model is not an "Indexed" model object') raise ValueError('model is not an "Indexed" model object')
nAtom = model.nAtom nAtom = model.nAtom
if nAtom: if nAtom:
tmpl = topology.normal tmpl = topology.normal
ffld = forcefield.normal ffld = forcefield.normal
res_list = model.get_residues() res_list = model.get_residues()
if len(res_list): if len(res_list):
for a in res_list: for a in res_list:
base = model.atom[a[0]] base = model.atom[a[0]]
resn = base.resn resn = base.resn
skipping to change at line 111 skipping to change at line 112
mbond = model.bond mbond = model.bond
for b in list(bonds.keys()): for b in list(bonds.keys()):
if b[0] in dict and b[1] in dict: if b[0] in dict and b[1] in dict:
bnd = Bond() bnd = Bond()
bnd.index = [ dict[b[0]], dict[b[1]] ] bnd.index = [ dict[b[0]], dict[b[1]] ]
bnd.order = bonds[b]['order'] bnd.order = bonds[b]['order']
mbond.append(bnd) mbond.append(bnd)
#------------------------------------------------------------------------------- -- #------------------------------------------------------------------------------- --
def add_hydrogens(model,topology=None,forcefield=None): def add_hydrogens(model,topology=None,forcefield=None):
if str(model.__class__) != 'chempy.models.Connected': if not isinstance(model, chempy.models.Connected):
raise ValueError('model is not a "Connected" model object') raise ValueError('model is not a "Connected" model object')
nAtom = model.nAtom nAtom = model.nAtom
if nAtom: if nAtom:
if not model.index: if not model.index:
model.update_index() model.update_index()
ffld = forcefield.normal ffld = forcefield.normal
tmpl = topology.normal tmpl = topology.normal
res_list = model.get_residues() res_list = model.get_residues()
if len(res_list): if len(res_list):
for a in res_list: for a in res_list:
 End of changes. 4 change blocks. 
3 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)