Package lib :: Package structure :: Module conversion
[hide private]
[frames] | no frames]

Source Code for Module lib.structure.conversion

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2003-2010,2012-2014 Edward d'Auvergne                         # 
 4  # Copyright (C) 2008 Sebastien Morin                                          # 
 5  #                                                                             # 
 6  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 7  #                                                                             # 
 8  # This program is free software: you can redistribute it and/or modify        # 
 9  # it under the terms of the GNU General Public License as published by        # 
10  # the Free Software Foundation, either version 3 of the License, or           # 
11  # (at your option) any later version.                                         # 
12  #                                                                             # 
13  # This program is distributed in the hope that it will be useful,             # 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
16  # GNU General Public License for more details.                                # 
17  #                                                                             # 
18  # You should have received a copy of the GNU General Public License           # 
19  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
20  #                                                                             # 
21  ############################################################################### 
22   
23   
24 -def get_proton_name(atom_num):
25 """Return a valid PDB atom name of <4 characters. 26 27 @param atom_num: The number of the atom. 28 @type atom_num: int 29 @return: The atom name to use in the PDB. 30 @rtype: str 31 """ 32 33 # Init the proton first letters and the atom number folding limits. 34 names = ['H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q'] 35 lims = [0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000] 36 37 # Loop over the proton names. 38 for i in range(len(names)): 39 # In the bounds. 40 if atom_num >= lims[i] and atom_num < lims[i+1]: 41 return names[i] + repr(atom_num - lims[i])
42