def extract(filenames, equilibrium_length=None): frequencies = [] intensities = [] geometry_params = dict() geometry_params['geometry'] = [] geometry_params['l1'] = [] geometry_params['l2'] = [] geometry_params['l12'] = [] geometry_params['theta'] = [] if equilibrium_length: geometry_params['l1_diff'] = [] geometry_params['l2_diff'] = [] geometry_params['l12_diff'] = [] geometry_params['o12_diff'] = [] for filename in filenames: try: job = ccopen(filename) data = job.parse() vibfreqs = data.vibfreqs vibirs = data.vibirs geometry = data.atomcoords[0] assert len(vibfreqs) == len(vibirs) >= 3 frequencies.append(vibfreqs) intensities.append(vibirs) C, O1, O2 = 0, 1, 2 d_C_O1 = distance(geometry[C], geometry[O1]) d_C_O2 = distance(geometry[C], geometry[O2]) d_O1_O2 = distance(geometry[O1], geometry[O2]) bond_sum = d_C_O1 + d_C_O2 # bond_difference = abs(d_C_O1 - d_C_O2) angle = bond_angle(geometry[O1], geometry[C], geometry[O2]) theta = 180.0 - angle l1 = d_C_O1 l2 = d_C_O2 o12 = d_O1_O2 l12 = bond_sum # dl = bond_difference if equilibrium_length: l1_diff = l1 - equilibrium_length l2_diff = l2 - equilibrium_length o12_diff = o12 - (2 * equilibrium_length) l12_diff = l12 - (2 * equilibrium_length) geometry_params['l1_diff'].append(l1_diff) geometry_params['l2_diff'].append(l2_diff) geometry_params['l12_diff'].append(l12_diff) geometry_params['o12_diff'].append(o12_diff) geometry_params['geometry'].append(geometry) geometry_params['l1'].append(l1) geometry_params['l2'].append(l2) geometry_params['l12'].append(l12) geometry_params['theta'].append(theta) except: pass frequencies = make_numpy_array_from_ragged_list(frequencies) intensities = make_numpy_array_from_ragged_list(intensities) for k in geometry_params: geometry_params[k] = np.array(geometry_params[k]) print("frequencies.shape:", frequencies.shape) print("intensities.shape:", intensities.shape) print("geometry_params['geometry'].shape:", geometry_params['geometry'].shape) return frequencies, intensities, geometry_params
job = ccopen(filename) data = job.parse() vibfreqs = data.vibfreqs vibirs = data.vibirs geometry = data.atomcoords[0] assert len(vibfreqs) == len(vibirs) == 3 frequencies.append(vibfreqs) intensities.append(vibirs) geometries.append(geometry) C, O1, O2 = 0, 1, 2 d_C_O1 = distance(geometry[C], geometry[O1]) d_C_O2 = distance(geometry[C], geometry[O2]) d_O1_O2 = distance(geometry[O1], geometry[O2]) bond_sum = d_C_O1 + d_C_O2 bond_difference = abs(d_C_O1 - d_C_O2) angle = bond_angle(geometry[O1], geometry[C], geometry[O2]) theta = 180.0 - angle l1 = d_C_O1 l2 = d_C_O2 o12 = d_O1_O2 l12 = bond_sum dl = bond_difference