![]() |
ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
|
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 fene_tcl.c 00022 * 00023 * Implementation of \ref fene_tcl.h 00024 */ 00025 #include "utils.h" 00026 #include "parser.h" 00027 #include "fene_tcl.h" 00028 #include "fene.h" 00029 00030 int tclprint_to_result_feneIA(Tcl_Interp *interp, Bonded_ia_parameters *params) 00031 { 00032 char buffer[TCL_DOUBLE_SPACE]; 00033 Tcl_PrintDouble(interp, params->p.fene.k, buffer); 00034 Tcl_AppendResult(interp, "FENE ", buffer, " ", (char *) NULL); 00035 Tcl_PrintDouble(interp, params->p.fene.drmax, buffer); 00036 Tcl_AppendResult(interp, buffer, (char *) NULL); 00037 Tcl_PrintDouble(interp, params->p.fene.r0, buffer); 00038 Tcl_AppendResult(interp, " ", buffer, (char *) NULL); 00039 return (TCL_OK); 00040 } 00041 00042 int tclcommand_inter_parse_fene(Tcl_Interp *interp, int bond_type, int argc, char **argv) 00043 { 00044 double k, drmax, r0; 00045 00046 if (argc != 3 && argc != 4) { 00047 Tcl_AppendResult(interp, "fene needs 2 or 3 parameters: " 00048 "<k> <drmax> [<r0>]", (char *) NULL); 00049 return TCL_ERROR; 00050 } 00051 00052 if ((! ARG_IS_D(1, k)) || (! ARG_IS_D(2, drmax))) 00053 { 00054 Tcl_AppendResult(interp, "fene needs 2 or 3 DOUBLE parameters: " 00055 "<k> <drmax> [<r0>]", (char *) NULL); 00056 return TCL_ERROR; 00057 } 00058 00059 if (argc == 4) { 00060 if (! ARG_IS_D(3, r0)) 00061 { 00062 Tcl_AppendResult(interp, "fene needs 2 or 3 DOUBLE parameters: " 00063 "<k> <drmax> [<r0>]", (char *) NULL); 00064 return TCL_ERROR; 00065 } 00066 } else { 00067 /* default value for r0 is 0.0. */ 00068 r0 = 0.0; 00069 } 00070 00071 CHECK_VALUE(fene_set_params(bond_type, k, drmax, r0), "bond type must be nonnegative"); 00072 } 00073
1.7.5.1