![]() |
ESPResSo 3.2.0-167-g2c9ead1-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 00022 #include "utils.h" 00023 00024 #ifdef LJCOS 00025 #include "ljcos.h" 00026 #include "ljcos_tcl.h" 00027 #include "parser.h" 00028 #include "communication.h" 00029 00030 int tclprint_to_result_ljcosIA(Tcl_Interp *interp, int i, int j) 00031 { 00032 char buffer[TCL_DOUBLE_SPACE]; 00033 IA_parameters *data = get_ia_param(i, j); 00034 00035 Tcl_PrintDouble(interp, data->LJCOS_eps, buffer); 00036 Tcl_AppendResult(interp, "lj-cos ", buffer, " ", (char *) NULL); 00037 Tcl_PrintDouble(interp, data->LJCOS_sig, buffer); 00038 Tcl_AppendResult(interp, buffer, " ", (char *) NULL); 00039 Tcl_PrintDouble(interp, data->LJCOS_cut, buffer); 00040 Tcl_AppendResult(interp, buffer, " ", (char *) NULL); 00041 Tcl_PrintDouble(interp, data->LJCOS_offset, buffer); 00042 Tcl_AppendResult(interp, buffer, " ", (char *) NULL); 00043 Tcl_PrintDouble(interp, data->LJCOS_alfa, buffer); 00044 Tcl_AppendResult(interp, buffer, " ", (char *) NULL); 00045 Tcl_PrintDouble(interp, data->LJCOS_beta, buffer); 00046 Tcl_AppendResult(interp, buffer, " ", (char *) NULL); 00047 Tcl_PrintDouble(interp, data->LJCOS_rmin, buffer); 00048 Tcl_AppendResult(interp, buffer, " ", (char *) NULL); 00049 00050 return TCL_OK; 00051 } 00052 00053 int tclcommand_inter_parse_ljcos(Tcl_Interp * interp, 00054 int part_type_a, int part_type_b, 00055 int argc, char ** argv) 00056 { 00057 double tmp; 00058 double eps, sig, cut, offset; 00059 int change; 00060 00061 if (argc < 5) { 00062 Tcl_AppendResult(interp, "lj-cos needs 4 parameters: " 00063 "<ljcos_eps> <ljcos_sig> <ljcos_cut> <ljcos_offset>", 00064 (char *) NULL); 00065 return 0; 00066 } 00067 00068 /* copy lj-cos parameters */ 00069 if ((! ARG_IS_D(1, eps)) || 00070 (! ARG_IS_D(2, sig)) || 00071 (! ARG_IS_D(3, cut)) || 00072 (! ARG_IS_D(4, offset) )) { 00073 Tcl_AppendResult(interp, "lj-cos needs 4 DOUBLE parameters: " 00074 "<ljcos_eps> <ljcos_sig> <ljcos_cut> <ljcos_offset>", 00075 (char *) NULL); 00076 return 0; 00077 } 00078 change = 5; 00079 00080 /* fix for the inconsistency in the ljcos parameters. 00081 There are 7 parameters for ljcos, but you read in only four of them. 00082 The rest is calculated in lj_cos_set_params. 00083 This is a problem with the blockfile format (Mehmet) 00084 */ 00085 if (argc >= 8 && ARG_IS_D(5, tmp) && ARG_IS_D(6, tmp) && ARG_IS_D(7, tmp)) 00086 change += 3; 00087 else 00088 Tcl_ResetResult(interp); 00089 00090 if (lj_cos_set_params(part_type_a, part_type_b, eps, sig, cut, offset) == ES_ERROR) { 00091 Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL); 00092 return 0; 00093 } 00094 00095 return change; 00096 } 00097 00098 #endif
1.7.5.1