TABLE OF CONTENTS


::pwtk::path::relaxAtoms

SYNOPSIS

proc ::pwtk::path::relaxAtoms {pathFile atomList {relaxString "1 1 1"}} {

PURPOSE

Relax the specified atoms in the neb.x PATH file by setting if_pos(*) flags to 'relaxString'.

In the neb.x PATH file, all atoms have the if_pos(*) flags and fixing/relaxing of atoms needs to be specifically set.

The if_pos(*) flags of the atoms not in $atomList are not touched.

ARGUMENTS

RETURN VALUE

None.

SOURCE

    # check arguments

    ::pwtk::fileMustExist  $pathFile "neb.x PATH"

    set natoms   [::pwtk::path::getNAtoms $pathFile]
    set atomList [lsort -integer -unique [::pwtk::parseRangeString $atomList $natoms]]

    if { ! [::pwtk::type::numberlist binary -strict $relaxString] } {
        ::pwtk::error "expected a list of three binary numbers for relaxString, but got: $relaxString" 1
    }

    # read path file

    set im 0
    foreach line [split [::pwtk::readFile $pathFile] \n] {
        if { [lindex $line 0] eq "Image:" } {
            set im [lindex $line 1]
        }
        if { $im == 1 } {
            if { [llength $line] == 9 } {
                incr nat
                if { $nat in $atomList } {
                    # replace ****************** that may appear in forces by zeros
                    set line [regsub -all {\*\*\*+} $line 0.000000000000]

                    # fmt  = "(3(2X,F18.12),3(2X,F18.12),3(2X,I1))"
                    set line [format {  %18.12f  %18.12f  %18.12f  %18.12f  %18.12f  %18.12f  %1d  %1d  %1d} {*}[lrange $line 0 5] {*}$relaxString]
                }
            }
        }
        append new_path $line\n
    }

    ::pwtk::file_backup $pathFile
    writeFile $pathFile $new_path
    #return $new_path
}