mailr5039 - in /branches/N_state_model: ./ generic_fns/structure.py physical_constants.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on February 20, 2008 - 09:55:
Author: bugman
Date: Wed Feb 20 09:55:12 2008
New Revision: 5039

URL: http://svn.gna.org/viewcvs/relax?rev=5039&view=rev
Log:
Merged revisions 5033-5037 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r5033 | bugman | 2008-02-20 09:23:23 +0100 (Wed, 20 Feb 2008) | 5 lines
  
  Fixes for the generic_fns.structure.atom_add() function.
  
  The atomic_data dictionary is now expected to be passed into the function.
........
  r5034 | bugman | 2008-02-20 09:24:01 +0100 (Wed, 20 Feb 2008) | 5 lines
  
  Fixes for the generic_fns.structure.atom_connect() function.
  
  The atomic_data dictionary is now expected to be passed into the function.
........
  r5035 | bugman | 2008-02-20 09:31:00 +0100 (Wed, 20 Feb 2008) | 3 lines
  
  Shifted all the relative atomic mass values into the physical_constants 
module.
........
  r5036 | bugman | 2008-02-20 09:32:44 +0100 (Wed, 20 Feb 2008) | 3 lines
  
  Updated the docstring of the generic_fns.structure.atomic_mass() function 
to epydoc format.
........
  r5037 | bugman | 2008-02-20 09:36:10 +0100 (Wed, 20 Feb 2008) | 6 lines
  
  Updated the generic_fns.structure.autoscale_tensor() function.
  
  The docstring was changed to epydoc format, the default method changed from 
None to 'mass', and a
  few comments were added.
........

Modified:
    branches/N_state_model/   (props changed)
    branches/N_state_model/generic_fns/structure.py
    branches/N_state_model/physical_constants.py

Propchange: branches/N_state_model/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: branches/N_state_model/generic_fns/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/generic_fns/structure.py?rev=5039&r1=5038&r2=5039&view=diff
==============================================================================
--- branches/N_state_model/generic_fns/structure.py (original)
+++ branches/N_state_model/generic_fns/structure.py Wed Feb 20 09:55:12 2008
@@ -34,13 +34,14 @@
 from generic_fns import molmol
 from generic_fns.sequence import load_PDB_sequence
 from generic_fns.selection import exists_mol_res_spin_data, return_molecule, 
return_residue, return_spin, spin_loop
+from physical_constants import ArH, ArC, ArN, ArO, ArS
 from relax_errors import RelaxError, RelaxFileError, RelaxNoPdbChainError, 
RelaxNoPdbError, RelaxNoResError, RelaxNoPipeError, RelaxNoSequenceError, 
RelaxNoTensorError, RelaxNoVectorsError, RelaxPdbError, RelaxPdbLoadError, 
RelaxRegExpError
 from relax_io import get_file_path
 from relax_warnings import RelaxNoAtomWarning, RelaxNoPDBFileWarning, 
RelaxWarning, RelaxZeroVectorWarning
 
 
 
-def atom_add(atom_id=None, record_name='', atom_name='', res_name='', 
chain_id='', res_num=None, pos=[None, None, None], segment_id='', element=''):
+def atom_add(atomic_data=None, atom_id=None, record_name='', atom_name='', 
res_name='', chain_id='', res_num=None, pos=[None, None, None], 
segment_id='', element=''):
     """Function for adding an atom to the atomic_data structure.
 
     The atomic_data data structure is a dictionary of arrays.  The keys 
correspond to the
@@ -62,6 +63,8 @@
     This function will create the key-value pair for the given atom.
 
 
+    @param atomic_data: The dictionary to place the atomic data into.
+    @type atomic_data:  dict
     @param atom_id:     The atom identifier.  This is used as the key within 
the dictionary.
     @type atom_id:      str
     @param record_name: The record name, e.g. 'ATOM', 'HETATM', or 'TER'.
@@ -100,7 +103,7 @@
     atomic_data[atom_id].append(element)
 
 
-def atom_connect(atom_id=None, bonded_id=None):
+def atom_connect(atomic_data=None, atom_id=None, bonded_id=None):
     """Function for connecting two atoms within the atomic_data data 
structure.
 
     The atomic_data data structure is a dictionary of arrays.  The keys 
correspond to the
@@ -123,6 +126,14 @@
     The bonded_id atom number will then be appended to the atom_id array.  
Because the
     connections work both ways in the PDB file, the atom_id atom number will 
be appended to the
     bonded_id atom array as well.
+
+
+    @param atomic_data: The dictionary to place the atomic data into.
+    @type atomic_data:  dict
+    @param atom_id:     The atom identifier.  This is used as the key within 
the dictionary.
+    @type atom_id:      str
+    @param bonded_id:   The second atom identifier.  This is used as the key 
within the dictionary.
+    @type bonded_id:    str
     """
 
     # Find the atom number corresponding to atom_id.
@@ -145,42 +156,55 @@
 
 
 def atomic_mass(element=None):
-    """Return the atomic mass of the given element."""
+    """Return the atomic mass of the given element.
+
+    @param element: The name of the element to return the atomic mass of.
+    @type element:  str
+    @return:        The relative atomic mass.
+    @rtype:         float
+    """
 
     # Proton.
     if element == 'H' or element == 'Q':
-        return 1.00794
+        return ArH
 
     # Carbon.
     elif element == 'C':
-        return 12.0107
+        return ArC
 
     # Nitrogen.
     elif element == 'N':
-        return 14.0067
+        return ArN
 
     # Oxygen.
     elif element == 'O':
-        return 15.9994
+        return ArO
 
     # Sulphur.
     elif element == 'S':
-        return 32.065
+        return ArS
 
     # Unknown.
     else:
         raise RelaxError, "The mass of the element " + `element` + " has not 
yet been programmed into relax."
 
 
-def autoscale_tensor(method=None):
-    """Automatically determine an appropriate scaling factor for display
-    of the diffusion tensor"""
-
+def autoscale_tensor(method='mass'):
+    """Automatically determine an appropriate scaling factor for display of 
the diffusion tensor.
+
+    @param method:  The method used to determine the scaling of the 
diffusion tensor object.
+    @type method:   str
+    @return:        The scaling factor.
+    @rtype:         float
+    """
+
+    # Centre of mass method.
     if method == 'mass':
         com, mass = centre_of_mass(return_mass=True)
         scale = mass * 6.8e-11
         return scale
 
+    # Autoscaling method.
     warn(RelaxWarning("Autoscale method %s not implimented. Reverting to 
scale=1.8e-6 A.s" % method))
     return 1.8e-6
 

Modified: branches/N_state_model/physical_constants.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/physical_constants.py?rev=5039&r1=5038&r2=5039&view=diff
==============================================================================
--- branches/N_state_model/physical_constants.py (original)
+++ branches/N_state_model/physical_constants.py Wed Feb 20 09:55:12 2008
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2007 Edward d'Auvergne                                       
 #
+# Copyright (C) 2007-2008 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -24,6 +24,9 @@
 from math import pi
 
 
+# Misc. constants.
+##################
+
 # Planck's constant.
 h = 6.62606876 * 1e-34
 
@@ -33,12 +36,19 @@
 # The magnetic constant or the permeability of vacuum.
 mu0 = 4.0 * pi * 1e-7
 
+
+# CSA and bond lengths.
+#######################
+
 # The 15N CSA in the NH bond (default value).
 N15_CSA = -172 * 1e-6
 
 # The length of the NH bond (default value).
 NH_BOND_LENGTH = 1.02 * 1e-10
 
+
+# Gyromagnetic ratios.
+######################
 
 # The 13C gyromagnetic ratio.
 g13C = 6.728 * 1e7
@@ -54,3 +64,22 @@
 
 # The 31P gyromagnetic ratio.
 g31P = 10.841 * 1e7
+
+
+# Relative atomic masses.
+#########################
+
+# Proton.
+ArH = 1.00794
+
+# Carbon.
+ArC = 12.0107
+
+# Nitrogen.
+ArN = 14.0067
+
+# Oxygen.
+ArO = 15.9994
+
+# Sulphur.
+ArS = 32.065




Related Messages


Powered by MHonArc, Updated Wed Feb 20 11:20:39 2008