Esempio n. 1
0
def write_lammps(filename, struct, symbolsbasename='lmp.struct.symbols'):
    """Write Structure object to lammps format. That file can be read in a
    lammps input file by ``read_data``. Write file ``lmp.struct.symbols`` with
    atom symbols.
    
    Parameters
    ----------
    filename : str 
        name of file to write
    symbolsbasename : str, optional
        file for atom symbols
    struct : Structure

    References
    ----------
    ase.calculators.lammpsrun (ASE 3.8).
    """
    dr = os.path.dirname(filename)
    fn = os.path.join(dr, symbolsbasename)
    common.file_write(fn, '\n'.join(struct.symbols))        
    common.file_write(filename, lammps.struct_str(struct))
Esempio n. 2
0
def write_lammps(filename, struct, symbolsbasename='lmp.struct.symbols'):
    """Write Structure object to lammps format. That file can be read in a
    lammps input file by ``read_data``. Write file ``lmp.struct.symbols`` with
    atom symbols.
    
    Parameters
    ----------
    filename : str 
        name of file to write
    symbolsbasename : str, optional
        file for atom symbols
    struct : Structure

    References
    ----------
    ase.calculators.lammpsrun (ASE 3.8).
    """
    dr = os.path.dirname(filename)
    fn = os.path.join(dr, symbolsbasename)
    common.file_write(fn, '\n'.join(struct.symbols))
    common.file_write(filename, lammps.struct_str(struct))
Esempio n. 3
0
templates = [
    batch.FileTemplate(basename=x)
    for x in ['lmp.in', 'lmp.struct', 'lmp.struct.symbols']
]

# rs-AlN
st = crys.Structure(coords_frac=np.array([[0.0] * 3, [0.5] * 3]),
                    symbols=['Al', 'N'],
                    cryst_const=np.array([2.78] * 3 + [60] * 3))

params_lst = []
for target_press in np.linspace(-20, 20, 15):  # GPa, bar in lammps
    params_lst.append([
        sql.SQLEntry(key='target_press', sqlval=target_press * 1e4),
        sql.SQLEntry(key='struct', sqlval=lammps.struct_str(st)),
        sql.SQLEntry(key='symbols', sqlval='\n'.join(st.symbols)),
    ])

calc = batch.ParameterStudy(
    machines=local,
    templates=templates,
    params_lst=params_lst,
    study_name='lammps_ev',
)
calc.write_input(sleep=0, backup=False, mode='w')

if not os.path.exists('calc'):
    os.symlink('calc_local', 'calc')

common.system("cp -r potentials calc_local/")
Esempio n. 4
0
                      scratch='/tmp',
                      filename='calc.templ/job.local',
                      home='/home/schmerler')

templates = [batch.FileTemplate(basename=x) for x in 
             ['lmp.in', 'lmp.struct', 'lmp.struct.symbols']]

# rs-AlN
st = crys.Structure(coords_frac=np.array([[0.0]*3, [0.5]*3]),
                    symbols=['Al','N'],
                    cryst_const=np.array([2.78]*3 + [60]*3))

params_lst = []
for target_press in np.linspace(-20,20,15): # GPa, bar in lammps
    params_lst.append([sql.SQLEntry(key='target_press', sqlval=target_press*1e4),
                       sql.SQLEntry(key='struct', sqlval=lammps.struct_str(st)),
                       sql.SQLEntry(key='symbols', sqlval='\n'.join(st.symbols)),
                      ])

calc = batch.ParameterStudy(machines=local,
                            templates=templates,
                            params_lst=params_lst, 
                            study_name='lammps_ev',
                            )
calc.write_input(sleep=0, backup=False, mode='w')

if not os.path.exists('calc'):
    os.symlink('calc_local', 'calc')

common.system("cp -r potentials calc_local/")