# 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
        
    def output_as_xtl( self ):
        print( self.title )
        print( "CELL" )
        cell_lengths = self.cell_lengths()
        cell_angles  = self.cell_angles()
        cell_data = cell_lengths + cell_angles
        print( ''.join( ['   {: .8f}'.format( element ) for element in cell_data ] ) )
        print( " Symmetry label P1\n\nATOMS\nNAME      X       Y     Z" )
        output_opts = { 'label' : True }
        self.output_coordinates_only( coordinate_type='Direct', opts = output_opts )

    def output_as_cif( self, symprec = None ):
        print( CifWriter( self.to_pymatgen_structure(), symprec ) )

    def output_as_pimaim( self, to_bohr = True ):
        if to_bohr is True:
            unit_scaling = angstrom_to_bohr
        else:
            unit_scaling = 1.0
        cell_lengths = self.cell.lengths() * self.scaling / unit_scaling
        print( "T\nF\nF\nF" )
        for row in self.cell_coordinates():
            print( ' '.join( [ str( x / unit_scaling ) for x in row ] ) )
        for row in self.cell.unit_vectors().transpose():
            print( ' '.join( [ str( x ) for x in row ] ) )
        for length in cell_lengths:
            print( length )

    def cell_coordinates( self ):

# 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

        
    def output_as_xtl( self ):
        print( self.title )
        print( "CELL" )
        cell_lengths = self.cell_lengths()
        cell_angles  = self.cell_angles()
        cell_data = cell_lengths + cell_angles
        print( ''.join( ['   {: .8f}'.format( element ) for element in cell_data ] ) )
        print( " Symmetry label P1\n\nATOMS\nNAME      X       Y     Z" )
        output_opts = { 'label' : True }
        self.output_coordinates_only( coordinate_type='Direct', opts = output_opts )

    def output_as_cif( self, symprec = None ):
        print( CifWriter( self.to_pymatgen_structure(), symprec ) )

    def output_as_pimaim( self, to_bohr = True ):
        if to_bohr is True:
            unit_scaling = angstrom_to_bohr
        else:
            unit_scaling = 1.0
        cell_lengths = self.cell.lengths() * self.scaling / unit_scaling
        print( "T\nF\nF\nF" )
        for row in self.cell_coordinates():
            print( ' '.join( [ str( x / unit_scaling ) for x in row ] ) )
        for row in self.cell.unit_vectors().transpose():
            print( ' '.join( [ str( x ) for x in row ] ) )
        for length in cell_lengths:
            print( length )

    def cell_coordinates( self ):

        return( self.coordinates * self.cell.lengths() * self.scaling )