Author: bugman
Date: Wed Oct 22 16:35:49 2014
New Revision: 26364
URL: http://svn.gna.org/viewcvs/relax?rev=26364&view=rev
Log:
Merged revisions 26354-26355,26358-26362 via svnmerge from
svn+ssh://[email protected]/svn/relax/trunk
........
r26354 | bugman | 2014-10-22 15:38:23 +0200 (Wed, 22 Oct 2014) | 6 lines
Changed the spin_selection argument default in the interatom.define user
function backend.
This now defaults to False to allow other parts of relax which call this
function to operate as
previously. The default for the interatom.define user function is however
still True.
........
r26355 | bugman | 2014-10-22 15:39:47 +0200 (Wed, 22 Oct 2014) | 6 lines
Modified the Structure.test_load_spins_multi_mol system test for the spin.pos
variable changes.
The atomic position for an ensemble of structures is now set to None rather
than being missing, so
the system test has been updated to check for this.
........
r26358 | bugman | 2014-10-22 15:55:46 +0200 (Wed, 22 Oct 2014) | 6 lines
The align_tensor.display user function now has more consistent section
formatting.
The section() and subsection() functions of the lib.text.sectioning module
are now being used to
standardise these custom printouts with the rest of relax.
........
r26359 | bugman | 2014-10-22 16:22:26 +0200 (Wed, 22 Oct 2014) | 8 lines
Modifications to the new N_state_model.test_CaM_IQ_tensor_fit system test.
The system test now checks all of the optimised values to make sure the
correct values have been
found. That will block any future regressions in this N-state model code
path. The system test is
now also faster. And the pcs.structural_noise user function RMSD value has
been set to 0.0 so that
the test no longer has a random component affecting the final optimised
values.
........
r26360 | bugman | 2014-10-22 16:31:04 +0200 (Wed, 22 Oct 2014) | 6 lines
Added printouts for the rdc.calc_q_factors and pcs_calc_q_factors user
functions.
These are activated by the new verbosity user function argument which
defaults to 1. If the value
is greater than 0, then the backend will print out all the calculated Q
factors.
........
r26361 | bugman | 2014-10-22 16:31:56 +0200 (Wed, 22 Oct 2014) | 3 lines
Small change which should have been part of the last commit (r26360).
........
r26362 | bugman | 2014-10-22 16:34:16 +0200 (Wed, 22 Oct 2014) | 5 lines
The verbosity argument of the RDC and PCS q_factors() functions now defaults
to 1.
This causes the Q factors to be printed out at the end of all N-state model
optimisations.
........
Modified:
branches/space_mapping_refactor/ (props changed)
branches/space_mapping_refactor/pipe_control/align_tensor.py
branches/space_mapping_refactor/pipe_control/interatomic.py
branches/space_mapping_refactor/pipe_control/pcs.py
branches/space_mapping_refactor/pipe_control/rdc.py
branches/space_mapping_refactor/test_suite/system_tests/n_state_model.py
branches/space_mapping_refactor/test_suite/system_tests/scripts/n_state_model/CaM_IQ_tensor_fit.py
branches/space_mapping_refactor/test_suite/system_tests/structure.py
branches/space_mapping_refactor/user_functions/pcs.py
branches/space_mapping_refactor/user_functions/rdc.py
Propchange: branches/space_mapping_refactor/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Oct 22 16:35:49 2014
@@ -1 +1 @@
-/trunk:1-26353
+/trunk:1-26362
Modified: branches/space_mapping_refactor/pipe_control/align_tensor.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/pipe_control/align_tensor.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/pipe_control/align_tensor.py
(original)
+++ branches/space_mapping_refactor/pipe_control/align_tensor.py Wed Oct
22 16:35:49 2014
@@ -36,6 +36,7 @@
from lib.errors import RelaxError, RelaxNoTensorError, RelaxTensorError,
RelaxUnknownParamCombError, RelaxUnknownParamError
from lib.geometry.angles import wrap_angles
from lib.io import write_data
+from lib.text.sectioning import section, subsection
from lib.warnings import RelaxWarning
import pipe_control
from pipe_control import pipes
@@ -223,15 +224,13 @@
data = get_tensor_object(tensor)
# Header.
- head = "# Tensor: %s #" % tensor
- print("\n\n\n" + '#' * len(head) + "\n" + head + "\n" + '#' *
len(head))
+ section(file=sys.stdout, text="Tensor '%s'" % tensor, prespace=3,
postspace=1)
# The Saupe matrix.
###################
- title = "# Saupe order matrix."
- print("\n\n" + title + '\n' + '#'*len(title) + '\n')
+ subsection(file=sys.stdout, text="Saupe order matrix", prespace=0)
# The parameter set {Sxx, Syy, Sxy, Sxz, Syz}.
print("# 5D, rank-1 notation {Sxx, Syy, Sxy, Sxz, Syz}:")
@@ -249,8 +248,7 @@
# The alignment tensor.
#######################
- title = "# Alignment tensor."
- print("\n\n" + title + '\n' + '#'*len(title) + '\n')
+ subsection(file=sys.stdout, text="Alignment tensor", prespace=2)
# The parameter set {Axx, Ayy, Axy, Axz, Ayz}.
print("# 5D, rank-1 notation {Axx, Ayy, Axy, Axz, Ayz}:")
@@ -268,8 +266,7 @@
# The probability tensor.
#########################
- title = "# Probability tensor."
- print("\n\n" + title + '\n' + '#'*len(title) + '\n')
+ subsection(file=sys.stdout, text="Probability tensor", prespace=2)
# The parameter set {Pxx, Pyy, Pxy, Pxz, Pyz}.
print("# 5D, rank-1 notation {Pxx, Pyy, Pxy, Pxz, Pyz}:")
@@ -287,8 +284,7 @@
# The magnetic susceptibility tensor.
#####################################
- title = "# Magnetic susceptibility tensor."
- print("\n\n" + title + '\n' + '#'*len(title) + '\n')
+ subsection(file=sys.stdout, text="Magnetic susceptibility tensor",
prespace=2)
chi_tensor = True
# The field strength.
@@ -339,8 +335,7 @@
# The Eigensystem.
##################
- title = "# Eigensystem."
- print("\n\n" + title + '\n' + '#'*len(title) + '\n')
+ subsection(file=sys.stdout, text="Eigensystem", prespace=2)
# Eigenvalues.
print("# Saupe order matrix eigenvalues {Sxx, Syy, Szz}.")
@@ -374,8 +369,7 @@
# Geometric description.
########################
- title = "# Geometric description."
- print("\n\n" + title + '\n' + '#'*len(title) + '\n')
+ subsection(file=sys.stdout, text="Geometric description", prespace=2)
# The GDO.
print("# Generalized degree of order (GDO).")
@@ -402,9 +396,6 @@
# Chi tensor rhombicity.
print("# Magnetic susceptibility rhombicity parameter (chi_rh =
chi_xx - chi_yy, where chi_ii are the eigenvalues).")
print("chi_rh = %-25.12e\n" % (chi_diag[0, 0] - chi_diag[1, 1]))
-
- # Some white space.
- print("\n\n\n")
def fix(id=None, fixed=True):
Modified: branches/space_mapping_refactor/pipe_control/interatomic.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/pipe_control/interatomic.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/pipe_control/interatomic.py (original)
+++ branches/space_mapping_refactor/pipe_control/interatomic.py Wed Oct 22
16:35:49 2014
@@ -195,7 +195,7 @@
return dp.interatomic.add_item(spin_id1=spin_id1, spin_id2=spin_id2)
-def define(spin_id1=None, spin_id2=None, pipe=None, direct_bond=False,
spin_selection=True, verbose=True):
+def define(spin_id1=None, spin_id2=None, pipe=None, direct_bond=False,
spin_selection=False, verbose=True):
"""Set up the magnetic dipole-dipole interaction.
@keyword spin_id1: The spin identifier string of the first spin
of the pair.
Modified: branches/space_mapping_refactor/pipe_control/pcs.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/pipe_control/pcs.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/pipe_control/pcs.py (original)
+++ branches/space_mapping_refactor/pipe_control/pcs.py Wed Oct 22 16:35:49 2014
@@ -545,12 +545,18 @@
return True
-def q_factors(spin_id=None):
+def q_factors(spin_id=None, verbosity=1):
"""Calculate the Q factors for the PCS data.
@keyword spin_id: The spin ID string used to restrict the Q factor
calculation to a subset of all spins.
@type spin_id: None or str
- """
+ @keyword verbosity: A flag specifying the amount of information to print.
The higher the value, the greater the verbosity.
+ @type verbosity: int
+ """
+
+ # Initial printout.
+ if verbosity:
+ print("\nPCS Q factors:")
# Check the pipe setup.
check_pipe_setup(sequence=True)
@@ -612,6 +618,10 @@
if not pcs_bc_data:
warn(RelaxWarning("No back-calculated PCS data can be found for
the alignment ID '%s', skipping the PCS Q factor calculation for this
alignment." % align_id))
continue
+
+ # ID and PCS Q factor printout.
+ if verbosity:
+ print(" Alignment ID '%s': %.3f" % (align_id,
cdp.q_factors_pcs[align_id]))
# The total Q factor.
cdp.q_pcs = 0.0
Modified: branches/space_mapping_refactor/pipe_control/rdc.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/pipe_control/rdc.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/pipe_control/rdc.py (original)
+++ branches/space_mapping_refactor/pipe_control/rdc.py Wed Oct 22 16:35:49 2014
@@ -596,12 +596,18 @@
return True
-def q_factors(spin_id=None):
+def q_factors(spin_id=None, verbosity=1):
"""Calculate the Q factors for the RDC data.
@keyword spin_id: The spin ID string used to restrict the Q factor
calculation to a subset of all spins.
@type spin_id: None or str
- """
+ @keyword verbosity: A flag specifying the amount of information to print.
The higher the value, the greater the verbosity.
+ @type verbosity: int
+ """
+
+ # Initial printout.
+ if verbosity:
+ print("\nRDC Q factors (norm1, norm2):")
# Check the pipe setup.
check_pipe_setup(sequence=True)
@@ -713,6 +719,10 @@
# The second Q factor definition.
cdp.q_factors_rdc_norm2[align_id] = sqrt(sse / D2_sum)
+
+ # ID and RDC Q factor printout.
+ if verbosity:
+ print(" Alignment ID '%s': %.3f, %.3f" % (align_id,
cdp.q_factors_rdc[align_id], cdp.q_factors_rdc_norm2[align_id]))
# The total Q factor.
cdp.q_rdc = 0.0
Modified:
branches/space_mapping_refactor/test_suite/system_tests/n_state_model.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/test_suite/system_tests/n_state_model.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/test_suite/system_tests/n_state_model.py
(original)
+++ branches/space_mapping_refactor/test_suite/system_tests/n_state_model.py
Wed Oct 22 16:35:49 2014
@@ -166,6 +166,36 @@
# Execute the script.
self.script_exec(status.install_path +
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'CaM_IQ_tensor_fit.py')
+ self.interpreter.state.save('x', force=True)
+
+ # Check the optimised alignment tensor.
+ ids = ['dy', 'tb', 'tm', 'er', 'yb', 'ho']
+ A = [
+ [ -5.961228899750e-04, 4.522953035367e-06,
6.168887153854e-04, 7.863257718395e-04, -2.695142351742e-04],
+ [ -1.383036217378e-04, -4.939409871651e-04,
4.130289107370e-04, 7.687580236309e-04, -3.692016717764e-04],
+ [ -9.960927192978e-05, 4.477678617640e-04,
-4.062486453226e-04, -4.332178003608e-04, 3.806525171855e-04],
+ [ -1.703610649220e-05, 2.102104571469e-04,
-2.836097445400e-04, -2.989888174606e-04, 1.326155627753e-04],
+ [ 6.087542827320e-05, 1.644473726436e-05,
-1.804561551839e-04, -1.544765971220e-04, 1.354612889609e-04],
+ [ -1.902819219985e-04, -1.267359074456e-04,
2.303672688393e-04, 3.019676781386e-04, -2.255708108877e-04]
+ ]
+ for i in range(len(A)):
+ print("Checking tensor '%s'." % ids[i])
+ self.assertAlmostEqual(cdp.align_tensors[i].Axx * 1e4, A[i][0] *
1e4)
+ self.assertAlmostEqual(cdp.align_tensors[i].Ayy * 1e4, A[i][1] *
1e4)
+ self.assertAlmostEqual(cdp.align_tensors[i].Axy * 1e4, A[i][2] *
1e4)
+ self.assertAlmostEqual(cdp.align_tensors[i].Axz * 1e4, A[i][3] *
1e4)
+ self.assertAlmostEqual(cdp.align_tensors[i].Ayz * 1e4, A[i][4] *
1e4)
+
+ # Check the optimised paramagnetic position.
+ centre = [ 6.328315298868965, 8.951353997015001,
12.311128147383837]
+ self.assertAlmostEqual(cdp.paramagnetic_centre[0], centre[0])
+ self.assertAlmostEqual(cdp.paramagnetic_centre[1], centre[1])
+ self.assertAlmostEqual(cdp.paramagnetic_centre[2], centre[2])
+
+ # Check the minimisation stats.
+ self.assertAlmostEqual(cdp.chi2, 496.36267335850528)
+ self.assertAlmostEqual(cdp.q_rdc, 0.142825408910208)
+ self.assertAlmostEqual(cdp.q_pcs, 0.07265356890310298)
def test_absolute_rdc(self):
Modified:
branches/space_mapping_refactor/test_suite/system_tests/scripts/n_state_model/CaM_IQ_tensor_fit.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/test_suite/system_tests/scripts/n_state_model/CaM_IQ_tensor_fit.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
---
branches/space_mapping_refactor/test_suite/system_tests/scripts/n_state_model/CaM_IQ_tensor_fit.py
(original)
+++
branches/space_mapping_refactor/test_suite/system_tests/scripts/n_state_model/CaM_IQ_tensor_fit.py
Wed Oct 22 16:35:49 2014
@@ -83,7 +83,7 @@
# PCS structural noise.
print("\n\n# Tensor optimisation with PCS structural noise.\n\n")
-self._execute_uf(uf_name='pcs.structural_noise', rmsd=0.3, sim_num=100,
file='devnull', force=True)
+self._execute_uf(uf_name='pcs.structural_noise', rmsd=0.0, sim_num=10,
file='devnull', force=True)
# Optimisation of everything.
self._execute_uf(uf_name='paramag.centre', fix=False)
@@ -93,7 +93,7 @@
self._execute_uf(uf_name='monte_carlo.setup', number=3)
self._execute_uf(uf_name='monte_carlo.create_data')
self._execute_uf(uf_name='monte_carlo.initial_values')
-self._execute_uf(uf_name='minimise.execute', min_algor='bfgs',
constraints=False, max_iter=5)
+self._execute_uf(uf_name='minimise.execute', min_algor='bfgs',
constraints=False, max_iter=2, func_tol=1e-1)
self._execute_uf(uf_name='monte_carlo.error_analysis')
# Show the tensors.
Modified: branches/space_mapping_refactor/test_suite/system_tests/structure.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/test_suite/system_tests/structure.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/test_suite/system_tests/structure.py
(original)
+++ branches/space_mapping_refactor/test_suite/system_tests/structure.py
Wed Oct 22 16:35:49 2014
@@ -2953,10 +2953,11 @@
# Check the @C1 spin data.
self.assertEqual(cdp.mol[0].res[0].spin[0].name, 'C1')
self.assertEqual(cdp.mol[0].res[0].spin[0].num, None)
- self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 1)
+ self.assertEqual(len(cdp.mol[0].res[0].spin[0].pos), 2)
self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][0], 6.250)
self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][1], 0.948)
self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0][2], 1.968)
+ self.assertEqual(cdp.mol[0].res[0].spin[0].pos[1], None)
# Check the @C2 spin data.
self.assertEqual(cdp.mol[0].res[0].spin[1].name, 'C2')
@@ -2972,10 +2973,11 @@
# Check the @C3 spin data.
self.assertEqual(cdp.mol[0].res[0].spin[2].name, 'C3')
self.assertEqual(cdp.mol[0].res[0].spin[2].num, None)
- self.assertEqual(len(cdp.mol[0].res[0].spin[2].pos), 1)
- self.assertEqual(cdp.mol[0].res[0].spin[2].pos[0][0], 8.062)
- self.assertEqual(cdp.mol[0].res[0].spin[2].pos[0][1], 0.431)
- self.assertEqual(cdp.mol[0].res[0].spin[2].pos[0][2], 3.048)
+ self.assertEqual(len(cdp.mol[0].res[0].spin[2].pos), 2)
+ self.assertEqual(cdp.mol[0].res[0].spin[0].pos[0], None)
+ self.assertEqual(cdp.mol[0].res[0].spin[2].pos[1][0], 8.062)
+ self.assertEqual(cdp.mol[0].res[0].spin[2].pos[1][1], 0.431)
+ self.assertEqual(cdp.mol[0].res[0].spin[2].pos[1][2], 3.048)
def test_load_internal_results(self):
Modified: branches/space_mapping_refactor/user_functions/pcs.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/user_functions/pcs.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/user_functions/pcs.py (original)
+++ branches/space_mapping_refactor/user_functions/pcs.py Wed Oct 22
16:35:49 2014
@@ -83,6 +83,13 @@
desc = "The spin ID string for restricting to subset of all selected
spins.",
can_be_none = True
)
+uf.add_keyarg(
+ name = "verbosity",
+ default = 1,
+ py_type = "int",
+ desc_short = "verbosity level",
+ desc = "The amount of information to print out. Set to zero to silence
the user function, or one to see all messages."
+)
# Description.
uf.desc.append(Desc_container())
uf.desc[-1].add_paragraph("For this to work, the back-calculated PCS data must
first be generated by the analysis specific code. Otherwise a warning will be
given.")
Modified: branches/space_mapping_refactor/user_functions/rdc.py
URL:
http://svn.gna.org/viewcvs/relax/branches/space_mapping_refactor/user_functions/rdc.py?rev=26364&r1=26363&r2=26364&view=diff
==============================================================================
--- branches/space_mapping_refactor/user_functions/rdc.py (original)
+++ branches/space_mapping_refactor/user_functions/rdc.py Wed Oct 22
16:35:49 2014
@@ -83,6 +83,13 @@
desc = "The spin ID string for restricting to subset of all selected
spins.",
can_be_none = True
)
+uf.add_keyarg(
+ name = "verbosity",
+ default = 1,
+ py_type = "int",
+ desc_short = "verbosity level",
+ desc = "The amount of information to print out. Set to zero to silence
the user function, or one to see all messages."
+)
# Description.
uf.desc.append(Desc_container())
uf.desc[-1].add_paragraph("For this to work, the back-calculated RDC data must
first be generated by the analysis specific code. Otherwise a warning will be
given.")
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits