TABLE OF CONTENTS


::pwtk::one_atom_dryrunPW

SYNOPSIS

proc ::pwtk::one_atom_dryrunPW {} {

DESCRIPTION

Make a single atom pw.x dry-run. Prior to calling this command, a user should define at least the Bravais lattice, i.e., ibrav and either celldm(i) (alternatively A,B,C...) or CELL_PARAMETERS.

The command finds a usable pseudo-potential file and performs a single-atom dry-run (useful for querying the lattice vectors if ibrav != 0).

This command is used internally by PWTK.

RETURN VALUE

Name of the output file of the pw.x dry-run.

SOURCE

    input_pushpop {
        proc getPP_ {dir} {
            if { [file exists $dir] } {
                set pp [file tail [lindex [glob -nocomplain $dir/*.UPF] 0]]
                if { [file readable [file join $dir $pp]] } {
                    set atom [::pwtk::pseudo::elemFromPPName $pp]
                    CONTROL "pseudo_dir = '$dir'"
                    SYSTEM "nat = 1 , ecutwfc = 15.0"
                    ATOMIC_SPECIES "$atom 1.0 $pp"
                    ATOMIC_POSITIONS (alat) "$atom 0.0 0.0 0.0"
                    return $pp
                }
            }
            return {}
        }

        foreach pdir [list $::env(PWTK)/examples/pseudo [pseudo_dir] \
                          [::pwtk::input::namelistGetVarValue CONTROL -nocase pseudo_dir trim] \
                          {*}[varvalue ::env(ESPRESSO_PSEUDO)] $::env(HOME)/espresso/pseudo] {
            if { [set pp [getPP_ $pdir]] ne {} } {
                return [dryrunPW]
            }
        }
        if { $pp eq {} } {
            # no PP located, download Si.pz-vbc.UPF from the web
            CONTROL "pseudo_dir = '[::fileutil::tempdir]'"
            pseudo_download Si.pz-vbc.UPF
            if { [getPP_ [::fileutil::tempdir]] ne {} } {
                return [dryrunPW]
            }
        }
        
        # if we came here, we failed to locate a PP file
        ::pwtk::error "failed to find a pseudopotential UPF file" 1
    }
}