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
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.º 3
0
# 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)
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',
Ejemplo n.º 4
0
# 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)
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)))