Hello,
I have a pdb trajectory of 50 frames (in separated pdb files). I want to generate only the solvent accessible surface around amino acid 31 within a radius of 15 A. I want to use the same set of atoms when generating each surface with respect to the first frame of the trajectory. I'm using the python script here below but it doesn't work, I get a segmentation error in the else block. It works if I use "*rc(session, 'surface zone #1.1 nearAtoms :{} distance {}'.format(resid, radius))*" in the else block but in that way I don't use exactly the same atoms each time. Any suggestions?
Thanks in advance.
Here the code :
###########################################################
*from chimerax.core.commands import run as rcdef get_surfaces(resid, radius): from chimerax.core.commands import run as rc from chimerax.atomic import selected_atoms with open('list_pdbs.txt', 'r') as list_pdbs: flag = 0 for pdb_file in list_pdbs: if flag == 0: list_atoms = [] rc(session, 'open ' + pdb_file.strip()) rc(session, 'sel :{} @<{}'.format(resid, radius)) cur_sel = selected_atoms(session).unique_structures[0].atoms.serial_numbers for a in cur_sel: list_atoms.append('@@serial_number='+str(a)) sel_atoms = ' | '.join(list_atoms) rc(session, 'surface #1 enclose #1') rc(session, 'surface zone #1.1 nearAtoms :{} distance {}'.format(resid, radius)) rc(session, '~ribbon') rc(session, '~disp') rc(session, "save {}_resid_{}_radius_{}.stl format stl".format(pdb_file.strip()[:-4], resid, radius)) rc(session, 'surface close') rc(session, '~sel') rc(session, "close all") flag = 1 else: rc(session, 'open ' + pdb_file.strip()) rc(session, 'sel {}'.format(sel_atoms)) rc(session, 'surface {} enclose #1'.format(sel_atoms)) rc(session, '~ribbon') rc(session, '~disp') rc(session, "save {}_resid_{}_radius_{}.stl format stl".format(pdb_file.strip()[:-4], resid, radius)) rc(session, '~sel') rc(session, 'surface close') rc(session, "close all") resid = 31radius = 15get_surfaces(resid, radius)rc(session, "quit")* #############################################################