# Path: vasppy/configuration.py
# class Configuration:
#     def __init__( self, cell, atoms ):
#     def dr( self, atom1, atom2 ):
#     def minimum_image_dr( self, atom1, atom2, cutoff=None ):
#     def interatomic_distances( self, minimum_image_convention = True ):
#     def interatomic_distances_for_atom( self, atom1, minimum_image_convention = True ):
#     def atoms_with_label( self, label ):
#     def partial_rdf( self, spec_i, spec_j, max_r, number_of_bins ):
#     def per_atom_rdf( self, spec_i, spec_j, max_r, number_of_bins ):
# 
# Path: vasppy/atom.py
# class Atom:
#     def __init__( self, label, r ): # currently assume fractional coordinates
# 
# Path: vasppy/cell.py
# def angle( x, y ):
# def rotation_matrix(axis, theta):
#     def __init__( self, matrix ):
#     def dr( self, r1, r2, cutoff=None ):
#     def nearest_image( self, origin, point ):
#     def minimum_image( self, r1, r2 ):
#     def minimum_image_dr( self, r1, r2, cutoff=None ):
#     def lengths( self ):
#     def angles( self ):
#     def cartesian_to_fractional_coordinates( self, coordinates ):
#     def fractional_to_cartesian_coordinates( self, coordinates ):
#     def inside_cell( self, r ):
#     def volume( self ):
#     def unit_vectors( self ):
#     def rotate( self, axis, theta ):
# class Cell:
# 
# Path: vasppy/units.py



import numpy as np  # type: ignore
import sys
import re
import copy
from vasppy import configuration, atom, cell
from vasppy.units import angstrom_to_bohr
from pymatgen import Lattice as pmg_Lattice  # type: ignore
from pymatgen import Structure as pmg_Structure  # type: ignore
from pymatgen.io.cif import CifWriter  # type: ignore
from collections import Counter
from signal import signal, SIGPIPE, SIG_DFL

# Ignore SIG_PIPE and don't throw exceptions on it... 
# http://newbebweb.blogspot.co.uk/2012/02/python-head-ioerror-errno-32-broken.html
signal( SIGPIPE, SIG_DFL ) 

def parity( list ):
    return( sum( list )%2 )

def swap_axes( matrix, axes ):
    axes_index = { 'x': 0, 'y': 1, 'z': 2 }
    matrix[:, [ axes_index[ axes[ 0 ] ], axes_index[ axes[ 1 ] ] ] ] = matrix[:, [ axes_index[ axes[ 1 ] ], axes_index[ axes[ 0 ] ] ] ]
    return matrix

class Poscar:

    lines_offset = 9

    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


# Path: vasppy/configuration.py
# class Configuration:
#     def __init__( self, cell, atoms ):
#     def dr( self, atom1, atom2 ):
#     def minimum_image_dr( self, atom1, atom2, cutoff=None ):
#     def interatomic_distances( self, minimum_image_convention = True ):
#     def interatomic_distances_for_atom( self, atom1, minimum_image_convention = True ):
#     def atoms_with_label( self, label ):
#     def partial_rdf( self, spec_i, spec_j, max_r, number_of_bins ):
#     def per_atom_rdf( self, spec_i, spec_j, max_r, number_of_bins ):
# 
# Path: vasppy/atom.py
# class Atom:
#     def __init__( self, label, r ): # currently assume fractional coordinates
# 
# Path: vasppy/cell.py
# def angle( x, y ):
# def rotation_matrix(axis, theta):
#     def __init__( self, matrix ):
#     def dr( self, r1, r2, cutoff=None ):
#     def nearest_image( self, origin, point ):
#     def minimum_image( self, r1, r2 ):
#     def minimum_image_dr( self, r1, r2, cutoff=None ):
#     def lengths( self ):
#     def angles( self ):
#     def cartesian_to_fractional_coordinates( self, coordinates ):
#     def fractional_to_cartesian_coordinates( self, coordinates ):
#     def inside_cell( self, r ):
#     def volume( self ):
#     def unit_vectors( self ):
#     def rotate( self, axis, theta ):
# class Cell:
# 
# Path: vasppy/units.py



# Path: vasppy/poscar.py
import numpy as np  # type: ignore
import sys
import re
import copy
from vasppy import configuration, atom, cell
from vasppy.units import angstrom_to_bohr
from pymatgen import Lattice as pmg_Lattice  # type: ignore
from pymatgen import Structure as pmg_Structure  # type: ignore
from pymatgen.io.cif import CifWriter  # type: ignore
from collections import Counter
from signal import signal, SIGPIPE, SIG_DFL


# Ignore SIG_PIPE and don't throw exceptions on it... 
# http://newbebweb.blogspot.co.uk/2012/02/python-head-ioerror-errno-32-broken.html
signal( SIGPIPE, SIG_DFL ) 

def parity( list ):
    return( sum( list )%2 )

def swap_axes( matrix, axes ):
    axes_index = { 'x': 0, 'y': 1, 'z': 2 }
    matrix[:, [ axes_index[ axes[ 0 ] ], axes_index[ axes[ 1 ] ] ] ] = matrix[:, [ axes_index[ axes[ 1 ] ], axes_index[ axes[ 0 ] ] ] ]
    return matrix

class Poscar:

    lines_offset = 9

    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


    def coordinates_by_species( self, species ):