Skip to content

Commit

Permalink
added tests and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
louisponet committed May 24, 2018
1 parent 4656592 commit 72f0ae0
Show file tree
Hide file tree
Showing 27 changed files with 510 additions and 4,061 deletions.
20 changes: 12 additions & 8 deletions examples/1createandrun_job_from_cif.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ name = "Si" #this name will also be given to the Structure inside the DFJob
local_dir = "/home/ponet/Documents/Si"
server_dir = "/home/ponet/Si"
bin_dir = "/usr/local/bin" #this is defaulted to the users bin dir = "~/bin/", it is the directory where pw.x etc will be called from
runcommand = Exec("mpirun", bin_dir, Dict{Symbol, Any}(:np => 24)) #this is the run command before the executable of the calculation and it's flags

execs = [Exec("mpirun", bin_dir, Dict{Symbol, Any}(:np => 24)), Exec("pw.x", bin_dir, Dict{Symbol, Any}(:nk => 2))]
#These execs are what will ultimately run the input, namely they will get pasted one after the other in the line of the job file.
#If you don't want to use mpirun, just insert an Exec().

pseudo_set = :pbesol #nonrelativistic calculation ( assumes you set up the pseudos, as demonstrated in the README)
pseudo_specifier = "paw" #this selects the correct pseudo if multiple belong to the pseudo_set. If you don't specify this, the first one in the set will be used.
Expand All @@ -28,18 +31,20 @@ header = ["#SBATCH -N 1", "#SBATCH --ntasks-per-node=24",
#The various calculations we want to run and the flags and data to pass to them are defined in two ways:
# - calculation specific flags and data are associated with the calculation they belong to
# - common flags can be defined as Pair{Symbol, Any} varargs at the end of the constructor call.
scf_data = Dict(:k_points => (6, 6, 6, 1, 1, 1), :flags => [:verbosity => "'low'"])
bands_data = Dict(:k_points => [(0.5, 0.5, 0.5, 100.),
(0.0, 0.0, 0.0, 100.),
(0.0, 0.5, 0.0, 1.)],

scf_data = Dict(:k_points => [6, 6, 6, 1, 1, 1], :flags => [:verbosity => "'low'"])
bands_data = Dict(:k_points => [[0.5, 0.5, 0.5, 100.],
[0.0, 0.0, 0.0, 100.],
[0.0, 0.5, 0.0, 1.]],
:flags => [:verbosity => "'high'", :nbnd => 8])

calculations = [:scf => ("pw.x", scf_data), :bands => ("pw.x", bands_data)] #the order here is the order in which the calculations will run! The first string in the tuple is the executable name that will be ran, which should be in the bin dir.
nscf_data = merge(bands_data, Dict(:k_points => (10, 10, 10)))
#the order here is the order in which the calculations will run! The first string in the tuple is the executable name that will be ran, which should be in the bin dir.

#Now we load the cif file and create a `DFJob` from it.

job = DFJob(name, local_dir, "/home/ponet/Downloads/9011998.cif", calculations,
:prefix => "'silicon'",
:prefix => "'$name'",
:restart_mode => "'from_scratch'",
:ecutwfc => 18.0,
:mixing_mode => "'plain'",
Expand All @@ -48,7 +53,6 @@ job = DFJob(name, local_dir, "/home/ponet/Downloads/9011998.cif", calculations,
#kwargs
server_dir = server_dir,
bin_dir = bin_dir,
runcommand = runcommand,
header = header,
pseudo_set = :pbesol,
pseudo_specifier = pseudo_specifier
Expand Down
57 changes: 16 additions & 41 deletions src/DFControl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,24 @@ module DFControl
include("types.jl")
include("input.jl")
include("utils.jl")
export kgrid
include("job.jl")

export DFJob
export save
export submit

export flag
export setflags!
export rmflags!

export data
export setdata!

export setflow!

export runcommand
export setruncommand!

export setrunflags!
export runflags
export setexecflags!
export inputs
export input
export setfilename!
export setkpoints!
export setdataoption!
export setheaderword!
export setpseudos!
export addbandscalculation!
export path
export undo
export undo!
export setserverdir!
export atoms
export setatoms!
export cell
export setcell!
export path
export addwancalc!
export setlocaldir!
export setserverdir!
export setprojections!
export print_info
export DFJob, Exec, DFInput
export flag, setflags!, rmflags!,
data, setdata!,
cell, setcell!,
setflow!,
setexecflags!,
input, inputs,
path, outpath, setfilename!, setkpoints!, setdataoption!, setpseudos!,
atoms, setatoms!, setprojections!,
addwancalc!, addbandscalc!,

setheaderword!, setserverdir!, setlocaldir!,
save, submit,
undo, undo!,
print_info

include("constants.jl")
export qe_input_flags
Expand Down
2 changes: 1 addition & 1 deletion src/atom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end
element ::Element
position ::Point3{T}
pseudo ::String = ""
projections ::Vector{Projection} = [Projection()]
projections ::Vector{Projection} = Projection[]
end

Atom(id::Symbol, el::Element, pos::Point3; kwargs...) = Atom(id=id, element=el, position=pos; kwargs...)
Expand Down
2 changes: 2 additions & 0 deletions src/input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,5 @@ outfile(input::DFInput{QE}) = splitext(input.filename)[1]*".out"
outfile(input::DFInput{Wannier90}) = splitext(input.filename)[1]*".wout"

setflow!(input::DFInput, run) = input.run = run

spincalc(input::DFInput) = all(flag(input, :nspin) .!= [nothing, 1])
Loading

0 comments on commit 72f0ae0

Please sign in to comment.