Sha256: 252e318d708a1bbc2395baabd096492adaea8de0ea668d94fdb04f531b482afd
Contents?: true
Size: 1.65 KB
Versions: 6
Compression:
Stored size: 1.65 KB
Contents
#! /usr/bin/env ruby # coding: utf-8 require "vasputils" require 'thor' class KpointsCommand < Thor desc "generate [option] settings", "Generate KPOINTS" long_desc " Generate KPOINTS file. \n" + "E.g., kpoints generate --mesh 2 3 4 --shift 0.1 0.2 0.3 --monkhorst" option :mesh, banner: '[array]', desc: 'Indicate mesh', type: :array option :shift, banner: '[array]', desc: 'Indicate shift', type: :array option :monkhorst, desc: 'Use Monkhorst packing' option :length, desc: 'Wavelength in real space. Need POSCAR.' def generate if options[:length] axes = VaspUtils::Poscar.load_file('POSCAR').axes lc = CrystalCell::LatticeAxes.axes_to_lc(axes) l = options[:length].to_f mesh = [] 3.times do |i| mesh[i] = (l/lc[i]).ceil end end if options[:mesh] mesh = options[:mesh] unless mesh.size == 3 puts "Three integers must be indicated as argument of --mesh option. Exit." exit end mesh.map!{|i| i.to_i} end if options[:shift] shift = options[:shift] unless shift.size == 3 puts "Three integers must be indicated as argument of --shift option. Exit." exit end shift.map!{|i| i.to_f} end type = :monkhorst if options[:monkhorst] mesh ||= [1,1,1] shift ||= [0.0, 0.0, 0.0] type ||= :gamma_center hash = { :comment => 'Generated by vasputils/bin/kpoints.', :points => nil, :scheme => :automatic, :mesh => mesh , :shift => shift, :type => type } kpoints = VaspUtils::Kpoints.new(hash) kpoints.dump(STDOUT) end end KpointsCommand.start(ARGV)
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
vasputils-0.1.7 | bin/kpoints |
vasputils-0.1.6 | bin/kpoints |
vasputils-0.1.5 | bin/kpoints |
vasputils-0.1.4 | bin/kpoints |
vasputils-0.1.3 | bin/kpoints |
vasputils-0.1.2 | bin/kpoints |