Пример #1
0
def decorate_interface():
    ats = Atoms('interface.xyz')
    dataset = spglib.get_symmetry_dataset(ats, symprec=1e-5)

    with open('unique_lattice_sites.json', 'w') as f:
        json.dump([
            list(ats[site_num].position)
            for site_num in np.unique(dataset['equivalent_atoms'])
        ], f)

    unique_atoms = []
    for at in ats:
        unique_atoms.append(at.position)
    voronoi = Voronoi(limits=tuple(np.diag(ats.cell)),
                      periodic=(True, True, False))
    cntr = voronoi.compute_voronoi(unique_atoms)
    ints_list = []
    for site_num in np.unique(dataset['equivalent_atoms']):
        for vert in voronoi.get_vertices(site_num, cntr):
            ints_list.append(vert.tolist())

    for unique in ints_list:
        ats.add_atoms(unique, 1)
    for i in range(len(ats)):
        ats.id[i] = i
    #remove voronoi duplicates
    print 'Fe_H atoms', len(ats)
    ats.wrap()
    del_ats = aseAtoms()
    for at in ats:
        del_ats.append(at)
    geometry.get_duplicate_atoms(del_ats, cutoff=0.2, delete=True)
    ats = del_ats.copy()
    print 'Fe_H atoms remove duplicates', len(ats)
    #select unique hydrogens
    #for i in range(len(ats)):
    #  ats.id[i] = i
    ints_list = [at.position for at in ats if at.number == 1]
    with open('unique_h_sites.json', 'w') as f:
        json.dump([list(u) for u in ints_list], f)
    ats.write('hydrogenated_grain.xyz')
Пример #2
0
      print 'Running WITH EAM as embedded cluster'
      qm_pot_file  = os.path.join(pot_dir, 'PotBH_fakemod.xml')
      print qm_pot_file
      mm_init_args = 'IP EAM_ErcolAd do_rescale_r=T r_scale=1.01' # Classical potential
      qm_pot       = Potential(mm_init_args, param_filename=qm_pot_file, cutoff_skin=cutoff_skin)
      qmmm_pot     = set_qmmm_pot(atoms, atoms.params['CrackPos'], mm_pot, qm_pot)

    strain_atoms = fix_edges(atoms)

    print 'Setup dynamics'
#If input_file is crack.xyz the cell has not been thermalized yet.
#Otherwise it will recover temperature from the previous run.
    print 'Attaching trajectories to dynamics'
    trajectory = AtomsWriter(traj_file)
#Only wriates trajectory if the system is in the LOTFDynamicas
#Interpolation 
    atoms.wrap()
    atoms.set_cutoff(3.0)
    atoms.calc_connect()
    print 'Running Crack Simulation'
    RELAXATION = False
    if RELAXATION:
      dynamics = FIRE(atoms)
      dynamics.attach(pass_trajectory_context(trajectory, dynamics), traj_interval, dynamics)
      dynamics.run(fmax=0.1)
    else:
      dynamics = LOTFDynamics(atoms, timestep, extrapolate_steps)
      dynamics.attach(pass_trajectory_context(trajectory, dynamics), traj_interval, dynamics)
      nsteps    = 2000
      dynamics.run(nsteps)