NetCDF file to study MD  [SOLVED]

MULTIBINIT, aTDEP, ANADDB, optics, cut3d, mrg* postprocessors

Moderators: MMNSchmitt, gonze

Locked
mancini
Posts: 40
Joined: Mon Nov 09, 2009 10:56 am

NetCDF file to study MD

Post by mancini » Fri Apr 20, 2012 12:14 pm

Hello to all,
I have to write a simple tools to analyse a molecular dynamics run of Abinit.
I can see that results and informations are stored in two (or three) different files:
1) TEST_OUT.nc
2) TEST_HIST
3) TEST_MOLDYN.nc (only if the input variable "nctime" is used and !=0)

My question: which of these files (or which combination of them) you suggest to use in the future ?

Many thanks,
Marco
Marco Mancini

LUTH, Observatoire de Paris
5, place Jules Janssen
92190 MEUDON - FRANCE

User avatar
torrent
Posts: 127
Joined: Fri Aug 14, 2009 7:40 pm

Re: NetCDF file to study MD

Post by torrent » Sat Apr 21, 2012 12:12 am

Dear Marco,

TEST_MOLDYN.nc is a file produced by Abinit for years.
It contains all the neded data to analyse the trajectories.
All these data are consistent (at each time step t, you have the quantities at time t).

TEST_OUT.nc and TEST_HIST are new files produced by Abinit.
They are specifically devoted to "restart" features (using the "restartxf" input keyword).
TEST_OUT.nc contains all the data that do not vary with the time.
TEST_HIST contains all the evolving data.
As TEST_HIST goal is to perform restarts, the data are not "time-consistent" (at each time step, you can have quantities at t and quantities at t-dt).
It is tricky to use it for trajectory analysis, but possible...

Cheers,

Marc
Marc Torrent
CEA - Bruyères-le-Chatel
France

mancini
Posts: 40
Joined: Mon Nov 09, 2009 10:56 am

Re: NetCDF file to study MD

Post by mancini » Mon Apr 23, 2012 10:03 am

Hello Marc,
thanks for your replay.

So if I have well understood, you are suggesting to use TEST_OUT.nc and TEST_HIST files
and avoid the old style file TEST_MOLDYN.nc.

Actually I was projecting to modify Abinit so to add the complementary informations to the TEST_HIST file.
Compared to the quantity of information which could be contained in the TEST_HIST file, some constant variables
should not change a lot the size of this file.
What do you think about it?

Otherwise, the only solution I can argue, is to parse the 2 files (TEST_OUT.nc and TEST_HIST) to obtain the same
informations contained in TEST_MOLDYN.nc.
Is this a long time solution?

Regards,
Marco
Marco Mancini

LUTH, Observatoire de Paris
5, place Jules Janssen
92190 MEUDON - FRANCE

User avatar
torrent
Posts: 127
Joined: Fri Aug 14, 2009 7:40 pm

Re: NetCDF file to study MD

Post by torrent » Wed Apr 25, 2012 10:40 pm

Hi Marco,

Concerning the HIST and OUT.nc files, you should (have to) contact Guillermo Avendano (UC Louvain) who is the author of these files.. before modifying them.
I know that he is currently still working on these files... adding the support for algorithms using replicas of the unit cell.

but...
I'm pretty sure that the idea is to use BOTH file, not one of them.
I don't think the spirit is to add the constants in the HIST file but it is (for sure) to parse the two files.
I also have written such a post-processing tool (for our needs here at Bruyeres) and I was easily able to parse the two files. They have the same rootname... so they are easy to identify. and it is not a problem to parse 2 files, espacially if they are in the same folder.

I also have a python tool named HIST2MOLDYN which is able to translate the pair (HIST, OUT.nc) into a MOLDYN.nc file.
Such a tool is easy to write (provided that you take into account the time shifts I mentionned).
I cannot send mine to you now because I'm currently in vacation; sorry....

Marc
Marc Torrent
CEA - Bruyères-le-Chatel
France

mancini
Posts: 40
Joined: Mon Nov 09, 2009 10:56 am

Re: NetCDF file to study MD

Post by mancini » Thu Apr 26, 2012 10:50 am

Hello Marc,

thanks again.

After my last post I have started to write a tools which can take or the MOLDYN or the pair HIST+OUT to
analyse the MD.

The only think I hope is that number and names of variables the will not change any month.
good vacations.

Marco
Marco Mancini

LUTH, Observatoire de Paris
5, place Jules Janssen
92190 MEUDON - FRANCE

thanusit
Posts: 70
Joined: Thu Jan 14, 2010 4:20 am

Re: NetCDF file to study MD

Post by thanusit » Tue Jul 31, 2012 11:46 am

Dear Marc and Marco

I'm trying to run a Python script to study the MD runs by abinit6.12.3. The script is diag_moldyn.py provided within the abinit package. However, I've encountered the following errors:

------------------------------------
/usr/lib64/python2.4/site-packages/scipy/misc/__init__.py:25: DeprecationWarning: NumpyTest will be removed in the next release; please update your code to use nose or unittest
test = NumpyTest().test
/usr/lib64/python2.4/site-packages/scipy/sparse/__init__.py:9: DeprecationWarning: NumpyTest will be removed in the next release; please update your code to use nose or unittest
test = NumpyTest().test
/usr/lib64/python2.4/site-packages/scipy/io/__init__.py:24: DeprecationWarning: NumpyTest will be removed in the next release; please update your code to use nose or unittest
test = NumpyTest().test
Traceback (most recent call last):
File "diag_moldyn.py", line 211, in ?
FDR = lireNetcdf()
File "diag_moldyn.py", line 59, in lireNetcdf
ConvNetCdf_Ascii(fiche)
File "diag_moldyn.py", line 124, in ConvNetCdf_Ascii
typat=ncfile2.variables['typat'].data
AttributeError: 'netcdf_variable' object has no attribute 'data'
--------------------------------------------------------------------------------------------

Could you give me some suggestions how to fix this problem, please? (I'm no good at Python script).

Kind regards,
Thanusit

mancini
Posts: 40
Joined: Mon Nov 09, 2009 10:56 am

Re: NetCDF file to study MD

Post by mancini » Fri Oct 26, 2012 11:24 am

Hello Thanusit,

I am very sorry for reply you so late (I should have a problem with the forum report).
I don't use this scipt so I have not idea about you error.
It seems to me a problem of numpy version.

Best regards,
Marco
Marco Mancini

LUTH, Observatoire de Paris
5, place Jules Janssen
92190 MEUDON - FRANCE

thanusit
Posts: 70
Joined: Thu Jan 14, 2010 4:20 am

Re: NetCDF file to study MD

Post by thanusit » Thu Nov 01, 2012 4:49 am

Hello Marco

Thank you for your reply.

I'm new to MD and would like to educate myself with the MD tutorial provided in Abinit. So far I haven't yet been able to get the script work for my system. Before I overcome this problem, I'm thinking of extracting data (likely by hand) of a MD run from output (*.out) and log files. The files seem to contain some quanties like positions and velocities of atoms at each time steps. So maybe I can start my learning from there. However, I would like to ask if the MD information stored in the output and log files are the same as that stored in the *_MOLDYN.nc file.

Kind regards
Thanusit

mancini
Posts: 40
Joined: Mon Nov 09, 2009 10:56 am

Re: NetCDF file to study MD

Post by mancini » Tue Nov 06, 2012 9:37 am

Hello Thanusit,

yes there are the same but to create a software (or also a small script) to extract data from output and log files could be
a temporary solution but I suggest to not spend a lot of time in it:
1) output (as well log) files are very big (because are text files) so to store it will be require a lot of space
2) the structure of the output file is not fixed (changing the version the output file structure could be change) this will make your
MD extractor no very portable.

I made this experience writing a python code for output file. It worked fine but I had to change it for more recent version of ABINIT.

So I suggest to spend some time to create a netcdf MD extractor for MOLDYN or HIST files.

Best regards
Marco
Marco Mancini

LUTH, Observatoire de Paris
5, place Jules Janssen
92190 MEUDON - FRANCE

mancini
Posts: 40
Joined: Mon Nov 09, 2009 10:56 am

Re: NetCDF file to study MD

Post by mancini » Tue Nov 06, 2012 10:05 am

Hello Thanusit,

After discussion with my boss, we decided to propose you the tool that I developed to study MD in ABINIT.
This tool is for the moment only private but I think that in the future could be added to ABINIT package.

Could you please send me a private message to give me your email address?

Best regards,
Marco
Marco Mancini

LUTH, Observatoire de Paris
5, place Jules Janssen
92190 MEUDON - FRANCE

thanusit
Posts: 70
Joined: Thu Jan 14, 2010 4:20 am

Re: NetCDF file to study MD

Post by thanusit » Wed Nov 07, 2012 5:28 am

Hi Marco

It's very kind of you and your boss for proposing me your tool for studying MD in abinit. Since I haven't had your e-mail address, please let me give my e-mail address via this forum. Here it is: thanusit@kku.ac.th.

Kind regards,
Thanusit

thanusit
Posts: 70
Joined: Thu Jan 14, 2010 4:20 am

(SOLVED)Re: NetCDF file to study MD

Post by thanusit » Mon Nov 12, 2012 9:31 am

Dear All

With nice help from Marco for providing his MD analysis tool, I am now able to study MD outputs from Abinit.

Best regards,
Thanusit

hwlalves
Posts: 6
Joined: Fri Apr 02, 2010 5:34 am

Re: NetCDF file to study MD

Post by hwlalves » Fri Jan 10, 2014 4:10 pm

Dear Thanusit,

By reading your solved post on the analysis of the obtained NetCDF abinit file, I am interested in how you solve it once I am experiencing your same problems. I am not a python expert but, after some adjustments of the python script, diag_moldyn.py, I am facing the following problem:

as-gaas100n2a_xo_DS1_MOLDYN.nc # the name of my output NetCDF MD file.
<scipy.io.netcdf.netcdf_file object at 0x8a6304c>
Nbatoms =
12
DimTensor =
6
Traceback (most recent call last):
File "diag_moldyn.py", line 227, in <module>
FDR = lireNetcdf()
File "diag_moldyn.py", line 62, in lireNetcdf
ConvNetCdf_Ascii(fiche)
File "diag_moldyn.py", line 108, in ConvNetCdf_Ascii
Vol = ncfile.variables['Cell_Volume'].data[0]
AttributeError: 'netcdf_variable' object has no attribute 'data'

So it seems that the python script, diag_moldyn.py, is somewhat deprecated for the new versions of abinit. I would like to not spent more time trying to solve it, but I need a "light" to have a script or a code that can help me to analyze my MD results.

Happy new year and my best regards.

Horacio.

thanusit
Posts: 70
Joined: Thu Jan 14, 2010 4:20 am

Re: NetCDF file to study MD

Post by thanusit » Wed Jan 15, 2014 6:42 am

Dear Horacio

Happy New Year to you too. Sorry for my late response.

Firstly, I have to say that I've never been able to get the diag_moldyn.py script work. The above mentioned tool that works for me is Marco's code that was customized to suit my platform (Fedora13) and he (and his boss) kindly allows me to us it. I don't think I have any right to pass on the code to anyone, sorry.

Alternatively, I have found that the Abinit Post Processing Application (APPA) Python script, available in abinit 7.4 or later, also works very well for the analysis of MD results. The script and as well as the guide to installation is provided in ..(abinit build directory).. /scripts/post_processing/appa/Readme. You may also read the attached notes on installation and running, and the Forum post "Running Python script APPA using locally installed Python2.7". Although the notes are rather specific to my platform, I hope it can bring you up some lights to get the script work on yours. I am no expert to Python, either, but very happy to help you get through this.

Kind regards,
Thanusit
Attachments
Using_APPA_Abinit_Post_Processing_tools_for_moldyn_by_T.Burinprakhon.in
(6.41 KiB) Downloaded 430 times

thanusit
Posts: 70
Joined: Thu Jan 14, 2010 4:20 am

Re: NetCDF file to study MD  [SOLVED]

Post by thanusit » Wed Jan 15, 2014 8:46 am

Dear Horacio and all

May I make a little update to my previous post?.
I've just found out that the script "diag_moldyn.py" appears to work find, provided that Python (>=2.7) and the required third party modules are properly installed.

Kind regards,
Thanusit

Locked