<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Diego,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>It's impossible to be 100% certain without knowing exactly which line it crashed in, but my strong suspicion is that the long atom spec you generate overran some limit in the atom spec or command parser and resulted in a crash. I will be investigating in more detail later, but working off that assumption I would change your script to directly select the atoms in Python rather than via a command. I'm going to assume the atoms in your PDB files are always in the same order, and that the structure is the only model open. If so, change these lines in the 'if' block:</div><div class=""><br class=""></div><div class=""><i class=""> cur_sel = selected_atoms(session).unique_structures[0].atoms.serial_numbers<br class=""> for a in cur_sel:<br class=""> list_atoms.append('@@serial_number='+str(a))<br class=""> sel_atoms = ' | '.join(list_atoms)</i></div><div class=""><i class=""><br class=""></i></div><div class=""><span style="font-style: normal;" class="">to:</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class=""><i class=""> selected = session.models[0].atoms.selecteds<br class=""><br class=""></i></div><div class=""><span style="font-style: normal;" class="">and these lines in the 'else' block:</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class=""><i class=""> rc(session, 'sel {}'.format(sel_atoms))<br class=""></i></div><div class=""><i class=""> rc(session, 'surface {} enclose #1'.format(sel_atoms))<br class=""></i></div><div class=""><span style="font-style: normal;" class="">to:</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class=""><i class=""> session.models[0].atoms.selecteds = selected</i></div><div class=""><i class=""> rc(session, 'surface sel enclose #1')<br class=""></i></div><div class=""><div class="">--Eric</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>UCSF Computer Graphics Lab</div></div><div class=""><i class=""><br class=""></i></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Jun 29, 2021, at 10:00 AM, Diego Amaya via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">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 "<i class="">rc(session, 'surface zone #1.1 nearAtoms :{} distance {}'.format(resid, radius))</i>" in the else block but in that way I don't use exactly the same atoms each time. Any suggestions? <br class=""></div><div class=""><br class=""></div><div class="">Thanks in advance.<br class=""></div><div class=""><br class=""></div><div class="">Here the code :</div><div class=""><br class=""></div><div class="">###########################################################<br class=""></div><div class=""><i class="">from chimerax.core.commands import run as rc<br class=""><br class="">def get_surfaces(resid, radius):<br class=""> from chimerax.core.commands import run as rc<br class=""> from chimerax.atomic import selected_atoms<br class=""><br class=""> with open('list_pdbs.txt', 'r') as list_pdbs:<br class=""> flag = 0<br class=""> for pdb_file in list_pdbs:<br class=""> if flag == 0:<br class=""> list_atoms = []<br class=""> rc(session, 'open ' + pdb_file.strip())<br class=""> rc(session, 'sel :{} @<{}'.format(resid, radius))<br class=""> cur_sel = selected_atoms(session).unique_structures[0].atoms.serial_numbers<br class=""> for a in cur_sel:<br class=""> list_atoms.append('@@serial_number='+str(a))<br class=""> sel_atoms = ' | '.join(list_atoms)<br class=""> rc(session, 'surface #1 enclose #1')<br class=""> rc(session, 'surface zone #1.1 nearAtoms :{} distance {}'.format(resid, radius))<br class=""> rc(session, '~ribbon')<br class=""> rc(session, '~disp')<br class=""> rc(session, "save {}_resid_{}_radius_{}.stl format stl".format(pdb_file.strip()[:-4], resid, radius))<br class=""> rc(session, 'surface close')<br class=""> rc(session, '~sel')<br class=""> rc(session, "close all")<br class=""> flag = 1<br class=""> else:<br class=""> rc(session, 'open ' + pdb_file.strip())<br class=""> rc(session, 'sel {}'.format(sel_atoms))<br class=""> rc(session, 'surface {} enclose #1'.format(sel_atoms))<br class=""> rc(session, '~ribbon')<br class=""> rc(session, '~disp')<br class=""> rc(session, "save {}_resid_{}_radius_{}.stl format stl".format(pdb_file.strip()[:-4], resid, radius))<br class=""> rc(session, '~sel')<br class=""> rc(session, 'surface close')<br class=""> rc(session, "close all")<br class=""> <br class="">resid = 31<br class="">radius = 15<br class=""><br class="">get_surfaces(resid, radius)<br class="">rc(session, "quit")</i></div><div class="">#############################################################</div><div class=""><br class=""></div><div class=""><br class="">-- <br class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Diego A. Amaya Ramírez</div></div></div></div>
<br class="">
<b style="color:rgb(34,34,34);font-family:Calibri,sans-serif;font-size:14.6667px;font-style:normal;letter-spacing:normal;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)" class=""><span style="font-size: 6.5pt; line-height: 9.96667px; font-family: "Ancizar Sans", sans-serif;" class="">Aviso legal:</span></b><span style="font-style: normal; font-weight: 400; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; background-color: rgb(255, 255, 255); font-size: 6.5pt; line-height: 9.96667px; font-family: "Ancizar Sans", sans-serif;" class=""> El contenido de este mensaje y los archivos adjuntos son confidenciales y de uso exclusivo de la Universidad Nacional de Colombia. Se encuentran dirigidos sólo para el uso del destinatario al cual van enviados. La reproducción, lectura y/o copia se encuentran prohibidas a cualquier persona diferente a este y puede ser ilegal. Si usted lo ha recibido por error, infórmenos y elimínelo de su correo. Los Datos Personales serán tratados conforme a la Ley 1581 de 2012 y a nuestra Política de Datos Personales que podrá consultar en la página web </span><span style="color:rgb(34,34,34);font-family:Calibri,sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);font-size:6.5pt;line-height:9.96667px" class=""><a href="http://www.unal.edu.co/" style="color:blue" target="_blank" class=""><span style="font-family:"Ancizar Sans",sans-serif" class="">www.unal.edu.co</span></a></span><span style="font-style: normal; font-weight: 400; letter-spacing: normal; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; background-color: rgb(255, 255, 255); font-size: 6.5pt; line-height: 9.96667px; font-family: "Ancizar Sans", sans-serif;" class="">.<u class=""><span class=""> </span></u>Las opiniones, informaciones, conclusiones y cualquier otro tipo de dato contenido en este correo electrónico, no relacionados con la actividad de la Universidad Nacional de Colombia, se entenderá como personales y de ninguna manera son avaladas por la Universidad.</span><br class=""><span style="color:rgb(245,132,111);font-family:ClearSans-Regular,Arial,Verdana,Helvetica,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!important;float:none" class=""><span class=""></span></span><span style="color:rgb(245,132,111);font-family:ClearSans-Regular,Arial,Verdana,Helvetica,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!important;float:none" class=""><span class=""></span></span>_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users<br class=""></div></blockquote></div><br class=""></div></body></html>