[PyMOL] Placing pseudo atom on COM and saving it as pdb

2016-10-12 Thread Subha K
Hi There, I am looking to automate the calculation of centre of mass and placing a pseudo atom on the COM and save it as a pdb file . Going through the forum [ https://sourceforge.net/p/pymol/mailman/message/34458943/] , I found some useful scripts for this, but, I am having trouble getting it

Re: [PyMOL] Placing pseudo atom on COM and saving it as pdb

2016-10-12 Thread Tsjerk Wassenaar
Hi Subha, Probably this will get close: for pdb in open('./out').readlines(): pdb = pdb.strip() cmd.load(pdb,'tmp') cmd.pseudoatom('tmp',name='pseudo') cmd.save(pdb[:-4]+'-pseudo.pdb','pseudo') cmd.delete('tmp') cmd.delete('pseudo') ... Just a bit too much for a oneliner

Re: [PyMOL] Placing pseudo atom on COM and saving it as pdb

2016-10-12 Thread Subha K
Thanks David and Tsjerk for the kind reply and suggestion. I Figured a solution by combining both of your suggestions 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

Re: [PyMOL] Placing pseudo atom on COM and saving it as pdb

2016-10-12 Thread Tsjerk Wassenaar
Hi Subha, Sorry, my bad. It should've been object='pseudo' and not name='pseudo'. Should've tested it first. Cheers, Tsjerk On Wed, Oct 12, 2016 at 9:56 PM, Subha K wrote: > Thanks David and Tsjerk for the kind reply and suggestion. > > I Figured a solution by combining

Re: [PyMOL] Placing pseudo atom on COM and saving it as pdb

2016-10-12 Thread Subha K
Oh yes, I am not familiar with the pymol options yet. So, couldn't figure that out. Thanks anyways for the quick help. Cheers, Subha On Wed, Oct 12, 2016 at 2:02 PM, Tsjerk Wassenaar wrote: > Hi Subha, > > Sorry, my bad. It should've been object='pseudo' and not

Re: [PyMOL] Placing pseudo atom on COM and saving it as pdb

2016-10-12 Thread David Hall
Every time you loop through the list of files, you set X=1 ; you do your X=X+1 in a loop that will only run once ( because glob.glob(“lig.pdb”) is only going to return a list of length 1 that has lig.pdb) , so you set X=1 , then X=2, then back to X=1 before you process the next entry. That is