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