Пример #1
0
 def get_kpoints(self, structure):
     '''
     Writes out a KPOINTS file using the fully automated grid method. Uses Gamma centered meshes 
     for hexagonal cells and Monkhorst-Pack grids otherwise.
     
     Algorithm: 
         Uses a simple approach scaling the number of divisions along each 
         reciprocal lattice vector proportional to its length. 
     '''
     return Kpoints.automatic_density(structure, int(self.kpoints_settings['grid_density']))
Пример #2
0
 def test_static_constructors(self):
     kpoints = Kpoints.gamma_automatic([3, 3, 3], [0, 0, 0])
     self.assertEqual(kpoints.style, "Gamma")
     self.assertEqual(kpoints.kpts, [[3, 3, 3]])
     kpoints = Kpoints.monkhorst_automatic([2, 2, 2], [0, 0, 0])
     self.assertEqual(kpoints.style, "Monkhorst")
     self.assertEqual(kpoints.kpts, [[2, 2, 2]])
     kpoints = Kpoints.automatic(100)
     self.assertEqual(kpoints.style, "Automatic")
     self.assertEqual(kpoints.kpts, [[100]])
     filepath = os.path.join(test_dir, 'POSCAR')
     poscar = Poscar.from_file(filepath)
     kpoints = Kpoints.automatic_density(poscar.struct, 500)
     self.assertEqual(kpoints.kpts, [[2, 4, 4]])
Пример #3
0
 def scale_mesh(self, newstr, density):
     """Scale the kpoint mesh.
         Args:
             newstr <structure>: new structure
             density <float>: kpoint density
         Returns:
             newkmesh <pymatgen Kpoints>: new kpoint mesh
             sets program_keys 'mast_kpoints' to new mesh
     """
     newkmesh = Kpoints.automatic_density(newstr, density)
     klist = list()
     klist = newkmesh.to_dict['kpoints'][0]
     klist.append(newkmesh.to_dict['generation_style'][0])
     self.keywords['program_keys']['mast_kpoints'] = klist
     return newkmesh