ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
angledist_tcl.c
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2010,2011,2012,2013 The ESPResSo project
00003   Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 
00004     Max-Planck-Institute for Polymer Research, Theory Group
00005   
00006   This file is part of ESPResSo.
00007   
00008   ESPResSo is free software: you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation, either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   ESPResSo is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with this program.  If not, see <http://www.gnu.org/licenses/>. 
00020 */
00021 /** \file angledist_tcl.c
00022  *
00023  *  Implementation of \ref angledist_tcl.h
00024  */
00025 #include "angledist_tcl.h"
00026 
00027 #ifdef BOND_ANGLEDIST
00028 #include "angledist.h"
00029 
00030 int tclcommand_inter_parse_angledist(Tcl_Interp *interp, int bond_type, int argc, char **argv)
00031 {
00032   double bend, phimin, distmin, phimax, distmax;
00033 
00034   if (argc != 6) {
00035     Tcl_AppendResult(interp, "angledist needs 5 parameters: "
00036                      "<bend> <phimin> <distmin> <phimax> <distmax>", (char *) NULL);
00037     printf ("argc=%d\n",argc);
00038     return (TCL_ERROR);
00039   }
00040 
00041   if (! ARG_IS_D(1, bend)) {
00042     Tcl_AppendResult(interp, "angledist needs a DOUBLE parameter: "
00043                      "<bend> ", (char *) NULL);
00044     return TCL_ERROR;
00045   }
00046 
00047   if (! ARG_IS_D(2, phimin)) {
00048     Tcl_AppendResult(interp, "angledist needs a DOUBLE parameter: "
00049                      "<phimin> ", (char *) NULL);
00050     return TCL_ERROR;
00051   }
00052 
00053   if (! ARG_IS_D(3, distmin)) {
00054     Tcl_AppendResult(interp, "angledist needs a DOUBLE parameter: "
00055                      "<distmin> ", (char *) NULL);
00056     return TCL_ERROR;
00057   }
00058 
00059   if (! ARG_IS_D(4, phimax)) {
00060     Tcl_AppendResult(interp, "angledist needs a DOUBLE parameter: "
00061                      "<phimax> ", (char *) NULL);
00062     return TCL_ERROR;
00063   }
00064 
00065   if (! ARG_IS_D(5, distmax)) {
00066     Tcl_AppendResult(interp, "angledist needs a DOUBLE parameter: "
00067                      "<distmax> ", (char *) NULL);
00068     return TCL_ERROR;
00069   }
00070 
00071 
00072   CHECK_VALUE(angledist_set_params(bond_type, bend, phimin, distmin, phimax, distmax), "bond type must be nonnegative");
00073 }
00074 
00075 int tclprint_to_result_angledistIA(Tcl_Interp *interp,
00076                                    Bonded_ia_parameters *params)
00077 {
00078   char buffer[TCL_DOUBLE_SPACE];
00079 
00080   Tcl_PrintDouble(interp, params->p.angledist.bend, buffer);
00081   Tcl_AppendResult(interp, "angledist ", buffer," ", (char *) NULL);
00082   Tcl_PrintDouble(interp, params->p.angledist.phimin, buffer);
00083   Tcl_AppendResult(interp, buffer, " ", (char *) NULL);
00084   Tcl_PrintDouble(interp, params->p.angledist.distmin, buffer);
00085   Tcl_AppendResult(interp, buffer, " ", (char *) NULL);
00086   Tcl_PrintDouble(interp, params->p.angledist.phimax, buffer);
00087   Tcl_AppendResult(interp, buffer, " ", (char *) NULL);
00088   Tcl_PrintDouble(interp, params->p.angledist.distmax, buffer);
00089   Tcl_AppendResult(interp, buffer, (char *) NULL);
00090   return TCL_OK;
00091 }
00092 
00093 #endif