Author: bugman Date: Mon Oct 24 00:29:08 2011 New Revision: 14890 URL: http://svn.gna.org/viewcvs/relax?rev=14890&view=rev Log: Updated the alignment tensor fitting script. Modified: 1.3/test_suite/shared_data/frame_order/rigid/tensor_fit.py Modified: 1.3/test_suite/shared_data/frame_order/rigid/tensor_fit.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/shared_data/frame_order/rigid/tensor_fit.py?rev=14890&r1=14889&r2=14890&view=diff ============================================================================== --- 1.3/test_suite/shared_data/frame_order/rigid/tensor_fit.py (original) +++ 1.3/test_suite/shared_data/frame_order/rigid/tensor_fit.py Mon Oct 24 00:29:08 2011 @@ -1,37 +1,52 @@ # Script for calculating the RDC alignment tensors for the test model. +from string import upper -# Create a new data pipe. -pipe.create('fit', 'N-state') -# Load the rotated C-domain. -structure.read_pdb('1J7P_1st_NH_rot.pdb', dir='..') - -# Load the spins. -structure.load_spins('@N') -structure.load_spins('@H') - -# Load the NH vectors. -structure.vectors(spin_id='@N', attached='H', ave=False) - -# Set the values needed to calculate the dipolar constant. -value.set(1.041 * 1e-10, 'bond_length', spin_id="@N") -value.set('15N', 'heteronucleus', spin_id="@N") -value.set('1H', 'proton', spin_id="@N") +# The tensor file for reading into relax. +out = open('tensors.py', 'w') # Loop over the alignments. -for tag in ['Ln1', 'Ln2', 'Ln3', 'Ln4']: +ln = ['dy', 'tb', 'tm', 'er'] +for i in range(len(ln)): + # Create a new data pipe. + pipe.create(ln[i], 'N-state') + + # Load the rotated C-domain. + structure.read_pdb('1J7P_1st_NH_rot.pdb', dir='..') + + # Load the spins. + structure.load_spins('@N') + structure.load_spins('@H') + + # Load the NH vectors. + structure.vectors(spin_id='@N', attached='H', ave=False) + + # Set the values needed to calculate the dipolar constant. + value.set(1.041 * 1e-10, 'bond_length', spin_id="@N") + value.set('15N', 'heteronucleus', spin_id="@N") + value.set('1H', 'proton', spin_id="@N") + # Load the RDCs. - rdc.read(align_id=tag, file='rdc_%s.txt'%tag, spin_id_col=1, data_col=2, error_col=None) + rdc.read(align_id=ln[i], file='rdc_%s.txt'%ln[i], res_num_col=2, spin_name_col=5, data_col=6, error_col=7) # Set up the model. n_state_model.select_model(model='fixed') # Minimisation. - grid_search(inc=11) - minimise('bfgs', constraints=True) + grid_search(inc=7) + minimise('newton', constraints=True) - # Fix the tensor. - align_tensor.fix(tag) + # Monte Carlo simulations. + monte_carlo.setup(number=1000) + monte_carlo.create_data() + monte_carlo.initial_values() + minimise('newton', constraints=False) + monte_carlo.error_analysis() + # Alias the tensor. + A = cdp.align_tensors[i] + # Write out the tensors. + out.write("align_tensor.init(tensor='%s%s %s-dom', params=(%s, %s, %s, %s, %s), param_types=2)\n" % (upper(ln[i][0]), ln[i][1], 'C', A.Axx, A.Ayy, A.Axy, A.Axz, A.Ayz)) + out.write("align_tensor.init(tensor='%s%s %s-dom', params=(%s, %s, %s, %s, %s), param_types=2, errors=True)\n" % (upper(ln[i][0]), ln[i][1], 'C', A.Axx_err, A.Ayy_err, A.Axy_err, A.Axz_err, A.Ayz_err))