Ejemplo n.º 1
0
def test_mishin():

    from ase.calculators.eam import EAM
    sys_setting ={'elements':['Al', 'Fe'], 'pot':'zhou', \
                  'pca':[10], 'nAtoms':250,\
              #'structure':'bcc',\
              #'positions':'rnd','a':3.0, 'period':[5,5,5]}



              'structure':'fcc',\
              'positions':'rnd','a':4.6, 'period':[2,2,2]}

    sys1 = sys.System(sys_setting)

    potDir = './'
    fileName = potDir + 'Zhou_AlFe.alloy'

    #potDir = '../../lammps/potentials/'
    #fileName = potDir + 'Ni.adp'

    mishin = EAM(potential=fileName)
    mishin.write_potential('new.eam.alloy')

    sys1.bulk.set_calculator(mishin)
    nAtoms = sys1.bulk.get_number_of_atoms()
    ep = sys1.bulk.get_potential_energy() / nAtoms
    forces = sys1.bulk.get_forces()

    print ep
    print mishin.Z
    print mishin.mass
    print mishin.a
    print mishin.lattice
    print mishin.nrho
    print mishin.drho
    print mishin.nr
    print mishin.dr
    #print mishin.d_d

    mishin.set_splines()
    print mishin.embedded_energy[0](30)

    mishin.plot()
Ejemplo n.º 2
0
for clust in allClust:
    # General info
    atoms = clust.toatoms()
    N = len(atoms.positions)
    # Define calculator
    mishin = EAM(
        potential='../CourseGitRepo/HA5_al_potential.alloy')  # Set up EAM
    atoms.set_calculator(mishin)
    # Relax structure
    dyn = BFGS(atoms, trajectory=f'traj/Al{N}.traj')
    dyn.run(fmax=0.05)
    # Calculate cohesive energy
    ECoh = np.abs(atoms.get_potential_energy() /
                  N)  # Cohesive energy is the positive potential energy

    # Print results
    str1 = f'| N={N}'
    str2 = 'Cohesive energy/atom:'
    str3 = f' {ECoh:.4f} eV   |'
    out(str1 + str2.rjust(30 - len(str1)) + str3.rjust(35 - len(str2)),
        f=Efile)
out('---------------------------------------------', f=Efile)

# Plot and save a picture of the potential
mishin.plot()
plt.tight_layout()
plt.savefig('al_potential.png')
# plt.show()

# The potential may not be perfectly suited for the smaller nanoparticles, since they don't exhibit the same symmetries as the bulk Al.
# Bulk Al is crystalline fcc.