mailr21441 - /trunk/pipe_control/rdc.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on November 14, 2013 - 11:56:
Author: bugman
Date: Thu Nov 14 11:56:30 2013
New Revision: 21441

URL: http://svn.gna.org/viewcvs/relax?rev=21441&view=rev
Log:
Created the pipe_control.rdc.setup_pseudoatom_rdcs() function.

This is used to make sure that the pseudo-atom interatomic systems (the 
containers from heternucleus
to pseudo-atom and heteronucleus to pseudo-atom members) are properly set up. 
 It will deselect the
interatomic containers if incorrectly set up or if they are not part of the 
main pair.


Modified:
    trunk/pipe_control/rdc.py

Modified: trunk/pipe_control/rdc.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/rdc.py?rev=21441&r1=21440&r2=21441&view=diff
==============================================================================
--- trunk/pipe_control/rdc.py (original)
+++ trunk/pipe_control/rdc.py Thu Nov 14 11:56:30 2013
@@ -935,6 +935,9 @@
 
     # The unit vectors, RDC constants, and J couplings.
     for interatom in interatomic_loop():
+        # Sort out pseudo-atoms first.  This only needs to be called once.
+        setup_pseudoatom_rdcs(interatom)
+
         # Get the spins.
         spin1 = return_spin(interatom.spin_id1)
         spin2 = return_spin(interatom.spin_id2)
@@ -1160,6 +1163,53 @@
             interatom.rdc_err[id] = sd
 
 
+def setup_pseudoatom_rdcs(interatom):
+    """Make sure that the interatom system is properly set up for 
pseudo-atoms and RDCs.
+
+    Interatomic data containers between the non-pseudo-atom and the 
pseudo-atom members will be deselected.
+
+
+    @param interatom:   The interatomic data container.
+    @type interatom:    InteratomContainer instance
+    """
+
+    # Get the spins.
+    spin1 = return_spin(interatom.spin_id1)
+    spin2 = return_spin(interatom.spin_id2)
+
+    # Checks.
+    flag1 = is_pseudoatom(spin1)
+    flag2 = is_pseudoatom(spin2)
+
+    # No pseudo-atoms, so do nothing.
+    if not flag1 and not flag2:
+        return
+
+    # Both are pseudo-atoms.
+    if flag1 and flag2:
+        warn(RelaxWarning("Support for both spins being in a dipole pair 
being pseudo-atoms is not implemented yet, deselecting the interatomic data 
container for the spin pair '%s' and '%s'." % (interatom.spin_id1, 
interatom.spin_id2)))
+        interatom.select = False
+
+    # Alias the pseudo and normal atoms.
+    pseudospin = spin1
+    base_spin_id = interatom.spin_id2
+    pseudospin_id = interatom.spin_id1
+    if flag2:
+        pseudospin = spin2
+        base_spin_id = interatom.spin_id1
+        pseudospin_id = interatom.spin_id2
+
+    # Loop over the atoms of the pseudo-atom.
+    for spin, spin_id in pseudoatom_loop(pseudospin, return_id=True):
+        # Get the corresponding interatomic data container.
+        pseudo_interatom = return_interatom(spin_id1=spin_id, 
spin_id2=base_spin_id)
+
+        # Deselect if needed.
+        if pseudo_interatom.select:
+            warn(RelaxWarning("Deselecting the interatomic data container 
for the spin pair '%s' and '%s' is it is part of the pseudo-atom system of 
the spin pair '%s' and '%s'." % (pseudo_interatom.spin_id1, 
pseudo_interatom.spin_id2, base_spin_id, pseudospin_id)))
+            pseudo_interatom.select = False
+
+
 def weight(align_id=None, spin_id=None, weight=1.0):
     """Set optimisation weights on the RDC data.
 




Related Messages


Powered by MHonArc, Updated Thu Nov 14 13:20:01 2013