# Copper FCC structure using ASE (Atomic Simulation Environment) library in python

I want to create a FCC structure using ASE (atomic simulation environment). I have define the all the required parameter correctly but at the time when i add GPAW calculator. The output of the program says that: "Atoms are too close". Please comment on this where i'm wrong.

Code

from ase import Atoms

a=4.0 # Lattice constant (in Angstroms)

position=[(0,0,0), (0,0,a), (0,a,0), (a,0,0), (0,a,a), (a,0,a), (a,a,0),(a,a,a), (a/2,0,a/2), (a/2,a,a/2),
(a/2,a/2,0),(a/2,a/2,a), (0,a/2,a/2),(a,a/2,a/2)]

symbol=['Cu']*len(position)
fcc= Atoms(symbols=symbol, positions=position, cell=(a,a,a), pbc=True)

view(fcc)

print(fcc.symbols)        # Access atomic symbols
#print(fcc.positions)      # Access atomic positions
print(fcc.pbc)            # Access periodic boundary conditiom
print(fcc.get_distance(0,1))    # Access distance between Atom
print(fcc.get_masses())     # Access Mass of Atom
print(fcc.get_cell_lengths_and_angles())  #Access Cell length and Angles


For Calculation

from gpaw import GPAW, PW

calc = GPAW()
fcc.set_calculator(calc)

• Check atomic positions. You need 4 atoms for a conventional FCC unit cell. It is periodic boundary condition. Jun 15, 2023 at 2:38
• It's better if you use the bulk() method from the build module of ASE. The details of this method is given at wiki.fysik.dtu.dk/ase/ase/build/build.html#ase.build.bulk Regards Punit Jun 15, 2023 at 4:17

## 2 Answers

First, I want to show a general way of checking the minimum bond length of a structure in ASE. Using your structure as an example, you can get the distance matrix in ASE by get_all_distances():

from ase import Atoms

a = 4.0 # Lattice constant (in Angstroms)
position = [(0,0,0), (0,0,a), (0,a,0), (a,0,0), (0,a,a),
(a,0,a), (a,a,0),(a,a,a), (a/2,0,a/2), (a/2,a,a/2),
(a/2,a/2,0),(a/2,a/2,a), (0,a/2,a/2),(a,a/2,a/2)]
symbol = ['Cu']*len(position)
atoms = Atoms(symbols=symbol, positions=position, cell=(a,a,a), pbc=True)
D = atoms.get_all_distances(mic=True) # Use minimum image convention for periodic systems


Then you can get the minimum pairwise distance by

import numpy as np

mask = np.ones(D.shape, dtype=bool)
np.fill_diagonal(mask, 0)
dmin = D[mask].min()
print(dmin)


And you will see the minimum bond length of your structure is 0. Why is that? Because you are using 14 atoms instead of 4 atoms for a conventional fcc unit cell, and there are many atoms overlapping with each other. Remember your cell have periodicity in all 3 dimensions.

The easiest way to build a valid fcc Cu bulk structure given the lattice constant is by using ase.build.bulk:

from ase.build import bulk

atoms = bulk('Cu', 'fcc', a=4.0)


Since you perform DFT calculations under periodic boundary condition(PBC), you should check your structure carefully. The first two atoms (0, 0, 0) and (0, 0, a) possesses the same coordinate in periodic cube with length a.

Considering symmetrically distinct atoms only, your code can be revised as following:

from ase import Atoms

a = 4.0 # Lattice constant (in Angstroms)

position = [(0, 0, 0), (a/2, 0, a/2), (a/2, a/2, 0), (0, a/2, a/2)]

symbols = ['Cu']*len(position)
fcc = Atoms(symbols=symbol, positions=position, cell=(a, a, a), pbc=True)


Of course it is way simpler to use ase.build.bulk function:

import ase.build

atoms = ase.build.bulk('Cu', 'fcc', a=4.0, cubic=True)


If you want only primitive unit cell, set cubic to False.