Пример #1
0
def main():
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    poscar.output_as_cif( args.symprec )
Пример #2
0
class PoscarTestCase( unittest.TestCase ):

    def setUp( self ):
        self.poscar = Poscar()
        self.poscar.title = "Title"
        self.poscar.scaling = 1.0
        self.poscar.cell = Mock( spec=Cell )
        self.poscar.cell.matrix = np.identity( 3 )
        self.poscar.atoms = [ 'A' ]
        self.poscar.atom_numbers = [ 1 ]
        self.poscar.coordinate_type = 'Direct'
        self.poscar.coordinates = np.array( [ [ 0.0, 0.0, 0.0 ] ] )
        self.poscar.selective_dynamics = False

    def test_stoichiometry( self ):
        poscar = Poscar()
        poscar.atoms = [ 'A', 'B', 'C' ]
        poscar.atom_numbers = [ 1, 2, 3 ]
        self.assertEqual( poscar.stoichiometry, Counter( { 'A': 1, 'B': 2, 'C': 3 } ) )

    @patch('sys.stdout', new_callable=StringIO)
    def test_output_header( self, mock_stdout ):
        self.poscar.output_header()
        expected_header_string = ("Title\n"
                                  "1.0\n"
                                  "    1.0000000000    0.0000000000    0.0000000000\n"
                                  "    0.0000000000    1.0000000000    0.0000000000\n"
                                  "    0.0000000000    0.0000000000    1.0000000000\n"
                                  "A\n"
                                  "1\n"
                                  "Direct\n")
        self.assertEqual( mock_stdout.getvalue(), expected_header_string )
Пример #3
0
def main():
    args = parse_command_line_arguments()
    poscar = Poscar()
    poscar.read_from( args.poscar )
    theta = math.pi * args.degrees / 180.0
    poscar.cell.rotate( args.axis, theta )
    poscar.output()
Пример #4
0
def main():
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar() # this doesn't really need vasppy. Could just use pymatgen to read the POSCAR
    # read POSCAR file
    poscar.read_from( args.poscar )
    structure = poscar.to_pymatgen_structure()
    symmetry_analyzer = SpacegroupAnalyzer( structure, symprec = args.symprec )
    print( symmetry_analyzer.get_space_group_symbol() )
Пример #5
0
def main():
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar() # this doesn't really need vasppy. Could just use pymatgen to read the POSCAR
    # read POSCAR file
    poscar.read_from( args.poscar )
    structure = poscar.to_pymatgen_structure()
    symmetry_analyzer = SpacegroupAnalyzer( structure, symprec = args.symprec )
    print( symmetry_analyzer.get_space_group_symbol() )
Пример #6
0
def main():
    args = parse_command_line_arguments()
    coordinate_types = {
        'd': 'Direct',
        'direct': 'Direct',
        'c': 'Cartesian',
        'cartesian': 'Cartesian'
    }
    coordinate_type = coordinate_types[args.coordinate_type]
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from(args.poscar)
    if args.scale:
        poscar.cell.matrix *= poscar.scaling
        poscar.scaling = 1.0
    if args.supercell:  # generate supercell
        if args.group:
            # check that if grouping is switched on, we are asking for a supercell that allows a "3D-chequerboard" pattern.
            for (i, axis) in zip(args.supercell, range(3)):
                if i % 2 == 1 and i > 1:
                    raise Exception(
                        "odd supercell expansions != 1 are incompatible with automatic grouping"
                    )
        poscar = poscar.replicate(*args.supercell, group=args.group)
    if args.bohr:
        poscar = poscar.in_bohr()
    # output to stdout
    output_opts = {
        'label': args.label,
        'numbered': args.number_atoms,
        'coordinates_only': args.coordinates_only,
        'selective': args.selective
    }
    poscar.output(coordinate_type=coordinate_type, opts=output_opts)
Пример #7
0
 def setUp( self ):
     self.poscar = Poscar()
     self.poscar.title = "Title"
     self.poscar.scaling = 1.0
     self.poscar.cell = Mock( spec=Cell )
     self.poscar.cell.matrix = np.identity( 3 )
     self.poscar.atoms = [ 'A' ]
     self.poscar.atom_numbers = [ 1 ]
     self.poscar.coordinate_type = 'Direct'
     self.poscar.coordinates = np.array( [ [ 0.0, 0.0, 0.0 ] ] )
     self.poscar.selective_dynamics = False
Пример #8
0
def main():
    args = parse_command_line_arguments()
    coordinate_types = { 'd' : 'Direct',
                         'direct' : 'Direct',
                         'c' : 'Cartesian',
                         'cartesian' : 'Cartesian' }
    coordinate_type = coordinate_types[ args.coordinate_type ]
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    if args.scale:
        poscar.cell.matrix *= poscar.scaling
        poscar.scaling = 1.0
    if args.supercell: # generate supercell
        if args.group:
            # check that if grouping is switched on, we are asking for a supercell that allows a "3D-chequerboard" pattern.
            for (i,axis) in zip( args.supercell, range(3) ):
                if i%2 == 1 and i > 1:
                    raise Exception( "odd supercell expansions != 1 are incompatible with automatic grouping" )
        poscar = poscar.replicate( *args.supercell, group=args.group )
    if args.bohr:
        poscar = poscar.in_bohr()
    # output to stdout
    output_opts = { 'label'    : args.label,
                    'numbered' : args.number_atoms,
                    'coordinates_only' : args.coordinates_only,
                    'selective': args.selective }
    poscar.output( coordinate_type=coordinate_type, opts=output_opts )
Пример #9
0
def read_data( verbose=True ):
    dir_list = find_vasp_calculations()
    if not dir_list:
        raise ValueError( 'Did not find any subdirectories containing vasprun.xml or vasprun.xml.gz files' )
    data = []
    for d in dir_list:
        converged = True
        try:
            with warnings.catch_warnings(record=True) as w:
                vasprun = read_vasprun( match_filename( d + 'vasprun.xml' ) )
                for warning in w:
                    if isinstance( warning.message, UnconvergedVASPWarning ):
                        converged = False
                    else:
                        print( warning.message )
        except:
            continue 
        poscar = Poscar.from_file( d + 'POSCAR' )
        data.append( [ poscar.scaling, 
                       vasprun.final_structure.volume, 
                       vasprun.final_energy,
                       converged ] )
    column_titles = [ 'scaling', 'volume', 'energy', 'converged' ]
    df = pd.DataFrame( data, columns=column_titles ).sort_values( by='scaling' )
    df = df.reset_index( drop=True )
    df['scaling_factor'] = df.volume / df.scaling**3
    scaling_factor_round = 4
    if verbose:
        print( df.to_string(index=False) )
    if len( set( df.scaling_factor.round( scaling_factor_round ) ) ) != 1:
        raise ValueError( "POSCAR scaling factors and volumes are inconsistent" )
    return df
Пример #10
0
def main():
    filename = 'testout.rst'
    restart_file = True
    args = parse_command_line_arguments()
    coordinates, velocities, dipoles, full_cell_matrix, cell_lengths = read_pimaim_restart( filename )
    assert( sum( args.atom_numbers ) == len( coordinates ) )
    poscar = Poscar()
    full_cell_matrix = full_cell_matrix.transpose()
    coordinates = get_cart_coords_from_pimaim_restart(coordinates, full_cell_matrix,cell_lengths)
    poscar.cell = Cell( full_cell_matrix)
    poscar.atoms = args.labels
    poscar.atom_numbers = args.atom_numbers
    poscar.coordinate_type = 'Cartesian'
    poscar.coordinates = coordinates
    poscar.output()
Пример #11
0
def main():
    filename = 'testout.rst'
    restart_file = True

    args = parse_command_line_arguments()
    coordinates, velocities, dipoles, full_cell_matrix = read_pimaim_restart(
        filename)
    assert (sum(args.atom_numbers) == len(coordinates))
    poscar = Poscar()
    poscar.cell = Cell(
        full_cell_matrix)  # TODO: possibly this needs transposing?
    poscar.atoms = args.labels
    poscar.atom_numbers = args.atom_numbers
    poscar.coordinate_type = 'Cartesian'
    poscar.coordinates = coordinates
    poscar.output()
Пример #12
0
def main():
    args = parse_command_line_arguments()
    poscar = Poscar.from_file( args.poscar )
    potcars = potcar_spec( args.potcar )
    for i, ( species, potcar ) in enumerate( zip( poscar.atoms, potcars ), 1 ):
        matching_potcar = potcar.startswith( species )
        if not matching_potcar:
            raise AttributeError( 'Species {} mismatch:\nPOSCAR contains {}\nPOTCAR contains {}'.format( i, species, potcar ) )
        if args.ppset:
            this_ppset = potcars[potcar]
            if args.ppset != this_ppset:
                raise AttributeError( 'Pseudopotential set mismatch: {}'.format( potcars.values() ) )
Пример #13
0
    def __init__(self):
        """
        Initialise a Xdatcar object.

        Args:
            None

        Returns:
            None
        """
        self.poscar = []
        self.poscar.append(Poscar())
Пример #14
0
def main():
    args = parse_command_line_arguments()
    poscar = Poscar()
    poscar.read_from(args.poscar)
    theta = math.pi * args.degrees / 180.0
    poscar.cell.rotate(args.axis, theta)
    poscar.output()
Пример #15
0
def main():
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from(args.poscar)
    poscar.output_as_pimaim()
Пример #16
0
def main():
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    # construct new Poscar instance with sorted atom types
    sorted_poscar = copy.deepcopy( poscar )
    sorted_poscar.atoms = []
    sorted_poscar.atom_numbers = []
    coordinate_list = []
    atoms = poscar.to_configuration().atoms
    for label in args.labels:
        if label in poscar.atoms:
            sorted_poscar.atoms.append( label )
            matched_atoms = [ atom for atom in atoms if atom.label == label ]
            sorted_poscar.atom_numbers.append( len( matched_atoms ) )
            coordinate_list.extend( [ atom.r for atom in matched_atoms ] )
        else:
            raise( ValueError( "'{}' atom label not found in {}".format( label, args.poscar ) ) )
    sorted_poscar.coordinates = np.array( coordinate_list )
    sorted_poscar.output( coordinate_type = poscar.coordinate_type )
Пример #17
0
def main():
    filename = 'testout.rst'
    restart_file = True
    args = parse_command_line_arguments()
    coordinates, velocities, dipoles, full_cell_matrix, cell_lengths = read_pimaim_restart( filename )
    assert( sum( args.atom_numbers ) == len( coordinates ) )
    poscar = Poscar()
    full_cell_matrix = full_cell_matrix.transpose()
    coordinates = get_cart_coords_from_pimaim_restart(coordinates, full_cell_matrix,cell_lengths)
    poscar.cell = Cell( full_cell_matrix)
    poscar.atoms = args.labels
    poscar.atom_numbers = args.atom_numbers
    poscar.coordinate_type = 'Cartesian'
    poscar.coordinates = coordinates
    poscar.output()
Пример #18
0
def main():
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from(args.poscar)
    # construct new Poscar instance with sorted atom types
    sorted_poscar = copy.deepcopy(poscar)
    sorted_poscar.atoms = []
    sorted_poscar.atom_numbers = []
    coordinate_list = []
    atoms = poscar.to_configuration().atoms
    for label in args.labels:
        if label in poscar.atoms:
            sorted_poscar.atoms.append(label)
            matched_atoms = [atom for atom in atoms if atom.label == label]
            sorted_poscar.atom_numbers.append(len(matched_atoms))
            coordinate_list.extend([atom.r for atom in matched_atoms])
        else:
            raise (ValueError("'{}' atom label not found in {}".format(
                label, args.poscar)))
    sorted_poscar.coordinates = np.array(coordinate_list)
    sorted_poscar.output(coordinate_type=poscar.coordinate_type)
Пример #19
0
def main():
    args = parse_command_line_arguments()
    poscar = Poscar.from_file(args.poscar)
    potcars = potcar_spec(args.potcar)
    for i, (species, potcar) in enumerate(zip(poscar.atoms, potcars), 1):
        matching_potcar = potcar.startswith(species)
        if not matching_potcar:
            raise AttributeError(
                'Species {} mismatch:\nPOSCAR contains {}\nPOTCAR contains {}'.
                format(i, species, potcar))
        if args.ppset:
            this_ppset = potcars[potcar]
            if args.ppset != this_ppset:
                raise AttributeError('Pseudopotential set mismatch: {}'.format(
                    potcars.values()))
Пример #20
0
def poscar_from_pimaim_restart(filename, atom_numbers, atom_labels):
    number_of_atoms = sum(atom_numbers)
    coordinates, velocities, dipoles, full_cell_matrix = read_restart_file(
        filename, number_of_atoms)

    poscar = Poscar()
    poscar.cell = Cell(
        full_cell_matrix)  # TODO: possibly this needs transposing
    poscar.atoms = atom_labels
    poscar.atom_numbers = atom_numbers
    poscar.coordinate_type = 'Direct'
    poscar.coordinates = poscar.cell.cartesian_to_fractional_coordinates(
        coordinates)

    return poscar
Пример #21
0
def poscar_from_pimaim_restart(filename, atom_numbers, atom_labels):
    number_of_atoms = sum(atom_numbers)
    coordinates, velocities, dipoles, full_cell_matrix, cell_lengths = read_restart_file(
        filename, number_of_atoms, cell_lengths)

    poscar = Poscar()
    full_cell_matrix = full_cell_matrix.transpose()
    coordinates = get_cart_coords_from_pimaim_restart(coordinates,
                                                      full_cell_matrix,
                                                      cell_lengths)
    poscar.cell = Cell(full_cell_matrix)
    poscar.atoms = atom_labels
    poscar.atom_numbers = atom_numbers
    poscar.coordinate_type = 'Direct'
    poscar.coordinates = poscar.cell.cartesian_to_fractional_coordinates(
        coordinates)

    return poscar
Пример #22
0
#! /usr/bin/env python3

from vasppy.poscar import Poscar
import math
import argparse

def parse_command_line_arguments():
    parser = argparse.ArgumentParser( description='Rotates the cell lattice in VASP POSCAR files' )
    parser.add_argument( 'poscar', help="filename of the VASP POSCAR to be processed" )
    parser.add_argument( '-a', '--axis', nargs=3, type=float, help="vector for rotation axis", required=True )
    parser.add_argument( '-d', '--degrees', type=int, help="rotation angle in degrees", required=True )
    args = parser.parse_args()
    return( args )

if __name__ == "__main__":
    args = parse_command_line_arguments()
    poscar = Poscar()
    poscar.read_from( args.poscar )
    theta = math.pi * args.degrees / 180.0
    poscar.cell.rotate( args.axis, theta )
    poscar.output()

Пример #23
0
    # command line arguments
    parser = argparse.ArgumentParser(
        description='Reorders the atomic species in a VASP POSCAR file')
    parser.add_argument('labels',
                        nargs='+',
                        help="atomic lables in the desired order")
    parser.add_argument('poscar',
                        help="filename of the VASP POSCAR to be processed")
    args = parser.parse_args()
    return (args)


if __name__ == "__main__":
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from(args.poscar)
    # construct new Poscar instance with sorted atom types
    sorted_poscar = copy.deepcopy(poscar)
    sorted_poscar.atoms = []
    sorted_poscar.atom_numbers = []
    coordinate_list = []
    atoms = poscar.to_configuration().atoms
    for label in args.labels:
        if label in poscar.atoms:
            sorted_poscar.atoms.append(label)
            matched_atoms = [atom for atom in atoms if atom.label == label]
            sorted_poscar.atom_numbers.append(len(matched_atoms))
            coordinate_list.extend([atom.r for atom in matched_atoms])
        else:
Пример #24
0
    parser.add_argument( '-g', '--group', help='group atoms within supercell', action='store_true' )
    parser.add_argument( '-s', '--supercell', type=int, nargs=3, metavar=( 'h', 'k', 'l' ), help='construct supercell by replicating (h,k,l) times along [a b c]' )
    parser.add_argument( '-b', '--bohr', action='store_true', help='assumes the input file is in Angstrom, and converts everything to bohr')
    parser.add_argument( '-n', '--number-atoms', action='store_true', help='label coordinates with atom number' )
    args = parser.parse_args()
    return( args )

if __name__ == "__main__":
    args = parse_command_line_arguments()
    coordinate_types = { 'd' : 'Direct',
                         'direct' : 'Direct',
                         'c' : 'Cartesian',
                         'cartesian' : 'Cartesian' }
    coordinate_type = coordinate_types[ args.coordinate_type ]
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    if args.supercell: # generate supercell
        if args.group:
            # check that if grouping is switched on, we are asking for a supercell that allows a "3D-chequerboard" pattern.
            for (i,axis) in zip( args.supercell, range(3) ):
                if i%2 == 1 and i > 1:
                    raise Exception( "odd supercell expansions != 1 are incompatible with automatic grouping" )
        poscar = poscar.replicate( *args.supercell, group=args.group )
    if args.bohr:
        poscar = poscar.in_bohr()
    # output to stdout
    output_opts = { 'label'    : args.label,
                    'numbered' : args.number_atoms,
                    'coordinates_only' : args.coordinates_only }
Пример #25
0
#! /usr/bin/env python3 

from vasppy.poscar import Poscar
import argparse

def parse_command_line_arguments():
    # command line arguments
    parser = argparse.ArgumentParser( description='Converts a VASP POSCAR file to the PIMAIM `restart.dat` format' )
    parser.add_argument( 'poscar', help="filename of the VASP POSCAR to be processed" )
    args = parser.parse_args()
    return( args )

if __name__ == "__main__":
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    poscar.output_as_pimaim()
    
Пример #26
0
    number_of_atomic_data_lines = next( index for index, d in enumerate( data_per_line[4:] ) if d == 1 )
    number_of_atomic_data_types = sum( [ cr_dump_log, vel_dump_log, chg_dump_log ] )
    number_of_atoms = int( number_of_atomic_data_lines / number_of_atomic_data_types )
    # this assumes coordinates, velocities, and dipoles are all present.
    # not sure what happens if atoms have qudrupoles, etc.
    coordinates = lines_to_numpy_array( file_data[ 4 : 4 + number_of_atoms ] ) 
    velocities  = lines_to_numpy_array( file_data[ 4 + number_of_atoms : 4 + number_of_atoms * 2 ] ) 
    dipoles     = lines_to_numpy_array( file_data[ 4 + number_of_atoms * 2 : 4 + number_of_atoms * 3 ] ) 
    cell_matrix = lines_to_numpy_array( file_data[ -6: -3 ] )
    cell_lengths = lines_to_numpy_array( file_data[ -3: ] )
    full_cell_matrix = cell_matrix * cell_lengths
    # TODO! need to check this with a non-orthorhombic cell
    return( coordinates, velocities, dipoles, full_cell_matrix )

if __name__ == '__main__':
    filename = 'testout.rst'
    restart_file = True

    args = parse_command_line_arguments()
    coordinates, velocities, dipoles, full_cell_matrix = read_pimaim_restart( filename )
    assert( sum( args.atom_numbers ) == len( coordinates ) )
    poscar = Poscar()
    poscar.cell = Cell( full_cell_matrix ) # TODO: possibly this needs transposing?
    poscar.atoms = args.labels
    poscar.atom_numbers = args.atom_numbers
    poscar.coordinate_type = 'Cartesian'
    poscar.coordinates = coordinates

    poscar.output()
Пример #27
0
#! /usr/bin/env python3 

from vasppy.poscar import Poscar
import argparse

def parse_command_line_arguments():
    # command line arguments
    parser = argparse.ArgumentParser( description='Converts a VASP POSCAR file to the .xtl file format' )
    parser.add_argument( 'poscar', help="filename of the VASP POSCAR to be processed" )
    args = parser.parse_args()
    return( args )

if __name__ == "__main__":
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    poscar.output_as_xtl()

Пример #28
0
    parser.add_argument( '-s', '--supercell', type=int, nargs=3, metavar=( 'h', 'k', 'l' ), help='construct supercell by replicating (h,k,l) times along [a b c]' )
    parser.add_argument( '-b', '--bohr', action='store_true', help='assumes the input file is in Angstrom, and converts everything to bohr')
    parser.add_argument( '-n', '--number-atoms', action='store_true', help='label coordinates with atom number' )
    parser.add_argument( '--scale', action='store_true', help='scale the lattice parameters by the scaling factor' )
    args = parser.parse_args()
    return( args )

if __name__ == "__main__":
    args = parse_command_line_arguments()
    coordinate_types = { 'd' : 'Direct',
                         'direct' : 'Direct',
                         'c' : 'Cartesian',
                         'cartesian' : 'Cartesian' }
    coordinate_type = coordinate_types[ args.coordinate_type ]
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    if args.scale:
        poscar.cell.matrix *= poscar.scaling
        poscar.scaling = 1.0
    if args.supercell: # generate supercell
        if args.group:
            # check that if grouping is switched on, we are asking for a supercell that allows a "3D-chequerboard" pattern.
            for (i,axis) in zip( args.supercell, range(3) ):
                if i%2 == 1 and i > 1:
                    raise Exception( "odd supercell expansions != 1 are incompatible with automatic grouping" )
        poscar = poscar.replicate( *args.supercell, group=args.group )
    if args.bohr:
        poscar = poscar.in_bohr()
    # output to stdout
Пример #29
0
import argparse


def parse_command_line_arguments():
    parser = argparse.ArgumentParser(
        description='Rotates the cell lattice in VASP POSCAR files')
    parser.add_argument('poscar',
                        help="filename of the VASP POSCAR to be processed")
    parser.add_argument('-a',
                        '--axis',
                        nargs=3,
                        type=float,
                        help="vector for rotation axis",
                        required=True)
    parser.add_argument('-d',
                        '--degrees',
                        type=int,
                        help="rotation angle in degrees",
                        required=True)
    args = parser.parse_args()
    return (args)


if __name__ == "__main__":
    args = parse_command_line_arguments()
    poscar = Poscar()
    poscar.read_from(args.poscar)
    theta = math.pi * args.degrees / 180.0
    poscar.cell.rotate(args.axis, theta)
    poscar.output()
Пример #30
0
import argparse
import copy
import numpy as np

def parse_command_line_arguments():
    # command line arguments
    parser = argparse.ArgumentParser( description='Reorders the atomic species in a VASP POSCAR file' )
    parser.add_argument( 'labels', nargs='+', help="atomic lables in the desired order" )
    parser.add_argument( 'poscar', help="filename of the VASP POSCAR to be processed" )
    args = parser.parse_args()
    return( args )

if __name__ == "__main__":
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from( args.poscar )
    # construct new Poscar instance with sorted atom types
    sorted_poscar = copy.deepcopy( poscar )
    sorted_poscar.atoms = []
    sorted_poscar.atom_numbers = []
    coordinate_list = []
    atoms = poscar.to_configuration().atoms
    for label in args.labels:
        if label in poscar.atoms:
            sorted_poscar.atoms.append( label )
            matched_atoms = [ atom for atom in atoms if atom.label == label ]
            sorted_poscar.atom_numbers.append( len( matched_atoms ) )
            coordinate_list.extend( [ atom.r for atom in matched_atoms ] )
        else:
Пример #31
0
 def test_stoichiometry( self ):
     poscar = Poscar()
     poscar.atoms = [ 'A', 'B', 'C' ]
     poscar.atom_numbers = [ 1, 2, 3 ]
     self.assertEqual( poscar.stoichiometry, Counter( { 'A': 1, 'B': 2, 'C': 3 } ) )
Пример #32
0
#! /usr/bin/env python3

from vasppy.poscar import Poscar
import argparse


def parse_command_line_arguments():
    # command line arguments
    parser = argparse.ArgumentParser(
        description='Converts a VASP POSCAR file to the .xtl file format')
    parser.add_argument('poscar',
                        help="filename of the VASP POSCAR to be processed")
    parser.add_argument(
        '-s',
        '--symprec',
        type=float,
        help="Symmetry precision for a symmetrised .cif output")
    args = parser.parse_args()
    return (args)


if __name__ == "__main__":
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from(args.poscar)
    poscar.output_as_cif(args.symprec)