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

Source Code for Module lib.structure.conversion

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