def compute_energy(template, i):
    potpath = os.path.join(os.environ['LAMMPS_POTENTIALS'], 'Au_u3.eam')
    potential = ClassicalPotential(path=potpath, ptype='eam', element=["Au"])
    runpath = Dir(path=os.path.join(
        os.environ['WORKDIR'],
        "final_project/Au110_reconstructed/test6_cubic/", str(i)))
    natoms, struc = make_struc(i=i)
    output_file = lammps_run(struc=struc,
                             runpath=runpath,
                             potential=potential,
                             intemplate=template,
                             inparam={})
    energy, lattice = get_lammps_energy(outfile=output_file)
    print('lattice is', lattice)

    surface_area = 1 / (math.sqrt(2)) * lattice * lattice

    print(natoms)

    energy_per_atom = energy / natoms
    surface_energy = []
    surface_energy = ((1 / (2 * surface_area)) * (energy - (natoms) *
                                                  (-3.930000000176775)))

    return energy, lattice, energy_per_atom, surface_energy
Esempio n. 2
0
def compute_dynamics(size, timestep, nsteps, temperature):
    """
    Make an input template and select potential and structure, and input parameters.
    Return a pair of output file and RDF file written to the runpath directory.
    """
    intemplate = """
    # ---------- Initialize simulation ---------------------
    units metal
    atom_style atomic
    dimension  3
    boundary   p p p
    read_data $DATAINPUT

    pair_style eam/alloy
    pair_coeff * * $POTENTIAL  Al

    velocity  all create $TEMPERATURE 87287 dist gaussian

    # ---------- Describe computed properties------------------
    compute msdall all msd
    thermo_style custom step pe ke etotal temp press density c_msdall[4]
    thermo $TOUTPUT

    # ---------- Specify ensemble  ---------------------
    fix  1 all nve
    #fix  1 all nvt temp $TEMPERATURE $TEMPERATURE $TDAMP

    # --------- Compute RDF ---------------
    compute rdfall all rdf 100 1 1
    fix 2 all ave/time 1 $RDFFRAME $RDFFRAME c_rdfall[*] file $RDFFILE mode vector

    # --------- Run -------------
    timestep $TIMESTEP
    run $NSTEPS
    """

    potential = ClassicalPotential(ptype='eam',
                                   element='Al',
                                   name='Al_zhou.eam.alloy')
    runpath = Dir(
        path=os.path.join(os.environ['WORKDIR'], "Lab4/Problem1", "size_" +
                          str(size)))
    struc = make_struc(size=size)
    inparam = {
        'TEMPERATURE': temperature,
        'NSTEPS': nsteps,
        'TIMESTEP': timestep,
        'TOUTPUT': 100,  # how often to write thermo output
        'TDAMP': 50 * timestep,  # thermostat damping time scale
        'RDFFRAME': int(nsteps / 4),  # frames for radial distribution function
    }
    outfile = lammps_run(struc=struc,
                         runpath=runpath,
                         potential=potential,
                         intemplate=intemplate,
                         inparam=inparam)
    output = parse_lammps_thermo(outfile=outfile)
    rdffile = get_rdf(runpath=runpath)
    rdfs = parse_lammps_rdf(rdffile=rdffile)
    return output, rdfs
Esempio n. 3
0
def compute_energy(alat, template):
    """
    Make an input template and select potential and structure, and the path where to run
    """
    potpath = os.path.join(os.environ['LAMMPS_POTENTIALS'],
                           'Al_zhou.eam.alloy')
    potential = ClassicalPotential(path=potpath, ptype='eam', element=["Al"])
    runpath = Dir(path=os.path.join(os.environ['WORKDIR'], "Lab1", str(alat)))
    struc = make_struc(alat=alat)
    output_file = lammps_run(struc=struc,
                             runpath=runpath,
                             potential=potential,
                             intemplate=template,
                             inparam={})
    energy, lattice = get_lammps_energy(outfile=output_file)
    return energy, lattice
def compute_energy(alat, template):
    """
    Make an input template and select potential and structure, and the path where to run
    """
    potpath = os.path.join(os.environ['LAMMPS_POTENTIALS'], 'Au_u3.eam')
    potential = ClassicalPotential(path=potpath, ptype='eam', element=["Au"])
    runpath = Dir(path=os.path.join(
        os.environ['WORKDIR'],
        "final_project/bulk_cohesive_energy/test10_relaxed_cubic_a_and_b/",
        str(alat)))
    struc = make_struc(alat=alat)
    output_file = lammps_run(struc=struc,
                             runpath=runpath,
                             potential=potential,
                             intemplate=template,
                             inparam={})
    energy, lattice = get_lammps_energy(outfile=output_file)
    return energy, lattice
Esempio n. 5
0
def compute_AgI_dynamics(size, timestep, nsteps, temperature, ncpu):
    """
    Make an input template and select potential and structure, and input parameters.
    Return a pair of output file and RDF file written to the runpath directory.
    """

    potential = ClassicalPotential(ptype='eam',
                                   element='Al',
                                   name='Al_zhou.eam.alloy')
    runpath = Dir(
        path=os.path.join(os.environ['WORKDIR'], "Lab4/Problem2", "temp_" +
                          str(temperature)))
    struc = make_struc(size=size)
    inparam = {
        'TEMPERATURE': temperature,
        'NSTEPS': nsteps,
        'TIMESTEP': timestep,
        'TOUTPUT': 100,  # how often to write thermo output
        'TDAMP': 50 * timestep,  # thermostat damping time scale
        'RDFFRAME': int(nsteps / 4),  # frames for radial distribution function
    }
    outfile = lammps_run(struc=struc,
                         runpath=runpath,
                         potential=potential,
                         intemplate=intemplate,
                         inparam=inparam,
                         ncpu=ncpu,
                         triclinic=True)
    output = parse_lammps_thermo(outfile=outfile)

    rdfAgFile = File(path=os.path.join(runpath.path, 'lammps.rdf.Ag'))
    rdfIFile = File(path=os.path.join(runpath.path, 'lammps.rdf.I'))
    rdfAgIFile = File(path=os.path.join(runpath.path, 'lammps.rdf.AgI'))

    rdfsAg = parse_lammps_rdf(rdffile=rdfAgFile)
    rdfsI = parse_lammps_rdf(rdffile=rdfIFile)
    rdfsAgI = parse_lammps_rdf(rdffile=rdfAgIFile)

    return output, rdfsAg, rdfsI, rdfsAgI