~ubuntu-branches/ubuntu/karmic/psicode/karmic

« back to all changes in this revision

Viewing changes to lib/ruby/cchbar.rb

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Handle access to Psi cchbar module
 
2
 
 
3
module Psi
 
4
  class CCHBar    
 
5
    # Mixin the InputGenerator
 
6
    include InputGenerator
 
7
    include Executor
 
8
    
 
9
    def initialize(task_obj)
 
10
      @task = task_obj
 
11
      # Set the generic command for this class
 
12
      set_binary_command Psi::Commands::CCHBAR
 
13
    end
 
14
  end
 
15
  
 
16
  # Add cchbar ability to Task
 
17
  class Task
 
18
    def cchbar(*args)
 
19
      # convert to a hash
 
20
      args_hash = args[0]
 
21
 
 
22
      # Create a new scf object
 
23
      cchbar_obj = Psi::CCHBar.new self
 
24
 
 
25
      # Form the input hash and generate the input file
 
26
      input_hash = { }
 
27
 
 
28
      # Check to see if the function arguments have the reference, if so use it, otherwise use
 
29
      # global setting
 
30
      if args_hash == nil or args_hash.has_key?("reference") == false
 
31
        input_hash["reference"] = reference
 
32
      end
 
33
 
 
34
      # If we are doing analytic gradients make sure cchbar knows
 
35
      if get_gradients == true
 
36
        input_hash["dertype"] = "first"
 
37
      else
 
38
        input_hash["dertype"] = "none"
 
39
      end
 
40
      
 
41
      # Check the wavefunction
 
42
      if args_hash == nil or args_hash.has_key?("wfn") == false
 
43
        input_hash["wfn"] = wavefunction
 
44
      end
 
45
 
 
46
      # Merge what we've done with what the user wants
 
47
      input_hash = input_hash.merge(args_hash) unless args_hash == nil
 
48
 
 
49
      # Run the ccenergy module, sending the input file as keyboard input
 
50
      puts "cchbar"
 
51
      cchbar_obj.execute(input_hash)
 
52
    end
 
53
  end
 
54
end
 
55
 
 
56
# Create some global functions
 
57
# User can send additional input parameters to the function
 
58
def cchbar(*args)
 
59
  # convert to a hash
 
60
  args_hash = args[0]
 
61
  Psi::global_task.cchbar(args_hash)
 
62
end