Author Topic: Automatimg Define  (Read 11274 times)

ym21d@fsu.edu

  • Jr. Member
  • **
  • Posts: 10
  • Karma: +0/-0
Automatimg Define
« on: May 19, 2023, 08:25:22 PM »
I am using turbomole through the program PuTTY, which uses Unix line commands. I am trying to automate my workflow as much as possible. Is there a way that I can use the Unix line commands to utomate calling define movimg through each step, making the selections I want. Or, is there another way of automating define?
Thank you,

antti_karttunen

  • Sr. Member
  • ****
  • Posts: 229
  • Karma: +1/-0
Re: Automatimg Define
« Reply #1 on: May 20, 2023, 11:27:39 AM »
Hi,

sure, you can feed define any input with the standard approach in Unix:
Code: [Select]
define < define.in
where define.in contains the commands for define.

Define sessions can be "recorded" easily with the tee command, please see the script below for an example.

Best wishes,
Antti

Code: [Select]
#!/bin/bash
# defrec: Record define session to file for later usage

OUTNAME=define.in

program_usage(){
cat <<EOF

*****************************************************************
*    defrec: Record define session to file for later usage      *
*****************************************************************

Usage: defrec

- defrec records all commands given to define into file $OUTNAME
- After finishing define, interupt defrec with Ctrl+C
- The command file can then be executed in another job directory:

  define < $OUTNAME

- Useful when you need to construct many similar Turbomole jobs.

EOF
}

# Check parameters
while [[ $# -gt 0 ]]
do
  case "$1" in
    "-h" | "-help" | "--help" ) program_usage ; exit 1 ;;
    *  ) program_usage ; exit 1 ;;
  esac
done

tee $OUTNAME | define


Michael_Patzschke

  • Jr. Member
  • **
  • Posts: 13
  • Karma: +0/-0
Re: Automatimg Define
« Reply #2 on: April 16, 2025, 12:44:23 PM »
Hei Antti,

that was very useful. Thank you! Is it possible to automate the cosmoprep routine as well?

Best wishes,
Michael

Michael_Patzschke

  • Jr. Member
  • **
  • Posts: 13
  • Karma: +0/-0
Re: Automatimg Define
« Reply #3 on: April 16, 2025, 12:49:28 PM »
Well I answer it myself. It is possible with cosmoprep < prep.in Where prep.in can be similarly recorded with the script provided by Antti!

uwe

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 592
  • Karma: +0/-0
Re: Automatimg Define
« Reply #4 on: April 16, 2025, 04:44:36 PM »
Hi,

why do you want to use define if you want to create automated inputs?

Instead of creating a define input and piping it into define, it is much easier to write a simple control file which is independent of your molecular structure. Like this one:

Code: [Select]
$coord file=coord
$atoms
  basis = def2-TZVP
$dft
  functional pbe
$rij
$marij
$cosmo
$cosmo_out file=out.cosmo
$end

This is for a RI-DFT input using COSMO with default settings. Place the coord file to the same directory and call jobex or ridft for a geometry optimization or a single-point energy calculation.

Or do you plan to use some specialties which only define is able to do?

Best Regards, Uwe

Michael_Patzschke

  • Jr. Member
  • **
  • Posts: 13
  • Karma: +0/-0
Re: Automatimg Define
« Reply #5 on: April 17, 2025, 11:58:08 AM »
Thank you for the reply.

How would I account for different spin multiplicities in such an input?

uwe

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 592
  • Karma: +0/-0
Re: Automatimg Define
« Reply #6 on: April 17, 2025, 12:41:10 PM »
Hello,

a good starting point is the Turbomole tutorial (not the documentation, tutorial is named tutorial_turbomole.pdf in the DOC directory), one of the first chapters is named "The s[ai]mple input".

As define is not used to generate start orbitals the molecular charge and optionally the number of
unpaired electrons (1 for doublet, 2 for triplet, etc.) can be added by using the $eht keyword:
     $eht charge=<n>
     $eht charge=<n> unpaired=<m>
Examples:
     $eht charge=-1
     $eht charge=2 unpaired=1


Please note that when starting a job directly from a short control file some tasks will be done automatically:
  • symmetry is checked and activated if found, similar to running desy in define. If you do not want to use symmetry by default, add
    $symmetry c1
    to the input control file
  • a closed shell occupation is taken by default for even number of electrons, also similar to what define is doing - to enforce unrestricted calculations, add
    $uhf
    to the control file
  • for geometry optimizations internal redundant coordinates are automatically generated
  • energy and gradient results are directly written to the control file, so when I script Turbomole, I always add $energy and $grad to avoid getting a long control file:
    $energy file=energy
    $grad file=gradient

  • to freeze orbitals add $freeze with the energy window to define which ones to freeze
    $freeze
      fpc=-3.0 fpv=50.0

    will freeze orbitals with energies below -3.0 Hartree and larger than +50.0 Hartree

Hope this helps. Please report any issues using this way to write input!

Best wishes