Esempio n. 1
0
    def parse(self):
        self.names = []
        self.adp_frac = {}
        self.adp_error_frac = {}
        self.adp_cart = {}
        self.adp_error_cart = {}
        self.frac = {}
        self.cart = {}
        self.element = {}
        self.cif = CIF(self.filename)
        self.cell = self.cif.cell
        self.T = value(self.cif['_diffrn_ambient_temperature'])
        for atomname, values in self.cif.positions.items():

            self.names.append(atomname)

            self.frac[atomname] = values['frac']
            self.cart[atomname] = frac2cart(values['frac'], self.cell)
            self.element[atomname] = values['element']
            if atomname in self.cif.atoms.keys():
                self.adp_frac[atomname] = self.cif.atoms[atomname]['adp']
                self.adp_error_frac[atomname] = self.cif.atoms[atomname]['adp_error']
                self.adp_cart[atomname] = frac2cart_ADP(self.cif.atoms[atomname]['adp'], self.cell)
                try:
                    self.adp_error_cart[atomname] = frac2cart_ADP(self.cif.atoms[atomname]['adp_error'], self.cell)
                except TypeError:
                    self.adp_error_cart[atomname] = None
            else:
                self.adp_error_frac[atomname] = None
                self.adp_frac[atomname] = None
                self.adp_error_cart[atomname] = None
                self.adp_cart[atomname] = None
Esempio n. 2
0
def check_cell(cif, p4p_values):
    """
    The values of the parameters are compared to those
    in the primary CIF. If the values do not match a
    Warning is printed.
    """
    cif_values = []
    cif_values.append('{:.4f}'.format(value(cif['_cell_length_a'])))
    cif_values.append('{:.4f}'.format(value(cif['_cell_length_b'])))
    cif_values.append('{:.4f}'.format(value(cif['_cell_length_c'])))
    cif_values.append('{:.4f}'.format(value(cif['_cell_angle_alpha'])))
    cif_values.append('{:.4f}'.format(value(cif['_cell_angle_beta'])))
    cif_values.append('{:.4f}'.format(value(cif['_cell_angle_gamma'])))
    for i, par in enumerate(p4p_values[:-1]):
        if not par == cif_values[i]:
            global cell_error
            cell_error = True
            printer.highlight(' Warning: Cell parameters from CIF and P4P-file do not match.', char='//\\\\')