Author: bugman Date: Fri Nov 16 20:08:22 2012 New Revision: 18004 URL: http://svn.gna.org/viewcvs/relax?rev=18004&view=rev Log: Added a script to perform a full frame order analysis on the synthetic CaM test data. Added: branches/frame_order_testing/test_suite/shared_data/frame_order/cam/full_analysis.py Added: branches/frame_order_testing/test_suite/shared_data/frame_order/cam/full_analysis.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/shared_data/frame_order/cam/full_analysis.py?rev=18004&view=auto ============================================================================== --- branches/frame_order_testing/test_suite/shared_data/frame_order/cam/full_analysis.py (added) +++ branches/frame_order_testing/test_suite/shared_data/frame_order/cam/full_analysis.py Fri Nov 16 20:08:22 2012 @@ -1,0 +1,149 @@ +############################################################################### +# # +# Copyright (C) 2004-2012 Edward d'Auvergne # +# # +# This file is part of the program relax (http://www.nmr-relax.com). # +# # +# This program 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 3 of the License, or # +# (at your option) any later version. # +# # +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. # +# # +############################################################################### + +"""Script for black-box Frame Order analysis. + +This script should be run from the directory where it is found with the commands: + +$ ../../../../../relax full_analysis.py + +$ mpirun -n 3 ../../../../../relax --multi mpi4py full_analysis.py +""" + +# Python module imports. +from numpy import array +from time import asctime, localtime + +# relax module imports. +from auto_analyses.frame_order import Frame_order_analysis + + +# Analysis variables. +##################### + +# The grid search size (the number of increments per dimension). +GRID_INC = 11 + +# The more precise grid search size for the initial rigid model (the number of increments per dimension). +GRID_INC_RIGID = 31 + +# The number of Sobol' integration points to use in the grid searches. +NUM_INT_PTS_GRID = 50 + +# The list of the number of Sobol' integration points to use iteratively in the optimisations after the grid search (for the PCS data subset). +NUM_INT_PTS_SUBSET = [100] + +# The list of the number of Sobol' integration points to use iteratively in the optimisations after the grid search (for all PCS and RDC data). +NUM_INT_PTS_FULL = [100, 1000] +#NUM_INT_PTS_FULL = [100, 1000, 200000] + +# The optimisation technique. +MIN_ALGOR = 'simplex' + +# The number of Monte Carlo simulations to be used for error analysis at the end of the protocol. +MC_NUM = 3 + + +# Set up the base data pipes. +############################# + +# The data pipe bundle to group all data pipes. +PIPE_BUNDLE = "Frame Order (%s)" % asctime(localtime()) + +# Create the base data pipe containing only a subset of the PCS data. +SUBSET = "Data subset - " + PIPE_BUNDLE +pipe.create(pipe_name=SUBSET, pipe_type='frame order', bundle=PIPE_BUNDLE) + +# Read the structures. +structure.read_pdb('1J7O_1st_NH.pdb', dir='..', set_mol_name='N-dom') +structure.read_pdb('1J7P_1st_NH_rot.pdb', dir='..', set_mol_name='C-dom') + +# Set up the 15N and 1H spins. +structure.load_spins(spin_id='@N', ave_pos=False) +structure.load_spins(spin_id='@H', ave_pos=False) +spin.isotope(isotope='15N', spin_id='@N') +spin.isotope(isotope='1H', spin_id='@H') + +# Define the magnetic dipole-dipole relaxation interaction. +dipole_pair.define(spin_id1='@N', spin_id2='@H', direct_bond=True) +dipole_pair.set_dist(spin_id1='@N', spin_id2='@H', ave_dist=1.041 * 1e-10) +dipole_pair.unit_vectors() + +# Loop over the alignments. +ln = ['dy', 'tb', 'tm', 'er'] +for i in range(len(ln)): + # Load the RDCs. + rdc.read(align_id=ln[i], file='rdc_%s.txt'%ln[i], spin_id1_col=1, spin_id2_col=2, data_col=3, error_col=4) + + # The PCS (only a subset of ~5 spins for fast initial optimisations). + pcs.read(align_id=ln[i], file='pcs_%s_subset.txt'%ln[i], mol_name_col=1, res_num_col=2, spin_name_col=5, data_col=6, error_col=7) + + # The temperature and field strength. + temperature(id=ln[i], temp=303) + frq.set(id=ln[i], frq=900e6) + +# Load the N-domain tensors (the full tensors). +script('../tensors.py') + +# Define the domains. +domain(id='N', spin_id=":1-78") +domain(id='C', spin_id=":80-148") + +# The tensor domains and reductions. +full = ['Dy N-dom', 'Tb N-dom', 'Tm N-dom', 'Er N-dom'] +red = ['Dy C-dom', 'Tb C-dom', 'Tm C-dom', 'Er C-dom'] +ids = ['dy', 'tb', 'tm', 'er'] +for i in range(len(full)): + # Initialise the reduced tensor. + align_tensor.init(tensor=red[i], align_id=ids[i], params=(0, 0, 0, 0, 0)) + + # Set the domain info. + align_tensor.set_domain(tensor=full[i], domain='N') + align_tensor.set_domain(tensor=red[i], domain='C') + + # Specify which tensor is reduced. + align_tensor.reduction(full_tensor=full[i], red_tensor=red[i]) + +# Set the reference domain. +frame_order.ref_domain('N') + +# Set the initial pivot point. +pivot = array([ 37.254, 0.5, 16.7465]) +frame_order.pivot(pivot, fix=True) + +# Set the paramagnetic centre position. +paramag.centre(pos=[35.934, 12.194, -4.206]) + +# Duplicate the PCS data subset data pipe to create a data pipe containing all the PCS data. +DATA = "Data - " + PIPE_BUNDLE +pipe.copy(pipe_from=SUBSET, pipe_to=DATA, bundle_to=PIPE_BUNDLE) + +# Load the complete PCS data into the already filled data pipe. +for i in range(len(ln)): + pcs.read(align_id=ln[i], file='pcs_%s.txt'%ln[i], mol_name_col=1, res_num_col=2, spin_name_col=5, data_col=6, error_col=7) + + + +# Execution. +############ + +# Do not change! +Frame_order_analysis(data_pipe_full=DATA, data_pipe_subset=SUBSET, pipe_bundle=PIPE_BUNDLE, grid_inc=GRID_INC, grid_inc_rigid=GRID_INC_RIGID, min_algor=MIN_ALGOR, num_int_pts_grid=NUM_INT_PTS_GRID, num_int_pts_subset=NUM_INT_PTS_SUBSET, num_int_pts_full=NUM_INT_PTS_FULL, mc_sim_num=MC_NUM)