#!/usr/bin/perl

#------------------------------------------------------------------------------
#$Author: antanas $
#$Date: 2014-10-16 16:11:20 +0300 (Thu, 16 Oct 2014) $ 
#$Rev: 2903 $
#$URL: svn://www.crystallography.net/cod-tools/tags/v2.1/data/AtomProperties/parts/core/BlueObelisk/core $
#------------------------------------------------------------------------------
#*
# Filters core atom information (atomic number, mass, ect.) from a yaml file. 
# Outputs filtered data in yaml file with metadata attached in comments.
#*
#* Usage:
#*     $0 input.yaml
#**

use strict;
use warnings;

use YAML qw(Dump Bless Load LoadFile);

@ARGV = ( "-" ) unless @ARGV;

my $atoms;

my $filename = $ARGV[0];

if ( $filename eq "-" ) {
    my $text = do { local $/; <STDIN> };
    $atoms = Load($text);
} else {
    $atoms = LoadFile($filename)
}

foreach ( keys %{$atoms} ) {
    delete $atoms->{$_}{covalent_radius};
    delete $atoms->{$_}{vdw_radius};
}

print '#$Date: 2014-10-16 16:11:20 +0300 (Thu, 16 Oct 2014) $' . "\n";
print "#Original file: $ARGV[0]\n";
print "#Descrp: Primary source of core atom information.\n";
print "#Source: elements.xml file from BlueObelisk 'bodr' git repository.\n";

print Dump $atoms;
