Skip to content

Command line Scripts

ajs99778 edited this page Oct 25, 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 [-f], --output FILENAME [--force]
        Write output to FILENAME (in csv format). Optionally, force
        overwrite if file already exists.

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. Additionally, the output option takes an optional force option, which silently overwrites the specified file, if it exists. Omission of this flag will present an interactive prompt to handle overwrites or renaming if the file exists.

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 [-f], --output outfile.xyz [--force]
        Write new geometry output to xyz-file instead of STDOUT. Optionally,
        force overwrite if file exists.

    -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 perpendicular to a chosen Cartesian axis. If no axis is provided, the x-axis is assumed.

Usage:
    mirror [options] file

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

    -o FILENAME [-f], --output FILENAME [--force]
        Write new geometry to FILENAME instead of STDOUT. Optionally, force
        overwrite if file already exists.

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

genshift

Used to shift the molecule (or a target fragment) by a specified vector. The vector can be specified as a vector of Cartesian coordinates (-v 1.2 0 -0.6). Additionally, the index of a specific atom can be supplied (-v 31), and the shift vector will be applied such that it is centered to the origin. Similarly, a bond can be centered to the origin by specifying two atom indices (-v 31 32).

The default is to shift all atoms, however a specific fragment to shift may be specified using the -t or --target option. The target list should be comma-separated atom-indices or ranges (eg: 1,2,9-11).

Usage:
    genshift [options] -v (x y z | a | a1 a2) file

Options:
    -v (x y z | a | a1 a2), --vector (x y z | a | a1 a2)
        Shift the molecule (or target fragment) by the vector (x, y, z), or
        center a specified atom (a) or bond (a1 a2) to the origin
        (1-indexed)

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

    -o outfile -f, --output outfile --force
        Write updated geometry to outfile, optionally forcing overwrite if
        the file already exists.

    -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. The genrotate command below allows for the use of an arbitrary vector or rotation, instead of just a Cartesian axis.

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

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

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, genrotate allows for an angle (with optional repeats) to be specified, or a number of equally spaced rotations to be requested. Also, it allows for only a specific target fragment of the geometry to be rotated (target fragment defaults to all atoms).

Similar to the genshift command above, the vector can be specified either in Cartesian coordinates (-v 1.2 0 3.6) or by a bond (-v 31 32). Additionally, the <code>--target option allows for selection of specific atoms to rotate (eg: -t 2-6,9,11-13). Rotation about a bond can be quite useful when combined with the target atom list, as this would, for example, allow for the rotation of a substituent group about it's bond to the rest of the molecule.

Usage:
    genrotate [options] -v (x y z | a1 a2) -a angle [-n repeat] file

    genrotate [options] -v (x y z | a1 a2) -n rotations file

Options:
    -v (x y z | a1 a2), --vector (x y z | a1 a2)
        The rotation vector defined by the points (0, 0, 0), (x, y, z), or
        defined by the vector from a1 to a2 (1-indexed atoms). 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. Additionally, the --change-order option will attempt to find the best alignment by systematically reordering the atoms (this will not affect the atom order in the output file). Additional information can be found in the Introduction to Aaron: Command Line Scripts tutorial.

Usage:
    rmsd_align [options] reference_geom target_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).

    -c, --change-order
        Tries reordering atoms to find best RMSD alignment. Use only for
        small systems, large systems should use the atom list method, above.

    -o FILENAME [-f], --output FILENAME [--force]
        Write aligned geometry to file instead of printing to STDOUT.
        Optionally, force overwrite if file already exists.

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

make_conf

Used to apply rotations to specified substituents to generate the initial structure for different conformers. This applies AaronTools' rules for creating conformers. The specified substituents must be in the AaronTools substituent library or be buildable from known substituents (info on buildable substituents can be found on the Creating a New Substituent Type page). This does not assume the substituent atoms are ordered the same as the corresponding substituent from our library.

Usage:
    make_conf [options] -c n[,m,l,...] -s atom1=sub1 [atom2=sub2 ...] file

Options:
    -a, --available
        List available substituent names and exit

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

    -c, --conformer
        Apply substituent rotations to generate the nth conformer of the
        input molecule

    -w [directory], --write [directory]
        Saves files instead of print to STDOUT. Will be saved to
        <directory>, if provided (defauls to current working directory).

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

Substitutions

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.

See Introduction to AaronTools: Command Line Scripts for more details.

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

Options:
    -a, --available
        List available substituent names and exit

    -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

    -o outfile [f], --output outfile [--force]
        Save the new geometry to <outfile>. Optionally, force overwrite if
        <outfile> already exists.

    -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.

See Introduction to AaronTools: Command Line Scripts for more details.

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

Options:
    -a, --available
        List available substituents and exit

    -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 [-f], --output outfile [--force]
        Output to file instead of STDOUT. Optionally, force overwrite if
        file exists

    -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.

See Introduction to AaronTools: Command Line Scripts for more details.

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

Options:
    -a, --available
        List available substituents

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

        Run through substitution combinations, outputing a file for each.
        For example, -l 3=Me,Ph 4=OMe,tBu will generate 4 files: 3=Me,4=OMe;
        3=Me,4=tBu; 3=Ph,4=OMe; and 3=Ph,4=tBu

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

        Same as ligand flag above, but for substrate substitutions

    -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 or in the personal Aaron_libs/Ligand library (no need to put the .xyz extension).

Usage:
    map_ligand [options] reference_structure -l target_ligand

Options:
    -l target_ligand, --ligand target_ligand
        Specify ligands to map to reference structure. Must be an Aaron
        ligand xyz file. Use libadd_ligand to add new ligands to your
        personal library.

    -o FILENAME [-f], --output FILENAME [--force]
        Save new geometry to FILENAME instead of printing to STDOUT.
        Optionally, force overwrite if file already exists.

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

Data/Structure Export Utilities

angle

Prints a specified angle to STDOUT. Default unit is degrees, but radians can be requested using the --radians flag.

 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

Grabs the thermochemistry data from a Gaussian output file and also computes Grimme's Quasi-RRHO free energy. Multiple output files may be specified. The default is to print to STDOUT, but by using the --output flag, a csv formatted file will be produced instead.

Usage:
    grab_thermo [options] file1 [file2 file3]

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

    -o FILENAME [-f], --output FILENAME [--force]
        Write output to FILENAME (in csv format). Optionally, force
        overwrite if file already exists.

grab_coords

Extracts the final coordinates from a Gaussian output file, Gaussian input file, xyz file, or pdb file and outputs them in xyz format.

Usage:
    grab_coords [options] filename

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

    -o FILENAME [f], --output FILENAME [--force]
        Write output to FILENAME (in xyz format). Optionally, force
        overwrite if FILENAME exists

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 Creating a New Ligand Type).

Usage:
    libadd_ligand [-f] -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

    -f, --force
        Force overwrite if ligand already exists in $HOME/Aaron_libs/Ligands

    -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.

See Creating a New Substituent Type for more details.

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