GLYLIB  0.3.0b
add_coord.c
Go to the documentation of this file.
00001 // Function written by B. Lachele Foley, 2007
00002 #include <mylib.h>
00003 //#include "../inc/mylib.h"
00004 #include <molecules.h>
00005 //#include "../inc/molecules.h"
00006 /* this adds one coordinate to another */
00007 coord_3D add_coord(coord_3D ca,coord_3D cb){
00008 coord_3D nc;
00009 
00010 nc.i=ca.i+cb.i;
00011 nc.j=ca.j+cb.j;
00012 nc.k=ca.k+cb.k;
00013 
00014 return nc;
00015 }
00016 
00017 /* this subtracts vector vb from vector va (and sets d, too) */
00018 coord_3D subtract_coord(coord_3D ca,coord_3D cb){
00019 coord_3D nc;
00020 
00021 nc.i=ca.i-cb.i;
00022 nc.j=ca.j-cb.j;
00023 nc.k=ca.k-cb.k;
00024 
00025 return nc;
00026 }
00027 
00028 /* this one multiplies a coordinate by a scalar */
00029 coord_3D scalarmult_coord(coord_3D ca,double cb){
00030 coord_3D nc;
00031 
00032 nc.i=ca.i*cb;
00033 nc.j=ca.j*cb;
00034 nc.k=ca.k*cb;
00035 
00036 return nc;
00037 }
 All Classes Files Functions Variables Typedefs Defines