Advertisement
shihab2196

different_species_VS_cutoffs

Dec 12th, 2023
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Author: Shihab Ahmed
  4. Created on Fri Dec  8 13:29:43 2023
  5. """
  6. import numpy as np
  7. import pandas as pd
  8. import matplotlib.pyplot as plt
  9. import random
  10. import magnolia.speciesfile_parser as sfp
  11.                
  12. base_oil = 'PAO4'
  13. data = {}
  14. all_data = {}
  15. total_species = {}
  16. for cutoff in np.array(range(30,76,5))/100:
  17.     commmon = r"C:\Users\arup2\OneDrive - University of California Merced\Desktop\LAMMPS\Base_Oil\{}\25_{}_200_O2_Soria\Production\1600".format(base_oil,base_oil)
  18.     sim_dir = ['\\Sim-1','\\Sim-2','\\Sim-3']
  19.     flag = True
  20.     for sim in sim_dir:
  21.         directory = commmon+sim
  22.         speciesfile = directory+f'\\species_{cutoff}.out'
  23.         if cutoff==0.30:
  24.             speciesfile = directory+'\\species.out'
  25.         current = sfp.get_species_count(speciesfile).T
  26.         if flag:
  27.             summed_species = current.copy()
  28.             flag = False
  29.         else:
  30.             summed_species = summed_species.add(current,fill_value=0)
  31.     exclude= ['O2', 'H62C30']
  32.     nsim   = len(sim_dir) # number of simulation
  33.     species = (summed_species/nsim).drop(exclude,axis=1)
  34.     plt.style.use("classic")
  35.     plt.figure(figsize=(6.4, 4.8))
  36.     total_molecule = species.count(axis=1)
  37.     total_species[cutoff] = len(species.columns)
  38.     last_value = total_molecule.iloc[-10:].mean()
  39.     data[cutoff]=last_value
  40.     all_data[cutoff]=species
  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