Skip to content

Explicit output of kmc trajectory? #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xunhuazhao opened this issue Apr 16, 2015 · 7 comments
Open

Explicit output of kmc trajectory? #24

xunhuazhao opened this issue Apr 16, 2015 · 7 comments

Comments

@xunhuazhao
Copy link

Hi, after a quick reading the documentation and playing with simple models, I am still not clear about a few important things:

  1. how can we specify the total running time?
  2. is it possible to explicitly output kmc traectory? I mean, coverage, TOF etc. along with time. Or can we output explicit value of time-averaged coverage and TOF? Curently I know only "kmos view" gives instance coverage in plot while I am interested in explicit values of coverage, TOF.

Thank you very much!

@mhoffman
Copy link
Owner

2015-04-16 15:31 GMT-07:00 xunhuazhao [email protected]:

Hi, after a quick reading the documentation and playing with simple
models, I am still not clear about a few important things:

  1. how can we specify the total running time?

We typically don't specify this directly since it is hard to say
independent of the system how long a kMC step take. You could run 'kmos
benchmark' which gives you an idea of how many seconds 1e6 steps take and
then divide your desired runtime by that number to see how many steps you
can do in your runtime. If you know the number of steps you can always run
model.do_steps(number_of_steps)

  1. is it possible to explicitly output kmc traectory? I mean, coverage,
    TOF etc. along with time. Or can we output explicit value of time-averaged
    coverage and TOF? Curently I know only "kmos view" gives instance coverage
    in plot while I am interested in explicit values of coverage, TOF.

Please have a look at the documentation here first :
http://kmos.readthedocs.org/en/latest/tutorials/index.html#running-the-model-the-api-way

Dr. Max J. Hoffmann
MAIL
Dept. of Chemical Engineering PHONE: +1 650 521 7187
Stanford University EMAIL:
[email protected]
4300
Shriram Center, room 315
443 Via Ortega
Stanford, CA 94035-4125
(U.S.A.)

@xunhuazhao
Copy link
Author

Hi, I look that chapter (1.6) and feel that the description is not very clear to me (Sorry).

It looks that there are two API ways to run a kmos simulation--one is run though a python script, the other one is "interact directly with model" by input commands in a sequence, is this correct?

I tried the following script, some warnings came out without any error message, I did not see any output file.

I tried also start from "kmos shell" and the command "model = KMC_Model(print_rates=False, banner=False)" leads to an error message:"name 'KMC_Model' is not defined". Furthermore, I input "from kmos.run import KMC_Model" and again "model = KMC_Model(print_rates=False, banner=False)", it gave me another error message"Fortran runtime error: Attempting to allocate already allocated variable 'nr2lattice'".

It will be great if you can comment on the problem and describe a bit more about how one can start to run a kmos simulation in API way(s). Thank you.

#######################################
#!/usr/bin/env python

from kmos.run import KMC_Model
model = KMC_Model()
model.do_steps(100000)
#######################################

@jmlorenzi
Copy link
Contributor

As Max is in PST and probably sleep right now, maybe I can take the liberty of commenting in the main points in case it helps:

(in reverse order)
2. If you start your ipython session with 'kmos shell', your model is already there. So you shall NOT import kmos.run or allocate the model with model=KMC_Model(). You can start directly playing by doing model.do_steps(N), model.get_atoms() etc...

Alternatively, you can start your shell with 'ipython' and then doing 'from kmos.run import KMC_Model' and 'model=KMC_Model()'

  1. About the warning: Could you be a bit more specific than 'some warnings'?
    About the no output file: That is the expected behavior. To get output you are supposed to use the model.get_atoms() method and explore the contents of the atoms object it returns, as explained in the tutorial. (Also: another useful method is model.get_std_sampled_data, it should be documented in the reference)

Were you familiar with python before you found kmos? If not, it is really worthwhile to learn the basics somewhere to ease you way into building useful scripts to run kmos.

Hope this helps,
Juan

@xunhuazhao
Copy link
Author

Thanks for your reply. I knew a bit about python. I run the above script by "python run.py" where run.py is its name. In the "kmos shell" way, I tried different commands. As you pointed out, some of them are not needed.

The remaining problem is I have not got expected results.
As you suggested, I input "model.get_atoms()" and got "Atoms(symbols='C340O396', positions=..., cell=[20.0, 20.0, 1.0], pbc=[False, False, False])" which I do not understand much.
"atoms = model.get_atoms()" leads to "Warning: numerical precision too low, to resolve time-steps
Will reset kMC time to 0s.".

Nothing came out from "atoms = model.get_atoms(geometry=False)".

What I would like to output are the current TOF and coverages. Thank you a lot!

@jmlorenzi
Copy link
Contributor

Ok. First of all, no output to the command line does not meant that 'nothing came out'. I suspect you actually get the atoms object. Then you need to look into the attributes of such object, doing

atoms.occupation
atoms.tofs

to see the results. This is explained in the tutorial, in the "Running the Model the API way"

The error about the numerical precision* appears sometimes when you ask for an atoms object twice without doing any kmc_steps in between (or if you do a very small number... or if the rates of the different process in you model differ by several orders of magnitude).

I must agree that the tutorial could be a bit more clear. However, all the critical information is there. Please take another look into it.

@xunhuazhao
Copy link
Author

Thanks a lot for your patient answers.
That is exactly I would like to get. After your explanations, the tutorial looks much clearer now :)

@jmlorenzi
Copy link
Contributor

No problem. Glad I could help.

@mhoffman Hadn't you fixed the 'numerical precision too low' thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants