ABCluster User Manual Version 2.1

for the global optimization of chemical clusters

by Jun Zhang

more information: http://www.zhjun-sci.com/software-abcluster-download.php

Contents

Contents i

1 Introduction1 1.1 What is ABCluster?...... 1 1.2 Program Citation...... 1 1.3 Contacting the Author...... 2 1.4 Copyright and Disclaimer...... 2 1.5 Files of ABCluster...... 2 1.6 Installation of ABCluster...... 3 1.6.1 For Windows Users...... 3 1.6.2 For and Mac OS X Users...... 3 1.6.3 For Linux and Mac OS X Users: Possible Issues...... 4 1.6.4 For OpenMP...... 4 1.6.5 If you see Incorrect format near ...... 4 1.7 Support ABCluster...... 4

2 Theoretical Background5 2.1 Rule of Thumb...... 5 2.2 Choose Your Cluster and Potential Energy Function...... 5 2.2.1 When does Force Field Perform Well?...... 5 2.2.2 When Must be Used?...... 6 2.2.3 Some Force Fields Preferred by Physicists...... 6 2.3 The Artificial Bee Colony Algorithm...... 6 2.4 Interfaces to Third-party Programs...... 7

3 Rigid Molecular Clusters with Force Fields9 3.1 Introduction...... 9 3.2 Example 1: (H2O)6 ...... 10 + + + 3.3 Example 2: Li , Na and Cs in (C6H6)6 ...... 12 3.4 Example 3: (CH2 –CH2)13 and Build New Force Fields...... 14 3.5 Example 4: HNO3(H2O)10 in an Electric Field...... 16

4 Optimization with Third-party Programs: isomer 19 4.1 Introduction...... 19 4.2 isomer with ...... 19 4.2.1 Configuration of Gaussian...... 19 + 4.2.2 Example 1: Al3O4 ...... 20 4.2.3 More About optfile ...... 22 4.2.4 Example 2: Au6 ...... 23 4.3 ABCluster Interfaces with Third-Party Programs...... 26 4.4 Clusters with Specific Point Group Symmetry...... 27

i ii CONTENTS

4.4.1 Point Group Grammar...... 28 4.4.2 Example 3: Au20 under Point Group Symmetries...... 28

5 Optimization with Third-party Programs: lego 31 5.1 Introduction...... 31 5.2 lego by Itself: Generate Complex Clusters...... 31 5.2.1 Preparation...... 31 5.2.2 Example 1: Na4(SO4)2(H2O)300 ...... 34 5.2.3 Example 2: (H2O)1000(C6H5CCH)150 ...... 35 5.2.4 Example 3-9: All Structural Features...... 36 5.3 lego with Gaussian...... 44 – 5.3.1 Example 10: (IO3 )(H2O)4 ...... 44 – 5.3.2 Example 11: ((NH3)4 )...... 46 5.3.3 Theoretical Background...... 47 5.4 lego with xTB...... 48 2+ 5.4.1 Example 12: Au8(PPh3)7 ...... 48 5.4.2 Example 13: Co6Te8(PEt3)6 ...... 50 5.4.3 Theoretical Background...... 52 5.5 lego with CP2K...... 53 5.5.1 Example 14: Au8 on O-Defected Rutile (110) Surface...... 53 5.5.2 Theoretical Background...... 55 5.6 lego with Gromacs...... 55 5.6.1 An Additional Input Option in inp File...... 56 5.6.2 Example 15: A Reversed Micelle of POPC...... 56 5.6.3 Example 16: Two Layers of POPC...... 58 5.6.4 Theoretical Background...... 59 5.7 lego with Lammps...... 60 5.7.1 Example 17: Ni38(CO)36 ...... 60 5.7.2 Theoretical Background...... 62 5.8 lego with NWChem, ORCA, MOPAC...... 62 5.9 lego with DMol3...... 63 5.10 Energy Boundary Setting...... 63 2− 5.10.1 Example 18: EMIM3Cl5 ...... 63 5.11 lego with More Programs...... 66

6 Atomic Clusters with Force Fields 69 6.1 Introduction...... 69 6.2 Example 1: 38 Lennard-Jones Particles...... 72 6.3 About abcinp ...... 72 Q+ Q− 6.4 Example 2: (Mg O )20 ...... 75 6.5 Example 3: Silve and Copper Clusters...... 76 6.5.1 Ag38 and Cu38 ...... 76 6.5.2 Ag32Cu6 ...... 77 6.6 Example 4: Perovskite Clusters (CaTiO3)5 ...... 77 6.7 Example 5: C16 and Ge16 Clusters...... 78

A Version History 81

Bibliography 83 Chapter 1

Introduction

I know that many people (including me) are very reluctant to read lengthy and tedious manuals, thus the manual is kept as short as possible. If you want to start as soon as possible, please go over Contents and just read Chapter2 and the sections starting with “Examples”.

1.1 What is ABCluster?

Briefly, ABCluster searches the global as well as the local minima of atomic and molec- ular clusters. ABCluster is a program developed by Dr. Jun Zhang to perform the global opti- mization of atomic and molecular clusters. It is an efficient and user-friendly program. It is designed in a way that non-experts, as well as experts, can perform a global op- timization readily without knowing too much about the internal algorithms, being a black-box. The latest version of ABCluster and related resources can be obtained online:

http://www.zhjun-sci.com/software-abcluster-download.php

ABCluster has been applied to a lot of realistic chemical problems by many authors, please refer to:

http://www.zhjun-sci.com/software-abcluster-stories.php

ABCluster uses very efficient global optimization algorithm, i.e. “the artificial bee colony algorithm”, which was developed in 2005, to perform the search. The algorithm has been modified and improved specifically for chemical problems. ABCluster supports a large number of force fields by itself, and also provide interfaces for any other third- party programs, meaning that ABCluster is able to generate reasonable initial structures of complex topology quickly by itself and also can generate optimized cluster structures using highly accurate ab initio quantum chemistry methods!

1.2 Program Citation

For any published works using ABCluster please include the following references:

Zhang, J.; Dolg, M. ABCluster: The Artificial Bee Colony Algorithm for Cluster Global Optimization. Phys. Chem. Chem. Phys. 2015, 17, 24173–24181.

1 2 CHAPTER 1. INTRODUCTION

Zhang, J.; Dolg, M. Global Optimization of Clusters of Rigid Molecules Using the Artificial Bee Colony Algorithm. Phys. Chem. Chem. Phys. 2016, 18, 3003–3010.

Zhang, J.; Glezakou, V.-A.; Rousseau, R.; Nguyen, M.-T. NWPEsSe: An Adaptive-Learning Global Optimization Algorithm for Nanosized Cluster Systems. J. Chem. Theory Comput. 2020, 16, 3947–3958.

1.3 Contacting the Author

If you have any bug reports, comments, suggestions or the possibility of cooperation on ABCluster, please feel free to contact to Dr. Jun Zhang via E-mail:

[email protected]

1.4 Copyright and Disclaimer

ABCluster is Copyright c 2015-2019 Jun Zhang. ABCluster is free of charge to non- profit academic use. The use of ABCluster in commercial packages is not allowed without a prior written commercial license agreement. The following codes used by ABCluster have special restrictions:

• libLBFGS (see http://www.chokkan.org/software/liblbfgs) libLBFGS is the C realization of the limited-memory Broyden–Fletcher–Goldfarb– Shanno (L-BFGS) method[1]. It is Copyright c 2002-2014 Naoaki Okazaki. libLBFGS is distributed under the term of the MIT license.

• Boost (see http://www.boost.org) Boost is a set of C++ libraries. It is Copyright c 2004-2006 Joe Coder. Boost is distributed under the Boost Software License, Version 1.0.

1.5 Files of ABCluster

When you download ABCluster and unzip it, you can get several files:

• rigidmol-optimizer For the global optimization of rigid molecular clusters with CHARMM-like force fields.

• isomer For the global optimization of atomic clusters with third-party programs.

• lego For the global optimization or fast initial structure guess of any clusters with third-party programs.

• atom-optimizer For the global optimization of atomic clusters using empirical force fields.

• abcinp For Generating input files for atom-optimizer.

• xyz2gaussian A small program for ABCluster using Gaussian.

• gaussian2xyz A small program for ABCluster using Gaussian.

• manual.pdf The user manual of ABCluster.

• misc/atomic-force-field.txt Some collected parameters for atom-optimizer. 1.6. INSTALLATION OF ABCLUSTER 3

• misc/dmol34abcluster.sh A script for ABCluster using DMol3 (Courtesy of Prof. Dr. Lei Ma and Mr. Kai Wang, Tianjin International Center for Nanopar- ticles and Nanosystems (TICNN), http://ticnn.tju.edu.cn).

• misc/mopac4abcluster.sh A script for ABCluster using MOPAC.

• misc/nwchem4abcluster.sh A script for ABCluster using NWChem.

• misc/orca4abcluster.sh A script for ABCluster using ORCA.

• misc/cp2k4abcluster/* Scripts for ABCluster using CP2K.

• misc/gromacs4abcluster/* Scripts for ABCluster using Gromacs.

• misc/lammps4abcluster/* Scripts for ABCluster using Lammps.

• testfiles This folder contains all test input files.

Attention: From ABCluster 2.1, a part of functionality of lego has been moved to another software called NWPEsSe, which could be obtained free of charge from:

https://store.pnnl.gov/content/north-west-potential-energy-surface-search-engine- nwpesse

1.6 Installation of ABCluster

ABCluster does not need to be installed. Please note that the current version of ABClus- ter does not have a graphic user interface (GUI). One must use it in the command line. You can use ABCluster with its absolute path every time. You can also set “PATH” variable to the directory where ABCluster resides.

1.6.1 For Windows Users Assume you put ABCluster (atom-optimizer.exe, etc) in the directory D:\ABCluster, open

Start→Control Panel→System or Security→System then click Advanced System Settings, choose Environment Variables option. In the System variables list, choose Path, then click Edit. In the editbox, add

;D:\ABCluster

(Don’t forget the semicolon “;” !) at the end of the texts in it, and click OK to confirm it.

1.6.2 For Linux and Mac OS X Users Assume you put ABCluster (atom-optimizer, etc) in the directory /home/you/bin/abcluster, then open your .bashrc. At the end of the file, add the statement

export PATH=$PATH:/home/you/bin/abcluster and run the command source ~/.bashrc. 4 CHAPTER 1. INTRODUCTION

1.6.3 For Linux and Mac OS X Users: Possible Issues Sometimes you cannot run ABCluster. If so, try the following ways.

• /usr/lib64/libstdc++.so.6: version ‘GLIBCXX 3.4.21’ not found: Please install or activate a GCC of higher version, like gcc 5.2.0. If you work on a com- puting cluster, maybe you can try module load gcc/5.2.0.

• dyld: Library not loaded: For Mac OS X users, you have to install boost, which can be done with two commands:

/usr/bin/ruby -e "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/ install/master/install)" brew install boost

1.6.4 For OpenMP ABCluster is parallelized by OpenMP. In default, it will use all the CPU cores of the ma- chine on which it is run. If you want to change this behavior, please set OMP NUM THREADS variable to the number of CPU cores you want to use.

1.6.5 If you see Incorrect format near ... Sometimes, if you prepare an input file on Windows and copy it to a Linux or Mac OS X system, ABCluster may not recognize its format and report an error like Incorrect format near .... In this case, please transform the Windows format into Linux format by dos2unix or using :set fileformat=unix in VIM.

1.7 Support ABCluster

ABCluster is a free program and I am working continuously to make it more and more efficient. I would be very appriciated if you could help me improve the program. There are two ways:

• If you have built your own molecular force field files that are absent in ABCluster distribution, I would appreciate if you could send them to me (mailto: ZhangJun- [email protected]).

• While I have provided a lot of interfaces, there are of course a lot of other programs for which interfaces are not provided, like ADF, BigDFT, etc. If you have written one and think it works well, I will be very appreciated if you could send it to me (mailto: ZhangJunQcc@gmail)

I would put them in the next release of ABCluster if you agree. Your contribution will be acknowledged. People share and gain! Thank you! Chapter 2

Theoretical Background

2.1 Rule of Thumb

As a rule of thumb, always use cheaper but reliable methods to do first explo- ration, and then use high-level methods to refine the results! For example, you can use force fields to get 1000 clusters, then use B3LYP-D3/6-31g(d) to optimize 100 lowest energy ones. Finally, for 20 lowest energy, use CCSD(T)/cc-pVTZ to further op- timize them. It is completely unnecessary to compute 1000 one using MP2 or CCSD(T) at the very beginning (unless you have infinite money)! After the global optimization by ABCluster, you will get a global minimum as well as a lot of local minima. Whether the global minimum can interpret experiments re- mains open at this stage. Also, the chemical information may lie not only in the global minimum but also in some local minima. Therefore, please pick up useful structures by your chemical intuition!

2.2 Choose Your Cluster and Potential Energy Function

Before using ABCluster to perform the global optimization of clusters, you should know what type of clusters and potential energy functions you need. In ABCluster, a chemical cluster is ranked by its energy, which, in principle, should be calculated as accurate as possible with quantum chemistry. However, a global opti- mization requires a large number of energy calculations, thus quantum chemistry is often too time-consuming. In contrast, force fields are much faster than quantum chemistry and can be used for large-scale global optimization. However, the accuracy of a force field is uncertain, making the interpretation of the results difficult. Therefore one must make a compromise between efficiency and accuracy. Below are some suggestions.

2.2.1 When does Force Field Perform Well?

For clusters containing ordinary organic, bioorganic and closed-shell inorganic species, the cluster can be described quite well by force fields like CHARMM, OPLS etc. Thus one should use rigidmol-optimizer. Please refer to Chapter3. In such cas- es, using expensive quantum chemistry is unnecessary. However, as mentioned above, the obtained lowest energy clusters must be further optimized and studied using sophis- ticated methods.

5 6 CHAPTER 2. THEORETICAL BACKGROUND

2.2.2 When Must Quantum Chemistry be Used? In these cases, we strongly recommend the use of quantum chemistry although it will be very cost. Thus one should use isomer and lego combined with quantum chemistry programs like Gaussian, CP2k, etc. From ABCluster 2.1, lego is recommended over isomer. Please refer to Chapter4.

+ • Inorganic clusters, like Au13, Al3O4 , Co2(CO)8, the interactions between the structural units (Au and Au, Al and O, Co and CO) are almost covalent. I am not aware of any force field that can calculate their energies accurately. One has to resort to quantum chemistry.

• Clusters with extra, absent electrons or special spin multiplicities, say – (H2O)10 , singlet and triplet CH2(CH3OH)5. Note that “extra, absent electrons” should be understood correctly. For example, sodium cation Na+ is a closed-shell species that can be described quite well by force fields, but sodium atom Na must be treated quantum chemically.

• Periodic systems, like Au10 absorbed on TiO2(110) surface. In these cases, periodicity must be taken into account explicitly. One can consider ABCluster combined with CP2K, VASP, ASE, etc.

• Clusters containing molecules with other non-classical structures.

2.2.3 Some Force Fields Preferred by Physicists People have developed force fields for special purposes for some kinds of atomic clusters. ABCluster supports a lot of them. However, you must be very careful in interpreting the optimization results. In Chapter6 Section 6.1 all the supported force fields are listed. You can use atom-optimizer, however, when you exactly know what you are doing! The parameters of the potentials have to be searched from literature, or fitted by yourself. In the distribution of ABCluster the file misc/atomic-force-field.txt contains some parameters. You can also check ABCluster website for updated ones.

2.3 The Artificial Bee Colony Algorithm

ABClsuter uses the so-called “artificial bee colony” (ABC) algorithm to perform the global optimization. It was proposed by Karaboga in 2005[2] and soon gains a lot of studies and applications in various problems. The ABC algorithm mimics the foraging behavior of bees. ABCluster models this behavior by three kinds of bees: employed bees (EM), onlooker bees (OL) and scout bees (SC). A colony tries to find the best nectar as food source. To do this, EMs perform a first search; OLs based on the knowledge of all EMs perform a further research; SCs have a memory of the previous search results and decide which nectars are of low quality and then discard them. After several cycles of search, the colony can find the best nectar. Now we interpret this model to the algorithm used in ABCluster. For the global optimization of chemical cluster geometry, a trial solution X is the nectar and the smoothed potential energy U is its quality (a lower numeric value indicates a higher quality). The cluster is characterized by its size N, the estimated maximum system size L, and of course the potential parameters. The parameters needed for the ABC algorithm are the following: the size of the population of trial solutions SN, the scout limit glimit, and the maximum cycle number gmax. Here are some typical choices: 2.4. INTERFACES TO THIRD-PARTY PROGRAMS 7

SN 10 to 300 or larger gmax 100 to 100000 or larger glimit 3 to 10 L 1.5 to 3 times larger than the system size

For details of the algorithms used in ABCluster (like explicit formulae), please refer to ABCluster original paper[3]. In the following chapters, we will give a lot of examples. In a real scientific research by ABCluster, you should remember the following tips:

• When the energy calculation is very expensive (like lego+CP2K condensed phase), a better strategy is to perform several optimizations with different initial guesses. For example, it could be more efficient to perform 5 20-step global opti- mizations than to perform 1 100-step global optimization. However, if you are able to do a large number of calculations easily (like using rigidmol-optimizer to do a 10000-step global optimization), then it is not necessary to split the calculations.

• For clusters with short-ranged or multimodal interactions or with multiple interaction sites (like H2O which has two hydrogen bond acceptor and two donor sites), very large gmax and SN are required to get reliable results, e.g. for some clusters with short-ranged Morse potential, gmax = 15000 and SN = 100 are required.

• L can be 1.5 to 3 times larger than system size.

• The parameters for atomic clusters can be obtained from literature. For molecular clusters, one can construct its force field parameters from CHARMM, OPLS or AMBER. Remember the form of equation (3.1.1) and that unit of  and σ is kJ mol−1 and A,˚ respectively! With wrong units, you will get absurd results. Of course, one can design his own parameters. Please visit the ABCluster website for more information.

2.4 Interfaces to Third-party Programs

ABCluster is designed in a way that can be combined with any other quantum chemistry or programs. In misc, one can find interfaces to Gaussian, ORCA, NWChem, MOPAC, xTB, CP2K, DMol3, Gromacs, Lammps. You can write interfaces for any other software you like. Please refer to Section 4.3. 8 CHAPTER 2. THEORETICAL BACKGROUND Chapter 3

Rigid Molecular Clusters with Force Fields

3.1 Introduction

In this chapter, we will discuss how to use rigidmol-optimizer to optimize molecular clusters. In the current version of ABCluster, the molecules in a cluster are assumed to be rigid, meaning that the internal degrees of freedoms (bond lengths, bond angles, dihedral angles, etc.) are kept unchanged during the optimization. For small molecules, this is a very good approximation. Thus each molecule in the cluster can be described by six external degrees of freedoms: the coordinates of its geometrical center R ≡ {X,Y,Z} and three Euler angles Ω ≡ {α, β, γ} relative to its pre-defined body-fixed coordinate system. The potential energy of the rigid molecular cluster is assumed to be of the following form:

N N 2  12  6!! X X X X e qiI qjJ σiI jJ σiI jJ U (Q) = + 4iI jJ − + 4π0 ri j ri j ri j I=1 I

testfiles/rigidmolecularcluster/charmm36 testfiles/rigidmolecularcluster/oplsaa

If you have built your own molecular force field files that are absent in ABCluster distribution, I would appreciate if you could send them to me

9 10 CHAPTER 3. RIGID MOLECULAR CLUSTERS WITH FORCE FIELDS

(mailto: [email protected]) thus I can put them in the next release of ABCluster. Your contribution will be acknowledged. People share and gain! The global optimization of clusters with periodic boundary condition in ABCluster is no longed supported. This part is treated more efficiently with “ABCrystal”, a program being developed by me. Please wait for some time.

3.2 Example 1: (H2O)6

You can find all input and output files in testfiles/rigidmolecularcluster/1-h2o6. We want to know the most stable structure of (H2O)6. We describe water by TIP4P model. This can be done in the following steps. Step 1: Go to the folder testfiles/rigidmolecularcluster. Note that there is a folder charmm36. Step 2: Prepare an input file named h2o6.inp with the following content: h2o6.cluster # cluster file name 20 #populationsize 20 #maximalgenerations 3 #scoutlimit 4. #amplitude h2o6 # save optimized configuration 30 #numberofLMstobesaved

This file is self-explaining: • Line 1: The name of the file that contains the cluster components and geometry. It will be explained in the next step. • Line 2: The size of the population of trial solutions, corresponding to “SN” men- tioned in Chapter2. The larger the cluster, the larger SN is required.

• Line 3: The maximum cycle number, corresponding to “gmax” mentioned in Chap- ter2. For such small systems, 20 is sufficient. For larger ones, perhaps 100000 is required!

• Line 4: The scout limit, corresponding to “glimit” mentioned in Chapter2. Usually 3 to 5 is OK. • Line 5: The estimated size of the cluster in A,˚ corresponding to “L” mentioned in Chapter2. For an efficient optimization of large systems, this value should be 1.5 to 3 times of the system size. • Line 6: The folder name to save the results. • Line 7: The number of local minima to be saved. Step 3: Prepare the cluster file named h2o6.cluster with the following content: 1 charmm36/tip4p.xyz 6 * 4.0000

Here:

• Line 1: The number of different components in the cluster. For (H2O)6 this is 1. + For Na (H2O)3(CH3OH)2, this is 3. 3.2. EXAMPLE 1: (H2O)6 11

• Line 2: The file name (with path, if necessary!) containing the coordinates and force field parameters, and the number of this molecules in the cluster. If there are more than one components in the cluster, then each component should be described by a line like this.

• Line 3: Here, * 4.0000 means generating a random initial guess with L = 4.0000 It can also have another form: 1 charmm36/tip4p.xyz 6 Water hexamer 3.5 7.0 -0.2 1.3 2.9 0.6 4.0 0.9 3.1 4.3 3.2 3.8 -1.8 4.4 1.0 0.8 0.2 0.6 4.2 3.4 3.9 1.9 0.2 3.2 3.6 4.7 2.9 3.6 1.7 1.7 5.1 5.2 -0.6 1.6 2.8 3.5

In ABCluster, as long as the first line after cluster components is not of the form like * 5.000 but anything else (for example, a title), then in the following one has to give an explicit initial guess in the form X, Y , Z, α, β and γ. Step 4: Now we have h2o6.inp and h2o6.cluster. We can run the global opti- mization: rigidmol-optimizer h2o6.inp > h2o6.out When the optimization is finished, we get the following files.

• h2o6.out The main output file.

• h2o6-OPT.cluster The global minimum in ABCluster format. It can only be read by rigidmol-optimizer. Also, it can be used as the initial guess of a new optimization.

• h2o6-OPT.xyz The global minimum in XYZ format. It can be read by, for example, VMD, CYLView.

• h2o6-OPT.gjf The global minimum in Gaussian input format. It can be read by, for example, GaussView.

• h2o6-LM Contains the local minima, each having three files in XYZ, Gaussian input, and ABCluster format, respectively. They are sorted in energy-increasing order, for example, 0.xyz is lower in energy than 13.xyz.

• abcluster*.cluster/xyz/gjf The file containing the currently found global min- imum during the running of rigidmol-optimizer. If rigidmol-optimizer crashes before normal termination, one can use this abcluster*.cluster to restart a new optimization.

Now let us see the result. h2o6.out is almost self-explained. Check out the last few lines: -- Results Report -- * 30 LMs will be saved in [ h2o6-LM ]. # Energy 0 -197.81681061 12 CHAPTER 3. RIGID MOLECULAR CLUSTERS WITH FORCE FIELDS

1 -197.67111685 2 -196.32589567 3 -194.95705153 4 -194.73940685 5 -194.66819086 6 -194.63796574 7 -194.34946345 8 -193.70652479 9 -193.00748943 10 -192.99048439 11 -192.62494819 12 -192.60665614 13 -192.32231800 14 -192.06424252 15 -192.03161537 16 -191.69369684 17 -191.63471955 18 -188.67537914 19 -188.64372639 20 -186.29820469 21 -186.25219262 22 -186.17613529 23 -185.70746332 24 -185.42916087 25 -185.28664778 26 -185.08714771 27 -185.05253489 28 -184.81985899 29 -184.70619909

* Final Global Minimal Energy: -197.81681061 * The Global Minimum is saved as: [ h2o6-OPT.(cluster/xyz/ gjf ) ]

All local minima are listed. For example, file h2o6-LM/21.cluster/xyz/gjf is the cluster having energy of −186.25. Open h2o6-OPT.xyz (the same as 0.xyz), we found that the global minimum is the cage isomer. Open h2o6-LM/2.xyz, we found a local minimum: the prism isomer. See Figure 3.2.1. To get a reliable conclusion on which one is more stable, please use high-level methods like quantum chemistry for further study. Of course, we can play with all 30 local minima!

+ + + 3.3 Example 2: Li , Na and Cs in (C6H6)6

You can find all input and output files in testfiles/rigidmolecularcluster/2-mben. The section title gives three cation-π systems. Let’s see what their global minima look like. Step 1: In the ABCluster distribution, go to the folder testfiles/rigidmolecularcluster. Note that there is a folder charmm36. + Step 2: Optimize Li (C6H6)6. Prepare two files: li-ben.inp and li-ben.cluster: li-ben.cluster # cluster file name + + + 3.3. EXAMPLE 2: LI , NA AND CS IN (C6H6)6 13

Figure 3.2.1: The two minima of (H2O)6.

20 #populationsize 20 #maximalgenerations 3 #scoutlimit 10.00000000 # amplitude li-ben # save optimized configuration 30 #numberofLMstobesaved

2 charmm36/c6h6.xyz 6 charmm36/li.xyz 1 * 10.0000

Then run the optimization: rigidmol-optimizer li-ben.inp > li-ben.out

+ + Step 3: Do the similar thing for Na (C6H6)6 and Cs (C6H6)6. Remember to change the file name from li* to na* or cs*, and in *.cluster, and change charmm36/li.xyz to charmm36/na.xyz or charmm36/cs.xyz. Now let’s open li-ben-OPT.xyz, na-ben-OPT.xyz and cs-ben-OPT.xyz to see their global minima, shown in Figure 3.3.1.

+ + + Figure 3.3.1: The global minima of Li (C6H6)6, Na (C6H6)6 and Cs (C6H6)6.

+ + One can see that in the first solvation shell, Li has only 2 C6H6, but Na and + + + Cs have 5. Morever, the remaining C6H6 is closer to Cs than that to Na . This is obviously related to the charge densities of cations. Maybe you want to see what will 2+ 2– happen for Ca or SO4 . Just try it! ABCluster can do many amazing things! 14 CHAPTER 3. RIGID MOLECULAR CLUSTERS WITH FORCE FIELDS

3.4 Example 3: (CH2 – CH2)13 and Build New Force Fields

You can find all input and output files in testfiles/rigidmolecularcluster/3-c2h413. Now we want to know the global minimum of (CH2 –CH2)13. However, it seems that there is no such file in testfiles/rigidmolecularcluster/charmm36. Therefore we have to build it by ourselves. Step 1: Construct the geometry of CH2 –CH2. An optimization at B3LYP/6-31g(d) level of theory is sufficient for our purpose. The final geometry is stored in a file called c2h4.xyz in XYZ format: 6 ethene C 0.00000000 0.00000000 0.66542300 H 0.00000000 0.92366200 1.23955100 H 0.00000000 -0.92366200 1.23955100 C 0.00000000 0.00000000 -0.66542300 H 0.00000000 -0.92366200 -1.23955100 H 0.00000000 0.92366200 -1.23955100

Step 2: Construct the force field parameters of CH2 –CH2. Since in this manual, we always use CHARMM36 force field, for consistency we also use this for ethene. You can get the lastest CHARMM force field files from:

http://mackerell.umaryland.edu/charmm ff.shtml

At the time this manual is written, the latest version is CHARMM36. After you download toppar c36 aug14.tgz and unzip it, fortunately, there are parameters for ethene. In the file toppar/top all36 cgenff.rtf you find the following words : RESI ETHE 0.00 ! C2H4 ethylene, yin/adm jr. GROUP ATOM C1 CG2D2 -0.42 ! ATOM H11HGA5 0.21! H11 H21 ATOM H12HGA5 0.21! \ / GROUP ! C1=C2 ATOM C2 CG2D2 -0.42! / \ ATOM H21HGA5 0.21! H12 H22 ATOM H22 HGA5 0.21 ! BOND C1 H11 C1 H12 DOUBLE C1 C2 BOND C2 H21 C2 H22 IC H11 C1 C2 H21 1.1036 121.37 180.00 121.37 1.1036 IC H12 C2 *C1 H11 1.1036 121.37 180.00 121.37 1.1036 IC H22 C1 *C2 H21 1.1036 121.37 180.00 121.37 1.1036 IC C1 C2 H21 H22 1.3370 121.37 -180.00 31.37 1.8845 PATCFIRSNONELASTNONE

Take the first line ATOM C1 CG2D2 -0.42 as an example, C1 indicates the corresponding atom; CG2D2 is the atomic type; -0.42 is its q parameter in (3.1.1). To find its  and σ parameters, we check the file toppar/par all36 cgenff.rtf, and find this: CG2D2 0.0 -0.0640 2.0800 ! alkene, yin,adm jr., 12/95 3.4. EXAMPLE 3: (CH2 –CH2)13 AND BUILD NEW FORCE FIELDS 15

-0.0640 and 2.0800 are  and σ, respectively. However, since CHARMM and ABCluster use different formulae, we have to transform them! The transformation formulae are:

ABCluster = CHARMM × (−4.184) (3.4.1)

5 σABCluster = σCHARMM × 2 6 (3.4.2) Thus its final value is: q = −0.42 (3.4.3)  = −0.0640 × (−4.184) = 0.2678 (3.4.4)

5 σ = 2.0800 × 2 6 = 3.7061 (3.4.5) The parameters of H can be found in a similar way:

q = +0.21 (3.4.6)

 = −0.0260 × (−4.184) = 0.1088 (3.4.7)

5 σ = 1.2600 × 2 6 = 2.2451 (3.4.8)

Thus the final molecular force field file c2h4.xyz for CH2 –CH2 is: 6 ethene C 0.00000000 0.00000000 0.66542300 H 0.00000000 0.92366200 1.23955100 H 0.00000000 -0.92366200 1.23955100 C 0.00000000 0.00000000 -0.66542300 H 0.00000000 -0.92366200 -1.23955100 H 0.00000000 0.92366200 -1.23955100 q epsilon (kJ/mol) sigma (AA) -0.42 0.2678 3.7061 # CG2D2 +0.21 0.1088 2.2451 # HGA5 +0.21 0.1088 2.2451 # HGA5 -0.42 0.2678 3.7061 # CG2D2 +0.21 0.1088 2.2451 # HGA5 +0.21 0.1088 2.2451 # HGA5

Note that there is a comment line between the geometry and parameter part. The words after # are comments. Step 3: Now prepare the files c2h413.inp and c2h413.cluster: c2h413.cluster # cluster file name 20 #populationsize 100 # maximal generations 3 #scoutlimit 10.00000000 # amplitude c2h413 # save optimized configuration 30 #numberofLMstobesaved

1 c2h4 . xyz 13 * 10.0000

Step 4: Run the global optimization: 16 CHAPTER 3. RIGID MOLECULAR CLUSTERS WITH FORCE FIELDS

Figure 3.4.1: The global minimum of (CH2 –CH2)13. rigidmol-optimizer c2h413.inp > c2h413.out

The final global minimum has Ci symmetry (in Figure 3.4.1): Before conclusion, we point out that ABCluster supports virtual sites. For example, in TIP4P water, a virtual site exists close to the oxygen atom. The symbol of all virtual sites starts with q. For example, in testfiles/rigidmolecularcluster/charmm36/tip4p.xyz 4 H2O O 0.00000000 0.00000000 0.21451132 qLP 0.00000000 0.00000000 0.06451132 H -0.00000000 0.75695033 -0.37137096 H 0.00000000 -0.75695033 -0.37137096 TIP4P q epsilon (kJ/mol) sigma (AA) 0.000 0.64852 3.1536 # OT -1.040 0.00000 0.0000 # LP +0.520 0.00000 0.0000 # HT +0.520 0.00000 0.0000 # HT qLP is the virtual site. Note that in the output files, all q* will be written in *.xyz but NOT in *.gjf. You can use this feature to design some special force fields.

3.5 Example 4: HNO3(H2O)10 in an Electric Field

You can find all input and output files in testfiles/rigidmolecularcluster/4-electric field. Now you can easily perform a global optimization of the cluster HNO3(H2O)10. For example, you can prepare the input file ef-0.inp and ef-0.cluster as below, and store the local minima in ef-0-LM. ef-0.cluster # cluster file name 30 #populationsize 50 # maximal generations 3 #scoutlimit 10.00000000 # amplitude ef-0 # save optimized configuration 30 #numberofLMstobesaved

2 charmm36/hno3.xyz 1 3.5. EXAMPLE 4: HNO3(H2O)10 IN AN ELECTRIC FIELD 17 charmm36/tip4p.xyz 10 * 10.0000

From ABCluster 2.0, you can add external electric field to the cluster. Now we want to see how the cluster will deform under the influence of electric field. This is very easy! Assume the electric field strength is 0.8 V A˚−1, we prepare the input files called ef-8.inp and ef-8.cluster: Warning: The electic field can only be applied when no charged species exist! ef-8.cluster # cluster file name 30 #populationsize 50 # maximal generations 3 #scoutlimit 10.00000000 # amplitude ef-8 # save optimized configuration 30 #numberofLMstobesaved

2 0.8 charmm36/hno3.xyz 1 charmm36/tip4p.xyz 10 * 10.0000

Note that, the electric field strength F is added in the first line of ef-8.cluster. If it is a single integer like 2, it will indicate that there is no external electric field. If it is an integer and a real number like 2 0.8, it means that F = 0.8 V A˚−1. Now run the global optimization: rigidmol-optimizer ef-8.inp > ef-8.out

We can see that the global minimum is streched along the z direction.

Figure 3.5.1: The GM of HNO3(H2O)10 in an electric field. 18 CHAPTER 3. RIGID MOLECULAR CLUSTERS WITH FORCE FIELDS Chapter 4

Optimization with Third-party Programs: isomer

4.1 Introduction

Besides force fields, ABCluster provides simple but powerful interfaces for any computa- tional chemistry programs, which can be done by isomer and lego. ABCluster has been proven to work well with Gaussian, xTB, DMol3, VASP, etc. Since these calculations are much more expensive than those of force fields, the ABC algorithm is simplified. From ABCluster 2.0, the generation of initial guess has been significantly improved. We will now show how to combine ABCluster with other programs. isomer and lego is designed for atomic and molecular clusters, respectively. From ABCluster 2.1, the functionality of lego has been siginificantly enhanced. As a glob- al optimizer, it can also be used as a fast structure generator for a large number of molecules. In this chapter, we will describe isomer. In Chapter5, we will describe lego.

4.2 isomer with Gaussian

Gaussian is one of the most popular quantum chemistry software, thus we have pro- vided official support for it. In the distribution of ABCluster, you can find two files: xyz2gaussian and gaussian2xyz. They will be used by ABCluster to compute energies with Gaussian.

4.2.1 Configuration of Gaussian If you already know how to configurate Gaussian, you can skip this section. For Windows users: Assume you use Gaussian09 and put it in the directory D:\G09W, then open Start→Control Panel→ System or Security→System, then click Advanced System Settings, choose the Environment Variables option. In the User variables for you list, click New. In the Variable name editbox, write “GAUSS EXEDIR”, and in the Variable value editbox, write“D:\G09W”. Then click OK to confirm it. For Linux and Mac OS X users: Assume you use Gaussian09 and put it in the directory /home/you/g09 and you set the scratch directory for the computation as /scratch/you. then open your .bashrc. At the end of the file, add the statements: export g09root="/home/you/g09" export GAUSS_SCRDIR=/scratch/you source $g09root/g09/bsd/g09.profile

19 20 CHAPTER 4. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: ISOMER

+ 4.2.2 Example 1: Al3O4 You can find all input and output files in testfiles/isomer/1-al3o4. + The first example is what the global minimum of the cluster Al3O4 is. We decide to use B3LYP/6-31g(d) to calculate energies. Now we will do this global optimization. Step 1: In the ABCluster distribution, go to the directory testfiles/isomer. Cre- ate a file called al3o4.inp. For Windows users, the content should be: al3o4 # Result file name Al3O4 #Symbols cube 3 3 3 # Structure types 40 # Maximal number of calculations >>>> ..\..\xyz2gaussian optfile $inp$ > $xxx$.gjf "D:\G09W\g09.exe" $xxx$.gjf ..\..\gaussian2xyz $xxx$.out > $out$ >>>>

For Linux and Mac OS X users, al3o4 # Result file name Al3O4 #Symbols cube 3 3 3 # Structure types 40 # Maximal number of calculations >>>> ../../xyz2gaussian optfile $inp$ > $xxx$.gjf g09 < $xxx$.gjf > $xxx$.log 2>/dev/null ../../gaussian2xyz $xxx$.log > $out$ >>>>

The meaning of each line is:

• Line 1: The name of the directory that stores the found local minima (LM). After optimization, all the found LMs will be stored in al3o4-LM.

+ + • Line 2: The cluster components. For Al3O4 , just write Al 3 O 4. For Mg2Al2O5 , write Mg 2 Al 2 O 5.

• Line 3: For this line, one can give the type of initial guesses. Available choices are listed below and are shown in Figure 4.2.1:

– line Generate a linear initial structure. – ring Generate a ring initial structure. – sphere Generate a sphere initial structure. – plane 2 3 Generate a 2D initial structure from a 2 × 3 lattice. – cube 3 4 3 Generate a 3D initial structure from a 3 × 4 × 3 lattice. – Point group symmetry. From ABCluster 2.1, isomer can generate clusters with specific point group symmetry! Please see Section 4.4 for details.

Note that this does not mean that the program will only give linear structures when you use line. It is just a “preference”.

• Line 4: The number of calculations you want to do. Here it means isomer will do 40 calculations. 4.2. ISOMER WITH GAUSSIAN 21

• The lines between two >>>> are the commands to call third-party programs to calculate energies. This will be explained in Section 4.3.

Figure 4.2.1: The types of initial guesses.

Step 2: Create a file named optfile with the following content: % nproc =16 % mem =24 GB #N B3LYP/6-31g(d) SCF(XQC) Geom(NoCrowd) Opt opt

+1 1 >>>>

>>>>

Note that you should modify nproc and mem for your machine. For details about this optfile, see Subsection 4.2.3. Step 3: Run the global optimization: nohup isomer al3o4.inp > al3o4.out &

Note that this optimization is very expensive. During the optimization, there will be a directory named al3o4-LM, in which one can check the found local minima so far. Also, one can check the output file al3o4.out, where one can see the current energies. An example output is: Will perform at most 40 calculations. ======# Energy Time State ======22 CHAPTER 4. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: ISOMER

0 -1027.87993176 105 Succeed 1 -1028.18358742 137 Succeed 2 -1027.78041855 134 Succeed 3 -1028.04665867 151 Succeed 4 -1028.07659763 149 Succeed 5 -1027.99541473 99 Succeed 6 -1027.92248937 77 Succeed 7 -1027.95052263 115 Succeed 8 -1028.04466817 109 Succeed 9 -1028.05070335 116 Succeed 10

This means, the program is performing the 11th calculations. You can check the struc- ture with low energy −1028.04665867 by the file al3o4-LM/3.xyz. See Figure 4.2.2. Step 4: After the optimization, you can check all the structures.

Reordered from low to high energy: ======

# Energy ======

36 -1028.18359819 1 -1028.18358742 4 -1028.07659763 20 -1028.05536676 19 -1028.05087588 9 -1028.05070335 3 -1028.04665867

The structure 36 has the lowest energy −1028.18359819 and is the global minimum. You can check it from al3o4-LM/36.xyz. The structures are shown in Figure 4.2.2.

+ Figure 4.2.2: One local and global minimum of Al3O4 .

4.2.3 More About optfile

Now we describe what optfile is. It is used by xyz2gaussian to convert a XYZ molecule into a Gaussian input file. Here is an example optfile. xyz2gaussian will put all the lines before the first >>>> in front of the coordinates, and all the lines between the two >>>> at the end of the coordinates, to generate a Gaussian input file. 4.2. ISOMER WITH GAUSSIAN 23

In practise, you have to modify the charge, spin multiplicity, method, , and other options to satisfy your requirement. Here SCF(XQC) is recom- mended since the initial guess can be very distorting, this option can guarantee the convergence of the SCF calculations. For their meanings, please refer to the Gaussian manual.

4.2.4 Example 2: Au6 You can find all input and output files in testfiles/isomer/2-au6. Now we want to know the global minimum of Au6. Maybe you are thinking about the Gupta or Sutton–Chen potential. Unfortunately, for small metallic clusters, both po- tentials are very inaccurate (Phys. Rev. A 2007, 76, 013202). Thus quantum chemistry must be used. Also, gold “enjoys” very strong relativistic effects. Thus one should use a suitable pseudopotential to describe gold. A good choice is the ECP60MDF. This pseu- dopotential can be obtained from http://www.tc.uni-koeln.de/PP/clickpse.en.html. Step 1: In the ABCluster distribution, go to the directory testfiles/isomer. Cre- ate a file called au6.inp. For Windows users, the content should be: au6 #Resultfilename Au6 #Symbols plane 4 3 # Structure types 20 # Maximal number of calculations >>>> ../../xyz2gaussian optfile $inp$ > $xxx$.gjf "D:\G09W\g09.exe" $xxx$.gjf ../../gaussian2xyz $xxx$.out > $out$ >>>>

For Linux and Mac OS X users, au6 #Resultfilename Au6 #Symbols plane 4 3 # Structure types 20 # Maximal number of calculations >>>> ../../xyz2gaussian optfile $inp$ > $xxx$.gjf g09 < $xxx$.gjf > $xxx$.log 2>/dev/null ../../gaussian2xyz $xxx$.log > $out$ >>>>

Since I know that the global minimum of small gold clusters should be plane, I use plane 4 3 for you to save time. In practise, however, when you do not know what the global minimum should be, you’d better use cube to search more kinds of structures. Step 2: Create a file named optfile with the following content: % nproc =16 % mem =24 GB #N TPSSTPSS/GENECP SCF(XQC) Geom(NoCrowd) Opt b opt

0 1 >>>> Au 0 24 CHAPTER 4. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: ISOMER

S 8 1.00 0.38000800E+02 0.20009000E-01 0.23972500E+02 -0.15167900E+00 0.15218200E+02 0.36396000E+00 0.55399900E+01 -0.82132600E+00 0.13855100E+01 0.93664100E+00 0.64246100E+00 0.42352700E+00 0.15649600E+00 0.16250000E-01 0.54910000E-01 -0.97800000E-03 S 8 1.00 0.38000800E+02 -0.53040000E-02 0.23972500E+02 0.46318000E-01 0.15218200E+02 -0.11994000E+00 0.55399900E+01 0.30406200E+00 0.13855100E+01 -0.49450100E+00 0.64246100E+00 -0.25551600E+00 0.15649600E+00 0.60916300E+00 0.54910000E-01 0.59776700E+00 S 8 1.00 0.38000800E+02 0.32340000E-01 0.23972500E+02 -0.17176200E+00 0.15218200E+02 0.33950300E+00 0.55399900E+01 -0.74617900E+00 0.13855100E+01 0.19174980E+01 0.64246100E+00 -0.11299310E+01 0.15649600E+00 -0.13662840E+01 0.54910000E-01 0.14423910E+01 S 1 1.00 0.54910000E-01 0.10000000E+01 P 7 1.00 0.10309200E+02 0.12821700E+00 0.66276500E+01 -0.35379000E+00 0.16744700E+01 0.56621100E+00 0.80111600E+00 0.49317100E+00 0.34687900E+00 0.11377500E+00 0.12270100E+00 0.25340000E-02 0.42428000E-01 0.67900000E-03 P 7 1.00 0.10309200E+02 -0.35885000E-01 0.66276500E+01 0.10289000E+00 0.16744700E+01 -0.20098800E+00 0.80111600E+00 -0.20104500E+00 0.34687900E+00 0.11654900E+00 0.12270100E+00 0.59496900E+00 0.42428000E-01 0.45552000E+00 P 7 1.00 0.10309200E+02 -0.77242000E-01 0.66276500E+01 0.22261100E+00 0.16744700E+01 -0.49535300E+00 0.80111600E+00 -0.36074700E+00 0.34687900E+00 0.71000000E+00 4.2. ISOMER WITH GAUSSIAN 25

0.12270100E+00 0.56883900E+00 0.42428000E-01 0.11930000E-02 P 1 1.00 0.42428000E-01 0.10000000E+01 D 6 1.00 0.11002700E+02 0.16467000E-01 0.68916600E+01 -0.68013000E-01 0.18080800E+01 0.29949200E+00 0.82105100E+00 0.45430300E+00 0.34416100E+00 0.34422400E+00 0.12974300E+00 0.12125600E+00 D 6 1.00 0.11002700E+02 -0.23628000E-01 0.68916600E+01 0.95672000E-01 0.18080800E+01 -0.54129400E+00 0.82105100E+00 -0.39553300E+00 0.34416100E+00 0.61916500E+00 0.12974300E+00 0.46827600E+00 D 1 1.00 0.12974300E+00 0.10000000E+01 F 1 1.00 0.89190000E+00 0.10000000E+01 ****

Au 0 ECP60MDF 5 60 H-Komponente 1 2 1.000000 0.000000 S-H 2 2 13.523218 426.641867 2 6.264384 36.800668 P-H 4 2 11.413867 87.002091 2 10.329215 174.004370 2 5.707424 8.870610 2 4.828165 17.902438 D-H 4 2 7.430963 49.883655 2 8.321990 74.684549 2 4.609642 6.486227 2 3.511507 9.546821 F-H 2 2 3.084639 8.791640 2 3.024743 11.658456 G-H 2 26 CHAPTER 4. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: ISOMER

2 3.978442 -5.234337 2 4.011491 -6.738142

>>>>

Note that here we use TPSS/ECP60MDF method. Step 3: Run the global optimization: nohup isomer au6.inp > au6.out &

Step 4: After the optimization, you can check the output au6.out: Reordered from low to high energy: ======

# Energy ======

12 -814.38110810 10 -814.38108834 14 -814.38097223 7 -814.38019205 9 -814.37918193 6 -814.37898387 8 -814.37826018 thus the structure au6-LM/12.xyz is the global minimum, which is shown in Figure 4.2.3.

Figure 4.2.3: The global minimum of Au6.

4.3 ABCluster Interfaces with Third-Party Programs

ABCluster can in principle work with any programs. Now we will see how to do this. When isomer/lego is running, it will generate a geometry with a long name, like x-34. You do not need to know its exact name, and in ABCluster it can be repre- sented by $xxx$. This geometry will be saved in standard XYZ format, a file named x-34.xxxxxyz, represented by $inp$. Then, commands between the two >>>> will be run one by one. Finally, the optimized geometry and energy should be written in XYZ format to a file named x-34.ooooout (The title line is the energy!), represented by $out$. Then isomer/lego will read optimized geometry and energy from this file and store it, launching next search. This mechanism can be shown in Figure 4.3.1. Now let’s see how we let ABCluster work with Gaussian. For the following com- mands: 4.4. CLUSTERS WITH SPECIFIC POINT GROUP SYMMETRY 27

Figure 4.3.1: How isomer/lego work with third-party programs.

>>>> ../../xyz2gaussian optfile $inp$ > $xxx$.gjf g09 < $xxx$.gjf > $xxx$.log 2>/dev/null ../../gaussian2xyz $xxx$.log > $out$ >>>>

In the first line, xyz2gaussian use the structure ($inp$) generated by isomer/lego and optfile to generate a Gaussian input file named $xxx$.gjf. The second line calls Gaussian to perform the local optimization, the output of which is in $xxx$.log. The third line extracts the final optimized structure and corresponding energy and saves it in $out$. This is exactly what Figure 4.3.1 instructs you to do. In summary, your main task is to write programs or scripts to translate the XYZ format geometry into the format that the third-party program understands, and perform the calculation, then extract energy and optimized geometry and save them in another XYZ file. You can read the scripts in misc to understand how to write efficient interfaces. In Chapter5, we will describe how to use them. From ABCluster 2.1, I recommend that isomer is used only together with Gaussian for pure atomic clusters. For other programs, lego is the better choice. See Chapter5.

4.4 Clusters with Specific Point Group Symmetry

From ABCluster 2.1, isomer can generate atomic clusters with specific point group symmetry. All kinds of point groups with arbitrary order of rotation are supported. This is very useful in looking for large symmetric clusters. In this section, we will discuss how to do this. 28 CHAPTER 4. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: ISOMER

4.4.1 Point Group Grammar Using point group symmetry in ABCluster is very simple: Just change the third line of isomer input by point group descriptions. The grammar is:

name x y z plane(optionally for Cnh, Dn, Dnh, Dnd)

Here, name is the point group name, like C2v, Oh (See below for a full list). x y z are three real numbers. They control the shape of the cluster. For example, 2 2 2 may result a cluster having close length, width, and heigth, and 5 5 1 may result a elongate cluster. For Cnh, Dn, Dnh, and Dnd, you can add a word plane, then isomer will only generate planar clusters under the point group symmetry! Below is a full list of point group names. They are completely identical to corre- sponding .

1. Cn: Like C3 or C12. Note that C1 is not allowed.

2. Cnh: Like C2h or C11h. Note that C1h is not allowed: use Cs instead.

3. Cnv: Like C4v or C9v. Note that C1v is not allowed: use Cs instead.

4. Sn: Like S2 or S8. Note that S2 is not allowed: use Ci instead. Plus, n must be even.

5. Dn: Like D5 or D6. Note that D1 is not allowed.

6. Dnh: Like D4h or D7h. Note that D1h is not allowed.

7. Dnd: Like D3d or D6d. Note that D1d is not allowed.

8. Cs: The HClO symmetry.

9. Ci: The inversion symmetry.

10. T: A symmetry weaker than CH4.

11. Th: A symmetry weaker than CH4.

12. Td: The CH4 symmetry.

13. O: A symmetry weaker than SF6.

14. Oh: The SF6 symmetry.

15. I: A symmetry weaker than C60.

16. Ih: The C60 symmetry.

4.4.2 Example 3: Au20 under Point Group Symmetries You can find all input and output files in testfiles/isomer/3-au20. We want to build clusters of Au20. If you just use inbox to do global optimization, it may take you 100 steps to find the famous Td symmetry global minimum. Using point group grammar, you can quickly get a lot clusters with the assigned symmetry. Prepare the following file au20.inp to generate Au20 having D2d symmetry. For Windows users, the content should be: 4.4. CLUSTERS WITH SPECIFIC POINT GROUP SYMMETRY 29 au20 #Resultfilename Au20 #Symbols D2d 2 2 2 # Structure types 10 # Maximal number of calculations >>>> copy $inp$ $out$ >>>>

For Linux and Max OS X users, the content should be: au20 #Resultfilename Au20 #Symbols D2d 2 2 2 # Structure types 10 # Maximal number of calculations >>>> cp $inp$ $out$ >>>>

Here, copy $inp$ $out$ or cp $inp$ $out$ means just guess cluster structures without further optimization. Of course, you can change them to use Gaussian or xTB or others for optimization. Just run this: isomer au20.inp > au20.out

In au20-LM, you will find that all structures have D2d symmetry! You can also try the following commands:

1. C5v 2 2 2 Generate clusters under C5v symmetry.

2. C5h 2 2 2 Generate clusters under C5h symmetry.

3. C5h 2 2 2 plane Generate planar clusters under C5h symmetry.

4. Td 2 2 2 Generate clusters under Td symmetry.

5. Oh 2 2 2 Generate clusters under Oh symmetry. For each of the point groups given above, we show an example in Figure 4.4.1:

Figure 4.4.1: Au20 under specified point group symmetries. 30 CHAPTER 4. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: ISOMER Chapter 5

Optimization with Third-party Programs: lego

5.1 Introduction

Before ABCluster 2.1, lego only has a few structrual features for cluster buidling. For- tunately, lego has now become a very powerful cluster building tool. One can generate much more complex structures than before. Thus, it is not only a global optimiza- tion program, but can also be used to generate initial guess for molecular dynamics or quantum chemistry. In this chapter we will discuss it in detail.

5.2 lego by Itself: Generate Complex Clusters

You can find all input and output files in testfiles/lego/1-9-mol. In this section, we will describe how to use lego to generate complex clusters. No third-party programs are needed. Therefore, you can use lego to generate initial struc- tures for molecular dynamics or quantum chemistry calculations.

5.2.1 Preparation Step 1: In the ABCluster distribution, go to the directory testfiles/lego. Create a file called mol.inp. For Windows users, the content should be: mol #Resultfilename mol.cluster # Cluster file name 5 # Maximum number of calculations >>>>

>>>> copy $inp$ $out$ >>>>

For Linux and Mac OS X users, mol #Resultfilename mol.cluster # Cluster file name 5 # Maximum number of calculations >>>>

>>>>

31 32 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO cp $inp$ $out$ >>>>

The meaning of each line is:

• Line 1: The name of the directory that stores the found local minima (LM). After optimization, all the found LMs will be stored in mol-LM.

• Line 2: The name of the file that contains the cluster components and geometry. This is very similar to that for rigidmol-optimizer.

• Line 3: The number of calculations you want to do. Here it means lego will do 5 calculations.

• The lines between two >>>> are the structure features, i.e., what shape of the cluster is. They will be explained in detail in Subsection 5.2.4.

• The lines between the next two >>>> are the commands to call third-party pro- grams to calculate the energy. This is explained in Section 4.3 and is completely identical to that for isomer.

You can see that, the command copy $inp$ $out$ or cp $inp$ $out$ simply send the generated structure back to ABCluster without being optimized by other programs. Step 2: Prepare some molecules in XYZ format. Water h2o.xyz: 3 water O 0.00000000 0.00000000 -0.11081188 H 0.00000000 -0.78397589 0.44324751 H -0.00000000 0.78397589 0.44324751

+ 2+ Na na.xyz and SO4 so4.xyz: 1 Na+ Na 0. 0. 0.

5 SO4 (2 -) S 0.00000000 0.00000000 0.00000000 O 0.00000000 0.00000000 1.67000004 O -0.00000000 -1.57449114 -0.55666668 O 1.36354933 0.78724557 -0.55666668 O -1.36354933 0.78724557 -0.55666668

Phenylacetylene C6H5CCH c6h5cch.xyz: 14 C6H5CCH C 0.00000000 -1.20805470 -1.53350228 C 0.00000000 -1.20800413 -0.13834242 C 0.00000000 -0.00000000 0.55915207 C -0.00000000 1.20800413 -0.13834242 C -0.00000000 1.20805470 -1.53350228 C 0.00000000 -0.00000000 -2.23092797 5.2. LEGO BY ITSELF: GENERATE COMPLEX CLUSTERS 33

H 0.00000000 -2.16039172 -2.08322677 H 0.00000000 -2.16049784 0.41120038 H -0.00000000 2.16049784 0.41120038 H -0.00000000 2.16039172 -2.08322677 H 0.00000000 -0.00000000 -3.33053195 C 0.00000000 -0.00000000 2.09915204 C 0.00000000 -0.00000000 3.30035204 H 0.00000000 -0.00000000 4.37035204

An icosahedral cluster Au55 au55.xyz: 55 Au55 , Ih Au 0.00000000 0.00000000 -0.00000000 Au 0.00000000 0.00000000 2.78370787 Au 0.00000099 -2.48982349 1.24491305 Au -2.36796255 -0.76939871 1.24491305 Au 2.36796255 -0.76939871 1.24491305 Au -1.46348073 2.01431010 1.24491305 Au 1.46348233 2.01430893 1.24491305 Au -1.46348134 -2.01431199 -1.24490928 Au 1.46348134 -2.01431199 -1.24490928 Au -2.36796415 0.76939988 -1.24490928 Au 2.36796515 0.76939683 -1.24490928 Au 0.00000160 2.48982538 -1.24490928 Au -0.00000000 0.00000000 -2.78370787 Au 0.00000000 0.00000000 5.60588695 Au 0.00000200 -5.01405667 2.50703096 Au -4.76865065 -1.54943062 2.50703096 Au 4.76865065 -1.54943062 2.50703096 Au -2.94718695 4.05645823 2.50703096 Au 2.94719018 4.05645588 2.50703096 Au -2.94718818 -4.05646203 -2.50702336 Au -4.76865388 1.54943297 -2.50702336 Au 4.76865588 1.54942682 -2.50702336 Au 0.00000323 5.01406047 -2.50702336 Au -0.00000000 0.00000000 -5.60588695 Au 0.00000000 -2.60015464 4.20713602 Au -2.47289401 -0.80349197 4.20713602 Au 2.47289401 -0.80349197 4.20713602 Au -1.52833255 2.10356929 4.20713602 Au 1.52833255 2.10356929 4.20713602 Au -2.47288912 -3.40364611 2.60015580 Au 2.47288912 -3.40364611 2.60015580 Au -1.52832953 -4.70372262 0.00000718 Au 1.52832953 -4.70372262 0.00000718 Au -4.00122458 1.30007635 2.60015404 Au -4.00122606 -2.90705825 0.00000028 Au -4.94578585 0.00000153 0.00000142 Au 4.00122458 1.30007635 2.60015404 Au 4.00122606 -2.90705825 0.00000028 Au 4.94578585 0.00000153 0.00000142 34 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

Au 0.00000164 4.20713581 2.60015498 Au -4.00122542 2.90705913 0.00000542 Au -1.52833164 4.70372193 0.00000133 Au 4.00122542 2.90705913 0.00000542 Au 1.52833164 4.70372193 0.00000133 Au -0.00000260 -4.20713750 -2.60015224 Au -4.00122857 -1.30007547 -2.60014834 Au -1.52833303 -2.10356685 -4.20713707 Au 4.00122857 -1.30007547 -2.60014834 Au 1.52833303 -2.10356685 -4.20713707 Au -2.47289130 3.40364805 -2.60015119 Au -2.47289519 0.80349588 -4.20713458 Au 2.47289130 3.40364805 -2.60015119 Au 2.47289519 0.80349588 -4.20713458 Au -0.00000000 2.60015758 -4.20713421 Au 2.94718818 -4.05646203 -2.50702336

Step 3: Prepare a file mol.cluster for later use.

5.2.2 Example 1: Na4(SO4)2(H2O)300

We consider (Na4(SO4)2(H2O)300. Of course, it can be perfectly done with rigidmol-optimizer. But here we just want to demonstrate how to use lego. Step 1: Modify mol.cluster. This is exactly the same as rigidmol-optimizer. 3 h2o . xyz 300 na. xyz 4 so4 . xyz 2

Step 2: Modify mol.inp. If you consider an isolated cluster, it should be like a sphere. But assume for some reasons, you want the cluster be in rectangle shape (say, for molecular dynamics simulations). This can be done by using the following input: mol #Resultfilename mol.cluster # Cluster file name 5 # Maximal number of calculations >>>> inbox 0. 0. 0. 8. 8. 20. inbox 0. 0. 0. 8. 8. 20. inbox 1. 1. 1. 7. 7. 17. >>>> cp $inp$ $out$ >>>>

Here, the first line inbox 0. 0. 0. 8. 8. 20. means that the first compo- nent of the cluster, i.e., 300 H2O, will be distributed randomly in a box defined by (0,0,0) and (8,8,20) (Figure 5.2.1); the second line inbox 0. 0. 0. 8. 8. 20. means that the second component of the cluster, i.e., 4 Na+, will be distributed random- ly in a box defined by (0,0,0) and (8,8,20); the third line inbox 1. 1. 1. 7. 7. 2– 17. means that the third component of the cluster, i.e., 2 SO4 , will be distributed 2– randomly in a box defined by (1,1,1) and (7,7,17). Note that for SO4 , we let them distribute in a smaller box. Step 3: Run the program: 5.2. LEGO BY ITSELF: GENERATE COMPLEX CLUSTERS 35

Figure 5.2.1: Definitions of inbox. lego mol.inp > mol.out

Step 4: All the 5 structures have the same energy 0.00000 because no programs are used to calculate them. Go to mol-LM and you will find 5 different structures. Pick the one you need. For example, mol-LM/3.xyz is shown in Figure 5.2.2. Note that the shape is like a rectangle. That is because the box is too small so water molecules overflow.

Figure 5.2.2: One example of Na4(SO4)2(H2O)300.

5.2.3 Example 2: (H2O)1000(C6H5CCH)150

Now we build a solvent box with 1000 H2O and 150 C6H5CCH. We only need to modify mol.cluster and structural feature part of mol.inp, like: mol.cluster: 2 h2o.xyz 1000 c6h5cch.xyz 150 mol . inp inbox 0. 0. 0. 50. 50. 50. inbox 0. 0. 0. 50. 50. 50. 36 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

These input files will place 1000 H2O and 150 C6H5CCH in a box 50 × 50 × 50 (Figure 5.2.1). Run the program with lego mol.inp > mol.out. You will find structures in mol-LM. For example, mol-LM/3.xyz is shown in Figure 5.2.3. However, we know that C6H5CCH is not soluble in H2O, therefore it is more suitable to build a two-phase structure. We can use: mol.cluster: 2 h2o.xyz 1000 c6h5cch.xyz 150 mol . inp inbox 0. 0. 0. 50. 50. 30. inbox 0. 0. 30. 50. 50. 50.

These input files will place 1000 H2O and 150 C6H5CCH in two separated but neighbor- ing boxes (Figure 5.2.1). Use lego to run this optimization. One result can be found in 5.2.3.

Figure 5.2.3: Cluster structures of (H2O)1000(C6H5CCH)150.

A tip: If you want to use lego to generate boxes for molecular dynamics, the number of molecules and box size should be compatible with the density of solvents.

5.2.4 Example 3-9: All Structural Features Now we introduce all structrual features that lego supports besides inbox. You can combine them to get very complex cluters.

1. pos x y z alpha beta gamma Put the molecule at a point (x,y,z) in an orienta- tion (alpha,beta,gamma).

Example 3: put Au55 at (20,20,20) with no rotation (0,0,0) relative to its original orientation (defined in au55.xyz), and put 1000 H2O in the box defined by (0,0,0) and (40,40,40). mol.cluster: 2 au55 . xyz 1 h2o.xyz 1000 mol . inp 5.2. LEGO BY ITSELF: GENERATE COMPLEX CLUSTERS 37

pos 20. 20. 20. 0. 0. 0. inbox 0. 0. 0. 40. 40. 40.

2. inbox x1 y1 z1 x2 y2 z2 Put molecules inside the box defined by (x1,y1,z1) and (x2,y2,z2).

Figure 5.2.4: Definition of inbox x1 y1 z1 x2 y2 z2.

Example 4: See Subsection 5.2.2 and 5.2.3.

3. outbox x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 Put molecules outside the box defined by (x1,y1,z1) and (x2,y2,z2) but inside the box defined by (x3,y3,z3) and (x4,y4,z4).

Example: put Au55 at (20,20,20) with no rotation (0,0,0) relative to its original orientation (defined in au55.xyz), and put 1000 H2O in the box defined by (0,0,0) and (40,40,40), but outside the box defined by (14,14,14) and (26,26,26). Note that the size of Au55 is about 12 × 12 × 12, thus (14,14,14) and (26,26,26) define the box enclosing Au55. mol.cluster: 2 au55 . xyz 1 h2o.xyz 1000 38 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

Figure 5.2.5: Definition of outbox x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4.

mol . inp pos 20. 20. 20. 0. 0. 0. outbox 14. 14. 14. 26. 26. 26. 0. 0. 0. 40. 40. 40.

You can see that unlike the first example, there is no water existing inside the gold cluster. outbox can be very useful when, for example, you want to soak a large cage molecule (like fullerene) in a solvent box, without any solvent molecules inside the cage.

4. insphere x y z ra rb rc Put molecules inside a sphere centered at (x,y,z) with three radii ra, rb. and rc. ( Example 5: prepare a prolate sphere containing 1000 H2O, and put a SO4 2 –) near the surface of the water droplet. mol.cluster: 2 h2o.xyz 1000 so4 . xyz 1 mol . inp insphere 0 0 0 20 25 10 5.2. LEGO BY ITSELF: GENERATE COMPLEX CLUSTERS 39

Figure 5.2.6: Definition of insphere x y z ra rb rc.

pos 5 9 6 0 0 0

5. onsurface n1 n2 n3 Put molecules randomly on surfaces of the n1-th component. For the molecules, the n2-th atom binds to the surface, the line defined by the n2-th and n3-th atom being othorgonal to the surface.

Example 6: 10 C6H6CCH are absorbed randomly on Au55, with –C–H pointing toward Au55.

mol.cluster: 2 au55 . xyz 1 c6h5cch.xyz 10 mol . inp pos 0 0 0 0 0 0 onsurface 1 14 13 40 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

Figure 5.2.7: Definition of onsurface n1 n2 n3.

6. micelle n1 n2 x y z ra rb rc Put molecules uniformly on a sphere surface centered at (x,y,z) with three radii ra, rb. and rc. For the molecules, the n1-th atom is on the sphere surface, the line defined by the n1-th and n2-th atom being othorgonal to the sphere surface. This option is very powerful to define a series of elegant structures. You will see this in the current and following sections. Example 7: Put 52 Na on a elliptic surface centered at (1,1,1) with radii 9,4,3. 5.2. LEGO BY ITSELF: GENERATE COMPLEX CLUSTERS 41

Figure 5.2.8: Definition of micelle n1 n2 x y z ra rb rc.

mol.cluster: 1 na. xyz 52 mol . inp micelle 1 1 0.5 0.5 0.5 9 4 3

Note that there is only 1 atom in Na, therefore we simply write 1 1.

Example 8: Put 11 C6H5CCH on a sphere surface centered at (0,0,0) with radius 5.

mol.cluster: 1 c6h5cch.xyz 11 mol . inp micelle 14 13 0. 0. 0. 5. 5. 5. 42 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

What if we write micelle 11 6 0. 0. 0. 5. 5. 5.? Yes, the molecules change their directions.

7. micelle n1 n2 n3 n4 x y z ra rb rc Put molecules evenly on a sphere surface centered at (x,y,z) with three radii ra, rb, and rc. For the molecules, the center of the n1-th and n2-th atom is on the sphere surface, the line defined by the center of the n1-th and n2-th atom, and the center of the n3-th and n4-th atom, being othorgonal to the sphere surface. micelle n1 n2 n3 n4 n5 n6 x y z ra rb rc Put molecules evenly on a sphere surface centered at (x,y,z) with three radii ra, rb. and rc. For the molecules, the center of the n1-th, n2-th and n3-th atom is on the sphere surface, the line defined by the center of the n1-th, n2-th and n3-th atom, and the center of the n4-th, n5-th and n6-th atom, being othorgonal to the sphere surface. This is useful when some cone-shape molecules are involved. See Section 5.4.1.

8. layer n1 n2 n3 x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 Align the molecules in a plane region defined by (x2,y2,z2), (x3,y3,z3), and (x4,y4,z4). For the molecules, For the molecules, the n1-th atom is on the plane, the line defined by the n1-th and n2-th atom being parallel to (x1,y1,z1). When n3 is 0, the molecules are distributed in the plane uniformly, otherwise randomly.

Example 9: Construct two layers of 72 C6H5CCH. mol.cluster: 2 c6h5cch.xyz 36 c6h5cch.xyz 36 mol . inp layer 14 13 0 0. 1. 1. 0. 0. 0. 35. 0. 0. 0. 35. 0. 5.2. LEGO BY ITSELF: GENERATE COMPLEX CLUSTERS 43

Figure 5.2.9: Definitions of micelle n1 n2 n3 n4 x y z ra rb rc and micelle n1 n2 n3 n4 n5 n6 x y z ra rb rc.

layer 13 14 0 0. 1. 1. 0. 0. 8. 35. 0. 8. 0. 35. 8.

Using these structural features, you can build clusters of any complex shapes for quantum chemistry or molecular dynamics. Now we will show how to combine lego with other programs to do global optimizations for complex systems of different chemical nature. 44 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

Figure 5.2.10: Definition of layer n1 n2 n3 x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4.

5.3 lego with Gaussian

Gaussian is one of the most popular quantum chemistry program. It is fast and reliable in geometriy optimization. For small atomic and molecular clusters, it is a good choice.

– 5.3.1 Example 10: (IO3 )(H2O)4 You can find all input and output files in testfiles/lego/10-h2o4io3. – We are going to search the global minimum of (IO3 )(H2O)4 at B3LYP-D3/SVP level of theory. It relates to some studies of atmospheric nucleation processes (J. Phys. Chem. Lett. 2019, 10, 1935). – First prepare 2 files containing the coordinates of IO3 , and H2O. io3.xyz: 4 IO3 (-) I 0.00000000 0.00000000 0.20675328 O -1.62482819 -0.93809499 -0.45658026 O -0.00000000 1.87618998 -0.45658026 O 1.62482819 -0.93809499 -0.45658026

h2o.xyz: 3 H2O O 0.00000000 0.00000000 -0.11081188 H 0.00000000 -0.78397589 0.44324751 H -0.00000000 0.78397589 0.44324751

Prepare the cluster file h2o4io3.cluster: 2 5.3. LEGO WITH GAUSSIAN 45 h2o . xyz 4 io3 . xyz 1

We will put the molecules randomly together in a box of size 7 × 7 × 7, and do 50 calculations to search the global minimum. Thus the ABCluster input file h2o4io3.inp is: h2o4io3i2o5 # Result file name h2o4io3i2o5.cluster # Cluster file name 50 #Maximalnumberofcalculations >>>> inbox 0. 0. 0. 7. 7. 7. inbox 0. 0. 0. 7. 7. 7. >>>> ./xyz2gaussian optfile $inp$ > $xxx$.gjf g09 < $xxx$.gjf > $xxx$.log 2>/dev/null ./gaussian2xyz $xxx$.log > $out$ >>>>

The charge of the system is −1, thus optfile: % nproc =16 % mem =24 GB #N B3LYP/SVP Empiricaldispersion(GD3) SCF(XQC) Geom(NoCrowd) Opt opt

-1 1 >>>>

>>>>

With these files, run the global optimization: nohup lego h2o4io3.inp > h2o4io3.out &

After optimization, in the output file h2o4io3.out, you can find: Reordered from low to high energy: ======

# Energy ======

41 -7450.79461219 32 -7450.79277832 21 -7450.79196832 38 -7450.79070065 16 -7450.79021089

The structure 41 is the global minimum. You can check it from h2o4io3-LM/41.xyz, shown in Figure 5.3.1. 46 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

– Figure 5.3.1: The global minimum of (IO3 )(H2O)4.

– 5.3.2 Example 11: ((NH3)4 ) You can find all input and output files in testfiles/lego/11-enh34. – Now we search the global minimum of ((NH3)4 ), which is a small model of ammonia- solvated electron. Prepare the geometry of NH3 nh3.xyz: 4 NH3 N -0.00000000 -0.00000000 -0.10000001 H 0.00000000 -0.94280900 0.23333324 H -0.81649655 0.47140450 0.23333324 H 0.81649655 0.47140450 0.23333324

The cluster file enh34.cluster: 1 nh3 . xyz 4

The input file enh34.inp: enh34 #Resultfilename enh34.cluster # Cluster file name 40 # Maximal number of calculations >>>> inbox 0. 0. 0. 4. 4. 4. >>>> ./xyz2gaussian optfile $inp$ > $xxx$.gjf g09 < $xxx$.gjf > $xxx$.log 2>/dev/null ./gaussian2xyz $xxx$.log > $out$ >>>>

Finally, edit optfile: % nproc =16 % mem =24 GB #N B3LYP/6-31+g(d) Empiricaldispersion(GD3) SCF(XQC) Geom( NoCrowd) Opt opt 5.3. LEGO WITH GAUSSIAN 47

-1 2 >>>>

>>>>

Note that for this solvated electron system, the diffuse basis set 6-31+g(d) is applied. Also, the spin multiplicity is set as 2. With these files, run the global optimization: nohup lego enh34.inp > enh34.out &

The global minimum is enh34-LM/39.xyz, shown in Figure 5.3.2.

– Figure 5.3.2: The global minimum of (NH3)4 , and the isosurface of the single occupied molecular orbital (isovalue = ±0.02).

5.3.3 Theoretical Background For the mechanism how ABCluster works with Gaussian, please refer to Section 4.3. For different systems, You can change optfile to get the best performance. Below are some tips.

• Always add SCF(XQC) Geom(NoCrowd) to get stable convergences.

• Usually double-zeta basis sets (6-31g(d), cc-pVDZ, SVP) are enough for global optimization. Triple basis sets will waste your computation time. Except for a few cases, diffuse basis sets are also unnecessary.

• For clsuters containing no transition metal atoms, B3LYP-D3 is always a good choice; otherwise, pure functionals like BLYP with dispersion corrections may be used.

– • For open-shell systems, like (NH3)4 or metal atomic clusters, set correct spin multiplicity in optfile. You may even have to consider spin symmetry broken.

• If you want to freeze some degrees of freedom, use Opt(ModRedundant) and add coordinates to be frozen between the two >>>>.

• If you want to use some special basis sets (like pseudopotentials), add basis set information in optfile between the two >>>>. See Subsection 4.2.4. 48 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

5.4 lego with xTB xTB is developed by Prof. Stefan Grimme and his coworkers. This is a very accurate and efficient semi-empirical method, and is highly recommended for first exploration of molecular clusters. The program can be obtained by contacting the authors (mailto: [email protected]).

2+ 5.4.1 Example 12: Au8(PPh3)7 You can find all input and output files in testfiles/lego/12-au8pph37. 2+ Au8(PPh3)7 is a typical case of ligand-protected metal clusters. Using ABClus- ter+xTB, you can obtain its global minimum in a very simple but reliable way. Prepare the structures of Au and PPh3. au.xyz: 1 Au Au 0. 0. 0.

pph3.xyz: 34 PPh3 P -0.03267416 1.25444481 0.01586741 C 1.63658711 0.51777952 -0.20249064 C 2.11728961 -0.51166267 0.62864297 C 3.35184041 -1.10947100 0.34809282 C 4.10821561 -0.69414585 -0.75395341 C 3.63530020 0.34051056 -1.57197305 C 2.40795850 0.94805830 -1.29666426 H 5.07175713 -1.17346984 -0.97083452 H 1.50773709 -0.86424610 1.47175488 H 2.05116452 1.76406952 -1.94166102 H 4.23354275 0.68320377 -2.42887611 C -1.01544355 0.47507538 -1.33319588 C -2.21940469 1.07011104 -1.74867816 C -3.02846596 0.43629819 -2.69607994 C -2.63622633 -0.78935952 -3.24540929 C -1.42903176 -1.37711749 -2.85016511 C -0.61623556 -0.75189941 -1.89960309 H 0.33989220 -1.20508238 -1.60281598 H -3.27166241 -1.28124289 -3.99569753 H -1.11558128 -2.34174977 -3.27817968 H -2.52732156 2.03612934 -1.31911157 H 3.71666214 -1.92176100 0.99789092 C -0.66142082 0.46509284 1.55752006 C -0.39744126 1.10286726 2.78269286 C -0.76708153 0.49574035 3.98770397 C -1.41331451 -0.74647719 3.97484028 C -1.69557473 -1.37249081 2.75456160 C -1.32638551 -0.77586757 1.54359431 H -1.69985780 -1.22476738 4.92127414 H -2.20016600 -2.35118707 2.73885049 5.4. LEGO WITH XTB 49

H -1.52959169 -1.27689951 0.58452673 H -3.96763868 0.91740951 -3.01466482 H -0.53008388 1.00001913 4.93837267 H 0.10426851 2.08465110 2.78454401

Prepare the cluster file au8pph37.cluster: 2 au. xyz 8 pph3 . xyz 7 Now we are going to prepare au8pph37.inp. Note that, it will be very inefficient to use inbox to put the molecules in a box. We know that from chemical intuition, the cluster will have a gold core, and PPh3 binds on the surfaces of the gold core with its phosphorous atom. Thus, we put gold atoms in a sphere, then put ligands on the sphere surface. au8pph37 # Result file name au8pph37.cluster # Cluster file name 200 # Maximal number of calculations >>>> insphere 0 0 0 5 5 5 micelle 1 1 1 2 12 23 0 0 0 6 6 6 >>>> cp $inp$ $xxx$.xyz ../xtb/bin/xtb $xxx$.xyz -gfn 1 -chrg +2 -o > $xxx$.out energy=‘awk ’NR==2{print $3}’ xtbopt.xyz‘ ; sed -i "2c ${ energy}" xtbopt.xyz mv xtbopt.xyz $out$ rm $xxx$.xyz $xxx$.out charges wbo xtbopt.log xtbrestart >>>> You can see that we put gold atoms randomly in a sphere of radii 5,5,5, and put ligands in a micelle structure on a sphere of radii 6,6,6. This sphere is larger because Au-P bond is relatively long. We will explain the commands between two >>>> in Subsection 5.4.3. With these files, run the global optimization: nohup lego au8pph37.inp > au8pph37.out & The global minimum is au8pph37-LM/58.xyz, shown in Figure 5.4.1. 50 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

2+ Figure 5.4.1: The global minimum of Au8(PPh3)7 , with the gold core highlighted.

5.4.2 Example 13: Co6Te8(PEt3)6 You can find all input and output files in testfiles/lego/13-co6te8pet36. In this section, we want to search another ligand protected cluster Co6Te8(PEt3)6. Since we do not know the structure of Co6Te8, we can do this search first. You can use isomer with xTB with the following file co6te8.inp: co6te8 # Result file name Co6Te9 #Symbols cube 4 4 4 # Structure types 100 # Maximal number of calculations >>>> cp $inp$ $xxx$.xyz ../xtb/bin/xtb $xxx$.xyz -gfn 1 -o > $xxx$.out energy=‘awk ’NR==2{print $3}’ xtbopt.xyz‘ ; sed -i "2c ${ energy}" xtbopt.xyz mv xtbopt.xyz $out$ rm $xxx$.xyz $xxx$.out charges wbo xtbopt.log xtbrestart >>>>

Run the global optimization with isomer co6te8.inp > co6te8.out. The global min- imum is co6te8-LM/40.xyz and is shown in Figure 5.4.2. Use this structure and pet3.xyz 22 PEt3 P 0.77411167 0.93908628 0.00000000 C 1.38078883 1.79703460 -1.48602405 H 1.02413441 2.80584461 -1.48602405 H 2.45078883 1.79702166 -1.48602419 C 0.86744661 1.07107703 -2.74342827 H 1.19588317 1.59486033 -3.61674408 H 1.25178947 0.07263744 -2.76071851 5.4. LEGO WITH XTB 51

H -0.20200553 1.04133445 -2.72647284 C 1.58017719 -0.68723832 0.13314147 H 1.06926441 -1.39066966 -0.49059924 H 2.59983880 -0.60671904 -0.18103498 C 1.53001448 -1.16683089 1.59569905 H 1.95386617 -2.14689639 1.66441129 H 2.08820972 -0.49286368 2.21139887 H 0.51311419 -1.19395588 1.92747918 C 1.16337141 1.93168334 1.47500099 H 0.62390995 1.54801668 2.31564434 H 0.88119749 2.94963161 1.30453342 C 2.67528550 1.85868155 1.75852616 H 3.05363867 2.84440501 1.93201431 H 2.84706388 1.25327881 2.62390451 H 3.17563928 1.42763883 0.91665428

and co6te8pet36.cluster 2 co6te8.xyz 1 pet3 . xyz 6

We can do the search. The input file co6te8pet36.inp is: co6te8pet36 # Result file name co6te8pet36.cluster # Cluster file name 100 #Maximalnumberofcalculations >>>> pos 0 0 0 0 0 0 micelle 1 1 4 22 0 0 0 4 4 4 >>>> cp $inp$ $xxx$.xyz ../../xtb/bin/xtb $xxx$.xyz -gfn 1 -o > $xxx$.out energy=‘awk ’NR==2{print $3}’ xtbopt.xyz‘ ; sed -i "2c ${ energy}" xtbopt.xyz mv xtbopt.xyz $out$ rm $xxx$.xyz $xxx$.out charges wbo xtbopt.log xtbrestart 52 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

>>>>

You can see that we fix the core and let ligands distribute around it. We let the bonding direction parallel to atom 1 and the center of atom 4 and 22. You can also use micelle 1 1 1 2 9 16 (the center of three carbon atoms). Run the global optimization: nohup lego co6te8pet36.inp > co6te8pet36.out & The global minimum is co6te8pet36-LM/65.xyz, shown in Figure 5.4.2. All ligands are bonding with cobalt atoms.

Figure 5.4.2: The global minimum of Co6Te8 and Co6Te8(PET3)6.

5.4.3 Theoretical Background First we explain how ABCluster works with xTB. Look at the commands below: cp $inp$ $xxx$.xyz ../xtb/bin/xtb $xxx$.xyz -gfn 1 -chrg +2 -o > $xxx$.out energy=‘awk ’NR==2{print $3}’ xtbopt.xyz‘ ; sed -i "2c ${energy}" xtbopt.xyz mv xtbopt.xyz $out$ rm $xxx$.xyz $xxx$.out charges wbo xtbopt.log xtbrestart The first line copies the geometry to a XYZ file for xTB. The second line optimizes the geometry (-o). xTB will store the optimized structure in a file called xtbopt.xyz. Thus, the third line changes the title to its energy. The fourth line copies xtbopt.xyz to $out$. The fifth line deletes the redundant files. Below are some tips for efficient use of ABCluster with xTB. • The charge and spin of the system can be adjusted with the keyword -chrg and -u • The current version of xTB uses GFN2 Hamiltonian (J. Chem. Theory Comput. 2019, 15, 1652) as default . However, in some cases, especially atomic clusters, the calculation may have difficulty in convergence. Thus, you may use GFN1 Hamiltonian (J. Chem. Theory Comput. 2017, 13, 1989) by using -gfn 1 as shown above. For organic molecular clusters, GFN2 works perfectly and can be safely used. • For complex systems, run more global optimizations to get reliable results. • In some cases, it is needed to adjust energy boundary for more efficient global optimization. See Section 5.10 for details. 5.5. LEGO WITH CP2K 53

5.5 lego with CP2K

To study clusters in periodic systems, like Au8 on TiO2 surface, first principle programs are needed. In this section we are going to use CP2K, a free and powerful program.

5.5.1 Example 14: Au8 on O-Defected Rutile (110) Surface You can find all input and output files in testfiles/lego/14-au8tio2110. Rutile and gold clusters play important roles in catalysis. In this section, we want to search the global minimum of rutile surface-supported Au8. The Miller index of the selected surface is 110, with an O-defect. It will provide extra electrons to the gold cluster. First prepare the gold atom and TiO2(rutile, 110, O-defect) surface. au.xyz: 1 Au Au 0. 0. 0.

tio2110.xyz. You can find it in testfiles/lego/14-au8tio2110/tio2110.xyz. It contains 4 layers of TiO2. The cell lengths for X and Y directions are 18.91 and 17.72 A,˚ respectively. You can find an O-defect on the surface. Prepare the cluster file au8tio2110.cluster: 2 tio2110.xyz 1 au. xyz 8

Prepare the input file au8tio2110.inp: au8tio2110 # Result file name au8tio2110.cluster # Cluster file name 50 #Maximalnumberofcalculations >>>> pos 9.455 8.86 0. 0. 0. 0. inbox 7. 5. 9. 14. 12. 10. >>>> cp2k4abcluster.sh $xxx$ $inp$ $out$ >>>>

Note that, the surface was fixed at its center with no rotations (If rotated, the periodic boundary condition will be destroyed!) The box defined in the second line lies above the O-defect. The command cp2k4abcluster.sh $xxx$ $inp$ $out$ calls CP2K for ABCluster. We will describe them now. You need to copy two files to the current directory from misc/cp2k4abcluster: geoopt.tmp and cp2k4abcluster.sh. The former is a template for geometry optimiza- tion using CP2K, and the latter is the script to call CP2K. You need to change both for ABCluster. First, for geoopt.tmp, you can find the following lines:

PROJECT_NAME ... WFN_RESTART_FILE_NAME ... @INCLUDE XXX 54 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

...

NEVER change the three lines! You can change other places for your calculation. You should give the correct basis set, pseudopotential, and DFT-D parameters file names:

BASIS_SET_FILE_NAME ../BASIS POTENTIAL_FILE_NAME ../GTH_POTENTIALS ... PARAMETER_FILE_NAME ../dftd3.dat

Note that BASIS and GTH POTENTIALS can be found in the CP2K distribution. Thus, the following lines are also needed to be changed according to the elements appeared in your cluster:

&KIND H BASIS_SET DZVP-MOLOPT-SR-GTH-q1 POTENTIAL GTH-PBE-q1 &END KIND &KIND Ti BASIS_SET DZVP-MOLOPT-SR-GTH-q12 POTENTIAL GTH-PBE-q12 &END KIND

You can change the functional name:

&XC_FUNCTIONAL NO_SHORTCUT &PBE T &END PBE &END XC_FUNCTIONAL

And most importantly, the cell parameters:

ABC 18.91 17.72 30.00 PERIODIC XYZ

Note that since we are studying surfaces, a vacuum space is needed between the TiO2 slabs, so the Z cell length is 30 A.˚ Therefore, a dipole correction has to be applied:

SURFACE_DIPOLE_CORRECTION T SURF_DIP_DIR Z

In this study, we freeze the last two layers of TiO2 by the following commands:

&CONSTRAINT &FIXED_ATOMS COMPONENTS_TO_FIX XYZ LIST 216..431 &END FIXED_ATOMS &END CONSTRAINT

You can delete these in your own works if you do not need them. Second, change cp2k4abcluster.sh. You need to change only one line: mpirun -n 144 .popt -i ${calcinpfn} -o ${calcoutfn} 5.6. LEGO WITH GROMACS 55

Usually, CP2K calculations are done with multi-node parallelization. In my case, I used 144 CPU cores. You need to change this for your cluster. For example, mpirun may have to be changed to srun for a slurm queueing system. With these files, run the global optimization: nohup lego au8tio2110.inp > au8tio2110.out & The global minimum is au8tio2110-LM/49.xyz, shown in Figure 5.5.1.

Figure 5.5.1: The global minimum of Au8 on O-defected rutile (110) surface.

Actually, from au8tio2110.out we know that there are two clusters having unusual lower energy: au8tio2110-LM/42.xyz and au8tio2110-LM/46.xyz. But in these two clusters, the surfaces are highly distorted, so I do not think it is related to our problems. However, if you think they are indeed what you need, accept them.

5.5.2 Theoretical Background • CP2K calculations are very expensive. Think carefully before you start production runs.

• For surface-supported clusters, pos is always preferred to be applied to the sur- face. The remaining atoms or molecules are distributed in a box above the surface. Always set correct ABC parameters in geoopt.tmp. The surface slab should be suf- ficiently large. Dipole correction has to be applied (SURFACE DIPOLE CORRECTION). • There may be some highly distorted clusters having very low energies. You should decide by yourself whether they are reasonable in your applications.

• If transition or lanthanide atoms are present, the cutoff of plane waves should be larger than 500 (using CUTOFF 500). • For different surfaces, like graphene, rutile, or platinum, different DFT calculation schemes are required. For example, for graphene or rutile, OT is an effective algo- rithm; for platinum, exact diagonalization may be better. Do calibrations before large-scale calculations.

5.6 lego with Gromacs

Gromacs is a very efficient molecular dynamics program. We will use it to optimize very large clusters of soft matter. Note that in such cases, the true global minimum is almost impossible to find. However, using ABCluster, we can get a very stable initial configuration for further study of such systems. 56 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

5.6.1 An Additional Input Option in inp File In this section, we introduce an option in the ABCluster input file. It is rarely used. But when very large molecules are involved in the global optimization. For every guess cluster, ABCluster will do a pre-optimization before submitting it to third-party pro- grams. However, for very large systems (hundreds of very large molecules, vide infra), the pre-optimization may be as expensive as Gromacs calculations. Thus, we can skip this pre-optimization when lego works with Gromacs. To do this, add N at the last line of *.inp files. For example, if we generate 4 water molecules in a box, the difference between adding N and not adding N is shown in Figure 5.6.1.

Figure 5.6.1: The difference between adding N and not adding N in generating 4 water molecules in a box.

Again: in most other cases do NOT add N unless you are sure what you are doing.

5.6.2 Example 15: A Reversed Micelle of POPC You can find all input and output files in testfiles/lego/15-reversedmicelle. In this section, we want to get some reversed micelle-like cluster of water and POPC. The cluster will be optimized using Gromacs. Readers are assumed to be familiar with Gromacs. For cluster optimization with Gromacs, force field parameters are required. They can be found in testfiles/lego/15-reversedmicelle/ tops. In these files, the residue names of water and POPC are SOL and POPC, respectively. We consider a system of 300 water and 100 POPC molecules. Thus, the essential part of the topology file testfiles/lego/15-reversedmicelle/system.top is:

[molecules] POPC 100 SOL 300

The molecular dynamics parameters file is testfiles/lego/15-reversedmicelle/min.mdp. We use steepest decent algorithm to minimize the system for 20000 steps. integrator = steep nsteps = 20000 5.6. LEGO WITH GROMACS 57

The geometries of water and POPC are testfiles/lego/15-reversedmicelle/spce.xyz and testfiles/lego/15-reversedmicelle/popc.xyz, respectively. Pay attention that unlike ordinary XYZ files used before, the element names in XYZ files for AB- Cluster+Gromacs must be the same as those in topology files. For example, in testfiles/lego/15-reversedmicelle/spce.xyz 3 water OW 12.47 38.07 55.20 HW1 11.47 38.06 55.24 HW2 12.77 38.49 54.35

OW has to be used instead of O. The cluster file testfiles/lego/15-reversedmicelle/reversedmicelle.cluster is 2 popc.xyz 100 spce.xyz 300

The input file testfiles/lego/15-reversedmicelle/reversedmicelle.inp is reversedmicelle # Result file name reversedmicelle.cluster # Cluster file name 20 #Maximalnumberofcalculations >>>> micelle 4 13 50 50 50 15 8 8 insphere 50 50 50 14.5 7.5 7.5 >>>> gromacs4abc-1.py $inp$ system.gro 100 100 100 gmx_d grompp -quiet -c system.gro -f min.mdp -p system.top - o system-min.tpr 1>nul 2>nul gmx_d mdrun -quiet -deffnm system-min 1>nul 2>nul gromacs4abc-2.py system-min.gro system-min.log $out$ rm -rf system.gro system-min.gro system-min.log system-min. tpr system-min.trr system-min.edr mdout.mdp step*.pdb >>>> N

The strutural features indicate that water molecules are distributed inside an el- lipsoid of radii 14.5,7.5,7.5. The POPC molecules are distributed on the surface of a slightly larger ellipsoid, with the hydrophilic ends pointing toward water. Note that the centers are 50 50 50 because we want to put the reversed micelle in the middle of the simulation box. For the commands, the lines gmx d ... run the optimization, and the line rm -rf ... deletes the redundant files. Two Python files are needed for the transformation between XYZ and GRO file formats. They can be copied from misc/gromacs4abcluster. You must have Python installed on your computer. For gromacs4ab-2.py, nothing needs to be changed. For gromacs4ac-1.py, the last thress arguments 100 100 100 are the Gromacs simulation box size (in A!˚ NOT nm in Gromacs). Also, you need to open it and change the following part: residues = [ 58 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

("POPC", 100, 52), ("SOL", 300, 3) ] Each line is a tuple containing the residue name, number of the residues, and the number of atoms in the residue. You need to change them for your system. Now you can run the global optimization: nohup lego reversedmicelle.inp > reversedmicelle.out You will get 20 reversed micelles in reversedmicelle-LM. Figure 5.6.2 shows one example.

Figure 5.6.2: One reversed micelle generated by lego.

5.6.3 Example 16: Two Layers of POPC You can find all input and output files in testfiles/lego/16-layers. We will create two layers of POPC and optimize the membrane with Gromacs. The cluster file testfiles/lego/16-layers/layers.cluster: 2 popc.xyz 225 popc.xyz 225

The corresponding part of gromacs4abc-1.py should be changed: residues = [ ("POPC", 225, 52), ("POPC", 225, 52) ] 5.6. LEGO WITH GROMACS 59

The input file testfiles/lego/16-layers/layers.inp: layers #Result file name layers.cluster # Cluster file name 20 # Maximal number of calculations >>>> layer 4 13 0 0 0 1 2 2 45 2 100 45 100 2 45 layer 4 13 0 0 0 -1 2 2 95 2 100 95 100 2 95 >>>> gromacs4abc-1.py $inp$ system.gro 100 100 130 gmx_d grompp -quiet -c system.gro -f min.mdp -p system.top - o system-min.tpr 1>nul 2>nul gmx_d mdrun -quiet -deffnm system-min 1>nul 2>nul gromacs4abc-2.py system-min.gro system-min.log $out$ rm -rf system.gro system-min.gro system-min.log system-min. tpr system-min.trr system-min.edr mdout.mdp step*.pdb >>>> N

We can see that 0 0 1 and 0 0 -1 make the POPC pointing in opposite directions. Now run the global optimization: nohup lego layers.inp > layers.out

You will get 20 clusters in layers-LM. Figure 5.6.3 shows one example.

Figure 5.6.3: One cluster generated by lego.

Note that this double-layer is only an illustration example. It is NOT a real mem- brane used in biological studies. If you need single layer, you can remove one component from the clusters.

5.6.4 Theoretical Background

• The cluster structures obtained in these calculations must be equillibrated in sol- vents for some time (for membranes, at least 10 ns) before production molecular dynamics runs.

• The simulation box size must match the periodicity of the system. 60 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

5.7 lego with Lammps

Here, Lammps is used with lego to do global optimizations for the reactive force field ReaxFF.

5.7.1 Example 17: Ni38(CO)36 You can find all input and output files in testfiles/lego/17-ni38co36. Some experiments implied that small nickel cluster, Ni38 can activate CO (J. Chem. Phys., 1997, 107, 1861). Saturation coverage was observed as ceNi38(CO)36. We want to find the global minimum of this. The interaction is described with ReaxFF. Readers are assumed to be familiar with Lammps. Prepare the stucture of Ni38 and CO: ni38.xyz 38 Ni38 Ni 6.30445000 1.93201000 -2.23037000 Ni 4.85996000 5.16445000 -1.15818000 Ni 6.70744000 1.23898000 0.22006600 Ni 5.74416000 9.54662000 -0.22006600 Ni 5.09216000 7.62167000 -1.89751000 Ni 3.20439000 5.88555000 0.65338600 Ni 5.28009000 4.53206000 1.28405000 Ni 6.14715000 8.85359000 2.23037000 Ni 6.51910000 4.43722000 -2.96845000 Ni 9.24721000 4.90005000 -0.65338600 Ni 6.93911000 3.78532000 -0.53140300 Ni 8.63026000 3.07251000 -2.37730000 Ni 9.50536000 7.37548000 -1.42336000 Ni 8.03966000 4.98459000 3.63355000 Ni 7.59164000 5.62115000 1.15818000 Ni 8.85878000 5.54893000 -3.13491000 Ni 7.40243000 8.75335000 -2.04729000 Ni 4.19082000 3.32801000 -2.88128000 Ni 9.71249000 4.25973000 1.80483000 Ni 4.64124000 2.70675000 -0.40732300 Ni 9.93840000 6.73257000 1.05351000 Ni 7.17151000 6.25354000 -1.28405000 Ni 4.41194000 5.80101000 -3.63355000 Ni 2.51320000 4.05303000 -1.05351000 Ni 8.26078000 7.45759000 2.88128000 Ni 5.93250000 6.34838000 2.96845000 Ni 9.03050000 2.40846000 0.08907010 Ni 5.04917000 2.03225000 2.04729000 Ni 3.42110000 8.37714000 -0.08907010 Ni 7.81036000 8.07885000 0.40732300 Ni 3.82134000 7.71309000 2.37730000 Ni 3.59282000 5.23667000 3.13491000 Ni 6.75212000 6.91106000 -3.75579000 Ni 5.51249000 7.00028000 0.53140300 Ni 2.94624000 3.41012000 1.42336000 5.7. LEGO WITH LAMMPS 61

Ni 5.69948000 3.87454000 3.75579000 Ni 2.73911000 6.52587000 -1.80483000 Ni 7.35944000 3.16393000 1.89751000

co.xyz 2 CO C 6.22580000 5.39280000 -0.64315500 O 6.22580000 5.39280000 0.64315500

The cluser file ni38co36.clsuter 2 ni38 . xyz 1 co. xyz 36

The input file ni38co36.inp ni38co36 # Result file name ni38co36.cluster # Cluster file name 1000 # Maximal number of calculations >>>> pos 0. 0. 0. 0. 0. 0. onsurface 1 1 2 >>>> lammps4abc-1.py $inp$ data.abc -20. +20. -20. 20. -20. +20. 0 0 0 3 Ni C O set NUMBER_OF_PROCESSORS=8 & lmp_serial < in.abc > out.abc 2> nul lammps4abc-2.py dump.abc.xyz out.abc $out$ 3 Ni C O rm -rf log.cite log. data.abc out.abc dump.abc.xyz >>>>

In the structural feature part, the nickle cluster is fixed in space, and CO molecules are distributed on its surface. In the command part, lmp serial ... runs the Lammps calculation, rm ... deletes the redundant files. Three other files are needed: in.abc, lamps4abc-1.py, and lamps4abc-2.py. They can be copied from misc/lammps4abcluster. Also, a ReaxFF parameter file is needed. It is called CHOSMoNiLiBFPN.ff (J. Electrochem. Soc. 2014, 161, E3009), which can be found in testfiles/lego/17-ni38co36. In in.abc, change the following line according to your case. This line suggests the force field you use. pair_coeff * * CHOSMoNiLiBFPN.ff Ni C O # !!!! Change this line for your ReaxFF force field !!!

For lammps4abc-*.py, nothing needs to be changed in them. You have to change some arguments. For lammps4abc-1.py, the 3rd to 9th arguments are xl,xh,yl,yh,zl,zh,xy,xz,yz parameters in Lammps. Then, you need to write the number of elements and their ele- ment symbols. For lammps4abc-2.py, the 4th argument is also the number of eleents, followed by their element symbols. Now run the global optimization: nohup lego ni38co36.inp > ni38co36.out 62 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

You will get 1000 clusters in ni38co36-LM. Note that onsurface will put CO randomly on the surface. However, we can also try micelle, which put CO uniformly on the surface: micelle 1 2 0 0 0 5 5 5

Figure 5.7.1 shows some examples. It seems that clusters obtained by micelle are more stable. Of course, you should determine by yourself that which one (randomly vs. uniformly) is needed in your research.

Figure 5.7.1: Typical clusters of Ni38(CO)36 obtained by onsurface and micelle.

5.7.2 Theoretical Background • Choose the suitable ReaxFF force field. Even you have a parameter file “CHSN.ff”, it is possible that some cross-element cases, say C-S, are not well trained. Always check the original paper for this.

• ReaxFF has a multi-modal functional form. A large number of steps is needed.

5.8 lego with NWChem, ORCA, MOPAC

The script misc/nwchem4abcluster.sh, misc/orca4abcluster.sh, and misc/mopac4abcluster.sh can be used to combine ABCluster with NWChem, ORCA, and MOPAC, respectively. They can be used in lego in the same way. For example: aul #Resultfilename aul.cluster # Cluster file name 1000 # Maximal number of calculations >>>> insphere 0 0 0 5 5 5 micelle 1 1 1 2 12 23 0 0 0 6 6 6 >>>> mopac4abcluster.sh $xxx$ $inp$ $out$ >>>>

Of course, *.sh must be in PATH variable, or be called with path. 5.9. LEGO WITH DMOL3 63

5.9 lego with DMol3

The script misc/dmol34abcluster.sh can be used to combine ABCluster with DMol3 (Courtesy of Prof. Dr. Lei Ma and Mr. Kai Wang, Tianjin International Center for Nanoparticles and Nanosystems (TICNN), http://ticnn.tju.edu.cn).)

5.10 Energy Boundary Setting

When lego generates a cluster, the optimized structure will be read by lego and is used to generate new guesses. Of course, the ones with lower energy are better candidates. However, some bad structures can have low energies due to the deficiency of compu- tational chemical methods. In this case, it is favourable to set an energy boundary. A cluster that has an energy outside the boundary will be discarded, making global optimization more efficient.

2− 5.10.1 Example 18: EMIM3Cl5 You can find all input and output files in testfiles/lego/18-emimcl. In this subsection, we want to find the global minimum of an ionic liquid cluster 2− + − EMIM3Cl5 , which is composed of 3 EMIM and 5 Cl . Since the cation and anion are very regular organic/inorganic molecules, it is very reasonable to combine lego with xTB. Prepare the structures of EMIM+ and Cl−. emim.xyz: 19 EMIM(-) N 2.187469 -1.660192 -0.353068 C 1.757536 -1.644943 0.914236 N 2.232132 -0.542047 1.501845 C 2.953898 0.173011 0.586948 C 2.925068 -0.532309 -0.586489 C 1.840081 -2.674052 -1.355483 C 1.066029 -2.065377 -2.509750 C 1.870399 -0.072180 2.834270 H 1.086623 -2.352958 1.366123 H 3.400887 1.120444 0.826002 H 3.339576 -0.302858 -1.550584 H 2.769423 -3.133339 -1.691155 H 1.251164 -3.428139 -0.838516 H 0.822941 -2.851009 -3.223815 H 1.647546 -1.300251 -3.019763 H 0.146856 -1.608473 -2.156579 H 1.175041 0.756299 2.730042 H 2.772643 0.239439 3.353475 H 1.379866 -0.878443 3.367685

cl.xyz: 1 Cl (-) Cl 0.00000 0.00000 0.00000 64 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

Prepare the cluster file emimcl.cluster: 2 emim . xyz 3 cl. xyz 5

Now we are going to prepare emimcl.inp. emimcl # Result file name emimcl.cluster # Cluster file name 500 # Maximal number of calculations >>>> inbox 0 0 0 10 10 10 inbox 0 0 0 10 10 10 >>>> cp $inp$ $xxx$.xyz ../xtb $xxx$.xyz -chrg -2 -o > $xxx$.out energy=‘awk ’NR==2{print $2}’ xtbopt.xyz‘ ; sed -i "2c ${ energy}" xtbopt.xyz mv xtbopt.xyz $out$ rm $xxx$.xyz $xxx$.out charges wbo xtbopt.log xtbrestart >>>>

Note that we write -chrg -2 to tell xTB that the system has two negative charges. With these files, run the global optimization: nohup lego emimcl.inp > emimcl.out &

In the output file emimcl.out, we can find this: Reordered from low to high energy: ======

# Energy ======

466 -96.29691227 472 -96.29679381 ... 185 -96.27701445 314 -96.27661512 385 -96.27625570 34 -96.27581349 481 -96.27557124 384 -96.27543809

However, these low energy clusters are not bound ones. Due to the large Coulomb repulsion, one Cl– is pushed away, say 385.xyz. A bound cluster thus may have a higher energy. For example, a bound cluster 384.xyz is (−96.27543809) − (−96.27625570) = 0.00081 Hartree higher than 385.xyz. See Figure 5.10.1. Therefore, lego mistakenly treated these low energy yet unbound clusters as good clusters and spent a lot of time in looking for these unbound clusters. In this case, one can add some commands at the last line of emimcl.inp to increase the efficiency of global optimization: 5.10. ENERGY BOUNDARY SETTING 65

2− Figure 5.10.1: Two structures of EMIM3Cl5 . emimcl # Result file name emimcl.cluster # Cluster file name 500 # Maximal number of calculations >>>> inbox 0 0 0 10 10 10 inbox 0 0 0 10 10 10 >>>> cp $inp$ $xxx$.xyz ../xtb $xxx$.xyz -chrg -2 -o > $xxx$.out energy=‘awk ’NR==2{print $2}’ xtbopt.xyz‘ ; sed -i "2c ${ energy}" xtbopt.xyz mv xtbopt.xyz $out$ rm $xxx$.xyz $xxx$.out charges wbo xtbopt.log xtbrestart >>>> Y -96.2760 +100

The first character of the last line, Y means to do a pre-optimization (see Section 5.6.1). The following two real numbers means that only clusters that have energy in [−96.2760, +100.0000] are treated as good ones. The energy -96.2760 is obtained from the observation that all clusters having energy lower than -96.2760 are unbound ones, so the desired (bound) clusters should have a higher energy. Run the global optimization: nohup lego emimcl.inp > emimcl.out &

In the output file emimcl.out, we can find this: ======

# Energy ======

41 -96.27595920 428 -96.27578187 185 -96.27566801 356 -96.27546900 86 -96.27533139 461 -96.27522497 66 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO

...

We can see that, although 41.xyz and 428.xyz are still unbound clusters, 185.xyz is already a bound one (see Figure 5.10.2). This significantly increase the global optimiza- tion efficiency and accuracy. This is a highly important strategy for global optimization of complicated clusters.

2− Figure 5.10.2: Two structures of EMIM3Cl5 .

5.11 lego with More Programs

While I have provided a lot of interfaces, there are of course a lot of other programs for which interfaces are not provided, like ADF, BigDFT, etc. If you have written one and think it works well, I will be very appreciated if you could send it to me (mailto: ZhangJunQcc@gmail) thus I can put them in the next release of ABCluster. Your contribution will be acknowledged. People share and gain! Before finishing this chapter, I would like to remind you that it is possible to use more programs at the same time to increase the search efficiency of ABCluster. For example, use ABCluster, xTB and Gaussian: h2o4io3i2o5 # Result file name h2o4io3i2o5.cluster # Cluster file name 50 #Maximalnumberofcalculations >>>> inbox 0. 0. 0. 7. 7. 7. inbox 0. 0. 0. 7. 7. 7. >>>> cp $inp$ $xxx$.xyz ../xtb/bin/xtb $xxx$.xyz -gfn 1 -chrg +2 -o > $xxx$.out energy=‘awk ’NR==2{print $3}’ xtbopt.xyz‘ ; sed -i "2c ${ energy}" xtbopt.xyz mv xtbopt.xyz $inp$ rm $xxx$.xyz $xxx$.out charges wbo xtbopt.log xtbrestart ./xyz2gaussian optfile $inp$ > $xxx$.gjf g09 < $xxx$.gjf > $xxx$.log 2>/dev/null ./gaussian2xyz $xxx$.log > $out$ >>>> 5.11. LEGO WITH MORE PROGRAMS 67

In this case, the cluster guessed by ABCluster will first be optimized with xTB and are then submitted to Gaussian for further optimization. Of course, you can also first use ABCluster+xTB to search some clusters, then use Gaussian to further optimize the energetically low-lying ones. You can use the strategy you prefer! 68 CHAPTER 5. OPTIMIZATION WITH THIRD-PARTY PROGRAMS: LEGO Chapter 6

Atomic Clusters with Force Fields

6.1 Introduction

The atoms in an atomic cluster can interact with each by various kinds of potentials. These potentials are preferred by physists. For chemists, they can also be used but the results must be interpreted with care. Here “atom” can also mean “particle”, like an ion. ABCluster now supports many kinds of potentials. We have collected a lot of parameters in misc/atomic-force-field.txt. If there is no what you need, you have to search in the literature or fit the parameters by yourself.

1. Coulomb–Born–Mayer potential[4] CBMN . Very suitable for a description of ionic clusters. N N  2   X X e qiqj rij U = + B exp − (6.1.1) CBM 4π r ij ρ i=1 i

2. Lennard-Jones potential[5] (LJN ). Widely used to describe the dispersion inter- action in chemistry. N N  12  6! X X σij σij U = 4 − (6.1.2) LJ ij r r i=1 i

3. Coulomb–Lennard-Jones potential (CLJN ). Includes both the Coulomb and dis- persion interaction. N N  12  6!! X X qiqj σij σij U = + 4 − (6.1.3) LJ r ij r r i=1 i

4. Morse potential[6] (MN ). A more advanced form than the harmonic potential for the description of the vibration of molecules. N N X X 0  0  UM = ij exp −nβij rij − rij − n exp −βij rij − rij (6.1.4) i=1 i

5. Coulomb–Morse–Repulsion potential[7] (CMRN ). This is very useful in the simu- lation of oxides, silicates, and silica-based glasses. N N  X X qiqj UCMR = + Dij (exp (−2αij (rij − ρij)) rij i=1 i

69 70 CHAPTER 6. ATOMIC CLUSTERS WITH FORCE FIELDS

6. Z potential[8] (ZN ). This is inspired by an earlier potential proposed by Dzugutov[9, 10] which was designed to study glass formation. Unlike CBM, LJ and M po- tentials, they contain minima as well as maxima, which make the close-packing energetically unfavorable and lead to amorphous structures.

N N m ! X X eαrij  σ  U = a cos (2k r ) + b + V θ (r − r ) (6.1.6) Z r3 F ij r 0 c ij i=1 i

7. Girifalco[11] (GfN ). An effective potential of the fullerene-fullerene interaction.

N N ! X X 1 1 2 UGi = −α 3 + 3 − 4 sij (sij − 1) sij (sij + 1) sij i=1 i

8. Gupta potential[12] (GN ). A very important many-body potential for modeling metals.   N N    X X rij p  UG =  Aij exp −pij − 1 − ρ (ri) (6.1.11) d i=1 j=1 ij  j6=i where: N    X rij ρ (r ) = ξ2 exp −2q − 1 (6.1.12) i ij ij d j=1 ij j6=i

9. Sutton–Chen potential[13] (SCN ). Another many-body potential for modeling metals.   N N  p X 1 X aij p  USC =  ij − ρ (ri) (6.1.13) 2 r i=1  j=1 ij  j6=i where: N  q X aij ρ (r ) = c2 (6.1.14) i ij r j=1 ij j6=i

10. Modified Sutton–Chen potential[14] (SCMJBN ). In 2015, Januszko and Bose pro- posed a modified form of Sutton–Chen potential, which shows some improvement in reproducing experimental data:   N N  p X X aij p  USCMJB =  ij − ρ (ri) (6.1.15) r i=1 j=1 ij  j6=i 6.1. INTRODUCTION 71

where: N    X rij ρ (r ) = c2 exp −α − 1 (6.1.16) i ij ij a j=1 ij j6=i

11. Tersoff potential[15] (TN ). This very complex many-body potential is very useful for describing C, Si, Ge, N, B clusters. What’s attractive is that its formula contains bond order information, thus it can generate structures with reasonable coordination numbers.

N N 1 X X U = f (r )(U (r ) + b U (r )) (6.1.17) T 2 c ij R ij ij A ij i=1 j=1 j6=i

where:  1 rij < Rij  1 1 rij − Rij fc (rij) = + cos π Rij < rij < Sij (6.1.18) 2 2 Sij − Rij  0 Sij < rij

UR (rij) = Aij exp (−λijrij) (6.1.19)

UA (rij) = −Bij exp (−µijrij) (6.1.20)

− 1  mi mi  2mi bij = χij 1 + βi ξij (6.1.21)

N X ξij = fc (rik) ωikgijk (6.1.22) k=1 k6=i,j

 c 2 c2 g = 1 + i − i (6.1.23) ijk d 2 2 i di + (hi − cos θijk)

In (6.1.23), θijk is the angle formed by three atoms i, j and k, atom i being the center.

12. Extended Lennard-Jones potential (ELJN ). This is a more accurate version of Lennard-Jones potential, although at small size its GM does not change much compared to that of a usual LJ cluster.

N N kmax X X X ck UELJ = (6.1.24) rk i=1 i

Now we will see how to perform global optimization on these clusters. 72 CHAPTER 6. ATOMIC CLUSTERS WITH FORCE FIELDS

6.2 Example 1: 38 Lennard-Jones Particles

You can find all input and output files in testfiles/atomiccluster/1-lj38. We have 38 particles interacting with Lennard-Jones potential (6.1.2), denoting as LJ38. We want to get its global minimum. Step 1: In the ABCluster distribution, go to the directory testfiles/atomiccluster. Step 2: Use abcinp to generate the input files:

../../abcinp lj38 1 LennardJones 5.0 30 300 5 30 38 C Parameters for atom 0: sigma epsilon > 1.4 1.0

This line will be explained in the Section 6.3. Step 3: Run the global optimization:

../../atom-optimizer lj38.inp > lj38.out

Below is everything you get after optimization:

• lj38.out The main output file.

• lj38.xyz The global minimum in XYZ format. It can be read by e.g. VMD, CYLView.

• lj38.gjf The global minimum in Gaussian input format. It can be read by e.g. GaussView.

• lj38-LM Contains the local minima, each one having two files in XYZ and Gaussian input format, respectively. They are sorted by energy-increasing order, e.g. 0.xyz is lower in energy than 13.xyz.

• abcluster*.xyz/gjf The file containing the current found global minimum dur- ing the running of rigidmol-optimizer. If rigidmol-optimizer crashes before normal termination, one can use this abcluster*.xyz to start a new optimization.

Now, you can check the final global minimal energy in lj38.out: 29 -170.78466518 * Final Global Minimal Energy: -173.92842659 * The Global Minimum is saved as: [ lj38.(gjf/.xyz) ] with the geometry in lj38.xyz (See Figure 6.2.1 ). Also, in the directory lj38-LM, there are 30 local minima for you.

6.3 About abcinp

Now we want to explain in detail how to generate the input files with abcinp. abcinp will print help information when run without any arguments: abcinp filename kind_of_atoms forcefield amplitude sn gmax glimit nsaves natoms1 symbol1 ... -- For atomic clusters: forcefield = LennardJones: sigma epsilon forcefield = CoulombLennardJones: q sigma epsilon forcefield = Morse: power epsilon beta r0 forcefield = CoulombBornMayer: q B rho forcefield = CoulombMorseRepulsion: q D alpha rho C forcefield = Girifalco: nC A B d 6.3. ABOUT ABCINP 73

Figure 6.2.1: The global minimum of LJ38. forcefield = Dzugutov: a alpha kF b sigma m rC V0 forcefield = Gupta: A xi d p q forcefield = SuttonChen: p q epsilon a c forcefield = SuttonChenMJB: p epsilon a c alpha forcefield = Tersoff: A B lambda mu beta m c d h R S chi omega forcefield = ExLennardJones: maxk c6 c7 ... cmaxk

We will interpret all the arguments:

• filename The unique filename. The generated input files will be named as filename.inp, filename.par and filenamei.xyz.

• kind of atoms The number of atomic types. For example, in the case of MgO clusters, kind of atoms = 2.

• forcefield The name of the force field. Available choices for atomic clusters are:

– LennardJones, see (6.1.2). – CoulombLennardJones, see (6.1.3). – Morse, see (6.1.4). – CoulombBornMayer, see (6.1.1). – CoulombMorseRepulsion, see (6.1.5). – Girifalco, see (6.1.7). – Dzugutov, see (6.1.6). – Gupta, see (6.1.11) and (6.1.12). – SuttonChen, see (6.1.13) and (6.1.14). – SuttonChenMJB, see (6.1.15) and (6.1.16). – Tersoff, see (6.1.17). – ExLennardJones, see (6.1.24).

• amplitude The estimated size of the cluster in A,˚ corresponding to “L” mentioned in Section2.

• sn The size of the population of trial solutions, corresponding to “SN” mentioned in Section2. Recommended value: 10 to 300. 74 CHAPTER 6. ATOMIC CLUSTERS WITH FORCE FIELDS

• gmax The maximum cycle number, corresponding to “gmax” mentioned in Section 2. Recommended value: 100 to 100000 or larger.

• glimit The scout limit, corresponding to “glimit” mentioned in Section2. Recom- mended value: 2 to 10.

• nasves The number of local minima to be saved.

• natoms1 symbol1 ... For all kind of atoms atoms, its number and symbol must be given. Here the symbol is not necessarily an element symbol like C or Mg, but can be any strings, like CT2. After this, the program will require you to input force field parameters for different pairs of atoms. The parameters are exactly the ones used from (6.1.1) to (6.1.14) in Section 6.1. Now we give explicit correspondence between the variables in the program input and the potential expression:

Lennard-Jones, (6.1.2) sigma - σ; epsilon -  Coulomb–Lennard-Jones, (6.1.3) q - q; sigma - σ; epsilon -  Morse, (6.1.4) power - n; epsilon - ; beta - β; r0 - r0 Coulomb–Born–Mayer, (6.1.1) q - q; B - B; rho - ρ Coulomb–Morse–Repulsion, (6.1.5). q - q; D - D; alpha - α; rho - ρ; C - C Girifalco, (6.1.7) nC - NC; A - A;B - B;d - d; Dzugutov, (6.1.6) a - a; alpha - α; kF - kF; b - b; sigma - σ; m - m; rC - rC; V0 - V0 Gupta, (6.1.11) A - A; xi - ξ; d - d; p -p; q - q Sutton–Chen, (6.1.13) p -p; q - q; epsilon - ; a - a; c - c Modified Sutton-Chen (by Januszko–Bose), (6.1.15) p -p; epsilon - ; a - a; c - c; alpha - α Tersoff, (6.1.17) A -A; B - B; lambda - λ; mu - µ; beta - β; m - m; c - c; d - d; h - h; R - R; S - S; chi - χ, omega - ω Extended Lennard-Jones, (6.1.24) maxk - kmax, c6 - c6, ··· For instance, in the last section, we use the following command:

../../abcinp lj38 1 LennardJones 5.0 30 300 5 30 38 C Parameters for atom 0: sigma epsilon > 1.4 1.0

This means: Perform a global optimization on a LennardJones cluster, with L = 5.0, SN = 30, gmax = 300, glimit = 5, 30 local minima will be saved. We have 1 kind of particles, its number, and symbol is 38 and C, respectively. The generated file will be named as lj38*. After this, you will get three files:

• lj38.inp The main input file.

• lj38.par The parameter file.

• lj38i.xyz Initial guess in XYZ format.

Open lj38.inp you will find this: 38 #numberofatoms lj38i.xyz # initial guess file; * - random guess LennardJones # force field types lj38.par # force field parameters Q+ Q− 6.4. EXAMPLE 2: (MG O )20 75

30 #populationsize 300 # maximal generations 5 #scoutlimit 5.00000000 # amplitude lj38 # save optimized configuration to .xyz and .gjf 30 #numberofLMstobesaved

This file can, of course, be modified manually. Especially, if you do not have an initial guess file, you can change Line 2 to a star *, then ABCluster will automatically generate an initial guess.

Q+ Q− 6.4 Example 2: (Mg O )20

You can find all input and output files in testfiles/atomiccluster/2-mgo20. In this section, we will find that the parameters can change the global minima signif- icantly. We consider (MgO)20. It can be described by Coulomb–Born–Mayer potential 6.1.1. A set of parameters is (J. Phys. C 1985, 18, 1149): B(Mg − O) = 821.6; B(Mg − Mg) = 0.0; B(O − O) = 22764 ρ(Mg − O) = 0.3242; ρ(Mg − Mg) = 0.1; ρ(O − O) = 0.1490 qMg = +2.0; qO = −2.0

If we use L = 5.0, SN = 100, gmax = 100, glimit = 5, then we can perform the global optimization:

../../abcinp mg20o20-q2 2 CoulombBornMayer 5.0 100 100 5 30 20 Mg 20 O Parameters for atom 0: q > +2 Parameters for atom 1: q > -2 Parameters for atom-pair 0-0: B rho > 0.0 0.1 Parameters for atom-pair 0-1: B rho > 821.6 0.3242 Parameters for atom-pair 1-1: B rho > 22746 0.1490

Since we have 2 kinds of atoms, “Mg” and “O”, we have to write 20 Mg 20 O to indicate that we have 20 Mg and 20 O atoms. Now perform the optimization: atom-optimizer mg20o20-q2.inp > mg20o20-q2.out Before looking at its geometry, what will it be if the formal charge Q on Mg and O are not 2.0, but other numbers, e.g. 1.5 and 1.0? Let’s try it. Generate the input files for Mg1.5+O1.5– ../../abcinp mg20o20-q1.5 2 CoulombBornMayer 5.0 100 100 5 30 20 Mg 20 O Parameters for atom 0: q > +1.5 Parameters for atom 1: q > -1.5 Parameters for atom-pair 0-0: B rho > 0.0 0.1 Parameters for atom-pair 0-1: B rho > 821.6 0.3242 Parameters for atom-pair 1-1: B rho > 22746 0.1490 and for Mg1.0+O1.0– ../../abcinp mg20o20-q1 2 CoulombBornMayer 5.0 100 100 5 30 20 Mg 20 O Parameters for atom 0: q > +1.0 Parameters for atom 1: q > -1.0 Parameters for atom-pair 0-0: B rho > 0.0 0.1 Parameters for atom-pair 0-1: B rho > 821.6 0.3242 Parameters for atom-pair 1-1: B rho > 22746 0.1490 76 CHAPTER 6. ATOMIC CLUSTERS WITH FORCE FIELDS

Run them! atom-optimizer mg20o20-q1.5.inp > mg20o20-q1.5.out atom-optimizer mg20o20-q1.inp > mg20o20-q1.out

Now check mg20o20-q2.xyz, mg20o20-q1.5.xyz and mg20o20-q1.xyz, you will ob- serve that the global minimum is a sphere, tube and cuboid, respectively!

Figure 6.4.1: The global minimum of (MgO)20.

6.5 Example 3: Silve and Copper Clusters

You can find all input and output files in testfiles/atomiccluster/3-alloy.

6.5.1 Ag38 and Cu38 Assume you get a silver and copper cluster. By mass spectroscopy, you know that their formulae are Ag38 and Cu38, respectively. What are their most stable structures? The best potential for metal clusters is Gupta potential (6.1.11). From J. Chem. Phys. 2011, 135, 164109, one can find their Gupta potential parameters:

A ξ d p q Ag-Ag 0.1028 1.1780 2.8885 10.928 3.1390 Cu-Cu 0.0855 1.2240 2.5562 10.960 2.2780 Cu-Ag 0.0980 1.2274 2.7224 10.700 2.8050

OK, now we can perform the global optimization. Let’s see Ag38 first. Step 1: Use abcinp to generate the input files: abcinp Ag38 1 Gupta 10 100 100 5 20 38 Ag Parameters for atom-pair 0-0: A xi d p q > 0.1028 1.1780 2.8885 10.928 3.1390

Step 2: Run the optimization: nohup atom-optimizer Ag38.inp > Ag38.out &

Step 3: Now we examine the structure by opening the file Ag38.xyz. See Figure 6.5.1. Now we do the same for Cu38. Step 1: Use abcinp to generate the input files: 6.6. EXAMPLE 4: PEROVSKITE CLUSTERS (CATIO3)5 77 abcinp Cu38 1 Gupta 10 100 100 5 20 38 Cu Parameters for atom-pair 0-0: A xi d p q > 0.0855 1.2240 2.5562 10.960 2.2780 Step 2: Run the optimization: nohup atom-optimizer Cu38.inp > Cu38.out & Step 3: Now we examine the structure by opening the file Ag38.xyz,. See Figure 6.5.1. Interestingly, both are a truncated octahedron.

Ag38 Cu38

Figure 6.5.1: The global minimum of Ag38 and Cu38.

6.5.2 Ag32Cu6 However, you may get a “nanoalloy”, a mixture of silver and copper atoms. For example, the alloy is Ag32Cu6. What shape will it be? Still truncated octahedron? Let’s see. Step 1: Use abcinp to generate the input files: abcinp Ag32Cu6 2 Gupta 10 3000 5000 5 20 32 Ag 6 Cu Parameters for atom-pair 0-0: A xi d p q > 0.1028 1.1780 2.8885 10.928 3.1390 Parameters for atom-pair 0-1: A xi d p q > 0.0980 1.2274 2.7224 10.700 2.8050 Parameters for atom-pair 1-1: A xi d p q > 0.0855 1.2240 2.5562 10.960 2.2780 Note that, for mixed alloys, the number of steps required to find the global minimum may be very large. In ABCluster 1.1 or 1.2 we have to set very large SN and gmax, see examples files in Ag32Cu6-slow-1.1 where SN = 3000 and gmax = 5000!. Fortunately, from ABCluster 1.3, we improved the algorithm significantly and now moderately pa- rameters work quiet well! Try to set SN = 300 and gmax = 300. During the running, you can examine the current global minimum by examing the temporal file abcluster*.xyz. Step 2: Run the optimization: nohup atom-optimizer Ag32Cu6.inp > Ag32Cu6.out & Step 3: Now we examine the structure by opening the file Ag32Cu6.xyz. See Figure 6.5.2. Amazingly, it is a “pancake”, with the six copper atoms forming a hexagonal ring!

6.6 Example 4: Perovskite Clusters (CaTiO3)5

You can find all input and output files in testfiles/atomiccluster/4-catio3. Perovskite recently attracts much attention from its scientific community due to its unexpected application in solar cells. Assume now you want to know the structure of (CaTiO3)5, you can do this job by ABCluster. For such systems, the so-called Coulomb– Morse–Repulsion potential (6.1.5) can be used. One can get the interaction parameter 78 CHAPTER 6. ATOMIC CLUSTERS WITH FORCE FIELDS

Ag32Cu6

Figure 6.5.2: The global minimum of Ag32Cu6.

Ca-O, Ti-O and O-O from Ref. [7]. For cation interaction Ca-Ca and Ti-Ti, only the Coulomb term (1/r) and strong repulsion term (1/r12) are considered (Assume C = 22), the Morse term can be assumed to be zero (thus D, α and ρ are all zero). The final parameters are:

q(Ca) = +1.2 q(Ti) = +2.4 q(O) = −1.2 D α ρ C Ca-Ca 0 0 0 22.0 Ca-Ti 0 0 0 22.0 Ca-O 0.030211 2.241334 2.923245 5.0 Ti-Ti 0 0 0 22.0 Ti-O 0.024235 2.254703 2.708943 1.0 O-O 0.042395 1.379316 3.618701 22.0

Now the optimization starts. Step 1: Use abcinp to generate the input files: abcinp catio3 3 CoulombMorseRepulsion 10 100 1000 5 10 5 Ca 5 Ti 15 O Parameters for atom 0: q > +1.2 Parameters for atom 1: q > +2.4 Parameters for atom 2: q > -1.2 Parameters for atom-pair 0-0: D alpha rho C > 0 0 0 22.0 Parameters for atom-pair 0-1: D alpha rho C > 0 0 0 22.0 Parameters for atom-pair 0-2: D alpha rho C > 0.030211 2.241334 2.923245 5.0 Parameters for atom-pair 1-1: D alpha rho C > 0 0 0 22.0 Parameters for atom-pair 1-2: D alpha rho C > 0.024235 2.254703 2.708943 1.0 Parameters for atom-pair 2-2: D alpha rho C > 0.042395 1.379316 3.618701 22.0 Step 2: Run the optimization: nohup atom-optimizer catio3.inp > catio3.out & Step 3: Now we examine the structure by opening the file catio3.xyz. See Figure 6.6.1. Note that it is very different from a bulk, perovskite structure.

6.7 Example 5: C16 and Ge16 Clusters

You can find all input and output files in testfiles/atomiccluster/5-csige. C16 and Ge16 clusters are inorganic clusters with very delocalized interactions. A suitable description requires quantum chemistry. However one may use Tersoff potential for a first exploration. The Tersoff potential parameters for C and Ge are listed below: 6.7. EXAMPLE 5: C16 AND GE16 CLUSTERS 79

Figure 6.6.1: The global minimum of (CaTiO3)5.

Element C Ge A 1393.6 1769.0 B 346.7 419.23 λ 3.4879 2.4451 µ 2.2119 1.7047 β 0.0000001524 0.00000090166 m 0.72751 0.75627 c 38049.0 106430.0 d 4.384 15.652 h −0.57058 −0.43884 R 1.8 2.8 S 2.1 3.1 ω 1.0 1.0 ξ 1.0 1.0

Using these parameters, it is not difficult to get the global minima of C16 and Ge16. For C16: Step 1: Use abcinp to generate the input files: abcinp c 1 Tersoff 5 20 2000 5 10 $1 c Parameters for atom 0: A B lambda mu beta m c d h R S > 1393.6 346.7 3.4879 2.2119 0.0000001524 0.72751 38049.0 4.384 -0.57058 1.8 2.1 Parameters for atom-pair 0-0: kai omega > 1.0 1.0

Step 2: Run the optimization: nohup atom-optimizer c.inp > c.out &

For Ge16 you can do the same thing. The global minima are shown in Figure 6.7.1. 80 CHAPTER 6. ATOMIC CLUSTERS WITH FORCE FIELDS

Figure 6.7.1: The global minimum of (C)16 and (Ge)16. Appendix A

Version History

• Version 2.1 (Released on: Jun. 2, 2020):

1. isomer can generate atomic clusters with specific point group symmetry! 2. A completely new lego has been available for complicated clusters at the nanometer scale including gas phase, ligated, surface-supported, and assemble of clusters. 3. Besides global optimization, ABCluster can be used as a powerful structure generator. 4. More interfaces to third-party programs are provided officially: CP2K, Gro- macs, and Lammps. 5. The manual is supplied with many new examples.

• Version 2.0 (Released on: Aug. 1, 2018):

1. For rigidmol-optimizer, ABCluster can study the molecular clusters in an external electric field. 2. For isomer and lego, the algorithm to generate initial guess (thus the search efficiency) has been improved siginificantly (For example, clashes removing, coarse optimization)! 3. isomer and lego has been parallelized for both single and many nodes! 4. Official support for isomer and lego with DMol3 is provided (Courtesy of Prof. Dr. Lei Ma and Mr. Kai Wang, Tianjin International Center for Nanoparticles and Nanosystems (TICNN), http://ticnn.tju.edu.cn).

• Version 1.5.1 (Released on: Dec. 18, 2017):

1. Official support for isomer and lego with ORCA, NWChem, and xTB are provided. 2. The evaluation codes have been optimized.

• Version 1.5 (Released on: Dec. 18, 2016):

1. A component cg-optimizer is added to support the anistropic, coarse-grained particles, including electric multipole interaction and Paramonov–Yaliraki po- tential. 2. The component rigidmol-optimizer supports 1D, 2D and 3D periodic bound- ary conditions.

81 82 APPENDIX A. VERSION HISTORY

3. New modified Sutton–Chen (J. Phys. Chem. Solids, 2015, 82, 67–75) and extended Lennard-Jones potential are supported. 4. A new keyword surface is added to lego for better supporting surface ab- sorption. 5. The output of isomer and lego are optimized.

• Version 1.4 (Released on: Apr. 5, 2016):

1. The new component lego has been added to support to search by third-party programs for both molecular and atomic clusters. 2. New Tersoff potential is supported.

• Version 1.3 (Released on: Jan. 22, 2016): New algorithm has been introduced. Now the efficiency of multi-component atomic clusters (e.g. Ag14Cu24) has been improved by 100 times!

• Version 1.2 (Released on: Nov. 6, 2015): The interfaces for third-party programs are available! Now ABCluster can do the global optimization with any quantum chemistry programs!

• Version 1.1 (Released on: Oct. 19, 2015): The optimization of Gupta and Sutton– Chen potential is siginificantly improved.

• Version 1.0 (Released on: Oct. 1, 2015): The first released version. Bibliography

[1] D. Liu, J. Nocedal, On the Lmited Memory BFGS Method for Large Scale Opti- mization, Math. Program. 1989, 45 (1-3):503–528.

[2] D. Karaboga, An Idea Based on Honey Bee Swarm for Numerical Optimization, Erciyes University: Technical Report TR06 2005.

[3] J. Zhang, M. Dolg, ABCluster: The Artificial Bee Colony Algorithm for Cluster Global Optimization, Phys. Chem. Chem. Phys. 2015, 17 :24173–24181.

[4] M. Born, J. E. Mayer, Zur Gittertheorie der Ionenkristalle, Z. Physik 1932, 75 (1- 2):1–18.

[5] J. Lennard-Jones, On the Determination of Molecular Fields, Proc. R. Soc. Lond. A. 1924, 106 :463–477.

[6] P. Morse, Diatomic Molecules According to the Wave Mechanics. II. Vibrational Levels, Phys. Rev. 1929, 34 :57–64.

[7] A. Pedone, G. Malavasi, M. C. Menziani, A. N. Cormack, U. Segre, A New Self- Consistent Empirical Interatomic Potential Model for Oxides, Silicates, and Silica- Based Glasses, J. Phys. Chem. B 2006, 110 (24):11780–11795.

[8] J. P. K. Doye, D. J. Wales, F. H. M. Zetterling, M. Dzugutov, The Favored Cluster Structures of Model Glass Formers, J. Chem. Phys. 2003, 118 (6):2792–2799.

[9] M. Dzugutov, Glass Formation in a Simple Monatomic Liquid with Icosahedral Inherent Local Order, Phys. Rev. A 1992, 46 :R2984–R2987.

[10] M. Dzugutov, Monatomic Model of Icosahedrally Ordered Metallic Glass Formers, J. Non-Cryst. Solids 1993, 156-158 (0):173–176.

[11] L. A. Girifalco, Molecular Properties of Fullerene in the Gas and Solid Phases, The Journal of Physical Chemistry 1992, 96 (2):858–861.

[12] R. P. Gupta, Lattice Relaxation at a Metal Surface, Phys. Rev. B 1981, 23 :6265– 6270.

[13] A. P. Sutton, J. Chen, Long-range Finnis–Sinclair Potentials, Phil. Mag. Lett. 1990, 61 (3):139–146.

[14] A. Januszko, S. Bose, Phonon Spectra and Temperature Variation of Bulk Proper- ties of Cu, Ag, Au and Pt Using Sutton–Chen and Modified Sutton–Chen Poten- tials, J. Phys. Chem. Solids 2015, 82 :67–75.

[15] J. Tersoff, New Empirical Approach for the Structure and Energy of Covalent Sys- tems, Phys. Rev. B 1988, 37 :6991–7000.

83