# AgAuAg chain¶

We consider the linear chain of three atoms AgAuAg here, which we relax in the first step:

```# creates: 1scogef.png
from ase import io
from ase.atoms import Atoms
from ase.optimize import FIRE
from ase.calculators.emt import EMT

fmax = 0.01

fname = 'AgAuAg.traj'
try:
except FileNotFoundError:
image = Atoms('AgAuAg', positions=((-1, 0, 0), (0, 0, 0), (1, 0, 0)))
image.calc = EMT()
FIRE(image).run(fmax=fmax)
image.write(fname)
```

We will stretch this configuration on the two outer atoms.

## Symmetric cogef¶

The standard COGEF pulling script is applied:

```# creates: 1scogef.png
from ase import io
from ase.optimize import FIRE
from ase.calculators.emt import EMT

from cogef import COGEF1D

def initialize(atoms):
atoms.calc = EMT()
return atoms

fmax = 0.01
cogef = COGEF1D(0, 2, initialize=initialize, fmax=fmax)

if not len(cogef.images):  # calculation was done already
cogef.images = [image]

stepsize = 0.1
steps = 50
cogef.move(stepsize, steps)
```

which creates the directory `cogef1d_0_2` and writes the file `cogef1d_0_2/cogef.traj` containing the corresponding trajectory. This produces rather high energies (“symmetric” above) as both AgAu bondlengths are stretched equally.

## Symmetry breaking through rattle¶

We may break symmetry by using `rattle`:

```# creates: 1scogef.png
import numpy as np
from ase import io
from ase.optimize import FIRE
from ase.calculators.emt import EMT

from cogef import COGEF1D

def initialize(atoms):
atoms.calc = EMT()
atoms.rattle()
return atoms

fmax = 0.01
cogef = COGEF1D(0, 2, name='rattle', initialize=initialize, fmax=fmax)

if not len(cogef.images):  # calculation was done already
cogef.images = [image]

stepsize = 0.1
steps = 50
cogef.move(stepsize, steps)
```

which creates the directory `rattle_0_2` and writes the file `rattle_0_2/cogef.traj`. The symmetry breaking enables one of the bonds to be intact, while the other breaks. The figure shows that this assymmetric configuration is of lower energy.