Advertisement
shihab2196

bond_order_cutoff_analysis

Dec 29th, 2023 (edited)
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.70 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Author: Shihab Ahmed
  4. Created on Fri Dec 29 03:52:55 2023
  5. """
  6.  
  7. import numpy as np
  8. import matplotlib.pyplot as plt
  9. import random
  10. import magnolia.speciesfile_parser as sfp
  11.                
  12. data = {}
  13. all_data = {}
  14. total_species = {}
  15.  
  16. for cutoff in np.array(range(30,80,5))/100:
  17.     total_species[cutoff]=0
  18.    
  19. for cutoff in np.array(range(30,80,5))/100:
  20.     dirr = r"C:\Users\arup2\OneDrive - University of California Merced\Desktop\LAMMPS\Antioxidants\ABCDE\D\D_300_O2\Production\1000K"
  21.     sim_dir = ['\\Sim-1','\\Sim-2','\\Sim-3']
  22.     flag = True
  23.     for sim in sim_dir:
  24.         directory = dirr+sim
  25.         speciesfile = directory+f'\\species_{cutoff}.out'
  26.         if cutoff==0.30:
  27.             speciesfile = directory+'\\species.out'
  28.         current = sfp.get_species_count(speciesfile).T
  29.         if flag:
  30.             summed_species = current.copy()
  31.             flag = False
  32.         else:
  33.             summed_species = summed_species.add(current,fill_value=0)
  34.     exclude= []#['O2', 'H26C34O4']
  35.     nsim   = len(sim_dir) # number of simulation
  36.     species = (summed_species/nsim).drop(exclude,axis=1)
  37.     plt.style.use("classic")
  38.     plt.figure(figsize=(6.4, 4.8))
  39.     total_molecule = species.count(axis=1)
  40.     total_species[cutoff]+= len(species.columns)
  41. #%%  
  42. plt.plot(total_species.keys(),total_species.values(),marker='s',c='r')
  43. plt.xlim(0.29)
  44. plt.xlabel('Bond order cutoff')
  45. plt.ylabel('Total number of different species')
  46. plt.savefig(r'C:\Users\arup2\OneDrive - University of California Merced\Desktop\LAMMPS\Post Processing\lammps_processing\python_outputs\species'+'\\species_speciesfile{}'.format(random.randint(0,10000000000)),dpi=400,bbox_inches='tight')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement