[ADF-LIST] ADF GUI help :ReaxFF molecular fractions

Laurens Groot groot at scm.com
Fri Oct 13 09:01:37 CEST 2017

Dear Gayani,

This is not possible yet with the GUI. A script would be required to 
parse the .rxmolfra file.
A quick python implementation is as follows:

#!/usr/bin/python

import sys

if (len(sys.argv) < 4):
     print("Incorrect number of arguments.")
     print("Usage: file.rxmolfra nstartmolecules mol1 [mol2 ...]")
     sys.exit()

filename = sys.argv[1]
nstartmolecules = sys.argv[2]
molecules = sys.argv[3:]
print("Iteration,"+",".join(molecules))
with open(filename) as f:
     for line in f:
         if "Iteration" in line:
             count = ['0'] * len(molecules)
             iteration = '0'
         if "Total number of molecules" in line:
             print(iteration+","+",".join(count))
         for imol, mol in enumerate(molecules):
             if " "+mol+" " in line:
                 words = line.split()
                 iteration = words[0]
                 count[imol] = str(float(words[1])/float(nstartmolecules))

To run it on the example from the tutorial:
python script.py Methane.rxmolfra 350 CH4 H2O CO2 > result.csv
You can import this in your favourite plotting program. We will probably 
have a way to plot this directly in our GUI with the next release...
I hope this answers your question.

Kind regards,
Laurens


Op 9-10-2017 om 11:19 schreef Gayani Nadeera Pallewela (Dr):
>
> Dear All,
>
> As shown in the ADF tutorial I was able to obtain the molecular 
> fractions of the simulated system.
>
> I want to plot the ratio of *Number of particular molecular 
> type/Initial number of molecules* with the time.
>
> As I understood Max option give the absolute number of molecules.
>
> Is there any way that I can get Number of particular molecular 
> type/Initial number of molecules plot.
>
> Do I have to use a separate script to do this using  .rxmolfra file as 
> an input?
>
> Thanks and regards,
>
> Gayani
>
> ------------------------------------------------------------------------
> CONFIDENTIALITY: This email is intended solely for the person(s) named 
> and may be confidential and/or privileged. If you are not the intended 
> recipient, please delete it, notify us and do not copy, use, or 
> disclose its contents.
> Towards a sustainable earth: Print only when necessary. Thank you.
>
>
> _______________________________________________
> ADFlist mailing list
> ADFlist at scm.com
> https://lists.scm.com/mailman/listinfo/adflist

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scm.com/pipermail/adflist/attachments/20171013/0f2fa743/attachment-0001.html>


More information about the ADFlist mailing list