cspy-opt command

The cspy-opt command can be used to perform crystal structure optimisations on one or several input crystal structures using DMACRYS.

cspy-opt [-h] [--basis-set BASIS_SET] [--method METHOD]
         [-p {fit,fit_disponly,fit_reponly,w99,fit_water_X,Day_halobenzenes,w99_orig_Halogens,w99_orig_H,w99rev_6311,w99rev_6311_s,w99rev_631,w99rev_pcm_6311,w99_s_cl,w99sp,w99rev_pcm_6311_and_Chloride,w99rev_pcm_6311_and_Bromide,w99rev_pcm_6311_and_Iodide,w99rev_pcm_6311_and_Halides,isoPAHAP,PAHAP,nothing,gaff2_LJ,gaff2_fit}]
         [--charges CHARGES] [--cutoff CUTOFF] [--multipole-rank MULTIPOLE_RANK]
         [--mulfit-rank MULFIT_RANK] [--mulfit-method {cumulative,overall}] [--MAXI MAXI]
         [--single-point] [--multipole MULTIPOLE] [--axis AXIS]
         [--reorder-atoms-if-high-rmsd] [--reorder-method {molecular_axis,rdkit}]
         [--dmacrys-timeout DMACRYS_TIMEOUT] [--log-level {INFO,DEBUG,WARN,ERROR}]
         [--outputs] [--cleanup] [--no-cleanup] [--gaussian-cpus GAUSSIAN_CPUS]
         [--gaussian-mem GAUSSIAN_MEM] [--calculation-type {dmacrys,dftb,mace,vasp}]
         [--lattice-opt] [--vasp-calc] [--mace-calc]
         [--mace_model {mace_mp,mace-off,mace_anicc,/path/to/custom/mace.model}]
         [--dma-switch DMA_SWITCH] [--pcm PCM] [--conformation]
         crystal_structures [crystal_structures ...]

positional arguments

options

  • -h, --help - show this help message and exit

  • --basis-set BASIS_SET, -b BASIS_SET - Basis set for Gaussian09 calculation (a string passed verbatim into Gaussian input file, e.g. 6-311G**) (default: cc-pVTZ)

  • --method METHOD, -m METHOD - Method for Gaussian09 calculation (a string passed verbatim into Gaussian input file, e.g. B3LYP (default: PBEPBE)

  • -p POTENTIAL, --potential POTENTIAL - intermolecular potential name (default: fit)

  • --charges CHARGES - Charges of each molecule for G09 calculation

  • --cutoff CUTOFF - dmacrys real space/repulsion-dispersion cutoff (default: calculate)

  • --multipole-rank MULTIPOLE_RANK, -r MULTIPOLE_RANK - Maximum angular momenta for DMA (default: 4)

  • --mulfit-rank MULFIT_RANK - Maximum angular momenta for MULFIT

  • --mulfit-method MULFIT_METHOD - Method for fitting in MULFIT (default: cumulative)

  • --MAXI MAXI - Max number of iterations to use in DMACRYS (default: 1000)

  • --single-point - Calculate a single point energy (don’t optimize)

  • --multipole MULTIPOLE - Multipole file to be used in the calculations

  • --axis AXIS - Axis file to be used in the calculations

  • --reorder-atoms-if-high-rmsd - Try to reorder atoms to match multipoles if the multipole matching returns high RMSD (> 1e-3)

  • --reorder-method REORDER_METHOD - Method to reorder atoms if high RMSD is detected (default: molecular_axis)

  • --dmacrys-timeout DMACRYS_TIMEOUT - Timeout for dmacrys calculations (default: 1200.0)

  • --log-level LOG_LEVEL - Logging verbosity (default: INFO)

  • --outputs - Write the dmacrys output files to the working directory

  • --cleanup - Remove intermediate files (fchk, individual dma files)

  • --no-cleanup - Don’t remove intermediate files (fchk, individual dma files)

  • --gaussian-cpus GAUSSIAN_CPUS, -j GAUSSIAN_CPUS - Number of cpus for G09 (default: 2)

  • --gaussian-mem GAUSSIAN_MEM - Memory setting for G09 (default: 2GB)

  • --calculation-type CALCULATION_TYPE -

    Specify the type of calculation to perform. Options include:

    dmacrys: Perform a dmacrys calculation, dftb: Perform a dftb calculation, mace: Perform a mace calculation, vasp: Perform a vasp calculation.

    (default: dmacrys)

  • --lattice-opt - Perform a full lattice optimisation with dftb

  • --vasp-calc - Perform calculation on the first molecule of the crystal structure. Vacuum=20

  • --mace-calc - Use this flag when running a dftb calculation to perform a full lattice optimisation

  • --mace_model MACE_MODEL - Mace pre-trained model to use. (default: mace_mp)

  • --dma-switch DMA_SWITCH - dma switch (default: 4)

  • --pcm PCM - Use PCM model (default: )

  • --conformation - Perform calculation on the first molecule of the crystal structure. Vacuum=20

Note

If a set of multipole files are not provided, then the cspy-opt command will invoke the same functions that are used by the cspy-dma command to perform distributed multipole analysis. To do this, a .fchk file will be generated using Gaussian with the basis set and level of theory read from the relevent optional arguments (–basis-set and –method)

Note

The positional argument crystal_structures can be in either SHELX or CIF format. Furthermore, several files can be listed sequentially in order to perform optimisations on each crystal structure. However, the cspy-opt command is not parallelised over crystal structures, hence, these optimisations will happen in serial.

Crystal structure optimisation with DMACRYS

Below is an example of the cspy-opt command:

cspy-opt test.res --basis-set '6-311G**' --method 'PBE1PBE' -j 4 # Use four CPU cores for the gaussian calculation

If the user already possess a set of multipoles for the input crystal structure, these can be specified using the --multipole flag which will read the file and bypass a new DMA calculation:

cspy-opt test.res --multipole test.dma

Note

Optimisation settings for cspy-opt are less flexible than those in cspy-csp. Be aware that, if using cspy-opt with DMACRYS, settings written within a cspy.toml file may not be implemented as expected.

Crystal structure optimisation with dftb+

The cspy-opt command is not limited to DMACRYS optimisations and can also be used to perform single-point energy calculations or crystal structure re-optimisations using dftb+. To perform these calculations, the user should ensure that they have downloaded dftb+ and make sure it is located in their $PATH variable. For more info, please visit the dftb+ github repository using the following link.

In order to customise the type of calculation and simulation parameters used in the dftb+ calculation, it is useful to include a cspy.toml file in the working directory such as the one below:

[[csp_minimization_step]]
kind = "dftb"

[dftb]
max_steps = 2500
max_force = 0.00058
kpoint_spacing = 0.05
scc_tol = 1e-5
timeout = 3600
single_point =  false         # Bool to control whether we run a single-point energy calculation
atomic_pos_opt =  false       # Bool to control whether we run a geometry optimisation on the atomic positions
lattice_and_atoms_opt =  true # Bool to control whether we run a geometry optimisation on the atomic positions and lattice parameters

Please note that there are a number of different keywords that can be specified under the [dftb] header. The defaults for these can be found in cspy/configuration.py

The user can start the calculation with the following command:

cspy-opt test.res --dftb-calc

This will create a Crystal object from the test.res file and then use this to create the necessary input files for the dftb+ calculation. These are run inside a temporary folder that is created in /dev/shm. Should the user wish to keep the output files, the --outputs flag should be included which will copy these from the temporary folder to the working directory.