User Tools

Site Tools


developers:add_new_variable

How to a add a new input variable to Abinit

Created and updated (2014.01.18)

To create a new input variable you need to edit the following routines:

  • Define the new variable inside the dataset_type defined in src/44_abitypes_defs/defs_abitypes.F90, Follow the alphabetic ordering for each kind of variable
           ! Scalars
           integer :: ntypat
           
           ! Pointers to arrays
           integer, pointer :: typat(:)  ! typat(natom)
  • Change the routine dtsetcopy (defined in src/53_abiutil/m_dtset.F90) so that the new variable is correctly copied
           ! Scalars
           dtout%ntypat = dtin%ntypat
           
           ! Pointers to arrays
           call deep_copy( dtin%typat, dtout%typat)
  • If the new variable is a pointer one has to nullify the pointer in the routine dtset_nullify. The memory is deallocated in the routine dtset_free (see m_dtset.F90)
  • Add the line for the checking of input variables in src/57_iovars/chkinp.F90. Use the routines chkint_eq, chkint_ne, chkint_ge, chkint_le, chkdpr
  • Add the line for the checking of variables (src/57_iovars/chkvars.F90). Follow the alphabetic ordering
  • Add the default value in src/57_iovars/indefo.F90
  • Initialize variables for the ABINIT code, for one particular dataset in src/57_iovars/invars2.F90
  • NOT NEEDED Include the variable in the list of input variables (src/57_iovars/is_input_variable.F90) this is done automatically by a perl script
  • Add the variable for printing in src/57_iovars/outvar_a_h.F90, src/57_iovars/outvar_i_n.F90, or src/57_iovars/outvar_o_z.F90 according to the first letter of the new variable
developers/add_new_variable.txt · Last modified: 2014/03/13 14:34 by Fabien Bruneval