Commit ac1916cb authored by Malthe Kjær Bisbo's avatar Malthe Kjær Bisbo
Browse files

added EMT tutorial, including tutorial on constrining free atoms during search

parent 9588e095
import numpy as np
from ase.build import fcc111
from ase.constraints import FixAtoms
from ase.calculators.emt import EMT
from gofee.candidates import CandidateGenerator, StartGenerator, RattleMutation, PermutationMutation
from gofee.utils import OperationConstraint
from gofee import GOFEE
### Define calculator ###
calc = EMT()
### Set up system ###
# 1-layer fixed Cu(111) slab
template = fcc111('Cu', size=(5, 5, 1), vacuum=10.0)
c = FixAtoms(indices=np.arange(len(template)))
template.set_constraint(c)
# Stoichiometry of atoms to be placed
stoichiometry = 7*[79]
## Box for startgenerator and rattle-mutation
k = 0.2 # Shrinkage fraction from each side of the box in v[0] and v[1] directions.
cell = template.get_cell()
# Initialize box with cell
v = np.copy(cell)
# Set height of box
v[2][2] = 5
# Shrink box in v[0] and v[1] directions
v[0] *= (1-2*k)
v[1] *= (1-2*k)
# Chose anker point p0 so box in centered in v[0] and v[1] directions.
z_max_slab = np.max(template.get_positions()[:,2])
p0 = np.array((0, 0, z_max_slab+0.3)) + k*(cell[0]+cell[1])
# Make box
box = [p0, v]
# initialize startgenerator (used to generate initial structures)
sg = StartGenerator(template, stoichiometry, box)
### Set up candidate generation operations ###
# Set up constraint for rattle-mutation
box_constraint = OperationConstraint(box=box)
# initialize rattle-mutation
n_to_optimize = len(stoichiometry)
rattle = RattleMutation(n_to_optimize, Nrattle=2, rattle_range=4)
candidate_generator = CandidateGenerator([0.2, 0.8], [sg, rattle])
### Initialize and run search ###
search = GOFEE(calc=calc,
startgenerator=sg,
candidate_generator=candidate_generator,
max_steps=150,
population_size=5,
position_constraint=box_constraint)
search.run()
\ No newline at end of file
import numpy as np
from ase import Atoms
from ase.calculators.emt import EMT
from gofee.candidates import CandidateGenerator, StartGenerator, RattleMutation
from gofee import GOFEE
### Define calculator ###
calc = EMT()
### Set up system ###
# make empty cell
template = Atoms('',
cell=[20,20,20],
pbc=[0, 0, 0])
# Stoichiometry of atoms to be placed
stoichiometry = 15*[29]
# Box in which to place atoms randomly
v = 5*np.eye(3)
p0 = np.array((7.5, 7.5, 7.5))
box = [p0, v]
# initialize startgenerator (used to generate initial structures)
sg = StartGenerator(template, stoichiometry, box)
### Set up candidate generation operations ###
# initialize rattle mutation
n_to_optimize = len(stoichiometry)
rattle = RattleMutation(n_to_optimize, Nrattle=3, rattle_range=4)
candidate_generator = CandidateGenerator(probabilities=[0.2, 0.8],
operations=[sg, rattle])
### Initialize and run search ###
search = GOFEE(calc=calc,
startgenerator=sg,
candidate_generator=candidate_generator,
max_steps=60,
population_size=5)
search.run()
\ No newline at end of file
......@@ -11,3 +11,62 @@ In this search we will utilize an :class:`OperationConstraint`
to constraint the :class:`RattleMutation` to only rattle the
atoms within a certain box in space that we define.
The following script :download:`Au7_on_Cu111.py` is used to carry
out the constrainted search:
.. literalinclude:: Au7_on_Cu111.py
If ASE and GPAW are set up and sourced propperly, you can run
the code as::
mpiexec --mca mpi_warn_on_fork 0 gpaw-python Au7_on_Cu111.py
What follows is a description of the elements of the python code
above, which relates to consraining the atomix position during
the search.
Box setup
---------
As previously in the :ref:`Cu15 cluster search <cu_cluster_search>`,
we define a box in which initial atoms are placed. In this example we
will also use this box to constrain the position of the "free" atoms
during the search.
Defining a box positioned 0.3Å above the slab, with a height of 5Å and
with xy-dimensions shrunk, from all sides by a fraction "k", relative
to the cell xy-dimensions, can be achieved by::
## Box for startgenerator and rattle-mutation
k = 0.2 # Shrinkage fraction from each side of the box in v[0] and v[1] directions.
cell = template.get_cell()
# Initialize box with cell
v = np.copy(cell)
# Set height of box
v[2][2] = 5
# Shrink box in v[0] and v[1] directions
v[0] *= (1-2*k)
v[1] *= (1-2*k)
# Chose anker point p0 so box in centered in v[0] and v[1] directions.
z_max_slab = np.max(template.get_positions()[:,2])
p0 = np.array((0, 0, z_max_slab+0.3)) + k*(cell[0]+cell[1])
# Make box
box = [p0, v]
Constraint object
-----------------
The constrraint object is made using::
from gofee.utils import OperationConstraint
box_constraint = OperationConstraint(box=box)
Initialize constrained GOFEE search
-----------------------------------
The constrained GOFEE search is initialized using the ``position_constraint``
keyword::
from gofee import GOFEE
search = GOFEE(calc=calc,
startgenerator=sg,
candidate_generator=candidate_generator,
max_steps=150,
population_size=5,
position_constraint=box_constraint)
\ No newline at end of file
.. _cu_cluster_search:
=============
Cu15 with EMT
=============
In this tutorial we carry out a search for isolated Cu15-clusters
described by the EMT potential for efficiency.
The following script :download:`Cu15.py` is used to carry out the search
(the indivitual elements of the code are explainted further below):
.. literalinclude:: Cu15.py
If ASE and GPAW are set up and sourced propperly, you can run
the code as::
mpiexec --mca mpi_warn_on_fork 0 gpaw-python Cu15.py
What follows is a description of the python script above.
Setting up the system
=====================
An important prerequisite for starting a search is to set up the system.
This is done by defining a template and a stoichiometry of the atoms to
optimize.
The *template* is an :class:`Atoms` object, either describing an empty cell or
a cell containing for example a slab of atoms. For most purposes, the atoms
in the template shold be fixed using the :class:`ase.constraints.FixAtoms`
constraint, as the template atoms are kept fixed during mutation operation,
but will take part in surrogate-relaxation if not fixed.
In this example the template is taken to be an empty 20Åx20Åx20Å cell, since
we considder isolated Cu-clusters. The code to generate the template is::
from ase import Atoms
template = Atoms('',
cell=[20,20,20],
pbc=[0, 0, 0])
The *stoichiometry* of atoms to optimize is a list of atomic numbers. In this
case 15 copper atoms (atomic nymber 29)::
stoichiometry = 15*[29]
Startgenerater - for making initial structures
==============================================
To initialize the search, initial structures need to be generated. This is
carried out using the :class:`StartGenerator`, which in addition to the
*template* and *stoichiometry* defined above, need a *box* in which to randomly
place the atoms defined in the *stoichiometry*.
The *box* is naturally defined by a point *p0* and three spanning vectors going
out from that point. These are defined bu the 3x3 matrix *v* in the example.
In the example a 20Åx20Åx20Å square box in the center of the cell is used::
import numpy as np
v = 5*np.eye(3)
p0 = np.array((7.5, 7.5, 7.5))
box = [p0, v]
The *startgenerator* can then be initialized with the code::
from gofee.candidates import StartGenerator
sg = StartGenerator(template, stoichiometry, box)
CandidateGenerator
==================
In GOFEE, the configurational space is explored by generation new candidate structures.
New candidates can be either completely random structures made using the *startgenerator*
or they can be the result of applying mutation operations to a population of some of the
best structures visited during the search. Examples of mutaion operations are the
:class:`RattleMutation`, which randomly shifts some of the atoms and the
:class:`PermutaionMutation` which randomly permutes some atoms of different type.
In this example we only optimize atoms of a single type, and therfor only use the
:class:`RattleMutation`, initializing it to rattle on average Natoms=3 atoms a maximum
distance of rattle_range=4Å, is achieved with::
from gofee.candidates import RattleMutation
n_to_optimize = len(stoichiometry)
rattle = RattleMutation(n_to_optimize, Nrattle=3, rattle_range=4)
Given some of the above described operations. e.g. a :class:`StartGenerator`
and a :class:`RattleMutation`, one can initialize a :class:`CandidateGenerator`,
which handles the generation of new candidates by applying the supplied
*operations* with probability specified in the *probabilities* list.
A CandidateGenerator which uses the startgenerator *sg* with 20% probability and
the rattle operation *rattle* with 80% probability, is initialized as follows::
from gofee.candidates import CandidateGenerator
candidate_generator = CandidateGenerator(probabilities=[0.2, 0.8],
operations=[sg, rattle])
Initialize and run GOFEE
========================
With all the above objects defined, we are ready to initialize and run GOFEE.
To run the search for 60 iterations with a population size of 5, use::
from gofee import GOFEE
search = GOFEE(calc=calc,
startgenerator=sg,
candidate_generator=candidate_generator,
max_steps=60,
population_size=5)
search.run()
This tutorial relies on many default settings of GOFEE, which could be changed.
To see how these settings are changed, have a look at the other tutorials.
.. _modify_gpr:
=========================
Modifying surrogate model
=========================
This tutorial extends the previous one for TiO clusters,
:ref:`searching for TiO clusters <searching-for-TiO-clusters>`. It is
This tutorial extends the previous one for
:ref:`Cu15 clusters <cu_cluster_search>`. It is
therefore recomended that you do that one before the present one.
In the avove mentioned tutorial GOFEE was initialized with the following
arguments::
from gofee import GOFEE
search = GOFEE(calc=calc,
startgenerator=sg,
candidate_generator=candidate_generator,
max_steps=100,
max_steps=60,
population_size=5)
however GOFEE takes a number of other arguments, including a
......@@ -20,19 +23,19 @@ Gaussian Process regression (GPR) model, which is actively learned
during the search and used for cheap optimization of new candidates.
One can for example apply a GPR model with another degree of regularization
in the search. As the regularization is a parameter of the *kernel*, passed
to the GPR model, the code will look like this::
in the search. This is controlled by the ``noise`` parameter of the ``kernel``,
passed to the GPR model. The modification can be achieved by::
from gofee.surrogate.gpr import GPR
from gofee.surrogate.kernel import double_gauss_kernel
from gofee.surrogate import GPR
from gofee.surrogate.kernel import DoubleGaussKernel
kernel = double_gauss_kernel(noise=1e-6)
kernel = DoubleGaussKernel(noise=1e-6)
gpr = GPR(kernel=kernel)
search = GOFEE(calc=calc,
gpr=gpr,
startgenerator=sg,
candidate_generator=candidate_generator,
max_steps=100,
max_steps=60,
population_size=5)
......@@ -53,5 +53,5 @@ Then define the *box* within which the :class:`StartGenerator` places atoms rand
Finally the :class:`StartGenerator` can be initialized::
from candidate_operations.candidate_generation import StartGenerator
from gofee.candidates import StartGenerator
sg = StartGenerator(slab, stoichiometry, box)
\ No newline at end of file
......@@ -9,6 +9,16 @@ This is the turorial for the GOFEE structure search.
.. toctree::
:maxdepth: 1
cu_clusters/cu_clusters
au_on_cu/au_on_cu
modifying_surrogate_model/modifying_surrogate_model
tio_clusters/tio_clusters
tio2_reconstruction/tio2_reconstruction
modifying_surrogate_model/modifying_surrogate_model
\ No newline at end of file
Different types of searches/modifications covered in these
tutorials include:
* Isolated clusters (see :ref:`here <cu_cluster_search>`)
* Constraining the positions of the free atoms during the search (see :ref:`here <au_on_cu_search>`)
* Surface reconstruction (see :ref:`here <au_on_cu_search>`)
* Modifying the surrogate model (see :ref:`here <modify_gpr>`)
......@@ -164,9 +164,11 @@ systems.</p>
<li class="toctree-l1"><a class="reference internal" href="getting_started/getting_started.html">Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="SLURM/SLURM.html">SLURM job examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial/tutorial.html">Tutorial</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial/cu_clusters/cu_clusters.html">Cu15 with EMT</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial/au_on_cu/au_on_cu.html">Au7 in Cu(111) with EMT</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial/modifying_surrogate_model/modifying_surrogate_model.html">Modifying surrogate model</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial/tio_clusters/tio_clusters.html">Searching for TiO clusters</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial/tio2_reconstruction/tio2_reconstruction.html">Searching for the TiO2(001)-(1x4) reconstruction</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial/modifying_surrogate_model/modifying_surrogate_model.html">Modifying surrogate model</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="GOFEE/GOFEE.html">GOFEE</a><ul>
......
Search.setIndex({docnames:["GOFEE/GOFEE","SLURM/SLURM","getting_started/getting_started","index","installation/installation","tutorial/au_on_cu/au_on_cu","tutorial/modifying_surrogate_model/modifying_surrogate_model","tutorial/tio2_reconstruction/tio2_reconstruction","tutorial/tio_clusters/tio_clusters","tutorial/tutorial"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:56},filenames:["GOFEE/GOFEE.rst","SLURM/SLURM.rst","getting_started/getting_started.rst","index.rst","installation/installation.rst","tutorial/au_on_cu/au_on_cu.rst","tutorial/modifying_surrogate_model/modifying_surrogate_model.rst","tutorial/tio2_reconstruction/tio2_reconstruction.rst","tutorial/tio_clusters/tio_clusters.rst","tutorial/tutorial.rst"],objects:{"gofee.GOFEE":{run:[0,1,1,""]},"gofee.candidates":{CandidateGenerator:[0,0,1,""],PermutationMutation:[0,0,1,""],RattleMutation2:[0,0,1,""],RattleMutation:[0,0,1,""],StartGenerator:[0,0,1,""]},"gofee.candidates.CandidateGenerator":{get_new_candidate:[0,1,1,""]},gofee:{GOFEE:[0,0,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"]},objtypes:{"0":"py:class","1":"py:method"},terms:{"1x4":[3,9],"20\u00e5x20\u00e5x20\u00e5":8,"30g":1,"3x3":8,"boolean":0,"case":[0,7,8],"class":[0,8],"default":[0,8],"export":[1,4],"final":[4,7],"float":0,"function":[0,4],"import":[6,7,8],"int":0,"new":[0,6,8],"super":0,"true":0,ASE:[0,2,4,7,8],For:[7,8],One:6,The:[0,3,4,7,8],Then:[4,7],These:8,Use:0,Used:0,With:8,abov:[7,8],accord:0,achiev:4,acquisit:0,activ:6,adding:0,addit:[0,2,8],after:4,all:[0,8],allow:0,alreadi:2,also:[0,2],altern:0,alwai:0,angstrom:0,anoth:6,appli:[0,6,8],arg:0,argument:6,arrai:[7,8],ase:[7,8],assum:4,atom:[0,2,5,8],atomist:[2,3],avali:4,averag:[0,8],avov:6,base:0,bash:1,basic:2,basic_mut:8,befor:[2,6,7],below:[0,8],best:8,between:0,bin:1,blmax:0,blmin:0,bool:0,both:[0,4],box:[0,5,7,8],box_to_place_in:0,build_cod:4,bulk:7,calc:[0,6,7,8],calcul:[0,1,7,8],call:4,can:[0,1,2,4,6,7,8],cancid:0,candid:[0,6,7,8],candidate_gener:[0,6,7,8],candidate_generatior:0,candidate_oper:[7,8],candidategener:[3,7],candomli:0,carri:[5,7,8],cell:[0,8],center:8,certain:5,chang:8,cheap:6,choos:7,chose:0,closest:0,cluster:[0,1,3,5,6,7,9],code:[1,4,6,7,8],compil:4,complet:[2,8],configur:8,consecut:0,considd:[0,8],constraint:[0,5,8],contain:[0,1,7,8],continu:2,coordin:0,core:1,corner:0,could:8,coval:0,cpu:1,creat:8,crossov:0,cymem:4,cython:4,d_cov:0,date:1,defin:[0,5,7,8],degre:6,depend:0,describ:[0,1,8],descript:[0,8],descriptor:4,desir:1,detail:7,dftb:[1,7,8],dict:0,differ:[7,8],dimens:0,directori:1,distanc:[0,8],done:[0,2,4,8],double_gauss_kernel:6,download:4,drawn:0,dualpoint:0,dure:[0,6,8],each:0,echo:1,either:[0,8],element:8,empti:[0,7,8],energi:[0,3,8],enforc:0,environ:2,especi:2,evalu:[0,4,8],exampl:[2,3,6,8],exclus:1,experi:2,explaint:8,explor:8,express:[0,3],extend:6,eye:8,fals:0,familiar:2,fermi:[7,8],file:[0,1,2,4,7],filenam:0,finish:1,first:[3,7],fix:[7,8],fixatom:8,folder:[1,4],follow:[6,7,8],form:[0,7],fors:8,found:0,free:0,from:[0,3,6,7,8],further:8,gaussian:[0,6],gener:[0,7,8],geometri:3,get:3,get_cel:7,get_new_candid:0,given:[7,8],global:[0,3],gofe:[1,2,4,6,7,9],gofee_test:1,goff:4,going:[2,8],gpaw:[1,4,7,8],gpr:[0,6],guid:2,hamiltonian_charg:[7,8],hamiltonian_fil:[7,8],hamiltonian_filling_empti:[7,8],hamiltonian_maxangularmomentum_:[7,8],hamiltonian_maxangularmomentum_o:[7,8],hamiltonian_maxangularmomentum_ti:[7,8],hamiltonian_scc:[7,8],handl:8,have:[0,2,4,8],heavili:2,height:7,how:[0,8],howev:[0,4,6],implement:[2,4],includ:[0,6],index:7,indic:0,indivitu:8,info:0,initi:[0,6,7],input:0,insid:4,instal:[2,3],interest:2,isol:[0,8],iter:[0,8],job:3,jobscript:1,kappa:0,kelvin:[7,8],kept:[0,8],kernel:6,kpt:[7,8],kwarg:0,label:[7,8],learn:6,len:[0,7,8],less:0,librari:2,like:[1,6],list:[0,7,8],local:1,log:0,logfil:0,look:[6,8],made:8,major:7,manag:1,mani:[0,8],master:[],matrix:[0,8],max:0,max_relax_dist:0,max_step:[0,6,7,8],maximum:[0,8],mca:[1,4,7,8],mean:4,mem:1,mention:[4,6],method:[0,2,3],min_certainti:0,minimum:0,model:[0,3,4,9],modifi:[1,3,9],more:7,most:[4,8],move:0,mpi4pi:4,mpi_warn_on_fork:[1,4,7,8],mpiexec:[1,4,7,8],much:0,multipl:0,must:[0,1],mutaion:8,mutat:[3,7,8],n_to_optim:[7,8],n_top:0,name:[0,1],natom:8,natur:8,ncandid:0,neccisari:2,need:[4,7,8],newer:4,ninit:0,node:1,nois:6,none:0,note:1,now:7,npermut:[0,7],nrattl:[0,7,8],ntask:1,number:[0,6,7,8],numpi:[7,8],nymber:8,object:[0,2,8],one:[0,6,7,8],ones:0,onli:[4,5],open:0,oper:[0,8],operationconstraint:[0,5],operationselector:0,optim:[0,3,6,7,8],origin:0,other:[0,6,8],otherwis:2,out:[5,7,8],overview:0,oxid:8,oxygen:8,pair:0,paramet:[0,6,7,8],parent:0,part:[4,8],particular:[2,4],partit:1,pass:6,path:[1,4],pbc:8,per:1,perform:0,permut:[0,7,8],permutaionmut:8,permutationmut:7,pickl:0,place:[0,7,8],point:8,popul:[0,8],population_s:[0,6,7,8],posit:[0,7],position_constraint:0,possibl:0,potenti:0,predict:0,prerequisit:[2,8],present:[0,6,7],previou:[6,7],principl:3,prior:[2,4],probabl:[0,8],process:[0,6],produc:0,program:2,propperli:[1,7,8],purpos:8,python:[1,2,4,7,8],pythonpath:[1,4],r_cov_i:0,r_cov_j:0,radiu:0,random:[0,8],randomli:[0,7,8],rattl:[0,5,7,8],rattle_rang:[0,7,8],rattlemut:[5,7,8],read:7,readi:8,recomend:[0,6,7],recommend:0,reconstruct:[3,9],regress:[0,6],regular:6,relax:[0,8],reli:[2,8],remain:0,repres:7,requir:[0,3],respect:0,restart:0,result:8,run:[0,1,4,7],run_search:1,safe:0,same:0,save:0,sbatch:1,script:[4,8],script_calling_gofe:4,search:[0,2,3,5,6,9],section:0,see:8,select:0,sesarch:0,set:[0,2],setup:[1,4],shift:8,shold:8,should:0,shown:0,similar:7,simul:2,sinc:8,singl:0,size:8,slab:[0,7,8],slap:7,slightli:7,slurm:3,slurm_submit_dir:1,some:[2,8],sourc:[1,3,7,8],space:[5,8],span:[0,8],specif:0,specifi:[0,8],sphere:0,squar:8,start:[0,1,3,7,8],startgener:[3,6,7,8],stdout:0,step:0,stoichiometri:[0,7,8],str:0,string:0,structu:0,structur:[0,7,9],stuff:1,submiss:1,submit:1,success:0,suppli:[0,8],surfac:[0,5],surrog:[0,3,4,8,9],swap:0,system:[0,2,3],take:[6,8],taken:8,tar:4,task:1,temperatur:[7,8],templat:8,test:4,than:0,thei:8,therefor:[2,6],thi:[0,1,4,5,6,7,8,9],thing:7,three:[0,8],through:2,ti5o10:8,time:[0,1,4],timecrit:4,tio2:[3,9],tio2_slab:7,tio2_surfac:[7,8],tio:[3,6,7,9],tiorg:[7,8],titanium:8,top:[0,7],traj:[0,7,8],trajectori:[0,2],turori:9,tutori:[1,2,3,5,6,7,8],type:8,uncertainti:0,under:0,understand:2,uniformli:0,unit:0,unlik:0,unpack:4,use:[0,1,2,7,8],used:[0,2,3,4,6,7,8],user:0,uses:8,using:[0,1,4,8],util:5,vector:[0,8],veri:7,visin:0,visit:8,vspan:0,wai:0,want:7,weigh:0,well:[0,2],wether:0,what:8,when:4,where:[0,1],whether:0,which:[0,1,6,7,8],witch:0,within:[0,5,7],work:4,written:4,you:[1,2,4,6,7,8],your:[1,4],yourfil:[],zxvf:4},titles:["GOFEE","SLURM job examples","Getting started","Welcome to the documentation for GOFEE!","Installation","Au7 in Cu(111) with EMT","Modifying surrogate model","Searching for the TiO2(001)-(1x4) reconstruction","Searching for TiO clusters","Tutorial"],titleterms:{"1x4":7,atom:7,au7:5,candidategener:[0,8],cluster:8,document:3,emt:5,exampl:1,from:4,get:2,gofe:[0,3,8],initi:8,instal:4,job:1,make:8,model:6,modifi:6,mutat:0,permutationmut:0,rattlemut:0,rattlemutation2:0,reconstruct:7,requir:4,run:8,search:[7,8],set:[7,8],slurm:1,sourc:4,start:2,startgener:0,startgenerat:8,structur:8,surrog:6,system:[7,8],templat:7,tio2:7,tio:8,tutori:9,welcom:3}})
\ No newline at end of file
Search.setIndex({docnames:["GOFEE/GOFEE","SLURM/SLURM","getting_started/getting_started","index","installation/installation","tutorial/au_on_cu/au_on_cu","tutorial/cu_clusters/cu_clusters","tutorial/modifying_surrogate_model/modifying_surrogate_model","tutorial/tio2_reconstruction/tio2_reconstruction","tutorial/tio_clusters/tio_clusters","tutorial/tutorial"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:56},filenames:["GOFEE/GOFEE.rst","SLURM/SLURM.rst","getting_started/getting_started.rst","index.rst","installation/installation.rst","tutorial/au_on_cu/au_on_cu.rst","tutorial/cu_clusters/cu_clusters.rst","tutorial/modifying_surrogate_model/modifying_surrogate_model.rst","tutorial/tio2_reconstruction/tio2_reconstruction.rst","tutorial/tio_clusters/tio_clusters.rst","tutorial/tutorial.rst"],objects:{"gofee.GOFEE":{run:[0,1,1,""]},"gofee.candidates":{CandidateGenerator:[0,0,1,""],PermutationMutation:[0,0,1,""],RattleMutation2:[0,0,1,""],RattleMutation:[0,0,1,""],StartGenerator:[0,0,1,""]},"gofee.candidates.CandidateGenerator":{get_new_candidate:[0,1,1,""]},gofee:{GOFEE:[0,0,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"]},objtypes:{"0":"py:class","1":"py:method"},terms:{"1x4":[3,10],"20\u00e5x20\u00e5x20\u00e5":[6,9],"30g":1,"3x3":[6,9],"boolean":0,"case":[0,6,8,9],"class":[0,9],"default":[0,6,9],"export":[1,4],"final":[4,8],"float":0,"function":[0,4],"import":[5,6,7,8,9],"int":0,"new":[0,6,7,9],"super":0,"true":0,ASE:[0,2,4,5,6,8,9],And:[],For:[6,8,9],One:7,The:[0,3,4,5,6,7,8,9],Then:[4,8],These:[6,9],Use:0,Used:0,With:[6,9],abov:[5,6,8,9],accord:0,achiev:[4,5,6,7],acquisit:0,activ:7,adding:0,addit:[0,2,6,9],after:4,all:[0,5,6,9],allow:0,alreadi:2,also:[0,2,5],altern:0,alwai:0,angstrom:0,anker:5,anoth:7,appli:[0,6,7,9],arang:5,arg:0,argument:7,arrai:[5,6,8,9],ase:[5,6,8,9],assum:4,atom:[0,2,5,6,9,10],atomist:[2,3],atomix:5,au15:[],au7:[3,10],au7_on_cu111:5,avali:4,averag:[0,6,9],avov:7,base:0,bash:1,basic:2,basic_mut:9,befor:[2,7,8],below:[0,6,9],best:[6,9],between:0,bin:1,blmax:0,blmin:0,bool:0,both:[0,4],box:[0,6,8,9],box_constraint:5,box_to_place_in:0,build:5,build_cod:4,bulk:8,calc:[0,5,6,7,8,9],calcul:[0,1,5,6,8,9],call:4,can:[0,1,2,4,5,6,7,8,9],cancid:0,candid:[0,5,6,7,8,9],candidate_gener:[0,5,6,7,8,9],candidate_generatior:0,candidate_oper:9,candidategener:[3,5,8],candomli:0,carri:[5,6,8,9],cell:[0,5,6,9],center:[5,6,9],certain:5,chang:[6,9],cheap:7,choos:8,chose:[0,5],closest:0,cluster:[0,1,3,5,6,7,8,10],code:[1,4,5,6,8,9],compil:4,complet:[2,6,9],configur:[6,9],consecut:0,considd:[0,6,9],consrain:5,constrain:10,constraint:[0,6,9],constrraint:5,contain:[0,1,6,8,9],continu:2,control:7,coordin:0,copi:5,copper:6,core:1,corner:0,could:[6,9],coval:0,cover:10,cpu:1,creat:9,crossov:0,cu15:[3,5,7,10],cymem:4,cython:4,d_cov:0,date:1,defin:[0,5,6,8,9],degre:7,depend:0,describ:[0,1,6,9],descript:[0,5,6,9],descriptor:4,desir:1,detail:8,dftb:[1,8,9],dict:0,differ:[6,8,9,10],dimens:[0,5],direct:5,directori:1,distanc:[0,6,9],done:[0,2,4,6,9],double_gauss_kernel:[],doublegausskernel:7,download:4,drawn:0,dualpoint:0,dure:[0,5,6,7,9,10],each:[0,5],echo:1,effici:6,either:[0,6,9],element:[5,6,9],empti:[0,6,8,9],emt:[3,10],energi:[0,3,9],enforc:0,environ:2,especi:2,evalu:[0,4,9],exampl:[2,3,5,6,7,9],exclus:1,experi:2,explaint:[6,9],explor:[6,9],express:[0,3],extend:7,eye:[6,9],fals:0,familiar:2,fcc111:5,fermi:[8,9],file:[0,1,2,4,8],filenam:0,finish:1,first:[3,8],fix:[5,6,8,9],fixatom:[5,6,9],folder:[1,4],follow:[5,6,7,8,9],form:[0,8],fors:9,found:0,fraction:5,free:[0,5,10],from:[0,3,5,6,7,8,9],further:[6,9],gaussian:[0,7],gener:[0,5,6,8,9],geometri:3,get:3,get_cel:[5,8],get_new_candid:0,get_posit:5,given:[6,8,9],global:[0,3],gofe:[1,2,4,7,8,10],gofee_test:1,goff:4,going:[2,6,9],gpaw:[1,4,5,6,8,9],gpr:[0,7],guid:2,hamiltonian_charg:[8,9],hamiltonian_fil:[8,9],hamiltonian_filling_empti:[8,9],hamiltonian_maxangularmomentum_:[8,9],hamiltonian_maxangularmomentum_o:[8,9],hamiltonian_maxangularmomentum_ti:[8,9],hamiltonian_scc:[8,9],handl:[6,9],have:[0,2,4,6,9],heavili:2,height:[5,8],here:10,how:[0,6,9],howev:[0,4,7],implement:[2,4],includ:[0,7,10],index:8,indic:[0,5],indivitu:[6,9],info:0,initi:[0,7,8],input:0,insid:4,instal:[2,3],interest:2,isol:[0,6,9,10],iter:[0,6,9],job:3,jobscript:1,kappa:0,kelvin:[8,9],kept:[0,6,9],kernel:7,keyword:5,kpt:[8,9],kwarg:0,label:[8,9],layer:5,learn:7,len:[0,5,6,8,9],less:0,librari:2,like:1,list:[0,6,8,9],local:1,log:0,logfil:0,look:[6,9],made:[5,6,9],major:8,make:5,manag:1,mani:[0,6,9],master:[],matrix:[0,6,9],max:[0,5],max_relax_dist:0,max_step:[0,5,6,7,8,9],maximum:[0,6,9],mca:[1,4,5,6,8,9],mean:4,mem:1,mention:[4,7],method:[0,2,3],min_certainti:0,minimum:0,model:[0,3,4,10],modif:[7,10],modifi:[1,3,10],more:8,most:[4,6,9],move:0,mpi4pi:4,mpi_warn_on_fork:[1,4,5,6,8,9],mpiexec:[1,4,5,6,8,9],much:0,multipl:0,must:[0,1],mutaion:[6,9],mutat:[3,5,6,8,9],n_to_optim:[5,6,8,9],n_top:0,name:[0,1],natom:[6,9],natur:[6,9],ncandid:0,neccisari:2,need:[4,6,8,9],newer:4,ninit:0,node:1,nois:7,none:0,note:1,now:8,npermut:[0,8],nrattl:[0,5,6,8,9],ntask:1,number:[0,6,7,8,9],numpi:[5,6,8,9],nymber:[6,9],object:[0,2,6,9],one:[0,6,7,8,9],ones:0,onli:[4,5,6],open:0,oper:[0,5,6,9],operationconstraint:[0,5],operationselector:0,optim:[0,3,6,7,8,9],origin:0,other:[0,6,7,9],otherwis:2,out:[5,6,8,9],overview:0,oxid:9,oxygen:9,pair:0,paramet:[0,7,8,9],parent:0,part:[4,6,9],particular:[2,4],partit:1,pass:7,path:[1,4],pbc:[6,9],per:1,perform:0,permut:[0,6,8,9],permutaionmut:[6,9],permutationmut:[5,8],pickl:0,place:[0,5,6,8,9],point:[5,6,9],popul:[0,6,9],population_s:[0,5,6,7,8,9],posit:[0,5,8,10],position_constraint:[0,5],possibl:0,potenti:[0,6],predict:0,prerequisit:[2,6,9],present:[0,7,8],previou:[7,8],previous:5,principl:3,prior:[2,4],probabl:[0,6,9],process:[0,7],produc:0,program:2,propperli:[1,5,6,8,9],purpos:[6,9],python:[1,2,4,5,6,8,9],pythonpath:[1,4],r_cov_i:0,r_cov_j:0,radiu:0,random:[0,6,9],randomli:[0,6,8,9],rattl:[0,5,6,8,9],rattle_rang:[0,5,6,8,9],rattlemut:[5,6,8,9],read:8,readi:[6,9],recomend:[0,7,8],recommend:0,reconstruct:[3,10],regress:[0,7],regular:7,rel:5,relat:5,relax:[0,6,9],reli:[2,6,9],remain:0,repres:8,requir:[0,3],respect:0,restart:0,result:[6,9],run:[0,1,4,5,8],run_search:1,safe:0,same:0,save:0,sbatch:1,script:[4,5,6,9],script_calling_gofe:4,search:[0,2,3,6,7,10],section:0,see:[6,9,10],select:0,sesarch:0,set:[0,2,5],set_constraint:5,setup:[1,4],shift:[6,9],shold:[6,9],should:0,shown:0,shrink:5,shrinkag:5,shrunk:5,side:5,similar:8,simul:2,sinc:[6,9],singl:[0,6],size:[5,6,9],slab:[0,5,6,8,9],slap:8,slightli:8,slurm:3,slurm_submit_dir:1,some:[2,6,9],sourc:[1,3,5,6,8,9],space:[5,6,9],span:[0,6,9],specif:0,specifi:[0,6,9],sphere:0,squar:[6,9],start:[0,1,3,6,8,9],startgener:[3,5,6,7,8,9],stdout:0,step:0,stoichiometri:[0,5,6,8,9],str:0,string:0,structu:0,structur:[0,5,8,10],stuff:1,submiss:1,submit:1,success:0,suppli:[0,6,9],surfac:[0,5,10],surrog:[0,3,4,6,9,10],swap:0,system:[0,2,3,5],take:[6,7,9],taken:[6,9],tar:4,task:1,temperatur:[8,9],templat:[5,6,9],test:4,than:0,thei:[6,9],therefor:[2,7],therfor:6,thi:[0,1,4,5,6,7,8,9,10],thing:8,three:[0,6,9],through:2,ti5o10:9,time:[0,1,4],timecrit:4,tio2:[3,10],tio2_slab:8,tio2_surfac:[8,9],tio:[3,8,10],tiorg:[8,9],titanium:9,top:[0,8],traj:[0,8,9],trajectori:[0,2],turori:10,tutori:[1,2,3,5,6,7,8,9],type:[6,9,10],uncertainti:0,under:0,understand:2,uniformli:0,unit:0,unlik:0,unpack:4,use:[0,1,2,5,6,8,9],used:[0,2,3,4,5,6,7,8,9],user:0,uses:[6,9],using:[0,1,4,5,6,9],util:5,vacuum:5,vector:[0,6,9],veri:8,visin:0,visit:[6,9],vspan:0,wai:0,want:8,weigh:0,well:[0,2],wether:0,what:[5,6,9],when:4,where:[0,1],whether:0,which:[0,1,5,6,7,8,9],witch:0,within:[0,5,8],work:4,written:4,you:[1,2,4,5,6,7,8,9],your:[1,4],yourfil:[],z_max_slab:5,zxvf:4},titles:["GOFEE","SLURM job examples","Getting started","Welcome to the documentation for GOFEE!","Installation","Au7 in Cu(111) with EMT","Cu15 with EMT","Modifying surrogate model","Searching for the TiO2(001)-(1x4) reconstruction","Searching for TiO clusters","Tutorial"],titleterms:{"1x4":8,atom:8,au15:[],au7:5,box:5,candidategener:[0,6,9],cluster:9,constrain:5,constraint:5,cu15:6,document:3,emt:[5,6],exampl:1,from:4,get:2,gofe:[0,3,5,6,9],initi:[5,6,9],instal:4,job:1,make:[6,9],model:7,modifi:7,mutat:0,object:5,permutationmut:0,rattlemut:0,rattlemutation2:0,reconstruct:8,requir:4,run:[6,9],search:[5,8,9],set:[6,8,9],setup:5,slurm:1,sourc:4,start:2,startgener:0,startgenerat:[6,9],structur:[6,9],surrog:7,system:[6,8,9],templat:8,tio2:8,tio:9,tutori:10,welcom:3}})
\ No newline at end of file
......@@ -34,7 +34,9 @@
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Searching for TiO clusters" href="../tio_clusters/tio_clusters.html" />
<link rel="prev" title="Cu15 with EMT" href="../cu_clusters/cu_clusters.html" />
</head>
<body class="wy-body-for-nav">
......@@ -78,11 +80,23 @@
<ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../installation/installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../getting_started/getting_started.html">Getting started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../SLURM/SLURM.html">SLURM job examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tutorial.html">Tutorial</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../tutorial.html">Tutorial</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../cu_clusters/cu_clusters.html">Cu15 with EMT</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Au7 in Cu(111) with EMT</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#box-setup">Box setup</a></li>
<li class="toctree-l3"><a class="reference internal" href="#constraint-object">Constraint object</a></li>
<li class="toctree-l3"><a class="reference internal" href="#initialize-constrained-gofee-search">Initialize constrained GOFEE search</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../tio_clusters/tio_clusters.html">Searching for TiO clusters</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tio2_reconstruction/tio2_reconstruction.html">Searching for the TiO2(001)-(1x4) reconstruction</a></li>
<li class="toctree-l2"><a class="reference internal" href="../modifying_surrogate_model/modifying_surrogate_model.html">Modifying surrogate model</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../GOFEE/GOFEE.html">GOFEE</a></li>
</ul>
......@@ -129,6 +143,8 @@
<li><a href="../../index.html">Docs</a> &raquo;</li>
<li><a href="../tutorial.html">Tutorial</a> &raquo;</li>
<li>Au7 in Cu(111) with EMT</li>
......@@ -155,6 +171,126 @@ the Cu(111) surface.</p>
<p>In this search we will utilize an <code class="xref py py-class docutils literal notranslate"><span class="pre">OperationConstraint</span></code>
to constraint the <code class="xref py py-class docutils literal notranslate"><span class="pre">RattleMutation</span></code> to only rattle the
atoms within a certain box in space that we define.</p>
<p>The following script <a class="reference download internal" download="" href="../../_downloads/3cb85bca7334a25d0c7c987644b7693e/Au7_on_Cu111.py"><code class="xref download docutils literal notranslate"><span class="pre">Au7_on_Cu111.py</span></code></a> is used to carry
out the constrainted search:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">ase.build</span> <span class="k">import</span> <span class="n">fcc111</span>
<span class="kn">from</span> <span class="nn">ase.constraints</span> <span class="k">import</span> <span class="n">FixAtoms</span>
<span class="kn">from</span> <span class="nn">ase.calculators.emt</span> <span class="k">import</span> <span class="n">EMT</span>
<span class="kn">from</span> <span class="nn">gofee.candidates</span> <span class="k">import</span> <span class="n">CandidateGenerator</span><span class="p">,</span> <span class="n">StartGenerator</span><span class="p">,</span> <span class="n">RattleMutation</span><span class="p">,</span> <span class="n">PermutationMutation</span>
<span class="kn">from</span> <span class="nn">gofee.utils</span> <span class="k">import</span> <span class="n">OperationConstraint</span>
<span class="kn">from</span> <span class="nn">gofee</span> <span class="k">import</span> <span class="n">GOFEE</span>
<span class="c1">### Define calculator ###</span>
<span class="n">calc</span> <span class="o">=</span> <span class="n">EMT</span><span class="p">()</span>
<span class="c1">### Set up system ###</span>
<span class="c1"># 1-layer fixed Cu(111) slab</span>
<span class="n">template</span> <span class="o">=</span> <span class="n">fcc111</span><span class="p">(</span><span class="s1">&#39;Cu&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">vacuum</span><span class="o">=</span><span class="mf">10.0</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">FixAtoms</span><span class="p">(</span><span class="n">indices</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">template</span><span class="p">)))</span>
<span class="n">template</span><span class="o">.</span><span class="n">set_constraint</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="c1"># Stoichiometry of atoms to be placed</span>
<span class="n">stoichiometry</span> <span class="o">=</span> <span class="mi">7</span><span class="o">*</span><span class="p">[</span><span class="mi">79</span><span class="p">]</span>
<span class="c1">## Box for startgenerator and rattle-mutation</span>
<span class="n">k</span> <span class="o">=</span> <span class="mf">0.2</span> <span class="c1"># Shrinkage fraction from each side of the box in v[0] and v[1] directions.</span>
<span class="n">cell</span> <span class="o">=</span> <span class="n">template</span><span class="o">.</span><span class="n">get_cell</span><span class="p">()</span>
<span class="c1"># Initialize box with cell</span>
<span class="n">v</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">cell</span><span class="p">)</span>
<span class="c1"># Set height of box</span>
<span class="n">v</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="mi">5</span>
<span class="c1"># Shrink box in v[0] and v[1] directions</span>
<span class="n">v</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*=</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">k</span><span class="p">)</span>