• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

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

変更サマリ

差分

--- a/MolLib/Ruby_bind/ruby_bind.c
+++ b/MolLib/Ruby_bind/ruby_bind.c
@@ -131,7 +131,7 @@ extern int MyAppControllerGetTextWithPrompt(const char *prompt, char *buf, int b
131131
132132 /*
133133 * call-seq:
134- * MessageOutput.write(str)
134+ * write(str)
135135 *
136136 * Put the message in the main text view.
137137 */
@@ -144,7 +144,7 @@ s_MessageOutput_Write(VALUE self, VALUE str)
144144
145145 /*
146146 * call-seq:
147- * Kernel.message_box(str, title, button = nil, icon = :info)
147+ * message_box(str, title, button = nil, icon = :info)
148148 *
149149 * Show a message box.
150150 * Buttons: nil (ok and cancel), :ok (ok only), :cancel (cancel only)
@@ -187,7 +187,7 @@ s_Kernel_MessageBox(int argc, VALUE *argv, VALUE self)
187187
188188 /*
189189 * call-seq:
190- * Kernel.error_message_box(str)
190+ * error_message_box(str)
191191 *
192192 * Show an error message box.
193193 */
@@ -444,276 +444,6 @@ s_Event_Callback(rb_event_t event, NODE *node, VALUE self, ID rid, VALUE klass)
444444 }
445445 }
446446
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-
717447 /*
718448 * call-seq:
719449 * ask(prompt, default = nil) -> string
@@ -833,7 +563,7 @@ s_Kernel_DocumentHome(VALUE self)
833563
834564 /*
835565 * call-seq:
836- * Kernel.get_global_settings(key)
566+ * get_global_settings(key)
837567 *
838568 * Get a setting data for key from the application preferences.
839569 */
@@ -850,7 +580,7 @@ s_Kernel_GetGlobalSettings(VALUE self, VALUE key)
850580
851581 /*
852582 * call-seq:
853- * Kernel.set_global_settings(key, value)
583+ * set_global_settings(key, value)
854584 *
855585 * Set a setting data for key to the application preferences.
856586 */
@@ -952,12 +682,24 @@ static const char *s_ParameterTypeNames[] = {
952682 "bond", "angle", "dihedral", "improper", "vdw", "vdw_pair", "vdw_cutoff", "atom"
953683 };
954684
685+/*
686+ * call-seq:
687+ * index -> Integer
688+ *
689+ * Get the index in the parameter list.
690+ */
955691 static VALUE s_ParameterRef_GetIndex(VALUE self) {
956692 ParameterRef *pref;
957693 Data_Get_Struct(self, ParameterRef, pref);
958694 return INT2NUM(pref->idx);
959695 }
960696
697+/*
698+ * call-seq:
699+ * par_type -> String
700+ *
701+ * Get the parameter type, like "bond", "angle", etc.
702+ */
961703 static VALUE s_ParameterRef_GetParType(VALUE self) {
962704 Int tp;
963705 s_UnionParFromValue(self, &tp, 0);
@@ -967,6 +709,16 @@ static VALUE s_ParameterRef_GetParType(VALUE self) {
967709 else rb_raise(rb_eMolbyError, "Internal error: parameter type tag is out of range (%d)", tp);
968710 }
969711
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+ */
970722 static VALUE s_ParameterRef_GetAtomTypes(VALUE self) {
971723 UnionPar *up;
972724 Int tp, i, n, types[4];
@@ -1026,6 +778,12 @@ static VALUE s_ParameterRef_GetAtomTypes(VALUE self) {
1026778 return rb_ary_new4(n, vals);
1027779 }
1028780
781+/*
782+ * call-seq:
783+ * k -> Float
784+ *
785+ * Get the force constant. Available for bond, angle, dihedral, and improper parameters.
786+ */
1029787 static VALUE s_ParameterRef_GetK(VALUE self) {
1030788 UnionPar *up;
1031789 Int tp, i, n;
@@ -1051,6 +809,12 @@ static VALUE s_ParameterRef_GetK(VALUE self) {
1051809 }
1052810 }
1053811
812+/*
813+ * call-seq:
814+ * r0 -> Float
815+ *
816+ * Get the equilibrium bond length. Only available for bond parameters.
817+ */
1054818 static VALUE s_ParameterRef_GetR0(VALUE self) {
1055819 UnionPar *up;
1056820 Int tp;
@@ -1060,6 +824,12 @@ static VALUE s_ParameterRef_GetR0(VALUE self) {
1060824 else rb_raise(rb_eMolbyError, "invalid member r0");
1061825 }
1062826
827+/*
828+ * call-seq:
829+ * a0 -> Float
830+ *
831+ * Get the equilibrium angle (in degree). Only available for angle parameters.
832+ */
1063833 static VALUE s_ParameterRef_GetA0(VALUE self) {
1064834 UnionPar *up;
1065835 Int tp;
@@ -1069,6 +839,13 @@ static VALUE s_ParameterRef_GetA0(VALUE self) {
1069839 else rb_raise(rb_eMolbyError, "invalid member a0");
1070840 }
1071841
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+ */
1072849 static VALUE s_ParameterRef_GetMult(VALUE self) {
1073850 UnionPar *up;
1074851 Int tp;
@@ -1078,6 +855,14 @@ static VALUE s_ParameterRef_GetMult(VALUE self) {
1078855 else rb_raise(rb_eMolbyError, "invalid member mult");
1079856 }
1080857
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+ */
1081866 static VALUE s_ParameterRef_GetPeriod(VALUE self) {
1082867 UnionPar *up;
1083868 Int tp, i, n;
@@ -1085,16 +870,24 @@ static VALUE s_ParameterRef_GetPeriod(VALUE self) {
1085870 up = s_UnionParFromValue(self, &tp, 0);
1086871 if (tp == kDihedralParType || tp == kImproperParType) {
1087872 if (up->torsion.mult == 1)
1088- return rb_float_new(up->torsion.period[0]);
873+ return INT2NUM(up->torsion.period[0]);
1089874 n = up->torsion.mult;
1090875 if (n > 3)
1091876 n = 3;
1092877 for (i = 0; i < n; i++)
1093- vals[i] = rb_float_new(up->torsion.period[i]);
878+ vals[i] = INT2NUM(up->torsion.period[i]);
1094879 return rb_ary_new4(n, vals);
1095880 } else rb_raise(rb_eMolbyError, "invalid member period");
1096881 }
1097882
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+ */
1098891 static VALUE s_ParameterRef_GetPhi0(VALUE self) {
1099892 UnionPar *up;
1100893 Int tp, i, n;
@@ -1112,6 +905,12 @@ static VALUE s_ParameterRef_GetPhi0(VALUE self) {
1112905 } else rb_raise(rb_eMolbyError, "invalid member phi0");
1113906 }
1114907
908+/*
909+ * call-seq:
910+ * A -> Float
911+ *
912+ * Get the "A" value for the van der Waals parameter.
913+ */
1115914 static VALUE s_ParameterRef_GetA(VALUE self) {
1116915 UnionPar *up;
1117916 Int tp;
@@ -1123,6 +922,12 @@ static VALUE s_ParameterRef_GetA(VALUE self) {
1123922 else rb_raise(rb_eMolbyError, "invalid member A");
1124923 }
1125924
925+/*
926+ * call-seq:
927+ * B -> Float
928+ *
929+ * Get the "B" value for the van der Waals parameter.
930+ */
1126931 static VALUE s_ParameterRef_GetB(VALUE self) {
1127932 UnionPar *up;
1128933 Int tp;
@@ -1134,6 +939,12 @@ static VALUE s_ParameterRef_GetB(VALUE self) {
1134939 else rb_raise(rb_eMolbyError, "invalid member B");
1135940 }
1136941
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+ */
1137948 static VALUE s_ParameterRef_GetReq(VALUE self) {
1138949 UnionPar *up;
1139950 Int tp;
@@ -1154,6 +965,12 @@ static VALUE s_ParameterRef_GetReq(VALUE self) {
1154965 /* else return rb_float_new(pow(2*a/b, 1.0/6.0)); */
1155966 }
1156967
968+/*
969+ * call-seq:
970+ * eps -> Float
971+ *
972+ * Get the minimum energy for the van der Waals parameter.
973+ */
1157974 static VALUE s_ParameterRef_GetEps(VALUE self) {
1158975 UnionPar *up;
1159976 Int tp;
@@ -1174,6 +991,12 @@ static VALUE s_ParameterRef_GetEps(VALUE self) {
1174991 /* else return rb_float_new(b*b/a/4.0 * INTERNAL2KCAL); */
1175992 }
1176993
994+/*
995+ * call-seq:
996+ * A14 -> Float
997+ *
998+ * Get the "A" value for the 1-4 van der Waals parameter.
999+ */
11771000 static VALUE s_ParameterRef_GetA14(VALUE self) {
11781001 UnionPar *up;
11791002 Int tp;
@@ -1185,6 +1008,12 @@ static VALUE s_ParameterRef_GetA14(VALUE self) {
11851008 else rb_raise(rb_eMolbyError, "invalid member A14");
11861009 }
11871010
1011+/*
1012+ * call-seq:
1013+ * B14 -> Float
1014+ *
1015+ * Get the "B" value for the 1-4 van der Waals parameter.
1016+ */
11881017 static VALUE s_ParameterRef_GetB14(VALUE self) {
11891018 UnionPar *up;
11901019 Int tp;
@@ -1196,6 +1025,12 @@ static VALUE s_ParameterRef_GetB14(VALUE self) {
11961025 else rb_raise(rb_eMolbyError, "invalid member B14");
11971026 }
11981027
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+ */
11991034 static VALUE s_ParameterRef_GetReq14(VALUE self) {
12001035 UnionPar *up;
12011036 Int tp;
@@ -1216,6 +1051,12 @@ static VALUE s_ParameterRef_GetReq14(VALUE self) {
12161051 /* else return rb_float_new(pow(2*a/b, 1.0/6.0)); */
12171052 }
12181053
1054+/*
1055+ * call-seq:
1056+ * eps14 -> Float
1057+ *
1058+ * Get the minimum energy for the 1-4 van der Waals parameter.
1059+ */
12191060 static VALUE s_ParameterRef_GetEps14(VALUE self) {
12201061 UnionPar *up;
12211062 Int tp;
@@ -1236,6 +1077,12 @@ static VALUE s_ParameterRef_GetEps14(VALUE self) {
12361077 /* else return rb_float_new(b*b/a/4.0 * INTERNAL2KCAL); */
12371078 }
12381079
1080+/*
1081+ * call-seq:
1082+ * cutoff -> Float
1083+ *
1084+ * Get the cutoff distance for the van der Waals pair-specific cutoff parameter.
1085+ */
12391086 static VALUE s_ParameterRef_GetCutoff(VALUE self) {
12401087 UnionPar *up;
12411088 Int tp;
@@ -1245,6 +1092,12 @@ static VALUE s_ParameterRef_GetCutoff(VALUE self) {
12451092 else rb_raise(rb_eMolbyError, "invalid member cutoff");
12461093 }
12471094
1095+/*
1096+ * call-seq:
1097+ * radius -> Float
1098+ *
1099+ * Get the atomic radius for the atom display parameter.
1100+ */
12481101 static VALUE s_ParameterRef_GetRadius(VALUE self) {
12491102 UnionPar *up;
12501103 Int tp;
@@ -1254,6 +1107,12 @@ static VALUE s_ParameterRef_GetRadius(VALUE self) {
12541107 else rb_raise(rb_eMolbyError, "invalid member radius");
12551108 }
12561109
1110+/*
1111+ * call-seq:
1112+ * color -> [Float, Float, Float]
1113+ *
1114+ * Get the rgb color for the atom display parameter.
1115+ */
12571116 static VALUE s_ParameterRef_GetColor(VALUE self) {
12581117 UnionPar *up;
12591118 Int tp;
@@ -1263,6 +1122,12 @@ static VALUE s_ParameterRef_GetColor(VALUE self) {
12631122 else rb_raise(rb_eMolbyError, "invalid member color");
12641123 }
12651124
1125+/*
1126+ * call-seq:
1127+ * atomic_number -> Integer
1128+ *
1129+ * Get the atomic number for the atom display parameter.
1130+ */
12661131 static VALUE s_ParameterRef_GetAtomicNumber(VALUE self) {
12671132 UnionPar *up;
12681133 Int tp;
@@ -1272,6 +1137,12 @@ static VALUE s_ParameterRef_GetAtomicNumber(VALUE self) {
12721137 else rb_raise(rb_eMolbyError, "invalid member atomic_number");
12731138 }
12741139
1140+/*
1141+ * call-seq:
1142+ * name -> String
1143+ *
1144+ * Get the name for the atom display parameter.
1145+ */
12751146 static VALUE s_ParameterRef_GetName(VALUE self) {
12761147 UnionPar *up;
12771148 Int tp;
@@ -1284,6 +1155,12 @@ static VALUE s_ParameterRef_GetName(VALUE self) {
12841155 } else rb_raise(rb_eMolbyError, "invalid member name");
12851156 }
12861157
1158+/*
1159+ * call-seq:
1160+ * weight -> Float
1161+ *
1162+ * Get the atomic weight for the atom display parameter.
1163+ */
12871164 static VALUE s_ParameterRef_GetWeight(VALUE self) {
12881165 UnionPar *up;
12891166 Int tp;
@@ -1295,6 +1172,12 @@ static VALUE s_ParameterRef_GetWeight(VALUE self) {
12951172 else rb_raise(rb_eMolbyError, "invalid member weight");
12961173 }
12971174
1175+/*
1176+ * call-seq:
1177+ * fullname -> String
1178+ *
1179+ * Get the full name for the atom display parameter.
1180+ */
12981181 static VALUE s_ParameterRef_GetFullName(VALUE self) {
12991182 UnionPar *up;
13001183 Int tp;
@@ -1307,6 +1190,12 @@ static VALUE s_ParameterRef_GetFullName(VALUE self) {
13071190 } else rb_raise(rb_eMolbyError, "invalid member fullname");
13081191 }
13091192
1193+/*
1194+ * call-seq:
1195+ * comment -> String
1196+ *
1197+ * Get the comment for the parameter.
1198+ */
13101199 static VALUE s_ParameterRef_GetComment(VALUE self) {
13111200 UnionPar *up;
13121201 Int tp, com;
@@ -1317,6 +1206,13 @@ static VALUE s_ParameterRef_GetComment(VALUE self) {
13171206 else return rb_str_new2(ParameterGetComment(com));
13181207 }
13191208
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+ */
13201216 static VALUE s_ParameterRef_GetSource(VALUE self) {
13211217 UnionPar *up;
13221218 Int tp, src;
@@ -1963,7 +1859,7 @@ s_ParameterRef_GetAttr(VALUE self, VALUE key)
19631859
19641860 /*
19651861 * call-seq:
1966- * parameter.keys(idx) -> array of valid parameter attributes
1862+ * keys(idx) -> array of valid parameter attributes
19671863 *
19681864 * Returns an array of valid parameter attributes (as Symbols).
19691865 */
@@ -1996,7 +1892,7 @@ s_ParameterRef_Keys(VALUE self)
19961892
19971893 /*
19981894 * call-seq:
1999- * parameter.to_hash(idx) -> hash
1895+ * to_hash(idx) -> Hash
20001896 *
20011897 * Returns a hash containing valid parameter names and values
20021898 */
@@ -2019,7 +1915,7 @@ s_ParameterRef_ToHash(VALUE self)
20191915
20201916 /*
20211917 * call-seq:
2022- * parameter.to_s(idx) -> string
1918+ * parameter.to_s(idx) -> String
20231919 *
20241920 * Returns a string representation of the given parameter
20251921 */
@@ -2117,7 +2013,7 @@ s_MoleculeFromParameterOrParEnumerableValue(VALUE val)
21172013
21182014 /*
21192015 * call-seq:
2120- * Parameter.builtin -> parameter
2016+ * builtin -> Parameter
21212017 *
21222018 * Returns a parameter value that points to the global (builtin) parameters.
21232019 */
@@ -2130,15 +2026,14 @@ s_Parameter_Builtin(VALUE self)
21302026
21312027 /*
21322028 * call-seq:
2133- * Parameter.bond(idx) -> parameterRef
2134- * Parameter.bond(t1, t2) -> parameterRef
2029+ * bond(idx) -> ParameterRef
2030+ * bond(t1, t2) -> ParameterRef
21352031 *
21362032 * 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
21382034 * are the atom type string (up to 4 characters).
21392035 * If the method is used as a singleton method, then the default parameters are looked up.
21402036 * 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).
21422037 */
21432038 static VALUE
21442039 s_Parameter_Bond(int argc, VALUE *argv, VALUE self)
@@ -2178,15 +2073,14 @@ s_Parameter_Bond(int argc, VALUE *argv, VALUE self)
21782073
21792074 /*
21802075 * call-seq:
2181- * Parameter.angle(idx) -> parameterRef
2182- * Parameter.angle(t1, t2, t3) -> parameterRef
2076+ * angle(idx) -> ParameterRef
2077+ * angle(t1, t2, t3) -> ParameterRef
21832078 *
21842079 * 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
21862081 * are the atom type string (up to 4 characters).
21872082 * If the method is used as a singleton method, then the default parameters are looked up.
21882083 * 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).
21902084 */
21912085 static VALUE
21922086 s_Parameter_Angle(int argc, VALUE *argv, VALUE self)
@@ -2227,15 +2121,14 @@ s_Parameter_Angle(int argc, VALUE *argv, VALUE self)
22272121
22282122 /*
22292123 * 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
22322126 *
22332127 * 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
22352129 * are the atom type string (up to 4 characters).
22362130 * If the method is used as a singleton method, then the default parameters are looked up.
22372131 * 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).
22392132 */
22402133 static VALUE
22412134 s_Parameter_Dihedral(int argc, VALUE *argv, VALUE self)
@@ -2277,15 +2170,14 @@ s_Parameter_Dihedral(int argc, VALUE *argv, VALUE self)
22772170
22782171 /*
22792172 * 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
22822175 *
22832176 * 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
22852178 * are the atom type string (up to 4 characters).
22862179 * If the method is used as a singleton method, then the default parameters are looked up.
22872180 * 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).
22892181 */
22902182 static VALUE
22912183 s_Parameter_Improper(int argc, VALUE *argv, VALUE self)
@@ -2327,15 +2219,14 @@ s_Parameter_Improper(int argc, VALUE *argv, VALUE self)
23272219
23282220 /*
23292221 * call-seq:
2330- * Parameter.vdw(idx) -> parameterRef
2331- * Parameter.vdw(t1) -> parameterRef
2222+ * vdw(idx) -> ParameterRef
2223+ * vdw(t1) -> ParameterRef
23322224 *
23332225 * 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
23352227 * are the atom type string (up to 4 characters).
23362228 * If the method is used as a singleton method, then the default parameters are looked up.
23372229 * 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).
23392230 */
23402231 static VALUE
23412232 s_Parameter_Vdw(int argc, VALUE *argv, VALUE self)
@@ -2376,15 +2267,14 @@ s_Parameter_Vdw(int argc, VALUE *argv, VALUE self)
23762267
23772268 /*
23782269 * 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
23812272 *
23822273 * 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
23842275 * are the atom type string (up to 4 characters).
23852276 * If the method is used as a singleton method, then the default parameters are looked up.
23862277 * 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).
23882278 */
23892279 static VALUE
23902280 s_Parameter_VdwPair(int argc, VALUE *argv, VALUE self)
@@ -2424,15 +2314,14 @@ s_Parameter_VdwPair(int argc, VALUE *argv, VALUE self)
24242314
24252315 /*
24262316 * 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
24292319 *
24302320 * 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
24322322 * are the atom type string (up to 4 characters).
24332323 * If the method is used as a singleton method, then the default parameters are looked up.
24342324 * 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).
24362325 */
24372326 static VALUE
24382327 s_Parameter_VdwCutoff(int argc, VALUE *argv, VALUE self)
@@ -2472,12 +2361,12 @@ s_Parameter_VdwCutoff(int argc, VALUE *argv, VALUE self)
24722361
24732362 /*
24742363 * call-seq:
2475- * Parameter.atom(idx) -> parameterRef
2476- * Parameter.atom(t1) -> parameterRef
2364+ * atom(idx) -> ParameterRef
2365+ * atom(t1) -> ParameterRef
24772366 *
24782367 * 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).
24812370 * Unlike other Parameter methods, this is used only as a singleton method, because
24822371 * the all atom parameters are global.
24832372 */
@@ -2512,7 +2401,7 @@ s_Parameter_Atom(int argc, VALUE *argv, VALUE self)
25122401
25132402 /*
25142403 * call-seq:
2515- * Parameter.nbonds -> integer
2404+ * nbonds -> Integer
25162405 *
25172406 * Returns the number of bond parameters. If the method is used as a singleton method,
25182407 * then only the default parameters are examined. Otherwise, the total number of the
@@ -2531,7 +2420,7 @@ s_Parameter_Nbonds(VALUE self)
25312420
25322421 /*
25332422 * call-seq:
2534- * Parameter.nangles -> integer
2423+ * nangles -> Integer
25352424 *
25362425 * Returns the number of angle parameters. If the method is used as a singleton method,
25372426 * then only the default parameters are examined. Otherwise, the total number of the
@@ -2550,7 +2439,7 @@ s_Parameter_Nangles(VALUE self)
25502439
25512440 /*
25522441 * call-seq:
2553- * Parameter.ndihedrals -> integer
2442+ * ndihedrals -> Integer
25542443 *
25552444 * Returns the number of dihedral parameters. If the method is used as a singleton method,
25562445 * then only the default parameters are examined. Otherwise, the total number of the
@@ -2569,7 +2458,7 @@ s_Parameter_Ndihedrals(VALUE self)
25692458
25702459 /*
25712460 * call-seq:
2572- * Parameter.nimpropers -> integer
2461+ * nimpropers -> Integer
25732462 *
25742463 * Returns the number of improper parameters. If the method is used as a singleton method,
25752464 * then only the default parameters are examined. Otherwise, the total number of the
@@ -2588,7 +2477,7 @@ s_Parameter_Nimpropers(VALUE self)
25882477
25892478 /*
25902479 * call-seq:
2591- * Parameter.nvdws -> integer
2480+ * nvdws -> Integer
25922481 *
25932482 * Returns the number of vdw parameters. If the method is used as a singleton method,
25942483 * then only the default parameters are examined. Otherwise, the total number of the
@@ -2607,7 +2496,7 @@ s_Parameter_Nvdws(VALUE self)
26072496
26082497 /*
26092498 * call-seq:
2610- * Parameter.nvdw_pairs -> integer
2499+ * nvdw_pairs -> Integer
26112500 *
26122501 * Returns the number of vdw pair parameters. If the method is used as a singleton method,
26132502 * then only the default parameters are examined. Otherwise, the total number of the
@@ -2626,7 +2515,7 @@ s_Parameter_NvdwPairs(VALUE self)
26262515
26272516 /*
26282517 * call-seq:
2629- * Parameter.nvdw_cutoffs -> integer
2518+ * nvdw_cutoffs -> Integer
26302519 *
26312520 * Returns the number of vdw cutoff parameters. If the method is used as a singleton method,
26322521 * then only the default parameters are examined. Otherwise, the total number of the
@@ -2645,7 +2534,7 @@ s_Parameter_NvdwCutoffs(VALUE self)
26452534
26462535 /*
26472536 * call-seq:
2648- * Parameter.natoms -> integer
2537+ * natoms -> Integer
26492538 *
26502539 * Returns the number of atom parameters. Unlike other Parameter methods, this
26512540 * method is used only as a singleton method, because all atom parameters are global.
@@ -2658,7 +2547,7 @@ s_Parameter_Natoms(VALUE self)
26582547
26592548 /*
26602549 * call-seq:
2661- * Parameter.bonds -> ParEnumerable
2550+ * bonds -> ParEnumerable
26622551 *
26632552 * Returns a ParEnumerable value that (formally) points to the collection of bond parameters.
26642553 * Parameter.bonds[x] is equivalent to Parameter.bond(x). ParEnumerable class is
@@ -2673,7 +2562,7 @@ s_Parameter_Bonds(VALUE self)
26732562
26742563 /*
26752564 * call-seq:
2676- * Parameter.angles -> ParEnumerable
2565+ * angles -> ParEnumerable
26772566 *
26782567 * Returns a ParEnumerable value that (formally) points to the collection of angle parameters.
26792568 * Parameter.angles[x] is equivalent to Parameter.angle(x). ParEnumerable class is
@@ -2688,7 +2577,7 @@ s_Parameter_Angles(VALUE self)
26882577
26892578 /*
26902579 * call-seq:
2691- * Parameter.dihedrals -> ParEnumerable
2580+ * dihedrals -> ParEnumerable
26922581 *
26932582 * Returns a ParEnumerable value that (formally) points to the collection of dihedral parameters.
26942583 * Parameter.dihedrals[x] is equivalent to Parameter.dihedral(x). ParEnumerable class is
@@ -2703,7 +2592,7 @@ s_Parameter_Dihedrals(VALUE self)
27032592
27042593 /*
27052594 * call-seq:
2706- * Parameter.impropers -> ParEnumerable
2595+ * impropers -> ParEnumerable
27072596 *
27082597 * Returns a ParEnumerable value that (formally) points to the collection of improper parameters.
27092598 * Parameter.impropers[x] is equivalent to Parameter.improper(x). ParEnumerable class is
@@ -2718,7 +2607,7 @@ s_Parameter_Impropers(VALUE self)
27182607
27192608 /*
27202609 * call-seq:
2721- * Parameter.vdws -> ParEnumerable
2610+ * vdws -> ParEnumerable
27222611 *
27232612 * Returns a ParEnumerable value that (formally) points to the collection of vdw parameters.
27242613 * Parameter.vdws[x] is equivalent to Parameter.vdw(x). ParEnumerable class is
@@ -2733,7 +2622,7 @@ s_Parameter_Vdws(VALUE self)
27332622
27342623 /*
27352624 * call-seq:
2736- * Parameter.vdw_pairs -> ParEnumerable
2625+ * vdw_pairs -> ParEnumerable
27372626 *
27382627 * Returns a ParEnumerable value that (formally) points to the collection of vdw pair parameters.
27392628 * Parameter.vdw_pairs[x] is equivalent to Parameter.vdw_pair(x). ParEnumerable class is
@@ -2748,7 +2637,7 @@ s_Parameter_VdwPairs(VALUE self)
27482637
27492638 /*
27502639 * call-seq:
2751- * Parameter.vdw_cutoffs -> ParEnumerable
2640+ * vdw_cutoffs -> ParEnumerable
27522641 *
27532642 * Returns a ParEnumerable value that (formally) points to the collection of vdw cutoff parameters.
27542643 * Parameter.vdw_cutoffs[x] is equivalent to Parameter.vdw_cutoff(x). ParEnumerable class is
@@ -2763,7 +2652,7 @@ s_Parameter_VdwCutoffs(VALUE self)
27632652
27642653 /*
27652654 * call-seq:
2766- * Parameter.atoms -> ParEnumerable
2655+ * atoms -> ParEnumerable
27672656 *
27682657 * Returns a ParEnumerable value that (formally) points to the collection of atom parameters.
27692658 * Parameter.atoms[x] is equivalent to Parameter.atom(x). ParEnumerable class is
@@ -2828,7 +2717,17 @@ s_NewParEnumerableValueFromMoleculeAndType(Molecule *mol, Int parType)
28282717 return Data_Wrap_Struct(rb_cParEnumerable, 0, (void (*)(void *))s_ParEnumerableRelease, pen);
28292718 }
28302719
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+ */
28322731 static VALUE
28332732 s_ParEnumerable_Aref(int argc, VALUE *argv, VALUE self)
28342733 {
@@ -2850,6 +2749,12 @@ s_ParEnumerable_Aref(int argc, VALUE *argv, VALUE self)
28502749 return Qnil; /* Not reached */
28512750 }
28522751
2752+/*
2753+ * call-seq:
2754+ * length -> Integer
2755+ *
2756+ * Returns the number of parameters included in this enumerable.
2757+ */
28532758 static VALUE
28542759 s_ParEnumerable_Length(VALUE self)
28552760 {
@@ -2871,6 +2776,12 @@ s_ParEnumerable_Length(VALUE self)
28712776 return Qnil; /* Not reached */
28722777 }
28732778
2779+/*
2780+ * call-seq:
2781+ * each {|pref| ...}
2782+ *
2783+ * Call the block for each parameter, passing a ParameterRef object as a block argument.
2784+ */
28742785 VALUE
28752786 s_ParEnumerable_Each(VALUE self)
28762787 {
@@ -2913,6 +2824,12 @@ s_ParEnumerable_Each(VALUE self)
29132824 return self;
29142825 }
29152826
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+ */
29162833 VALUE
29172834 s_ParEnumerable_ReverseEach(VALUE self)
29182835 {
@@ -2955,7 +2872,7 @@ s_ParEnumerable_ReverseEach(VALUE self)
29552872
29562873 /*
29572874 * call-seq:
2958- * ParEnumerable.insert(idx = nil, pref = nil) -> ParameterRef
2875+ * insert(idx = nil, pref = nil) -> ParameterRef
29592876 *
29602877 * Insert a new parameter at the specified position (if idx is nil, then at the end).
29612878 * 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)
30072924
30082925 /*
30092926 * call-seq:
3010- * ParEnumerable.delete(int)
3011- * ParEnumerable.delete(intgroup)
2927+ * delete(Integer)
2928+ * delete(IntGroup)
30122929 *
30132930 * Delete the parameter(s) specified by the argument.
30142931 */
@@ -3043,8 +2960,8 @@ s_ParEnumerable_Delete(VALUE self, VALUE ival)
30432960
30442961 /*
30452962 * 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
30482965 *
30492966 * Find the parameter record that matches the given atom types. The atom types are given
30502967 * 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)
37733690
37743691 static int s_Molecule_AtomIndexFromValue(Molecule *, VALUE);
37753692
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+ */
37773701 static VALUE
37783702 s_MolEnumerable_Aref(VALUE self, VALUE arg1)
37793703 {
@@ -3823,6 +3747,12 @@ s_MolEnumerable_Aref(VALUE self, VALUE arg1)
38233747 return Qnil;
38243748 }
38253749
3750+/*
3751+ * call-seq:
3752+ * length -> Integer
3753+ *
3754+ * Returns the number of objects included in this enumerable.
3755+ */
38263756 static VALUE
38273757 s_MolEnumerable_Length(VALUE self)
38283758 {
@@ -3845,6 +3775,16 @@ s_MolEnumerable_Length(VALUE self)
38453775 return INT2NUM(-1);
38463776 }
38473777
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+ */
38483788 VALUE
38493789 s_MolEnumerable_Each(VALUE self)
38503790 {
@@ -3936,7 +3876,7 @@ s_Molecule_Alloc(VALUE klass)
39363876
39373877 /*
39383878 * call-seq:
3939- * molecule.dup -> molecule
3879+ * dup -> Molecule
39403880 *
39413881 * Duplicate a molecule. All entries are deep copied, so modifying the newly
39423882 * created object does not affect the old object in any sense.
@@ -3954,7 +3894,7 @@ s_Molecule_InitCopy(VALUE self, VALUE arg)
39543894
39553895 /*
39563896 * call-seq:
3957- * molecule.loadmbsf(file) -> boolean
3897+ * loadmbsf(file) -> bool
39583898 *
39593899 * Read a structure from a mbsf file.
39603900 * Return true if successful.
@@ -3981,7 +3921,7 @@ s_Molecule_Loadmbsf(int argc, VALUE *argv, VALUE self)
39813921
39823922 /*
39833923 * call-seq:
3984- * molecule.loadpsf(file, pdbfile = nil) -> boolean
3924+ * loadpsf(file, pdbfile = nil) -> bool
39853925 *
39863926 * Read a structure from a psf file. molecule must be empty. The psf may be
39873927 * an "extended" version, which also contains coordinates. If pdbfile
@@ -4036,7 +3976,7 @@ s_Molecule_Loadpsf(int argc, VALUE *argv, VALUE self)
40363976
40373977 /*
40383978 * call-seq:
4039- * molecule.loadpdb(file) -> boolean
3979+ * loadpdb(file) -> bool
40403980 *
40413981 * Read coordinates from a pdb file. If molecule is empty, then structure is build
40423982 * 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)
40644004
40654005 /*
40664006 * call-seq:
4067- * molecule.loaddcd(file) -> boolean
4007+ * loaddcd(file) -> bool
40684008 *
40694009 * Read coordinates from a dcd file. The molecule should not empty.
40704010 * Return true if successful.
@@ -4091,7 +4031,7 @@ s_Molecule_Loaddcd(int argc, VALUE *argv, VALUE self)
40914031
40924032 /*
40934033 * call-seq:
4094- * molecule.loadtep(file) -> boolean
4034+ * loadtep(file) -> bool
40954035 *
40964036 * Read coordinates from an ortep .tep file.
40974037 * Return true if successful.
@@ -4118,7 +4058,7 @@ s_Molecule_Loadtep(int argc, VALUE *argv, VALUE self)
41184058
41194059 /*
41204060 * call-seq:
4121- * molecule.loadres(file) -> boolean
4061+ * loadres(file) -> bool
41224062 *
41234063 * Read coordinates from a shelx .res file.
41244064 * Return true if successful.
@@ -4145,7 +4085,7 @@ s_Molecule_Loadres(int argc, VALUE *argv, VALUE self)
41454085
41464086 /*
41474087 * call-seq:
4148- * molecule.loadfchk(file) -> boolean
4088+ * loadfchk(file) -> bool
41494089 *
41504090 * Read coordinates and MO information from a Gaussian fchk file. (TODO: implement this)
41514091 * Return true if successful.
@@ -4172,7 +4112,7 @@ s_Molecule_Loadfchk(int argc, VALUE *argv, VALUE self)
41724112
41734113 /*
41744114 * call-seq:
4175- * molecule.loaddat(file) -> boolean
4115+ * loaddat(file) -> bool
41764116 *
41774117 * Read coordinates and ESP information from a GAMESS dat file. (TODO: read MO info as well)
41784118 * Return true if successful.
@@ -4199,7 +4139,7 @@ s_Molecule_Loaddat(int argc, VALUE *argv, VALUE self)
41994139
42004140 /*
42014141 * call-seq:
4202- * molecule.savembsf(file) -> boolean
4142+ * savembsf(file) -> bool
42034143 *
42044144 * Write structure as a mbsf file. Returns true if successful.
42054145 */
@@ -4218,7 +4158,7 @@ s_Molecule_Savembsf(VALUE self, VALUE fname)
42184158
42194159 /*
42204160 * call-seq:
4221- * molecule.savepsf(file) -> boolean
4161+ * savepsf(file) -> bool
42224162 *
42234163 * Write structure as a psf file. Returns true if successful.
42244164 */
@@ -4237,7 +4177,7 @@ s_Molecule_Savepsf(VALUE self, VALUE fname)
42374177
42384178 /*
42394179 * call-seq:
4240- * molecule.savepdb(file) -> boolean
4180+ * savepdb(file) -> bool
42414181 *
42424182 * Write coordinates as a pdb file. Returns true if successful.
42434183 */
@@ -4256,7 +4196,7 @@ s_Molecule_Savepdb(VALUE self, VALUE fname)
42564196
42574197 /*
42584198 * call-seq:
4259- * molecule.savedcd(file) -> boolean
4199+ * savedcd(file) -> bool
42604200 *
42614201 * Write coordinates as a dcd file. Returns true if successful.
42624202 */
@@ -4275,7 +4215,7 @@ s_Molecule_Savedcd(VALUE self, VALUE fname)
42754215
42764216 /*
42774217 * call-seq:
4278- * molecule.savetep(file) -> boolean
4218+ * savetep(file) -> bool
42794219 *
42804220 * Write coordinates as an ORTEP file. Returns true if successful.
42814221 */
@@ -4353,31 +4293,12 @@ s_Molecule_LoadSave(int argc, VALUE *argv, VALUE self, int loadFlag)
43534293 }
43544294 }
43554295 }
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
43754296 rb_raise(rb_eMolbyError, "the file %s cannot be %s", argstr, (loadFlag ? "loaded" : "saved"));
43764297 }
43774298
43784299 /*
43794300 * call-seq:
4380- * molecule.molload(file, *args) -> boolean
4301+ * molload(file, *args) -> bool
43814302 *
43824303 * Read a structure from the given file by calling the public method "loadXXX" (XXX is the
43834304 * 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)
43914312
43924313 /*
43934314 * call-seq:
4394- * molecule.molsave(file, *args) -> boolean
4315+ * molsave(file, *args) -> bool
43954316 *
43964317 * Write a structure/coordinate to the given file by calling the public method "saveXXX"
43974318 * (XXX is the file type given by the extension).
@@ -4404,7 +4325,7 @@ s_Molecule_Save(int argc, VALUE *argv, VALUE self)
44044325
44054326 /*
44064327 * call-seq:
4407- * molecule.name -> string
4328+ * name -> String
44084329 *
44094330 * Returns the display name of the molecule. If the molecule has no associated
44104331 * document, then returns nil.
@@ -4424,7 +4345,7 @@ s_Molecule_Name(VALUE self)
44244345
44254346 /*
44264347 * call-seq:
4427- * molecule.path -> string
4348+ * path -> String
44284349 *
44294350 * Returns the full path name of the molecule, if it is associated with a file.
44304351 * If the molecule has no associated file, then returns nil.
@@ -4444,7 +4365,7 @@ s_Molecule_Path(VALUE self)
44444365
44454366 /*
44464367 * call-seq:
4447- * molecule.dir -> string
4368+ * dir -> String
44484369 *
44494370 * Returns the full path name of the directory in which the file associated with the
44504371 * molecule is located. If the molecule has no associated file, then returns nil.
@@ -4471,7 +4392,7 @@ s_Molecule_Dir(VALUE self)
44714392
44724393 /*
44734394 * call-seq:
4474- * molecule.inspect -> string
4395+ * inspect -> String
44754396 *
44764397 * Returns a string in the form "Molecule[name]" if the molecule has the associated
44774398 * document. Otherwise, a string "<Molecule:0x****>" (the address is the address of
@@ -4512,9 +4433,9 @@ s_Molecule_Inspect(VALUE self)
45124433
45134434 /*
45144435 * call-seq:
4515- * Molecule.open(file) -> molecule
4436+ * open(file) -> Molecule
45164437 *
4517- * Create a new molecule from file. This assumes MoleculeCallback_openNewMolecule() is implemented.
4438+ * Create a new molecule from file.
45184439 */
45194440 static VALUE
45204441 s_Molecule_Open(VALUE self, VALUE fname)
@@ -4532,8 +4453,7 @@ s_Molecule_Open(VALUE self, VALUE fname)
45324453
45334454 /*
45344455 * call-seq:
4535- * Molecule.new(file, *args) -> molecule
4536- * molecule.initialize(file, *args)
4456+ * new(file, *args) -> Molecule
45374457 *
45384458 * Create a new molecule and call "load" method with the same arguments.
45394459 */
@@ -4557,7 +4477,7 @@ s_Molecule_MolEnumerable(VALUE self, int kind)
45574477
45584478 /*
45594479 * call-seq:
4560- * molecule.atoms -> MolEnumerable
4480+ * atoms -> MolEnumerable
45614481 *
45624482 * Returns a MolEnumerable object representing the array of atoms.
45634483 */
@@ -4569,7 +4489,7 @@ s_Molecule_Atoms(VALUE self)
45694489
45704490 /*
45714491 * call-seq:
4572- * molecule.bonds -> MolEnumerable
4492+ * bonds -> MolEnumerable
45734493 *
45744494 * Returns a MolEnumerable object representing the array of bonds. A bond is represented
45754495 * by an array of two atom indices.
@@ -4582,7 +4502,7 @@ s_Molecule_Bonds(VALUE self)
45824502
45834503 /*
45844504 * call-seq:
4585- * molecule.angles -> MolEnumerable
4505+ * angles -> MolEnumerable
45864506 *
45874507 * Returns a MolEnumerable object representing the array of angles. An angle is represented
45884508 * by an array of three atom indices.
@@ -4595,7 +4515,7 @@ s_Molecule_Angles(VALUE self)
45954515
45964516 /*
45974517 * call-seq:
4598- * molecule.dihedrals -> MolEnumerable
4518+ * dihedrals -> MolEnumerable
45994519 *
46004520 * Returns a MolEnumerable object representing the array of dihedrals. A dihedral is represented
46014521 * by an array of four atom indices.
@@ -4608,7 +4528,7 @@ s_Molecule_Dihedrals(VALUE self)
46084528
46094529 /*
46104530 * call-seq:
4611- * molecule.impropers -> MolEnumerable
4531+ * impropers -> MolEnumerable
46124532 *
46134533 * Returns a MolEnumerable object representing the array of impropers. An improper is represented
46144534 * by an array of four atom indices.
@@ -4621,7 +4541,7 @@ s_Molecule_Impropers(VALUE self)
46214541
46224542 /*
46234543 * call-seq:
4624- * molecule.residues -> MolEnumerable
4544+ * residues -> MolEnumerable
46254545 *
46264546 * Returns a MolEnumerable object representing the array of residue names.
46274547 */
@@ -4633,7 +4553,7 @@ s_Molecule_Residues(VALUE self)
46334553
46344554 /*
46354555 * call-seq:
4636- * molecule.natoms -> int
4556+ * natoms -> Integer
46374557 *
46384558 * Returns the number of atoms.
46394559 */
@@ -4647,7 +4567,7 @@ s_Molecule_Natoms(VALUE self)
46474567
46484568 /*
46494569 * call-seq:
4650- * molecule.nbonds -> int
4570+ * nbonds -> Integer
46514571 *
46524572 * Returns the number of bonds.
46534573 */
@@ -4661,7 +4581,7 @@ s_Molecule_Nbonds(VALUE self)
46614581
46624582 /*
46634583 * call-seq:
4664- * molecule.nangles -> int
4584+ * nangles -> Integer
46654585 *
46664586 * Returns the number of angles.
46674587 */
@@ -4675,7 +4595,7 @@ s_Molecule_Nangles(VALUE self)
46754595
46764596 /*
46774597 * call-seq:
4678- * molecule.ndihedrals -> int
4598+ * ndihedrals -> Integer
46794599 *
46804600 * Returns the number of dihedrals.
46814601 */
@@ -4689,7 +4609,7 @@ s_Molecule_Ndihedrals(VALUE self)
46894609
46904610 /*
46914611 * call-seq:
4692- * molecule.nimpropers -> int
4612+ * nimpropers -> Integer
46934613 *
46944614 * Returns the number of impropers.
46954615 */
@@ -4703,7 +4623,7 @@ s_Molecule_Nimpropers(VALUE self)
47034623
47044624 /*
47054625 * call-seq:
4706- * molecule.nresidues -> int
4626+ * nresidues -> Integer
47074627 *
47084628 * Returns the number of residues.
47094629 */
@@ -4717,7 +4637,7 @@ s_Molecule_Nresidues(VALUE self)
47174637
47184638 /*
47194639 * call-seq:
4720- * molecule.start_step -> int
4640+ * start_step -> Integer
47214641 *
47224642 * Returns the start step (defined by dcd format).
47234643 */
@@ -4731,7 +4651,7 @@ s_Molecule_StartStep(VALUE self)
47314651
47324652 /*
47334653 * call-seq:
4734- * molecule.start_step = int
4654+ * start_step = Integer
47354655 *
47364656 * Set the start step (defined by dcd format).
47374657 */
@@ -4746,7 +4666,7 @@ s_Molecule_SetStartStep(VALUE self, VALUE val)
47464666
47474667 /*
47484668 * call-seq:
4749- * molecule.steps_per_frame -> int
4669+ * steps_per_frame -> Integer
47504670 *
47514671 * Returns the number of steps between frames (defined by dcd format).
47524672 */
@@ -4760,7 +4680,7 @@ s_Molecule_StepsPerFrame(VALUE self)
47604680
47614681 /*
47624682 * call-seq:
4763- * molecule.steps_per_frame = int
4683+ * steps_per_frame = Integer
47644684 *
47654685 * Set the number of steps between frames (defined by dcd format).
47664686 */
@@ -4775,7 +4695,7 @@ s_Molecule_SetStepsPerFrame(VALUE self, VALUE val)
47754695
47764696 /*
47774697 * call-seq:
4778- * molecule.ps_per_step -> float
4698+ * ps_per_step -> Float
47794699 *
47804700 * Returns the time increment (in picoseconds) for one step (defined by dcd format).
47814701 */
@@ -4789,7 +4709,7 @@ s_Molecule_PsPerStep(VALUE self)
47894709
47904710 /*
47914711 * call-seq:
4792- * molecule.ps_per_step = float
4712+ * ps_per_step = Float
47934713 *
47944714 * Set the time increment (in picoseconds) for one step (defined by dcd format).
47954715 */
@@ -4804,9 +4724,9 @@ s_Molecule_SetPsPerStep(VALUE self, VALUE val)
48044724
48054725 /*
48064726 * call-seq:
4807- * molecule.find_angles -> int (added number of angles)
4727+ * find_angles -> Integer
48084728 *
4809- * Find the angles from the bonds
4729+ * Find the angles from the bonds. Returns the number of angles newly created.
48104730 */
48114731 static VALUE
48124732 s_Molecule_FindAngles(VALUE self)
@@ -4841,9 +4761,9 @@ s_Molecule_FindAngles(VALUE self)
48414761
48424762 /*
48434763 * call-seq:
4844- * molecule.find_dihedrals -> int (added number of dihedrals)
4764+ * find_dihedrals -> Integer
48454765 *
4846- * Find the dihedrals from the bonds
4766+ * Find the dihedrals from the bonds. Returns the number of dihedrals newly created.
48474767 */
48484768 static VALUE
48494769 s_Molecule_FindDihedrals(VALUE self)
@@ -4889,10 +4809,9 @@ s_Molecule_FindDihedrals(VALUE self)
48894809
48904810 /*
48914811 * call-seq:
4892- * molecule.nresidues = integer
4812+ * nresidues = Integer
48934813 *
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.
48964815 */
48974816 static VALUE
48984817 s_Molecule_ChangeNresidues(VALUE self, VALUE val)
@@ -4908,7 +4827,7 @@ s_Molecule_ChangeNresidues(VALUE self, VALUE val)
49084827
49094828 /*
49104829 * call-seq:
4911- * molecule.max_residue_number(atom_group = nil) -> int
4830+ * max_residue_number(atom_group = nil) -> Integer
49124831 *
49134832 * Returns the maximum residue number actually used. If an atom group is given, only
49144833 * 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)
49294848
49304849 /*
49314850 * call-seq:
4932- * molecule.min_residue_number(atom_group = nil) -> int
4851+ * min_residue_number(atom_group = nil) -> Integer
49334852 *
49344853 * Returns the minimum residue number actually used. If an atom group is given, only
49354854 * 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)
49504869
49514870 /*
49524871 * call-seq:
4953- * molecule.each_atom block
4872+ * each_atom {|aref| ...}
49544873 *
49554874 * Execute the block, with the AtomRef object for each atom as the argument.
49564875 * Equivalent to self.atoms.each, except that the return value is self (a Molecule object).
@@ -4974,9 +4893,9 @@ s_Molecule_EachAtom(VALUE self)
49744893
49754894 /*
49764895 * call-seq:
4977- * molecule.cell -> array [a, b, c, alpha, beta, gamma]
4896+ * cell -> [a, b, c, alpha, beta, gamma]
49784897 *
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.
49804899 */
49814900 static VALUE
49824901 s_Molecule_Cell(VALUE self)
@@ -4995,10 +4914,10 @@ s_Molecule_Cell(VALUE self)
49954914
49964915 /*
49974916 * call-seq:
4998- * molecule.cell = [a, b, c, alpha, beta, gamma]
4917+ * cell = [a, b, c, alpha, beta, gamma]
49994918 * set_cell([a, b, c, alpha, beta, gamma], flag = nil)
50004919 *
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.
50024921 This operation is undoable. If the second argument is given as non-nil, then
50034922 the coordinates are transformed so that the cartesian coordinates remain the same.
50044923 */
@@ -5045,8 +4964,10 @@ s_Molecule_CellTransform(VALUE self)
50454964 * call-seq:
50464965 * box -> [avec, bvec, cvec, origin, flags]
50474966 *
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.
50504971 */
50514972 static VALUE
50524973 s_Molecule_Box(VALUE self)
@@ -5074,8 +4995,9 @@ s_Molecule_Box(VALUE self)
50744995 * Set the unit cell parameters. Avec, bvec, and cvec can be either a Vector3D or a number.
50754996 If it is a number, the x/y/z axis vector is multiplied with the given number and used
50764997 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.
50795001 In the third form, the existing box is cleared.
50805002 */
50815003 static VALUE
@@ -5127,28 +5049,10 @@ s_Molecule_SetBox(int argc, VALUE *argv, VALUE self)
51275049 return self;
51285050 }
51295051
5130-#if 0
51315052 /*
51325053 * 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
51525056 *
51535057 * Get the currently defined symmetry operations. If no symmetry operation is defined,
51545058 * returns an empty array.
@@ -5171,7 +5075,7 @@ s_Molecule_Symmetry(VALUE self)
51715075
51725076 /*
51735077 * call-seq:
5174- * molecule.nsymmetries -> integer
5078+ * nsymmetries -> Integer
51755079 *
51765080 * Get the number of currently defined symmetry operations.
51775081 */
@@ -5185,10 +5089,12 @@ s_Molecule_Nsymmetries(VALUE self)
51855089
51865090 /*
51875091 * call-seq:
5188- * molecule.add_symmetry(Transform) -> integer (number of total transforms)
5092+ * add_symmetry(Transform) -> Integer
51895093 *
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.
51925098 */
51935099 static VALUE
51945100 s_Molecule_AddSymmetry(VALUE self, VALUE trans)
@@ -5203,10 +5109,12 @@ s_Molecule_AddSymmetry(VALUE self, VALUE trans)
52035109
52045110 /*
52055111 * 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
52075114 *
52085115 * 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.
52105118 */
52115119 static VALUE
52125120 s_Molecule_RemoveSymmetry(int argc, VALUE *argv, VALUE self)
@@ -5227,7 +5135,7 @@ s_Molecule_RemoveSymmetry(int argc, VALUE *argv, VALUE self)
52275135 }
52285136 for (i = 0; i < n; i++)
52295137 MolActionCreateAndPerform(mol, gMolActionDeleteSymmetryOperation);
5230- return self;
5138+ return INT2NUM(mol->nsyms);
52315139 }
52325140
52335141 static VALUE
@@ -5242,19 +5150,16 @@ s_Molecule_AtomGroup_i(VALUE arg, VALUE values)
52425150
52435151 /*
52445152 * 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| ...}
52505157 *
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)
52585163 * representing each atom, and the atoms are removed from the result if the block returns false.
52595164 *
52605165 */
@@ -5319,7 +5224,7 @@ s_Molecule_AtomGroup(int argc, VALUE *argv, VALUE self)
53195224
53205225 /*
53215226 * call-seq:
5322- * molecule.atom_index(val) -> int
5227+ * atom_index(val) -> Integer
53235228 *
53245229 * Returns the atom index represented by val. val can be either a non-negative integer
53255230 * (directly representing the atom index), a negative integer (representing <code>natoms - val</code>),
@@ -5338,7 +5243,7 @@ s_Molecule_AtomIndex(VALUE self, VALUE val)
53385243
53395244 /*
53405245 * call-seq:
5341- * molecule.extract(group, dummy_flag = nil) -> molecule
5246+ * extract(group, dummy_flag = nil) -> Molecule
53425247 *
53435248 * Extract the atoms given by group and return as a new molecule object.
53445249 * 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)
53685273
53695274 /*
53705275 * call-seq:
5371- * molecule.add(molecule2) -> molecule
5276+ * add(molecule2) -> self
53725277 *
53735278 * Combine two molecules. The residue numbers of the newly added atoms may be renumbered to avoid
53745279 conflicts.
@@ -5380,7 +5285,6 @@ s_Molecule_Add(VALUE self, VALUE val)
53805285 Molecule *mol1, *mol2;
53815286 Data_Get_Struct(self, Molecule, mol1);
53825287 mol2 = MoleculeFromValue(val);
5383-// MoleculeMerge(mol1, mol2, NULL, mol1->nresidues - 1);
53845288 MolActionCreateAndPerform(mol1, gMolActionMergeMolecule, mol2, NULL);
53855289 return self;
53865290 }
@@ -5395,7 +5299,7 @@ s_Molecule_Duplicate(VALUE self)
53955299
53965300 /*
53975301 * call-seq:
5398- * molecule.remove(group) -> molecule
5302+ * remove(group) -> Molecule
53995303 *
54005304 * The atoms designated by the given group are removed from the molecule.
54015305 * This operation is undoable.
@@ -5448,7 +5352,7 @@ s_Molecule_Remove(VALUE self, VALUE group)
54485352
54495353 /*
54505354 * call-seq:
5451- * molecule.create_atom(name, pos = -1) -> AtomRef
5355+ * create_atom(name, pos = -1) -> AtomRef
54525356 *
54535357 * Create a new atom with the specified name (may contain residue
54545358 * 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)
54905394
54915395 /*
54925396 * call-seq:
5493- * molecule.duplicate_atom(atomref, pos = -1) -> AtomRef
5397+ * duplicate_atom(atomref, pos = -1) -> AtomRef
54945398 *
54955399 * Create a new atom with the same attributes (but no bonding information)
54965400 * with the specified atom. Returns the reference to the new atom.
@@ -5534,7 +5438,7 @@ s_Molecule_DuplicateAnAtom(int argc, VALUE *argv, VALUE self)
55345438
55355439 /*
55365440 * call-seq:
5537- * molecule.create_bond(n1, n2, ...) -> molecule
5441+ * create_bond(n1, n2, ...) -> Molecule
55385442 *
55395443 * Create bonds between atoms n1 and n2, n3 and n4, and so on. Returns self.
55405444 * This operation is undoable.
@@ -5568,7 +5472,7 @@ s_Molecule_CreateBond(int argc, VALUE *argv, VALUE self)
55685472
55695473 /*
55705474 * call-seq:
5571- * molecule.add_angle(n1, n2, n3) -> molecule
5475+ * add_angle(n1, n2, n3) -> Molecule
55725476 *
55735477 * Add angle n1-n2-n3. Returns self. Usually, angles are automatically added
55745478 * 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)
55925496
55935497 /*
55945498 * call-seq:
5595- * molecule.remove_angle(n1, n2, n3) -> molecule
5499+ * remove_angle(n1, n2, n3) -> Molecule
55965500 *
55975501 * Remove angle n1-n2-n3. Returns self. Usually, angles are automatically removed
55985502 * 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)
56185522
56195523 /*
56205524 * call-seq:
5621- * molecule.add_dihedral(n1, n2, n3, n4) -> molecule
5525+ * add_dihedral(n1, n2, n3, n4) -> Molecule
56225526 *
56235527 * Add dihedral n1-n2-n3-n4. Returns self. Usually, dihedrals are automatically added
56245528 * 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)
56435547
56445548 /*
56455549 * call-seq:
5646- * molecule.remove_dihedral(n1, n2, n3, n4) -> molecule
5550+ * remove_dihedral(n1, n2, n3, n4) -> Molecule
56475551 *
56485552 * Remove dihedral n1-n2-n3-n4. Returns self. Usually, dihedrals are automatically removed
56495553 * 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)
56705574
56715575 /*
56725576 * call-seq:
5673- * molecule.add_improper(n1, n2, n3, n4) -> molecule
5577+ * add_improper(n1, n2, n3, n4) -> Molecule
56745578 *
56755579 * Add dihedral n1-n2-n3-n4. Returns self. Unlike angles and dihedrals, impropers are
56765580 * 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)
56965600
56975601 /*
56985602 * call-seq:
5699- * molecule.remove_improper(n1, n2, n3, n4) -> molecule
5603+ * remove_improper(n1, n2, n3, n4) -> Molecule
57005604 *
57015605 * Remove improper n1-n2-n3-n4. Returns self. Unlike angles and dihedrals, impropers are
57025606 * 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)
57245628
57255629 /*
57265630 * call-seq:
5727- * molecule.assign_residue(group, res) -> molecule
5631+ * assign_residue(group, res) -> Molecule
57285632 *
57295633 * Assign the specified atoms as the given residue. res can either be an integer, "resname"
57305634 * 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)
57885692
57895693 /*
57905694 * call-seq:
5791- * molecule.offset_residue(group, offset) -> molecule
5695+ * offset_residue(group, offset) -> Molecule
57925696 *
57935697 * Offset the residue number of the specified atoms. If any of the residue number gets
57945698 * negative, then exception is thrown.
@@ -5812,7 +5716,7 @@ s_Molecule_OffsetResidue(VALUE self, VALUE range, VALUE offset)
58125716
58135717 /*
58145718 * call-seq:
5815- * molecule.reorder_atoms(array) -> intGroup
5719+ * reorder_atoms(array) -> IntGroup
58165720 *
58175721 * Change the order of atoms so that the atoms specified in the array argument appear
58185722 * 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)
58545758
58555759 /*
58565760 * call-seq:
5857- * molecule.guess_bonds(limit = 1.2) -> Array
5761+ * guess_bonds(limit = 1.2) -> Integer
58585762 *
58595763 * Create bonds between atoms that are 'close enough', i.e. the interatomic distance is
58605764 * smaller than the sum of the vdw radii times the argument 'limit'. If limit is not
58615765 * 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.
58635767 * This operation is undoable.
58645768 */
58655769 static VALUE
@@ -5878,19 +5782,14 @@ s_Molecule_GuessBonds(int argc, VALUE *argv, VALUE self)
58785782 MoleculeGuessBonds(mol, limit, &nbonds, &bonds);
58795783 if (nbonds > 0) {
58805784 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]));
58845785 free(bonds);
5885- } else {
5886- retval = rb_ary_new();
58875786 }
5888- return retval;
5787+ return INT2NUM(nbonds);
58895788 }
58905789
58915790 /*
58925791 * call-seq:
5893- * molecule.register_undo(script, *args)
5792+ * register_undo(script, *args)
58945793 *
58955794 * Register an undo operation with the current molecule.
58965795 */
@@ -5909,7 +5808,7 @@ s_Molecule_RegisterUndo(int argc, VALUE *argv, VALUE self)
59095808
59105809 /*
59115810 * call-seq:
5912- * molecule.undo_enabled? => true/false
5811+ * undo_enabled? -> bool
59135812 *
59145813 * Returns true if undo is enabled for this molecule; otherwise no.
59155814 */
@@ -5925,7 +5824,7 @@ s_Molecule_UndoEnabled(VALUE self)
59255824
59265825 /*
59275826 * call-seq:
5928- * molecule.undo_enabled = true/false
5827+ * undo_enabled = bool
59295828 *
59305829 * Enable or disable undo.
59315830 */
@@ -5940,7 +5839,7 @@ s_Molecule_SetUndoEnabled(VALUE self, VALUE val)
59405839
59415840 /*
59425841 * call-seq:
5943- * molecule.selection -> intGroup
5842+ * selection -> IntGroup
59445843 *
59455844 * Returns the current selection. The returned value is frozen.
59465845 */
@@ -5981,7 +5880,7 @@ s_Molecule_SetSelectionSub(VALUE self, VALUE val, int undoable)
59815880
59825881 /*
59835882 * call-seq:
5984- * molecule.selection = intGroup
5883+ * selection = IntGroup
59855884 *
59865885 * Set the current selection. The right-hand operand may be nil.
59875886 * 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)
59945893
59955894 /*
59965895 * call-seq:
5997- * molecule.set_undoable_selection(intGroup)
5896+ * set_undoable_selection(IntGroup)
59985897 *
59995898 * Set the current selection with undo registration. The right-hand operand may be nil.
60005899 * This operation is undoable.
@@ -6007,8 +5906,8 @@ s_Molecule_SetUndoableSelection(VALUE self, VALUE val)
60075906
60085907 /*
60095908 * call-seq:
6010- * molecule.select_frame(index)
6011- * molecule.frame = index
5909+ * select_frame(index)
5910+ * frame = index
60125911 *
60135912 * Select the specified frame. If successful, returns true, otherwise returns false.
60145913 */
@@ -6026,7 +5925,7 @@ s_Molecule_SelectFrame(VALUE self, VALUE val)
60265925
60275926 /*
60285927 * call-seq:
6029- * molecule.frame => integer
5928+ * frame -> Integer
60305929 *
60315930 * Get the current frame.
60325931 */
@@ -6040,7 +5939,7 @@ s_Molecule_Frame(VALUE self)
60405939
60415940 /*
60425941 * call-seq:
6043- * molecule.nframes => integer
5942+ * nframes -> Integer
60445943 *
60455944 * Get the number of frames.
60465945 */
@@ -6054,85 +5953,8 @@ s_Molecule_Nframes(VALUE self)
60545953
60555954 /*
60565955 * 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
61365958 *
61375959 * Insert new frames at the indices specified by the intGroup. If the first argument is
61385960 * 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)
61916013 }
61926014 }
61936015 }
6194-#if 1
61956016 ival = MolActionCreateAndPerform(mol, gMolActionInsertFrames, ig, mol->natoms * count, vp);
61966017 IntGroupRelease(ig);
61976018 free(vp);
61986019 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
62166020 }
62176021
62186022 /*
62196023 * 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
62226026 *
62236027 * Same as molecule.insert_frames(nil, coordinates).
62246028 */
@@ -6233,7 +6037,7 @@ s_Molecule_CreateFrames(int argc, VALUE *argv, VALUE self)
62336037
62346038 /*
62356039 * call-seq:
6236- * molecule.remove_frames(intGroup, wantCoordinates = false)
6040+ * remove_frames(IntGroup, wantCoordinates = false)
62376041 *
62386042 * Remove the frames at group. If wantsCoordinates is false (default), returns true if successful
62396043 * 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)
62776081
62786082 /*
62796083 * call-seq:
6280- * molecule.each_frame block
6084+ * each_frame {|n| ...}
62816085 *
62826086 * Set the frame number from 0 to nframes-1 and execute the block. The block argument is
62836087 * the frame number. After completion, the original frame number is restored.
@@ -6302,7 +6106,7 @@ s_Molecule_EachFrame(VALUE self)
63026106
63036107 /*
63046108 * call-seq:
6305- * molecule.set_atom_attr(index, key, value)
6109+ * set_atom_attr(index, key, value)
63066110 *
63076111 * Set the atom attribute for the specified atom.
63086112 * This operation is undoable.
@@ -6323,7 +6127,7 @@ s_Molecule_SetAtomAttr(VALUE self, VALUE idx, VALUE key, VALUE val)
63236127
63246128 /*
63256129 * call-seq:
6326- * molecule.get_atom_attr(index, key)
6130+ * get_atom_attr(index, key)
63276131 *
63286132 * Get the atom attribute for the specified atom.
63296133 */
@@ -6335,8 +6139,9 @@ s_Molecule_GetAtomAttr(VALUE self, VALUE idx, VALUE key)
63356139
63366140 /*
63376141 * 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+ *
63406145 * Get the fragment including the atom n1 or the atom group. If additional arguments are given,
63416146 * those atoms will not be counted during the search.
63426147 */
@@ -6393,7 +6198,7 @@ s_Molecule_Fragment(int argc, VALUE *argv, VALUE self)
63936198
63946199 /*
63956200 * call-seq:
6396- * molecule.each_fragment block
6201+ * each_fragment {|group| ...}
63976202 *
63986203 * Execute the block, with the IntGroup object for each fragment as the argument.
63996204 * Atoms or bonds should not be added or removed during the execution of the block.
@@ -6424,7 +6229,7 @@ s_Molecule_EachFragment(VALUE self)
64246229
64256230 /*
64266231 * call-seq:
6427- * molecule.detachable?(n1, group) -> array of two atoms
6232+ * detachable?(group) -> [n1, n2]
64286233 *
64296234 * Check whether the group is 'detachable', i.e. the group is bound to the rest
64306235 * 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)
64496254
64506255 /*
64516256 * 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
64536258 *
64546259 * Returns an array of bonds that connect an atom in the group and an atom out
64556260 * 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)
65016306
65026307 /*
65036308 * call-seq:
6504- * molecule.translate(vec, group = nil) -> molecule
6309+ * translate(vec, group = nil) -> Molecule
65056310 *
65066311 * Translate the molecule by vec. If group is given, only atoms in the group are moved.
65076312 * This operation is undoable.
@@ -6526,9 +6331,9 @@ s_Molecule_Translate(int argc, VALUE *argv, VALUE self)
65266331
65276332 /*
65286333 * 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
65306335 *
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.
65326337 * If group is given, only atoms in the group are moved.
65336338 * This operation is undoable.
65346339 */
@@ -6544,7 +6349,7 @@ s_Molecule_Rotate(int argc, VALUE *argv, VALUE self)
65446349 Data_Get_Struct(self, Molecule, mol);
65456350 rb_scan_args(argc, argv, "22", &aval, &anval, &cval, &gval);
65466351 ig = (NIL_P(gval) ? NULL : s_Molecule_AtomGroupFromValue(self, gval));
6547- angle = NUM2DBL(rb_Float(anval));
6352+ angle = NUM2DBL(rb_Float(anval)) * kDeg2Rad;
65486353 VectorFromValue(aval, &av);
65496354 if (NIL_P(cval))
65506355 cv.x = cv.y = cv.z = 0.0;
@@ -6560,7 +6365,7 @@ s_Molecule_Rotate(int argc, VALUE *argv, VALUE self)
65606365
65616366 /*
65626367 * call-seq:
6563- * molecule.reflect(axis, center = [0,0,0], group = nil) -> molecule
6368+ * reflect(axis, center = [0,0,0], group = nil) -> Molecule
65646369 *
65656370 * Reflect the molecule by the plane which is perpendicular to axis and including center.
65666371 * axis must not be a zero vector.
@@ -6593,7 +6398,7 @@ s_Molecule_Reflect(int argc, VALUE *argv, VALUE self)
65936398
65946399 /*
65956400 * call-seq:
6596- * molecule.invert(center = [0,0,0], group = nil) -> molecule
6401+ * invert(center = [0,0,0], group = nil) -> Molecule
65976402 *
65986403 * Invert the molecule with the given center.
65996404 * If group is given, only atoms in the group are moved.
@@ -6623,7 +6428,7 @@ s_Molecule_Invert(int argc, VALUE *argv, VALUE self)
66236428
66246429 /*
66256430 * call-seq:
6626- * molecule.transform(transform, group = nil) -> molecule
6431+ * transform(transform, group = nil) -> Molecule
66276432 *
66286433 * Transform the molecule by the given Transform object.
66296434 * If group is given, only atoms in the group are moved.
@@ -6660,7 +6465,7 @@ s_Molecule_DoCenterOfMass(Molecule *mol, Vector *outv, IntGroup *ig)
66606465
66616466 /*
66626467 * call-seq:
6663- * molecule.center_of_mass(group = nil) -> vector3d
6468+ * center_of_mass(group = nil) -> Vector3D
66646469 *
66656470 * Calculate the center of mass for the given set of atoms. The argument
66666471 * group is null, then all atoms are considered.
@@ -6683,7 +6488,7 @@ s_Molecule_CenterOfMass(int argc, VALUE *argv, VALUE self)
66836488
66846489 /*
66856490 * call-seq:
6686- * molecule.centralize(group = nil) -> self
6491+ * centralize(group = nil) -> self
66876492 *
66886493 * Translate the molecule so that the center of mass of the given group is located
66896494 * 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)
67106515
67116516 /*
67126517 * call-seq:
6713- * molecule.bounds(group = nil) -> [min, max]
6518+ * bounds(group = nil) -> [min, max]
67146519 *
67156520 * Calculate the boundary. The return value is an array of two Vector3D objects.
67166521 */
@@ -6765,7 +6570,7 @@ s_Molecule_GetVectorFromArg(Molecule *mol, VALUE val, Vector *vp)
67656570
67666571 /*
67676572 * call-seq:
6768- * molecule.measure_bond(n1, n2) -> Float
6573+ * measure_bond(n1, n2) -> Float
67696574 *
67706575 * Calculate the bond length. The arguments can either be atom indices, the "residue:name" representation,
67716576 * or Vector3D values.
@@ -6784,7 +6589,7 @@ s_Molecule_MeasureBond(VALUE self, VALUE nval1, VALUE nval2)
67846589
67856590 /*
67866591 * call-seq:
6787- * molecule.measure_angle(n1, n2, n3) -> Float
6592+ * measure_angle(n1, n2, n3) -> Float
67886593 *
67896594 * Calculate the bond angle. The arguments can either be atom indices, the "residue:name" representation,
67906595 * or Vector3D values. The return value is in degree.
@@ -6808,7 +6613,7 @@ s_Molecule_MeasureAngle(VALUE self, VALUE nval1, VALUE nval2, VALUE nval3)
68086613
68096614 /*
68106615 * call-seq:
6811- * molecule.measure_dihedral(n1, n2, n3, n4) -> Float
6616+ * measure_dihedral(n1, n2, n3, n4) -> Float
68126617 *
68136618 * Calculate the dihedral angle. The arguments can either be atom indices, the "residue:name" representation,
68146619 * 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
68336638
68346639 /*
68356640 * 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
68376642 *
68386643 * Expand the specified part of the molecule by the given symmetry operation.
68396644 * Returns an IntGroup containing the added atoms.
@@ -6871,7 +6676,7 @@ s_Molecule_ExpandBySymmetry(int argc, VALUE *argv, VALUE self)
68716676
68726677 /*
68736678 * call-seq:
6874- * molecule.wrap_unit_cell(group) -> Vector3D
6679+ * wrap_unit_cell(group) -> Vector3D
68756680 *
68766681 * Move the specified group so that the center of mass of the group is within the
68776682 * unit cell. The offset vector is returned. If no periodic box is defined,
@@ -6904,7 +6709,7 @@ s_Molecule_WrapUnitCell(VALUE self, VALUE gval)
69046709
69056710 /*
69066711 * call-seq:
6907- * molecule.find_conflicts(limit[, group1[, group2]]) -> [[n1, n2], [n3, n4], ...]
6712+ * find_conflicts(limit[, group1[, group2]]) -> [[n1, n2], [n3, n4], ...]
69086713 *
69096714 * Find pairs of atoms that are within the limit distance. If group1 and group2 are given, the
69106715 * 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)
69746779
69756780 /*
69766781 * call-seq:
6977- * molecule.display()
6782+ * display
69786783 *
69796784 * Refresh the display if this molecule is bound to a view. Otherwise do nothing.
69806785 */
@@ -6990,7 +6795,7 @@ s_Molecule_Display(VALUE self)
69906795
69916796 /*
69926797 * call-seq:
6993- * molecule.update_enabled? => true/false
6798+ * update_enabled? -> bool
69946799 *
69956800 * Returns true if screen update is enabled; otherwise no.
69966801 */
@@ -7006,7 +6811,7 @@ s_Molecule_UpdateEnabled(VALUE self)
70066811
70076812 /*
70086813 * call-seq:
7009- * molecule.update_enabled = true/false
6814+ * update_enabled = bool
70106815 *
70116816 * Enable or disable screen update. This is effective for automatic update on modification.
70126817 * Explicit call to molecule.display() always updates the screen.
@@ -7025,9 +6830,9 @@ s_Molecule_SetUpdateEnabled(VALUE self, VALUE val)
70256830
70266831 /*
70276832 * 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
70316836 *
70326837 * Set the flag whether to show the unit cell. If no argument is given, the
70336838 * current flag is returned.
@@ -7048,9 +6853,9 @@ s_Molecule_ShowUnitCell(int argc, VALUE *argv, VALUE self)
70486853
70496854 /*
70506855 * 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
70546859 *
70556860 * Set the flag whether to show the hydrogen atoms. If no argument is given, the
70566861 * current flag is returned.
@@ -7071,9 +6876,9 @@ s_Molecule_ShowHydrogens(int argc, VALUE *argv, VALUE self)
70716876
70726877 /*
70736878 * 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
70776882 *
70786883 * Set the flag whether to show the dummy atoms. If no argument is given, the
70796884 * current flag is returned.
@@ -7094,9 +6899,9 @@ s_Molecule_ShowDummyAtoms(int argc, VALUE *argv, VALUE self)
70946899
70956900 /*
70966901 * 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
71006905 *
71016906 * Set the flag whether to show the expanded atoms. If no argument is given, the
71026907 * current flag is returned.
@@ -7117,9 +6922,9 @@ s_Molecule_ShowExpanded(int argc, VALUE *argv, VALUE self)
71176922
71186923 /*
71196924 * 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
71236928 *
71246929 * Set the flag whether to show the thermal ellipsoids. If no argument is given, the
71256930 * current flag is returned.
@@ -7140,8 +6945,8 @@ s_Molecule_ShowEllipsoids(int argc, VALUE *argv, VALUE self)
71406945
71416946 /*
71426947 * call-seq:
7143- * molecule.show_graphite
7144- * molecule.show_graphite = integer
6948+ * show_graphite -> Integer
6949+ * show_graphite = Integer
71456950 *
71466951 * Set whether to show the graphite plane. If the argument is positive, it also indicates the
71476952 * number of rings to display for each direction.
@@ -7165,7 +6970,7 @@ s_Molecule_ShowGraphite(int argc, VALUE *argv, VALUE self)
71656970
71666971 /*
71676972 * call-seq:
7168- * molecule.show_periodic_image = [amin, amax, bmin, bmax, cmin, cmax]
6973+ * show_periodic_image = [amin, amax, bmin, bmax, cmin, cmax]
71696974 *
71706975 * Set to show the periodic image of the atoms. If the unit cell is not defined, the values are
71716976 * set but no visual effects are observed.
@@ -7202,9 +7007,9 @@ s_Molecule_ShowPeriodicImage(int argc, VALUE *argv, VALUE self)
72027007
72037008 /*
72047009 * 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
72087013 *
72097014 * Set the flag whether to draw the model in line mode. If no argument is given, the
72107015 * current flag is returned.
@@ -7225,7 +7030,7 @@ s_Molecule_LineMode(int argc, VALUE *argv, VALUE self)
72257030
72267031 /*
72277032 * call-seq:
7228- * molecule.show_text(string)
7033+ * show_text(string)
72297034 *
72307035 * Show the string in the info text box.
72317036 */
@@ -7241,7 +7046,7 @@ s_Molecule_ShowText(VALUE self, VALUE arg)
72417046
72427047 /*
72437048 * call-seq:
7244- * molecule.md_arena -> MDArena
7049+ * md_arena -> MDArena
72457050 *
72467051 * Returns the MDArena object associated to this molecule. If no MDArena is associated to
72477052 * this molecule, a new arena is created.
@@ -7262,7 +7067,7 @@ s_Molecule_MDArena(VALUE self)
72627067
72637068 /*
72647069 * call-seq:
7265- * molecule.set_parameter_attr(type, index, key, value, src) -> value
7070+ * set_parameter_attr(type, index, key, value, src) -> value
72667071 *
72677072 * This method is used only internally.
72687073 */
@@ -7289,7 +7094,7 @@ s_Molecule_SetParameterAttr(VALUE self, VALUE tval, VALUE ival, VALUE kval, VALU
72897094
72907095 /*
72917096 * call-seq:
7292- * molecule.parameter -> Parameter
7097+ * parameter -> Parameter
72937098 *
72947099 * Get the local parameter of this molecule. If not defined, returns nil.
72957100 */
@@ -7305,7 +7110,7 @@ s_Molecule_Parameter(VALUE self)
73057110
73067111 /*
73077112 * call-seq:
7308- * molecule.selectedMO -> IntGroup
7113+ * selectedMO -> IntGroup
73097114 *
73107115 * Returns a group of selected mo in the "MO Info" table. If the MO info table
73117116 * is not selected, returns nil. If the MO info table is selected but no MOs
@@ -7331,7 +7136,7 @@ s_Molecule_SelectedMO(VALUE self)
73317136
73327137 /*
73337138 * 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]
73357140 *
73367141 * Returns a default MO grid for cube file generation. Origin: Vector, dx, dy, dz: float, nx, ny, nz: integer.
73377142 * If the molecule does not contain a basis set information, then returns nil.
@@ -7366,8 +7171,8 @@ s_Cubegen_callback(double progress, void *ref)
73667171
73677172 /*
73687173 * 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])
73717176 *
73727177 * Calculate the molecular orbital with number mo and create a 'cube' file.
73737178 * 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)
74557260
74567261 /*
74577262 * call-seq:
7458- * molecule.nelpots
7263+ * nelpots
74597264 *
74607265 * Get the number of electrostatic potential info.
74617266 */
@@ -7469,7 +7274,7 @@ s_Molecule_NElpots(VALUE self)
74697274
74707275 /*
74717276 * call-seq:
7472- * molecule.elpot(idx)
7277+ * elpot(idx)
74737278 *
74747279 * Get the electrostatic potential info at the given index. If present, then the
74757280 * return value is [Vector, Float] (position and potential). If not present, then
@@ -7489,7 +7294,7 @@ s_Molecule_Elpot(VALUE self, VALUE ival)
74897294
74907295 /*
74917296 * call-seq:
7492- * molecule.search_equivalent_atoms(ig = nil)
7297+ * search_equivalent_atoms(ig = nil)
74937298 *
74947299 * Search equivalent atoms (within the atom group if given). Returns an array of integers.
74957300 */
@@ -7521,7 +7326,7 @@ s_Molecule_SearchEquivalentAtoms(int argc, VALUE *argv, VALUE self)
75217326
75227327 /*
75237328 * call-seq:
7524- * Molecule.current -> Molecule
7329+ * current -> Molecule
75257330 *
75267331 * Get the currently "active" molecule.
75277332 */
@@ -7543,11 +7348,11 @@ s_Molecule_Current(VALUE klass)
75437348 * Molecule[] is equivalent to Molecule.current.
75447349 * Molecule[n] (n is an integer) is equivalent to Molecule.list[n].
75457350 * 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
75477352 * given name is returned.
75487353 * Molecule[regex] gives the first document (in the order of creation time) that
75497354 * 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.
75517356 */
75527357 static VALUE
75537358 s_Molecule_MoleculeAtIndex(int argc, VALUE *argv, VALUE klass)
@@ -7588,7 +7393,7 @@ s_Molecule_MoleculeAtIndex(int argc, VALUE *argv, VALUE klass)
75887393
75897394 /*
75907395 * call-seq:
7591- * Molecule.list -> array of Molecules
7396+ * list -> array of Molecules
75927397 *
75937398 * Get the list of molecules associated to the documents, in the order of creation
75947399 * time of the document. If no document is open, returns an empry array.
@@ -7610,7 +7415,7 @@ s_Molecule_List(VALUE klass)
76107415
76117416 /*
76127417 * call-seq:
7613- * Molecule.ordered_list -> array of Molecules
7418+ * ordered_list -> array of Molecules
76147419 *
76157420 * Get the list of molecules associated to the documents, in the order of front-to-back
76167421 * ordering of the associated window. If no document is open, returns an empry array.
@@ -7648,7 +7453,7 @@ Init_Molby(void)
76487453 rb_define_private_method(rb_cMolecule, "initialize_copy", s_Molecule_InitCopy, 1);
76497454 rb_define_method(rb_cMolecule, "loadmbsf", s_Molecule_Loadmbsf, -1);
76507455 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");
76527457 rb_define_method(rb_cMolecule, "loadpdb", s_Molecule_Loadpdb, -1);
76537458 rb_define_method(rb_cMolecule, "loaddcd", s_Molecule_Loaddcd, -1);
76547459 rb_define_method(rb_cMolecule, "loadtep", s_Molecule_Loadtep, -1);
@@ -7659,7 +7464,7 @@ Init_Molby(void)
76597464 rb_define_method(rb_cMolecule, "molsave", s_Molecule_Save, -1);
76607465 rb_define_method(rb_cMolecule, "savembsf", s_Molecule_Savembsf, 1);
76617466 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");
76637468 rb_define_method(rb_cMolecule, "savepdb", s_Molecule_Savepdb, 1);
76647469 rb_define_method(rb_cMolecule, "savedcd", s_Molecule_Savedcd, 1);
76657470 rb_define_method(rb_cMolecule, "savetep", s_Molecule_Savetep, 1);
@@ -7695,16 +7500,17 @@ Init_Molby(void)
76957500 rb_define_method(rb_cMolecule, "each_atom", s_Molecule_EachAtom, 0);
76967501 rb_define_method(rb_cMolecule, "cell", s_Molecule_Cell, 0);
76977502 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=");
76997504 rb_define_method(rb_cMolecule, "cell_transform", s_Molecule_CellTransform, 0);
77007505 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=");
77037508 rb_define_method(rb_cMolecule, "symmetry", s_Molecule_Symmetry, 0);
7509+ rb_define_alias(rb_cMolecule, "symmetries", "symmetry");
77047510 rb_define_method(rb_cMolecule, "nsymmetries", s_Molecule_Nsymmetries, 0);
77057511 rb_define_method(rb_cMolecule, "add_symmetry", s_Molecule_AddSymmetry, 1);
7706- rb_define_method(rb_cMolecule, "remove_symmetries", s_Molecule_RemoveSymmetry, -1);
77077512 rb_define_method(rb_cMolecule, "remove_symmetry", s_Molecule_RemoveSymmetry, -1);
7513+ rb_define_alias(rb_cMolecule, "remove_symmetries", "remove_symmetry");
77087514 rb_define_method(rb_cMolecule, "extract", s_Molecule_Extract, -1);
77097515 rb_define_method(rb_cMolecule, "add", s_Molecule_Add, 1);
77107516 rb_define_alias(rb_cMolecule, "+", "add");
@@ -7727,16 +7533,16 @@ Init_Molby(void)
77277533 rb_define_method(rb_cMolecule, "selection", s_Molecule_Selection, 0);
77287534 rb_define_method(rb_cMolecule, "selection=", s_Molecule_SetSelection, 1);
77297535 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);
77327536 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=");
77337539 rb_define_method(rb_cMolecule, "nframes", s_Molecule_Nframes, 0);
77347540 rb_define_method(rb_cMolecule, "create_frame", s_Molecule_CreateFrames, -1);
77357541 rb_define_method(rb_cMolecule, "insert_frame", s_Molecule_InsertFrames, -1);
77367542 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");
77407546 rb_define_method(rb_cMolecule, "each_frame", s_Molecule_EachFrame, 0);
77417547 rb_define_method(rb_cMolecule, "register_undo", s_Molecule_RegisterUndo, -1);
77427548 rb_define_method(rb_cMolecule, "undo_enabled?", s_Molecule_UndoEnabled, 0);
@@ -7765,7 +7571,6 @@ Init_Molby(void)
77657571 rb_define_method(rb_cMolecule, "update_enabled?", s_Molecule_UpdateEnabled, 0);
77667572 rb_define_method(rb_cMolecule, "update_enabled=", s_Molecule_SetUpdateEnabled, 1);
77677573 rb_define_method(rb_cMolecule, "show_unitcell", s_Molecule_ShowUnitCell, -1);
7768- rb_define_method(rb_cMolecule, "show_unitcell=", s_Molecule_ShowUnitCell, -1);
77697574 rb_define_method(rb_cMolecule, "show_hydrogens", s_Molecule_ShowHydrogens, -1);
77707575 rb_define_method(rb_cMolecule, "show_hydrogens=", s_Molecule_ShowHydrogens, -1);
77717576 rb_define_method(rb_cMolecule, "show_dummy_atoms", s_Molecule_ShowDummyAtoms, -1);
@@ -7778,8 +7583,15 @@ Init_Molby(void)
77787583 rb_define_method(rb_cMolecule, "show_graphite=", s_Molecule_ShowGraphite, -1);
77797584 rb_define_method(rb_cMolecule, "show_periodic_image", s_Molecule_ShowPeriodicImage, -1);
77807585 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");
77817593 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");
77837595 rb_define_method(rb_cMolecule, "show_text", s_Molecule_ShowText, 1);
77847596 rb_define_method(rb_cMolecule, "md_arena", s_Molecule_MDArena, 0);
77857597 rb_define_method(rb_cMolecule, "set_parameter_attr", s_Molecule_SetParameterAttr, 5);
@@ -7816,10 +7628,10 @@ Init_Molby(void)
78167628 strcat(buf, "=");
78177629 rb_define_method(rb_cAtomRef, buf, s_AtomAttrDefTable[i].setter, 1);
78187630 }
7819- rb_define_method(rb_cAtomRef, "set_attr", s_AtomRef_SetAttr, 2);
78207631 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", "[]=");
78227633 rb_define_method(rb_cAtomRef, "[]", s_AtomRef_GetAttr, 1);
7634+ rb_define_alias(rb_cAtomRef, "get_attr", "[]");
78237635 s_SetAtomAttrString = rb_str_new2("set_atom_attr");
78247636 rb_global_variable(&s_SetAtomAttrString);
78257637
@@ -7900,10 +7712,10 @@ Init_Molby(void)
79007712 rb_define_method(rb_cParameterRef, buf, s_ParameterAttrDefTable[i].setter, 1);
79017713 }
79027714 }
7903- rb_define_method(rb_cParameterRef, "set_attr", s_ParameterRef_SetAttr, 2);
79047715 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", "[]=");
79067717 rb_define_method(rb_cParameterRef, "[]", s_ParameterRef_GetAttr, 1);
7718+ rb_define_alias(rb_cParameterRef, "get_attr", "[]");
79077719 rb_define_method(rb_cParameterRef, "to_hash", s_ParameterRef_ToHash, 0);
79087720 rb_define_method(rb_cParameterRef, "to_s", s_ParameterRef_ToString, 0);
79097721 rb_define_method(rb_cParameterRef, "keys", s_ParameterRef_Keys, 0);
@@ -7917,7 +7729,6 @@ Init_Molby(void)
79177729
79187730 /* module Kernel */
79197731 rb_define_method(rb_mKernel, "check_interrupt", s_Kernel_CheckInterrupt, 0);
7920-/* rb_define_method(rb_mKernel, "idle", s_Kernel_Idle, 1); */
79217732 rb_define_method(rb_mKernel, "get_interrupt_flag", s_GetInterruptFlag, 0);
79227733 rb_define_method(rb_mKernel, "set_interrupt_flag", s_SetInterruptFlag, 1);
79237734 rb_define_method(rb_mKernel, "show_progress_panel", s_ShowProgressPanel, -1);
--- a/MolLib/Ruby_bind/ruby_dialog.c
+++ b/MolLib/Ruby_bind/ruby_dialog.c
@@ -171,7 +171,7 @@ s_RubyDialog_ItemIndexForTag(VALUE self, VALUE tag)
171171
172172 /*
173173 * call-seq:
174- * dialog.set_attr(tag, hash)
174+ * set_attr(tag, hash)
175175 *
176176 * Set the attributes given in the hash.
177177 */
@@ -305,7 +305,7 @@ s_RubyDialog_SetAttr(VALUE self, VALUE tag, VALUE hash)
305305
306306 /*
307307 * call-seq:
308- * dialog.attr(tag, key)
308+ * attr(tag, key)
309309 *
310310 * Get the attribute for the key.
311311 */
@@ -419,7 +419,7 @@ s_RubyDialog_Attr(VALUE self, VALUE tag, VALUE key)
419419
420420 /*
421421 * call-seq:
422- * dialog.run
422+ * run
423423 *
424424 * Run the modal session for this dialog.
425425 */
@@ -458,13 +458,13 @@ s_RubyDialog_Run(VALUE self)
458458
459459 /*
460460 * 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
462462 *
463463 * Layout items in a table. The first argument is the number of columns, and must be a positive integer.
464464 * If the last argument is a hash, then it contains the layout options.
465465 * The ixy is the item identifier (a non-negative integer) or [identifier, hash], where the hash
466466 * 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.
468468 */
469469 static VALUE
470470 s_RubyDialog_Layout(int argc, VALUE *argv, VALUE self)
@@ -722,11 +722,10 @@ s_RubyDialog_Layout(int argc, VALUE *argv, VALUE self)
722722
723723 /*
724724 * call-seq:
725- * dialog.item(type, hash) => integer
725+ * item(type, hash) -> integer
726726 *
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.
730729 * Returns an integer that represents the item. (0 and 1 are reserved for "OK" and "Cancel")
731730 */
732731 static VALUE
@@ -828,7 +827,7 @@ s_RubyDialog_Item(int argc, VALUE *argv, VALUE self)
828827
829828 /*
830829 * call-seq:
831- * dialog._items => an array of hash
830+ * _items -> Array of Hash
832831 *
833832 * Returns an internal array of items. For debugging use only.
834833 */
@@ -840,7 +839,7 @@ s_RubyDialog_Items(VALUE self)
840839
841840 /*
842841 * call-seq:
843- * dialog.nitems => integer
842+ * nitems -> integer
844843 *
845844 * Returns the number of items.
846845 */
@@ -854,7 +853,7 @@ s_RubyDialog_Nitems(VALUE self)
854853
855854 /*
856855 * call-seq:
857- * dialog.each_item block
856+ * each_item {|n| ...}
858857 *
859858 * Iterate the given block with the item number as the argument.
860859 */
@@ -872,7 +871,7 @@ s_RubyDialog_EachItem(VALUE self)
872871
873872 /*
874873 * call-seq:
875- * dialog.radio_group(ary)
874+ * radio_group(Array)
876875 *
877876 * Group radio buttons as a mutually exclusive group.
878877 */
@@ -915,14 +914,21 @@ s_RubyDialog_RadioGroup(VALUE self, VALUE aval)
915914
916915 /*
917916 * call-seq:
918- * dialog.action(index)
917+ * action(index)
919918 *
920919 * 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.
922921 * Otherwise, the "action" attribute is looked for the item, and if found
923922 * it is called with the given index as the argument (the attribute must be
924923 * either a symbol (method name) or a Proc object).
925924 * 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+.
926932 */
927933 static VALUE
928934 s_RubyDialog_Action(VALUE self, VALUE idx)
@@ -949,7 +955,7 @@ s_RubyDialog_Action(VALUE self, VALUE idx)
949955
950956 /*
951957 * 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)
953959 *
954960 * Display the "save as" dialog and returns the fullpath filename.
955961 */
@@ -986,7 +992,7 @@ s_RubyDialog_SavePanel(int argc, VALUE *argv, VALUE klass)
986992
987993 /*
988994 * 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)
990996 *
991997 * Display the "open" dialog and returns the fullpath filename.
992998 */
--- a/MolLib/Ruby_bind/ruby_md.c
+++ b/MolLib/Ruby_bind/ruby_md.c
@@ -112,7 +112,7 @@ s_MDArena_Run_or_minimize(VALUE self, VALUE arg, int minimize)
112112
113113 /*
114114 * call-seq:
115- * mdarena.run(n) -> self
115+ * run(n) -> self
116116 *
117117 * Run the simulation for n steps.
118118 */
@@ -124,8 +124,8 @@ s_MDArena_Run(VALUE self, VALUE arg)
124124
125125 /*
126126 * call-seq:
127- * mdarena.minimize(n) -> self
128- * mdarena.minimize(n) { ... } -> self
127+ * minimize(n) -> self
128+ * minimize(n) { ... } -> self
129129 *
130130 * Minimize the energy for n steps. If a block is given, it is executed when minimization is complete.
131131 */
@@ -137,7 +137,7 @@ s_MDArena_Minimize(VALUE self, VALUE arg)
137137
138138 /*
139139 * call-seq:
140- * mdarena.prepare(check_only = false) -> self or nil
140+ * prepare(check_only = false) -> self or nil
141141 *
142142 * Prepare for the MD calculation; refresh the internal information even if initialization is
143143 * already done.
@@ -258,7 +258,7 @@ s_MDArena_Prepare(int argc, VALUE *argv, VALUE self)
258258
259259 /*
260260 * 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]
262262 *
263263 * Get the current energies.
264264 */
@@ -340,9 +340,9 @@ static struct s_MDArenaAttrDef s_MDPressureAttrDefTable[] = {
340340
341341 /*
342342 * call-seq:
343- * arena[attr]
343+ * self[attr]
344344 *
345- * Get the attribute value.
345+ * Get the attribute value. The attribute values also can be accessed by self.attribute_name.
346346 */
347347 static VALUE
348348 s_MDArena_Get(VALUE self, VALUE attr)
@@ -408,12 +408,6 @@ s_MDArena_Get(VALUE self, VALUE attr)
408408 return Qnil; /* Not reached */
409409 }
410410
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- */
417411 static VALUE
418412 s_MDArena_GetAttr(VALUE self)
419413 {
@@ -422,9 +416,9 @@ s_MDArena_GetAttr(VALUE self)
422416
423417 /*
424418 * call-seq:
425- * arena[attr]=
419+ * self[attr] = value
426420 *
427- * Set the attribute value.
421+ * Set the attribute value. The attributes can also be modified by self.attribute_name = value.
428422 */
429423 static VALUE
430424 s_MDArena_Set(VALUE self, VALUE attr, VALUE val)
@@ -523,12 +517,6 @@ s_MDArena_Set(VALUE self, VALUE attr, VALUE val)
523517 return Qnil; /* Not reached */
524518 }
525519
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- */
532520 static VALUE
533521 s_MDArena_SetAttr(VALUE self, VALUE val)
534522 {
@@ -549,7 +537,7 @@ s_MDArena_SetAttr(VALUE self, VALUE val)
549537
550538 /*
551539 * call-seq:
552- * arena.to_hash
540+ * to_hash -> Hash
553541 *
554542 * Returns a (frozen) hash that contains the current value for all attribute keys.
555543 */
@@ -570,7 +558,7 @@ s_MDArena_ToHash(VALUE self)
570558
571559 /*
572560 * call-seq:
573- * arena.print_surface_area
561+ * print_surface_area
574562 *
575563 * Print the surface area information to standard output. (for debug)
576564 */
旧リポジトリブラウザで表示