Example #1
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()
Example #2
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 )
Example #3
0
def main():
    args = parse_command_line_arguments()
    # initialise
    poscar = Poscar()
    # read POSCAR file
    poscar.read_from(args.poscar)
    poscar.output_as_pimaim()
Example #4
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 )
Example #5
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()
Example #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)
Example #7
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() )
Example #8
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() )
Example #9
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 )
Example #10
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)
Example #11
0
    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 }
    poscar.output( coordinate_type = coordinate_type, opts = output_opts )
Example #12
0
    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
    output_opts = { 'label'    : args.label,
                    'numbered' : args.number_atoms,