mailr6213 - /1.3/generic_fns/monte_carlo.py


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

Header


Content

Posted by edward on May 21, 2008 - 23:18:
Author: bugman
Date: Wed May 21 23:13:27 2008
New Revision: 6213

URL: http://svn.gna.org/viewcvs/relax?rev=6213&view=rev
Log:
Updated the setup() function to the new design.


Modified:
    1.3/generic_fns/monte_carlo.py

Modified: 1.3/generic_fns/monte_carlo.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/monte_carlo.py?rev=6213&r1=6212&r2=6213&view=diff
==============================================================================
--- 1.3/generic_fns/monte_carlo.py (original)
+++ 1.3/generic_fns/monte_carlo.py Wed May 21 23:13:27 2008
@@ -341,43 +341,31 @@
         set_selected_sim(self.run, instance, select_sim)
 
 
-def setup(run=None, number=None, all_select_sim=None):
+def setup(number=None, all_select_sim=None):
     """Function for setting up Monte Carlo simulations.
 
-    @param run:             The name of the run.
-    @type run:              str
-    @param number:          The number of Monte Carlo simulations to set up.
-    @type number:           int
-    @params all_select_sim: The selection status of the Monte Carlo 
simulations.  The first
-        dimension of this matrix corresponds to the simulation and the 
second corresponds to the
-        instance.
-    @type all_select_sim:   numpy matrix (int)
+    @keyword number:            The number of Monte Carlo simulations to set 
up.
+    @type number:               int
+    @keyword all_select_sim:    The selection status of the Monte Carlo 
simulations.  The first
+                                dimension of this matrix corresponds to the 
simulation and the
+                                second corresponds to the instance.
+    @type all_select_sim:       numpy matrix (int)
     """
 
-    # Arguments.
-    self.run = run
-
-    # Test if the run exists.
-    if not self.run in relax_data_store.run_names:
-        raise RelaxNoPipeError, self.run
-
-    # Test if Monte Carlo simulations have already been set up for the given 
run.
-    if hasattr(relax_data_store, 'sim_number') and 
relax_data_store.sim_number.has_key(self.run):
-        raise RelaxError, "Monte Carlo simulations for the run " + 
`self.run` + " have already been set up."
-
-    # Create the data structure 'sim_number' if it doesn't exist.
-    if not hasattr(relax_data_store, 'sim_number'):
-        relax_data_store.sim_number = {}
-
-    # Add the simulation number.
-    relax_data_store.sim_number[self.run] = number
-
-    # Create the data structure 'sim_state'.
-    if not hasattr(relax_data_store, 'sim_state'):
-        relax_data_store.sim_state = {}
-
-    # Turn simulations on.
-    relax_data_store.sim_state[self.run] = 1
+    # Test if the current data pipe exists.
+    if not relax_data_store.current_pipe:
+        raise RelaxNoPipeError
+
+    # Alias the current data pipe.
+    cdp = relax_data_store[relax_data_store.current_pipe]
+
+    # Test if Monte Carlo simulations have already been set up.
+    if hasattr(cdp, 'sim_number'):
+        raise RelaxError, "Monte Carlo simulations have already been set up."
+
+    # Create a number of MC sim data structures.
+    cdp.sim_number = number
+    cdp.sim_state = 1
 
     # Select all simulations.
-    self.select_all_sims(number=number, all_select_sim=all_select_sim)
+    select_all_sims(number=number, all_select_sim=all_select_sim)




Related Messages


Powered by MHonArc, Updated Wed May 21 23:20:12 2008