def siesta_md(atoms=None, gen='poscar.gen', ncpu=4, supercell=[1, 1, 1], dt=0.5, P=0.0, T=None, tstep=5000, opt='Verlet', us='F', FreeAtoms=None): if exists('siesta.MDE') or exists('siesta.MD_CAR'): system('rm siesta.MDE siesta.MD_CAR') if atoms is None: atoms = read(gen) write_siesta_in(atoms, coord='cart', md=True, opt=opt, xcf='VDW', xca='DRSLL', dt=dt, T=T, P=P, tstep=tstep, us=us, FreeAtoms=FreeAtoms) # for MD run_siesta(ncpu=ncpu) images = siesta_traj(batch=tstep) return images
def siesta_opt(atoms, label='siesta', ncpu=4, supercell=[1, 1, 1], VariableCell='true', xcf='VDW', xca='DRSLL', basistype='DZP', dt=0.5, T=None, tstep=5000, us='F', P=0.0, coord='cart'): write_siesta_in(atoms, coord=coord, VariableCell=VariableCell, md=False, opt='CG', P=P, xcf=xcf, xca=xca, basistype=basistype, us=us) # for MD run_siesta(ncpu=ncpu) images = siesta_traj(label=label) return images
def single_point(atoms, xcf='VDW', xca='DRSLL', basistype='DZP', val={ 'C': 4.0, 'H': 1.0, 'O': 6.0, 'N': 5.0, 'F': 7.0, 'Al': 3.0 }, cpu=4): if isfile('siesta.out'): system('rm siesta.*') write_siesta_in(atoms, coord='cart', md=True, opt='SinglePoint', xcf=xcf, xca=xca, basistype=basistype, us=False) # for MD system('mpirun -n %d siesta<in.fdf>siesta.out' % cpu) natom = len(atoms) atom_name = atoms.get_chemical_symbols() spec = [] for sp in atom_name: if sp not in spec: spec.append(sp) e, f, p, q = get_siesta_info(natom, spec, atom_name, val=val, label='siesta') atoms.set_initial_charges(charges=q[-1]) calc = SinglePointCalculator(atoms, energy=e, stress=p[-1]) atoms.set_calculator(calc) return atoms
def single_point(atoms, cpu=4): if isfile('siesta.out'): system('rm siesta.*') write_siesta_in(atoms, coord='cart', md=True, opt='SinglePoint', xcf='VDW', xca='DRSLL', us=False) # for MD system('mpirun -n %d siesta<in.fdf>siesta.out' % cpu) with open('siesta.out', 'r') as fs: for line in fs.readlines(): if line.startswith('siesta: E_KS(eV)'): e = float(line.split()[-1]) break calc = SinglePointCalculator(atoms, energy=e) atoms.set_calculator(calc) return atoms
x1 = xd[0] * a[0] + xd[1] * b[0] + xd[2] * c[0] x2 = xd[0] * a[1] + xd[1] * b[1] + xd[2] * c[1] x3 = xd[0] * a[2] + xd[1] * b[2] + xd[2] * c[2] x.append([x1, x2, x3]) il += 1 xs.append(x) A = Atoms(atom_name, x, cell=[a, b, c], pbc=[True, True, True]) A.set_calculator(calc) # A._calc.results['energy'] = his.write(atoms=A) cell = np.array([a, b, c]) his.close() if __name__ == '__main__': from emdk import get_structure, emdk from ase.io import read, write from ase import Atoms from siesta import write_siesta_in supercell = [1, 1, 1] struc = 'cl20' get_structure(struc=struc, output='dftb', recover=True, center=True) A = read('card.gen') write_siesta_in(A, coord='zmatrix', fac=1.20)