version 1.26 | version 1.27 |
---|
| |
} | } |
Tcl_AppendResult(interp, "Invalid segid: ", argv[2], NULL); | Tcl_AppendResult(interp, "Invalid segid: ", argv[2], NULL); |
return TCL_ERROR; | return TCL_ERROR; |
} else if (argc == 5 && !strcasecmp(argv[1], "coordinates")) { | } else if (argc == 5 && |
| (!strcasecmp(argv[1], "coordinates") || |
| !strcasecmp(argv[1], "mass"))) { |
topo_mol *mol = psf->mol; | topo_mol *mol = psf->mol; |
int segindex = (mol ? | int segindex = (mol ? |
hasharray_index(mol->segment_hash, argv[2]) : | hasharray_index(mol->segment_hash, argv[2]) : |
| |
atoms = seg->residue_array[resindex].atoms; | atoms = seg->residue_array[resindex].atoms; |
while (atoms) { | while (atoms) { |
if (!strcmp(atoms->name, argv[4])) { | if (!strcmp(atoms->name, argv[4])) { |
| if (!strcasecmp(argv[1], "coordinates")) { |
#if TCL_MINOR_VERSION >= 6 | #if TCL_MINOR_VERSION >= 6 |
char buf[512]; | char buf[512]; |
sprintf(buf, "%f %f %f", atoms->x, atoms->y, atoms->z); | sprintf(buf, "%f %f %f", atoms->x, atoms->y, atoms->z); |
| |
sprintf(interp->result, "%f %f %f", atoms->x, atoms->y, atoms->z); | sprintf(interp->result, "%f %f %f", atoms->x, atoms->y, atoms->z); |
#endif | #endif |
return TCL_OK; | return TCL_OK; |
| } else if (!strcasecmp(argv[1], "mass")) { |
| #if TCL_MINOR_VERSION >= 6 |
| char buf[512]; |
| sprintf(buf, "%f", atoms->mass); |
| Tcl_AppendResult(interp, buf, NULL); |
| #else |
| sprintf(interp->result, "%f", atoms->mass); |
| #endif |
| return TCL_OK; |
| } |
} | } |
atoms = atoms->next; | atoms = atoms->next; |
} | } |