# Load ase modules to create clusters
from ase.io import write
from ase.cluster import Decahedron
from ase.cluster import Icosahedron
from ase.cluster import Octahedron
from ase.cluster import wulff_construction

# Define output directory
output_path = r'C:\Users\admin\Nextcloud\MyData\\'

# Elemnent you want to try and it´s lattice constant
element = "Au"
latticeconstant = 4.08


# Create decosahedral cluster
filename = "Au_cluster_decosahedron_small"
clusterDec1 = Decahedron(element, p=2, q=1, r=3, latticeconstant=latticeconstant)
write(images=clusterDec1, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")

filename = "Au_cluster_decosahedron_large"
clusterDec2 = Decahedron(element, p=7, q=2, r=0, latticeconstant=latticeconstant)
write(images=clusterDec2, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")



# Create icosahedral cluster
filename = "Au_cluster_icosahedron_star"
clusterIko1 = Icosahedron(element, noshells=3, latticeconstant=latticeconstant)
write(images=clusterIko1, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")

filename = "Au_cluster_icosahedron_pentagon"
clusterIko2 = Icosahedron(element, noshells=7, latticeconstant=latticeconstant)
write(images=clusterIko2, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")


# Create octahedral cluster
filename = "Au_cluster_octahedron_small"
clusterOct1 = Octahedron(symbol=element, length=8, cutoff=3, latticeconstant=latticeconstant)
write(images=clusterOct1, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")

filename = "Au_cluster_octahedron_large"
clusterOct2 = Octahedron(symbol=element, length=9, cutoff=2, latticeconstant=latticeconstant)
write(images=clusterOct2, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")


# Create cluster with the wulff generator
structure = "fcc"

filename = "Au_cluster_111_e1=0p7_100_e2=0p7_fcc_aim290"
clusterWullf1 = wulff_construction(element, surfaces=[(1,1,1), (1,0,0)], energies=[0.7, 0.7], size=100, structure=structure, rounding="closest", latticeconstant=latticeconstant)
write(images=clusterWullf1, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")

filename = "Au_cluster_001_e1=0p4_101_e2=0p3_fcc_aim290"
clusterWullf2 = wulff_construction(element, surfaces=[(0,0,1), (1,0,1)], energies=[0.4, 0.3], size=290, structure=structure, rounding="closest", latticeconstant=latticeconstant)
write(images=clusterWullf2, filename=str(output_path) + "/" + str(filename) + ".xyz", format="xyz")