~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to lib/ruby/transqt.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 scf module
 
2
 
 
3
module Psi
 
4
  class TransQT
 
5
    
 
6
    # Mixin the InputGenerator
 
7
    include InputGenerator
 
8
    include Executor
 
9
    
 
10
    def initialize(task_obj)
 
11
      @task = task_obj
 
12
      # Set the generic command for this class
 
13
      set_binary_command Psi::Commands::TRANSQT
 
14
    end
 
15
  end
 
16
  
 
17
  # Add transqt ability to Task
 
18
  class Task
 
19
    def transqt(*args)
 
20
      # convert to a hash
 
21
      args_hash = args[0]
 
22
 
 
23
      # Create a new scf object
 
24
      transqt_obj = Psi::TransQT.new self
 
25
 
 
26
      # Form the input hash and generate the input file
 
27
      input_hash = { }
 
28
 
 
29
      # Check to see if the function arguments have the reference, if so use it, otherwise use
 
30
      # global setting
 
31
      if args_hash == nil or args_hash.has_key?("reference") == false
 
32
        input_hash["reference"] = reference
 
33
      end
 
34
 
 
35
      # Check the wavefunction
 
36
      if args_hash == nil or args_hash.has_key?("wfn") == false
 
37
        input_hash["wfn"] = wavefunction
 
38
      end
 
39
 
 
40
      # Are we doing a back transformation?
 
41
      if args_hash != nil and args_hash.has_key?(:backtr) and args_hash[:backtr] == true
 
42
        transqt_obj.set_binary_command Psi::Commands::BACKTRANSQT
 
43
      end
 
44
      args_hash.delete(:backtr) unless args_hash == nil
 
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 scf module, sending the input file as keyboard input
 
50
      puts "transqt"
 
51
      transqt_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 transqt(*args)
 
59
  # convert to a hash
 
60
  args_hash = args[0]
 
61
  Psi::global_task.transqt(args_hash)
 
62
end