package Atom;

@ISA=qw(chemistry);
use Chemistry::ForceField;
use Chemistry::AtomType;

sub new {
	my $class=shift;
	$self = {
		id => "",
		charge => 0.0,
		type => 0,
		xyz => 0,
		};
	bless $self;
}

sub clone {
	my $self=shift;
	my $clone = Atom->new;
	($clone->{id},$clone->{charge},$clone->{type}) = ($self->{id},$self->{charge},$self->{type});
	$clone->{xyz} = $self->{xyz}->clone if ($self->{xyz});
	return $clone
}
	
sub id {
	my ($self, $id) = @_;
	$self->{id} = $id if defined $id;
	return $self->{id};
}

sub charge {
	my ($self, $charge) = @_;
	$self->{charge} = $charge if defined $charge;
	return $self->{charge};
}
sub mw {
	my $self = shift;
	my $type = $self->type;
	return $type->mw;
}

sub type {
	my ($self, $type) = @_;
	$self->{type} = $type if defined $type;
	return $self->{type};
}

sub xyz {
	my ($self, $xyz) = @_;
	$self->{xyz} = $xyz if defined $xyz;
	return $self->{xyz};
}

sub res {
	my ($self, $res) = @_;
	$self->{res} = $res if defined $res;
	return $self->{res};
}

sub loadAtomPDB {
	my ($self, $lin, $ff) = @_;
	my ($lab,$numAt, $id, $res, $nres, $x, $y, $z, $ch, $tipAt) = split " ", $lin;
	$self = Atom->new;
	$self->id($id);
	$self->xyz(Point->new ($x, $y, $z));
	$self->charge($ch);
	$self->type($ff->atType($tipAt));
	return $self;
}


"1";



	
