Skip to content

Command line Scripts

Steven E. Wheeler edited this page Jul 11, 2018 · 6 revisions

Table of Contents

Getting Started

The usage help for any script can be easily displayed on the command line, as seen in this example:

$ grab_thermo -h
Usage:
    grab_thermo [options] file1 [file2 file3]

Options:
    -h, --help
        Print this help message and exit

    -o FILENAME, --output FILENAME
        Write output to FILENAME (in csv format)

The output will, by default, be printed to STDOUT, allowing for viewing the changes before committing them to a file or piping to another program. Additionally, output or write options are available for saving to files. In general, the output option writes to a single specified file, while the write option specifies a directory in which to save multiple output files.

Geometry Modification

dihedral

Used to change, set, or print a specified dihedral angle. The change option adjusts the current dihedral by the value supplied, while the set option sets the dihedral angle to a specific value. Degrees is the default unit, but radians can be specified as well by using the radian flag. Multiple change/set/print options can be specified, allowing for multiple changes to a single geometry to be performed at once.

Usage:
    dihedral [options] filename

Options:
    -c ATOM1 ATOM2 ANGLE, --change ATOM1 ATOM2 ANGLE
        Change dihedral about ATOM1-ATOM2 (1-indexed) bond by ANGLE

    -p ATOM1 ATOM2 ATOM3 ATOM4, --print ATOM1 ATOM2 ATOM3 ATOM4
        Print current ATOM1-ATOM2-ATOM3-ATOM4 (1-indexed) dihedral to STDOUT

    -s ATOM1 ATOM2 ATOM3 ATOM4 ANGLE, --set ATOM1 ATOM2 ATOM3 ATOM4 ANGLE
        Set new ATOM1-ATOM2-ATOM3-ATOM4 (1-indexed) dihedral to ANGLE

    -o outfile.xyz, --output outfile.xyz
        Write new geometry output to xyz-file instead of STDOUT

    -r, --radians
        Use radians for ANGLE units (default is degrees)

    -h, --help
        Print this help message and exit

mirror

Used to mirror the coordinates across the plane perpindicular to a chosen cartesian axis.

Usage:
    mirror [options] file [file2 file3 ...]

Options:
    -x x, --axis x
        Specify cartesian axis perpendicular to reflection plane (defaults
        to X).

    -w [directory], --write [directory]
        Write new geometry output to INFILE_mirror.xyz instead of STDOUT.
        Directory defaults to current working directory.

    -h, --help
        Print this help message and exit

genshift

Used to shift the molecule (or a target fragment) by a specified vector. The shift can be repeated multiple times, with a new geometry output for each shift.

Usage:
    genshift [options] -v x y z file1 [file2, file3, ...]

Options:
    -v x y z, --vector x y z
        Shift the molecule (or target fragment) by the vector (x, y, z)

    -n num, --nshift num
        Repeat the shift n times

    -t list, --targets list
        List of atom numbers to shift (1-indexed). Defaults to all atoms.

    -w [directory], --write [directory]
        Write new geometry output to INFILE-NAME_shift_VECTOR.xyz instead of
        STDOUT. Directory defaults to current working directory.

    -h, --help
        Print this help message and exit

rotate

Used to rotate the geometry about the specified cartesian axis. One can either specify an angle to rotate by (with an optional number of repeats), or request a number of equally-spaced rotations.

Usage:
    rotate [options] -x x|y|z -a angle [-n repeat] file [file2 file3 ...]

    rotate [options] -x x|y|z -n rotations file [file2 file3 ...]

Options:
    -x axis, --axis axis
        Specify rotation about x, y, or z axis.

    -a angle, --angle angle
        Specify the angle to rotate.

    -n num, --nrot num
        If used with --angle specified, repeats the rotation NUM times.
        Otherwise, performs NUM equally spaced rotations (implies
        angle=360/num).

    -r, --radians
        Angle specified in radians (default is degrees)

    -w [directory], --write [directory]
        Write new geometry output to INFILE-NAME_rotate_AXIS_ANGLE.xyz
        instead of STDOUT. Directory defaults to current working directory.

    -h, --help
        Print this help message and exit.

genrotate

Used to rotate the geometry about the axis defined by a specified vector. Like the rotate script, allows for an angle (with optional repeats) to be specified, or a number of equally spaced rotations to be requested. Also, allows for only a specific target fragment of the geometry to be rotated (target fragment defaults to all atoms).

Usage:
    genrotate [options] -v x y z -a angle [-n repeat] file [file2 file3 ...]

    genrotate [options] -v x y z -n rotations file [file2 file3 ...]

Options:
    -v x y z, --vector x y z
        The rotation vector defined by the points (0, 0, 0), (x, y, z).
        Should be space separated.

    -a angle, --angle angle
        Rotate by ANGLE degrees.

    -n num, --nrot num
        If used with --angle specified, repeats the rotation NUM times.
        Otherwise, performs NUM equally spaced rotations (implies
        ANGLE=360/NUM).

    -t list, --targets list
        List of atom numbers to rotate (1-indexed). Defaults to all atoms.

    -r, --radians
        Angle specified in radians (default is degrees).

    -w [directory], --write [directory]
        Write new geometry output to INFILE_genrotate_AXIS_ANGLE.xyz instead
        of STDOUT. Directory defaults to current working directory.

    -h, --help
        Print this help message and exit.

rmsd_align

Aligns a target geometry to a reference geometry. One can choose to align only specific atoms, align only heavy atoms, or align all atoms.

Usage:
    rmsd_align [options] [-r reference_atomlist] reference_geom [-t
    target_atomlist] target_geom

    Aligns [specified atoms in] target_geom to [specified atoms in]
    reference_geom.

Options:
    -ha, --heavyatoms
        Only align heavy atoms.

    -r atomlist, --refatoms atomlist
        List of atoms in reference geometry to align to (1-indexed).

    -t atomlist, --targetatoms atomlist
        List of atoms in target geometry to align (1-indexed).

    -o outfile, --output outfile
        Write aligned geometry to OUTFILE instead of STDOUT

    -h, --help
        Print this help message and exit

Substitutions

Allowed substituents for replacement or use as named targets (if supported, see below) are listed in $QCHASM/AaronTools/Subs/subs.

substitute

Used to change substituents. The substituent list can take multiple target=substituent pairs. Additionally, comma-separated lists are allowed for the keys. For example, 1,3,5=Cl will replace the substituents at atoms 1, 3, and 5 with Chlorine. An optional minimize flag is provided, which will rotate the substituent to reduce steric clashes.

Usage:
    substitute [options] -s atom1=sub1 [atom2=sub2 ...] file [file2 ...]

Options:
    -s atom=sub, --sub atom=sub
        Location of substituent (1-indexed) and requested substituent using
        key=value notation.

    -m, --minimize
        Rotate new substituent to minimize LJ potential

    -w [directory], --write [directory]
        Write new geometry output to INFILE-NAME_TARGET-ATOM_SUB-NAME.xyz
        instead of STDOUT. Directory defaults to current working directory.

    -h, --help
        Print this help message and exit

cat_substitute

Similar to substitute, but specifically designed for catalyst geometries. The substitutions are once again specified in target=substituent pairs, and comma-separated lists of targets are allowed. Additionally, the target specified can either be an atom index or a named target. Named targets will replace ALL substituents of that type (e.g.: Me=iPr will replace all methyl groups detected with isopropyl groups). Relative ligand/substrate numbering (instead of the default absolute numbering) can be useful when running through various catalysts with the same ligand— the target numbering only has to be determined once.

Usage:
    cat_substitute [options] [-l|s target=sub ...] file

Options:
    -l target=sub, --ligand target=sub
        Replace target (atom or substituent) on ligand with specified
        substituent

    -s target=sub, --substrate target=sub
        Replace target (atom or substituent) on substrate with specified
        substituent

    -r, --relnum
        Use relative ligand/substrate numbering

    -o outfile, --output outfile
        Output to file instead of STDOUT

    -h, --help
        Print this help message and exit

cat_screen

Used to generate substituent combinations, outputting a file for each. The format for target=substitution pairs can take the following forms:

  • 38=Me,OMe 48=OH,Cl will produce four files, one for each combination of substitutions on the two targets.
  • 38,48=Me,OH will produce only two files, one with methyl groups and one with hydroxyl groups. This version is useful when maintaining symmetry is required.
  • Me=H,iPr,tBu Cl=F,Br,I will produce nine files, replacing all detected methyl groups and all detected chloro groups with combinations of the substituents requested.
As with cat_substitute above, relative ligand/substrate numbering is allowed.
Usage:
    cat_screen [options] [-l|s target=sub ...] file

Options:
    -l target=sub1[,sub2,... target2=sub3,sub4,...]
        --ligand target=sub1[,sub2,... target2=sub3,sub4,...]

    -s target=sub1[,sub2,... target2=sub3,sub4,...]
        --substrate target=sub1[,sub2,... target2=sub3,sub4,...]

    -r, --relnum
        Use relative ligand/substrate numbering instead of absolute
        numbering

    -w [directory] --write [directory]
        Save files instead of printing to STDOUT. Will be saved to
        directory, if provided (defaults to current directory).

    -h, --help
        Print this help message and exit

map_ligand

Used to map a new ligand onto a reference catalyst structure. The target ligand specified should be found in the AaronTools/Ligand library (no need to put the .xyz extension). Multiple ligands can be specified.

Usage:
    map_ligand [options] reference_structure -l target_ligand [second_target ...]

Options:
    -l target_ligand, --ligand target_ligand
      Specify ligands to map to reference structure.

    -w [directory], --write [directory]
        Save files instead of printing to STDOUT. Defaults to current
        directory.

    -h, --help
      Print this help message and exit.

Data/Structure Export Utilities

angle

 Usage:
     angle [options] -a atom1 atom2 atom3 filename
 
 Options:
     -a, --atoms
         Specify the atoms to find the angle between
 
     -r, --radians
         Use radians for ANGLE units (default is degrees)
 
     -h, --help
         Print this help message and exit

grab_thermo

 Usage:
     grab_thermo [options] file1 [file2 file3]
  
 Options:
     -o FILENAME, --output FILENAME
         Write output to FILENAME (in csv format)
 
     -h, --help
         Print this help message and exit

grab_coords

 Usage:
     grab_coords filename
     
     Extracts final geometry from <filename> and prints as XYZ coordinates

libadd_ligand

Adds the ligand from the xyz file to the user's local ligand library. The xyz file must be formatted properly to allow for component detection by AaronTools (see Building a TS Library).

Usage:
    libadd_ligand -n name file

Options:
    -n name, --name name
        The name the ligand should be saved under (without the path or file
        extention). If unsupplied, will simply print to STDOUT

    -h, --help
        Print this help message and exit

libadd_substituent

Saves a new substituent to the user's local ligand library. The target atom should be the substituent atom that attaches to the rest of the structure. The avoid atom is the atom the substituent is attached to in the rest of the structure.

Conformer information must be supplied, specifically the number of conformers for that substituent and the angle of rotation between each conformer. For example, the built-in phenyl ligand produces two conformers, with the second rotated 90 degrees relative to the first. This would be called as -c 2 90 on the command line.

Usage:
    libadd_substituent [-n name] -t target -a avoid -c nconf rotangle
    filename

Options:
    -t atom, --target atom
        The index of the substituent atom connected to the rest of the
        geometry

    -a atom --avoid atom
        The index of the atom that the substituent connects to

    -c nconfs rotangle, -conf nconfs rotangle
        The number of conformers and the rotation angle (in degrees) used to
        generate each

    -n name, --name name
        The name the substituent should be saved under (without the path or
        file extention). If unsupplied, will simply print to STDOUT

    -h, --help
        Print this help message and exit
Clone this wiki locally