Hey Osvaldo, I wasn't sure whether it was COG or COM. For a ligand it may matter. For a macromolecule it won't. That's easy to see by considering the COM as the weighted average of the COGs per atom type. Because the distributions will be pretty much the same in all directions, the COGs will be approximately the same and hence the COM will be equal to the COG.
:) Tsjerk On Tue, Sep 15, 2015 at 10:09 PM, Osvaldo Martin <aloctavo...@gmail.com> wrote: > Hi, > > Tsjerk you are right pseudoatom puts a new atom on the geometric center of > a selection. > Just a clarification, the center of mass and the geometric center (AKA > centroid) are not exactly the same thing. The geometric center is the > average of the coordinates and the center of mass is the mass-weighted > average of the coordinates. I understand that for many practical purposes > both can be used interchangeably since they could be numerically similar. > > Cheers, > Osvaldo. > > > > > On Tue, Sep 15, 2015 at 3:36 PM, Tsjerk Wassenaar <tsje...@gmail.com> > wrote: > >> Hi, >> >> AFAIK, pseudoatom puts a new atom on the center of mass (or geometry) of >> the selection. So, >> >> import glob >> from pymol import cmd >> >> for pdb in glob.glob("*.pdb"): cmd.pseudoatom(pdb[-3:],"{} and resn >> LIGANDNAME".format(pdb)) >> >> Or along those lines. Be creative :) >> >> Cheers, >> >> Tsjerk >> >> >> On Tue, Sep 15, 2015 at 12:25 AM, Osvaldo Martin <aloctavo...@gmail.com> >> wrote: >> >>> Hi Zakir, >>> >>> The following script computes the Center Of Mass (or alternative the >>> geometric center) and then draws a pseudoatom >>> <http://www.pymolwiki.org/index.php/Pseudoatom>. I think you could >>> adapt the script to your needs if you find difficulties, don’t hesitate to >>> contact the list again (your question is not silly). >>> >>> >>> import pymol >>> from pymol import cmd >>> pymol.finish_launching() >>> import numpy as np >>> >>> def center(selection, com=True): >>> model = cmd.get_model(selection) >>> xyz = np.array(model.get_coord_list()) >>> mass = [i.get_mass() for i in model.atom] >>> xyz_m = xyz * np.array([mass]).T >>> if com: >>> return tuple(np.sum(xyz_m, 0)/model.get_mass()) >>> else: >>> return tuple(np.average(xyz, 0)) >>> >>> >>> cmd.load('some_file.pdb') >>> COM = center('all') >>> cmd.pseudoatom('center', pos=COM) >>> >>> Alternatively, you can use this script >>> <http://www.pymolwiki.org/index.php/Center_of_mass> to compute the >>> center of mass. >>> >>> Cheers, >>> Osvaldo >>> >>> >>> On Mon, Sep 14, 2015 at 4:29 PM, Zakir Tnimov <zakir.tni...@gmail.com> >>> wrote: >>> >>> Hi there, >>>> >>>> I have no experience in scripting what so ever thus this simple task >>>> drives me nuts. >>>> I was using ZDOCK to dock my protein on the complex. It spits me out >>>> 2000 pdb files that each contain a ligand and receptor. Receptor position >>>> is fixed, ligand is not. What I want to show is just centre of mass of the >>>> ligand and a receptor. I understand that I should be doing something like >>>> this: >>>> >>>> from pymol import cmd >>>> from glob import glob >>>> >>>> for file in glob("*.pdb"): >>>> print file >>>> cmd.load(file,'prot') >>>> for a in cmd.index("CYS/SG"): >>>> identify COM >>>> print its location as a dot or sphere >>>> delete loaded file >>>> go to another one until list is exhousted >>>> >>>> cmd.delete("all”) >>>> >>>> Thank you a lot and sorry for bothering you with such a silly question! >>>> >>>> >>>> zakir.tni...@gmail.com >>>> >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> _______________________________________________ >>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net >>> >> >> >> >> -- >> Tsjerk A. Wassenaar, Ph.D. >> >> > -- Tsjerk A. Wassenaar, Ph.D.
------------------------------------------------------------------------------
_______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net