本文整理汇总了C++中ARG_IS_D函数的典型用法代码示例。如果您正苦于以下问题:C++ ARG_IS_D函数的具体用法?C++ ARG_IS_D怎么用?C++ ARG_IS_D使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ARG_IS_D函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: tclcommand_inter_parse_harmonic_dumbbell
int tclcommand_inter_parse_harmonic_dumbbell(Tcl_Interp *interp, int bond_type, int argc, char **argv)
{
double k1, k2, r, r_cut;
if (argc < 4) {
Tcl_AppendResult(interp, "harmonic dumbbell needs at least 3 parameters: "
"<k1> <k2> <r> [<r_cut>]", (char *) NULL);
return TCL_ERROR;
}
if ((! ARG_IS_D(1, k1)) || (! ARG_IS_D(2, k2)) || (! ARG_IS_D(3, r))) {
Tcl_AppendResult(interp, "harmonic dumbbell needs at least 3 DOUBLE parameters: "
"<k1> <k2> <r> [<r_cut>]", (char *) NULL);
return TCL_ERROR;
}
if (argc < 5) {
r_cut = -1.0;
} else if (! ARG_IS_D(4, r_cut)) {
Tcl_AppendResult(interp, "<r_cut> should be DOUBLE", (char *) NULL);
return TCL_ERROR;
}
CHECK_VALUE(harmonic_dumbbell_set_params(bond_type, k1, k2, r, r_cut), "bond type must be nonnegative");
}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:25,代码来源:harmonic_dumbbell_tcl.cpp
示例2: tclcommand_inter_parse_cos2
int tclcommand_inter_parse_cos2(Tcl_Interp * interp,
int part_type_a, int part_type_b,
int argc, char ** argv)
{
/* parameters needed for cos2 */
double eps, offset, w;
int change;
/* get cos2 interaction type */
if (argc < 4) {
Tcl_AppendResult(interp, "cos2 needs 3 parameters: "
"<cos2_eps> <cos2_offset> <cos2_w>",
(char *) NULL);
return 0;
}
/* copy cos2 parameters */
if ((! ARG_IS_D(1, eps)) ||
(! ARG_IS_D(2, offset)) ||
(! ARG_IS_D(3, w))) {
Tcl_AppendResult(interp, "cos2 needs 3 DOUBLE parameters: "
"<cos2_eps> <cos2_offset> <cos2_w>",
(char *) NULL);
return 0;
}
change = 4;
if (cos2_set_params(part_type_a, part_type_b,
eps, offset, w
) == ES_ERROR) {
Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL);
return 0;
}
return change;
}
开发者ID:Haider-BA,项目名称:espresso,代码行数:35,代码来源:cos2_tcl.cpp
示例3: tclcommand_inter_parse_hat
int tclcommand_inter_parse_hat(Tcl_Interp * interp,
int part_type_a, int part_type_b,
int argc, char ** argv)
{
/* parameters needed for hat */
double Fmax, r;
int change;
/* get hat interaction type */
if (argc < 3) {
Tcl_AppendResult(interp, "hat potential needs 2 parameters: "
"<hat_Fmax> <hat_r>",
(char *) NULL);
return 0;
}
/* copy soft-sphere parameters */
if ((! ARG_IS_D(1, Fmax)) ||
(! ARG_IS_D(2, r)) ) {
Tcl_AppendResult(interp, "hat potential needs 2 parameters: "
"<hat_Fmax> <hat_r>",
(char *) NULL);
return 0;
}
change = 3;
Tcl_ResetResult(interp);
if (hat_set_params(part_type_a, part_type_b, Fmax, r) == ES_ERROR) {
Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL);
return 0;
}
return change;
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:34,代码来源:hat_tcl.cpp
示例4: tclcommand_inter_parse_gaussian
int tclcommand_inter_parse_gaussian(Tcl_Interp * interp,
int part_type_a, int part_type_b,
int argc, char ** argv)
{
/* parameters needed for Gaussian */
double eps, sig, cut;
/* copy parameters */
if ((argc < 4) ||
(! ARG_IS_D(1, eps)) ||
(! ARG_IS_D(2, sig)) ||
(! ARG_IS_D(3, cut))) {
Tcl_AppendResult(interp, "Gaussian potential needs 3 parameters: "
"<epsilon> <sigma> <cut>", (char *) NULL);
return 0;
}
Tcl_ResetResult(interp);
if (gaussian_set_params(part_type_a, part_type_b,
eps, sig, cut) == ES_ERROR) {
Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL);
return 0;
}
/* return number of used parameters */
return 4;
}
开发者ID:kessel,项目名称:espresso,代码行数:26,代码来源:gaussian_tcl.cpp
示例5: tclcommand_thermostat_parse_npt_isotropic
int tclcommand_thermostat_parse_npt_isotropic(Tcl_Interp *interp, int argc, char **argv)
{
double temp, gamma0, gammav;
/* check number of arguments */
if (argc < 5) {
Tcl_AppendResult(interp, "wrong # args: should be \n\"",
argv[0]," set ",argv[1]," <temp> <gamma0> <gammav>\"", (char *)NULL);
return (TCL_ERROR);
}
/* check argument types */
if ( !ARG_IS_D(2, temp) || !ARG_IS_D(3, gamma0) || !ARG_IS_D(4, gammav) ) {
Tcl_AppendResult(interp, argv[0]," ",argv[1]," needs four DOUBLES", (char *)NULL);
return (TCL_ERROR);
}
/* broadcast parameters */
temperature = temp;
nptiso_gamma0 = gamma0;
nptiso_gammav = gammav;
thermo_switch = ( thermo_switch | THERMO_NPT_ISO );
mpi_bcast_parameter(FIELD_THERMO_SWITCH);
mpi_bcast_parameter(FIELD_TEMPERATURE);
mpi_bcast_parameter(FIELD_NPTISO_G0);
mpi_bcast_parameter(FIELD_NPTISO_GV);
return (TCL_OK);
}
开发者ID:gitter-badger,项目名称:espresso,代码行数:26,代码来源:thermostat_tcl.cpp
示例6: tclcommand_inter_parse_angle
/// parse parameters for the angle potential
int tclcommand_inter_parse_angle(Tcl_Interp *interp, int bond_type, int argc, char **argv)
{
double bend, phi0;
/* the optional parameter phi0 is due to backwards compatibility and is set to PI if not given */
if (argc != 2 && argc != 3) {
Tcl_AppendResult(interp, "angle needs 1 or 2 parameters: "
"<bend> [<phi0>]", (char *) NULL);
return (TCL_ERROR);
}
if (! ARG_IS_D(1, bend)) {
Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: "
"<bend> ", (char *) NULL);
return TCL_ERROR;
}
/* special treatment of the optional parameter phi0 */
if (argc == 3) {
if (! ARG_IS_D(2, phi0)) {
Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: "
"<phi0> ", (char *) NULL);
return TCL_ERROR;
}
} else {
phi0 = PI;
}
CHECK_VALUE(angle_set_params(bond_type, bend, phi0), "bond type must be nonnegative");
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:30,代码来源:angle_tcl.cpp
示例7: lbnode_parse_set
static int lbnode_parse_set(Tcl_Interp *interp, int argc, char **argv, int *ind) {
double f[3];
while (argc > 0) {
if(ARG0_IS_S("force")){
if (argc < 4 ||
!ARG_IS_D(1, f[0]) ||
!ARG_IS_D(2, f[1]) ||
!ARG_IS_D(3, f[2])
) {
Tcl_AppendResult(interp, "force expects three doubles as argument", (char *)NULL);
return TCL_ERROR;
}
argc -= 4;
argv += 4;
if (argc > 0) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "Error in lbnode_extforce force. You can only change one field at the same time.", (char *)NULL);
return ES_ERROR;
}
}
else {
Tcl_AppendResult(interp, "unknown parameter \"", argv[0], "\" to set", (char *)NULL);
return TCL_ERROR;
}
}
if (lb_lbnode_set_extforce_GPU(ind, f) == ES_ERROR) {
Tcl_AppendResult(interp, "position is not in the LB lattice", (char *)NULL);
return TCL_ERROR;
}
return ES_OK;
}
开发者ID:andmi,项目名称:espresso,代码行数:34,代码来源:lb_tcl.c
示例8: tclcommand_rotate_system
/* ############### */
int tclcommand_rotate_system(ClientData data, Tcl_Interp * interp, int argc, char ** argv) {
double alpha,theta,phi;
if (argc != 4) {
fprintf(stderr,"needs 3 angles\n");
return ES_ERROR;
}
if (! (ARG_IS_D(1,phi)))
{
fprintf(stderr,"Expects 3 floats\n");
return ES_ERROR;
}
if (!(ARG_IS_D(2,theta)))
{
fprintf(stderr,"Expects 3 floats\n");
return ES_ERROR;
}
if (! (ARG_IS_D(3,alpha)))
{
fprintf(stderr,"Expects 3 floats\n");
return ES_ERROR;
}
rotate_system(phi,theta,alpha);
return ES_OK;
}
开发者ID:hirschsn,项目名称:espresso,代码行数:29,代码来源:rotate_system_tcl.cpp
示例9: tclcommand_minimize_energy
int tclcommand_minimize_energy(ClientData data, Tcl_Interp *interp, int argc, char **argv)
{
int max_steps;
double f_max, gamma, max_displacement;
if (argc != 5) {
Tcl_AppendResult(interp, "wrong # args: \n\"", (char *) NULL);
return usage(interp);
}
else {
if(!ARG_IS_D(1,f_max)) {
return usage(interp);
}
if(!ARG_IS_I(2,max_steps)) {
return usage(interp);
}
if(!ARG_IS_D(3,gamma)) {
return usage(interp);
}
if(!ARG_IS_D(4,max_displacement)) {
return usage(interp);
}
}
minimize_energy_init(f_max, gamma, max_steps, max_displacement);
mpi_minimize_energy();
return TCL_OK;
}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:29,代码来源:minimize_energy_tcl.cpp
示例10: tclcommand_inter_coulomb_parse_maggs
/** parse TCL command.
number of parameters is checked and maggs_set_parameters function is called.
@return zero if successful
@param interp TCL interpreter handle
@param argc number of arguments given
@param argv array of arguments given
*/
int tclcommand_inter_coulomb_parse_maggs(Tcl_Interp * interp, int argc, char ** argv)
{
int mesh;
double f_mass;
double epsilon = 1.0;
int finite_epsilon_flag = 1;
/* if the command is localeps, call function */
if ( (argc > 0) && (ARG_IS_S(0, "localeps")) )
return tclcommand_localeps(interp, argc, argv);
if(argc < 2) {
Tcl_AppendResult(interp, "Not enough parameters: inter coulomb <bjerrum> memd <f_mass> <mesh>", (char *) NULL);
return TCL_ERROR;
}
if(! ARG_IS_D(0, f_mass))
return TCL_ERROR;
if(! ARG_IS_I(1, mesh)) {
Tcl_AppendResult(interp, "integer expected", (char *) NULL);
return TCL_ERROR;
}
if(argc > 4) {
Tcl_AppendResult(interp, "Too many parameters: inter coulomb memd <f_mass> <mesh> [epsilon <eps>]", (char *) NULL);
return TCL_ERROR;
}
if(argc == 3) {
Tcl_AppendResult(interp, "Usage: inter coulomb memd <f_mass> <mesh> [epsilon <eps>]", (char *) NULL);
return TCL_ERROR;
}
if(argc == 4) {
if (ARG_IS_S(2, "epsilon")) {
if(! (ARG_IS_D(3, epsilon) && epsilon > 0.0)) {
Tcl_AppendResult(interp, "epsilon expects a positive double",
(char *) NULL);
return TCL_ERROR;
}
}
} else finite_epsilon_flag=1;
coulomb.method = COULOMB_MAGGS;
int res = maggs_set_parameters(coulomb.bjerrum, f_mass, mesh,
finite_epsilon_flag, epsilon);
switch (res) {
case -1:
Tcl_AppendResult(interp, "mass of the field is negative", (char *)NULL);
return TCL_ERROR;
case -2:
Tcl_AppendResult(interp, "mesh must be positive", (char *) NULL);
return TCL_ERROR;
case ES_OK:
return TCL_OK;
}
Tcl_AppendResult(interp, "unknown error", (char *) NULL);
return TCL_ERROR;
}
开发者ID:Petr-Melenev,项目名称:espresso-dev,代码行数:66,代码来源:maggs_tcl.cpp
示例11: tclcommand_inter_coulomb_parse_elc_params
int tclcommand_inter_coulomb_parse_elc_params(Tcl_Interp * interp, int argc, char ** argv)
{
double pwerror;
double gap_size;
double far_cut = -1;
double top = 1, mid = 1, bot = 1;
int neutralize = 1;
if (argc < 2) {
Tcl_AppendResult(interp, "either nothing or elc <pwerror> <minimal layer distance> {<cutoff>} {dielectric <di_top> <di_mid> <di_bottom>} {noneutralization} expected, not \"",
argv[0], "\"", (char *)NULL);
return TCL_ERROR;
}
if (!ARG0_IS_D(pwerror))
return TCL_ERROR;
if (!ARG1_IS_D(gap_size))
return TCL_ERROR;
argc -= 2; argv += 2;
if (argc > 0) {
// if there, parse away manual cutoff
if(ARG0_IS_D(far_cut)) {
argc--; argv++;
}
else
Tcl_ResetResult(interp);
while (argc > 0) {
if (ARG0_IS_S("noneutralization") || ARG0_IS_S("-noneutralization")) {
neutralize = 0;
argc--; argv++;
}
else if (argc >= 4 && ARG0_IS_S("dielectric")) {
// just a dummy, not used, as it is only printed for information
// purposes. We need to calculate it
double space_layer_dummy;
if (!ARG_IS_D(1,top) || !ARG_IS_D(2,mid) || !ARG_IS_D(3,bot))
return TCL_ERROR;
argc -= 4; argv += 4;
if (argc > 0 && ARG_IS_D(4, space_layer_dummy)) {
argc--; argv++;
}
}
else {
Tcl_AppendResult(interp, "either nothing or elc <pwerror> <minimal layer distance> {<cutoff>} {dielectric <di_top> <di_mid> <di_bottom>} {noneutralization} expected, not \"",
argv[0], "\"", (char *)NULL);
return TCL_ERROR;
}
}
}
CHECK_VALUE(ELC_set_params(pwerror, gap_size, far_cut, neutralize, top, mid, bot),
"choose a 3d electrostatics method prior to ELC");
}
开发者ID:rafaelbordin,项目名称:espresso,代码行数:56,代码来源:elc_tcl.c
示例12: tclcommand_inter_coulomb_parse_mmm2d
int tclcommand_inter_coulomb_parse_mmm2d(Tcl_Interp * interp, int argc, char ** argv)
{
int err;
double maxPWerror;
double far_cut = -1;
double top = 1, mid = 1, bot = 1;
double delta_top = 0, delta_bot = 0;
if (argc < 1) {
Tcl_AppendResult(interp, "wrong # arguments: inter coulomb mmm2d <maximal pairwise error> "
"{<fixed far cutoff>} {dielectric <e1> <e2> <e3>} | {dielectric-contrasts <d1> <d2>}", (char *) NULL);
return TCL_ERROR;
}
if (! ARG0_IS_D(maxPWerror))
return TCL_ERROR;
--argc; ++argv;
if (argc >= 1) {
if (ARG0_IS_D(far_cut)){
--argc; ++argv;
} else {
Tcl_ResetResult(interp);
}
}
if (argc != 0) {
if (argc == 4 && ARG0_IS_S("dielectric")) {
if (!ARG_IS_D(1,top) || !ARG_IS_D(2,mid) || !ARG_IS_D(3,bot))
return TCL_ERROR;
delta_top = (mid - top)/(mid + top);
delta_bot = (mid - bot)/(mid + bot);
}
else if (argc == 3 && ARG0_IS_S("dielectric-contrasts")) {
if (!ARG_IS_D(1,delta_top) || !ARG_IS_D(2,delta_bot))
return TCL_ERROR;
} else {
Tcl_AppendResult(interp, "wrong # arguments: inter coulomb mmm2d <maximal pairwise error> "
"{<fixed far cutoff>} {dielectric <e1> <e2> <e3>} | {dielectric-contrasts <d1> <d2>}", (char *) NULL);
return TCL_ERROR;
}
}
if (cell_structure.type != CELL_STRUCTURE_NSQUARE &&
cell_structure.type != CELL_STRUCTURE_LAYERED) {
Tcl_AppendResult(interp, "MMM2D requires layered of nsquare cell structure", (char *)NULL);
return TCL_ERROR;
}
if ((err = MMM2D_set_params(maxPWerror, far_cut, delta_top, delta_bot)) > 0) {
Tcl_AppendResult(interp, mmm2d_errors[err], (char *)NULL);
return TCL_ERROR;
}
return TCL_OK;
}
开发者ID:andmi,项目名称:espresso,代码行数:56,代码来源:mmm2d_tcl.c
示例13: tclcommand_thermostat_parse_inter_dpd
int tclcommand_thermostat_parse_inter_dpd(Tcl_Interp *interp, int argc, char ** argv)
{
double temp;
if (argc < 2) {
Tcl_AppendResult(interp, "thermostat needs 1 parameter: "
"<temperature>",
(char *) NULL);
return TCL_ERROR;
}
if (argc>2 && ARG_IS_S(2, "ignore_fixed_particles")) {
if (argc == 3)
dpd_ignore_fixed_particles=1;
else if (argc!= 4 || (!ARG_IS_I(3, dpd_ignore_fixed_particles)))
return TCL_ERROR;
mpi_bcast_parameter(FIELD_DPD_IGNORE_FIXED_PARTICLES);
return TCL_OK;
}
/* copy lattice-boltzmann parameters */
if (! ARG_IS_D(2, temp)) { return TCL_ERROR; }
if ( temp < 0.0 ) {
Tcl_AppendResult(interp, "temperature must be non-negative", (char *) NULL);
return TCL_ERROR;
}
temperature = temp;
thermo_switch = ( thermo_switch | THERMO_INTER_DPD );
mpi_bcast_parameter(FIELD_THERMO_SWITCH);
mpi_bcast_parameter(FIELD_TEMPERATURE);
return (TCL_OK);
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:33,代码来源:dpd_tcl.cpp
示例14: tclcommand_thermostat_parse_lb
int tclcommand_thermostat_parse_lb(Tcl_Interp *interp, int argc, char ** argv)
{
#if defined(LB) || defined(LB_GPU)
double temp;
/* get lb interaction type */
if (argc < 2) {
Tcl_AppendResult(interp, "lb needs 1 parameter: "
"<temperature>",
(char *) NULL);
return TCL_ERROR;
}
/* copy lattice-boltzmann parameters */
if (! ARG_IS_D(1, temp)) { return TCL_ERROR; }
if ( temp < 0.0 ) {
Tcl_AppendResult(interp, "temperature must be non-negative", (char *) NULL);
return TCL_ERROR;
}
temperature = temp;
thermo_switch = ( thermo_switch | THERMO_LB );
mpi_bcast_parameter(FIELD_THERMO_SWITCH);
mpi_bcast_parameter(FIELD_TEMPERATURE);
#endif
return TCL_OK;
}
开发者ID:gitter-badger,项目名称:espresso,代码行数:29,代码来源:thermostat_tcl.cpp
示例15: tclcommand_thermostat_parse_bd
int tclcommand_thermostat_parse_bd(Tcl_Interp *interp, int argc, char **argv)
{
double temp;
/* check number of arguments */
if (argc < 3) {
Tcl_AppendResult(interp, "wrong # args: should be \n\"",
argv[0]," ",argv[1]," <temp>\"", (char *)NULL);
return (TCL_ERROR);
}
/* check argument types */
if ( !ARG_IS_D(2, temp) ) {
Tcl_AppendResult(interp, argv[0]," ",argv[1]," needs a DOUBLE", (char *)NULL);
return (TCL_ERROR);
}
if (temp < 0) {
Tcl_AppendResult(interp, "temperature must be positive", (char *)NULL);
return (TCL_ERROR);
}
/* broadcast parameters */
temperature = temp;
thermo_switch = ( thermo_switch | THERMO_BD );
mpi_bcast_parameter(FIELD_THERMO_SWITCH);
mpi_bcast_parameter(FIELD_TEMPERATURE);
return (TCL_OK);
}
开发者ID:gitter-badger,项目名称:espresso,代码行数:29,代码来源:thermostat_tcl.cpp
示例16: tclcommand_metadynamics_parse_relative_z
int tclcommand_metadynamics_parse_relative_z(Tcl_Interp *interp, int argc, char **argv)
{
int pid1, pid2, dbins, numrelaxationsteps;
double dmin, dmax, bheight, bwidth, fbound;
/* check number of arguments */
if (argc < 11) {
Tcl_AppendResult(interp, "wrong # args: should be \n\"",
argv[0]," ",argv[1]," <pid1> <pid2> <z_min> <z_max> <b_height> <b_width> <f_bound> <z_bins> <num_relaxation_steps>\"", (char *)NULL);
return (TCL_ERROR);
}
/* check argument types */
if ( !ARG_IS_I(2, pid1) || !ARG_IS_I(3, pid2) || !ARG_IS_D(4, dmin) || !ARG_IS_D(5, dmax) ||
!ARG_IS_D(6, bheight) || !ARG_IS_D(7, bwidth) || !ARG_IS_D(8, fbound) || !ARG_IS_I(9, dbins) || !ARG_IS_I(10, numrelaxationsteps) ) {
Tcl_AppendResult(interp, argv[0]," ",argv[1]," needs two INTS, five DOUBLES, and two INTS in this order", (char *)NULL);
return (TCL_ERROR);
}
if (pid1 < 0 || pid1 > max_seen_particle || pid2 < 0 || pid2 > max_seen_particle) {
Tcl_AppendResult(interp, "pid1 and/or pid2 out of range", (char *)NULL);
return (TCL_ERROR);
}
if (dmax < dmin || bheight < 0 || bwidth < 0 || fbound < 0 || dbins < 0 || numrelaxationsteps <0) {
Tcl_AppendResult(interp, "check parameters: inconcistency somewhere", (char *)NULL);
return (TCL_ERROR);
}
free(meta_acc_force);
free(meta_acc_fprofile);
/* broadcast parameters */
meta_pid1 = pid1;
meta_pid2 = pid2;
meta_bias_height = bheight;
meta_bias_width = bwidth;
meta_xi_min = dmin;
meta_xi_max = dmax;
meta_f_bound = fbound;
meta_xi_num_bins = dbins;
meta_switch = META_REL_Z;
meta_num_relaxation_steps = numrelaxationsteps;
return (TCL_OK);
}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:47,代码来源:metadynamics_tcl.cpp
示例17: tclcommand_inter_coulomb_parse_ewald
int tclcommand_inter_coulomb_parse_ewald(Tcl_Interp * interp, int argc, char ** argv)
{
double r_cut, alpha;
int i, kmax;
coulomb.method = COULOMB_EWALD;
#ifdef PARTIAL_PERIODIC
if(PERIODIC(0) == 0 ||
PERIODIC(1) == 0 ||
PERIODIC(2) == 0)
{
Tcl_AppendResult(interp, "Need periodicity (1,1,1) with Coulomb EWALD",
(char *) NULL);
return TCL_ERROR;
}
#endif
if (argc < 2) {
Tcl_AppendResult(interp, "expected: inter coulomb <bjerrum> ewald <r_cut> <alpha> <kmax>",
(char *) NULL);
return TCL_ERROR;
}
if(! ARG0_IS_D(r_cut))
return TCL_ERROR;
if(argc != 3) {
Tcl_AppendResult(interp, "wrong # arguments: inter coulomb <bjerrum> ewald <r_cut> <alpha> <kmax>",
(char *) NULL);
return TCL_ERROR;
}
if(! ARG_IS_D(1, alpha))
return TCL_ERROR;
if(! ARG_IS_I(2, kmax))
return TCL_ERROR;
if ((i = ewald_set_params(r_cut, alpha, kmax)) < 0) {
switch (i) {
case -1:
Tcl_AppendResult(interp, "r_cut must be positive", (char *) NULL);
break;
case -4:
Tcl_AppendResult(interp, "alpha must be positive", (char *) NULL);
break;
case -5:
Tcl_AppendResult(interp, "kmax must be greater than zero", (char *) NULL);
default:;
Tcl_AppendResult(interp, "unspecified error", (char *) NULL);
}
return TCL_ERROR;
}
return TCL_OK;
}
开发者ID:adolfom,项目名称:espresso,代码行数:59,代码来源:ewald.c
示例18: tclcommand_inter_parse_bending_force
/// parse parameters for the bending_force potential
int tclcommand_inter_parse_bending_force(Tcl_Interp *interp, int bond_type, int argc, char **argv)
{
double phi0, kb;
if (argc != 3 ) {
Tcl_AppendResult(interp, "bending_force needs 2 parameters: "
"<phi0> <kb>", (char *) NULL);
return (TCL_ERROR);
}
if (!ARG_IS_D(1, phi0) || !ARG_IS_D(2, kb) ) {
Tcl_AppendResult(interp, "bending_force needs 2 parameters of types DOUBLE: "
"<phi0> <kb>", (char *) NULL);
return TCL_ERROR;
}
CHECK_VALUE(bending_force_set_params(bond_type, phi0, kb), "bond type must be nonnegative");
}
开发者ID:branicky,项目名称:espresso,代码行数:18,代码来源:bending_force_tcl.c
示例19: tclcommand_inter_coulomb_parse_mmm1d
int tclcommand_inter_coulomb_parse_mmm1d(Tcl_Interp *interp, int argc, char **argv)
{
double switch_rad, maxPWerror;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # arguments: inter coulomb mmm1d <switch radius> "
"{<bessel cutoff>} <maximal error for near formula> | tune <maximal pairwise error>", (char *) NULL);
return TCL_ERROR;
}
if (ARG0_IS_S("tune")) {
/* autodetermine bessel cutoff AND switching radius */
if (! ARG_IS_D(1, maxPWerror))
return TCL_ERROR;
switch_rad = -1;
}
else {
if (argc == 2) {
/* autodetermine bessel cutoff */
if ((! ARG_IS_D(0, switch_rad)) ||
(! ARG_IS_D(1, maxPWerror)))
return TCL_ERROR;
}
else {
Tcl_AppendResult(interp, "wrong # arguments: inter coulomb mmm1d <switch radius> "
"<maximal error for near formula> | tune <maximal pairwise error>", (char *) NULL);
return TCL_ERROR;
}
if (switch_rad <= 0 || switch_rad > box_l[2]) {
Tcl_AppendResult(interp, "switching radius is not between 0 and box_l[2]", (char *)NULL);
return TCL_ERROR;
}
}
MMM1D_set_params(switch_rad, maxPWerror);
char *log = NULL;
int result = mmm1d_tune(&log) == ES_OK ? TCL_OK : TCL_ERROR;
Tcl_AppendResult(interp, log, NULL);
if (log)
free(log);
return gather_runtime_errors(interp, result);
}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:46,代码来源:mmm1d_tcl.cpp
示例20: tclcommand_inter_parse_inter_dpd
int tclcommand_inter_parse_inter_dpd(Tcl_Interp * interp,
int part_type_a, int part_type_b,
int argc, char ** argv)
{
/* parameters needed for LJ */
extern double temperature;
double gamma,r_c,tgamma,tr_c;
int wf,twf;
int change;
/* get inter_dpd interaction type */
if (argc < 7) {
Tcl_AppendResult(interp, "inter_dpd needs 6 parameters: "
"<gamma> <r_cut> <wf> <tgamma> <tr_cut> <twf>",
(char *) NULL);
return 0;
}
if (temperature == -1) {
Tcl_AppendResult(interp, "Please set temperature first: temperature inter_dpd temp",(char *) NULL);
return 0;
}
/* copy lennard-jones parameters */
if ((! ARG_IS_D(1, gamma)) ||
(! ARG_IS_D(2, r_c)) ||
(! ARG_IS_I(3, wf)) ||
(! ARG_IS_D(4, tgamma)) ||
(! ARG_IS_D(5, tr_c)) ||
(! ARG_IS_I(6, twf)) ) {
Tcl_AppendResult(interp, "inter_dpd needs 6 parameters: "
"<gamma> <r_cut> <wf> <tgamma> <tr_cut> <twf> ",
(char *) NULL);
return 0;
}
change = 7;
if (inter_dpd_set_params(part_type_a, part_type_b,
gamma,r_c,wf,tgamma,tr_c,twf) == ES_ERROR) {
Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL);
return 0;
}
inter_dpd_init();
return change;
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:46,代码来源:dpd_tcl.cpp
注:本文中的ARG_IS_D函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论