Sha256: 4b3ad18f3dab42cc62cd2ad705155b94a046d26b63010e12ae0c4a7f797e1879
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 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$/ 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 results[:mesh] = io.readline.strip.split(/\s+/).map{|i| i.to_i} 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.12 | lib/vasputils/kpoints.rb |