Exemple #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
Exemple #2
0
 def __add__(self, atom):
     new_atom = copy(atom)
     oldfrac = new_atom.get_frac()
     newfrac = dot(oldfrac, self.matrix) + self.trans
     newfrac = array(*newfrac[0,].tolist())
     new_atom.set_frac(newfrac.flatten().tolist())
     newcart = frac2cart(newfrac, atom.molecule.get_cell())
     new_atom.cart = newcart
     new_atom.set_name(new_atom.get_name() + '_' + str(self.ID))
     try:
         old_adp = ADP_to_matrix(new_atom.adp['cart_meas'])
         new_adp = dot(self.matrix.transpose(), old_adp)
         new_adp = dot(new_adp, self.matrix)
         new_adp = ADP_to_XD_list(new_adp)
         new_atom.adp['cart_meas'] = new_adp
         new_adp_frac = frac2cart_ADP(new_adp, atom.molecule.get_cell())
         new_atom.adp['frac_meas'] = new_adp_frac
     except ADPDataError:
         pass
     return new_atom
Exemple #3
0
 def run(self):
     super(Frac2Cart, self).run()
     self._Cart(frac2cart(self._Position, self._Cell))
Exemple #4
0
 def set_frac(self, frac):
     self.frac = frac
     self.cart = frac2cart(frac, self.molecule.get_cell())
Exemple #5
0
    def get_cart(self):
        if self.cart is None:
            self.cart = frac2cart(self.frac, self.cell)

        return self.cart
Exemple #6
0
 def get_cart(self):
     return frac2cart(self.frac, self.cell)