Molecular Modeling Software
リビジョン | 35319796608a9041ca39ab45535a02cf0e1e7b0d (tree) |
---|---|
日時 | 2010-02-18 23:39:06 |
作者 | toshinagata1964 <toshinagata1964@a2be...> |
コミッター | toshinagata1964 |
Cleaning up the rdoc comments.
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@10 a2be9bc6-48de-4e38-9406-05402d4bc13c
@@ -131,7 +131,7 @@ extern int MyAppControllerGetTextWithPrompt(const char *prompt, char *buf, int b | ||
131 | 131 | |
132 | 132 | /* |
133 | 133 | * call-seq: |
134 | - * MessageOutput.write(str) | |
134 | + * write(str) | |
135 | 135 | * |
136 | 136 | * Put the message in the main text view. |
137 | 137 | */ |
@@ -144,7 +144,7 @@ s_MessageOutput_Write(VALUE self, VALUE str) | ||
144 | 144 | |
145 | 145 | /* |
146 | 146 | * call-seq: |
147 | - * Kernel.message_box(str, title, button = nil, icon = :info) | |
147 | + * message_box(str, title, button = nil, icon = :info) | |
148 | 148 | * |
149 | 149 | * Show a message box. |
150 | 150 | * Buttons: nil (ok and cancel), :ok (ok only), :cancel (cancel only) |
@@ -187,7 +187,7 @@ s_Kernel_MessageBox(int argc, VALUE *argv, VALUE self) | ||
187 | 187 | |
188 | 188 | /* |
189 | 189 | * call-seq: |
190 | - * Kernel.error_message_box(str) | |
190 | + * error_message_box(str) | |
191 | 191 | * |
192 | 192 | * Show an error message box. |
193 | 193 | */ |
@@ -444,276 +444,6 @@ s_Event_Callback(rb_event_t event, NODE *node, VALUE self, ID rid, VALUE klass) | ||
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -#if 0 | |
448 | -#pragma mark ------ Obsolete ------ | |
449 | - | |
450 | -/* User interrupt handling | |
451 | - * User interrupt (command-period on Mac OS) is handled by periodic polling of | |
452 | - * key events. This polling should only be enabled during "normal" execution | |
453 | - * of scripts and must be disabled when the rest of the application (or Ruby | |
454 | - * script itself) is handling GUI. This is ensured by appropriate calls to | |
455 | - * enable_interrupt and disable_interrupt. */ | |
456 | - | |
457 | -static int s_interrupt_var_initialized = 0; | |
458 | -static VALUE s_interrupt_thread = Qnil; | |
459 | -static VALUE s_interrupt_proc = Qnil; | |
460 | -static VALUE s_interrupt_lock = Qnil; | |
461 | -static VALUE s_interrupt_flag = Qfalse; | |
462 | -static VALUE s_eval_arguments[3] = {Qnil, Qnil, Qnil}; | |
463 | - | |
464 | -static VALUE | |
465 | -s_ShowProgressPanel(int argc, VALUE *argv, VALUE self) | |
466 | -{ | |
467 | - volatile VALUE message; | |
468 | - const char *p; | |
469 | - if (Ruby_GetInterruptFlag() == Qtrue) { | |
470 | - if (s_interrupt_lock != Qnil) | |
471 | - rb_funcall(s_interrupt_lock, rb_intern("lock"), 0); | |
472 | - rb_scan_args(argc, argv, "01", &message); | |
473 | - if (message != Qnil) | |
474 | - p = StringValuePtr(message); | |
475 | - else | |
476 | - p = NULL; | |
477 | - MyAppCallback_showProgressPanel(p); | |
478 | - if (s_interrupt_lock != Qnil) | |
479 | - rb_funcall(s_interrupt_lock, rb_intern("unlock"), 0); | |
480 | - } | |
481 | - return Qnil; | |
482 | -} | |
483 | - | |
484 | -static VALUE | |
485 | -s_HideProgressPanel(VALUE self) | |
486 | -{ | |
487 | - MyAppCallback_hideProgressPanel(); | |
488 | - return Qnil; | |
489 | -} | |
490 | - | |
491 | -static VALUE | |
492 | -s_SetProgressValue(VALUE self, VALUE val) | |
493 | -{ | |
494 | - double dval = NUM2DBL(rb_Float(val)); | |
495 | - MyAppCallback_setProgressValue(dval); | |
496 | - return Qnil; | |
497 | -} | |
498 | - | |
499 | -static VALUE | |
500 | -s_SetProgressMessage(VALUE self, VALUE msg) | |
501 | -{ | |
502 | - const char *p; | |
503 | - if (msg == Qnil) | |
504 | - p = NULL; | |
505 | - else p = StringValuePtr(msg); | |
506 | - MyAppCallback_setProgressMessage(p); | |
507 | - return Qnil; | |
508 | -} | |
509 | - | |
510 | -static VALUE | |
511 | -s_SetInterruptFlag(VALUE self, VALUE val) | |
512 | -{ | |
513 | - VALUE oldval; | |
514 | - if (val != Qundef) { | |
515 | - if (val == Qfalse || val == Qnil) | |
516 | - val = Qfalse; | |
517 | - else val = Qtrue; | |
518 | - } | |
519 | - if (s_interrupt_lock != Qnil) | |
520 | - rb_funcall(s_interrupt_lock, rb_intern("lock"), 0); | |
521 | - oldval = s_interrupt_flag; | |
522 | - if (val != Qundef) { | |
523 | - s_interrupt_flag = val; | |
524 | - if (val == Qfalse) { | |
525 | - s_HideProgressPanel(self); | |
526 | - } | |
527 | - } | |
528 | - if (s_interrupt_lock != Qnil) | |
529 | - rb_funcall(s_interrupt_lock, rb_intern("unlock"), 0); | |
530 | - if (s_interrupt_thread != Qnil) { | |
531 | - if (val == Qtrue) | |
532 | - rb_funcall(s_interrupt_thread, rb_intern("wakeup"), 0); | |
533 | - else if (val == Qfalse) | |
534 | - rb_eval_string("while !$interrupt_thread['stopped']; Thread.pass; end"); | |
535 | - } | |
536 | - return oldval; | |
537 | -} | |
538 | - | |
539 | -static VALUE | |
540 | -s_GetInterruptFlag(VALUE self) | |
541 | -{ | |
542 | - return s_SetInterruptFlag(self, Qundef); | |
543 | -} | |
544 | - | |
545 | -static VALUE | |
546 | -s_Ruby_CallMethod(VALUE val) | |
547 | -{ | |
548 | - void **ptr = (void **)val; | |
549 | - VALUE receiver = (VALUE)ptr[0]; | |
550 | - ID method_id = (ID)ptr[1]; | |
551 | - VALUE args = (VALUE)ptr[2]; | |
552 | - return rb_funcall(s_interrupt_proc, rb_intern("call"), 3, receiver, ID2SYM(method_id), args); | |
553 | -} | |
554 | - | |
555 | -VALUE | |
556 | -Ruby_CallMethodWithInterrupt(VALUE receiver, ID method_id, VALUE args, int *status) | |
557 | -{ | |
558 | - VALUE *temp_arguments[3]; | |
559 | - VALUE retval; | |
560 | - if (s_interrupt_var_initialized == 0) { | |
561 | - rb_define_variable("$interrupt_thread", &s_interrupt_thread); | |
562 | - rb_define_variable("$interrupt_proc", &s_interrupt_proc); | |
563 | - rb_define_variable("$interrupt_lock", &s_interrupt_lock); | |
564 | - rb_define_variable("$interrupt_flag", &s_interrupt_flag); | |
565 | - rb_define_variable("$eval_target", &s_eval_arguments[0]); | |
566 | - rb_define_variable("$eval_method", &s_eval_arguments[1]); | |
567 | - rb_define_variable("$eval_args", &s_eval_arguments[2]); | |
568 | - rb_eval_string_protect( | |
569 | - "require 'thread'; $interrupt_lock = Mutex.new \n" | |
570 | - "$interrupt_stack = Array.new \n" | |
571 | - "def start_interrupt_check \n" | |
572 | - " f = set_interrupt_flag(false) # Suspend $interrupt_thread if running \n" | |
573 | - " $interrupt_stack.push([f, $interrupt_thread]) # Save $interrupt_thread \n" | |
574 | - " $interrupt_thread = Thread.new { # Create a new $interrupt_thread \n" | |
575 | - " while 1 \n" | |
576 | - " 10.times { \n" | |
577 | - " sleep 0.01 \n" | |
578 | - " if !get_interrupt_flag \n" | |
579 | - " Thread.current['stopped'] = true \n" | |
580 | - " Thread.stop \n" | |
581 | - " Thread.current['stopped'] = nil \n" | |
582 | - " end \n" | |
583 | - " } \n" | |
584 | - " if check_interrupt > 0 \n" | |
585 | - /* "raise Interrupt" does not work in Ruby1.8.6 */ | |
586 | - " Thread.main.raise Interrupt.new(nil) \n" | |
587 | - " end \n" | |
588 | - " end \n" | |
589 | - " } \n" | |
590 | - " set_interrupt_flag(true) # Let $interrupt_thread alive \n" | |
591 | - "end \n" | |
592 | - "def stop_interrupt_check \n" | |
593 | - " $interrupt_thread.kill # Stop $interrupt_thread \n" | |
594 | - " c = $interrupt_stack.pop \n" | |
595 | - " $interrupt_thread = c[1] # Restore the previous thread \n" | |
596 | - " set_interrupt_flag(c[0]) # Wake up $interrupt_thread if necessary \n" | |
597 | - "end \n", status); | |
598 | - if (*status != 0) | |
599 | - return Qnil; | |
600 | - /* s_interrupt_proc = rb_eval_string_protect( | |
601 | - "Proc.new { |rec, method, args| \n" | |
602 | - " start_interrupt_check \n" | |
603 | - " begin \n" | |
604 | - " rec.send(method, *args) # Do method call \n" | |
605 | - " ensure \n" | |
606 | - " stop_interrupt_check \n" | |
607 | - " end \n" | |
608 | - "}", status); | |
609 | - if (*status != 0) | |
610 | - return Qnil; */ | |
611 | - s_interrupt_var_initialized = 1; | |
612 | - } | |
613 | - | |
614 | - memmove(temp_arguments, s_eval_arguments, sizeof(temp_arguments)); | |
615 | - s_eval_arguments[0] = receiver; | |
616 | - s_eval_arguments[2] = args; | |
617 | - if (method_id == 0) { | |
618 | - /* args should be a string, which is evaluated */ | |
619 | - if (receiver == Qnil) { | |
620 | - retval = rb_eval_string_protect( | |
621 | - "start_interrupt_check \n" | |
622 | - "begin \n" | |
623 | - " eval $eval_args \n" | |
624 | - "ensure \n" | |
625 | - " stop_interrupt_check \n" | |
626 | - "end \n", status); | |
627 | - } else { | |
628 | - retval = rb_eval_string_protect( | |
629 | - "start_interrupt_check \n" | |
630 | - "begin \n" | |
631 | - " $eval_target.instance_eval $eval_args \n" | |
632 | - "ensure \n" | |
633 | - " stop_interrupt_check \n" | |
634 | - "end \n", status); | |
635 | - } | |
636 | - } else { | |
637 | - s_eval_arguments[1] = ID2SYM(method_id); | |
638 | - retval = rb_eval_string_protect( | |
639 | - "start_interrupt_check \n" | |
640 | - "begin \n" | |
641 | - " $eval_target.send($eval_method, *$eval_args) \n" | |
642 | - "ensure \n" | |
643 | - " stop_interrupt_check \n" | |
644 | - "end \n", status); | |
645 | - } | |
646 | - /* char *s = StringValuePtr(args); | |
647 | - char *p; | |
648 | - asprintf(&p, "start_interrupt_check; begin; %s; ensure; stop_interrupt_check; end", s); | |
649 | - retval = rb_eval_string_protect(p, status); | |
650 | - free(p); */ | |
651 | -/* } else { */ | |
652 | - /* args should be a Ruby array of arguments */ | |
653 | -/* ptr[0] = (void *)receiver; | |
654 | - ptr[1] = (void *)method_id; | |
655 | - ptr[2] = (void *)args; | |
656 | - retval = rb_protect(s_Ruby_CallMethod, (VALUE)ptr, status); | |
657 | - } */ | |
658 | - memmove(s_eval_arguments, temp_arguments, sizeof(temp_arguments)); | |
659 | - | |
660 | - MyAppCallback_hideProgressPanel(); /* In case when the progress panel is still onscreen */ | |
661 | - return retval; | |
662 | -} | |
663 | - | |
664 | -VALUE | |
665 | -Ruby_SetInterruptFlag(VALUE val) | |
666 | -{ | |
667 | - return s_SetInterruptFlag(Qnil, val); | |
668 | -} | |
669 | - | |
670 | -VALUE | |
671 | -Ruby_GetInterruptFlag(void) | |
672 | -{ | |
673 | - return s_SetInterruptFlag(Qnil, Qundef); | |
674 | -} | |
675 | - | |
676 | -/* | |
677 | - * call-seq: | |
678 | - * check_interrupt -> integer | |
679 | - * | |
680 | - * Returns 1 if interrupted, 0 if not, -1 if interrupt is disabled. | |
681 | - */ | |
682 | -static VALUE | |
683 | -s_Kernel_CheckInterrupt(VALUE self) | |
684 | -{ | |
685 | - if (Ruby_GetInterruptFlag() == Qfalse) | |
686 | - return INT2NUM(-1); | |
687 | - else if (MyAppCallback_checkInterrupt()) | |
688 | - return INT2NUM(1); | |
689 | - else return INT2NUM(0); | |
690 | -} | |
691 | - | |
692 | -/* | |
693 | - * call-seq: | |
694 | - * idle(seconds) | |
695 | - * | |
696 | - * Wait for seconds with handling GUI. Raises Interrupt exception if command-. is | |
697 | - * pressed. | |
698 | - */ | |
699 | -/*static VALUE | |
700 | -s_Kernel_Idle(VALUE self, VALUE seconds) | |
701 | -{ | |
702 | - double dval = NUM2DBL(seconds); | |
703 | - VALUE iflag; | |
704 | - int retval; | |
705 | - iflag = Ruby_SetInterruptFlag(Qfalse); | |
706 | - retval = MyAppCallback_processUIWithTimeout(dval); | |
707 | - Ruby_SetInterruptFlag(iflag); | |
708 | - if (retval == 1) | |
709 | - rb_interrupt(); | |
710 | - return Qnil; | |
711 | -} | |
712 | -*/ | |
713 | - | |
714 | -#pragma mark ------ End Obsolete ------ | |
715 | -#endif | |
716 | - | |
717 | 447 | /* |
718 | 448 | * call-seq: |
719 | 449 | * ask(prompt, default = nil) -> string |
@@ -833,7 +563,7 @@ s_Kernel_DocumentHome(VALUE self) | ||
833 | 563 | |
834 | 564 | /* |
835 | 565 | * call-seq: |
836 | - * Kernel.get_global_settings(key) | |
566 | + * get_global_settings(key) | |
837 | 567 | * |
838 | 568 | * Get a setting data for key from the application preferences. |
839 | 569 | */ |
@@ -850,7 +580,7 @@ s_Kernel_GetGlobalSettings(VALUE self, VALUE key) | ||
850 | 580 | |
851 | 581 | /* |
852 | 582 | * call-seq: |
853 | - * Kernel.set_global_settings(key, value) | |
583 | + * set_global_settings(key, value) | |
854 | 584 | * |
855 | 585 | * Set a setting data for key to the application preferences. |
856 | 586 | */ |
@@ -952,12 +682,24 @@ static const char *s_ParameterTypeNames[] = { | ||
952 | 682 | "bond", "angle", "dihedral", "improper", "vdw", "vdw_pair", "vdw_cutoff", "atom" |
953 | 683 | }; |
954 | 684 | |
685 | +/* | |
686 | + * call-seq: | |
687 | + * index -> Integer | |
688 | + * | |
689 | + * Get the index in the parameter list. | |
690 | + */ | |
955 | 691 | static VALUE s_ParameterRef_GetIndex(VALUE self) { |
956 | 692 | ParameterRef *pref; |
957 | 693 | Data_Get_Struct(self, ParameterRef, pref); |
958 | 694 | return INT2NUM(pref->idx); |
959 | 695 | } |
960 | 696 | |
697 | +/* | |
698 | + * call-seq: | |
699 | + * par_type -> String | |
700 | + * | |
701 | + * Get the parameter type, like "bond", "angle", etc. | |
702 | + */ | |
961 | 703 | static VALUE s_ParameterRef_GetParType(VALUE self) { |
962 | 704 | Int tp; |
963 | 705 | s_UnionParFromValue(self, &tp, 0); |
@@ -967,6 +709,16 @@ static VALUE s_ParameterRef_GetParType(VALUE self) { | ||
967 | 709 | else rb_raise(rb_eMolbyError, "Internal error: parameter type tag is out of range (%d)", tp); |
968 | 710 | } |
969 | 711 | |
712 | +/* | |
713 | + * call-seq: | |
714 | + * atom_type -> String or Array of String | |
715 | + * atom_types -> String or Array of String | |
716 | + * | |
717 | + * Get the atom types. For a bond parameter, an array of two strings (like ["ca", "ha"]) | |
718 | + * is returned. For an angle parameter, an array of three strings (like ["ha", "ca", "ha"]) | |
719 | + * is returned. For a dihedral or improper parameter, an array of four strings is returned. | |
720 | + * The atom type may be "X", which is a wildcard that matches any atom type. | |
721 | + */ | |
970 | 722 | static VALUE s_ParameterRef_GetAtomTypes(VALUE self) { |
971 | 723 | UnionPar *up; |
972 | 724 | Int tp, i, n, types[4]; |
@@ -1026,6 +778,12 @@ static VALUE s_ParameterRef_GetAtomTypes(VALUE self) { | ||
1026 | 778 | return rb_ary_new4(n, vals); |
1027 | 779 | } |
1028 | 780 | |
781 | +/* | |
782 | + * call-seq: | |
783 | + * k -> Float | |
784 | + * | |
785 | + * Get the force constant. Available for bond, angle, dihedral, and improper parameters. | |
786 | + */ | |
1029 | 787 | static VALUE s_ParameterRef_GetK(VALUE self) { |
1030 | 788 | UnionPar *up; |
1031 | 789 | Int tp, i, n; |
@@ -1051,6 +809,12 @@ static VALUE s_ParameterRef_GetK(VALUE self) { | ||
1051 | 809 | } |
1052 | 810 | } |
1053 | 811 | |
812 | +/* | |
813 | + * call-seq: | |
814 | + * r0 -> Float | |
815 | + * | |
816 | + * Get the equilibrium bond length. Only available for bond parameters. | |
817 | + */ | |
1054 | 818 | static VALUE s_ParameterRef_GetR0(VALUE self) { |
1055 | 819 | UnionPar *up; |
1056 | 820 | Int tp; |
@@ -1060,6 +824,12 @@ static VALUE s_ParameterRef_GetR0(VALUE self) { | ||
1060 | 824 | else rb_raise(rb_eMolbyError, "invalid member r0"); |
1061 | 825 | } |
1062 | 826 | |
827 | +/* | |
828 | + * call-seq: | |
829 | + * a0 -> Float | |
830 | + * | |
831 | + * Get the equilibrium angle (in degree). Only available for angle parameters. | |
832 | + */ | |
1063 | 833 | static VALUE s_ParameterRef_GetA0(VALUE self) { |
1064 | 834 | UnionPar *up; |
1065 | 835 | Int tp; |
@@ -1069,6 +839,13 @@ static VALUE s_ParameterRef_GetA0(VALUE self) { | ||
1069 | 839 | else rb_raise(rb_eMolbyError, "invalid member a0"); |
1070 | 840 | } |
1071 | 841 | |
842 | +/* | |
843 | + * call-seq: | |
844 | + * mult -> Float | |
845 | + * | |
846 | + * Get the multiplicity. Only available for dihedral and improper parameters. | |
847 | + * (Note: Implementation of multiple dihedral/improper parameters is not well tested) | |
848 | + */ | |
1072 | 849 | static VALUE s_ParameterRef_GetMult(VALUE self) { |
1073 | 850 | UnionPar *up; |
1074 | 851 | Int tp; |
@@ -1078,6 +855,14 @@ static VALUE s_ParameterRef_GetMult(VALUE self) { | ||
1078 | 855 | else rb_raise(rb_eMolbyError, "invalid member mult"); |
1079 | 856 | } |
1080 | 857 | |
858 | +/* | |
859 | + * call-seq: | |
860 | + * period -> Integer or Array of Integers | |
861 | + * | |
862 | + * Get the periodicity. Only available for dihedral and improper parameters. | |
863 | + * If the multiplicity is larger than 1, then an array of integers is returned. | |
864 | + * (Note: Implementation of multiple dihedral/improper parameters is not well tested) | |
865 | + */ | |
1081 | 866 | static VALUE s_ParameterRef_GetPeriod(VALUE self) { |
1082 | 867 | UnionPar *up; |
1083 | 868 | Int tp, i, n; |
@@ -1085,16 +870,24 @@ static VALUE s_ParameterRef_GetPeriod(VALUE self) { | ||
1085 | 870 | up = s_UnionParFromValue(self, &tp, 0); |
1086 | 871 | if (tp == kDihedralParType || tp == kImproperParType) { |
1087 | 872 | if (up->torsion.mult == 1) |
1088 | - return rb_float_new(up->torsion.period[0]); | |
873 | + return INT2NUM(up->torsion.period[0]); | |
1089 | 874 | n = up->torsion.mult; |
1090 | 875 | if (n > 3) |
1091 | 876 | n = 3; |
1092 | 877 | for (i = 0; i < n; i++) |
1093 | - vals[i] = rb_float_new(up->torsion.period[i]); | |
878 | + vals[i] = INT2NUM(up->torsion.period[i]); | |
1094 | 879 | return rb_ary_new4(n, vals); |
1095 | 880 | } else rb_raise(rb_eMolbyError, "invalid member period"); |
1096 | 881 | } |
1097 | 882 | |
883 | +/* | |
884 | + * call-seq: | |
885 | + * phi0 -> Float or Array of Floats | |
886 | + * | |
887 | + * Get the equilibrium dihedral angle. Only available for dihedral and improper parameters. | |
888 | + * If the multiplicity is larger than 1, then an array of floats is returned. | |
889 | + * (Note: Implementation of multiple dihedral/improper parameters is not well tested) | |
890 | + */ | |
1098 | 891 | static VALUE s_ParameterRef_GetPhi0(VALUE self) { |
1099 | 892 | UnionPar *up; |
1100 | 893 | Int tp, i, n; |
@@ -1112,6 +905,12 @@ static VALUE s_ParameterRef_GetPhi0(VALUE self) { | ||
1112 | 905 | } else rb_raise(rb_eMolbyError, "invalid member phi0"); |
1113 | 906 | } |
1114 | 907 | |
908 | +/* | |
909 | + * call-seq: | |
910 | + * A -> Float | |
911 | + * | |
912 | + * Get the "A" value for the van der Waals parameter. | |
913 | + */ | |
1115 | 914 | static VALUE s_ParameterRef_GetA(VALUE self) { |
1116 | 915 | UnionPar *up; |
1117 | 916 | Int tp; |
@@ -1123,6 +922,12 @@ static VALUE s_ParameterRef_GetA(VALUE self) { | ||
1123 | 922 | else rb_raise(rb_eMolbyError, "invalid member A"); |
1124 | 923 | } |
1125 | 924 | |
925 | +/* | |
926 | + * call-seq: | |
927 | + * B -> Float | |
928 | + * | |
929 | + * Get the "B" value for the van der Waals parameter. | |
930 | + */ | |
1126 | 931 | static VALUE s_ParameterRef_GetB(VALUE self) { |
1127 | 932 | UnionPar *up; |
1128 | 933 | Int tp; |
@@ -1134,6 +939,12 @@ static VALUE s_ParameterRef_GetB(VALUE self) { | ||
1134 | 939 | else rb_raise(rb_eMolbyError, "invalid member B"); |
1135 | 940 | } |
1136 | 941 | |
942 | +/* | |
943 | + * call-seq: | |
944 | + * r_eq -> Float | |
945 | + * | |
946 | + * Get the equilibrium radius (half of the minimum energy distance) for the van der Waals parameter. | |
947 | + */ | |
1137 | 948 | static VALUE s_ParameterRef_GetReq(VALUE self) { |
1138 | 949 | UnionPar *up; |
1139 | 950 | Int tp; |
@@ -1154,6 +965,12 @@ static VALUE s_ParameterRef_GetReq(VALUE self) { | ||
1154 | 965 | /* else return rb_float_new(pow(2*a/b, 1.0/6.0)); */ |
1155 | 966 | } |
1156 | 967 | |
968 | +/* | |
969 | + * call-seq: | |
970 | + * eps -> Float | |
971 | + * | |
972 | + * Get the minimum energy for the van der Waals parameter. | |
973 | + */ | |
1157 | 974 | static VALUE s_ParameterRef_GetEps(VALUE self) { |
1158 | 975 | UnionPar *up; |
1159 | 976 | Int tp; |
@@ -1174,6 +991,12 @@ static VALUE s_ParameterRef_GetEps(VALUE self) { | ||
1174 | 991 | /* else return rb_float_new(b*b/a/4.0 * INTERNAL2KCAL); */ |
1175 | 992 | } |
1176 | 993 | |
994 | +/* | |
995 | + * call-seq: | |
996 | + * A14 -> Float | |
997 | + * | |
998 | + * Get the "A" value for the 1-4 van der Waals parameter. | |
999 | + */ | |
1177 | 1000 | static VALUE s_ParameterRef_GetA14(VALUE self) { |
1178 | 1001 | UnionPar *up; |
1179 | 1002 | Int tp; |
@@ -1185,6 +1008,12 @@ static VALUE s_ParameterRef_GetA14(VALUE self) { | ||
1185 | 1008 | else rb_raise(rb_eMolbyError, "invalid member A14"); |
1186 | 1009 | } |
1187 | 1010 | |
1011 | +/* | |
1012 | + * call-seq: | |
1013 | + * B14 -> Float | |
1014 | + * | |
1015 | + * Get the "B" value for the 1-4 van der Waals parameter. | |
1016 | + */ | |
1188 | 1017 | static VALUE s_ParameterRef_GetB14(VALUE self) { |
1189 | 1018 | UnionPar *up; |
1190 | 1019 | Int tp; |
@@ -1196,6 +1025,12 @@ static VALUE s_ParameterRef_GetB14(VALUE self) { | ||
1196 | 1025 | else rb_raise(rb_eMolbyError, "invalid member B14"); |
1197 | 1026 | } |
1198 | 1027 | |
1028 | +/* | |
1029 | + * call-seq: | |
1030 | + * r_eq14 -> Float | |
1031 | + * | |
1032 | + * Get the equilibrium radius (half of the minimum energy distance) for the 1-4 van der Waals parameter. | |
1033 | + */ | |
1199 | 1034 | static VALUE s_ParameterRef_GetReq14(VALUE self) { |
1200 | 1035 | UnionPar *up; |
1201 | 1036 | Int tp; |
@@ -1216,6 +1051,12 @@ static VALUE s_ParameterRef_GetReq14(VALUE self) { | ||
1216 | 1051 | /* else return rb_float_new(pow(2*a/b, 1.0/6.0)); */ |
1217 | 1052 | } |
1218 | 1053 | |
1054 | +/* | |
1055 | + * call-seq: | |
1056 | + * eps14 -> Float | |
1057 | + * | |
1058 | + * Get the minimum energy for the 1-4 van der Waals parameter. | |
1059 | + */ | |
1219 | 1060 | static VALUE s_ParameterRef_GetEps14(VALUE self) { |
1220 | 1061 | UnionPar *up; |
1221 | 1062 | Int tp; |
@@ -1236,6 +1077,12 @@ static VALUE s_ParameterRef_GetEps14(VALUE self) { | ||
1236 | 1077 | /* else return rb_float_new(b*b/a/4.0 * INTERNAL2KCAL); */ |
1237 | 1078 | } |
1238 | 1079 | |
1080 | +/* | |
1081 | + * call-seq: | |
1082 | + * cutoff -> Float | |
1083 | + * | |
1084 | + * Get the cutoff distance for the van der Waals pair-specific cutoff parameter. | |
1085 | + */ | |
1239 | 1086 | static VALUE s_ParameterRef_GetCutoff(VALUE self) { |
1240 | 1087 | UnionPar *up; |
1241 | 1088 | Int tp; |
@@ -1245,6 +1092,12 @@ static VALUE s_ParameterRef_GetCutoff(VALUE self) { | ||
1245 | 1092 | else rb_raise(rb_eMolbyError, "invalid member cutoff"); |
1246 | 1093 | } |
1247 | 1094 | |
1095 | +/* | |
1096 | + * call-seq: | |
1097 | + * radius -> Float | |
1098 | + * | |
1099 | + * Get the atomic radius for the atom display parameter. | |
1100 | + */ | |
1248 | 1101 | static VALUE s_ParameterRef_GetRadius(VALUE self) { |
1249 | 1102 | UnionPar *up; |
1250 | 1103 | Int tp; |
@@ -1254,6 +1107,12 @@ static VALUE s_ParameterRef_GetRadius(VALUE self) { | ||
1254 | 1107 | else rb_raise(rb_eMolbyError, "invalid member radius"); |
1255 | 1108 | } |
1256 | 1109 | |
1110 | +/* | |
1111 | + * call-seq: | |
1112 | + * color -> [Float, Float, Float] | |
1113 | + * | |
1114 | + * Get the rgb color for the atom display parameter. | |
1115 | + */ | |
1257 | 1116 | static VALUE s_ParameterRef_GetColor(VALUE self) { |
1258 | 1117 | UnionPar *up; |
1259 | 1118 | Int tp; |
@@ -1263,6 +1122,12 @@ static VALUE s_ParameterRef_GetColor(VALUE self) { | ||
1263 | 1122 | else rb_raise(rb_eMolbyError, "invalid member color"); |
1264 | 1123 | } |
1265 | 1124 | |
1125 | +/* | |
1126 | + * call-seq: | |
1127 | + * atomic_number -> Integer | |
1128 | + * | |
1129 | + * Get the atomic number for the atom display parameter. | |
1130 | + */ | |
1266 | 1131 | static VALUE s_ParameterRef_GetAtomicNumber(VALUE self) { |
1267 | 1132 | UnionPar *up; |
1268 | 1133 | Int tp; |
@@ -1272,6 +1137,12 @@ static VALUE s_ParameterRef_GetAtomicNumber(VALUE self) { | ||
1272 | 1137 | else rb_raise(rb_eMolbyError, "invalid member atomic_number"); |
1273 | 1138 | } |
1274 | 1139 | |
1140 | +/* | |
1141 | + * call-seq: | |
1142 | + * name -> String | |
1143 | + * | |
1144 | + * Get the name for the atom display parameter. | |
1145 | + */ | |
1275 | 1146 | static VALUE s_ParameterRef_GetName(VALUE self) { |
1276 | 1147 | UnionPar *up; |
1277 | 1148 | Int tp; |
@@ -1284,6 +1155,12 @@ static VALUE s_ParameterRef_GetName(VALUE self) { | ||
1284 | 1155 | } else rb_raise(rb_eMolbyError, "invalid member name"); |
1285 | 1156 | } |
1286 | 1157 | |
1158 | +/* | |
1159 | + * call-seq: | |
1160 | + * weight -> Float | |
1161 | + * | |
1162 | + * Get the atomic weight for the atom display parameter. | |
1163 | + */ | |
1287 | 1164 | static VALUE s_ParameterRef_GetWeight(VALUE self) { |
1288 | 1165 | UnionPar *up; |
1289 | 1166 | Int tp; |
@@ -1295,6 +1172,12 @@ static VALUE s_ParameterRef_GetWeight(VALUE self) { | ||
1295 | 1172 | else rb_raise(rb_eMolbyError, "invalid member weight"); |
1296 | 1173 | } |
1297 | 1174 | |
1175 | +/* | |
1176 | + * call-seq: | |
1177 | + * fullname -> String | |
1178 | + * | |
1179 | + * Get the full name for the atom display parameter. | |
1180 | + */ | |
1298 | 1181 | static VALUE s_ParameterRef_GetFullName(VALUE self) { |
1299 | 1182 | UnionPar *up; |
1300 | 1183 | Int tp; |
@@ -1307,6 +1190,12 @@ static VALUE s_ParameterRef_GetFullName(VALUE self) { | ||
1307 | 1190 | } else rb_raise(rb_eMolbyError, "invalid member fullname"); |
1308 | 1191 | } |
1309 | 1192 | |
1193 | +/* | |
1194 | + * call-seq: | |
1195 | + * comment -> String | |
1196 | + * | |
1197 | + * Get the comment for the parameter. | |
1198 | + */ | |
1310 | 1199 | static VALUE s_ParameterRef_GetComment(VALUE self) { |
1311 | 1200 | UnionPar *up; |
1312 | 1201 | Int tp, com; |
@@ -1317,6 +1206,13 @@ static VALUE s_ParameterRef_GetComment(VALUE self) { | ||
1317 | 1206 | else return rb_str_new2(ParameterGetComment(com)); |
1318 | 1207 | } |
1319 | 1208 | |
1209 | +/* | |
1210 | + * call-seq: | |
1211 | + * source -> String | |
1212 | + * | |
1213 | + * Get the source string for the parameter. Returns false for undefined parameter, | |
1214 | + * and nil for "local" parameter that is specific for the molecule. | |
1215 | + */ | |
1320 | 1216 | static VALUE s_ParameterRef_GetSource(VALUE self) { |
1321 | 1217 | UnionPar *up; |
1322 | 1218 | Int tp, src; |
@@ -1963,7 +1859,7 @@ s_ParameterRef_GetAttr(VALUE self, VALUE key) | ||
1963 | 1859 | |
1964 | 1860 | /* |
1965 | 1861 | * call-seq: |
1966 | - * parameter.keys(idx) -> array of valid parameter attributes | |
1862 | + * keys(idx) -> array of valid parameter attributes | |
1967 | 1863 | * |
1968 | 1864 | * Returns an array of valid parameter attributes (as Symbols). |
1969 | 1865 | */ |
@@ -1996,7 +1892,7 @@ s_ParameterRef_Keys(VALUE self) | ||
1996 | 1892 | |
1997 | 1893 | /* |
1998 | 1894 | * call-seq: |
1999 | - * parameter.to_hash(idx) -> hash | |
1895 | + * to_hash(idx) -> Hash | |
2000 | 1896 | * |
2001 | 1897 | * Returns a hash containing valid parameter names and values |
2002 | 1898 | */ |
@@ -2019,7 +1915,7 @@ s_ParameterRef_ToHash(VALUE self) | ||
2019 | 1915 | |
2020 | 1916 | /* |
2021 | 1917 | * call-seq: |
2022 | - * parameter.to_s(idx) -> string | |
1918 | + * parameter.to_s(idx) -> String | |
2023 | 1919 | * |
2024 | 1920 | * Returns a string representation of the given parameter |
2025 | 1921 | */ |
@@ -2117,7 +2013,7 @@ s_MoleculeFromParameterOrParEnumerableValue(VALUE val) | ||
2117 | 2013 | |
2118 | 2014 | /* |
2119 | 2015 | * call-seq: |
2120 | - * Parameter.builtin -> parameter | |
2016 | + * builtin -> Parameter | |
2121 | 2017 | * |
2122 | 2018 | * Returns a parameter value that points to the global (builtin) parameters. |
2123 | 2019 | */ |
@@ -2130,15 +2026,14 @@ s_Parameter_Builtin(VALUE self) | ||
2130 | 2026 | |
2131 | 2027 | /* |
2132 | 2028 | * call-seq: |
2133 | - * Parameter.bond(idx) -> parameterRef | |
2134 | - * Parameter.bond(t1, t2) -> parameterRef | |
2029 | + * bond(idx) -> ParameterRef | |
2030 | + * bond(t1, t2) -> ParameterRef | |
2135 | 2031 | * |
2136 | 2032 | * In the first form, the index-th bond parameter record is returned. In the second |
2137 | - * form, the bond parameter for t1-t2 is looked up (the last index first). t1, t2 | |
2033 | + * form, the bond parameter for t1-t2 is looked up (the last index first). t1, t2 | |
2138 | 2034 | * are the atom type string (up to 4 characters). |
2139 | 2035 | * If the method is used as a singleton method, then the default parameters are looked up. |
2140 | 2036 | * Otherwise, the specific parameters are looked up first, and then the default parameters. |
2141 | - * In this case, t1 and t2 can be the atom index (0-based). | |
2142 | 2037 | */ |
2143 | 2038 | static VALUE |
2144 | 2039 | s_Parameter_Bond(int argc, VALUE *argv, VALUE self) |
@@ -2178,15 +2073,14 @@ s_Parameter_Bond(int argc, VALUE *argv, VALUE self) | ||
2178 | 2073 | |
2179 | 2074 | /* |
2180 | 2075 | * call-seq: |
2181 | - * Parameter.angle(idx) -> parameterRef | |
2182 | - * Parameter.angle(t1, t2, t3) -> parameterRef | |
2076 | + * angle(idx) -> ParameterRef | |
2077 | + * angle(t1, t2, t3) -> ParameterRef | |
2183 | 2078 | * |
2184 | 2079 | * In the first form, the index-th angle parameter record is returned. In the second |
2185 | - * form, the bond parameter for t1-t2-t3 is looked up (the last index first). t1, t2, t3 | |
2080 | + * form, the bond parameter for t1-t2-t3 is looked up (the last index first). t1, t2, t3 | |
2186 | 2081 | * are the atom type string (up to 4 characters). |
2187 | 2082 | * If the method is used as a singleton method, then the default parameters are looked up. |
2188 | 2083 | * Otherwise, the specific parameters are looked up first, and then the default parameters. |
2189 | - * In this case, t1-t3 can be the atom index (0-based). | |
2190 | 2084 | */ |
2191 | 2085 | static VALUE |
2192 | 2086 | s_Parameter_Angle(int argc, VALUE *argv, VALUE self) |
@@ -2227,15 +2121,14 @@ s_Parameter_Angle(int argc, VALUE *argv, VALUE self) | ||
2227 | 2121 | |
2228 | 2122 | /* |
2229 | 2123 | * call-seq: |
2230 | - * Parameter.dihedral(idx) -> parameterRef | |
2231 | - * Parameter.dihedral(t1, t2, t3, t4) -> parameterRef | |
2124 | + * dihedral(idx) -> ParameterRef | |
2125 | + * dihedral(t1, t2, t3, t4) -> ParameterRef | |
2232 | 2126 | * |
2233 | 2127 | * In the first form, the index-th dihedral parameter record is returned. In the second |
2234 | - * form, the bond parameter for t1-t2-t3-t4 is looked up (the last index first). t1, t2, t3, t4 | |
2128 | + * form, the bond parameter for t1-t2-t3-t4 is looked up (the last index first). t1, t2, t3, t4 | |
2235 | 2129 | * are the atom type string (up to 4 characters). |
2236 | 2130 | * If the method is used as a singleton method, then the default parameters are looked up. |
2237 | 2131 | * Otherwise, the specific parameters are looked up first, and then the default parameters. |
2238 | - * In this case, t1-t4 can be the atom index (0-based). | |
2239 | 2132 | */ |
2240 | 2133 | static VALUE |
2241 | 2134 | s_Parameter_Dihedral(int argc, VALUE *argv, VALUE self) |
@@ -2277,15 +2170,14 @@ s_Parameter_Dihedral(int argc, VALUE *argv, VALUE self) | ||
2277 | 2170 | |
2278 | 2171 | /* |
2279 | 2172 | * call-seq: |
2280 | - * Parameter.improper(idx) -> parameterRef | |
2281 | - * Parameter.improper(t1, t2, t3, t4) -> parameterRef | |
2173 | + * improper(idx) -> ParameterRef | |
2174 | + * improper(t1, t2, t3, t4) -> ParameterRef | |
2282 | 2175 | * |
2283 | 2176 | * In the first form, the index-th improper parameter record is returned. In the second |
2284 | - * form, the bond parameter for t1-t2-t3-t4 is looked up (the last index first). t1, t2, t3, t4 | |
2177 | + * form, the bond parameter for t1-t2-t3-t4 is looked up (the last index first). t1, t2, t3, t4 | |
2285 | 2178 | * are the atom type string (up to 4 characters). |
2286 | 2179 | * If the method is used as a singleton method, then the default parameters are looked up. |
2287 | 2180 | * Otherwise, the specific parameters are looked up first, and then the default parameters. |
2288 | - * In this case, t1-t4 can be the atom index (0-based). | |
2289 | 2181 | */ |
2290 | 2182 | static VALUE |
2291 | 2183 | s_Parameter_Improper(int argc, VALUE *argv, VALUE self) |
@@ -2327,15 +2219,14 @@ s_Parameter_Improper(int argc, VALUE *argv, VALUE self) | ||
2327 | 2219 | |
2328 | 2220 | /* |
2329 | 2221 | * call-seq: |
2330 | - * Parameter.vdw(idx) -> parameterRef | |
2331 | - * Parameter.vdw(t1) -> parameterRef | |
2222 | + * vdw(idx) -> ParameterRef | |
2223 | + * vdw(t1) -> ParameterRef | |
2332 | 2224 | * |
2333 | 2225 | * In the first form, the index-th vdw parameter record is returned. In the second |
2334 | - * form, the vdw parameter for t1 is looked up (the last index first). t1 | |
2226 | + * form, the vdw parameter for t1 is looked up (the last index first). t1 | |
2335 | 2227 | * are the atom type string (up to 4 characters). |
2336 | 2228 | * If the method is used as a singleton method, then the default parameters are looked up. |
2337 | 2229 | * Otherwise, the specific parameters are looked up first, and then the default parameters. |
2338 | - * In this case, t1 can be the atom index (0-based). | |
2339 | 2230 | */ |
2340 | 2231 | static VALUE |
2341 | 2232 | s_Parameter_Vdw(int argc, VALUE *argv, VALUE self) |
@@ -2376,15 +2267,14 @@ s_Parameter_Vdw(int argc, VALUE *argv, VALUE self) | ||
2376 | 2267 | |
2377 | 2268 | /* |
2378 | 2269 | * call-seq: |
2379 | - * Parameter.vdw_pair(idx) -> parameterRef | |
2380 | - * Parameter.vdw_pair(t1, t2) -> parameterRef | |
2270 | + * vdw_pair(idx) -> ParameterRef | |
2271 | + * vdw_pair(t1, t2) -> ParameterRef | |
2381 | 2272 | * |
2382 | 2273 | * In the first form, the index-th vdw-pair parameter record is returned. In the second |
2383 | - * form, the vdw-pair parameter for t1-t2 is looked up (the last index first). t1, t2 | |
2274 | + * form, the vdw-pair parameter for t1-t2 is looked up (the last index first). t1, t2 | |
2384 | 2275 | * are the atom type string (up to 4 characters). |
2385 | 2276 | * If the method is used as a singleton method, then the default parameters are looked up. |
2386 | 2277 | * Otherwise, the specific parameters are looked up first, and then the default parameters. |
2387 | - * In this case, t1 and t2 can be the atom index (0-based). | |
2388 | 2278 | */ |
2389 | 2279 | static VALUE |
2390 | 2280 | s_Parameter_VdwPair(int argc, VALUE *argv, VALUE self) |
@@ -2424,15 +2314,14 @@ s_Parameter_VdwPair(int argc, VALUE *argv, VALUE self) | ||
2424 | 2314 | |
2425 | 2315 | /* |
2426 | 2316 | * call-seq: |
2427 | - * Parameter.vdw_cutoff(idx) -> parameterRef | |
2428 | - * Parameter.vdw_cutoff(t1, t2) -> parameterRef | |
2317 | + * vdw_cutoff(idx) -> ParameterRef | |
2318 | + * vdw_cutoff(t1, t2) -> ParameterRef | |
2429 | 2319 | * |
2430 | 2320 | * In the first form, the index-th vdw-cutoff parameter record is returned. In the second |
2431 | - * form, the vdw-pair parameter for t1-t2 is looked up (the last index first). t1, t2 | |
2321 | + * form, the vdw-pair parameter for t1-t2 is looked up (the last index first). t1, t2 | |
2432 | 2322 | * are the atom type string (up to 4 characters). |
2433 | 2323 | * If the method is used as a singleton method, then the default parameters are looked up. |
2434 | 2324 | * Otherwise, the specific parameters are looked up first, and then the default parameters. |
2435 | - * In this case, t1 and t2 can be the atom index (0-based). | |
2436 | 2325 | */ |
2437 | 2326 | static VALUE |
2438 | 2327 | s_Parameter_VdwCutoff(int argc, VALUE *argv, VALUE self) |
@@ -2472,12 +2361,12 @@ s_Parameter_VdwCutoff(int argc, VALUE *argv, VALUE self) | ||
2472 | 2361 | |
2473 | 2362 | /* |
2474 | 2363 | * call-seq: |
2475 | - * Parameter.atom(idx) -> parameterRef | |
2476 | - * Parameter.atom(t1) -> parameterRef | |
2364 | + * atom(idx) -> ParameterRef | |
2365 | + * atom(t1) -> ParameterRef | |
2477 | 2366 | * |
2478 | 2367 | * In the first form, the index-th atom parameter record is returned. In the second |
2479 | - * form, the atom parameter for t1 is looked up (the last index first). t1 | |
2480 | - * are the element name string (up to 4 characters). | |
2368 | + * form, the atom parameter for t1 is looked up (the last index first). t1 | |
2369 | + * is the element name string (up to 4 characters). | |
2481 | 2370 | * Unlike other Parameter methods, this is used only as a singleton method, because |
2482 | 2371 | * the all atom parameters are global. |
2483 | 2372 | */ |
@@ -2512,7 +2401,7 @@ s_Parameter_Atom(int argc, VALUE *argv, VALUE self) | ||
2512 | 2401 | |
2513 | 2402 | /* |
2514 | 2403 | * call-seq: |
2515 | - * Parameter.nbonds -> integer | |
2404 | + * nbonds -> Integer | |
2516 | 2405 | * |
2517 | 2406 | * Returns the number of bond parameters. If the method is used as a singleton method, |
2518 | 2407 | * then only the default parameters are examined. Otherwise, the total number of the |
@@ -2531,7 +2420,7 @@ s_Parameter_Nbonds(VALUE self) | ||
2531 | 2420 | |
2532 | 2421 | /* |
2533 | 2422 | * call-seq: |
2534 | - * Parameter.nangles -> integer | |
2423 | + * nangles -> Integer | |
2535 | 2424 | * |
2536 | 2425 | * Returns the number of angle parameters. If the method is used as a singleton method, |
2537 | 2426 | * then only the default parameters are examined. Otherwise, the total number of the |
@@ -2550,7 +2439,7 @@ s_Parameter_Nangles(VALUE self) | ||
2550 | 2439 | |
2551 | 2440 | /* |
2552 | 2441 | * call-seq: |
2553 | - * Parameter.ndihedrals -> integer | |
2442 | + * ndihedrals -> Integer | |
2554 | 2443 | * |
2555 | 2444 | * Returns the number of dihedral parameters. If the method is used as a singleton method, |
2556 | 2445 | * then only the default parameters are examined. Otherwise, the total number of the |
@@ -2569,7 +2458,7 @@ s_Parameter_Ndihedrals(VALUE self) | ||
2569 | 2458 | |
2570 | 2459 | /* |
2571 | 2460 | * call-seq: |
2572 | - * Parameter.nimpropers -> integer | |
2461 | + * nimpropers -> Integer | |
2573 | 2462 | * |
2574 | 2463 | * Returns the number of improper parameters. If the method is used as a singleton method, |
2575 | 2464 | * then only the default parameters are examined. Otherwise, the total number of the |
@@ -2588,7 +2477,7 @@ s_Parameter_Nimpropers(VALUE self) | ||
2588 | 2477 | |
2589 | 2478 | /* |
2590 | 2479 | * call-seq: |
2591 | - * Parameter.nvdws -> integer | |
2480 | + * nvdws -> Integer | |
2592 | 2481 | * |
2593 | 2482 | * Returns the number of vdw parameters. If the method is used as a singleton method, |
2594 | 2483 | * then only the default parameters are examined. Otherwise, the total number of the |
@@ -2607,7 +2496,7 @@ s_Parameter_Nvdws(VALUE self) | ||
2607 | 2496 | |
2608 | 2497 | /* |
2609 | 2498 | * call-seq: |
2610 | - * Parameter.nvdw_pairs -> integer | |
2499 | + * nvdw_pairs -> Integer | |
2611 | 2500 | * |
2612 | 2501 | * Returns the number of vdw pair parameters. If the method is used as a singleton method, |
2613 | 2502 | * then only the default parameters are examined. Otherwise, the total number of the |
@@ -2626,7 +2515,7 @@ s_Parameter_NvdwPairs(VALUE self) | ||
2626 | 2515 | |
2627 | 2516 | /* |
2628 | 2517 | * call-seq: |
2629 | - * Parameter.nvdw_cutoffs -> integer | |
2518 | + * nvdw_cutoffs -> Integer | |
2630 | 2519 | * |
2631 | 2520 | * Returns the number of vdw cutoff parameters. If the method is used as a singleton method, |
2632 | 2521 | * then only the default parameters are examined. Otherwise, the total number of the |
@@ -2645,7 +2534,7 @@ s_Parameter_NvdwCutoffs(VALUE self) | ||
2645 | 2534 | |
2646 | 2535 | /* |
2647 | 2536 | * call-seq: |
2648 | - * Parameter.natoms -> integer | |
2537 | + * natoms -> Integer | |
2649 | 2538 | * |
2650 | 2539 | * Returns the number of atom parameters. Unlike other Parameter methods, this |
2651 | 2540 | * method is used only as a singleton method, because all atom parameters are global. |
@@ -2658,7 +2547,7 @@ s_Parameter_Natoms(VALUE self) | ||
2658 | 2547 | |
2659 | 2548 | /* |
2660 | 2549 | * call-seq: |
2661 | - * Parameter.bonds -> ParEnumerable | |
2550 | + * bonds -> ParEnumerable | |
2662 | 2551 | * |
2663 | 2552 | * Returns a ParEnumerable value that (formally) points to the collection of bond parameters. |
2664 | 2553 | * Parameter.bonds[x] is equivalent to Parameter.bond(x). ParEnumerable class is |
@@ -2673,7 +2562,7 @@ s_Parameter_Bonds(VALUE self) | ||
2673 | 2562 | |
2674 | 2563 | /* |
2675 | 2564 | * call-seq: |
2676 | - * Parameter.angles -> ParEnumerable | |
2565 | + * angles -> ParEnumerable | |
2677 | 2566 | * |
2678 | 2567 | * Returns a ParEnumerable value that (formally) points to the collection of angle parameters. |
2679 | 2568 | * Parameter.angles[x] is equivalent to Parameter.angle(x). ParEnumerable class is |
@@ -2688,7 +2577,7 @@ s_Parameter_Angles(VALUE self) | ||
2688 | 2577 | |
2689 | 2578 | /* |
2690 | 2579 | * call-seq: |
2691 | - * Parameter.dihedrals -> ParEnumerable | |
2580 | + * dihedrals -> ParEnumerable | |
2692 | 2581 | * |
2693 | 2582 | * Returns a ParEnumerable value that (formally) points to the collection of dihedral parameters. |
2694 | 2583 | * Parameter.dihedrals[x] is equivalent to Parameter.dihedral(x). ParEnumerable class is |
@@ -2703,7 +2592,7 @@ s_Parameter_Dihedrals(VALUE self) | ||
2703 | 2592 | |
2704 | 2593 | /* |
2705 | 2594 | * call-seq: |
2706 | - * Parameter.impropers -> ParEnumerable | |
2595 | + * impropers -> ParEnumerable | |
2707 | 2596 | * |
2708 | 2597 | * Returns a ParEnumerable value that (formally) points to the collection of improper parameters. |
2709 | 2598 | * Parameter.impropers[x] is equivalent to Parameter.improper(x). ParEnumerable class is |
@@ -2718,7 +2607,7 @@ s_Parameter_Impropers(VALUE self) | ||
2718 | 2607 | |
2719 | 2608 | /* |
2720 | 2609 | * call-seq: |
2721 | - * Parameter.vdws -> ParEnumerable | |
2610 | + * vdws -> ParEnumerable | |
2722 | 2611 | * |
2723 | 2612 | * Returns a ParEnumerable value that (formally) points to the collection of vdw parameters. |
2724 | 2613 | * Parameter.vdws[x] is equivalent to Parameter.vdw(x). ParEnumerable class is |
@@ -2733,7 +2622,7 @@ s_Parameter_Vdws(VALUE self) | ||
2733 | 2622 | |
2734 | 2623 | /* |
2735 | 2624 | * call-seq: |
2736 | - * Parameter.vdw_pairs -> ParEnumerable | |
2625 | + * vdw_pairs -> ParEnumerable | |
2737 | 2626 | * |
2738 | 2627 | * Returns a ParEnumerable value that (formally) points to the collection of vdw pair parameters. |
2739 | 2628 | * Parameter.vdw_pairs[x] is equivalent to Parameter.vdw_pair(x). ParEnumerable class is |
@@ -2748,7 +2637,7 @@ s_Parameter_VdwPairs(VALUE self) | ||
2748 | 2637 | |
2749 | 2638 | /* |
2750 | 2639 | * call-seq: |
2751 | - * Parameter.vdw_cutoffs -> ParEnumerable | |
2640 | + * vdw_cutoffs -> ParEnumerable | |
2752 | 2641 | * |
2753 | 2642 | * Returns a ParEnumerable value that (formally) points to the collection of vdw cutoff parameters. |
2754 | 2643 | * Parameter.vdw_cutoffs[x] is equivalent to Parameter.vdw_cutoff(x). ParEnumerable class is |
@@ -2763,7 +2652,7 @@ s_Parameter_VdwCutoffs(VALUE self) | ||
2763 | 2652 | |
2764 | 2653 | /* |
2765 | 2654 | * call-seq: |
2766 | - * Parameter.atoms -> ParEnumerable | |
2655 | + * atoms -> ParEnumerable | |
2767 | 2656 | * |
2768 | 2657 | * Returns a ParEnumerable value that (formally) points to the collection of atom parameters. |
2769 | 2658 | * Parameter.atoms[x] is equivalent to Parameter.atom(x). ParEnumerable class is |
@@ -2828,7 +2717,17 @@ s_NewParEnumerableValueFromMoleculeAndType(Molecule *mol, Int parType) | ||
2828 | 2717 | return Data_Wrap_Struct(rb_cParEnumerable, 0, (void (*)(void *))s_ParEnumerableRelease, pen); |
2829 | 2718 | } |
2830 | 2719 | |
2831 | -/* [] */ | |
2720 | +/* | |
2721 | + * call-seq: | |
2722 | + * self[*args] -> ParameterRef | |
2723 | + * | |
2724 | + * Call the accessor of the Parameter object from which this ParEnumerable object is derived from. | |
2725 | + * Thus, if self is "bond" type, self[*args] is equivalent to p.bond(*args), where p is the | |
2726 | + * parent Parameter object of self. | |
2727 | + * | |
2728 | + * <b>See Also</b>: Parameter#bond, Parameter#angle, Parameter#dihedral, Parameter#improper, | |
2729 | + * Parameter#vdw, Parameter#vdw_pair, Parameter#vdw_cutoff, Parameter#atom. | |
2730 | + */ | |
2832 | 2731 | static VALUE |
2833 | 2732 | s_ParEnumerable_Aref(int argc, VALUE *argv, VALUE self) |
2834 | 2733 | { |
@@ -2850,6 +2749,12 @@ s_ParEnumerable_Aref(int argc, VALUE *argv, VALUE self) | ||
2850 | 2749 | return Qnil; /* Not reached */ |
2851 | 2750 | } |
2852 | 2751 | |
2752 | +/* | |
2753 | + * call-seq: | |
2754 | + * length -> Integer | |
2755 | + * | |
2756 | + * Returns the number of parameters included in this enumerable. | |
2757 | + */ | |
2853 | 2758 | static VALUE |
2854 | 2759 | s_ParEnumerable_Length(VALUE self) |
2855 | 2760 | { |
@@ -2871,6 +2776,12 @@ s_ParEnumerable_Length(VALUE self) | ||
2871 | 2776 | return Qnil; /* Not reached */ |
2872 | 2777 | } |
2873 | 2778 | |
2779 | +/* | |
2780 | + * call-seq: | |
2781 | + * each {|pref| ...} | |
2782 | + * | |
2783 | + * Call the block for each parameter, passing a ParameterRef object as a block argument. | |
2784 | + */ | |
2874 | 2785 | VALUE |
2875 | 2786 | s_ParEnumerable_Each(VALUE self) |
2876 | 2787 | { |
@@ -2913,6 +2824,12 @@ s_ParEnumerable_Each(VALUE self) | ||
2913 | 2824 | return self; |
2914 | 2825 | } |
2915 | 2826 | |
2827 | +/* | |
2828 | + * call-seq: | |
2829 | + * reverse_each {|pref| ...} | |
2830 | + * | |
2831 | + * Call the block for each parameter in the reverse order, passing a ParameterRef object as a block argument. | |
2832 | + */ | |
2916 | 2833 | VALUE |
2917 | 2834 | s_ParEnumerable_ReverseEach(VALUE self) |
2918 | 2835 | { |
@@ -2955,7 +2872,7 @@ s_ParEnumerable_ReverseEach(VALUE self) | ||
2955 | 2872 | |
2956 | 2873 | /* |
2957 | 2874 | * call-seq: |
2958 | - * ParEnumerable.insert(idx = nil, pref = nil) -> ParameterRef | |
2875 | + * insert(idx = nil, pref = nil) -> ParameterRef | |
2959 | 2876 | * |
2960 | 2877 | * Insert a new parameter at the specified position (if idx is nil, then at the end). |
2961 | 2878 | * If a ParameterRef is given, then the content of the parameter is copied to the new parameter, |
@@ -3007,8 +2924,8 @@ s_ParEnumerable_Insert(int argc, VALUE *argv, VALUE self) | ||
3007 | 2924 | |
3008 | 2925 | /* |
3009 | 2926 | * call-seq: |
3010 | - * ParEnumerable.delete(int) | |
3011 | - * ParEnumerable.delete(intgroup) | |
2927 | + * delete(Integer) | |
2928 | + * delete(IntGroup) | |
3012 | 2929 | * |
3013 | 2930 | * Delete the parameter(s) specified by the argument. |
3014 | 2931 | */ |
@@ -3043,8 +2960,8 @@ s_ParEnumerable_Delete(VALUE self, VALUE ival) | ||
3043 | 2960 | |
3044 | 2961 | /* |
3045 | 2962 | * call-seq: |
3046 | - * ParEnumerable.lookup(atom_types, options, ...) -> ParameterRef | |
3047 | - * ParEnumerable.lookup(atom_type_string, options, ...) -> ParameterRef | |
2963 | + * lookup(atom_types, options, ...) -> ParameterRef | |
2964 | + * lookup(atom_type_string, options, ...) -> ParameterRef | |
3048 | 2965 | * |
3049 | 2966 | * Find the parameter record that matches the given atom types. The atom types are given |
3050 | 2967 | * either as an array of string, or a single string delimited by whitespaces or hyphens. |
@@ -3773,7 +3690,14 @@ s_AtomRef_GetAttr(VALUE self, VALUE key) | ||
3773 | 3690 | |
3774 | 3691 | static int s_Molecule_AtomIndexFromValue(Molecule *, VALUE); |
3775 | 3692 | |
3776 | -/* [] */ | |
3693 | +/* | |
3694 | + * call-seq: | |
3695 | + * self[idx] -> AtomRef or Array of Integers | |
3696 | + * | |
3697 | + * Get the idx-th atom, bond, etc. for the Molecule from which this MolEnuerable object is | |
3698 | + * derived from. For the atom, the return value is AtomRef. For the residue, the return | |
3699 | + * value is a String. Otherwise, the return value is an Array of Integers. | |
3700 | + */ | |
3777 | 3701 | static VALUE |
3778 | 3702 | s_MolEnumerable_Aref(VALUE self, VALUE arg1) |
3779 | 3703 | { |
@@ -3823,6 +3747,12 @@ s_MolEnumerable_Aref(VALUE self, VALUE arg1) | ||
3823 | 3747 | return Qnil; |
3824 | 3748 | } |
3825 | 3749 | |
3750 | +/* | |
3751 | + * call-seq: | |
3752 | + * length -> Integer | |
3753 | + * | |
3754 | + * Returns the number of objects included in this enumerable. | |
3755 | + */ | |
3826 | 3756 | static VALUE |
3827 | 3757 | s_MolEnumerable_Length(VALUE self) |
3828 | 3758 | { |
@@ -3845,6 +3775,16 @@ s_MolEnumerable_Length(VALUE self) | ||
3845 | 3775 | return INT2NUM(-1); |
3846 | 3776 | } |
3847 | 3777 | |
3778 | +/* | |
3779 | + * call-seq: | |
3780 | + * each {|obj| ...} | |
3781 | + * | |
3782 | + * Call the block for each atom/bond/angle/dihedral/improper/residue. The block argument is | |
3783 | + * an AtomRef for atoms, a String for residues, and an Array of Integers for others. | |
3784 | + * For the atoms, a same AtomRef object is passed (with different internal information) | |
3785 | + * for each invocation of block. Otherwise, a new Ruby object will be created and passed | |
3786 | + * for each iteration. | |
3787 | + */ | |
3848 | 3788 | VALUE |
3849 | 3789 | s_MolEnumerable_Each(VALUE self) |
3850 | 3790 | { |
@@ -3936,7 +3876,7 @@ s_Molecule_Alloc(VALUE klass) | ||
3936 | 3876 | |
3937 | 3877 | /* |
3938 | 3878 | * call-seq: |
3939 | - * molecule.dup -> molecule | |
3879 | + * dup -> Molecule | |
3940 | 3880 | * |
3941 | 3881 | * Duplicate a molecule. All entries are deep copied, so modifying the newly |
3942 | 3882 | * created object does not affect the old object in any sense. |
@@ -3954,7 +3894,7 @@ s_Molecule_InitCopy(VALUE self, VALUE arg) | ||
3954 | 3894 | |
3955 | 3895 | /* |
3956 | 3896 | * call-seq: |
3957 | - * molecule.loadmbsf(file) -> boolean | |
3897 | + * loadmbsf(file) -> bool | |
3958 | 3898 | * |
3959 | 3899 | * Read a structure from a mbsf file. |
3960 | 3900 | * Return true if successful. |
@@ -3981,7 +3921,7 @@ s_Molecule_Loadmbsf(int argc, VALUE *argv, VALUE self) | ||
3981 | 3921 | |
3982 | 3922 | /* |
3983 | 3923 | * call-seq: |
3984 | - * molecule.loadpsf(file, pdbfile = nil) -> boolean | |
3924 | + * loadpsf(file, pdbfile = nil) -> bool | |
3985 | 3925 | * |
3986 | 3926 | * Read a structure from a psf file. molecule must be empty. The psf may be |
3987 | 3927 | * an "extended" version, which also contains coordinates. If pdbfile |
@@ -4036,7 +3976,7 @@ s_Molecule_Loadpsf(int argc, VALUE *argv, VALUE self) | ||
4036 | 3976 | |
4037 | 3977 | /* |
4038 | 3978 | * call-seq: |
4039 | - * molecule.loadpdb(file) -> boolean | |
3979 | + * loadpdb(file) -> bool | |
4040 | 3980 | * |
4041 | 3981 | * Read coordinates from a pdb file. If molecule is empty, then structure is build |
4042 | 3982 | * by use of CONECT instructions. Otherwise, only the coordinates are read in. |
@@ -4064,7 +4004,7 @@ s_Molecule_Loadpdb(int argc, VALUE *argv, VALUE self) | ||
4064 | 4004 | |
4065 | 4005 | /* |
4066 | 4006 | * call-seq: |
4067 | - * molecule.loaddcd(file) -> boolean | |
4007 | + * loaddcd(file) -> bool | |
4068 | 4008 | * |
4069 | 4009 | * Read coordinates from a dcd file. The molecule should not empty. |
4070 | 4010 | * Return true if successful. |
@@ -4091,7 +4031,7 @@ s_Molecule_Loaddcd(int argc, VALUE *argv, VALUE self) | ||
4091 | 4031 | |
4092 | 4032 | /* |
4093 | 4033 | * call-seq: |
4094 | - * molecule.loadtep(file) -> boolean | |
4034 | + * loadtep(file) -> bool | |
4095 | 4035 | * |
4096 | 4036 | * Read coordinates from an ortep .tep file. |
4097 | 4037 | * Return true if successful. |
@@ -4118,7 +4058,7 @@ s_Molecule_Loadtep(int argc, VALUE *argv, VALUE self) | ||
4118 | 4058 | |
4119 | 4059 | /* |
4120 | 4060 | * call-seq: |
4121 | - * molecule.loadres(file) -> boolean | |
4061 | + * loadres(file) -> bool | |
4122 | 4062 | * |
4123 | 4063 | * Read coordinates from a shelx .res file. |
4124 | 4064 | * Return true if successful. |
@@ -4145,7 +4085,7 @@ s_Molecule_Loadres(int argc, VALUE *argv, VALUE self) | ||
4145 | 4085 | |
4146 | 4086 | /* |
4147 | 4087 | * call-seq: |
4148 | - * molecule.loadfchk(file) -> boolean | |
4088 | + * loadfchk(file) -> bool | |
4149 | 4089 | * |
4150 | 4090 | * Read coordinates and MO information from a Gaussian fchk file. (TODO: implement this) |
4151 | 4091 | * Return true if successful. |
@@ -4172,7 +4112,7 @@ s_Molecule_Loadfchk(int argc, VALUE *argv, VALUE self) | ||
4172 | 4112 | |
4173 | 4113 | /* |
4174 | 4114 | * call-seq: |
4175 | - * molecule.loaddat(file) -> boolean | |
4115 | + * loaddat(file) -> bool | |
4176 | 4116 | * |
4177 | 4117 | * Read coordinates and ESP information from a GAMESS dat file. (TODO: read MO info as well) |
4178 | 4118 | * Return true if successful. |
@@ -4199,7 +4139,7 @@ s_Molecule_Loaddat(int argc, VALUE *argv, VALUE self) | ||
4199 | 4139 | |
4200 | 4140 | /* |
4201 | 4141 | * call-seq: |
4202 | - * molecule.savembsf(file) -> boolean | |
4142 | + * savembsf(file) -> bool | |
4203 | 4143 | * |
4204 | 4144 | * Write structure as a mbsf file. Returns true if successful. |
4205 | 4145 | */ |
@@ -4218,7 +4158,7 @@ s_Molecule_Savembsf(VALUE self, VALUE fname) | ||
4218 | 4158 | |
4219 | 4159 | /* |
4220 | 4160 | * call-seq: |
4221 | - * molecule.savepsf(file) -> boolean | |
4161 | + * savepsf(file) -> bool | |
4222 | 4162 | * |
4223 | 4163 | * Write structure as a psf file. Returns true if successful. |
4224 | 4164 | */ |
@@ -4237,7 +4177,7 @@ s_Molecule_Savepsf(VALUE self, VALUE fname) | ||
4237 | 4177 | |
4238 | 4178 | /* |
4239 | 4179 | * call-seq: |
4240 | - * molecule.savepdb(file) -> boolean | |
4180 | + * savepdb(file) -> bool | |
4241 | 4181 | * |
4242 | 4182 | * Write coordinates as a pdb file. Returns true if successful. |
4243 | 4183 | */ |
@@ -4256,7 +4196,7 @@ s_Molecule_Savepdb(VALUE self, VALUE fname) | ||
4256 | 4196 | |
4257 | 4197 | /* |
4258 | 4198 | * call-seq: |
4259 | - * molecule.savedcd(file) -> boolean | |
4199 | + * savedcd(file) -> bool | |
4260 | 4200 | * |
4261 | 4201 | * Write coordinates as a dcd file. Returns true if successful. |
4262 | 4202 | */ |
@@ -4275,7 +4215,7 @@ s_Molecule_Savedcd(VALUE self, VALUE fname) | ||
4275 | 4215 | |
4276 | 4216 | /* |
4277 | 4217 | * call-seq: |
4278 | - * molecule.savetep(file) -> boolean | |
4218 | + * savetep(file) -> bool | |
4279 | 4219 | * |
4280 | 4220 | * Write coordinates as an ORTEP file. Returns true if successful. |
4281 | 4221 | */ |
@@ -4353,31 +4293,12 @@ s_Molecule_LoadSave(int argc, VALUE *argv, VALUE self, int loadFlag) | ||
4353 | 4293 | } |
4354 | 4294 | } |
4355 | 4295 | } |
4356 | -#if 0 | |
4357 | - if (loadFlag) { | |
4358 | - /* Try all "loadXXX" (public) methods */ | |
4359 | - ID midsave = mid; | |
4360 | - rval = rb_funcall(self, rb_intern("methods"), 0); | |
4361 | - vp = RARRAY_PTR(rval); | |
4362 | - for (i = RARRAY_LEN(rval) - 1; i >= 0; i--) { | |
4363 | - p = RSTRING_PTR(vp[i]); | |
4364 | - if (strncmp(p, "load", 4) == 0 && strlen(p) > 4) { | |
4365 | - mid = rb_to_id(vp[i]); | |
4366 | - if (midsave != 0 && mid == midsave) | |
4367 | - continue; | |
4368 | - rval = rb_funcall2(self, mid, argc, argv); | |
4369 | - if (rval != Qnil) | |
4370 | - return rval; /* Successful */ | |
4371 | - } | |
4372 | - } | |
4373 | - } | |
4374 | -#endif | |
4375 | 4296 | rb_raise(rb_eMolbyError, "the file %s cannot be %s", argstr, (loadFlag ? "loaded" : "saved")); |
4376 | 4297 | } |
4377 | 4298 | |
4378 | 4299 | /* |
4379 | 4300 | * call-seq: |
4380 | - * molecule.molload(file, *args) -> boolean | |
4301 | + * molload(file, *args) -> bool | |
4381 | 4302 | * |
4382 | 4303 | * Read a structure from the given file by calling the public method "loadXXX" (XXX is the |
4383 | 4304 | * file type given by the extension). If this method fails, then all defined (public) |
@@ -4391,7 +4312,7 @@ s_Molecule_Load(int argc, VALUE *argv, VALUE self) | ||
4391 | 4312 | |
4392 | 4313 | /* |
4393 | 4314 | * call-seq: |
4394 | - * molecule.molsave(file, *args) -> boolean | |
4315 | + * molsave(file, *args) -> bool | |
4395 | 4316 | * |
4396 | 4317 | * Write a structure/coordinate to the given file by calling the public method "saveXXX" |
4397 | 4318 | * (XXX is the file type given by the extension). |
@@ -4404,7 +4325,7 @@ s_Molecule_Save(int argc, VALUE *argv, VALUE self) | ||
4404 | 4325 | |
4405 | 4326 | /* |
4406 | 4327 | * call-seq: |
4407 | - * molecule.name -> string | |
4328 | + * name -> String | |
4408 | 4329 | * |
4409 | 4330 | * Returns the display name of the molecule. If the molecule has no associated |
4410 | 4331 | * document, then returns nil. |
@@ -4424,7 +4345,7 @@ s_Molecule_Name(VALUE self) | ||
4424 | 4345 | |
4425 | 4346 | /* |
4426 | 4347 | * call-seq: |
4427 | - * molecule.path -> string | |
4348 | + * path -> String | |
4428 | 4349 | * |
4429 | 4350 | * Returns the full path name of the molecule, if it is associated with a file. |
4430 | 4351 | * If the molecule has no associated file, then returns nil. |
@@ -4444,7 +4365,7 @@ s_Molecule_Path(VALUE self) | ||
4444 | 4365 | |
4445 | 4366 | /* |
4446 | 4367 | * call-seq: |
4447 | - * molecule.dir -> string | |
4368 | + * dir -> String | |
4448 | 4369 | * |
4449 | 4370 | * Returns the full path name of the directory in which the file associated with the |
4450 | 4371 | * molecule is located. If the molecule has no associated file, then returns nil. |
@@ -4471,7 +4392,7 @@ s_Molecule_Dir(VALUE self) | ||
4471 | 4392 | |
4472 | 4393 | /* |
4473 | 4394 | * call-seq: |
4474 | - * molecule.inspect -> string | |
4395 | + * inspect -> String | |
4475 | 4396 | * |
4476 | 4397 | * Returns a string in the form "Molecule[name]" if the molecule has the associated |
4477 | 4398 | * document. Otherwise, a string "<Molecule:0x****>" (the address is the address of |
@@ -4512,9 +4433,9 @@ s_Molecule_Inspect(VALUE self) | ||
4512 | 4433 | |
4513 | 4434 | /* |
4514 | 4435 | * call-seq: |
4515 | - * Molecule.open(file) -> molecule | |
4436 | + * open(file) -> Molecule | |
4516 | 4437 | * |
4517 | - * Create a new molecule from file. This assumes MoleculeCallback_openNewMolecule() is implemented. | |
4438 | + * Create a new molecule from file. | |
4518 | 4439 | */ |
4519 | 4440 | static VALUE |
4520 | 4441 | s_Molecule_Open(VALUE self, VALUE fname) |
@@ -4532,8 +4453,7 @@ s_Molecule_Open(VALUE self, VALUE fname) | ||
4532 | 4453 | |
4533 | 4454 | /* |
4534 | 4455 | * call-seq: |
4535 | - * Molecule.new(file, *args) -> molecule | |
4536 | - * molecule.initialize(file, *args) | |
4456 | + * new(file, *args) -> Molecule | |
4537 | 4457 | * |
4538 | 4458 | * Create a new molecule and call "load" method with the same arguments. |
4539 | 4459 | */ |
@@ -4557,7 +4477,7 @@ s_Molecule_MolEnumerable(VALUE self, int kind) | ||
4557 | 4477 | |
4558 | 4478 | /* |
4559 | 4479 | * call-seq: |
4560 | - * molecule.atoms -> MolEnumerable | |
4480 | + * atoms -> MolEnumerable | |
4561 | 4481 | * |
4562 | 4482 | * Returns a MolEnumerable object representing the array of atoms. |
4563 | 4483 | */ |
@@ -4569,7 +4489,7 @@ s_Molecule_Atoms(VALUE self) | ||
4569 | 4489 | |
4570 | 4490 | /* |
4571 | 4491 | * call-seq: |
4572 | - * molecule.bonds -> MolEnumerable | |
4492 | + * bonds -> MolEnumerable | |
4573 | 4493 | * |
4574 | 4494 | * Returns a MolEnumerable object representing the array of bonds. A bond is represented |
4575 | 4495 | * by an array of two atom indices. |
@@ -4582,7 +4502,7 @@ s_Molecule_Bonds(VALUE self) | ||
4582 | 4502 | |
4583 | 4503 | /* |
4584 | 4504 | * call-seq: |
4585 | - * molecule.angles -> MolEnumerable | |
4505 | + * angles -> MolEnumerable | |
4586 | 4506 | * |
4587 | 4507 | * Returns a MolEnumerable object representing the array of angles. An angle is represented |
4588 | 4508 | * by an array of three atom indices. |
@@ -4595,7 +4515,7 @@ s_Molecule_Angles(VALUE self) | ||
4595 | 4515 | |
4596 | 4516 | /* |
4597 | 4517 | * call-seq: |
4598 | - * molecule.dihedrals -> MolEnumerable | |
4518 | + * dihedrals -> MolEnumerable | |
4599 | 4519 | * |
4600 | 4520 | * Returns a MolEnumerable object representing the array of dihedrals. A dihedral is represented |
4601 | 4521 | * by an array of four atom indices. |
@@ -4608,7 +4528,7 @@ s_Molecule_Dihedrals(VALUE self) | ||
4608 | 4528 | |
4609 | 4529 | /* |
4610 | 4530 | * call-seq: |
4611 | - * molecule.impropers -> MolEnumerable | |
4531 | + * impropers -> MolEnumerable | |
4612 | 4532 | * |
4613 | 4533 | * Returns a MolEnumerable object representing the array of impropers. An improper is represented |
4614 | 4534 | * by an array of four atom indices. |
@@ -4621,7 +4541,7 @@ s_Molecule_Impropers(VALUE self) | ||
4621 | 4541 | |
4622 | 4542 | /* |
4623 | 4543 | * call-seq: |
4624 | - * molecule.residues -> MolEnumerable | |
4544 | + * residues -> MolEnumerable | |
4625 | 4545 | * |
4626 | 4546 | * Returns a MolEnumerable object representing the array of residue names. |
4627 | 4547 | */ |
@@ -4633,7 +4553,7 @@ s_Molecule_Residues(VALUE self) | ||
4633 | 4553 | |
4634 | 4554 | /* |
4635 | 4555 | * call-seq: |
4636 | - * molecule.natoms -> int | |
4556 | + * natoms -> Integer | |
4637 | 4557 | * |
4638 | 4558 | * Returns the number of atoms. |
4639 | 4559 | */ |
@@ -4647,7 +4567,7 @@ s_Molecule_Natoms(VALUE self) | ||
4647 | 4567 | |
4648 | 4568 | /* |
4649 | 4569 | * call-seq: |
4650 | - * molecule.nbonds -> int | |
4570 | + * nbonds -> Integer | |
4651 | 4571 | * |
4652 | 4572 | * Returns the number of bonds. |
4653 | 4573 | */ |
@@ -4661,7 +4581,7 @@ s_Molecule_Nbonds(VALUE self) | ||
4661 | 4581 | |
4662 | 4582 | /* |
4663 | 4583 | * call-seq: |
4664 | - * molecule.nangles -> int | |
4584 | + * nangles -> Integer | |
4665 | 4585 | * |
4666 | 4586 | * Returns the number of angles. |
4667 | 4587 | */ |
@@ -4675,7 +4595,7 @@ s_Molecule_Nangles(VALUE self) | ||
4675 | 4595 | |
4676 | 4596 | /* |
4677 | 4597 | * call-seq: |
4678 | - * molecule.ndihedrals -> int | |
4598 | + * ndihedrals -> Integer | |
4679 | 4599 | * |
4680 | 4600 | * Returns the number of dihedrals. |
4681 | 4601 | */ |
@@ -4689,7 +4609,7 @@ s_Molecule_Ndihedrals(VALUE self) | ||
4689 | 4609 | |
4690 | 4610 | /* |
4691 | 4611 | * call-seq: |
4692 | - * molecule.nimpropers -> int | |
4612 | + * nimpropers -> Integer | |
4693 | 4613 | * |
4694 | 4614 | * Returns the number of impropers. |
4695 | 4615 | */ |
@@ -4703,7 +4623,7 @@ s_Molecule_Nimpropers(VALUE self) | ||
4703 | 4623 | |
4704 | 4624 | /* |
4705 | 4625 | * call-seq: |
4706 | - * molecule.nresidues -> int | |
4626 | + * nresidues -> Integer | |
4707 | 4627 | * |
4708 | 4628 | * Returns the number of residues. |
4709 | 4629 | */ |
@@ -4717,7 +4637,7 @@ s_Molecule_Nresidues(VALUE self) | ||
4717 | 4637 | |
4718 | 4638 | /* |
4719 | 4639 | * call-seq: |
4720 | - * molecule.start_step -> int | |
4640 | + * start_step -> Integer | |
4721 | 4641 | * |
4722 | 4642 | * Returns the start step (defined by dcd format). |
4723 | 4643 | */ |
@@ -4731,7 +4651,7 @@ s_Molecule_StartStep(VALUE self) | ||
4731 | 4651 | |
4732 | 4652 | /* |
4733 | 4653 | * call-seq: |
4734 | - * molecule.start_step = int | |
4654 | + * start_step = Integer | |
4735 | 4655 | * |
4736 | 4656 | * Set the start step (defined by dcd format). |
4737 | 4657 | */ |
@@ -4746,7 +4666,7 @@ s_Molecule_SetStartStep(VALUE self, VALUE val) | ||
4746 | 4666 | |
4747 | 4667 | /* |
4748 | 4668 | * call-seq: |
4749 | - * molecule.steps_per_frame -> int | |
4669 | + * steps_per_frame -> Integer | |
4750 | 4670 | * |
4751 | 4671 | * Returns the number of steps between frames (defined by dcd format). |
4752 | 4672 | */ |
@@ -4760,7 +4680,7 @@ s_Molecule_StepsPerFrame(VALUE self) | ||
4760 | 4680 | |
4761 | 4681 | /* |
4762 | 4682 | * call-seq: |
4763 | - * molecule.steps_per_frame = int | |
4683 | + * steps_per_frame = Integer | |
4764 | 4684 | * |
4765 | 4685 | * Set the number of steps between frames (defined by dcd format). |
4766 | 4686 | */ |
@@ -4775,7 +4695,7 @@ s_Molecule_SetStepsPerFrame(VALUE self, VALUE val) | ||
4775 | 4695 | |
4776 | 4696 | /* |
4777 | 4697 | * call-seq: |
4778 | - * molecule.ps_per_step -> float | |
4698 | + * ps_per_step -> Float | |
4779 | 4699 | * |
4780 | 4700 | * Returns the time increment (in picoseconds) for one step (defined by dcd format). |
4781 | 4701 | */ |
@@ -4789,7 +4709,7 @@ s_Molecule_PsPerStep(VALUE self) | ||
4789 | 4709 | |
4790 | 4710 | /* |
4791 | 4711 | * call-seq: |
4792 | - * molecule.ps_per_step = float | |
4712 | + * ps_per_step = Float | |
4793 | 4713 | * |
4794 | 4714 | * Set the time increment (in picoseconds) for one step (defined by dcd format). |
4795 | 4715 | */ |
@@ -4804,9 +4724,9 @@ s_Molecule_SetPsPerStep(VALUE self, VALUE val) | ||
4804 | 4724 | |
4805 | 4725 | /* |
4806 | 4726 | * call-seq: |
4807 | - * molecule.find_angles -> int (added number of angles) | |
4727 | + * find_angles -> Integer | |
4808 | 4728 | * |
4809 | - * Find the angles from the bonds | |
4729 | + * Find the angles from the bonds. Returns the number of angles newly created. | |
4810 | 4730 | */ |
4811 | 4731 | static VALUE |
4812 | 4732 | s_Molecule_FindAngles(VALUE self) |
@@ -4841,9 +4761,9 @@ s_Molecule_FindAngles(VALUE self) | ||
4841 | 4761 | |
4842 | 4762 | /* |
4843 | 4763 | * call-seq: |
4844 | - * molecule.find_dihedrals -> int (added number of dihedrals) | |
4764 | + * find_dihedrals -> Integer | |
4845 | 4765 | * |
4846 | - * Find the dihedrals from the bonds | |
4766 | + * Find the dihedrals from the bonds. Returns the number of dihedrals newly created. | |
4847 | 4767 | */ |
4848 | 4768 | static VALUE |
4849 | 4769 | s_Molecule_FindDihedrals(VALUE self) |
@@ -4889,10 +4809,9 @@ s_Molecule_FindDihedrals(VALUE self) | ||
4889 | 4809 | |
4890 | 4810 | /* |
4891 | 4811 | * call-seq: |
4892 | - * molecule.nresidues = integer | |
4812 | + * nresidues = Integer | |
4893 | 4813 | * |
4894 | - * Change the number of residues. If the result is not equal to the argument, | |
4895 | - * exception is thrown. This operation is undoable. | |
4814 | + * Change the number of residues. | |
4896 | 4815 | */ |
4897 | 4816 | static VALUE |
4898 | 4817 | s_Molecule_ChangeNresidues(VALUE self, VALUE val) |
@@ -4908,7 +4827,7 @@ s_Molecule_ChangeNresidues(VALUE self, VALUE val) | ||
4908 | 4827 | |
4909 | 4828 | /* |
4910 | 4829 | * call-seq: |
4911 | - * molecule.max_residue_number(atom_group = nil) -> int | |
4830 | + * max_residue_number(atom_group = nil) -> Integer | |
4912 | 4831 | * |
4913 | 4832 | * Returns the maximum residue number actually used. If an atom group is given, only |
4914 | 4833 | * these atoms are examined. If no atom is present, nil is returned. |
@@ -4929,7 +4848,7 @@ s_Molecule_MaxResSeq(int argc, VALUE *argv, VALUE self) | ||
4929 | 4848 | |
4930 | 4849 | /* |
4931 | 4850 | * call-seq: |
4932 | - * molecule.min_residue_number(atom_group = nil) -> int | |
4851 | + * min_residue_number(atom_group = nil) -> Integer | |
4933 | 4852 | * |
4934 | 4853 | * Returns the minimum residue number actually used. If an atom group is given, only |
4935 | 4854 | * these atoms are examined. If no atom is present, nil is returned. |
@@ -4950,7 +4869,7 @@ s_Molecule_MinResSeq(int argc, VALUE *argv, VALUE self) | ||
4950 | 4869 | |
4951 | 4870 | /* |
4952 | 4871 | * call-seq: |
4953 | - * molecule.each_atom block | |
4872 | + * each_atom {|aref| ...} | |
4954 | 4873 | * |
4955 | 4874 | * Execute the block, with the AtomRef object for each atom as the argument. |
4956 | 4875 | * Equivalent to self.atoms.each, except that the return value is self (a Molecule object). |
@@ -4974,9 +4893,9 @@ s_Molecule_EachAtom(VALUE self) | ||
4974 | 4893 | |
4975 | 4894 | /* |
4976 | 4895 | * call-seq: |
4977 | - * molecule.cell -> array [a, b, c, alpha, beta, gamma] | |
4896 | + * cell -> [a, b, c, alpha, beta, gamma] | |
4978 | 4897 | * |
4979 | - * Returns the cell parameters. If cell is not set, returns nil. | |
4898 | + * Returns the unit cell parameters. If cell is not set, returns nil. | |
4980 | 4899 | */ |
4981 | 4900 | static VALUE |
4982 | 4901 | s_Molecule_Cell(VALUE self) |
@@ -4995,10 +4914,10 @@ s_Molecule_Cell(VALUE self) | ||
4995 | 4914 | |
4996 | 4915 | /* |
4997 | 4916 | * call-seq: |
4998 | - * molecule.cell = [a, b, c, alpha, beta, gamma] | |
4917 | + * cell = [a, b, c, alpha, beta, gamma] | |
4999 | 4918 | * set_cell([a, b, c, alpha, beta, gamma], flag = nil) |
5000 | 4919 | * |
5001 | - * Set the cell parameters. If the cell value is nil, then clear the current cell. | |
4920 | + * Set the unit cell parameters. If the cell value is nil, then clear the current cell. | |
5002 | 4921 | This operation is undoable. If the second argument is given as non-nil, then |
5003 | 4922 | the coordinates are transformed so that the cartesian coordinates remain the same. |
5004 | 4923 | */ |
@@ -5045,8 +4964,10 @@ s_Molecule_CellTransform(VALUE self) | ||
5045 | 4964 | * call-seq: |
5046 | 4965 | * box -> [avec, bvec, cvec, origin, flags] |
5047 | 4966 | * |
5048 | - * Get the unit cell as a periodic bounding box. Avec, bvec, cvec, origin are Vector3D objects, and | |
5049 | - flags is a 3-member array of integers. If no unit cell is defined, nil is returned. | |
4967 | + * Get the unit cell information in the form of a periodic bounding box. | |
4968 | + * Avec, bvec, cvec, origin are Vector3D objects, and flags is a 3-member array of | |
4969 | + * Integers which define whether the system is periodic along the axis. | |
4970 | + * If no unit cell is defined, nil is returned. | |
5050 | 4971 | */ |
5051 | 4972 | static VALUE |
5052 | 4973 | s_Molecule_Box(VALUE self) |
@@ -5074,8 +4995,9 @@ s_Molecule_Box(VALUE self) | ||
5074 | 4995 | * Set the unit cell parameters. Avec, bvec, and cvec can be either a Vector3D or a number. |
5075 | 4996 | If it is a number, the x/y/z axis vector is multiplied with the given number and used |
5076 | 4997 | as the box vector. |
5077 | - Flags, if present, is a 3-member array of integers representing the periodic flags. | |
5078 | - In the second form, an isotropic box with dimension d is set. | |
4998 | + Flags, if present, is a 3-member array of Integers defining whether the system is | |
4999 | + periodic along the axis. | |
5000 | + In the second form, an isotropic box with cell-length d is set. | |
5079 | 5001 | In the third form, the existing box is cleared. |
5080 | 5002 | */ |
5081 | 5003 | static VALUE |
@@ -5127,28 +5049,10 @@ s_Molecule_SetBox(int argc, VALUE *argv, VALUE self) | ||
5127 | 5049 | return self; |
5128 | 5050 | } |
5129 | 5051 | |
5130 | -#if 0 | |
5131 | 5052 | /* |
5132 | 5053 | * call-seq: |
5133 | - * box_transform -> Transform | |
5134 | - * | |
5135 | - * Get the transform matrix that converts internal coordinates for the periodic box | |
5136 | - * to cartesian coordinates. If the periodic box is not defined, nil is returned. | |
5137 | - */ | |
5138 | -static VALUE | |
5139 | -s_Molecule_BoxTransform(VALUE self) | |
5140 | -{ | |
5141 | - Molecule *mol; | |
5142 | - Data_Get_Struct(self, Molecule, mol); | |
5143 | - if (mol == NULL || mol->box == NULL) | |
5144 | - return Qnil; | |
5145 | - return ValueFromTransform(&(mol->box->tr)); | |
5146 | -} | |
5147 | -#endif | |
5148 | - | |
5149 | -/* | |
5150 | - * call-seq: | |
5151 | - * molecule.symmetry -> array of Transform | |
5054 | + * symmetry -> Array of Transforms | |
5055 | + * symmetries -> Array of Transforms | |
5152 | 5056 | * |
5153 | 5057 | * Get the currently defined symmetry operations. If no symmetry operation is defined, |
5154 | 5058 | * returns an empty array. |
@@ -5171,7 +5075,7 @@ s_Molecule_Symmetry(VALUE self) | ||
5171 | 5075 | |
5172 | 5076 | /* |
5173 | 5077 | * call-seq: |
5174 | - * molecule.nsymmetries -> integer | |
5078 | + * nsymmetries -> Integer | |
5175 | 5079 | * |
5176 | 5080 | * Get the number of currently defined symmetry operations. |
5177 | 5081 | */ |
@@ -5185,10 +5089,12 @@ s_Molecule_Nsymmetries(VALUE self) | ||
5185 | 5089 | |
5186 | 5090 | /* |
5187 | 5091 | * call-seq: |
5188 | - * molecule.add_symmetry(Transform) -> integer (number of total transforms) | |
5092 | + * add_symmetry(Transform) -> Integer | |
5189 | 5093 | * |
5190 | - * Add a new symmetry operation. If no symmetry operation is defined, then add an identity | |
5191 | - * transform as the index 0, then the new symmetry operation is appended. | |
5094 | + * Add a new symmetry operation. If no symmetry operation is defined and the | |
5095 | + * given argument is not an identity transform, then also add an identity | |
5096 | + * transform at the index 0. | |
5097 | + * Returns the total number of symmetries after operation. | |
5192 | 5098 | */ |
5193 | 5099 | static VALUE |
5194 | 5100 | s_Molecule_AddSymmetry(VALUE self, VALUE trans) |
@@ -5203,10 +5109,12 @@ s_Molecule_AddSymmetry(VALUE self, VALUE trans) | ||
5203 | 5109 | |
5204 | 5110 | /* |
5205 | 5111 | * call-seq: |
5206 | - * molecule.remove_symmetry(count = nil) -> integer (number of total transforms) | |
5112 | + * remove_symmetry(count = nil) -> Integer | |
5113 | + * remove_symmetries(count = nil) -> Integer | |
5207 | 5114 | * |
5208 | 5115 | * Remove the specified number of symmetry operations. The last added ones are removed |
5209 | - * first. If count is nil, then all symmetry operations are removed. | |
5116 | + * first. If count is nil, then all symmetry operations are removed. Returns the | |
5117 | + * number of leftover symmetries. | |
5210 | 5118 | */ |
5211 | 5119 | static VALUE |
5212 | 5120 | s_Molecule_RemoveSymmetry(int argc, VALUE *argv, VALUE self) |
@@ -5227,7 +5135,7 @@ s_Molecule_RemoveSymmetry(int argc, VALUE *argv, VALUE self) | ||
5227 | 5135 | } |
5228 | 5136 | for (i = 0; i < n; i++) |
5229 | 5137 | MolActionCreateAndPerform(mol, gMolActionDeleteSymmetryOperation); |
5230 | - return self; | |
5138 | + return INT2NUM(mol->nsyms); | |
5231 | 5139 | } |
5232 | 5140 | |
5233 | 5141 | static VALUE |
@@ -5242,19 +5150,16 @@ s_Molecule_AtomGroup_i(VALUE arg, VALUE values) | ||
5242 | 5150 | |
5243 | 5151 | /* |
5244 | 5152 | * call-seq: |
5245 | - * molecule.atom_group | |
5246 | - * molecule.atom_group { block } | |
5247 | - * molecule.atom_group(arg1, arg2, ...) | |
5248 | - * molecule.atom_group(arg1, arg2, ...) { block } | |
5249 | - * argN is either integer, string, intGroup, or array-like object | |
5153 | + * atom_group | |
5154 | + * atom_group {|aref| ...} | |
5155 | + * atom_group(arg1, arg2, ...) | |
5156 | + * atom_group(arg1, arg2, ...) {|aref| ...} | |
5250 | 5157 | * |
5251 | - * Specify a group of atoms. If no arguments are given, IntGroup[0..natoms] is the result. | |
5252 | - * If arguments are given, then the atoms reprensented by the arguments are combined (the | |
5253 | - * arguments are not scanned recursively; i.e. if arg1 is an array of intGroups, the intGroups | |
5254 | - * are not scanned for component integers and exception will fire because intGroups cannot | |
5255 | - * be coerced into an integer). For a conversion of a string to an atom index, see description | |
5256 | - * of <code>Molecule#atom_index<code>. | |
5257 | - * If block is given, the block is evaluated with an AtomRef (not atom index integers!) | |
5158 | + * Specify a group of atoms. If no arguments are given, IntGroup\[0...natoms] is the result. | |
5159 | + * If arguments are given, then the atoms reprensented by the arguments are added to the | |
5160 | + * group. For a conversion of a string to an atom index, see the description | |
5161 | + * of Molecule#atom_index. | |
5162 | + * If a block is given, it is evaluated with an AtomRef (not atom index integers) | |
5258 | 5163 | * representing each atom, and the atoms are removed from the result if the block returns false. |
5259 | 5164 | * |
5260 | 5165 | */ |
@@ -5319,7 +5224,7 @@ s_Molecule_AtomGroup(int argc, VALUE *argv, VALUE self) | ||
5319 | 5224 | |
5320 | 5225 | /* |
5321 | 5226 | * call-seq: |
5322 | - * molecule.atom_index(val) -> int | |
5227 | + * atom_index(val) -> Integer | |
5323 | 5228 | * |
5324 | 5229 | * Returns the atom index represented by val. val can be either a non-negative integer |
5325 | 5230 | * (directly representing the atom index), a negative integer (representing <code>natoms - val</code>), |
@@ -5338,7 +5243,7 @@ s_Molecule_AtomIndex(VALUE self, VALUE val) | ||
5338 | 5243 | |
5339 | 5244 | /* |
5340 | 5245 | * call-seq: |
5341 | - * molecule.extract(group, dummy_flag = nil) -> molecule | |
5246 | + * extract(group, dummy_flag = nil) -> Molecule | |
5342 | 5247 | * |
5343 | 5248 | * Extract the atoms given by group and return as a new molecule object. |
5344 | 5249 | * If dummy_flag is true, then the atoms that are not included in the group but are connected |
@@ -5368,7 +5273,7 @@ s_Molecule_Extract(int argc, VALUE *argv, VALUE self) | ||
5368 | 5273 | |
5369 | 5274 | /* |
5370 | 5275 | * call-seq: |
5371 | - * molecule.add(molecule2) -> molecule | |
5276 | + * add(molecule2) -> self | |
5372 | 5277 | * |
5373 | 5278 | * Combine two molecules. The residue numbers of the newly added atoms may be renumbered to avoid |
5374 | 5279 | conflicts. |
@@ -5380,7 +5285,6 @@ s_Molecule_Add(VALUE self, VALUE val) | ||
5380 | 5285 | Molecule *mol1, *mol2; |
5381 | 5286 | Data_Get_Struct(self, Molecule, mol1); |
5382 | 5287 | mol2 = MoleculeFromValue(val); |
5383 | -// MoleculeMerge(mol1, mol2, NULL, mol1->nresidues - 1); | |
5384 | 5288 | MolActionCreateAndPerform(mol1, gMolActionMergeMolecule, mol2, NULL); |
5385 | 5289 | return self; |
5386 | 5290 | } |
@@ -5395,7 +5299,7 @@ s_Molecule_Duplicate(VALUE self) | ||
5395 | 5299 | |
5396 | 5300 | /* |
5397 | 5301 | * call-seq: |
5398 | - * molecule.remove(group) -> molecule | |
5302 | + * remove(group) -> Molecule | |
5399 | 5303 | * |
5400 | 5304 | * The atoms designated by the given group are removed from the molecule. |
5401 | 5305 | * This operation is undoable. |
@@ -5448,7 +5352,7 @@ s_Molecule_Remove(VALUE self, VALUE group) | ||
5448 | 5352 | |
5449 | 5353 | /* |
5450 | 5354 | * call-seq: |
5451 | - * molecule.create_atom(name, pos = -1) -> AtomRef | |
5355 | + * create_atom(name, pos = -1) -> AtomRef | |
5452 | 5356 | * |
5453 | 5357 | * Create a new atom with the specified name (may contain residue |
5454 | 5358 | * information) and position (if position is out of range, the atom is appended at |
@@ -5490,7 +5394,7 @@ s_Molecule_CreateAnAtom(int argc, VALUE *argv, VALUE self) | ||
5490 | 5394 | |
5491 | 5395 | /* |
5492 | 5396 | * call-seq: |
5493 | - * molecule.duplicate_atom(atomref, pos = -1) -> AtomRef | |
5397 | + * duplicate_atom(atomref, pos = -1) -> AtomRef | |
5494 | 5398 | * |
5495 | 5399 | * Create a new atom with the same attributes (but no bonding information) |
5496 | 5400 | * with the specified atom. Returns the reference to the new atom. |
@@ -5534,7 +5438,7 @@ s_Molecule_DuplicateAnAtom(int argc, VALUE *argv, VALUE self) | ||
5534 | 5438 | |
5535 | 5439 | /* |
5536 | 5440 | * call-seq: |
5537 | - * molecule.create_bond(n1, n2, ...) -> molecule | |
5441 | + * create_bond(n1, n2, ...) -> Molecule | |
5538 | 5442 | * |
5539 | 5443 | * Create bonds between atoms n1 and n2, n3 and n4, and so on. Returns self. |
5540 | 5444 | * This operation is undoable. |
@@ -5568,7 +5472,7 @@ s_Molecule_CreateBond(int argc, VALUE *argv, VALUE self) | ||
5568 | 5472 | |
5569 | 5473 | /* |
5570 | 5474 | * call-seq: |
5571 | - * molecule.add_angle(n1, n2, n3) -> molecule | |
5475 | + * add_angle(n1, n2, n3) -> Molecule | |
5572 | 5476 | * |
5573 | 5477 | * Add angle n1-n2-n3. Returns self. Usually, angles are automatically added |
5574 | 5478 | * when a bond is created, so it is rarely necessary to use this method explicitly. |
@@ -5592,7 +5496,7 @@ s_Molecule_AddAngle(VALUE self, VALUE v1, VALUE v2, VALUE v3) | ||
5592 | 5496 | |
5593 | 5497 | /* |
5594 | 5498 | * call-seq: |
5595 | - * molecule.remove_angle(n1, n2, n3) -> molecule | |
5499 | + * remove_angle(n1, n2, n3) -> Molecule | |
5596 | 5500 | * |
5597 | 5501 | * Remove angle n1-n2-n3. Returns self. Usually, angles are automatically removed |
5598 | 5502 | * when a bond is removed, so it is rarely necessary to use this method explicitly. |
@@ -5618,7 +5522,7 @@ s_Molecule_RemoveAngle(VALUE self, VALUE v1, VALUE v2, VALUE v3) | ||
5618 | 5522 | |
5619 | 5523 | /* |
5620 | 5524 | * call-seq: |
5621 | - * molecule.add_dihedral(n1, n2, n3, n4) -> molecule | |
5525 | + * add_dihedral(n1, n2, n3, n4) -> Molecule | |
5622 | 5526 | * |
5623 | 5527 | * Add dihedral n1-n2-n3-n4. Returns self. Usually, dihedrals are automatically added |
5624 | 5528 | * when a bond is created, so it is rarely necessary to use this method explicitly. |
@@ -5643,7 +5547,7 @@ s_Molecule_AddDihedral(VALUE self, VALUE v1, VALUE v2, VALUE v3, VALUE v4) | ||
5643 | 5547 | |
5644 | 5548 | /* |
5645 | 5549 | * call-seq: |
5646 | - * molecule.remove_dihedral(n1, n2, n3, n4) -> molecule | |
5550 | + * remove_dihedral(n1, n2, n3, n4) -> Molecule | |
5647 | 5551 | * |
5648 | 5552 | * Remove dihedral n1-n2-n3-n4. Returns self. Usually, dihedrals are automatically removed |
5649 | 5553 | * when a bond is removed, so it is rarely necessary to use this method explicitly. |
@@ -5670,7 +5574,7 @@ s_Molecule_RemoveDihedral(VALUE self, VALUE v1, VALUE v2, VALUE v3, VALUE v4) | ||
5670 | 5574 | |
5671 | 5575 | /* |
5672 | 5576 | * call-seq: |
5673 | - * molecule.add_improper(n1, n2, n3, n4) -> molecule | |
5577 | + * add_improper(n1, n2, n3, n4) -> Molecule | |
5674 | 5578 | * |
5675 | 5579 | * Add dihedral n1-n2-n3-n4. Returns self. Unlike angles and dihedrals, impropers are |
5676 | 5580 | * not automatically added when a new bond is created, so this method is more useful than |
@@ -5696,7 +5600,7 @@ s_Molecule_AddImproper(VALUE self, VALUE v1, VALUE v2, VALUE v3, VALUE v4) | ||
5696 | 5600 | |
5697 | 5601 | /* |
5698 | 5602 | * call-seq: |
5699 | - * molecule.remove_improper(n1, n2, n3, n4) -> molecule | |
5603 | + * remove_improper(n1, n2, n3, n4) -> Molecule | |
5700 | 5604 | * |
5701 | 5605 | * Remove improper n1-n2-n3-n4. Returns self. Unlike angles and dihedrals, impropers are |
5702 | 5606 | * not automatically added when a new bond is created, so this method is more useful than |
@@ -5724,7 +5628,7 @@ s_Molecule_RemoveImproper(VALUE self, VALUE v1, VALUE v2, VALUE v3, VALUE v4) | ||
5724 | 5628 | |
5725 | 5629 | /* |
5726 | 5630 | * call-seq: |
5727 | - * molecule.assign_residue(group, res) -> molecule | |
5631 | + * assign_residue(group, res) -> Molecule | |
5728 | 5632 | * |
5729 | 5633 | * Assign the specified atoms as the given residue. res can either be an integer, "resname" |
5730 | 5634 | * or "resname.resno". When the residue number is not specified, the residue number of |
@@ -5788,7 +5692,7 @@ s_Molecule_AssignResidue(VALUE self, VALUE range, VALUE res) | ||
5788 | 5692 | |
5789 | 5693 | /* |
5790 | 5694 | * call-seq: |
5791 | - * molecule.offset_residue(group, offset) -> molecule | |
5695 | + * offset_residue(group, offset) -> Molecule | |
5792 | 5696 | * |
5793 | 5697 | * Offset the residue number of the specified atoms. If any of the residue number gets |
5794 | 5698 | * negative, then exception is thrown. |
@@ -5812,7 +5716,7 @@ s_Molecule_OffsetResidue(VALUE self, VALUE range, VALUE offset) | ||
5812 | 5716 | |
5813 | 5717 | /* |
5814 | 5718 | * call-seq: |
5815 | - * molecule.reorder_atoms(array) -> intGroup | |
5719 | + * reorder_atoms(array) -> IntGroup | |
5816 | 5720 | * |
5817 | 5721 | * Change the order of atoms so that the atoms specified in the array argument appear |
5818 | 5722 | * in this order from the top of the molecule. The atoms that are not included in array |
@@ -5854,12 +5758,12 @@ s_Molecule_ReorderAtoms(VALUE self, VALUE array) | ||
5854 | 5758 | |
5855 | 5759 | /* |
5856 | 5760 | * call-seq: |
5857 | - * molecule.guess_bonds(limit = 1.2) -> Array | |
5761 | + * guess_bonds(limit = 1.2) -> Integer | |
5858 | 5762 | * |
5859 | 5763 | * Create bonds between atoms that are 'close enough', i.e. the interatomic distance is |
5860 | 5764 | * smaller than the sum of the vdw radii times the argument 'limit'. If limit is not |
5861 | 5765 | * given, a default value of 1.2 is used. |
5862 | - * The newly created bonds are returned as an array of integer. | |
5766 | + * The number of the newly created bonds is returned. | |
5863 | 5767 | * This operation is undoable. |
5864 | 5768 | */ |
5865 | 5769 | static VALUE |
@@ -5878,19 +5782,14 @@ s_Molecule_GuessBonds(int argc, VALUE *argv, VALUE self) | ||
5878 | 5782 | MoleculeGuessBonds(mol, limit, &nbonds, &bonds); |
5879 | 5783 | if (nbonds > 0) { |
5880 | 5784 | MolActionCreateAndPerform(mol, gMolActionAddBonds, nbonds * 2, bonds); |
5881 | - retval = rb_ary_new2(nbonds * 2); | |
5882 | - for (i = 0; i < nbonds * 2; i++) | |
5883 | - rb_ary_push(retval, INT2NUM(bonds[i])); | |
5884 | 5785 | free(bonds); |
5885 | - } else { | |
5886 | - retval = rb_ary_new(); | |
5887 | 5786 | } |
5888 | - return retval; | |
5787 | + return INT2NUM(nbonds); | |
5889 | 5788 | } |
5890 | 5789 | |
5891 | 5790 | /* |
5892 | 5791 | * call-seq: |
5893 | - * molecule.register_undo(script, *args) | |
5792 | + * register_undo(script, *args) | |
5894 | 5793 | * |
5895 | 5794 | * Register an undo operation with the current molecule. |
5896 | 5795 | */ |
@@ -5909,7 +5808,7 @@ s_Molecule_RegisterUndo(int argc, VALUE *argv, VALUE self) | ||
5909 | 5808 | |
5910 | 5809 | /* |
5911 | 5810 | * call-seq: |
5912 | - * molecule.undo_enabled? => true/false | |
5811 | + * undo_enabled? -> bool | |
5913 | 5812 | * |
5914 | 5813 | * Returns true if undo is enabled for this molecule; otherwise no. |
5915 | 5814 | */ |
@@ -5925,7 +5824,7 @@ s_Molecule_UndoEnabled(VALUE self) | ||
5925 | 5824 | |
5926 | 5825 | /* |
5927 | 5826 | * call-seq: |
5928 | - * molecule.undo_enabled = true/false | |
5827 | + * undo_enabled = bool | |
5929 | 5828 | * |
5930 | 5829 | * Enable or disable undo. |
5931 | 5830 | */ |
@@ -5940,7 +5839,7 @@ s_Molecule_SetUndoEnabled(VALUE self, VALUE val) | ||
5940 | 5839 | |
5941 | 5840 | /* |
5942 | 5841 | * call-seq: |
5943 | - * molecule.selection -> intGroup | |
5842 | + * selection -> IntGroup | |
5944 | 5843 | * |
5945 | 5844 | * Returns the current selection. The returned value is frozen. |
5946 | 5845 | */ |
@@ -5981,7 +5880,7 @@ s_Molecule_SetSelectionSub(VALUE self, VALUE val, int undoable) | ||
5981 | 5880 | |
5982 | 5881 | /* |
5983 | 5882 | * call-seq: |
5984 | - * molecule.selection = intGroup | |
5883 | + * selection = IntGroup | |
5985 | 5884 | * |
5986 | 5885 | * Set the current selection. The right-hand operand may be nil. |
5987 | 5886 | * This operation is _not_ undoable. If you need undo, use set_undoable_selection instead. |
@@ -5994,7 +5893,7 @@ s_Molecule_SetSelection(VALUE self, VALUE val) | ||
5994 | 5893 | |
5995 | 5894 | /* |
5996 | 5895 | * call-seq: |
5997 | - * molecule.set_undoable_selection(intGroup) | |
5896 | + * set_undoable_selection(IntGroup) | |
5998 | 5897 | * |
5999 | 5898 | * Set the current selection with undo registration. The right-hand operand may be nil. |
6000 | 5899 | * This operation is undoable. |
@@ -6007,8 +5906,8 @@ s_Molecule_SetUndoableSelection(VALUE self, VALUE val) | ||
6007 | 5906 | |
6008 | 5907 | /* |
6009 | 5908 | * call-seq: |
6010 | - * molecule.select_frame(index) | |
6011 | - * molecule.frame = index | |
5909 | + * select_frame(index) | |
5910 | + * frame = index | |
6012 | 5911 | * |
6013 | 5912 | * Select the specified frame. If successful, returns true, otherwise returns false. |
6014 | 5913 | */ |
@@ -6026,7 +5925,7 @@ s_Molecule_SelectFrame(VALUE self, VALUE val) | ||
6026 | 5925 | |
6027 | 5926 | /* |
6028 | 5927 | * call-seq: |
6029 | - * molecule.frame => integer | |
5928 | + * frame -> Integer | |
6030 | 5929 | * |
6031 | 5930 | * Get the current frame. |
6032 | 5931 | */ |
@@ -6040,7 +5939,7 @@ s_Molecule_Frame(VALUE self) | ||
6040 | 5939 | |
6041 | 5940 | /* |
6042 | 5941 | * call-seq: |
6043 | - * molecule.nframes => integer | |
5942 | + * nframes -> Integer | |
6044 | 5943 | * |
6045 | 5944 | * Get the number of frames. |
6046 | 5945 | */ |
@@ -6054,85 +5953,8 @@ s_Molecule_Nframes(VALUE self) | ||
6054 | 5953 | |
6055 | 5954 | /* |
6056 | 5955 | * call-seq: |
6057 | - * molecule.insert_frame(index, coordinates = nil) => integer | |
6058 | - * | |
6059 | - * Insert a new frame at index. If index is negative or greater than the number of | |
6060 | - * frames, a new frame is inserted at the last. If coordinates is given as an array | |
6061 | - * of Vector3Ds, then those coordinates are set to the new frame. Otherwise, the | |
6062 | - * coordinates of current molecule are copied to the new frame. | |
6063 | - * Returns the index of the new frame if successful, -1 if not. | |
6064 | - */ | |
6065 | -/* | |
6066 | -static VALUE | |
6067 | -s_Molecule_InsertFrame(int argc, VALUE *argv, VALUE self) | |
6068 | -{ | |
6069 | - VALUE val, coords; | |
6070 | - Molecule *mol; | |
6071 | - int ival; | |
6072 | - Vector *vp; | |
6073 | - Data_Get_Struct(self, Molecule, mol); | |
6074 | - rb_scan_args(argc, argv, "11", &val, &coords); | |
6075 | - ival = NUM2INT(val); | |
6076 | - if (coords != Qnil) { | |
6077 | - int i, len; | |
6078 | - VALUE *ptr; | |
6079 | - if (TYPE(coords) != T_ARRAY) | |
6080 | - rb_raise(rb_eTypeError, "the coordinates should be given as an array of Vector3D"); | |
6081 | - len = RARRAY_LEN(coords); | |
6082 | - if (len < mol->natoms) | |
6083 | - rb_raise(rb_eMolbyError, "the coordinates should contain no less than %d vectors", mol->natoms); | |
6084 | - len = mol->natoms; | |
6085 | - ptr = RARRAY_PTR(coords); | |
6086 | - vp = ALLOC_N(Vector, len); | |
6087 | - for (i = 0; i < len; i++) { | |
6088 | - VectorFromValue(ptr[i], &vp[i]); | |
6089 | - } | |
6090 | - } else vp = NULL; | |
6091 | - ival = MoleculeInsertFrame(mol, ival, vp); | |
6092 | - if (vp != NULL) | |
6093 | - free(vp); | |
6094 | - val = INT2NUM(ival); | |
6095 | - rb_funcall(self, rb_intern("register_undo"), 2, rb_str_new2("remove_frame"), val); | |
6096 | - return val; | |
6097 | -} | |
6098 | -*/ | |
6099 | - | |
6100 | -/* | |
6101 | - * call-seq: | |
6102 | - * molecule.remove_frame(index) | |
6103 | - * | |
6104 | - * Remove the frame at index. If successful, an array of the coordinates in the | |
6105 | - * removed frame is returned. Otherwise, nil is returned. | |
6106 | - */ | |
6107 | -/* | |
6108 | -static VALUE | |
6109 | -s_Molecule_RemoveFrame(VALUE self, VALUE val) | |
6110 | -{ | |
6111 | - VALUE coords; | |
6112 | - Molecule *mol; | |
6113 | - int ival; | |
6114 | - Vector *vp; | |
6115 | - Data_Get_Struct(self, Molecule, mol); | |
6116 | - ival = NUM2INT(val); | |
6117 | - vp = ALLOC_N(Vector, mol->natoms); | |
6118 | - ival = MoleculeRemoveFrame(mol, ival, vp); | |
6119 | - if (ival >= 0) { | |
6120 | - int i; | |
6121 | - coords = rb_ary_new2(mol->natoms); | |
6122 | - for (i = 0; i < mol->natoms; i++) { | |
6123 | - rb_ary_push(coords, ValueFromVector(&vp[i])); | |
6124 | - } | |
6125 | - rb_funcall(self, rb_intern("register_undo"), 3, rb_str_new2("insert_frame"), val, coords); | |
6126 | - } else coords = Qnil; | |
6127 | - free(vp); | |
6128 | - return coords; | |
6129 | -} | |
6130 | -*/ | |
6131 | - | |
6132 | -/* | |
6133 | - * call-seq: | |
6134 | - * molecule.insert_frame(integer, coordinates = nil) => boolean | |
6135 | - * molecule.insert_frames(intGroup = nil, coordinates = nil) => boolean | |
5956 | + * insert_frame(integer, coordinates = nil) -> bool | |
5957 | + * insert_frames(intGroup = nil, coordinates = nil) -> bool | |
6136 | 5958 | * |
6137 | 5959 | * Insert new frames at the indices specified by the intGroup. If the first argument is |
6138 | 5960 | * an integer, a single new frame is inserted at that index. If the first argument is |
@@ -6191,34 +6013,16 @@ s_Molecule_InsertFrames(int argc, VALUE *argv, VALUE self) | ||
6191 | 6013 | } |
6192 | 6014 | } |
6193 | 6015 | } |
6194 | -#if 1 | |
6195 | 6016 | ival = MolActionCreateAndPerform(mol, gMolActionInsertFrames, ig, mol->natoms * count, vp); |
6196 | 6017 | IntGroupRelease(ig); |
6197 | 6018 | free(vp); |
6198 | 6019 | return (ival >= 0 ? val : Qnil); |
6199 | -#else | |
6200 | - ival = MoleculeInsertFrames(mol, ig, vp); | |
6201 | - if (vp != NULL) | |
6202 | - free(vp); | |
6203 | - if (val == Qnil) | |
6204 | - val = ValueFromIntGroup(ig); | |
6205 | - IntGroupRelease(ig); | |
6206 | - i = MoleculeGetNumberOfFrames(mol); | |
6207 | - if (nframes + count < i) { | |
6208 | - /* Register undo operation to remove "extra" frames that were automatically inserted */ | |
6209 | - ig = IntGroupNewWithPoints(nframes, i - (nframes + count), -1); | |
6210 | - rb_funcall(self, rb_intern("register_undo"), 2, rb_str_new2("remove_frames"), ValueFromIntGroup(ig)); | |
6211 | - IntGroupRelease(ig); | |
6212 | - } | |
6213 | - rb_funcall(self, rb_intern("register_undo"), 2, rb_str_new2("remove_frames"), val); | |
6214 | - return (ival >= 0 ? val : Qnil); | |
6215 | -#endif | |
6216 | 6020 | } |
6217 | 6021 | |
6218 | 6022 | /* |
6219 | 6023 | * call-seq: |
6220 | - * molecule.create_frame(coordinates = nil) => integer | |
6221 | - * molecule.create_frames(coordinates = nil) => integer | |
6024 | + * create_frame(coordinates = nil) -> Integer | |
6025 | + * create_frames(coordinates = nil) -> Integer | |
6222 | 6026 | * |
6223 | 6027 | * Same as molecule.insert_frames(nil, coordinates). |
6224 | 6028 | */ |
@@ -6233,7 +6037,7 @@ s_Molecule_CreateFrames(int argc, VALUE *argv, VALUE self) | ||
6233 | 6037 | |
6234 | 6038 | /* |
6235 | 6039 | * call-seq: |
6236 | - * molecule.remove_frames(intGroup, wantCoordinates = false) | |
6040 | + * remove_frames(IntGroup, wantCoordinates = false) | |
6237 | 6041 | * |
6238 | 6042 | * Remove the frames at group. If wantsCoordinates is false (default), returns true if successful |
6239 | 6043 | * and nil otherwise. If wantsCoordinates is true, an array of arrays of the coordinates in the |
@@ -6277,7 +6081,7 @@ s_Molecule_RemoveFrames(int argc, VALUE *argv, VALUE self) | ||
6277 | 6081 | |
6278 | 6082 | /* |
6279 | 6083 | * call-seq: |
6280 | - * molecule.each_frame block | |
6084 | + * each_frame {|n| ...} | |
6281 | 6085 | * |
6282 | 6086 | * Set the frame number from 0 to nframes-1 and execute the block. The block argument is |
6283 | 6087 | * the frame number. After completion, the original frame number is restored. |
@@ -6302,7 +6106,7 @@ s_Molecule_EachFrame(VALUE self) | ||
6302 | 6106 | |
6303 | 6107 | /* |
6304 | 6108 | * call-seq: |
6305 | - * molecule.set_atom_attr(index, key, value) | |
6109 | + * set_atom_attr(index, key, value) | |
6306 | 6110 | * |
6307 | 6111 | * Set the atom attribute for the specified atom. |
6308 | 6112 | * This operation is undoable. |
@@ -6323,7 +6127,7 @@ s_Molecule_SetAtomAttr(VALUE self, VALUE idx, VALUE key, VALUE val) | ||
6323 | 6127 | |
6324 | 6128 | /* |
6325 | 6129 | * call-seq: |
6326 | - * molecule.get_atom_attr(index, key) | |
6130 | + * get_atom_attr(index, key) | |
6327 | 6131 | * |
6328 | 6132 | * Get the atom attribute for the specified atom. |
6329 | 6133 | */ |
@@ -6335,8 +6139,9 @@ s_Molecule_GetAtomAttr(VALUE self, VALUE idx, VALUE key) | ||
6335 | 6139 | |
6336 | 6140 | /* |
6337 | 6141 | * call-seq: |
6338 | - * molecule.fragment(n1, *exatoms) -> molecule | |
6339 | - * molecule.fragment(group, *exatoms) -> molecule | |
6142 | + * fragment(n1, *exatoms) -> IntGroup | |
6143 | + * fragment(group, *exatoms) -> IntGroup | |
6144 | + * | |
6340 | 6145 | * Get the fragment including the atom n1 or the atom group. If additional arguments are given, |
6341 | 6146 | * those atoms will not be counted during the search. |
6342 | 6147 | */ |
@@ -6393,7 +6198,7 @@ s_Molecule_Fragment(int argc, VALUE *argv, VALUE self) | ||
6393 | 6198 | |
6394 | 6199 | /* |
6395 | 6200 | * call-seq: |
6396 | - * molecule.each_fragment block | |
6201 | + * each_fragment {|group| ...} | |
6397 | 6202 | * |
6398 | 6203 | * Execute the block, with the IntGroup object for each fragment as the argument. |
6399 | 6204 | * Atoms or bonds should not be added or removed during the execution of the block. |
@@ -6424,7 +6229,7 @@ s_Molecule_EachFragment(VALUE self) | ||
6424 | 6229 | |
6425 | 6230 | /* |
6426 | 6231 | * call-seq: |
6427 | - * molecule.detachable?(n1, group) -> array of two atoms | |
6232 | + * detachable?(group) -> [n1, n2] | |
6428 | 6233 | * |
6429 | 6234 | * Check whether the group is 'detachable', i.e. the group is bound to the rest |
6430 | 6235 | * of the molecule via only one bond. If it is, then the indices of the atoms |
@@ -6449,7 +6254,7 @@ s_Molecule_Detachable_P(VALUE self, VALUE gval) | ||
6449 | 6254 | |
6450 | 6255 | /* |
6451 | 6256 | * call-seq: |
6452 | - * molecule.bonds_on_border(group = selection) -> array of array of two atoms | |
6257 | + * bonds_on_border(group = selection) -> Array of Array of two Integers | |
6453 | 6258 | * |
6454 | 6259 | * Returns an array of bonds that connect an atom in the group and an atom out |
6455 | 6260 | * of the group. The first atom in the bond always belongs to the group. If no |
@@ -6501,7 +6306,7 @@ s_Molecule_BondsOnBorder(int argc, VALUE *argv, VALUE self) | ||
6501 | 6306 | |
6502 | 6307 | /* |
6503 | 6308 | * call-seq: |
6504 | - * molecule.translate(vec, group = nil) -> molecule | |
6309 | + * translate(vec, group = nil) -> Molecule | |
6505 | 6310 | * |
6506 | 6311 | * Translate the molecule by vec. If group is given, only atoms in the group are moved. |
6507 | 6312 | * This operation is undoable. |
@@ -6526,9 +6331,9 @@ s_Molecule_Translate(int argc, VALUE *argv, VALUE self) | ||
6526 | 6331 | |
6527 | 6332 | /* |
6528 | 6333 | * call-seq: |
6529 | - * molecule.rotate(axis, angle, center = [0,0,0], group = nil) -> molecule | |
6334 | + * rotate(axis, angle, center = [0,0,0], group = nil) -> Molecule | |
6530 | 6335 | * |
6531 | - * Rotate the molecule. The axis must not a zero vector. angle is given in radian. | |
6336 | + * Rotate the molecule. The axis must not a zero vector. angle is given in degree. | |
6532 | 6337 | * If group is given, only atoms in the group are moved. |
6533 | 6338 | * This operation is undoable. |
6534 | 6339 | */ |
@@ -6544,7 +6349,7 @@ s_Molecule_Rotate(int argc, VALUE *argv, VALUE self) | ||
6544 | 6349 | Data_Get_Struct(self, Molecule, mol); |
6545 | 6350 | rb_scan_args(argc, argv, "22", &aval, &anval, &cval, &gval); |
6546 | 6351 | ig = (NIL_P(gval) ? NULL : s_Molecule_AtomGroupFromValue(self, gval)); |
6547 | - angle = NUM2DBL(rb_Float(anval)); | |
6352 | + angle = NUM2DBL(rb_Float(anval)) * kDeg2Rad; | |
6548 | 6353 | VectorFromValue(aval, &av); |
6549 | 6354 | if (NIL_P(cval)) |
6550 | 6355 | cv.x = cv.y = cv.z = 0.0; |
@@ -6560,7 +6365,7 @@ s_Molecule_Rotate(int argc, VALUE *argv, VALUE self) | ||
6560 | 6365 | |
6561 | 6366 | /* |
6562 | 6367 | * call-seq: |
6563 | - * molecule.reflect(axis, center = [0,0,0], group = nil) -> molecule | |
6368 | + * reflect(axis, center = [0,0,0], group = nil) -> Molecule | |
6564 | 6369 | * |
6565 | 6370 | * Reflect the molecule by the plane which is perpendicular to axis and including center. |
6566 | 6371 | * axis must not be a zero vector. |
@@ -6593,7 +6398,7 @@ s_Molecule_Reflect(int argc, VALUE *argv, VALUE self) | ||
6593 | 6398 | |
6594 | 6399 | /* |
6595 | 6400 | * call-seq: |
6596 | - * molecule.invert(center = [0,0,0], group = nil) -> molecule | |
6401 | + * invert(center = [0,0,0], group = nil) -> Molecule | |
6597 | 6402 | * |
6598 | 6403 | * Invert the molecule with the given center. |
6599 | 6404 | * If group is given, only atoms in the group are moved. |
@@ -6623,7 +6428,7 @@ s_Molecule_Invert(int argc, VALUE *argv, VALUE self) | ||
6623 | 6428 | |
6624 | 6429 | /* |
6625 | 6430 | * call-seq: |
6626 | - * molecule.transform(transform, group = nil) -> molecule | |
6431 | + * transform(transform, group = nil) -> Molecule | |
6627 | 6432 | * |
6628 | 6433 | * Transform the molecule by the given Transform object. |
6629 | 6434 | * If group is given, only atoms in the group are moved. |
@@ -6660,7 +6465,7 @@ s_Molecule_DoCenterOfMass(Molecule *mol, Vector *outv, IntGroup *ig) | ||
6660 | 6465 | |
6661 | 6466 | /* |
6662 | 6467 | * call-seq: |
6663 | - * molecule.center_of_mass(group = nil) -> vector3d | |
6468 | + * center_of_mass(group = nil) -> Vector3D | |
6664 | 6469 | * |
6665 | 6470 | * Calculate the center of mass for the given set of atoms. The argument |
6666 | 6471 | * group is null, then all atoms are considered. |
@@ -6683,7 +6488,7 @@ s_Molecule_CenterOfMass(int argc, VALUE *argv, VALUE self) | ||
6683 | 6488 | |
6684 | 6489 | /* |
6685 | 6490 | * call-seq: |
6686 | - * molecule.centralize(group = nil) -> self | |
6491 | + * centralize(group = nil) -> self | |
6687 | 6492 | * |
6688 | 6493 | * Translate the molecule so that the center of mass of the given group is located |
6689 | 6494 | * at (0, 0, 0). Equivalent to molecule.translate(molecule.center_of_mass(group) * -1). |
@@ -6710,7 +6515,7 @@ s_Molecule_Centralize(int argc, VALUE *argv, VALUE self) | ||
6710 | 6515 | |
6711 | 6516 | /* |
6712 | 6517 | * call-seq: |
6713 | - * molecule.bounds(group = nil) -> [min, max] | |
6518 | + * bounds(group = nil) -> [min, max] | |
6714 | 6519 | * |
6715 | 6520 | * Calculate the boundary. The return value is an array of two Vector3D objects. |
6716 | 6521 | */ |
@@ -6765,7 +6570,7 @@ s_Molecule_GetVectorFromArg(Molecule *mol, VALUE val, Vector *vp) | ||
6765 | 6570 | |
6766 | 6571 | /* |
6767 | 6572 | * call-seq: |
6768 | - * molecule.measure_bond(n1, n2) -> Float | |
6573 | + * measure_bond(n1, n2) -> Float | |
6769 | 6574 | * |
6770 | 6575 | * Calculate the bond length. The arguments can either be atom indices, the "residue:name" representation, |
6771 | 6576 | * or Vector3D values. |
@@ -6784,7 +6589,7 @@ s_Molecule_MeasureBond(VALUE self, VALUE nval1, VALUE nval2) | ||
6784 | 6589 | |
6785 | 6590 | /* |
6786 | 6591 | * call-seq: |
6787 | - * molecule.measure_angle(n1, n2, n3) -> Float | |
6592 | + * measure_angle(n1, n2, n3) -> Float | |
6788 | 6593 | * |
6789 | 6594 | * Calculate the bond angle. The arguments can either be atom indices, the "residue:name" representation, |
6790 | 6595 | * or Vector3D values. The return value is in degree. |
@@ -6808,7 +6613,7 @@ s_Molecule_MeasureAngle(VALUE self, VALUE nval1, VALUE nval2, VALUE nval3) | ||
6808 | 6613 | |
6809 | 6614 | /* |
6810 | 6615 | * call-seq: |
6811 | - * molecule.measure_dihedral(n1, n2, n3, n4) -> Float | |
6616 | + * measure_dihedral(n1, n2, n3, n4) -> Float | |
6812 | 6617 | * |
6813 | 6618 | * Calculate the dihedral angle. The arguments can either be atom indices, the "residue:name" representation, |
6814 | 6619 | * or Vector3D values. The return value is in degree. |
@@ -6833,7 +6638,7 @@ s_Molecule_MeasureDihedral(VALUE self, VALUE nval1, VALUE nval2, VALUE nval3, VA | ||
6833 | 6638 | |
6834 | 6639 | /* |
6835 | 6640 | * call-seq: |
6836 | - * molecule.expand_by_symmetry(group, sym, dx=0, dy=0, dz=0) -> IntGroup | |
6641 | + * expand_by_symmetry(group, sym, dx=0, dy=0, dz=0) -> IntGroup | |
6837 | 6642 | * |
6838 | 6643 | * Expand the specified part of the molecule by the given symmetry operation. |
6839 | 6644 | * Returns an IntGroup containing the added atoms. |
@@ -6871,7 +6676,7 @@ s_Molecule_ExpandBySymmetry(int argc, VALUE *argv, VALUE self) | ||
6871 | 6676 | |
6872 | 6677 | /* |
6873 | 6678 | * call-seq: |
6874 | - * molecule.wrap_unit_cell(group) -> Vector3D | |
6679 | + * wrap_unit_cell(group) -> Vector3D | |
6875 | 6680 | * |
6876 | 6681 | * Move the specified group so that the center of mass of the group is within the |
6877 | 6682 | * unit cell. The offset vector is returned. If no periodic box is defined, |
@@ -6904,7 +6709,7 @@ s_Molecule_WrapUnitCell(VALUE self, VALUE gval) | ||
6904 | 6709 | |
6905 | 6710 | /* |
6906 | 6711 | * call-seq: |
6907 | - * molecule.find_conflicts(limit[, group1[, group2]]) -> [[n1, n2], [n3, n4], ...] | |
6712 | + * find_conflicts(limit[, group1[, group2]]) -> [[n1, n2], [n3, n4], ...] | |
6908 | 6713 | * |
6909 | 6714 | * Find pairs of atoms that are within the limit distance. If group1 and group2 are given, the |
6910 | 6715 | * first and second atom in the pair should belong to group1 and group2, respectively. |
@@ -6974,7 +6779,7 @@ s_Molecule_FindConflicts(int argc, VALUE *argv, VALUE self) | ||
6974 | 6779 | |
6975 | 6780 | /* |
6976 | 6781 | * call-seq: |
6977 | - * molecule.display() | |
6782 | + * display | |
6978 | 6783 | * |
6979 | 6784 | * Refresh the display if this molecule is bound to a view. Otherwise do nothing. |
6980 | 6785 | */ |
@@ -6990,7 +6795,7 @@ s_Molecule_Display(VALUE self) | ||
6990 | 6795 | |
6991 | 6796 | /* |
6992 | 6797 | * call-seq: |
6993 | - * molecule.update_enabled? => true/false | |
6798 | + * update_enabled? -> bool | |
6994 | 6799 | * |
6995 | 6800 | * Returns true if screen update is enabled; otherwise no. |
6996 | 6801 | */ |
@@ -7006,7 +6811,7 @@ s_Molecule_UpdateEnabled(VALUE self) | ||
7006 | 6811 | |
7007 | 6812 | /* |
7008 | 6813 | * call-seq: |
7009 | - * molecule.update_enabled = true/false | |
6814 | + * update_enabled = bool | |
7010 | 6815 | * |
7011 | 6816 | * Enable or disable screen update. This is effective for automatic update on modification. |
7012 | 6817 | * Explicit call to molecule.display() always updates the screen. |
@@ -7025,9 +6830,9 @@ s_Molecule_SetUpdateEnabled(VALUE self, VALUE val) | ||
7025 | 6830 | |
7026 | 6831 | /* |
7027 | 6832 | * call-seq: |
7028 | - * molecule.show_unitcell | |
7029 | - * molecule.show_unitcell true|false | |
7030 | - * molecule.show_unitcell = true|false | |
6833 | + * show_unitcell | |
6834 | + * show_unitcell(bool) | |
6835 | + * show_unitcell = bool | |
7031 | 6836 | * |
7032 | 6837 | * Set the flag whether to show the unit cell. If no argument is given, the |
7033 | 6838 | * current flag is returned. |
@@ -7048,9 +6853,9 @@ s_Molecule_ShowUnitCell(int argc, VALUE *argv, VALUE self) | ||
7048 | 6853 | |
7049 | 6854 | /* |
7050 | 6855 | * call-seq: |
7051 | - * molecule.show_hydrogens | |
7052 | - * molecule.show_hydrogens true|false | |
7053 | - * molecule.show_hydrogens = true|false | |
6856 | + * show_hydrogens | |
6857 | + * show_hydrogens(bool) | |
6858 | + * show_hydrogens = bool | |
7054 | 6859 | * |
7055 | 6860 | * Set the flag whether to show the hydrogen atoms. If no argument is given, the |
7056 | 6861 | * current flag is returned. |
@@ -7071,9 +6876,9 @@ s_Molecule_ShowHydrogens(int argc, VALUE *argv, VALUE self) | ||
7071 | 6876 | |
7072 | 6877 | /* |
7073 | 6878 | * call-seq: |
7074 | - * molecule.show_dummy_atoms | |
7075 | - * molecule.show_dummy_atoms true|false | |
7076 | - * molecule.show_dummy_atoms = true|false | |
6879 | + * show_dummy_atoms | |
6880 | + * show_dummy_atoms(bool) | |
6881 | + * show_dummy_atoms = bool | |
7077 | 6882 | * |
7078 | 6883 | * Set the flag whether to show the dummy atoms. If no argument is given, the |
7079 | 6884 | * current flag is returned. |
@@ -7094,9 +6899,9 @@ s_Molecule_ShowDummyAtoms(int argc, VALUE *argv, VALUE self) | ||
7094 | 6899 | |
7095 | 6900 | /* |
7096 | 6901 | * call-seq: |
7097 | - * molecule.show_expanded | |
7098 | - * molecule.show_expanded true|false | |
7099 | - * molecule.show_expanded = true|false | |
6902 | + * show_expanded | |
6903 | + * show_expanded(bool) | |
6904 | + * show_expanded = bool | |
7100 | 6905 | * |
7101 | 6906 | * Set the flag whether to show the expanded atoms. If no argument is given, the |
7102 | 6907 | * current flag is returned. |
@@ -7117,9 +6922,9 @@ s_Molecule_ShowExpanded(int argc, VALUE *argv, VALUE self) | ||
7117 | 6922 | |
7118 | 6923 | /* |
7119 | 6924 | * call-seq: |
7120 | - * molecule.show_ellipsoids | |
7121 | - * molecule.show_ellipsoids true|false | |
7122 | - * molecule.show_ellipsoids = true|false | |
6925 | + * show_ellipsoids | |
6926 | + * show_ellipsoids(bool) | |
6927 | + * show_ellipsoids = bool | |
7123 | 6928 | * |
7124 | 6929 | * Set the flag whether to show the thermal ellipsoids. If no argument is given, the |
7125 | 6930 | * current flag is returned. |
@@ -7140,8 +6945,8 @@ s_Molecule_ShowEllipsoids(int argc, VALUE *argv, VALUE self) | ||
7140 | 6945 | |
7141 | 6946 | /* |
7142 | 6947 | * call-seq: |
7143 | - * molecule.show_graphite | |
7144 | - * molecule.show_graphite = integer | |
6948 | + * show_graphite -> Integer | |
6949 | + * show_graphite = Integer | |
7145 | 6950 | * |
7146 | 6951 | * Set whether to show the graphite plane. If the argument is positive, it also indicates the |
7147 | 6952 | * number of rings to display for each direction. |
@@ -7165,7 +6970,7 @@ s_Molecule_ShowGraphite(int argc, VALUE *argv, VALUE self) | ||
7165 | 6970 | |
7166 | 6971 | /* |
7167 | 6972 | * call-seq: |
7168 | - * molecule.show_periodic_image = [amin, amax, bmin, bmax, cmin, cmax] | |
6973 | + * show_periodic_image = [amin, amax, bmin, bmax, cmin, cmax] | |
7169 | 6974 | * |
7170 | 6975 | * Set to show the periodic image of the atoms. If the unit cell is not defined, the values are |
7171 | 6976 | * set but no visual effects are observed. |
@@ -7202,9 +7007,9 @@ s_Molecule_ShowPeriodicImage(int argc, VALUE *argv, VALUE self) | ||
7202 | 7007 | |
7203 | 7008 | /* |
7204 | 7009 | * call-seq: |
7205 | - * molecule.line_mode | |
7206 | - * molecule.line_mode true|false | |
7207 | - * molecule.line_mode = true|false | |
7010 | + * line_mode | |
7011 | + * line_mode(bool) | |
7012 | + * line_mode = bool | |
7208 | 7013 | * |
7209 | 7014 | * Set the flag whether to draw the model in line mode. If no argument is given, the |
7210 | 7015 | * current flag is returned. |
@@ -7225,7 +7030,7 @@ s_Molecule_LineMode(int argc, VALUE *argv, VALUE self) | ||
7225 | 7030 | |
7226 | 7031 | /* |
7227 | 7032 | * call-seq: |
7228 | - * molecule.show_text(string) | |
7033 | + * show_text(string) | |
7229 | 7034 | * |
7230 | 7035 | * Show the string in the info text box. |
7231 | 7036 | */ |
@@ -7241,7 +7046,7 @@ s_Molecule_ShowText(VALUE self, VALUE arg) | ||
7241 | 7046 | |
7242 | 7047 | /* |
7243 | 7048 | * call-seq: |
7244 | - * molecule.md_arena -> MDArena | |
7049 | + * md_arena -> MDArena | |
7245 | 7050 | * |
7246 | 7051 | * Returns the MDArena object associated to this molecule. If no MDArena is associated to |
7247 | 7052 | * this molecule, a new arena is created. |
@@ -7262,7 +7067,7 @@ s_Molecule_MDArena(VALUE self) | ||
7262 | 7067 | |
7263 | 7068 | /* |
7264 | 7069 | * call-seq: |
7265 | - * molecule.set_parameter_attr(type, index, key, value, src) -> value | |
7070 | + * set_parameter_attr(type, index, key, value, src) -> value | |
7266 | 7071 | * |
7267 | 7072 | * This method is used only internally. |
7268 | 7073 | */ |
@@ -7289,7 +7094,7 @@ s_Molecule_SetParameterAttr(VALUE self, VALUE tval, VALUE ival, VALUE kval, VALU | ||
7289 | 7094 | |
7290 | 7095 | /* |
7291 | 7096 | * call-seq: |
7292 | - * molecule.parameter -> Parameter | |
7097 | + * parameter -> Parameter | |
7293 | 7098 | * |
7294 | 7099 | * Get the local parameter of this molecule. If not defined, returns nil. |
7295 | 7100 | */ |
@@ -7305,7 +7110,7 @@ s_Molecule_Parameter(VALUE self) | ||
7305 | 7110 | |
7306 | 7111 | /* |
7307 | 7112 | * call-seq: |
7308 | - * molecule.selectedMO -> IntGroup | |
7113 | + * selectedMO -> IntGroup | |
7309 | 7114 | * |
7310 | 7115 | * Returns a group of selected mo in the "MO Info" table. If the MO info table |
7311 | 7116 | * is not selected, returns nil. If the MO info table is selected but no MOs |
@@ -7331,7 +7136,7 @@ s_Molecule_SelectedMO(VALUE self) | ||
7331 | 7136 | |
7332 | 7137 | /* |
7333 | 7138 | * call-seq: |
7334 | - * molecule.default_MO_grid(npoints = 80*80*80) -> [origin, dx, dy, dz, nx, ny, nz] | |
7139 | + * default_MO_grid(npoints = 80*80*80) -> [origin, dx, dy, dz, nx, ny, nz] | |
7335 | 7140 | * |
7336 | 7141 | * Returns a default MO grid for cube file generation. Origin: Vector, dx, dy, dz: float, nx, ny, nz: integer. |
7337 | 7142 | * If the molecule does not contain a basis set information, then returns nil. |
@@ -7366,8 +7171,8 @@ s_Cubegen_callback(double progress, void *ref) | ||
7366 | 7171 | |
7367 | 7172 | /* |
7368 | 7173 | * call-seq: |
7369 | - * molecule.cubegen(fname, mo, npoints=1000000 [, iflag]) | |
7370 | - * molecule.cubegen(fname, mo, origin, dx, dy, dz, nx, ny, nz [, iflag]) | |
7174 | + * cubegen(fname, mo, npoints=1000000 [, iflag]) | |
7175 | + * cubegen(fname, mo, origin, dx, dy, dz, nx, ny, nz [, iflag]) | |
7371 | 7176 | * |
7372 | 7177 | * Calculate the molecular orbital with number mo and create a 'cube' file. |
7373 | 7178 | * In the first form, the cube size is estimated from the atomic coordinates. In the |
@@ -7455,7 +7260,7 @@ s_Molecule_Cubegen(int argc, VALUE *argv, VALUE self) | ||
7455 | 7260 | |
7456 | 7261 | /* |
7457 | 7262 | * call-seq: |
7458 | - * molecule.nelpots | |
7263 | + * nelpots | |
7459 | 7264 | * |
7460 | 7265 | * Get the number of electrostatic potential info. |
7461 | 7266 | */ |
@@ -7469,7 +7274,7 @@ s_Molecule_NElpots(VALUE self) | ||
7469 | 7274 | |
7470 | 7275 | /* |
7471 | 7276 | * call-seq: |
7472 | - * molecule.elpot(idx) | |
7277 | + * elpot(idx) | |
7473 | 7278 | * |
7474 | 7279 | * Get the electrostatic potential info at the given index. If present, then the |
7475 | 7280 | * return value is [Vector, Float] (position and potential). If not present, then |
@@ -7489,7 +7294,7 @@ s_Molecule_Elpot(VALUE self, VALUE ival) | ||
7489 | 7294 | |
7490 | 7295 | /* |
7491 | 7296 | * call-seq: |
7492 | - * molecule.search_equivalent_atoms(ig = nil) | |
7297 | + * search_equivalent_atoms(ig = nil) | |
7493 | 7298 | * |
7494 | 7299 | * Search equivalent atoms (within the atom group if given). Returns an array of integers. |
7495 | 7300 | */ |
@@ -7521,7 +7326,7 @@ s_Molecule_SearchEquivalentAtoms(int argc, VALUE *argv, VALUE self) | ||
7521 | 7326 | |
7522 | 7327 | /* |
7523 | 7328 | * call-seq: |
7524 | - * Molecule.current -> Molecule | |
7329 | + * current -> Molecule | |
7525 | 7330 | * |
7526 | 7331 | * Get the currently "active" molecule. |
7527 | 7332 | */ |
@@ -7543,11 +7348,11 @@ s_Molecule_Current(VALUE klass) | ||
7543 | 7348 | * Molecule[] is equivalent to Molecule.current. |
7544 | 7349 | * Molecule[n] (n is an integer) is equivalent to Molecule.list[n]. |
7545 | 7350 | * Molecule[name] gives the first document (in the order of creation time) that has |
7546 | - * the given name. If a second argument (k) is given, the n-th document that has the | |
7351 | + * the given name. If a second argument (k) is given, the k-th document that has the | |
7547 | 7352 | * given name is returned. |
7548 | 7353 | * Molecule[regex] gives the first document (in the order of creation time) that |
7549 | 7354 | * has a name matching the regular expression. If a second argument (k) is given, |
7550 | - * the n-th document that has a name matching the re is returned. | |
7355 | + * the k-th document that has a name matching the re is returned. | |
7551 | 7356 | */ |
7552 | 7357 | static VALUE |
7553 | 7358 | s_Molecule_MoleculeAtIndex(int argc, VALUE *argv, VALUE klass) |
@@ -7588,7 +7393,7 @@ s_Molecule_MoleculeAtIndex(int argc, VALUE *argv, VALUE klass) | ||
7588 | 7393 | |
7589 | 7394 | /* |
7590 | 7395 | * call-seq: |
7591 | - * Molecule.list -> array of Molecules | |
7396 | + * list -> array of Molecules | |
7592 | 7397 | * |
7593 | 7398 | * Get the list of molecules associated to the documents, in the order of creation |
7594 | 7399 | * time of the document. If no document is open, returns an empry array. |
@@ -7610,7 +7415,7 @@ s_Molecule_List(VALUE klass) | ||
7610 | 7415 | |
7611 | 7416 | /* |
7612 | 7417 | * call-seq: |
7613 | - * Molecule.ordered_list -> array of Molecules | |
7418 | + * ordered_list -> array of Molecules | |
7614 | 7419 | * |
7615 | 7420 | * Get the list of molecules associated to the documents, in the order of front-to-back |
7616 | 7421 | * ordering of the associated window. If no document is open, returns an empry array. |
@@ -7648,7 +7453,7 @@ Init_Molby(void) | ||
7648 | 7453 | rb_define_private_method(rb_cMolecule, "initialize_copy", s_Molecule_InitCopy, 1); |
7649 | 7454 | rb_define_method(rb_cMolecule, "loadmbsf", s_Molecule_Loadmbsf, -1); |
7650 | 7455 | rb_define_method(rb_cMolecule, "loadpsf", s_Molecule_Loadpsf, -1); |
7651 | - rb_define_method(rb_cMolecule, "loadpsfx", s_Molecule_Loadpsf, -1); | |
7456 | + rb_define_alias(rb_cMolecule, "loadpsfx", "loadpsf"); | |
7652 | 7457 | rb_define_method(rb_cMolecule, "loadpdb", s_Molecule_Loadpdb, -1); |
7653 | 7458 | rb_define_method(rb_cMolecule, "loaddcd", s_Molecule_Loaddcd, -1); |
7654 | 7459 | rb_define_method(rb_cMolecule, "loadtep", s_Molecule_Loadtep, -1); |
@@ -7659,7 +7464,7 @@ Init_Molby(void) | ||
7659 | 7464 | rb_define_method(rb_cMolecule, "molsave", s_Molecule_Save, -1); |
7660 | 7465 | rb_define_method(rb_cMolecule, "savembsf", s_Molecule_Savembsf, 1); |
7661 | 7466 | rb_define_method(rb_cMolecule, "savepsf", s_Molecule_Savepsf, 1); |
7662 | - rb_define_method(rb_cMolecule, "savepsfx", s_Molecule_Savepsf, 1); | |
7467 | + rb_define_alias(rb_cMolecule, "savepsfx", "savepsf"); | |
7663 | 7468 | rb_define_method(rb_cMolecule, "savepdb", s_Molecule_Savepdb, 1); |
7664 | 7469 | rb_define_method(rb_cMolecule, "savedcd", s_Molecule_Savedcd, 1); |
7665 | 7470 | rb_define_method(rb_cMolecule, "savetep", s_Molecule_Savetep, 1); |
@@ -7695,16 +7500,17 @@ Init_Molby(void) | ||
7695 | 7500 | rb_define_method(rb_cMolecule, "each_atom", s_Molecule_EachAtom, 0); |
7696 | 7501 | rb_define_method(rb_cMolecule, "cell", s_Molecule_Cell, 0); |
7697 | 7502 | rb_define_method(rb_cMolecule, "cell=", s_Molecule_SetCell, -1); |
7698 | - rb_define_method(rb_cMolecule, "set_cell", s_Molecule_SetCell, -1); | |
7503 | + rb_define_alias(rb_cMolecule, "set_cell", "cell="); | |
7699 | 7504 | rb_define_method(rb_cMolecule, "cell_transform", s_Molecule_CellTransform, 0); |
7700 | 7505 | rb_define_method(rb_cMolecule, "box", s_Molecule_Box, 0); |
7701 | - rb_define_method(rb_cMolecule, "set_box", s_Molecule_SetBox, -1); | |
7702 | -/* rb_define_method(rb_cMolecule, "box_transform", s_Molecule_BoxTransform, 0); */ | |
7506 | + rb_define_method(rb_cMolecule, "box=", s_Molecule_SetBox, -1); | |
7507 | + rb_define_alias(rb_cMolecule, "set_box", "box="); | |
7703 | 7508 | rb_define_method(rb_cMolecule, "symmetry", s_Molecule_Symmetry, 0); |
7509 | + rb_define_alias(rb_cMolecule, "symmetries", "symmetry"); | |
7704 | 7510 | rb_define_method(rb_cMolecule, "nsymmetries", s_Molecule_Nsymmetries, 0); |
7705 | 7511 | rb_define_method(rb_cMolecule, "add_symmetry", s_Molecule_AddSymmetry, 1); |
7706 | - rb_define_method(rb_cMolecule, "remove_symmetries", s_Molecule_RemoveSymmetry, -1); | |
7707 | 7512 | rb_define_method(rb_cMolecule, "remove_symmetry", s_Molecule_RemoveSymmetry, -1); |
7513 | + rb_define_alias(rb_cMolecule, "remove_symmetries", "remove_symmetry"); | |
7708 | 7514 | rb_define_method(rb_cMolecule, "extract", s_Molecule_Extract, -1); |
7709 | 7515 | rb_define_method(rb_cMolecule, "add", s_Molecule_Add, 1); |
7710 | 7516 | rb_define_alias(rb_cMolecule, "+", "add"); |
@@ -7727,16 +7533,16 @@ Init_Molby(void) | ||
7727 | 7533 | rb_define_method(rb_cMolecule, "selection", s_Molecule_Selection, 0); |
7728 | 7534 | rb_define_method(rb_cMolecule, "selection=", s_Molecule_SetSelection, 1); |
7729 | 7535 | rb_define_method(rb_cMolecule, "set_undoable_selection", s_Molecule_SetUndoableSelection, 1); |
7730 | - rb_define_method(rb_cMolecule, "select_frame", s_Molecule_SelectFrame, 1); | |
7731 | - rb_define_method(rb_cMolecule, "frame=", s_Molecule_SelectFrame, 1); | |
7732 | 7536 | rb_define_method(rb_cMolecule, "frame", s_Molecule_Frame, 0); |
7537 | + rb_define_method(rb_cMolecule, "frame=", s_Molecule_SelectFrame, 1); | |
7538 | + rb_define_alias(rb_cMolecule, "select_frame", "frame="); | |
7733 | 7539 | rb_define_method(rb_cMolecule, "nframes", s_Molecule_Nframes, 0); |
7734 | 7540 | rb_define_method(rb_cMolecule, "create_frame", s_Molecule_CreateFrames, -1); |
7735 | 7541 | rb_define_method(rb_cMolecule, "insert_frame", s_Molecule_InsertFrames, -1); |
7736 | 7542 | rb_define_method(rb_cMolecule, "remove_frame", s_Molecule_RemoveFrames, 1); |
7737 | - rb_define_method(rb_cMolecule, "create_frames", s_Molecule_CreateFrames, -1); | |
7738 | - rb_define_method(rb_cMolecule, "insert_frames", s_Molecule_InsertFrames, -1); | |
7739 | - rb_define_method(rb_cMolecule, "remove_frames", s_Molecule_RemoveFrames, -1); | |
7543 | + rb_define_alias(rb_cMolecule, "create_frames", "create_frame"); | |
7544 | + rb_define_alias(rb_cMolecule, "insert_frames", "insert_frame"); | |
7545 | + rb_define_alias(rb_cMolecule, "remove_frames", "remove_frame"); | |
7740 | 7546 | rb_define_method(rb_cMolecule, "each_frame", s_Molecule_EachFrame, 0); |
7741 | 7547 | rb_define_method(rb_cMolecule, "register_undo", s_Molecule_RegisterUndo, -1); |
7742 | 7548 | rb_define_method(rb_cMolecule, "undo_enabled?", s_Molecule_UndoEnabled, 0); |
@@ -7765,7 +7571,6 @@ Init_Molby(void) | ||
7765 | 7571 | rb_define_method(rb_cMolecule, "update_enabled?", s_Molecule_UpdateEnabled, 0); |
7766 | 7572 | rb_define_method(rb_cMolecule, "update_enabled=", s_Molecule_SetUpdateEnabled, 1); |
7767 | 7573 | rb_define_method(rb_cMolecule, "show_unitcell", s_Molecule_ShowUnitCell, -1); |
7768 | - rb_define_method(rb_cMolecule, "show_unitcell=", s_Molecule_ShowUnitCell, -1); | |
7769 | 7574 | rb_define_method(rb_cMolecule, "show_hydrogens", s_Molecule_ShowHydrogens, -1); |
7770 | 7575 | rb_define_method(rb_cMolecule, "show_hydrogens=", s_Molecule_ShowHydrogens, -1); |
7771 | 7576 | rb_define_method(rb_cMolecule, "show_dummy_atoms", s_Molecule_ShowDummyAtoms, -1); |
@@ -7778,8 +7583,15 @@ Init_Molby(void) | ||
7778 | 7583 | rb_define_method(rb_cMolecule, "show_graphite=", s_Molecule_ShowGraphite, -1); |
7779 | 7584 | rb_define_method(rb_cMolecule, "show_periodic_image", s_Molecule_ShowPeriodicImage, -1); |
7780 | 7585 | rb_define_method(rb_cMolecule, "show_periodic_image=", s_Molecule_ShowPeriodicImage, -1); |
7586 | + rb_define_alias(rb_cMolecule, "show_unitcell=", "show_unitcell"); | |
7587 | + rb_define_alias(rb_cMolecule, "show_hydrogens=", "show_hydrogens"); | |
7588 | + rb_define_alias(rb_cMolecule, "show_dummy_atoms=", "show_dummy_atoms"); | |
7589 | + rb_define_alias(rb_cMolecule, "show_expanded=", "show_expanded"); | |
7590 | + rb_define_alias(rb_cMolecule, "show_ellipsoids=", "show_ellipsoids"); | |
7591 | + rb_define_alias(rb_cMolecule, "show_graphite=", "show_graphite"); | |
7592 | + rb_define_alias(rb_cMolecule, "show_periodic_image=", "show_periodic_image"); | |
7781 | 7593 | rb_define_method(rb_cMolecule, "line_mode", s_Molecule_LineMode, -1); |
7782 | - rb_define_method(rb_cMolecule, "line_mode=", s_Molecule_LineMode, -1); | |
7594 | + rb_define_alias(rb_cMolecule, "line_mode=", "line_mode"); | |
7783 | 7595 | rb_define_method(rb_cMolecule, "show_text", s_Molecule_ShowText, 1); |
7784 | 7596 | rb_define_method(rb_cMolecule, "md_arena", s_Molecule_MDArena, 0); |
7785 | 7597 | rb_define_method(rb_cMolecule, "set_parameter_attr", s_Molecule_SetParameterAttr, 5); |
@@ -7816,10 +7628,10 @@ Init_Molby(void) | ||
7816 | 7628 | strcat(buf, "="); |
7817 | 7629 | rb_define_method(rb_cAtomRef, buf, s_AtomAttrDefTable[i].setter, 1); |
7818 | 7630 | } |
7819 | - rb_define_method(rb_cAtomRef, "set_attr", s_AtomRef_SetAttr, 2); | |
7820 | 7631 | rb_define_method(rb_cAtomRef, "[]=", s_AtomRef_SetAttr, 2); |
7821 | - rb_define_method(rb_cAtomRef, "get_attr", s_AtomRef_GetAttr, 1); | |
7632 | + rb_define_alias(rb_cAtomRef, "set_attr", "[]="); | |
7822 | 7633 | rb_define_method(rb_cAtomRef, "[]", s_AtomRef_GetAttr, 1); |
7634 | + rb_define_alias(rb_cAtomRef, "get_attr", "[]"); | |
7823 | 7635 | s_SetAtomAttrString = rb_str_new2("set_atom_attr"); |
7824 | 7636 | rb_global_variable(&s_SetAtomAttrString); |
7825 | 7637 |
@@ -7900,10 +7712,10 @@ Init_Molby(void) | ||
7900 | 7712 | rb_define_method(rb_cParameterRef, buf, s_ParameterAttrDefTable[i].setter, 1); |
7901 | 7713 | } |
7902 | 7714 | } |
7903 | - rb_define_method(rb_cParameterRef, "set_attr", s_ParameterRef_SetAttr, 2); | |
7904 | 7715 | rb_define_method(rb_cParameterRef, "[]=", s_ParameterRef_SetAttr, 2); |
7905 | - rb_define_method(rb_cParameterRef, "get_attr", s_ParameterRef_GetAttr, 1); | |
7716 | + rb_define_alias(rb_cParameterRef, "set_attr", "[]="); | |
7906 | 7717 | rb_define_method(rb_cParameterRef, "[]", s_ParameterRef_GetAttr, 1); |
7718 | + rb_define_alias(rb_cParameterRef, "get_attr", "[]"); | |
7907 | 7719 | rb_define_method(rb_cParameterRef, "to_hash", s_ParameterRef_ToHash, 0); |
7908 | 7720 | rb_define_method(rb_cParameterRef, "to_s", s_ParameterRef_ToString, 0); |
7909 | 7721 | rb_define_method(rb_cParameterRef, "keys", s_ParameterRef_Keys, 0); |
@@ -7917,7 +7729,6 @@ Init_Molby(void) | ||
7917 | 7729 | |
7918 | 7730 | /* module Kernel */ |
7919 | 7731 | rb_define_method(rb_mKernel, "check_interrupt", s_Kernel_CheckInterrupt, 0); |
7920 | -/* rb_define_method(rb_mKernel, "idle", s_Kernel_Idle, 1); */ | |
7921 | 7732 | rb_define_method(rb_mKernel, "get_interrupt_flag", s_GetInterruptFlag, 0); |
7922 | 7733 | rb_define_method(rb_mKernel, "set_interrupt_flag", s_SetInterruptFlag, 1); |
7923 | 7734 | rb_define_method(rb_mKernel, "show_progress_panel", s_ShowProgressPanel, -1); |
@@ -171,7 +171,7 @@ s_RubyDialog_ItemIndexForTag(VALUE self, VALUE tag) | ||
171 | 171 | |
172 | 172 | /* |
173 | 173 | * call-seq: |
174 | - * dialog.set_attr(tag, hash) | |
174 | + * set_attr(tag, hash) | |
175 | 175 | * |
176 | 176 | * Set the attributes given in the hash. |
177 | 177 | */ |
@@ -305,7 +305,7 @@ s_RubyDialog_SetAttr(VALUE self, VALUE tag, VALUE hash) | ||
305 | 305 | |
306 | 306 | /* |
307 | 307 | * call-seq: |
308 | - * dialog.attr(tag, key) | |
308 | + * attr(tag, key) | |
309 | 309 | * |
310 | 310 | * Get the attribute for the key. |
311 | 311 | */ |
@@ -419,7 +419,7 @@ s_RubyDialog_Attr(VALUE self, VALUE tag, VALUE key) | ||
419 | 419 | |
420 | 420 | /* |
421 | 421 | * call-seq: |
422 | - * dialog.run | |
422 | + * run | |
423 | 423 | * |
424 | 424 | * Run the modal session for this dialog. |
425 | 425 | */ |
@@ -458,13 +458,13 @@ s_RubyDialog_Run(VALUE self) | ||
458 | 458 | |
459 | 459 | /* |
460 | 460 | * call-seq: |
461 | - * dialog.layout(columns, i11, ..., i1c, i21, ..., i2c, ..., ir1, ..., irc [, options]) => integer | |
461 | + * layout(columns, i11, ..., i1c, i21, ..., i2c, ..., ir1, ..., irc [, options]) => integer | |
462 | 462 | * |
463 | 463 | * Layout items in a table. The first argument is the number of columns, and must be a positive integer. |
464 | 464 | * If the last argument is a hash, then it contains the layout options. |
465 | 465 | * The ixy is the item identifier (a non-negative integer) or [identifier, hash], where the hash |
466 | 466 | * contains the specific options for the item. |
467 | - * Returns an integer that represents the NSView that wraps the items. | |
467 | + * Returns an integer that represents the dialog item. | |
468 | 468 | */ |
469 | 469 | static VALUE |
470 | 470 | s_RubyDialog_Layout(int argc, VALUE *argv, VALUE self) |
@@ -722,11 +722,10 @@ s_RubyDialog_Layout(int argc, VALUE *argv, VALUE self) | ||
722 | 722 | |
723 | 723 | /* |
724 | 724 | * call-seq: |
725 | - * dialog.item(type, hash) => integer | |
725 | + * item(type, hash) -> integer | |
726 | 726 | * |
727 | - * Create a dialog item. | |
728 | - * type: one of the following symbols; :text, :textfield, :radio, :checkbox, :popup | |
729 | - * hash: attributes that can be set by set_attr | |
727 | + * Create a dialog item. Type is one of the following symbols; <tt>:text, :textfield, :radio, | |
728 | + * :checkbox, :popup</tt>. Hash is the attributes that can be set by set_attr. | |
730 | 729 | * Returns an integer that represents the item. (0 and 1 are reserved for "OK" and "Cancel") |
731 | 730 | */ |
732 | 731 | static VALUE |
@@ -828,7 +827,7 @@ s_RubyDialog_Item(int argc, VALUE *argv, VALUE self) | ||
828 | 827 | |
829 | 828 | /* |
830 | 829 | * call-seq: |
831 | - * dialog._items => an array of hash | |
830 | + * _items -> Array of Hash | |
832 | 831 | * |
833 | 832 | * Returns an internal array of items. For debugging use only. |
834 | 833 | */ |
@@ -840,7 +839,7 @@ s_RubyDialog_Items(VALUE self) | ||
840 | 839 | |
841 | 840 | /* |
842 | 841 | * call-seq: |
843 | - * dialog.nitems => integer | |
842 | + * nitems -> integer | |
844 | 843 | * |
845 | 844 | * Returns the number of items. |
846 | 845 | */ |
@@ -854,7 +853,7 @@ s_RubyDialog_Nitems(VALUE self) | ||
854 | 853 | |
855 | 854 | /* |
856 | 855 | * call-seq: |
857 | - * dialog.each_item block | |
856 | + * each_item {|n| ...} | |
858 | 857 | * |
859 | 858 | * Iterate the given block with the item number as the argument. |
860 | 859 | */ |
@@ -872,7 +871,7 @@ s_RubyDialog_EachItem(VALUE self) | ||
872 | 871 | |
873 | 872 | /* |
874 | 873 | * call-seq: |
875 | - * dialog.radio_group(ary) | |
874 | + * radio_group(Array) | |
876 | 875 | * |
877 | 876 | * Group radio buttons as a mutually exclusive group. |
878 | 877 | */ |
@@ -915,14 +914,21 @@ s_RubyDialog_RadioGroup(VALUE self, VALUE aval) | ||
915 | 914 | |
916 | 915 | /* |
917 | 916 | * call-seq: |
918 | - * dialog.action(index) | |
917 | + * action(index) | |
919 | 918 | * |
920 | 919 | * Do the default action for the dialog item with the given index. |
921 | - * If index == 0 (OK) or 1 (Cancel), RubyDialogCallback_endModal() is called. | |
920 | + * If index == 0 (OK) or 1 (Cancel), the modal session of this dialog will end. | |
922 | 921 | * Otherwise, the "action" attribute is looked for the item, and if found |
923 | 922 | * it is called with the given index as the argument (the attribute must be |
924 | 923 | * either a symbol (method name) or a Proc object). |
925 | 924 | * If the "action" attribute is not found, do nothing. |
925 | + * | |
926 | + * It is likely that you will create a new RubyDialog of your own, and | |
927 | + * define a singleton method named +action+ that overrides this method. | |
928 | + * When it is invoked, you can process item-specific actions according to | |
929 | + * the argument index, and if you want to continue the default behavior | |
930 | + * (e.g. to end modal session when "OK" is pressed), just call this | |
931 | + * version by +super+. | |
926 | 932 | */ |
927 | 933 | static VALUE |
928 | 934 | s_RubyDialog_Action(VALUE self, VALUE idx) |
@@ -949,7 +955,7 @@ s_RubyDialog_Action(VALUE self, VALUE idx) | ||
949 | 955 | |
950 | 956 | /* |
951 | 957 | * call-seq: |
952 | - * RubyDialog.save_panel(message = nil, directory = nil, default_filename = nil, wildcard = nil) | |
958 | + * save_panel(message = nil, directory = nil, default_filename = nil, wildcard = nil) | |
953 | 959 | * |
954 | 960 | * Display the "save as" dialog and returns the fullpath filename. |
955 | 961 | */ |
@@ -986,7 +992,7 @@ s_RubyDialog_SavePanel(int argc, VALUE *argv, VALUE klass) | ||
986 | 992 | |
987 | 993 | /* |
988 | 994 | * call-seq: |
989 | - * RubyDialog.open_panel(message = nil, directory = nil, wildcard = nil, for_directories = false, multiple_selection = false) | |
995 | + * open_panel(message = nil, directory = nil, wildcard = nil, for_directories = false, multiple_selection = false) | |
990 | 996 | * |
991 | 997 | * Display the "open" dialog and returns the fullpath filename. |
992 | 998 | */ |
@@ -112,7 +112,7 @@ s_MDArena_Run_or_minimize(VALUE self, VALUE arg, int minimize) | ||
112 | 112 | |
113 | 113 | /* |
114 | 114 | * call-seq: |
115 | - * mdarena.run(n) -> self | |
115 | + * run(n) -> self | |
116 | 116 | * |
117 | 117 | * Run the simulation for n steps. |
118 | 118 | */ |
@@ -124,8 +124,8 @@ s_MDArena_Run(VALUE self, VALUE arg) | ||
124 | 124 | |
125 | 125 | /* |
126 | 126 | * call-seq: |
127 | - * mdarena.minimize(n) -> self | |
128 | - * mdarena.minimize(n) { ... } -> self | |
127 | + * minimize(n) -> self | |
128 | + * minimize(n) { ... } -> self | |
129 | 129 | * |
130 | 130 | * Minimize the energy for n steps. If a block is given, it is executed when minimization is complete. |
131 | 131 | */ |
@@ -137,7 +137,7 @@ s_MDArena_Minimize(VALUE self, VALUE arg) | ||
137 | 137 | |
138 | 138 | /* |
139 | 139 | * call-seq: |
140 | - * mdarena.prepare(check_only = false) -> self or nil | |
140 | + * prepare(check_only = false) -> self or nil | |
141 | 141 | * |
142 | 142 | * Prepare for the MD calculation; refresh the internal information even if initialization is |
143 | 143 | * already done. |
@@ -258,7 +258,7 @@ s_MDArena_Prepare(int argc, VALUE *argv, VALUE self) | ||
258 | 258 | |
259 | 259 | /* |
260 | 260 | * call-seq: |
261 | - * arena.energies -> [total, bond, angle, dihedral, improper, vdw, electrostatic, auxiliary, surface, kinetic, net] | |
261 | + * energies -> [total, bond, angle, dihedral, improper, vdw, electrostatic, auxiliary, surface, kinetic, net] | |
262 | 262 | * |
263 | 263 | * Get the current energies. |
264 | 264 | */ |
@@ -340,9 +340,9 @@ static struct s_MDArenaAttrDef s_MDPressureAttrDefTable[] = { | ||
340 | 340 | |
341 | 341 | /* |
342 | 342 | * call-seq: |
343 | - * arena[attr] | |
343 | + * self[attr] | |
344 | 344 | * |
345 | - * Get the attribute value. | |
345 | + * Get the attribute value. The attribute values also can be accessed by self.attribute_name. | |
346 | 346 | */ |
347 | 347 | static VALUE |
348 | 348 | s_MDArena_Get(VALUE self, VALUE attr) |
@@ -408,12 +408,6 @@ s_MDArena_Get(VALUE self, VALUE attr) | ||
408 | 408 | return Qnil; /* Not reached */ |
409 | 409 | } |
410 | 410 | |
411 | -/* | |
412 | - * call-seq: | |
413 | - * arena.(attrname) | |
414 | - * | |
415 | - * Get the attribute value. The name of the attribute is taken from ruby_frame->last_func. | |
416 | - */ | |
417 | 411 | static VALUE |
418 | 412 | s_MDArena_GetAttr(VALUE self) |
419 | 413 | { |
@@ -422,9 +416,9 @@ s_MDArena_GetAttr(VALUE self) | ||
422 | 416 | |
423 | 417 | /* |
424 | 418 | * call-seq: |
425 | - * arena[attr]= | |
419 | + * self[attr] = value | |
426 | 420 | * |
427 | - * Set the attribute value. | |
421 | + * Set the attribute value. The attributes can also be modified by self.attribute_name = value. | |
428 | 422 | */ |
429 | 423 | static VALUE |
430 | 424 | s_MDArena_Set(VALUE self, VALUE attr, VALUE val) |
@@ -523,12 +517,6 @@ s_MDArena_Set(VALUE self, VALUE attr, VALUE val) | ||
523 | 517 | return Qnil; /* Not reached */ |
524 | 518 | } |
525 | 519 | |
526 | -/* | |
527 | - * call-seq: | |
528 | - * arena.(attrname)= | |
529 | - * | |
530 | - * Set the attribute value. The name of the attribute is taken from ruby_frame->last_func. | |
531 | - */ | |
532 | 520 | static VALUE |
533 | 521 | s_MDArena_SetAttr(VALUE self, VALUE val) |
534 | 522 | { |
@@ -549,7 +537,7 @@ s_MDArena_SetAttr(VALUE self, VALUE val) | ||
549 | 537 | |
550 | 538 | /* |
551 | 539 | * call-seq: |
552 | - * arena.to_hash | |
540 | + * to_hash -> Hash | |
553 | 541 | * |
554 | 542 | * Returns a (frozen) hash that contains the current value for all attribute keys. |
555 | 543 | */ |
@@ -570,7 +558,7 @@ s_MDArena_ToHash(VALUE self) | ||
570 | 558 | |
571 | 559 | /* |
572 | 560 | * call-seq: |
573 | - * arena.print_surface_area | |
561 | + * print_surface_area | |
574 | 562 | * |
575 | 563 | * Print the surface area information to standard output. (for debug) |
576 | 564 | */ |