psi::psirb::Task Class Reference

#include <psirb.h>


Public Member Functions

 Task (std::string prefix="psi", std::string scratch="/tmp/")
 ~Task ()
const std::string & prefix ()
void prefix (std::string new_prefix)
const std::string & scratch ()
void scratch (std::string new_scratch)
psi::PSIOlibpsio ()

Static Public Member Functions

static void create_ruby_class ()
static void rb_free (void *p)
static VALUE rb_alloc (VALUE klass)
static VALUE rb_init (int argc, VALUE *argv, VALUE self)
static VALUE rb_init_copy (VALUE copy, VALUE orig)
static VALUE rb_to_s (VALUE self)
static VALUE rb_prefix_set (VALUE self, VALUE newPrefix)
static VALUE rb_prefix_get (VALUE self)
static VALUE rb_scratch_set (VALUE self, VALUE newsScratch)
static VALUE rb_scratch_get (VALUE self)
static VALUE rb_load_zmat (VALUE self)
static VALUE rb_load_cartesian (VALUE self)
static VALUE rb_print_toc (VALUE, VALUE)
 Ruby function: Psi::Task.print_toc(unit).
static VALUE rb_chkpt_exist (VALUE, VALUE)
 Ruby functions: Psi::Task.exist? and Psi::Task.exists?
static VALUE rb_chkpt_label_get (VALUE)
 Ruby function: Psi::Task.label.
static VALUE rb_chkpt_label_set (VALUE self, VALUE label)
 Ruby function: Psi::Task.label.
static VALUE rb_chkpt_escf_get (VALUE)
 Ruby function: Psi::Task.escf.
static VALUE rb_chkpt_escf_set (VALUE, VALUE)
 Ruby function: Psi::Task.escf=.
static VALUE rb_chkpt_eref_get (VALUE)
 Ruby function: Psi::Task.eref.
static VALUE rb_chkpt_eref_set (VALUE, VALUE)
 Ruby function: Psi::Task.eref=.
static VALUE rb_chkpt_ecorr_get (VALUE)
 Ruby function: Psi::Task.ecorr.
static VALUE rb_chkpt_ecorr_set (VALUE, VALUE)
 Ruby function: Psi::Task.ecorr=.
static VALUE rb_chkpt_enuc_get (VALUE)
 Ruby function: Psi::Task.enuc.
static VALUE rb_chkpt_enuc_set (VALUE, VALUE)
 Ruby function: Psi::Chkpt:enuc=.
static VALUE rb_chkpt_efzc_get (VALUE)
 Ruby function: Psi::Task.efzc.
static VALUE rb_chkpt_efzc_set (VALUE, VALUE)
 Ruby function: Psi::Task.efzc=.
static VALUE rb_chkpt_etot_get (VALUE)
 Ruby function: Psi::Task.etot.
static VALUE rb_chkpt_etot_set (VALUE, VALUE)
 Ruby function: Psi::Task.etot=.
static VALUE rb_chkpt_disp_get (VALUE)
 Ruby function: Psi::Task.disp.
static VALUE rb_chkpt_disp_set (VALUE, VALUE)
 Ruby function: Psi::Task.disp=.
static VALUE rb_chkpt_eccsd_get (VALUE)
 Ruby function: Psi::Task.eccsd.
static VALUE rb_chkpt_e_t_get (VALUE)
 Ruby function: Psi::Task.e_t.
static VALUE rb_chkpt_emp2_get (VALUE)
 Ruby function: Psi::Task.emp2.
static VALUE rb_chkpt_eom_state_energies_get (VALUE)
 Ruby function: Psi::Task.eom_states_energy.
static VALUE rb_chkpt_num_irreps_get (VALUE)
 Ruby function: Psi::Task.num_irreps.
static VALUE rb_chkpt_clsdpi_set (VALUE, VALUE)
 Ruby function: Psi::Task.clsdpi=(array).
static VALUE rb_chkpt_clsdpi_get (VALUE)
 Ruby function: Psi::Task.clsdpi.
static VALUE rb_chkpt_frzcpi_set (VALUE, VALUE)
 Ruby function: Psi::Task.frzcpi=(array).
static VALUE rb_chkpt_frzcpi_get (VALUE)
 Ruby function: Psi::Task.frzcpi.
static VALUE rb_chkpt_frzvpi_set (VALUE, VALUE)
 Ruby function: Psi::Task.frzvpi=(array).
static VALUE rb_chkpt_frzvpi_get (VALUE)
 Ruby function: Psi::Task.frzcpi.
static VALUE rb_chkpt_evals_get (VALUE)
static VALUE rb_chkpt_alpha_evals_get (VALUE)
static VALUE rb_chkpt_beta_evals_get (VALUE)
static VALUE rb_chkpt_evals_set (VALUE, VALUE)
static VALUE rb_chkpt_alpha_evals_set (VALUE, VALUE)
static VALUE rb_chkpt_beta_evals_set (VALUE, VALUE)
static VALUE rb_chkpt_exps_set (VALUE, VALUE)
static VALUE rb_chkpt_exps_get (VALUE)


Detailed Description

A calculation will now be grouped into a Task object. Tasks provide a simple way of having several prefixes in a single input file. There is a global Task object that is used by default.

Definition at line 66 of file psirb.h.


Constructor & Destructor Documentation

psi::psirb::Task::Task ( std::string  prefix = "psi",
std::string  scratch = "/tmp/" 
)

Default constructor; sets prefix to "psi" and scratch to "/tmp/"

Definition at line 18 of file task.cc.

References psi::PSIO::filecfg_kwd().

00019 {
00020         // Set the m_psiPSIO object to the values given:
00021         // By default file32 is kept in the current working directory.
00022         // By default only one volume is used.
00023         // The ability to change individual files will be added.
00024         m_psiPSIO.filecfg_kwd("DEFAULT", "NAME",    -1, prefix.c_str());
00025         m_psiPSIO.filecfg_kwd("DEFAULT", "NVOLUME", -1, "1");
00026         m_psiPSIO.filecfg_kwd("DEFAULT", "VOLUME1", -1, scratch.c_str());
00027         m_psiPSIO.filecfg_kwd("DEFAULT", "VOLUME1", 32, "./");
00028         
00029         // Save the variables for quick access
00030         m_szFilePrefix = prefix;
00031         m_szScratchPath = scratch;
00032 }

psi::psirb::Task::~Task (  ) 

Destructor

Definition at line 34 of file task.cc.

00035 {
00036         // Currently nothing to do.
00037 }


Member Function Documentation

const std::string & psi::psirb::Task::prefix (  ) 

Accessor function get for the prefix

Returns:
current prefix

Definition at line 39 of file task.cc.

Referenced by rb_init(), rb_init_copy(), rb_prefix_get(), rb_prefix_set(), and rb_to_s().

00040 {
00041         return m_szFilePrefix;
00042 }

void psi::psirb::Task::prefix ( std::string  new_prefix  ) 

Accessor function put for the prefix

Parameters:
new_prefix what to change the prefix to

Definition at line 44 of file task.cc.

References psi::PSIO::filecfg_kwd().

00045 {
00046         m_szFilePrefix = new_prefix;
00047         
00048         // Change the setting in m_psiPSIO
00049         m_psiPSIO.filecfg_kwd("DEFAULT", "NAME", -1, new_prefix.c_str());
00050 }

const std::string & psi::psirb::Task::scratch (  ) 

Accessor function get for the scratch location

Returns:
current location

Definition at line 52 of file task.cc.

Referenced by rb_init(), rb_init_copy(), rb_scratch_get(), rb_scratch_set(), and rb_to_s().

00053 {
00054         return m_szScratchPath;
00055 }

void psi::psirb::Task::scratch ( std::string  new_scratch  ) 

Accessor function put for the scratch location

Parameters:
new_scratch what to change the scratch to

Definition at line 57 of file task.cc.

References psi::PSIO::filecfg_kwd().

00058 {
00059         m_szScratchPath = new_scratch;
00060         
00061         // Change the setting in m_psiPSIO;
00062         m_psiPSIO.filecfg_kwd("DEFAULT", "VOLUME1", -1, new_scratch.c_str());
00063 }

psi::PSIO * psi::psirb::Task::libpsio (  ) 

Accessor get function for the libpsio object associated with this Task

Returns:
libpsio object pointer

Definition at line 65 of file task.cc.

00066 {
00067         return &m_psiPSIO;
00068 }

void psi::psirb::Task::create_ruby_class (  )  [static]

Creates the Ruby class framework

Definition at line 74 of file task.cc.

References rb_alloc(), rb_chkpt_clsdpi_get(), rb_chkpt_clsdpi_set(), rb_chkpt_disp_get(), rb_chkpt_disp_set(), rb_chkpt_e_t_get(), rb_chkpt_eccsd_get(), rb_chkpt_ecorr_get(), rb_chkpt_ecorr_set(), rb_chkpt_efzc_get(), rb_chkpt_efzc_set(), rb_chkpt_emp2_get(), rb_chkpt_enuc_get(), rb_chkpt_enuc_set(), rb_chkpt_eom_state_energies_get(), rb_chkpt_eref_get(), rb_chkpt_eref_set(), rb_chkpt_escf_get(), rb_chkpt_escf_set(), rb_chkpt_etot_get(), rb_chkpt_etot_set(), rb_chkpt_exist(), rb_chkpt_frzcpi_get(), rb_chkpt_frzcpi_set(), rb_chkpt_frzvpi_get(), rb_chkpt_frzvpi_set(), rb_chkpt_label_get(), rb_chkpt_label_set(), rb_chkpt_num_irreps_get(), rb_init(), rb_init_copy(), rb_prefix_get(), rb_prefix_set(), rb_print_toc(), rb_scratch_get(), rb_scratch_set(), and rb_to_s().

00075 {
00076         // Create the Task class under the Psi module
00077         Task::m_rbTask = rb_define_class_under(Globals::g_rbPsi, "Task", rb_cObject);
00078         
00079         // Register the allocation functioin with Ruby
00080         rb_define_alloc_func(Task::m_rbTask, Task::rb_alloc);
00081         
00082         
00083         // Register the initialization function with Ruby
00084         //
00085         // The structure of a call to rb_define_method is the following. If # of arguments is -1 then an C-array of
00086         // Ruby objects is sent. Note every single function has a "VALUE self" parameter that is not counted in the
00087         // number listed here.
00088         //
00089         //               Ruby object      Ruby function name    C/++ function to be called                  # of arguments
00090         rb_define_method(Task::m_rbTask, "initialize",          RUBYCAST(Task::rb_init),                        -1);
00091         
00092         // Register the initialization copy function with Ruby
00093         rb_define_method(Task::m_rbTask, "initialize_copy",     RUBYCAST(Task::rb_init_copy),                    1);
00094         
00095         // Register the the to_s function.
00096         rb_define_method(Task::m_rbTask, "to_s",                RUBYCAST(Task::rb_to_s),                         0);
00097         
00098         // Add other functions starting here.
00099         rb_define_method(Task::m_rbTask, "prefix=",             RUBYCAST(Task::rb_prefix_set),                   1);
00100         rb_define_method(Task::m_rbTask, "prefix",              RUBYCAST(Task::rb_prefix_get),                   0);
00101         rb_define_method(Task::m_rbTask, "scratch=",            RUBYCAST(Task::rb_scratch_set),                  1);
00102         rb_define_method(Task::m_rbTask, "scratch",             RUBYCAST(Task::rb_scratch_get),                  0);
00103         rb_define_method(Task::m_rbTask, "load_zmat",           RUBYCAST(Task::rb_load_zmat),                    0);
00104         rb_define_method(Task::m_rbTask, "load_cartesian",      RUBYCAST(Task::rb_load_cartesian),               0);
00105         
00106         // Interface to libpsio++
00107         rb_define_method(Task::m_rbTask, "print_toc",           RUBYCAST(Task::rb_print_toc),                    1);
00108         
00109         // Checkpoint interface
00110         rb_define_method(Task::m_rbTask, "exist?",              RUBYCAST(Task::rb_chkpt_exist),                  1);
00111         rb_define_method(Task::m_rbTask, "exists?",             RUBYCAST(Task::rb_chkpt_exist),                  1);
00112         rb_define_method(Task::m_rbTask, "label",               RUBYCAST(Task::rb_chkpt_label_get),              0);
00113         rb_define_method(Task::m_rbTask, "label=",              RUBYCAST(Task::rb_chkpt_label_set),              1); 
00114         rb_define_method(Task::m_rbTask, "escf",                RUBYCAST(Task::rb_chkpt_escf_get),               0);
00115         rb_define_method(Task::m_rbTask, "escf=",               RUBYCAST(Task::rb_chkpt_escf_set),               1);
00116         rb_define_method(Task::m_rbTask, "eref",                RUBYCAST(Task::rb_chkpt_eref_get),               0);
00117         rb_define_method(Task::m_rbTask, "eref=",               RUBYCAST(Task::rb_chkpt_eref_set),               1);
00118         rb_define_method(Task::m_rbTask, "ecorr",               RUBYCAST(Task::rb_chkpt_ecorr_get),              0);
00119         rb_define_method(Task::m_rbTask, "ecorr=",              RUBYCAST(Task::rb_chkpt_ecorr_set),              1);
00120         rb_define_method(Task::m_rbTask, "enuc",                RUBYCAST(Task::rb_chkpt_enuc_get),               0);
00121         rb_define_method(Task::m_rbTask, "enuc=",               RUBYCAST(Task::rb_chkpt_enuc_set),               1);
00122         rb_define_method(Task::m_rbTask, "efzc",                RUBYCAST(Task::rb_chkpt_efzc_get),               0);
00123         rb_define_method(Task::m_rbTask, "efzc=",               RUBYCAST(Task::rb_chkpt_efzc_set),               1);
00124         rb_define_method(Task::m_rbTask, "etot",                RUBYCAST(Task::rb_chkpt_etot_get),               0);
00125         rb_define_method(Task::m_rbTask, "etot=",               RUBYCAST(Task::rb_chkpt_etot_set),               1);
00126         rb_define_method(Task::m_rbTask, "disp",                RUBYCAST(Task::rb_chkpt_disp_get),               0);
00127         rb_define_method(Task::m_rbTask, "disp=",                   RUBYCAST(Task::rb_chkpt_disp_set),               1);
00128         rb_define_method(Task::m_rbTask, "eccsd",               RUBYCAST(Task::rb_chkpt_eccsd_get),              0);
00129         rb_define_method(Task::m_rbTask, "e_t",                 RUBYCAST(Task::rb_chkpt_e_t_get),                0);
00130         rb_define_method(Task::m_rbTask, "emp2",                RUBYCAST(Task::rb_chkpt_emp2_get),               0);
00131         rb_define_method(Task::m_rbTask, "eom_states_energy",   RUBYCAST(Task::rb_chkpt_eom_state_energies_get), 0);
00132         rb_define_method(Task::m_rbTask, "num_irreps",          RUBYCAST(Task::rb_chkpt_num_irreps_get),         0);
00133         rb_define_method(Task::m_rbTask, "clsdpi=",             RUBYCAST(Task::rb_chkpt_clsdpi_set),             1);
00134         rb_define_method(Task::m_rbTask, "clsdpi",              RUBYCAST(Task::rb_chkpt_clsdpi_get),             0);
00135         rb_define_method(Task::m_rbTask, "frzcpi=",             RUBYCAST(Task::rb_chkpt_frzcpi_set),             1);
00136         rb_define_method(Task::m_rbTask, "frzcpi",              RUBYCAST(Task::rb_chkpt_frzcpi_get),             0);
00137         rb_define_method(Task::m_rbTask, "frzvpi=",             RUBYCAST(Task::rb_chkpt_frzvpi_set),             1);
00138         rb_define_method(Task::m_rbTask, "frzvpi",              RUBYCAST(Task::rb_chkpt_frzvpi_get),             0);
00139         rb_define_method(Task::m_rbTask, "evals",               RUBYCAST(Task::rb_chkpt_evals_get),              0);
00140         rb_define_method(Task::m_rbTask, "evals=",              RUBYCAST(Task::rb_chkpt_evals_set),              1);
00141         rb_define_method(Task::m_rbTask, "alpha_evals",         RUBYCAST(Task::rb_chkpt_alpha_evals_get),        0);
00142         rb_define_method(Task::m_rbTask, "alpha_evals=",        RUBYCAST(Task::rb_chkpt_alpha_evals_set),        1);
00143         rb_define_method(Task::m_rbTask, "beta_evals",          RUBYCAST(Task::rb_chkpt_beta_evals_get),         0);
00144         rb_define_method(Task::m_rbTask, "beta_evals=",         RUBYCAST(Task::rb_chkpt_beta_evals_set),         1);
00145         rb_define_method(Task::m_rbTask, "exps",                RUBYCAST(Task::rb_chkpt_exps_get),               0);
00146         rb_define_method(Task::m_rbTask, "exps=",               RUBYCAST(Task::rb_chkpt_exps_set),               1);
00147         
00148         // A checkpoint function that uses Psi::Matrix
00149 //      rb_define_method(Task::m_rbTask, "fgeom=",              RUBYCAST(Task::rb_chkpt_fgeom_get),              0);
00150 }

void psi::psirb::Task::rb_free ( void *  p  )  [static]

Called by Ruby when it needs to delete a class.

Definition at line 152 of file task.cc.

Referenced by rb_alloc(), and rb_init_copy().

00153 {
00154         Task *pTask = (Task*)p;
00155         if (pTask)
00156                 delete pTask;
00157 }

VALUE psi::psirb::Task::rb_alloc ( VALUE  klass  )  [static]

Called by Ruby during object creation

Definition at line 159 of file task.cc.

References rb_free().

Referenced by create_ruby_class().

00160 {
00161         Task *newTask = new Task;
00162         VALUE newObj;
00163         
00164         // Wrap the newly created Task inside a Ruby object.
00165         newObj = Data_Wrap_Struct(klass, 0, Task::rb_free, newTask);
00166         // Ruby is now responsible for the object, not us.
00167         
00168         // Return the new object.
00169         return newObj;
00170 }

VALUE psi::psirb::Task::rb_init ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Called by Ruby during object creation

Definition at line 172 of file task.cc.

References prefix(), and scratch().

Referenced by create_ruby_class().

00173 {
00174         Task *task;
00175         VALUE rbObject;
00176         
00177         // Get the Task object from Ruby
00178         Data_Get_Struct(self, Task, task);
00179         
00180         // What Ruby does is that if the user uses a Hash for their function
00181         // arguments argv[0] is the Hash. If the user did a simple comma
00182         // separated array then argv[...] are the individual elements.
00183         // This function assumes a Hash. I think hashes for function parameters are
00184         // better as it allows for any parameter ordering.
00185         
00186         if (argc > 1) {
00187                 // Throw an exception in Ruby
00188                 rb_raise(rb_eArgError, "must use a Hash as your function parameters");
00189                 return Qnil;
00190         }
00191         
00192         if (argc == 1) {
00193                 // Work through the Hash
00194                 
00195                 // Did the user give a prefix?
00196                 // Since I expect the user to use :prefix need to convert ID prefix
00197                 // to Symbol :prefix.
00198                 rbObject = rb_hash_aref(argv[0], ID2SYM(rb_intern("prefix")));
00199                 if (rbObject != Qnil) {
00200                         // Get the string and tell Task about it
00201                         // StringValue calls to_str on the object, if needed
00202                         VALUE str = StringValue(rbObject);
00203                         // Set the prefix variable to this
00204                         task->prefix(RSTRING(str)->ptr);
00205                 }
00206                 
00207                 // Did the user give a scratch?
00208                 rbObject = rb_hash_aref(argv[0], ID2SYM(rb_intern("scratch")));
00209                 if (rbObject != Qnil) {
00210                         // Get the string and tell Task about it
00211                         // StringValue calls to_str on the object, if needed
00212                         VALUE str = StringValue(rbObject);
00213                         // Set the prefix variable to this
00214                         task->scratch(RSTRING(str)->ptr);
00215                 }
00216         }
00217         
00218         // If the user did not provide any arguments, that's ok
00219         // Task sets some values by default.
00220         return self;
00221 }

VALUE psi::psirb::Task::rb_init_copy ( VALUE  copy,
VALUE  orig 
) [static]

Called by Ruby during object copy creation

Definition at line 223 of file task.cc.

References prefix(), rb_free(), and scratch().

Referenced by create_ruby_class().

00224 {
00225         Task *o, *c;
00226         
00227         // Do not self copy
00228         if (copy == orig)
00229                 return copy;
00230                 
00231         // We can only copy a Task to a Task. This function is called on the copy
00232         // object by Ruby, so we must make sure orig is a Task. Simple thing to
00233         // do is check if orig is freed by Task::free.
00234         if (TYPE(orig) != T_DATA || RDATA(orig)->dfree != (RUBY_DATA_FUNC)Task::rb_free) {
00235                 rb_raise(rb_eTypeError, "wrong argument type");
00236                 return copy;
00237         }
00238 
00239         // Get the objects and copy
00240         Data_Get_Struct(copy, Task, c);
00241         Data_Get_Struct(orig, Task, o);
00242         
00243         c->prefix(o->prefix());
00244         c->scratch(o->scratch());
00245         
00246         return copy;
00247 }

VALUE psi::psirb::Task::rb_to_s ( VALUE  self  )  [static]

Called by Ruby if the user tries to print a Task object

Definition at line 249 of file task.cc.

References prefix(), and scratch().

Referenced by create_ruby_class().

00250 {
00251         Task *s;
00252         std::string text("Task: prefix = ");
00253         
00254         Data_Get_Struct(self, Task, s);
00255         text += s->prefix() + "; scratch = " + s->scratch();
00256         
00257         return rb_str_new2(text.c_str());
00258 }

VALUE psi::psirb::Task::rb_prefix_set ( VALUE  self,
VALUE  newPrefix 
) [static]

Ruby function: Task.prefix=

Definition at line 260 of file task.cc.

References prefix().

Referenced by create_ruby_class().

00261 {
00262         Task *task;
00263         
00264         Data_Get_Struct(self, Task, task);
00265         
00266         // Get the string and tell Task about it
00267         // StringValue calls to_str on the object, if needed
00268         VALUE str = StringValue(newPrefix);
00269         // Set the prefix variable to this
00270         task->prefix(RSTRING(str)->ptr);
00271 
00272         return self;
00273 }

VALUE psi::psirb::Task::rb_prefix_get ( VALUE  self  )  [static]

Ruby function: Task.prefix

Definition at line 275 of file task.cc.

References prefix().

Referenced by create_ruby_class().

00276 {
00277         Task *task;
00278         
00279         Data_Get_Struct(self, Task, task);
00280         
00281         // Get the string from Task and return it.
00282         return rb_str_new2(task->prefix().c_str());
00283 }

VALUE psi::psirb::Task::rb_scratch_set ( VALUE  self,
VALUE  newsScratch 
) [static]

Ruby function: Task.scratch=

Definition at line 285 of file task.cc.

References scratch().

Referenced by create_ruby_class().

00286 {
00287         Task *task;     
00288         Data_Get_Struct(self, Task, task);
00289         
00290         // Get the string and tell Task about it
00291         // StringValue calls to_str on the object, if needed
00292         VALUE str = StringValue(newScratch);
00293         // Set the prefix variable to this
00294         task->scratch(RSTRING(str)->ptr);
00295 
00296         return self;
00297 }

VALUE psi::psirb::Task::rb_scratch_get ( VALUE  self  )  [static]

Ruby function: Task.scratch

Definition at line 299 of file task.cc.

References scratch().

Referenced by create_ruby_class().

00300 {
00301         Task *task;
00302         
00303         Data_Get_Struct(self, Task, task);
00304         
00305         // Get the string from Task and return it.
00306         return rb_str_new2(task->scratch().c_str());
00307 }

VALUE psi::psirb::Task::rb_print_toc ( VALUE  self,
VALUE  rUnit 
) [static]

Ruby function: Psi::Task.print_toc(unit).

Prints the TOC entries for unit to Globals::g_fOutput

Definition at line 751 of file task.cc.

References psi::PSIO::close(), psi::psirb::Globals::g_fOutput, m_psiPSIO, psi::PSIO::open(), psi::PSIO::open_check(), and psi::PSIO::tocprint().

Referenced by create_ruby_class().

00752 {
00753         Task *task;
00754         Data_Get_Struct(self, Task, task);
00755         unsigned int unit = NUM2UINT(rUnit);
00756         int bAlreadyOpen;
00757         
00758         // Is the file already open?
00759         bAlreadyOpen = task->m_psiPSIO.open_check(unit);
00760         if (bAlreadyOpen == false)
00761                 task->m_psiPSIO.open(unit, PSIO_OPEN_OLD);
00762                 
00763         // Print the toc
00764         task->m_psiPSIO.tocprint(unit, Globals::g_fOutput);
00765         
00766         // If it was already open, do not close it.
00767         if (bAlreadyOpen == false)
00768                 task->m_psiPSIO.close(unit, 1);
00769                 
00770         return self;
00771 }

VALUE psi::psirb::Task::rb_chkpt_exist ( VALUE  self,
VALUE  keyword 
) [static]

Ruby functions: Psi::Task.exist? and Psi::Task.exists?

Ruby interface to chkpt_exist. Checks to see if the requested keyword exists in the checkpoint file.

Parameters:
self Ruby object calling this function.
keyword Keyword to check for.
Returns:
Qtrue (C) / true (Ruby) if it exists, or Qfalse (C) / false (Ruby) if it does not.

Definition at line 316 of file task.cc.

References psi::Chkpt::build_keyword(), psi::Chkpt::exist(), and m_psiPSIO.

Referenced by create_ruby_class().

00317 {
00318         Task *task;     
00319         Data_Get_Struct(self, Task, task);
00320         
00321         // Convert the given keyword to a C-string
00322         VALUE str = StringValue(keyword);
00323         char *p = RSTRING(str)->ptr;
00324         char *keyw = NULL;
00325         
00326         if (p == NULL) {
00327                 rb_raise(rb_eArgError, "wrong argument, expected a string");
00328         }
00329         
00330         // Call the Psi chkpt function
00331         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00332         keyw = chkpt.build_keyword(p);
00333         int result = chkpt.exist(keyw);
00334         free(keyw);
00335         
00336         if (result) return Qtrue;
00337         else        return Qfalse;
00338 }

VALUE psi::psirb::Task::rb_chkpt_label_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.label.

Ruby interface to chkpt_rd_label. Reads the label from checkpoint.

Parameters:
self Ruby object calling this function.
Returns:
Label as a Ruby string.

Definition at line 345 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_label().

Referenced by create_ruby_class().

00346 {
00347         Task *task;     
00348         Data_Get_Struct(self, Task, task);
00349 
00350         // Read in the label from Chkpt
00351         char *label = NULL;
00352         
00353         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00354         label = chkpt.rd_label();
00355         
00356         // Create ruby string
00357         VALUE result = rb_str_new2(label);
00358         
00359         return result;
00360 }

VALUE psi::psirb::Task::rb_chkpt_label_set ( VALUE  self,
VALUE  label 
) [static]

Ruby function: Psi::Task.label.

Ruby interface to chkpt_wt_label. Writes the label to checkpoint.

Parameters:
self Ruby object calling this function.
label New label.

Definition at line 367 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_label().

Referenced by create_ruby_class().

00368 {
00369         Task *task;     
00370         Data_Get_Struct(self, Task, task);
00371         
00372         // Convert the given keyword to a C-string
00373         VALUE str = StringValue(label);
00374         char *p = RSTRING(str)->ptr;    
00375         if (p == NULL) {
00376                 rb_raise(rb_eArgError, "wrong argument, expected a string");
00377         }
00378         
00379         // Call the Psi chkpt function
00380         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00381         chkpt.wt_label(p);
00382         
00383         return self;
00384 }

VALUE psi::psirb::Task::rb_chkpt_escf_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.escf.

Ruby interface to chkpt_rd_escf. Reads SCF energy from checkpoint.

Parameters:
self Ruby object calling this function.
Returns:
SCF energy in a Ruby object.

Definition at line 391 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_escf().

Referenced by create_ruby_class().

00392 {
00393         Task *task;     
00394         Data_Get_Struct(self, Task, task);
00395 
00396         // Read in the scf
00397         double escf;
00398         
00399         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00400         escf = chkpt.rd_escf();
00401         
00402         VALUE result = rb_float_new(escf);
00403         return result;
00404 }

VALUE psi::psirb::Task::rb_chkpt_escf_set ( VALUE  self,
VALUE  vescf 
) [static]

Ruby function: Psi::Task.escf=.

Ruby interface to chkpt_wt_escf. Writes the SCF energy to checkpoint.

Parameters:
self Ruby object calling this function.
vescf New SCF energy.

Definition at line 411 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_escf().

Referenced by create_ruby_class().

00412 {
00413         Task *task;     
00414         Data_Get_Struct(self, Task, task);
00415 
00416         // Read in the scf
00417         double escf = NUM2DBL(vescf);
00418         
00419         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00420         chkpt.wt_escf(escf);
00421         
00422         return self;
00423 }

VALUE psi::psirb::Task::rb_chkpt_eref_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.eref.

Ruby interface to chkpt_rd_eref. Read the reference energy from checkpoint.

Parameters:
self Ruby object calling this function.
Returns:
Reference energy in a Ruby object.

Definition at line 430 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_escf().

Referenced by create_ruby_class().

00431 {
00432         Task *task;     
00433         Data_Get_Struct(self, Task, task);
00434 
00435         // Read in the scf
00436         double escf;
00437         
00438         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00439         escf = chkpt.rd_escf();
00440         
00441         VALUE result = rb_float_new(escf);
00442         return result;
00443 }

VALUE psi::psirb::Task::rb_chkpt_eref_set ( VALUE  self,
VALUE  veref 
) [static]

Ruby function: Psi::Task.eref=.

Ruby interface to chkpt_wt_ref. Writes the reference energy to checkpoint.

Parameters:
self Ruby object calling this function.
veref New reference energy as a Ruby object.

Definition at line 450 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_eref().

Referenced by create_ruby_class().

00451 {
00452         Task *task;     
00453         Data_Get_Struct(self, Task, task);
00454 
00455         // Read in the scf
00456         double eref = NUM2DBL(veref);
00457         
00458         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00459         chkpt.wt_eref(eref);
00460         
00461         return self;
00462 }

VALUE psi::psirb::Task::rb_chkpt_ecorr_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.ecorr.

Ruby interface to chkpt_rd_ecorr. Read the correlation energy from checkpoint.

Parameters:
self Ruby object calling this function.
Returns:
Correlation energy as a Ruby object.

Definition at line 469 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_ecorr().

Referenced by create_ruby_class().

00470 {
00471         Task *task;     
00472         Data_Get_Struct(self, Task, task);
00473 
00474         double ecorr;
00475         
00476         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00477         ecorr = chkpt.rd_ecorr();
00478         
00479         VALUE result = rb_float_new(ecorr);
00480         return result;
00481 }

VALUE psi::psirb::Task::rb_chkpt_ecorr_set ( VALUE  self,
VALUE  vecorr 
) [static]

Ruby function: Psi::Task.ecorr=.

Ruby interface to chkpt_wt_ecorr. Writes the new correlation energy to checkpoint.

Parameters:
self Ruby object calling this function.
vecorr New correlation energy as a Ruby object.

Definition at line 488 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_ecorr().

Referenced by create_ruby_class().

00489 {
00490         Task *task;     
00491         Data_Get_Struct(self, Task, task);
00492 
00493         double ecorr = NUM2DBL(vecorr);
00494         
00495         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00496         chkpt.wt_ecorr(ecorr);
00497         
00498         return self;
00499 }

VALUE psi::psirb::Task::rb_chkpt_enuc_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.enuc.

Ruby interface to chkpt_rd_enuc. Read the nuclear repulsion energy to checkpoint.

Parameters:
self Ruby object calling this function.
Returns:
Nuclear repulsion energy as a Ruby object.

Definition at line 506 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_enuc().

Referenced by create_ruby_class().

00507 {
00508         Task *task;     
00509         Data_Get_Struct(self, Task, task);
00510 
00511         double enuc;
00512         
00513         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00514         enuc = chkpt.rd_enuc();
00515         
00516         VALUE result = rb_float_new(enuc);
00517         return result;
00518 }

VALUE psi::psirb::Task::rb_chkpt_enuc_set ( VALUE  self,
VALUE  venuc 
) [static]

Ruby function: Psi::Chkpt:enuc=.

Ruby interface to chkpt_wt_enuc. Writes the nuclear repulsion energy to checkpoint.

Parameters:
self Ruby object calling this function.
venuc New nuclear repulsion energy as a Ruby object.

Definition at line 525 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_enuc().

Referenced by create_ruby_class().

00526 {
00527         Task *task;     
00528         Data_Get_Struct(self, Task, task);
00529 
00530         double enuc = NUM2DBL(venuc);
00531         
00532         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00533         chkpt.wt_enuc(enuc);
00534         
00535         return self;
00536 }

VALUE psi::psirb::Task::rb_chkpt_efzc_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.efzc.

Ruby interface to chkpt_rd_efzc. Reads the frozen core energy from checkpoint.

Parameters:
self Ruby object that is calling this function.
Returns:
Frozen core energy in a Ruby object.

Definition at line 543 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_efzc().

Referenced by create_ruby_class().

00544 {
00545         Task *task;     
00546         Data_Get_Struct(self, Task, task);
00547         double efzc;
00548         
00549         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00550         efzc = chkpt.rd_efzc();
00551         
00552         VALUE result = rb_float_new(efzc);
00553         return result;
00554 }

VALUE psi::psirb::Task::rb_chkpt_efzc_set ( VALUE  self,
VALUE  vefzc 
) [static]

Ruby function: Psi::Task.efzc=.

Ruby interface to chkpt_wt_efzc. Writes the frozen core energy to checkpoint.

Parameters:
self Ruby object that is calling this function.
vefzc New frozen core energy.

Definition at line 561 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_efzc().

Referenced by create_ruby_class().

00562 {
00563         Task *task;     
00564         Data_Get_Struct(self, Task, task);
00565         double efzc = NUM2DBL(vefzc);
00566         
00567         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00568         chkpt.wt_efzc(efzc);
00569         
00570         return self;
00571 }

VALUE psi::psirb::Task::rb_chkpt_etot_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.etot.

Ruby interface to chkpt_rd_etot. Reads the total energy from checkpoint file.

Parameters:
self Ruby object that is calling this function.
Returns:
Total energy in a Ruby object.

Definition at line 578 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_etot().

Referenced by create_ruby_class().

00579 {
00580         Task *task;     
00581         Data_Get_Struct(self, Task, task);
00582         double etot;
00583         
00584         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00585         etot = chkpt.rd_etot();
00586         
00587         VALUE result = rb_float_new(etot);
00588         return result;
00589 }

VALUE psi::psirb::Task::rb_chkpt_etot_set ( VALUE  self,
VALUE  vetot 
) [static]

Ruby function: Psi::Task.etot=.

Ruby interface to chkpt_wt_etot. Write the new total energy to checkpoint file.

Parameters:
self Ruby object that is calling this function.
vetot New total energy.

Definition at line 596 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_etot().

Referenced by create_ruby_class().

00597 {
00598         Task *task;     
00599         Data_Get_Struct(self, Task, task);
00600         double etot = NUM2DBL(vetot);
00601         
00602         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00603         chkpt.wt_etot(etot);
00604         
00605         return self;
00606 }

VALUE psi::psirb::Task::rb_chkpt_disp_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.disp.

Ruby interface to chkpt_rd_disp. Reads the current geometry displacement number.

Parameters:
self Ruby object that is calling this function.
Returns:
Current displacement number.

Definition at line 627 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_disp().

Referenced by create_ruby_class().

00628 {
00629         Task *task;     
00630         Data_Get_Struct(self, Task, task);
00631         int disp;
00632         
00633         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00634         disp = chkpt.rd_disp();
00635         
00636         VALUE result = INT2FIX(disp);
00637         return result;
00638 }

VALUE psi::psirb::Task::rb_chkpt_disp_set ( VALUE  self,
VALUE  ndisp 
) [static]

Ruby function: Psi::Task.disp=.

Ruby interface to chkpt_wt_disp. Writes out the current geometry displacement number.

Parameters:
self Ruby object that is calling this function.
ndisp New displacement number.

Definition at line 645 of file task.cc.

References m_psiPSIO, and psi::Chkpt::wt_disp().

Referenced by create_ruby_class().

00646 {
00647         Task *task;     
00648         Data_Get_Struct(self, Task, task);
00649         int disp = NUM2INT(ndisp);
00650         
00651         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00652         chkpt.wt_disp(disp);
00653         
00654         return self;
00655 }

VALUE psi::psirb::Task::rb_chkpt_eccsd_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.eccsd.

Returns the CCSD contribution to the total energy.

Parameters:
self The Ruby object that is calling this function.
Returns:
CCSD energy contribution as a Ruby object.

Definition at line 662 of file task.cc.

References m_psiPSIO, and psi::Chkpt::rd_eccsd().

Referenced by create_ruby_class().

00663 {
00664         Task *task;     
00665         Data_Get_Struct(self, Task, task);
00666         double energy;
00667         
00668         Chkpt chkpt(&task->m_psiPSIO, PSIO_OPEN_OLD);
00669         energy = chkpt.rd_eccsd();
00670         
00671         // Return the value to the user
00672         return rb_float_new(energy);
00673 }

VALUE psi::psirb::Task::rb_chkpt_e_t_get ( VALUE  self  )  [static]

Ruby function: Psi::Task.e_t.

Returns the (T) contribution to the total energy.

Parameters:
self The Ruby object that is calling this function.
Returns:
(T) energy contribution as a Ruby object.

Definition at line 680 of file task.cc.

References