@@ -2040,101 +2040,100 @@ static bool h5_read_rsp_data(md_vlx_t* vlx, hid_t handle) {
20402040 }
20412041 }
20422042 }
2043+ }
20432044
2044- if (vlx -> rsp .number_of_frequencies > 0 ) {
2045- // Dipoles
2046- size_t num_dipole_points = vlx -> rsp .number_of_frequencies * 3 ;
2047- if (h5_check_dataset_exists (handle , "electric_transition_dipoles" )) {
2048- md_array_resize (vlx -> rsp .electric_transition_dipoles , vlx -> rsp .number_of_frequencies , vlx -> arena );
2049- MEMSET (vlx -> rsp .electric_transition_dipoles , 0 , md_array_bytes (vlx -> rsp .electric_transition_dipoles ));
2050- if (!h5_read_dataset_data (vlx -> rsp .electric_transition_dipoles , num_dipole_points , handle , H5T_NATIVE_DOUBLE , "electric_transition_dipoles" )) {
2051- md_array_free (vlx -> rsp .electric_transition_dipoles , vlx -> arena );
2052- vlx -> rsp .electric_transition_dipoles = NULL ;
2053- }
2045+ if (vlx -> rsp .number_of_frequencies > 0 ) {
2046+ // Dipoles
2047+ size_t num_dipole_points = vlx -> rsp .number_of_frequencies * 3 ;
2048+ if (h5_check_dataset_exists (handle , "electric_transition_dipoles" )) {
2049+ md_array_resize (vlx -> rsp .electric_transition_dipoles , vlx -> rsp .number_of_frequencies , vlx -> arena );
2050+ MEMSET (vlx -> rsp .electric_transition_dipoles , 0 , md_array_bytes (vlx -> rsp .electric_transition_dipoles ));
2051+ if (!h5_read_dataset_data (vlx -> rsp .electric_transition_dipoles , num_dipole_points , handle , H5T_NATIVE_DOUBLE , "electric_transition_dipoles" )) {
2052+ md_array_free (vlx -> rsp .electric_transition_dipoles , vlx -> arena );
2053+ vlx -> rsp .electric_transition_dipoles = NULL ;
20542054 }
2055+ }
20552056
2056- if (h5_check_dataset_exists (handle , "magnetic_transition_dipoles" )) {
2057- md_array_resize (vlx -> rsp .magnetic_transition_dipoles , vlx -> rsp .number_of_frequencies , vlx -> arena );
2058- MEMSET (vlx -> rsp .magnetic_transition_dipoles , 0 , md_array_bytes (vlx -> rsp .magnetic_transition_dipoles ));
2059- if (!h5_read_dataset_data (vlx -> rsp .magnetic_transition_dipoles , num_dipole_points , handle , H5T_NATIVE_DOUBLE , "magnetic_transition_dipoles" )) {
2060- md_array_free (vlx -> rsp .magnetic_transition_dipoles , vlx -> arena );
2061- vlx -> rsp .magnetic_transition_dipoles = NULL ;
2062- }
2057+ if (h5_check_dataset_exists (handle , "magnetic_transition_dipoles" )) {
2058+ md_array_resize (vlx -> rsp .magnetic_transition_dipoles , vlx -> rsp .number_of_frequencies , vlx -> arena );
2059+ MEMSET (vlx -> rsp .magnetic_transition_dipoles , 0 , md_array_bytes (vlx -> rsp .magnetic_transition_dipoles ));
2060+ if (!h5_read_dataset_data (vlx -> rsp .magnetic_transition_dipoles , num_dipole_points , handle , H5T_NATIVE_DOUBLE , "magnetic_transition_dipoles" )) {
2061+ md_array_free (vlx -> rsp .magnetic_transition_dipoles , vlx -> arena );
2062+ vlx -> rsp .magnetic_transition_dipoles = NULL ;
20632063 }
2064+ }
20642065
2065- if (h5_check_dataset_exists (handle , "velocity_transition_dipoles" )) {
2066- md_array_resize (vlx -> rsp .velocity_transition_dipoles , vlx -> rsp .number_of_frequencies , vlx -> arena );
2067- MEMSET (vlx -> rsp .velocity_transition_dipoles , 0 , md_array_bytes (vlx -> rsp .velocity_transition_dipoles ));
2068- if (!h5_read_dataset_data (vlx -> rsp .velocity_transition_dipoles , num_dipole_points , handle , H5T_NATIVE_DOUBLE , "velocity_transition_dipoles" )) {
2069- md_array_free (vlx -> rsp .velocity_transition_dipoles , vlx -> arena );
2070- vlx -> rsp .velocity_transition_dipoles = NULL ;
2071- }
2066+ if (h5_check_dataset_exists (handle , "velocity_transition_dipoles" )) {
2067+ md_array_resize (vlx -> rsp .velocity_transition_dipoles , vlx -> rsp .number_of_frequencies , vlx -> arena );
2068+ MEMSET (vlx -> rsp .velocity_transition_dipoles , 0 , md_array_bytes (vlx -> rsp .velocity_transition_dipoles ));
2069+ if (!h5_read_dataset_data (vlx -> rsp .velocity_transition_dipoles , num_dipole_points , handle , H5T_NATIVE_DOUBLE , "velocity_transition_dipoles" )) {
2070+ md_array_free (vlx -> rsp .velocity_transition_dipoles , vlx -> arena );
2071+ vlx -> rsp .velocity_transition_dipoles = NULL ;
20722072 }
2073+ }
20732074
2074- if (h5_check_dataset_exists (handle , "tpa_strengths/circular" )) {
2075- md_array_resize (vlx -> rsp .tpa_strengths_circular , vlx -> rsp .number_of_frequencies , vlx -> arena );
2076- MEMSET (vlx -> rsp .tpa_strengths_circular , 0 , md_array_bytes (vlx -> rsp .tpa_strengths_circular ));
2077- if (!h5_read_dataset_data (vlx -> rsp .tpa_strengths_circular , vlx -> rsp .number_of_frequencies , handle , H5T_NATIVE_DOUBLE , "tpa_strengths/circular" )) {
2078- md_array_free (vlx -> rsp .tpa_strengths_circular , vlx -> arena );
2079- vlx -> rsp .tpa_strengths_circular = NULL ;
2080- }
2081- }
2075+ if (h5_check_dataset_exists (handle , "tpa_strengths/circular" )) {
2076+ md_array_resize (vlx -> rsp .tpa_strengths_circular , vlx -> rsp .number_of_frequencies , vlx -> arena );
2077+ MEMSET (vlx -> rsp .tpa_strengths_circular , 0 , md_array_bytes (vlx -> rsp .tpa_strengths_circular ));
2078+ if (!h5_read_dataset_data (vlx -> rsp .tpa_strengths_circular , vlx -> rsp .number_of_frequencies , handle , H5T_NATIVE_DOUBLE , "tpa_strengths/circular" )) {
2079+ md_array_free (vlx -> rsp .tpa_strengths_circular , vlx -> arena );
2080+ vlx -> rsp .tpa_strengths_circular = NULL ;
2081+ }
2082+ }
20822083
2083- if (h5_check_dataset_exists (handle , "tpa_strengths/linear" )) {
2084- md_array_resize (vlx -> rsp .tpa_strengths_linear , vlx -> rsp .number_of_frequencies , vlx -> arena );
2085- MEMSET (vlx -> rsp .tpa_strengths_linear , 0 , md_array_bytes (vlx -> rsp .tpa_strengths_linear ));
2086- if (!h5_read_dataset_data (vlx -> rsp .tpa_strengths_linear , vlx -> rsp .number_of_frequencies , handle , H5T_NATIVE_DOUBLE , "tpa_strengths/linear" )) {
2087- md_array_free (vlx -> rsp .tpa_strengths_linear , vlx -> arena );
2088- vlx -> rsp .tpa_strengths_linear = NULL ;
2089- }
2084+ if (h5_check_dataset_exists (handle , "tpa_strengths/linear" )) {
2085+ md_array_resize (vlx -> rsp .tpa_strengths_linear , vlx -> rsp .number_of_frequencies , vlx -> arena );
2086+ MEMSET (vlx -> rsp .tpa_strengths_linear , 0 , md_array_bytes (vlx -> rsp .tpa_strengths_linear ));
2087+ if (!h5_read_dataset_data (vlx -> rsp .tpa_strengths_linear , vlx -> rsp .number_of_frequencies , handle , H5T_NATIVE_DOUBLE , "tpa_strengths/linear" )) {
2088+ md_array_free (vlx -> rsp .tpa_strengths_linear , vlx -> arena );
2089+ vlx -> rsp .tpa_strengths_linear = NULL ;
20902090 }
2091+ }
20912092
2092- if (h5_check_dataset_exists (handle , "sigma" )) {
2093- md_array_resize (vlx -> rsp .sigmas , vlx -> rsp .number_of_frequencies , vlx -> arena );
2094- MEMSET (vlx -> rsp .sigmas , 0 , md_array_bytes (vlx -> rsp .sigmas ));
2095- if (!h5_read_dataset_data (vlx -> rsp .sigmas , md_array_size (vlx -> rsp .sigmas ), handle , H5T_NATIVE_DOUBLE , "sigma" )) {
2096- md_array_free (vlx -> rsp .sigmas , vlx -> arena );
2097- vlx -> rsp .sigmas = NULL ;
2098- }
2093+ if (h5_check_dataset_exists (handle , "sigma" )) {
2094+ md_array_resize (vlx -> rsp .sigmas , vlx -> rsp .number_of_frequencies , vlx -> arena );
2095+ MEMSET (vlx -> rsp .sigmas , 0 , md_array_bytes (vlx -> rsp .sigmas ));
2096+ if (!h5_read_dataset_data (vlx -> rsp .sigmas , md_array_size (vlx -> rsp .sigmas ), handle , H5T_NATIVE_DOUBLE , "sigma" )) {
2097+ md_array_free (vlx -> rsp .sigmas , vlx -> arena );
2098+ vlx -> rsp .sigmas = NULL ;
20992099 }
2100+ }
21002101
2101- if (h5_check_dataset_exists (handle , "optical-rotation" )) {
2102- md_array_resize (vlx -> rsp .optical_rotations , vlx -> rsp .number_of_frequencies , vlx -> arena );
2103- MEMSET (vlx -> rsp .optical_rotations , 0 , md_array_bytes (vlx -> rsp .optical_rotations ));
2104- if (!h5_read_dataset_data (vlx -> rsp .optical_rotations , md_array_size (vlx -> rsp .optical_rotations ), handle , H5T_NATIVE_DOUBLE , "optical-rotation" )) {
2105- md_array_free (vlx -> rsp .optical_rotations , vlx -> arena );
2106- vlx -> rsp .optical_rotations = NULL ;
2107- }
2102+ if (h5_check_dataset_exists (handle , "optical-rotation" )) {
2103+ md_array_resize (vlx -> rsp .optical_rotations , vlx -> rsp .number_of_frequencies , vlx -> arena );
2104+ MEMSET (vlx -> rsp .optical_rotations , 0 , md_array_bytes (vlx -> rsp .optical_rotations ));
2105+ if (!h5_read_dataset_data (vlx -> rsp .optical_rotations , md_array_size (vlx -> rsp .optical_rotations ), handle , H5T_NATIVE_DOUBLE , "optical-rotation" )) {
2106+ md_array_free (vlx -> rsp .optical_rotations , vlx -> arena );
2107+ vlx -> rsp .optical_rotations = NULL ;
21082108 }
2109+ }
21092110
2110- if (h5_check_dataset_exists (handle , "delta-epsilon" )) {
2111- md_array_resize (vlx -> rsp .delta_epsilons , vlx -> rsp .number_of_frequencies , vlx -> arena );
2112- MEMSET (vlx -> rsp .delta_epsilons , 0 , md_array_bytes (vlx -> rsp .delta_epsilons ));
2113- if (!h5_read_dataset_data (vlx -> rsp .delta_epsilons , md_array_size (vlx -> rsp .delta_epsilons ), handle , H5T_NATIVE_DOUBLE , "delta-epsilon" )) {
2114- md_array_free (vlx -> rsp .delta_epsilons , vlx -> arena );
2115- vlx -> rsp .delta_epsilons = NULL ;
2116- }
2111+ if (h5_check_dataset_exists (handle , "delta-epsilon" )) {
2112+ md_array_resize (vlx -> rsp .delta_epsilons , vlx -> rsp .number_of_frequencies , vlx -> arena );
2113+ MEMSET (vlx -> rsp .delta_epsilons , 0 , md_array_bytes (vlx -> rsp .delta_epsilons ));
2114+ if (!h5_read_dataset_data (vlx -> rsp .delta_epsilons , md_array_size (vlx -> rsp .delta_epsilons ), handle , H5T_NATIVE_DOUBLE , "delta-epsilon" )) {
2115+ md_array_free (vlx -> rsp .delta_epsilons , vlx -> arena );
2116+ vlx -> rsp .delta_epsilons = NULL ;
21172117 }
2118+ }
21182119
2119- if (h5_check_dataset_exists (handle , "oscillator_strengths" )) {
2120- md_array_resize (vlx -> rsp .oscillator_strengths , vlx -> rsp .number_of_frequencies , vlx -> arena );
2121- MEMSET (vlx -> rsp .oscillator_strengths , 0 , md_array_bytes (vlx -> rsp .oscillator_strengths ));
2122- if (!h5_read_dataset_data (vlx -> rsp .oscillator_strengths , md_array_size (vlx -> rsp .oscillator_strengths ), handle , H5T_NATIVE_DOUBLE , "oscillator_strengths" )) {
2123- md_array_free (vlx -> rsp .oscillator_strengths , vlx -> arena );
2124- vlx -> rsp .oscillator_strengths = NULL ;
2125- }
2120+ if (h5_check_dataset_exists (handle , "oscillator_strengths" )) {
2121+ md_array_resize (vlx -> rsp .oscillator_strengths , vlx -> rsp .number_of_frequencies , vlx -> arena );
2122+ MEMSET (vlx -> rsp .oscillator_strengths , 0 , md_array_bytes (vlx -> rsp .oscillator_strengths ));
2123+ if (!h5_read_dataset_data (vlx -> rsp .oscillator_strengths , md_array_size (vlx -> rsp .oscillator_strengths ), handle , H5T_NATIVE_DOUBLE , "oscillator_strengths" )) {
2124+ md_array_free (vlx -> rsp .oscillator_strengths , vlx -> arena );
2125+ vlx -> rsp .oscillator_strengths = NULL ;
21262126 }
2127+ }
21272128
2128- if (h5_check_dataset_exists (handle , "rotatory_strengths" )) {
2129- md_array_resize (vlx -> rsp .rotatory_strengths , vlx -> rsp .number_of_frequencies , vlx -> arena );
2130- MEMSET (vlx -> rsp .rotatory_strengths , 0 , md_array_bytes (vlx -> rsp .rotatory_strengths ));
2131- if (!h5_read_dataset_data (vlx -> rsp .rotatory_strengths , md_array_size (vlx -> rsp .rotatory_strengths ), handle , H5T_NATIVE_DOUBLE , "rotatory_strengths" )) {
2132- md_array_free (vlx -> rsp .rotatory_strengths , vlx -> arena );
2133- vlx -> rsp .rotatory_strengths = NULL ;
2134- }
2129+ if (h5_check_dataset_exists (handle , "rotatory_strengths" )) {
2130+ md_array_resize (vlx -> rsp .rotatory_strengths , vlx -> rsp .number_of_frequencies , vlx -> arena );
2131+ MEMSET (vlx -> rsp .rotatory_strengths , 0 , md_array_bytes (vlx -> rsp .rotatory_strengths ));
2132+ if (!h5_read_dataset_data (vlx -> rsp .rotatory_strengths , md_array_size (vlx -> rsp .rotatory_strengths ), handle , H5T_NATIVE_DOUBLE , "rotatory_strengths" )) {
2133+ md_array_free (vlx -> rsp .rotatory_strengths , vlx -> arena );
2134+ vlx -> rsp .rotatory_strengths = NULL ;
21352135 }
21362136 }
2137-
21382137 }
21392138
21402139 return true;
0 commit comments