Exemple #1
0
 def __init__(self):
     self.title = "Title"
     self.scaling = 1.0
     self.cell = cell.Cell(np.identity(3))
     self.atoms = ['A']
     self.atom_numbers = [1]
     self.coordinate_type = 'Direct'
     self.coordinates = np.array([[0.0, 0.0, 0.0]])
     self.selective_dynamics = False
Exemple #2
0
 def to_configuration(self):
     atoms = [
         atom.Atom(label, coordinates)
         for (label, coordinates
              ) in zip(self.labels(), self.fractional_coordinates())
     ]
     config = configuration.Configuration(
         cell.Cell(matrix=self.cell.matrix * self.scaling), atoms)
     return (config)
Exemple #3
0
 def interpolate_to_orthorhombic_grid( self, dimensions ): # warning. This may need a more robust minimim image function in Cell.py for highly non-orthorhombic cells
     old_grid = self
     old_cell = old_grid.poscar.cell
     new_grid = Grid( dimensions = dimensions )
     new_grid.poscar.cell = cell.Cell( np.diag( np.diag( self.poscar.cell.matrix ) ) )
     index_grid           = np.array( [ [ i, j, k ] for ( i, j, k ), value in np.ndenumerate( new_grid.grid ) ] )
     cart_coord_grid      = np.array( [ new_grid.cartesian_coordinate_at_index( index ) for index in index_grid ] )
     init_frac_coord_grid = np.array( [ old_cell.cartesian_to_fractional_coordinates( r ) for r in cart_coord_grid ] )
     frac_coord_grid      = np.array( [ old_cell.inside_cell( r ) for r in init_frac_coord_grid ] )
     new_grid_data        = np.array( [ old_grid.interpolated_value_at_fractional_coordinate( r ) for r in frac_coord_grid ] )
     new_grid.grid = new_grid_data.reshape( new_grid.dimensions )
     return( new_grid )
Exemple #4
0
 def swap_axes(self, axes):
     new_poscar = copy.deepcopy(self)
     new_poscar.cell = cell.Cell(swap_axes(self.cell.matrix, axes))
     return new_poscar