Author: bugman Date: Wed Mar 10 18:31:25 2010 New Revision: 10969 URL: http://svn.gna.org/viewcvs/relax?rev=10969&view=rev Log: Updated the generate_ri.py sample script to work with the current relax code base. This code was old and broken. A copyright notice has been added. Modified: 1.3/sample_scripts/generate_ri.py Modified: 1.3/sample_scripts/generate_ri.py URL: http://svn.gna.org/viewcvs/relax/1.3/sample_scripts/generate_ri.py?rev=10969&r1=10968&r2=10969&view=diff ============================================================================== --- 1.3/sample_scripts/generate_ri.py (original) +++ 1.3/sample_scripts/generate_ri.py Wed Mar 10 18:31:25 2010 @@ -1,7 +1,29 @@ -# Script for generating synthetic relaxation data. +############################################################################### +# # +# Copyright (C) 2004-2010 Edward d'Auvergne # +# # +# This file is part of the program relax. # +# # +# relax is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# relax is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +"""Script for back-calculating the relaxation data.""" # relax module imports. -from generic.selection import spin_loop +from generic_fns.mol_res_spin import spin_loop def back_calc(): @@ -22,6 +44,10 @@ for spin in spin_loop(): # Loop over the relaxation data. for j in xrange(len(spin.relax_data)): + # No data. + if spin.relax_data[j] == None: + continue + # 600 MHz NOE. if spin.ri_labels[j] == 'NOE' and spin.frq_labels[spin.remap_table[j]] == '600': spin.relax_error[j] = 0.04 @@ -46,25 +72,28 @@ relax_data.write(ri_label='R2', frq_label='500', file='r2.500.out', force=True) -# Create the run +# Create the data pipe. pipe.create('test', 'mf') -# Set the nucleus type to nitrogen. +# Load a PDB file. +structure.read_pdb('example.pdb') + +# Load the backbone amide nitrogen spins from the structure. +structure.load_spins(spin_id='@N') + +# Set the spin name and then load the NH vectors. +structure.vectors(spin_id='@N', attached='H*', ave=False) + +# Set the diffusion tensor in the PDB frame (Dxx, Dyy, Dzz, Dxy, Dxz, Dyz). +diffusion_tensor.init((1.340e7, 1.516e7, 1.691e7, 0.000e7, 0.000e7, 0.000e7), param_types=3) + +# Set the required values. +value.set(val=-172e-6, param='CSA') +value.set(val=1.02e-10, param='r') value.set('15N', 'heteronucleus') - -# Set the diffusion tensor to isotropic with tm set to 10 ns. -diffusion_tensor.init(10e-9) - -# Add a residue. -sequence.add(1, 'ALA') - -# Set the CSA and bond lengths. -value.set(value=-172e-6, param='CSA') -value.set(value=1.02e-10, param='r') - -# Set the model-free parameters. -value.set(value=0.8, param='S2') -value.set(value=20e-12, param='te') +value.set('1H', 'proton') +value.set(val=0.8, param='S2') +value.set(val=20e-12, param='te') # Select model-free model m2. model_free.select_model(model='m2')