c2f_string Subroutine

private pure subroutine c2f_string(c_str, f_str)

Convert a string coming from C into a Fortran string

Arguments

Type IntentOptional Attributes Name
character(kind=c_char), intent(in) :: c_str(:)

Input string to be converted

character(len=*), intent(out) :: f_str

Called by

proc~~c2f_string~~CalledByGraph proc~c2f_string c2f_string proc~c_ommp_qm_helper_init_vdw_prm C_ommp_qm_helper_init_vdw_prm proc~c_ommp_qm_helper_init_vdw_prm->proc~c2f_string proc~c_ommp_init_xyz C_ommp_init_xyz proc~c_ommp_init_xyz->proc~c2f_string proc~c_ommp_init_mmp C_ommp_init_mmp proc~c_ommp_init_mmp->proc~c2f_string proc~c_ommp_system_from_qm_helper C_ommp_system_from_qm_helper proc~c_ommp_system_from_qm_helper->proc~c2f_string proc~c_ommp_qm_helper_init_vdw C_ommp_qm_helper_init_vdw proc~c_ommp_qm_helper_init_vdw->proc~c2f_string proc~c_ommp_fatal C_ommp_fatal proc~c_ommp_fatal->proc~c2f_string proc~c_ommp_create_link_atom C_ommp_create_link_atom proc~c_ommp_create_link_atom->proc~c2f_string proc~c_ommp_message C_ommp_message proc~c_ommp_message->proc~c2f_string proc~c_ommp_time_pull C_ommp_time_pull proc~c_ommp_time_pull->proc~c2f_string proc~c_ommp_set_outputfile C_ommp_set_outputfile proc~c_ommp_set_outputfile->proc~c2f_string proc~c_ommp_save_mmp C_ommp_save_mmp proc~c_ommp_save_mmp->proc~c2f_string proc~c_ommp_print_summary_to_file C_ommp_print_summary_to_file proc~c_ommp_print_summary_to_file->proc~c2f_string

Contents

Source Code


Source Code

        pure subroutine c2f_string(c_str, f_str)
            !! Convert a string coming from C into a Fortran string
            implicit none
            
            character(kind=c_char), intent(in) :: c_str(:)
            !! Input string to be converted
            character(len=*), intent(out) :: f_str

            integer :: i 

            i = 1
            do while(c_str(i) /= c_null_char)
                f_str(i:i) = c_str(i)
                i = i + 1
            end do

            do i = i, len(f_str)
                f_str(i:i) = ' '
            end do

            f_str = trim(f_str)
        end subroutine c2f_string