cspy-opt command

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

cspy-opt [-h] [--basis-set BASIS_SET] [--method METHOD]
         [-p {fit,fit_boron,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_Halides,isoPAHAP,PAHAP}]
         [--charges CHARGES] [--cutoff CUTOFF] [--multipole-rank MULTIPOLE_RANK]
         [--mulfit-rank MULFIT_RANK] [--mulfit-method {cumulative,overall}] [--MAXI MAXI]
         [--single-point] [--multipole MULTIPOLE] [--axis AXIS]
         [--dmacrys-timeout DMACRYS_TIMEOUT] [--log-level {INFO,DEBUG,WARN,ERROR}]
         [--outputs] [--cleanup] [--no-cleanup] [--gaussian-cpus GAUSSIAN_CPUS]
         [--gaussian-mem GAUSSIAN_MEM] [--dma-switch DMA_SWITCH] [--pcm PCM] [--dftb-calc]
         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 Gaussian calculation (a string passed verbatim into Gaussian input file, e.g. 6-311G** (default: 6-311G**)

  • --method METHOD, -m METHOD - Method for Gaussian 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 to be read by Gaussian.

    For example, a salt like NaCl would be specified as "+1 -1"

  • --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) with DMACRYS

  • --multipole MULTIPOLE -

    Multipoles file to be used in a DMACRYS calculation.

    If not specified, a new axis will be created

  • --axis AXIS -

    Axis file to be used in a DMACRYS calculation.

    If not specified, a new axis will be created

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

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

  • --outputs - Write the final 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 to run Gaussian (default: 2)

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

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

  • --pcm PCM - Instructs Gaussian to use a PCM model with epsilon set to the specified value.

  • --dftb-calc - Perform a dftb calculation instead of using DMACRYS

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 arguements (–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

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.