Author: bugman Date: Fri Nov 21 09:41:51 2014 New Revision: 26678 URL: http://svn.gna.org/viewcvs/relax?rev=26678&view=rev Log: Created the Frame_order.test_pdb_model_rotor2 system test to check for an offset pivot. The pivot is set to [1, 0, 1] so that the rotor axis is tilted -45 degrees in the xz-plane. And the size of the geometric object is set to 100 Angstrom for better testing of the sizes of the elements. Modified: branches/frame_order_cleanup/test_suite/system_tests/frame_order.py Modified: branches/frame_order_cleanup/test_suite/system_tests/frame_order.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/frame_order.py?rev=26678&r1=26677&r2=26678&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/system_tests/frame_order.py (original) +++ branches/frame_order_cleanup/test_suite/system_tests/frame_order.py Fri Nov 21 09:41:51 2014 @@ -20,7 +20,7 @@ ############################################################################### # Python module imports. -from math import pi +from math import pi, sqrt import platform import numpy from numpy import array, float64, transpose @@ -1686,6 +1686,88 @@ index += 1 + def test_pdb_model_rotor2(self): + """Check the PDB file created by the frame_order.pdb_model user function for the rotor model with an offset pivot.""" + + # Create a data pipe. + self.interpreter.pipe.create(pipe_name='PDB model', pipe_type='frame order') + + # Select the model. + self.interpreter.frame_order.select_model('rotor') + + # The axis alpha parameter, and printout. + axis_alpha = pi / 2.0 + axis = create_rotor_axis_alpha(pi/2, array([1, 0, 1], float64), array([0, 0, 0], float64)) + print("\nRotor axis:\n %s" % axis) + print("Rotor apex (100*axis + [1, 0, 1]):\n %s" % (100.0*axis + [1.0, 0.0, 1.0])) + + # Set the average domain position translation parameters. + self.interpreter.value.set(param='ave_pos_x', val=0.0) + self.interpreter.value.set(param='ave_pos_y', val=0.0) + self.interpreter.value.set(param='ave_pos_z', val=0.0) + self.interpreter.value.set(param='ave_pos_alpha', val=0.0) + self.interpreter.value.set(param='ave_pos_beta', val=0.0) + self.interpreter.value.set(param='ave_pos_gamma', val=0.0) + self.interpreter.value.set(param='axis_alpha', val=axis_alpha) + self.interpreter.value.set(param='cone_sigma_max', val=0.0) + + # Set the pivot. + self.interpreter.frame_order.pivot(pivot=[1, 0, 1], fix=True) + + # Create the PDB. + self.interpreter.frame_order.pdb_model(dir=ds.tmpdir, inc=1, size=100.0) + + # Create a data pipe for the new structure. + self.interpreter.pipe.create(pipe_name='PDB check', pipe_type='frame order') + self.interpreter.pipe.display() + + # Read the contents of the file. + self.interpreter.structure.read_pdb(file='frame_order.pdb', dir=ds.tmpdir) + + # The data, as it should be with everything along the z-axis, shifted from the origin to the pivot. + l = 100.0 + proj = sqrt(0.5*l**2) + proj2 = sqrt(0.5*(l-2.0)**2) + proj3 = sqrt(0.5*(l+2.0)**2) + data = [ + [ 1, 'PIV', 1, 'Piv', [ 1.0, 0.0, 1.0]], + [ 1, 'RTX', 2, 'CTR', [ 1.0, 0.0, 1.0]], + [ 2, 'RTX', 3, 'PRP', [-proj+1.0, 0.0, proj+1.0]], + [ 3, 'RTX', 4, 'PRP', [ proj+1.0, 0.0, -proj+1.0]], + [ 4, 'RTB', 5, 'BLO', [-proj+1.0, 0.0, proj+1.0]], + [ 5, 'RTB', 187, 'BLO', [-proj2+1.0, 0.0, proj2+1.0]], + [ 6, 'RTB', 369, 'BLO', [-proj+1.0, 0.0, proj+1.0]], + [ 7, 'RTB', 551, 'BLO', [-proj2+1.0, 0.0, proj2+1.0]], + [ 8, 'RTB', 733, 'BLO', [ proj+1.0, 0.0, -proj+1.0]], + [ 9, 'RTB', 915, 'BLO', [ proj2+1.0, 0.0, -proj2+1.0]], + [10, 'RTB', 1097, 'BLO', [ proj+1.0, 0.0, -proj+1.0]], + [11, 'RTB', 1279, 'BLO', [ proj2+1.0, 0.0, -proj2+1.0]], + [12, 'RTL', 1461, 'z-ax', [-proj3+1.0, 0.0, proj3+1.0]], + [12, 'RTL', 1462, 'z-ax', [ proj3+1.0, 0.0, -proj3+1.0]] + ] + + # Check the atomic coordinates. + selection = cdp.structure.selection() + index = 0 + for res_num, res_name, atom_num, atom_name, pos in cdp.structure.atom_loop(selection=selection, res_num_flag=True, res_name_flag=True, atom_num_flag=True, atom_name_flag=True, pos_flag=True): + # Skip the propeller blades. + if atom_name == 'BLD': + continue + + # Checks (to the 3 places accuracy of a PDB file). + print("Checking residue %s %s, atom %s %s, at position %s." % (data[index][0], data[index][1], data[index][2], data[index][3], data[index][4])) + self.assertAlmostEqual(data[index][0], res_num, 3) + self.assertAlmostEqual(data[index][1], res_name, 3) + self.assertAlmostEqual(data[index][2], atom_num, 3) + self.assertAlmostEqual(data[index][3], atom_name, 3) + self.assertAlmostEqual(data[index][4][0], pos[0][0], 3) + self.assertAlmostEqual(data[index][4][1], pos[0][1], 3) + self.assertAlmostEqual(data[index][4][2], pos[0][2], 3) + + # Increment the index. + index += 1 + + def test_pseudo_ellipse_zero_cone_angle(self): """Catch for a bug in optimisation when the cone_theta_x is set to zero in the pseudo-ellipse models."""