ABINIT developer workshop 2009 ABINIT & V_Sim AUTRANS - F RANCE Parser Objectives Status Implementation API Outlooks V_Sim Parser and visualisation: how to link ABINIT and V_Sim? News Damien Caliste L_Sim - CEA Grenoble 25th March 2009 Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Why do I want to touch the parser of ABINIT? ABINIT & V_Sim Parser Objectives Status Implementation API Outlooks V_Sim News I’ve got a ’foo.in’ file and I’m wondering. . . . . . how many datasets in this file? . . . what is the XC functional used in the second one? This means isolating the parser code from ABINIT and add some ’write’ statements. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Why do I want to touch the parser of ABINIT? I’ve got a ’foo.in’ file and I’m wondering. . . ABINIT & V_Sim Parser Objectives Status . . . how many datasets in this file? . . . what is the XC functional used in the second one? Implementation API Outlooks V_Sim This means isolating the parser code from ABINIT and add some ’write’ statements. News What about a more complex action like: “find all files in /home/caliste/2008Runs dealing with silicon in PBE approximation where Ecut > 15Ht?” Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Why do I want to touch the parser of ABINIT? I’ve got a ’foo.in’ file and I’m wondering. . . . . . how many datasets in this file? ABINIT & V_Sim Parser Objectives Status Implementation API . . . what is the XC functional used in the second one? This means isolating the parser code from ABINIT and add some ’write’ statements. Outlooks V_Sim News What about a more complex action like: “find all files in /home/caliste/2008Runs dealing with silicon in PBE approximation where Ecut > 15Ht?” objective This means having a multi-language library. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Pre 5.6 status of the parser Main routines ABINIT & V_Sim Parser Objectives Status 12parser: generic Fortran tokenification and analysing routines ; 13iovars: allocation, default values, set up and memory check of dtset. Implementation API Outlooks V_Sim News Based on: 01manage_mpi, 11util, 12geometry, 13recipspace and 13xml. Existing drawbacks for a library all major steps are called from abinit.F90; error are reported through human-readable messages; program is stoped on error. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Pre 5.6 status of the parser Main routines ABINIT & V_Sim Parser Objectives Status 12parser: generic Fortran tokenification and analysing routines ; 13iovars: allocation, default values, set up and memory check of dtset. Implementation API Outlooks V_Sim News Based on: 01manage_mpi, 11util, 12geometry, 13recipspace and 13xml. Existing drawbacks for a library 4 all major steps are called from abinit.F90; 8 error are reported through human-readable messages; 8 program is stoped on error. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Main ideas about the implementation Input / output ABINIT & V_Sim Parser Objectives IN: a file name or a string. OUT: a dtsets object (dictionnary-like) with querying methods: keys defined as ab_dtset_<varname> ; Status Implementation API Outlooks _get() methods retrieving integer/double as scalar/arrays. V_Sim News Internals: Fortran90 implementation ; private ab_dtset_load() routine gathering the calls from abinit.F90 ; identification of new parsed dtsets structure with a unique integer and internaly stored in a private Fortran90 linked list. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim The API in Fortran90 ABINIT & V_Sim module a b _ d t s e t ! E r r o r codes integer , parameter , integer , parameter , integer , parameter , integer , parameter , integer , parameter , public public public public public :: :: :: :: :: AB_NO_ERROR AB_ERROR_DTSET_OBJ AB_ERROR_DTSET_ATT AB_ERROR_DTSET_ID AB_ERROR_DTSET_SIZE = = = = = 0 1 2 3 4 Parser Objectives ! Key d e f i n i t i o n s integer , parameter , public : : a b _ d t s e t _ i s c f = 150 integer , parameter , public : : a b _ d t s e t _ i x c = 151 integer , parameter , public : : ab_dtset_delayperm = 152 Status Implementation API Outlooks V_Sim News ! Main public public public public public public public public public routines : : ab_dtset_new : : ab_dtset_new_from_string : : ab_dtset_free : : ab_dtset_get_ndtset : : ab_dtset_get_integer : : ab_dtset_get_real : : ab_dtset_get_shape : : ab_dtset_get_integer_array : : ab_dtset_get_real_array Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim The API in Fortran90 ABINIT & V_Sim Parser Objectives Status Implementation subroutine ab_dtset_new ( d t s e t s I d , f i l e n a m e , n ) integer , i n t e n t ( out ) : : d t s e t s I d integer , i n t e n t ( i n ) : : n character ( len = n ) , i n t e n t ( i n ) : : f i l e n a m e dtsetsId: an identifier to later address these datasets ; API Outlooks V_Sim News filename: a filename ; n: the length of the string (for binding reasons). Remember to call ab_dtset_free() after use. Recovering tricks ab_dtset_new() on failure calls wrtout() and then leave_new(). Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim The API in Fortran90 ABINIT & V_Sim Parser Objectives subroutine a b _ d t s e t _ g e t _ i n t e g e r ( d t s e t s I d , & & value , i d , i d t s e t , e r r n o ) integer , i n t e n t ( i n ) : : d t s e t s I d integer , i n t e n t ( i n ) : : i d , i d t s e t integer , i n t e n t ( out ) : : v a l u e integer , i n t e n t ( out ) : : e r r n o Status Implementation API Outlooks V_Sim News dtsetsId: the identifier returned by ab_dtset_new() ; value: the returned value ; id: the variable identifier ; idtset: the dataset number (0 is default like in ABINIT) ; errno: an error code. value is correct only if errno is AB_NO_ERROR. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim The API in C ABINIT & V_Sim Parser typedef enum { _INT_SCALAR , _INT_ARRAY , _DOUBLE_SCALAR, _DOUBLE_ARRAY, _OTHER } AbDtsetTypes ; AbDtsetTypes a b _ d t s e t _ g e t _ t y p e _ f r o m _ i d ( A b D t s e t I d s i d ) ; # define AB_DTSET_TYPE( A ) a b _ d t s e t _ g e t _ t y p e _ f r o m _ i d ( A ) Objectives Status Implementation API Outlooks AbDtsets ∗ ab_dtset_new ( const char ∗ f i l e n a m e ) ; AbDtsets ∗ a b _ d t s e t _ n e w _ f r o m _ s t r i n g ( const char ∗ s t r i n g ) ; void a b _ d t s e t _ f r e e ( AbDtsets ∗ d t ) ; V_Sim News AbError a b _ d t s e t _ g e t _ n d t s e t ( AbDtsets ∗ dt , i n t ∗ n d t s e t ) ; AbError a b _ d t s e t _ g e t _ i n t e g e r ( AbDtsets ∗ dt , A b D t s e t I d s i d , i n t i d t s e t , i n t ∗ value ) ; AbError ab_dtset_get_shape ( AbDtsets ∗ dt , i n t ∗n , i n t dims [ 7 ] , AbDtsetIds id , i n t i d t s e t ) ; AbError a b _ d t s e t _ g e t _ i n t e g e r _ a r r a y ( AbDtsets ∗ dt , i n t ∗ values , s i z e _ t n , AbDtsetIds id , i n t i d t s e t ) ; Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim The API in Python import a b i n i t ABINIT & V_Sim Parser Objectives Status Implementation API Outlooks V_Sim # Create a new d a t a s e t . d t = a b i n i t . dtsets_new ( f i l e n a m e = " f o o . i n " ) # Get t h e number o f data s e t s . ndtset = dt . dtsets_get_ndtset ( ) # Get t h e v a l u e o f v a r i a b l e ’ i x c ’ f o r d a t a s e t 2 dt . dtsets_get ( " i x c " , 2) News Additional information One can get the list of available variables using abinit.dtsets_get_ids(). The arrays are implemented using numarray. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Example in Python ABINIT & V_Sim Parser Objectives Status Implementation API Outlooks V_Sim News Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim Outlooks ABINIT & V_Sim Parser Objectives Issues Difficult to build ; Tricks to handle errors. Status Implementation API Outlooks V_Sim What next, open propositions. . . a proper error handler ; News a possible write API (?) ; do the same for the symetry routines. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim V_Sim, a visualisation software Interactive, 3D, visualisation software. isolated / periodic systems ; ABINIT & V_Sim balls and sticks (and more) ; Parser cutting planes ; Objectives Status isosurfaces ; Implementation API spin / forces representation ; Outlooks V_Sim ... News Resources: Home page http://inac.cea.fr/L_Sim/V_Sim Debian package http://packages.debian.org/sid/v-sim Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim New features since Liège (not so complete list) Input/output formats Native ABINIT input files ; ABINIT & V_Sim Parser XCrysden structure and forces ; SVG output for schemes ; Objectives Status Implementation API Outlooks Capabilities Coloured maps with isolines ; V_Sim News Smooth periodic duplication ; Full customisation of pairs. Geometry modifications (the road to a builder) Single / group node moving with interactive update of pairs ; removal / addition of nodes. Laboratoire de Simulation Atomistique inac.cea.fr/sp2m/L_Sim
© Copyright 2024