![]() |
ESPResSo 3.2.0-64-g5125f6e-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 angle_tcl.c 00022 * 00023 * Implementation of \ref angle_tcl.h 00024 */ 00025 #include "angle_tcl.h" 00026 00027 #ifdef BOND_ANGLE_OLD 00028 #include "angle.h" 00029 #include "communication.h" 00030 00031 /// parse parameters for the angle potential 00032 int tclcommand_inter_parse_angle(Tcl_Interp *interp, int bond_type, int argc, char **argv) 00033 { 00034 double bend, phi0; 00035 00036 /* the optional parameter phi0 is due to backwards compatibility and is set to PI if not given */ 00037 if (argc != 2 && argc != 3) { 00038 Tcl_AppendResult(interp, "angle needs 1 or 2 parameters: " 00039 "<bend> [<phi0>]", (char *) NULL); 00040 return (TCL_ERROR); 00041 } 00042 00043 if (! ARG_IS_D(1, bend)) { 00044 Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: " 00045 "<bend> ", (char *) NULL); 00046 return TCL_ERROR; 00047 } 00048 00049 /* special treatment of the optional parameter phi0 */ 00050 if (argc == 3) { 00051 if (! ARG_IS_D(2, phi0)) { 00052 Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: " 00053 "<phi0> ", (char *) NULL); 00054 return TCL_ERROR; 00055 } 00056 } else { 00057 phi0 = PI; 00058 } 00059 CHECK_VALUE(angle_set_params(bond_type, bend, phi0), "bond type must be nonnegative"); 00060 } 00061 00062 int tclprint_to_result_angleIA(Tcl_Interp *interp, Bonded_ia_parameters *params) 00063 { 00064 char buffer[TCL_DOUBLE_SPACE]; 00065 Tcl_PrintDouble(interp, params->p.angle.bend, buffer); 00066 Tcl_AppendResult(interp, "angle ", buffer," ", (char *) NULL); 00067 Tcl_PrintDouble(interp, params->p.angle.phi0, buffer); 00068 Tcl_AppendResult(interp, buffer, (char *) NULL); 00069 return TCL_OK; 00070 } 00071 00072 #endif 00073
1.7.5.1