Sha256: 308cc7d30c173753a32d4dbcc85658ff99c806fc23e55296a3e801b2b79c34d1
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
#! /usr/bin/env ruby # coding: utf-8 require "vasputils.rb" # Module dearing with KPOINTS. # This can deal with only Automatic mesh style of KPOINTS, # i.e., this cannot deal with other various styles of KPOINTS. module VaspUtils::Kpoints def self.parse(io) results = {} results[:comment] = io.readline.chomp raise "Not automatic generating KPOINTS! 2nd line must be 0." unless io.readline == "0\n" line = io.readline case line when /^m/i; then; results[:type] = :monkhorst when /^g/i; then; results[:type] = :gamma_center else raise "Kpoints module can deal with only monkhorst and gamma-center." end #pp io.readline.strip.split(/\s+/).map{|i| i.to_i} results[:mesh] = io.readline.strip.split(/\s+/).map{|i| i.to_i} #pp io.readline.strip.split(/\s+/).map{|i| i.to_f} results[:shift] = io.readline.strip.split(/\s+/).map{|i| i.to_f} return results end # def self.load_file(file) self.parse(File.open(file, "r")) end def self.dump(data, io) io.puts "Automatic mesh" io.puts "0" io.puts data[:type].to_s.capitalize io.puts data[:mesh].join(" ") io.puts data[:shift].join(" ") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vasputils-0.0.11 | lib/vasputils/kpoints.rb |