Ejemplo n.º 1
0
def main(fileprefix, KijFilePrefix=None):

    if KijFilePrefix is None:
        KijFilePrefix = fileprefix
    # fileprefix='140415a'
    # Datafolder
    dataFolder = 'DATA'
    outputFolder = dataFolder + '/' + fileprefix + '_tar'
    # Post-processor searches/saves file "KijFilePrefix.Kij.npy"
    # KijFilePrefix='130415a'
    # KijFilePrefix=fileprefix
    # Use this restart file if the force constant file cannot be found
    restartFile = KijFilePrefix + '.quenched.restart'

    # Create the data folder
    from subprocess import call
    command = ["mkdir", "-p", outputFolder]
    print " ".join(command)
    call(command)

    dt_md = 2.5e-15  # Timestep used in MD, affects the frequency grid
    widthWin = 0.1e12  # Width of the Daniell smoothing window in Hz
    # The velocity dump file from LAMMPS
    fileVels = fileprefix + '.vels.dat'
    # The compactly formatted velocity file, produced using a C++ script if not found
    fileCompactVels = fileprefix + '.vels.dat.compact'

    # Correct the units, this assumes the unit of eV/(A^2)*(A/ps)^2 for the v_iK_{ij}v_j product (LAMMPS metal units)
    scaleFactor = 1.602e-19 / (1e-20) * 1e4

    # Prepare the post-processor
    pP = SHCPostProc(fileCompactVels,
                     KijFilePrefix,
                     dt_md=dt_md,
                     scaleFactor=scaleFactor,
                     LAMMPSDumpFile=fileVels,
                     widthWin=widthWin,
                     LAMMPSRestartFile=restartFile,
                     NChunks=100,
                     chunkSize=50000,
                     backupPrefix=fileprefix,
                     reCalcVels=False,
                     reCalcFC=False)
    # Post-process
    pP.postProcess()  # All variables will be contained in the object pP

    # Various output options

    # Pickling the post-processing instance
    import cPickle as pickle
    with open(outputFolder + '/' + fileprefix + '_PP.pckl', 'w') as f:
        pickle.dump(pP, f)

    # Saving into numpy files
    np.save(outputFolder + '/' + fileprefix + '_oms.npy', pP.oms_fft)
    np.save(outputFolder + '/' + fileprefix + '_SHC.npy', pP.SHC_smooth)

    # Saving to file
    print "Saving to file " + outputFolder + '/' + fileprefix + '_SHC.txt'
    np.savetxt(outputFolder + '/' + fileprefix + '_SHC.txt',
               np.column_stack((pP.oms_fft, pP.SHC_smooth)))

    # Copy relevant files to the DATA folder
    command = "cp " + fileprefix + '.aveinput_*.dat' + " " + outputFolder
    print command
    call(command, shell=True)

    command = "cp " + fileprefix + '.Ti*.dat' + " " + outputFolder
    print command
    call(command, shell=True)

    # Tar the output folder without the DATA folder
    command = [
        "tar", "-czvf", fileprefix + '_tar.tgz', '--directory=' + dataFolder,
        outputFolder.strip(dataFolder + '/')
    ]
    print " ".join(command)
    call(command)
Ejemplo n.º 2
0
# The compactly formatted velocity file, produced using a C++ script if not found
fileCompactVels = fileprefix + '.vels.dat.compact'
# Post-processor searches/saves file "KijFilePrefix.Kij.npy"
KijFilePrefix = '270115a'
# Use this restart file if the force constant file cannot be found
restartFile = KijFilePrefix + '.quenched.restart'
# Correct the units, this assumes the unit of eV/(A^2)*(A/ps)^2 for the v_iK_{ij}v_j product (LAMMPS metal units)
scaleFactor = 1.602e-19 / (1e-20) * 1e4

# Prepare the post-processor
pP = SHCPostProc(fileCompactVels,
                 KijFilePrefix,
                 dt_md=dt_md,
                 scaleFactor=scaleFactor,
                 LAMMPSDumpFile=fileVels,
                 widthWin=widthWin,
                 LAMMPSRestartFile='270115a.quenched.restart',
                 NChunks=200,
                 chunkSize=50000,
                 backupPrefix=fileprefix,
                 reCalcVels=False,
                 reCalcFC=False)
# Post-process
pP.postProcess()  # All variables will be contained in the object pP

# Various output options

# Pickling the post-processing instance
import cPickle as pickle
with open(outputFolder + '/' + fileprefix + '_PP.pckl', 'w') as f:
    pickle.dump(pP, f)
Ejemplo n.º 3
0
def main(filePrefix):

    # filePrefix='090415a'
    dataFile = filePrefix + '_Si.dat'
    restartFile = filePrefix + '.quenched.restart'
    length = 200
    width = 20
    mass = 28.0
    rho = 2.291  # Density in g/cm^3

    Natoms = np.int(
        np.round(rho * 1e-3 / 1e-6 * length * width**2 * 1e-30 /
                 (mass * 1.66e-27)))
    # Create the box of silicon atoms, write to datafile
    ab = atombox(length, width, Natoms)
    ab.fillBox(seed=1234)
    ab.writeToFile(dataFile, mass)
    del ab

    # Minimize the atom positions
    lmp = lammps()
    lmp.command("variable filename string '" + filePrefix + "'")
    lmp.command("variable datafile string '" + dataFile + "'")
    lmp.command("variable restartfile string '" + restartFile + "'")

    def iterateFile(lmp, filename):
        '''
        Do the same as lmp.file(filename) but allow the script to be continued after quit.
        '''
        with open(filename, "r") as f:
            for line in f:
                print line
                if "quit" in line and line[0] != "#":
                    return
                else:
                    lmp.command(line)
        return

    # lmp.file("quench_Si.lmp") # If quit is found, python quits
    iterateFile(lmp, "quench_Si.lmp")
    lmp.close()
    # Create a new LAMMPS object
    lmp = lammps()
    lmp.command("variable filename string '" + filePrefix + "'")
    lmp.command("variable restartfile string '" + restartFile + "'")
    iterateFile(lmp, "amorphous_interface.lmp")
    # lmp.file("amorphous_interface.lmp")

    fileCompactVels = filePrefix + '.vels.dat.compact'
    fileVels = filePrefix + '.vels.dat'
    widthWin = 0.5e12

    KijFilePrefix = filePrefix
    scaleFactor = 1.602e-19 / (1e-20) * 1e4
    dt_md = 2.5e-15

    pP = SHCPostProc.SHCPostProc(fileCompactVels,
                                 KijFilePrefix,
                                 dt_md=dt_md,
                                 scaleFactor=scaleFactor,
                                 LAMMPSDumpFile=fileVels,
                                 widthWin=widthWin,
                                 NChunks=20,
                                 chunkSize=50000,
                                 backupPrefix=filePrefix,
                                 LAMMPSRestartFile=restartFile,
                                 reCalcVels=True,
                                 reCalcFC=True)

    pP.postProcess()

    # Pickling the post-processing object into file
    import cPickle as pickle
    with open(filePrefix + '_PP.pckl', 'w') as f:
        pickle.dump(pP, f)

    # Saving into numpy files
    np.save(filePrefix + '_oms.npy', pP.oms_fft)
    np.save(filePrefix + '_SHC.npy', pP.SHC_smooth)

    # Saving the frequencies and heat currents to file
    np.savetxt(fileprefix + '_SHC.txt', np.column_stack((oms, pP.SHC_smooth)))
Ejemplo n.º 4
0
def main(fileprefix,KijFilePrefix=None):

    if KijFilePrefix is None:
        KijFilePrefix=fileprefix
    # fileprefix='140415a'
    # Datafolder 
    dataFolder='DATA'
    outputFolder=dataFolder+'/'+fileprefix+'_tar'
    # Post-processor searches/saves file "KijFilePrefix.Kij.npy"
    # KijFilePrefix='130415a' 
    # KijFilePrefix=fileprefix
    # Use this restart file if the force constant file cannot be found
    restartFile=KijFilePrefix+'.quenched.restart' 

    # Create the data folder
    from subprocess import call
    command=["mkdir","-p",outputFolder]
    print " ".join(command)
    call(command)
    
    dt_md=2.5e-15 # Timestep used in MD, affects the frequency grid
    widthWin=0.1e12 # Width of the Daniell smoothing window in Hz
    # The velocity dump file from LAMMPS
    fileVels=fileprefix+'.vels.dat' 
    # The compactly formatted velocity file, produced using a C++ script if not found
    fileCompactVels=fileprefix+'.vels.dat.compact' 

    # Correct the units, this assumes the unit of eV/(A^2)*(A/ps)^2 for the v_iK_{ij}v_j product (LAMMPS metal units)
    scaleFactor=1.602e-19/(1e-20)*1e4
    
    # Prepare the post-processor
    pP=SHCPostProc(fileCompactVels,KijFilePrefix,
                   dt_md=dt_md,scaleFactor=scaleFactor,
                   LAMMPSDumpFile=fileVels,widthWin=widthWin,
                   LAMMPSRestartFile=restartFile,
                   NChunks=100,chunkSize=50000,
                   backupPrefix=fileprefix,
                   reCalcVels=False,
                   reCalcFC=False)
    # Post-process
    pP.postProcess() # All variables will be contained in the object pP
    
    # Various output options
    
    # Pickling the post-processing instance
    import cPickle as pickle
    with open(outputFolder+'/'+fileprefix+'_PP.pckl','w') as f:
        pickle.dump(pP,f)
    
    # Saving into numpy files
    np.save(outputFolder+'/'+fileprefix+'_oms.npy',pP.oms_fft)
    np.save(outputFolder+'/'+fileprefix+'_SHC.npy',pP.SHC_smooth)

    # Saving to file
    print "Saving to file "+outputFolder+'/'+fileprefix+'_SHC.txt'
    np.savetxt(outputFolder+'/'+fileprefix+'_SHC.txt',np.column_stack((pP.oms_fft,pP.SHC_smooth)))

    # Copy relevant files to the DATA folder
    command="cp "+fileprefix+'.aveinput_*.dat'+" "+outputFolder
    print command
    call(command,shell=True)

    command="cp "+fileprefix+'.Ti*.dat'+" "+outputFolder
    print command
    call(command,shell=True)  

    # Tar the output folder without the DATA folder 
    command=["tar","-czvf",fileprefix+'_tar.tgz','--directory='+dataFolder,outputFolder.strip(dataFolder+'/')]
    print " ".join(command)
    call(command)
Ejemplo n.º 5
0
# The velocity dump file from LAMMPS
fileVels=fileprefix+'.vels.dat' 
# The compactly formatted velocity file, produced using a C++ script if not found
fileCompactVels=fileprefix+'.vels.dat.compact' 
# Post-processor searches/saves file "KijFilePrefix.Kij.npy"
KijFilePrefix='270115a' 
# Use this restart file if the force constant file cannot be found
restartFile=KijFilePrefix+'.quenched.restart' 
# Correct the units, this assumes the unit of eV/(A^2)*(A/ps)^2 for the v_iK_{ij}v_j product (LAMMPS metal units)
scaleFactor=1.602e-19/(1e-20)*1e4

# Prepare the post-processor
pP=SHCPostProc(fileCompactVels,KijFilePrefix,
               dt_md=dt_md,scaleFactor=scaleFactor,
               LAMMPSDumpFile=fileVels,widthWin=widthWin,
               LAMMPSRestartFile='270115a.quenched.restart',
               NChunks=200,chunkSize=50000,
               backupPrefix=fileprefix,
               reCalcVels=False,
               reCalcFC=False)
# Post-process
pP.postProcess() # All variables will be contained in the object pP

# Various output options

# Pickling the post-processing instance
import cPickle as pickle
with open(outputFolder+'/'+fileprefix+'_PP.pckl','w') as f:
    pickle.dump(pP,f)
    
# Saving into numpy files
np.save(outputFolder+'/'+fileprefix+'_oms.npy',pP.oms_fft)