Giter VIP home page Giter VIP logo

tools-for-g16.bash's People

Contributors

o2-ac avatar polyluxus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tools-for-g16.bash's Issues

Wrong duration will not exit script

Since the validate duration routine is called from a subshell, the fatal function producing the error will only exit that subshell:

w) requested_walltime=$(format_duration_or_exit "$OPTARG")

Therefore the value written to the jobscript will be unset and may lead to errors.

For example executing a command with a (currently see #75) not recognised input will produce the following:

$ g16.submit -w120S -k test.gjf
INFO    : Configuration file '<HOME>/local/tools-for-g16.bash/.g16.toolsrc' applied.
ERROR   : Value for seconds (120S) is no positive integer.
INFO    : Will process Inputfile 'test.gjf'.
INFO    : Output will be written to 'test.log'.
INFO    : Checkpoint file 'test.chk' does not exists and will be created.
INFO    : Removed keyword 'MaxDisk=30000MB'.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'test.gjf'.
INFO    : Request a total memory of 6320 MB, including overhead for Gaussian.
WARNING : This is still in preparation
WARNING : No project selected.
INFO    : Written submission script 'test.slurm.bash'.
INFO    : Created submit script, use
INFO    : sbatch test.slurm.bash
INFO    : to start the job.
INFO    : g16.submit.sh is part of tools-for-g16.bash 0.2.1 (2019-03-26)

And within test.slurm.bash:

#!/bin/bash
# Submission script automatically created with g16.submit.sh
#SBATCH --job-name='test'
#SBATCH --output='test.slurm.bash.o%j'
#SBATCH --error='test.slurm.bash.e%j'
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=12
#SBATCH --mem-per-cpu=526
#SBATCH --time=                                                 <<--- !!!
#SBATCH --mail-type=END,FAIL
#SBATCH --export=NONE
jobid="${SLURM_JOB_ID}"
[...]

g16.prepare fails to read chrg/uhf/mult properly if on same line

When the markers chrg, mult, uhf are on the same line, g16.prepare will only catch the charge.

For example: Issuing

$ g16.prepare start.xyz

where start.xyz is

    6
chrg 1 uhf 1
 C     0.000000     0.000000     0.000000
 C     0.000000     0.000000     1.450000
 H     1.026720     0.000000    -0.362996
 H    -0.513360     0.889165    -0.363000
 H    -1.026719     0.000000     1.813000
 H     0.513360     0.889165     1.813000

will result in

INFO    : Configuration file '<--->/local/tools-for-g16.bash/.g16.toolsrc' applied.
INFO    : Found molecule's charge: 1.
WARNING : No route section was specified, using default:
WARNING : #P B97D3/def2SVP/W06   DenFit
INFO    : Setting charge (1) and multiplicity (1).
INFO    : Using caption 'Calculation: start.xyz; chrg 1; mult 1; uhf 0; 2019-01-25 10:40:29 (CET)'.
INFO    : Checkpoint file 'start.xyz.chk' does not exists and will be created.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'start.xyz.com'.
INFO    : g16.prepare.sh is part of tools-for-g16.bash 0.1.0.dev (2018-12-XX)

Changing the 'comment line' to

mult 2 chrg 1

will also result in the above.

The reason for this is the if/elif ... then ... else ... fi construct starting on line 517 in process_gaussian.sh.
Possible fix: This needs to be changed so that the same line will get checked multiple times for any of the patterns. Converting it into multiple if statements will probably work and needs only little more coding effort.

Addendum
The patterns can probably drop the mandatory space between the indicator and the number

< old; > new;
<     pattern_charge="[Cc][Hh][Rr][Gg][[:space:]]+([+-]?[0-9]+)"
<     pattern_mult="[Mm][Uu][Ll][Tt][[:space:]]+([0-9]+)"
<     pattern_uhf="[Uu][Hh][Ff][[:space:]]+([0-9]+)"
---
>     pattern_charge="[Cc][Hh][Rr][Gg][[:space:]]*([+-]?[0-9]+)"
>     pattern_mult="[Mm][Uu][Ll][Tt][[:space:]]*([0-9]+)"
>     pattern_uhf="[Uu][Hh][Ff][[:space:]]*([0-9]+)"

so that an input of chrg1 uhf1 would also work.

Wrong check for profile

[[ -e "$g16_installpath/g16/bsd/g16.profile" ]] && fatal "Gaussian profile does not exist."

This checks if the file exists and abort if it does. Obviously this must be changed to

    [[ -e "$g16_installpath/g16/bsd/g16.profile" ]] || fatal "Gaussian profile does not exist."

Other scripts need to be investigated for that error, too.

Enhance predefined route sections

Currently the best option is to edit the .g16.toolsrc (or similar) directly, if you would like to change the pre-defined route sections. This is a bit tedious. It would be nice to have a more decent route section builder, i.e. one that would open an editor, where you can edit the route section more comfortably (or something like that).

It would also be nice if the string (variable) could handle Gaussian type comments. For example:

$ g16.prepare.dev -llist
INFO    : Configuration file '<HOME>/devel/tools-for-g16.bash/.g16.toolsrc' applied.
    0 : # PM6

    1 : #P B97D3/def2SVP/W06   DenFit

    2 : #P B97D3/def2TZVPP/W06 DenFit

    3 : #P PBE1PBE/def2SVP ! this is known as pbe0
$ g16.prepare.dev -l3 -ropt -jtest start.xyz
INFO    : Configuration file '<HOME>/devel/tools-for-g16.bash/.g16.toolsrc' applied.
INFO    : Applied route section:
INFO    : #P PBE1PBE/def2SVP ! this is known as pbe0
INFO    : Added 'opt' to the route section.
INFO    : Setting charge (0) and multiplicity (1).
INFO    : Using caption 'Calculation: test; chrg 0; mult 1; uhf 0; 2019-04-16 19:17:13 (CEST)'.
INFO    : Checkpoint file 'test.chk' does not exists and will be created.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'test.com'.
INFO    : g16.prepare.sh is part of tools-for-g16.bash 0.2.2 (2019-04-04)
$ head -n5 test.com
%Chk=test.chk
%NProcShared=12
%Mem=4000MB
#P PBE1PBE/def2SVP ! this is known as pbe0 opt MaxDisk=30000MB

$ g16.submit.dev -k test.com
INFO    : Configuration file '<HOME>/devel/tools-for-g16.bash/.g16.toolsrc' applied.
INFO    : Will process Inputfile 'test.com'.
INFO    : Output will be written to 'test.log'.
WARNING : Link0 directive '%NProcShared=12' found.
WARNING : The statement will be replaced by script values.
WARNING : Link0 directive '%Mem=4000MB' found.
WARNING : The statement will be replaced by script values.
INFO    : Removed comment: this is known as pbe0 opt MaxDisk=30000MB
INFO    : Removed comment: Automagically created with g16.prepare.sh (tools-for-g16.bash, 0.2.2, 2019-04-04)
INFO    : Removed comment: '<HOME>/bin/g16.prepare.dev' '-l3' '-ropt' '-jtest' 'start.xyz'
INFO    : Checkpoint file 'test.chk' does not exists and will be created.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'test.gjf'.
INFO    : Request a total memory of 6320 MB, including overhead for Gaussian.
INFO    : Request a walltime of 120:00:00.
INFO    : Request 12 cores to run this job on.
WARNING : No project selected.
WARNING : No machine type selected.
INFO    : No email address given, notifications will be sent to system default.
INFO    : Written submission script 'test.bsub.bash'.
INFO    : Created submit script, use
INFO    : bsub < test.bsub.bash
INFO    : to start the job.
INFO    : g16.submit.sh is part of tools-for-g16.bash 0.2.2 (2019-04-04)
$ head -n5 test.gjf
%Chk=test.chk
%NProcShared=12
%Mem=4000MB
#P PBE1PBE/def2SVP MaxDisk=30000MB

In this particular case, because the comment is not removed from the predefined variable, the added opt keyword is removed during submission. (Kudos to @O2-AC for mentioning this as an idea.)
And even if submitted as it is, Gaussian would read it as part of the comment.

g16.optinput does not report what 'OPT' is added

For example:

INFO    : Configuration file '[...]/.g16.toolsrc' applied.
WARNING : Link0 directive '%NProcShared=24' found.
WARNING : The statement will be replaced by script values.
WARNING : Link0 directive '%Mem=20000MB' found.
WARNING : The statement will be replaced by script values.
INFO    : Removed comment: Automagically created with g16.submit.sh
INFO    : Removed comment: [...]/bin/g16.submit -p24 -m20000 df-b97d3tzvp.irc.fwd.com
INFO    : Removed keyword 'IRC(RCFC,forward,MaxPoints=25,StepSize=10,MaxCycle=100)'.
INFO    : Removed keyword 'guess(read)'.
INFO    : Added 'guess(read)' to the route section.
INFO    : Removed keyword 'geom(check)'.
INFO    : Added 'geom(check)' to the route section.
INFO    : Checkpoint file 'df-b97d3tzvp.irc.fwd.opt.chk' does not exists and will be created.
INFO    : Removed keyword 'MaxDisk=30000MB'.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'df-b97d3tzvp.irc.fwd.opt.com'.
INFO    : g16.optinput.sh is part of tools-for-g16.bash 0.0.17 (2018-10-09)

The line where it states what OPT is added is missing.

g16.prep interface with xtb/turbomole

The script should be able to read an xyz coordinate file from a previous run of xtb. For example it should be able to extract a block with given charge/ uhf status in the following form:

$set
chrg <num>
uhf <int>
$end

Additionally it would be great if it recognises and parses coord files, as xtb -siman writes one for every conformer. Should be as simple as matching a line versus $coord, and having the format

   <floating point number>   <floating point number>   <floating point number>    <element>

where <floating point number> is in bohr. (Needs to be converted to angstrom, or can possibly be set with Units.)

Language reset not sufficient

Ocasional fails, i.e. LANGUAGE is set.
See: Temporarily change language for terminal messages/warnings/errors, Why is overriding the LANG environment variable not changing the language for me?

warn_and_set_locale ()
{
if ! check_locale ; then
warning "Formatting might not properly work for current locale."
warning "Setting locale POSIX compliant."
unset LANG LC_ALL LC_NUMERIC
local -a locale_settings
mapfile -t locale_settings < <(locale)
debug "New locale settings:"
debug "$( fold -w80 -s <<< "$( printf '%s; ' "${locale_settings[@]}"; printf '\n' )" )"
fi
}

Therefore it should be added unset LANGUAGE and export LANG=C, LC_ALL=C to make double dead sure we're posix compliant.

all input scripts need '-f' switch

The frequency script needs a switch to specify a filename analogous to optinput/spinput.
Same for dissolve.
Similar for ircinput, but here a general workflow must be found for the two files to be generated.

  • g16.freqinput
  • g16.dissolve
  • g16.ircinput
  • g16.optinput
  • g16.spinput
  • g16.prepare

Add `--` to terminate reading options.

As a precaution add -- to terminate reading options.

For the (unlikely) case that a file name starts with a dash, the script will refuse to handle it as it will interpret it as an option.

For example:

bash $ cat -- -start.xyz
    2

 H     0.000   0.000   0.000
 H     0.000   0.000   0.666
bash $ g16.prepare -jtest -start.xyz
INFO    : Configuration file '<<--->>/local/tools-for-g16.bash/.g16.toolsrc' applied.
ERROR   : There is no inputfile specified
bash $ # Even worse:
bash $ cat -- -ssstart.xyz
    2

 H     0.000   0.000   0.000
 H     0.000   0.000   0.666
bash $ g16.prepare -jtest -ssstart.xyz
INFO    : Configuration file '<<--->>/local/tools-for-g16.bash/.g16.toolsrc' applied.
bash $ # Workaround:
bash $ g16.prepare -jtest ./-ssstart.xyz
INFO    : Configuration file '<<--->>/local/tools-for-g16.bash/.g16.toolsrc' applied.
WARNING : No route section was specified, using default:
WARNING : #P B97D3/def2SVP/W06   DenFit
INFO    : Setting charge (0) and multiplicity (1).
INFO    : Using caption 'Calculation: test; chrg 0; mult 1; uhf 0; 2019-02-07 15:32:46 (CET)'.
INFO    : Checkpoint file 'test.chk' does not exists and will be created.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'test.com'.
INFO    : g16.prepare.sh is part of tools-for-g16.bash 0.1.1 (2019-02-05)

print output if submission fails

Currently it is only stated that the submission failed, while there should also be an indication as to why. The output of the submission command will currently be neglected, and is only shown in debug mode.

g16.prep/freqinput should echo complete route section

It currently echos the route section which is loaded with -l, but internal option may add more keywords with -r, -T, -P, ...
The applied route section should be echoed, or at least anything that was added should.

configure script buggy in translate mode (-T switch)

When the ./configure/configure.sh is used with the -T switch, two settings are not copied correctly from the original .g16.toolsrc

Specifically the lines:

# Set the commands or paths for utilities:
#
# - wrapper for all Gaussian commands
#
#   The wrapper will load the Gaussian environment before executing the below utilities
#   This should be blank if the utilities are found in PATH, or the absolute paths are provided
#   g16_wrapper_cmd="g16.wrapper"
#
# - formatted checkpoint files
#   
#   The command that executes formchk.
#   Local install with formchk found in PATH, or wrapped with above, or absolute path.
#
    g16_formchk_cmd="formchk"
#   No options should be included in the above, but can be set:
    g16_formchk_opts=""

will be written into the .g16.toolsrc and have to be changed manually to:

# Set the commands or paths for utilities:
#
# - wrapper for all Gaussian commands
#
#   The wrapper will load the Gaussian environment before executing the below utilities
#   This should be blank if the utilities are found in PATH, or the absolute paths are provided
    g16_wrapper_cmd="g16.wrapper"
#
# - formatted checkpoint files
#   
#   The command that executes formchk.
#   Local install with formchk found in PATH, or wrapped with above, or absolute path.
#
    g16_formchk_cmd="formchk"
#   No options should be included in the above, but can be set:
    g16_formchk_opts="-3"

configure has a few problems writing all correct values to file

TODO:

  • Fix setting value of temporary directory
  • Fix pre-defined route sections in defaults/ rc

configure still gets the temporary directory wrong

The configure script has problems reading and setting the temporary directory, if it contains a variable. There is a lot of expansion, etc going on. This is in itself not crucial, if the directory is read/writable; (if eventually set correctly probably by hand;) it should be addressed eventually.

allcheck gets removed and not re-added

$ g16.optinput -f df-b3lyp-svp.af.opt.com df-b3lyp-svp.af.sp.gjf
INFO    : Configuration file '/rwthfs/rz/cluster/home/~~~xx~~~/local/tools-for-g16.bash/.g16.toolsrc' applied.
WARNING : Link0 directive '%NProcShared=20' found.
WARNING : The statement will be replaced by script values.
WARNING : Link0 directive '%Mem=40000MB' found.
WARNING : The statement will be replaced by script values.
INFO    : Keyword 'AllCheck' found in input stream.
INFO    : Skipping reading title, charge, and multiplicity.
INFO    : Removed comment: Automagically created with g16.submit.sh
INFO    : Removed comment: /home/~~~xx~~~/bin/g16.submit -P~x~ -M0 -p20 -m40000 df-b3lyp-svp.af.sp.com
INFO    : Removed keyword 'guess(read)'.
INFO    : Added 'guess(read)' to the route section.
INFO    : Removed keyword 'geom(allcheck)'.               (!!!!!)
INFO    : Added 'geom(check)' to the route section.       (!!!!!)
INFO    : Added 'OPT' to the route section.
INFO    : Checkpoint file 'df-b3lyp-svp.af.opt.chk' does not exists and will be created.
INFO    : Removed keyword 'MaxDisk=30000MB'.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'df-b3lyp-svp.af.opt.com'.
INFO    : g16.optinput.sh is part of tools-for-g16.bash 0.1.0.dev (2018-11-XX)

When AllCheck is found it must be retained, otherwise the charge/multiplicity line and the title is missing, therefore the calculation will fail.

g16.submit fails if input uses fragments, enhance support for fragment calculations

Molecules can be specified in fragments, making it easier to generate a broken symmetry ansatz, see G16 manual.

The following file is a valid input, but produces errors:

%OldChk=df-bp86-svp.chk
#P BP86/def2SVP/W06 DenFit EmpiricalDispersion(GD3BJ) opt(tight)
int(ultrafinegrid) gfinput gfoldprint iop(6/7=3) MaxDisk=30000MB

Calculation: df-bp86-svp; chrg 0; mult 2; uhf(BS) 3;

0 2   1 -2   -2 2   1 2
 C(Fragment=1)      2.47876000   -0.98801800    0.00000300
 H(Fragment=1)      3.44120100   -0.45469200   -0.00002200
 H(Fragment=1)      2.49595200   -2.08858400    0.00000100
 C(Fragment=2)      1.25783500   -0.28351300   -0.00000100
 C(Fragment=2)      1.23594200    1.17023000    0.00000100
 H(Fragment=2)      2.18498000    1.73055200   -0.00000100
 C(Fragment=2)     -0.00000100    1.78167000   -0.00000100
 C(Fragment=2)     -1.23594300    1.17023000   -0.00000100
 H(Fragment=2)     -2.18498200    1.73055000   -0.00000100
 C(Fragment=2)     -1.25783400   -0.28351400    0.00000500
 C(Fragment=2)      0.00000000   -0.96386700    0.00000200
 H(Fragment=2)      0.00000100   -2.06575500    0.00000200
 C(Fragment=3)     -2.47876000   -0.98801800   -0.00000200
 H(Fragment=3)     -3.44120000   -0.45469200    0.00000500
 H(Fragment=3)     -2.49595300   -2.08858400   -0.00001800

Observed behaviour:

$ g16.submit -k -Pxx -M0 -p20 -m40000 df-bp86-svp.af_doublet.com
INFO    : Configuration file '/rwthfs/rz/cluster/home/~~~xx~~~/local/tools-for-g16.bash/.g16.toolsrc' applied.
INFO    : Will process Inputfile 'df-bp86-svp.af_doublet.com'.
INFO    : Output will be written to 'df-bp86-svp.af_doublet.log'.
INFO    : Checkpoint file 'df-bp86-svp.af_doublet.chk' does not exists and will be created.
INFO    : Removed keyword 'MaxDisk=30000MB'.
INFO    : Added 'MaxDisk=30000MB' to the route section.
ERROR   : Charge unset; somewhere, something went wrong.

I also guess that reading in the geometry afterwards will fail.

submit mangles link0 directives into the body of the input file

When there are additional link0 directives, something goes wrong in g16.submit (or more likely in resoures/process_gaussian) which causes some lines to go where they do not belong to. For example, the following input file created with g16.prepare:

%Chk=bp86-svp.chk
%NProcShared=12
%Mem=4000MB
#P BP86/def2SVP/W06 EmpiricalDispersion(GD3BJ) DenFit MaxDisk=30000MB

Calculation: bp86-svp; chrg 0; mult 1; uhf 0; 2019-03-07 10:23:51 (CET)

0   1
C        0.99017000     -0.06890000     -0.07181000
H        2.08237000     -0.06890000     -0.07181000
H        0.62610000     -0.68663000     -0.89568000
H        0.62610000      0.95346000     -0.19485000
H        0.62610000     -0.47352000      0.87510000

!Automagically created with g16.prepare.sh
!g16.prepare -l3 -jbp86-svp start.xyz

Subsequently transformed with g16.optinput to:

%OldChk=bp86-svp.chk
%Chk=bp86-svp.opt.chk
%NProcShared=12
%Mem=4000MB
#P BP86/def2SVP/W06 EmpiricalDispersion(GD3BJ) DenFit guess(read) geom(check)
OPT MaxDisk=30000MB

Calculation: bp86-svp; chrg 0; mult 1; uhf 0; 2019-03-07 10:23:51 (CET)

0   1


!Automagically created with g16.optinput.sh
!g16.optinput bp86-svp.gjf

And further with g16.freqinput to:

%OldChk=bp86-svp.opt.chk
%Chk=bp86-svp.opt.freq.chk
%NProcShared=12
%Mem=4000MB
#P BP86/def2SVP/W06 EmpiricalDispersion(GD3BJ) DenFit Freq guess(read)
geom(check) MaxDisk=30000MB

Calculation: bp86-svp; chrg 0; mult 1; uhf 0; 2019-03-07 10:23:51 (CET)

0   1


!Automagically created with g16.freqinput.sh
!g16.freqinput bp86-svp.opt.gjf

So far so good, because there is nothing in link0 that was not expected.
Now use this file to rerun the calculation, i.e.

g16.freqinput -R -T300 -P20 bp86-svp.opt.freq.gjf

Firstly this produces a file called bp86-svp.opt.freq.freq.T300-0_P20-0.com. Doubeling the freq, that is a bonus issue (for free :D).
However, the input file looks correct and behaves correct:

%OldChk=bp86-svp.opt.freq.chk
%Chk=bp86-svp.opt.freq.freq.T300-0_P20-0.chk
%NoSave
%NProcShared=12
%Mem=4000MB
#P BP86/def2SVP/W06 EmpiricalDispersion(GD3BJ) DenFit Freq(ReadFC)
Temperature=300.0 Pressure=20.0 guess(read) geom(check) MaxDisk=30000MB

Calculation: bp86-svp; chrg 0; mult 1; uhf 0; 2019-03-07 10:23:51 (CET)

0   1


!Automagically created with g16.freqinput.sh
!g16.freqinput -R -T300 -P20 bp86-svp.opt.freq.gjf

The additional link0 command not accounted for is %NoSave.
When submitted with

g16.submit -k -p4 -m2000 -w00:30:00 bp86-svp.opt.freq.freq.T300-0_P20-0.com

(Unfortunately I also need to work on the debug statements; they're not very helpful.)
this is turned into bogus:

%OldChk=bp86-svp.opt.freq.chk
%Chk=bp86-svp.opt.freq.freq.T300-0_P20-0.chk
%NProcShared=4
%Mem=2000MB
#P BP86/def2SVP/W06 EmpiricalDispersion(GD3BJ) DenFit Freq(ReadFC)
Temperature=300.0 Pressure=20.0 guess(read) geom(check) MaxDisk=30000MB

Calculation: bp86-svp; chrg 0; mult 1; uhf 0; 2019-03-07 10:23:51 (CET)

0   1
%NoSave
%NProcShared=12
%Mem=4000MB



!Automagically created with g16.submit.sh
!g16.submit -k -p4 -m2000 -w00:30:00 bp86-svp.opt.freq.freq.T300-0_P20-0.com

And the calculation fails (Atom specifications unexpectedly found in input stream.).

I currently cant pinpoint to the culprit. Obviously the debug statements have to be revised first, to actually give information about the issue.)

scratch directory default definition

Currently the content of the $TEMP variable is written to the submission script by default. It should rather be the steering that will evaluated within the queuing system.

script mangled empty lines separating modredundant

when submitting a file like

#P B97D3/def2SVP/W06 DenFit
opt(modredundant, MaxCycle=100, MaxStep=10, VeryTight, NoEigenTest) 
scf(xqc, MaxConventionalCycle=500) int(ultrafinegrid) 

TITLE

CHRG MULT
...GEOM...

B 3 52 F

the empty line separating the modred input does not translate to the submitted job.

Seemingly empty route sections are not detected

If a valid input file test.gjf of the following form

%chk= [...]
#B97D3/def2SVP OPT

Title required

0 1
[...]

is used as a template, the script (for example g16.freqinput) will write a false input file.

%OldChk= [...] (%Chk, %Mem, etc.)
Freq guess(read) geom(check)



!Automagically created with g16.freqinput.sh (tools-for-g16.bash, 0.2.0, 2019-03-19)
!'<HOME>/bin/g16.freqinput' 'test.gjf'

Any of the scripts should probably abort.

Language formatting needs to be checked

The scripts (probably all) that deal with number and use printf should check that the numeric format is English. Currently this is somewhat supported by g16.getfreq via the messaging interface.

# If the used locale is not English, the formatting of floating numbers of the
# printf commands will produce an error
warn_and_set_locale ()
{
if [[ "$LANG" =~ ^en_US.(UTF-8|utf8)$ ]]; then
debug "Locale is '$LANG'"
else
warning "Formatting might not properly work for '$LANG'."
warning "Setting locale for this script to 'en_US.UTF-8'."
set -x
export LC_NUMERIC="en_US.UTF-8"
set +x
fi
}

This needs to be rewritten to directly check for LC_NUMERIC, too, and then included as a standard check in all scripts.


For example:

bash $ export LC_NUMERIC=de_DE.UTF-8
bash $ printf '%-6.6f\n' "6"
6,000000
bash $ cat start.xyz
    2

 H     0.000   0.000   0.000
 H     0.000   0.000   0.666
bash $ g16.prepare start.xyz
INFO    : Configuration file '<<--->>/tools-for-g16.bash/.g16.toolsrc' applied.
<<--->>/tools-for-g16.bash/resources/process_gaussian.sh: line 505: printf: 0.000: invalid number
<<--->>/tools-for-g16.bash/resources/process_gaussian.sh: line 505: printf: 0.000: invalid number
<<--->>/tools-for-g16.bash/resources/process_gaussian.sh: line 505: printf: 0.000: invalid number
<<--->>/tools-for-g16.bash/resources/process_gaussian.sh: line 505: printf: 0.000: invalid number
<<--->>/tools-for-g16.bash/resources/process_gaussian.sh: line 505: printf: 0.000: invalid number
<<--->>/tools-for-g16.bash/resources/process_gaussian.sh: line 505: printf: 0.666: invalid number
WARNING : No route section was specified, using default:
WARNING : #P B97D3/def2SVP/W06   DenFit
INFO    : Setting charge (0) and multiplicity (1).
INFO    : Using caption 'Calculation: start.xyz; chrg 0; mult 1; uhf 0; 2019-02-05 17:29:34 (CET)'.
INFO    : Checkpoint file 'start.xyz.chk' does not exists and will be created.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'start.xyz.com'.
INFO    : g16.prepare.sh is part of tools-for-g16.bash 0.1.1 (2019-02-05)
bash $ cat start.xyz.com
%Chk=start.xyz.chk
%NProcShared=12
%Mem=2000MB
#P B97D3/def2SVP/W06 DenFit MaxDisk=30000MB

Calculation: start.xyz; chrg 0; mult 1; uhf 0; 2019-02-05 17:29:34 (CET)

0   1
H        0,00000000      0,00000000      0,00000000
H        0,00000000      0,00000000      0,00000000

!Automagically created with g16.prepare.sh
!<<--->>/bin/g16.prepare start.xyz
bash $

g16.prepare -u switch doesn't exit properly, some values not accepted

The validation of the email address doesn't work as it is implemented incorrectly as an argument.

#hlp -u <ARG> Set user email address. This is also a BSUB specific setting.
#hlp In other queueing systems it just won't be used.
#hlp If the argument is 'default', '0', or '', it reverts to system settings.
#hlp
u)
bsub_email=$(validate_email "$OPTARG")
;;

This expects the validate function to return (echo) a string, which it does not do; the user email will always be empty if tried to set via the command line.

Additionally, since executed in a subshell, it won't exit, if the value is wrong.

The option also must not check for the specified overwrites.

This should work better:

#hlp     -u <ARG> Set user email address. This is also a BSUB specific setting.
#hlp              In other queueing systems it just won't be used.
#hlp              If the argument is 'default', '0', or '', it reverts to system settings.
#hlp
  u)
     if [[ "$OPTARG" =~ ^(|0|[Dd][Ee][Ff][Aa][Uu][Ll][Tt])$ ]] ; then
       bsub_email="default"
       continue
     elif validate_email "$OPTARG" "the user email address" ; then
       bsub_email="$OPTARG"
     fi
     ;;

prepare -R needs to check for route card

The following command produces no error, but should (not sure why testrt fails)

g16.prepare -R'PM6' -jpm6opt xtbopt.xyz

So the script needs to actively check for the route card and insert it, if not present.

g16.prepare command line options should overwrite settings found in input

Current behaviour is that settings for the charge/multiplicity if specified on the command line will be overwritten from settings which might be found in the input file. For example, the command

g16.prepare -c1 -M2 start.xyz 

should force a charge of 1 and a multiplicity of 2 regardless of any flags found in the input file.

Check if keyword exists twice in route section

When a keyword appears twice (except for some) Gaussian will usually fail to execute. It will produce a syntax error. This should be checked and avoided, especially when using scripts building on existing inputs.

g16.chk2xyz fails with empty options

The issues is with

 g16_formchk_args=( "$g16_formchk_opts" "$use_input_chk" "$output_fchk" )

which puts an empty argument if g16_formchk_opts is chosen to be empty.
That will cause the program formchk not to run, because it is waiting for user input.

load_modules is unused

The setting

load_modules="true"

currently has no effect.
Whether modules are loaded is still determined via qsys. This should be changed.

g16.prep new switch for uhf treatment

As an alternative to the multiplicity switch -M <INT> there should be an option to specify the number of unpaired instead, like -u <INT-1>. This obviously results in the same thing and appropriate warnings/errors should be issued.

freqinput needs a check if oldchk is set and guess value if unset

Using g16.freqinput on a file where no chk statement is present will produce a new file without oldchk statement. Since the input depends on the presence of this file, Gaussian will abort with an error.

If there is no chk statement to construct the oldchk statement from, test for a checkpoint file with the same basename and use this instead.

This is especially an issue, since inputfiles submitted with g16.submit of this bundle don't necessary need a chk statement, since the script will automatically add it. Using the wrong inputfile will then recreate this error.

Version warning fires on false positive

The script should warn if it detects a configuration file, which is 'too old' (from a previous major version). Currently it fires only when the versions match.

For example:

if [[ -n $g16_tools_rc_loc ]] ; then
#shellcheck source=./g16.tools.rc
. "$g16_tools_rc_loc"
message "Configuration file '${g16_tools_rc_loc/*$HOME/<HOME>}' applied."
if [[ "${configured_version}" =~ ^${version%.*} ]] ; then
warning "Configured version was $configured_version ($configured_versiondate),"
warning "and probably needs an update to $version ($versiondate)."
fi
else
debug "No custom settings found."
fi

specify e-mail for g16.submit

BSUB is capable of reading an e-mail address, where you can specify to send the summaries. This should be a configuration option for the script, too.

g16.prep load file from different dir, but write to current, -j switch misfunctioning

Consider you would like to start a job in the directory here from a geometry stored in there which is ../ammonia/ in his case, then running the following will cause the input file to be written to the wrong directory:

$ g16.prepare -j%s ../ammonia/ammonia.start.xyz
INFO    : Configuration file '/***/.g16.toolsrc' applied.
WARNING : File '../ammonia/ammonia.com' exists.
INFO    : File will be backed up.
INFO    : ‘../ammonia/ammonia.com’ -> ‘../ammonia/ammonia.com.1’
WARNING : No route section was specified, using default:
WARNING : #P B97D3/def2SVP/W06   DenFit
INFO    : Using caption 'Calculation: ../ammonia/ammonia'.
INFO    : Setting charge (0) and multiplicity (1).
WARNING : Checkpoint file '../ammonia/ammonia.chk' exists and will very likely be overwritten.
WARNING : This may lead to an unusable file and loss of data.
INFO    : If you are attempting to read in data from a previous run, use
INFO    : the directive '%OldChk=<previous_calculation>' instead.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile '../ammonia/ammonia.com'.
INFO    : g16.prepare.sh is part of tools-for-g16.bash 0.0.13 (2018-08-17)

##Expected behaviour:

The input should be written to here/***.com, which is obviously a problem with a filter from the -j switch. This does allow slashes, but is later used to generate the filename. The problem does not exist, if a fixed name is given:

$ g16.prepare -jtest ../ammonia/ammonia.start.xyz
INFO    : Configuration file '***/.g16.toolsrc' applied.
WARNING : No route section was specified, using default:
WARNING : #P B97D3/def2SVP/W06   DenFit
INFO    : Using caption 'Calculation: test'.
INFO    : Setting charge (0) and multiplicity (1).
INFO    : Checkpoint file 'test.chk' does not exists and will be created.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'test.com'.
INFO    : g16.prepare.sh is part of tools-for-g16.bash 0.0.13 (2018-08-17)

g16.spinput -R switch has no effect

For example:

%Chk=bp86-svp.chk
%NProcShared=12
%Mem=4000MB
#P BP86/def2SVP/W06 EmpiricalDispersion(GD3BJ) DenFit opt MaxDisk=30000MB

Calculation: bp86-svp; chrg 0; mult 1; uhf 0; 2019-03-07 17:18:21 (CET)

0   1
O        0.96315000     -0.09248000      0.01214000
H        1.93103000     -0.10324000     -0.03303000
H        0.68430000     -0.30756000     -0.89061000

!Automagically created with g16.prepare.sh
!g16.prepare -l3 -ropt -jbp86-svp start.xyz

with

$ g16.spinput -R'#P TPSSTPSS/def2TZVPP' -f tpss-tzvpp.com bp86-svp.com

produces

%OldChk=bp86-svp.chk
%Chk=tpss-tzvpp.chk
%NProcShared=12
%Mem=4000MB
#P BP86/def2SVP/W06 EmpiricalDispersion(GD3BJ) DenFit guess(read) geom(check)
MaxDisk=30000MB

Calculation: bp86-svp; chrg 0; mult 1; uhf 0; 2019-03-07 17:18:21 (CET)

0   1


!Automagically created with g16.spinput.sh
!g16.spinput -R#P TPSSTPSS/def2TZVPP -f tpss-tzvpp.com bp86-svp.com

😭

Recursive mode for g16.chk2xyz

It would be immensely helpful to recourse through a directory and format all checkpoint files found at the wrap-up of a project (with g16.chk2xyz) similar to finding all energies (with g16.getenergies).

Typo in g16.submit output

INFO    : Will process Inputfile 'm06tzvpp.com'.
INFO    : Output will be written to 'm06tzvpp.log'.
WARNING : Link0 directive '%NProcShared=12' found.
WARNING : The statement will be replaced by script values.
WARNING : Link0 directive '%Mem=2000MB' found.
WARNING : The statement will be replaced by script values.
INFO    : Removed comment: Automagically created with g16.prepare.sh (tools-for-g16.bash, 0.2.2, 2019-04-04)
INFO    : Removed comment: '<HOME>/bin/g16.prepare' '-l' '9' '-j' 'm06tzvpp' 'start.xyz'
INFO    : Checkpoint file 'm06tzvpp.chk' does not exists and will be created.
INFO    : Removed keyword 'MaxDisk=30000MB'.
INFO    : Added 'MaxDisk=30000MB' to the route section.
INFO    : Written modified inputfile 'm06tzvpp.gjf'.
INFO    : Request a total memory of 26960 MB, including overhead for Gaussian.
INFO    : Request a walltime of 72:00:00.
INFO    : Request 24 to run this job on.
WARNING : No project selected.
INFO    : Written submission script 'm06tzvpp.slurm.bash'.
INFO    : Submitted batch job 1249291
INFO    : g16.submit.sh is part of tools-for-g16.bash 0.2.2 (2019-04-04)

Should probably read:

[...]
INFO    : Request 24 cores to run this job on.
[...]

Support different duration values for the script

It would be nice to instead issuing the default duration in seconds, a suffix (d = days; h = hours; m = minutes) could determine how long the calculation should run (default should remain seconds no prefix needed there):

input normalised/equivalent input
120 2:00
3600 1:00:00
70:0 1:10:00
12:00:00 12:00:00
15m 15:00
1h 1:00:00
1d 24:00:00
... ...

Input geometry with fragment specifications is not recognised be g16.prepare

The following example:

 C(fragment=1)  -1.212436     0.000000    -0.700000
 C(fragment=1)  -1.212436     0.000000    -2.100000
 H(fragment=1)  -2.155537     0.000000    -2.644500
 C(fragment=1)  -0.000000     0.000000    -2.800000
 H(fragment=1)  -0.000000     0.000000    -3.889000
 C(fragment=1)   1.212436     0.000000    -2.100000
 H(fragment=1)   2.155537     0.000000    -2.644500
 C(fragment=1)   1.212436     0.000000    -0.700000
 H(fragment=1)   2.155537     0.000000    -0.155500
 C(fragment=1)  -0.000000     0.000000    -0.000000
 H(fragment=1)  -0.000000     0.000000     1.008000
 C(fragment=2)  -2.468172     0.000000     0.025000
 C(fragment=2)  -3.377499     1.050000    -0.150000
 H(fragment=2)  -3.141724     1.866750    -0.830625
 C(fragment=2)  -4.589935     1.050000     0.550000
 H(fragment=2)  -5.297261     1.866750     0.413875
 C(fragment=2)  -4.893044     0.000000     1.425000
 H(fragment=2)  -5.836145     0.000000     1.969500
 C(fragment=2)  -3.983717    -1.050000     1.600000
 H(fragment=2)  -4.219492    -1.866750     2.280625
 C(fragment=2)  -2.771281    -1.050000     0.900000
 H(fragment=2)  -2.063955    -1.866750     1.036125

will lead to

$ g16.prepare frags.xyz
INFO    : Configuration file '<HOME>/local/tools-for-g16.bash/.g16.toolsrc' applied.
WARNING : No geometry in 'frags.xyz'.
INFO    : g16.prepare.sh is part of tools-for-g16.bash 0.2.0_alpha2 (2019-03-08)

The issue is here:

pattern_element="[A-Za-z]+[A-Za-z]*"

The regex should probably be something like [A-Za-z]+[A-Za-z]?(\([^\)]+\))? and everything else has to be matched after that, too.

testrt shortcut

The testrt utility takes a string as the argument, which is rather inconvenient. It would be nice if there were a shortcut to that utility to test the input file instead, i.e. read the input, extract and normalise the route, check the input, etc.

For example:

$ g16.testroute good-input.gjf
INFO: Route section has no syntax error.
$ g16.testroute good-input.gjf
WARNING: Route section has (a) syntax error(s).
WARNING: (external) [...]

validate_g16_route missing in spinput, but is referred to

INFO    : Configuration file '<HOME>/local/tools-for-g16.bash/.g16.toolsrc' applied.
<<--->>g16.spinput: line 288: validate_g16_route: command not found
WARNING : Syntax error in specified route section:
WARNING : #P BP86/def2SVP
ERROR   : Emergency stop.

g16.submit writes to wrong chkpoint

If the checkpoint file exists, it'll write to <file>.chk.1 instead of <file>.chk.

Probably an issue with checking the file locations, issuing the warning, then using the newly generated name, instead of overwriting it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.