diff options
author | Bruce Smith <bruce@nanorex.com> | 2009-01-12 23:12:33 +0000 |
---|---|---|
committer | Bruce Smith <bruce@nanorex.com> | 2009-01-12 23:12:33 +0000 |
commit | c0e1948c73472001c41d4b60e0919c50f15f1cca (patch) | |
tree | 96bf2a41449901e55aa8befb28d01faf3624367c | |
parent | 91e53fe973a03836d746166184e71a138dbaae7c (diff) | |
download | nanoengineer-c0e1948c73472001c41d4b60e0919c50f15f1cca.tar.gz nanoengineer-c0e1948c73472001c41d4b60e0919c50f15f1cca.zip |
line length, renamed methods, other misc cleanup
-rwxr-xr-x | cad/src/analysis/GAMESS/jig_Gamess.py | 4 | ||||
-rwxr-xr-x | cad/src/commands/BuildAtoms/BuildAtoms_Command.py | 4 | ||||
-rwxr-xr-x | cad/src/foundation/Utility.py | 71 | ||||
-rwxr-xr-x | cad/src/model/chem.py | 85 | ||||
-rwxr-xr-x | cad/src/model/chunk.py | 58 | ||||
-rwxr-xr-x | cad/src/model/part.py | 7 | ||||
-rw-r--r-- | cad/src/modelTree/mt_statistics.py | 6 | ||||
-rwxr-xr-x | cad/src/operations/ops_files.py | 4 | ||||
-rwxr-xr-x | cad/src/simulation/movie.py | 19 |
9 files changed, 148 insertions, 110 deletions
diff --git a/cad/src/analysis/GAMESS/jig_Gamess.py b/cad/src/analysis/GAMESS/jig_Gamess.py index 87b32fb02..93b0d5741 100755 --- a/cad/src/analysis/GAMESS/jig_Gamess.py +++ b/cad/src/analysis/GAMESS/jig_Gamess.py @@ -16,7 +16,7 @@ from analysis.GAMESS.files_gms import get_energy_from_gms_outfile, get_atompos_f from utilities.Log import redmsg, greenmsg import foundation.env as env from utilities.Log import redmsg -from model.chem import move_alist_and_snuggle +from model.chem import move_atoms_and_normalize_bondpoints import foundation.state_utils as state_utils from utilities.debug import print_compact_traceback @@ -341,7 +341,7 @@ class Gamess(Jig): print "move_atoms: The number of atoms from GAMESS file (%d) is not matching with that of the current model (%d)" % \ (len(newPositions), len(atomList)) return - move_alist_and_snuggle(atomList, newPositions) + move_atoms_and_normalize_bondpoints(atomList, newPositions) #bruce 051221 fix a bug analogous to bug 1239 by letting this new function (containing a loop) # replace a copy (which was right here) of the older buggy version of that loop self.assy.o.gl_update() diff --git a/cad/src/commands/BuildAtoms/BuildAtoms_Command.py b/cad/src/commands/BuildAtoms/BuildAtoms_Command.py index cf9fdd96f..a0e5b5b71 100755 --- a/cad/src/commands/BuildAtoms/BuildAtoms_Command.py +++ b/cad/src/commands/BuildAtoms/BuildAtoms_Command.py @@ -228,6 +228,10 @@ class BuildAtoms_Command(SelectAtoms_Command): self.Menu_spec.append(item) chunk = selatom.molecule if (chunk.chunkHasOverlayText): + # note: this is only a hint, but since it's updated whenever + # chunk is drawn, I suspect it will always be up to date at + # this point. (If not, that's ok -- these commands will just + # be noops.) [bruce 090112 comment] if (chunk.showOverlayText): item = ('Hide overlay text on %r' % name, self.toggleShowOverlayText) else: diff --git a/cad/src/foundation/Utility.py b/cad/src/foundation/Utility.py index 990a2ec7e..216d733df 100755 --- a/cad/src/foundation/Utility.py +++ b/cad/src/foundation/Utility.py @@ -1424,38 +1424,61 @@ class Node( StateMixin): """ return None - def copy_copyable_attrs_to(self, target, own_mutable_state = True): #bruce 050526; behavior and docstring revised 051003 + def copy_copyable_attrs_to(self, target, own_mutable_state = True): """ - Copy all copyable attrs (as defined by a typically-subclass-specific constant tuple, self.copyable_attrs) - from self to target (presumably a Node of the same subclass, but this is not checked, - and violating it might not be an error, in principle; in particular, as of 051003 target is explicitly permitted + Copy all copyable attrs (as defined by a typically-subclass-specific + constant tuple which lists their names, self.copyable_attrs) + from self to target (presumably a Node of the same subclass as self, + but this is not checked, and violating it might not be an error, + in principle; in particular, as of 051003 target is explicitly permitted to be a methodless attribute-holder). - Target and self need not be in the same assy (i.e. need not have the same .assy attribute), - and when this situation occurs, it must not be disturbed (e.g. setting target.assy = self.assy would be a bug). - Doesn't do any invals or updates in target. - This is not intended to be a full copy of self, since copyable_attrs (in current client code) - should not contain object-valued attrs like Group.members, Node.dad, or Chunk.atoms, but only - "parameter-like" attributes. It's meant to be used as a helper function for making full or partial copies - of self, and related purposes. The exact set of attributes to include can be chosen somewhat - arbitrarily by each subclass, but any which are left out will have to be handled separately by the copy methods; - in practice, new attributes in subclasses should almost always be declared in copyable_attrs. - As of 051003, this method (implem and spec) has been extended to "deep copy" any mutable objects - found in attribute values (of the standard kinds defined by state_utils.copy_val), so that no - mutable state is shared between copies and originals. This can be turned off by passing own_mutable_state = False, - which is a useful optimization if serial copies are made and intermediate copies won't be kept. - This is intended as a private helper method for subclass-specific copy methods, - which may need to do further work to make these attribute-copies fully correct -- - for example, modifying the values of id- or (perhaps) name-like attributes, - or doing appropriate invals or updates in target. + + Target and self need not be in the same assy (i.e. need not have the + same .assy attribute), and when this situation occurs, it must not be + disturbed (e.g. setting target.assy = self.assy would be a bug). + + This method doesn't do any invals or updates in target. + + This is not intended to be a full copy of self, since copyable_attrs + (in current client code) should not contain object-valued attrs like + Group.members, Node.dad, or Chunk.atoms, but only "parameter-like" + attributes. It's meant to be used as a helper function for making full + or partial copies of self, and related purposes. The exact set of + attributes to include can be chosen somewhat arbitrarily by each + subclass, but any which are left out will have to be handled separately + by the copy methods; in practice, new attributes in subclasses should + almost always be declared in copyable_attrs. + + As of 051003, this method (implem and spec) has been extended to + "deep copy" any mutable objects found in attribute values (of the + standard kinds defined by state_utils.copy_val), so that no mutable + state is shared between copies and originals. This can be turned off + by passing own_mutable_state = False, which is a useful optimization + if serial copies are made and intermediate copies won't be kept. + + This is intended as a private helper method for subclass-specific copy + methods, which may need to do further work to make these attribute- + copies fully correct -- for example, modifying the values of id- or + (perhaps) name-like attributes, or doing appropriate invals or updates + in target. + + [subclasses probably never need to extend this method] """ + #bruce 050526; behavior and docstring revised 051003 + # REVIEW/TODO: rename this to be private, if indeed it is for attr in self.copyable_attrs: - assert attr != 'assy' #e could optim by doing this once per class or once per instance + assert attr != 'assy' # todo: optim by doing this once per class val = getattr(self, attr) if own_mutable_state: val = copy_val(val) - setattr(target, attr, val) # turns some default class attrs into unneeded instance attrs (nevermind for now) + setattr(target, attr, val) + # note: waste of RAM: this turns some default class attrs + # into unneeded instance attrs (nevermind for now; + # but note that some classes copy some attrs outside of this + # method for this reason) if isinstance(target, Node): - # don't do this for non-Nodes, to permit target being just a methodless attribute-holder [new feature, bruce 051003] + # having this condition permits target being just a + # methodless attribute-holder [new feature, bruce 051003] self.copy_prior_part_to( target) return diff --git a/cad/src/model/chem.py b/cad/src/model/chem.py index 3699eaf00..11537efbc 100755 --- a/cad/src/model/chem.py +++ b/cad/src/model/chem.py @@ -589,7 +589,7 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): # Text to be drawn floating over the atom. Note, you must also # set chunk.chunkHasOverlayText for this to be used. Do this by - # just calling setOverlayText(). + # just calling setOverlayText() to set both. overlayText = None # piotr 080822: The pdb_info dictionary stores information @@ -635,8 +635,8 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): self._changed_structure() self.changed() posn = self.posn() - self.setposn_batch( posn - V(1,1,1) ) # i hope it doesn't optimize for posn being unchanged! just in case, set wrong then right - self.setposn_batch( posn ) + self.setposn( posn - V(1,1,1) ) # i hope it doesn't optimize for posn being unchanged! just in case, set wrong then right + self.setposn( posn ) # .picked might change... always recompute selatoms in external code ####@@@@ self.molecule.changeapp(1) # anything needed for InvalMixin stuff?? #e ####@@@@ @@ -1056,7 +1056,7 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): undo_archive._undo_debug_message( '_undo_debug_obj = %r' % self ) return - def setOverlayText(self, text): + def setOverlayText(self, text): # by EricM self.overlayText = text self.molecule.chunkHasOverlayText = True @@ -1290,6 +1290,7 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): # It's also been called (for awhile) from reading xyz files from Minimize.] # bruce 041130 added unary '+' (see Atom.posn comment for the reason). #bruce 060308 rewrite + #bruce 090112 removed setposn_batch alias, since no distinction for ages self._setposn_no_chunk_or_bond_invals(pos) mol = self.molecule if mol is not None: @@ -1301,9 +1302,7 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): for b in self.bonds: b.setup_invalidate() return # from setposn - - setposn_batch = setposn #bruce 060308 rewrite of setposn - + def _setposn_no_chunk_or_bond_invals(self, pos): #bruce 060308 (private for Chunk and Atom) self._posn = + pos _changed_posn_Atoms[self.key] = self #bruce 060322 @@ -1369,14 +1368,7 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): def __str__(self): return self.element.symbol_for_printing + str(self.key) - - def prin(self): - """ - for debugging - """ - lis = map((lambda b: b.other(self).element.symbol), self.bonds) - print self.element.name, lis - + _f_valid_neighbor_geom = False # privately, also used as valid_data tuple # this is reset to False by some Atom methods, and when any bond of self # is invalidated, which covers (I think) motion or element change of a @@ -3481,7 +3473,7 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): (self, numol, self.molecule, self.molecule.assy, numol.assy) print_compact_stack(msg + ": ") #bruce 080411 - # We only have to set this in the chunk, not clear it, as it + # We only have to set this in numol, not clear it in self, as it # is cleared by the display routine when needed. if (self.overlayText): numol.chunkHasOverlayText = True @@ -4759,10 +4751,8 @@ class Atom( PAM_Atom_methods, AtomBase, InvalMixin, StateMixin, Selobj_API): register_instancelike_class( Atom) # ericm & bruce 080225 register_class_changedicts( Atom, _Atom_global_dicts ) - # error if one class has two same-named changedicts (so be careful re module reload) - -# removing definition of atom = Atom, since I have just fixed all uses, I hope: [bruce 071113] -## atom = Atom # old name of that class -- must remain here until all code has been revised to use new name [bruce 050610] + # error if one class has two same-named changedicts + # (so be careful re module reload) # == @@ -4794,18 +4784,21 @@ def oneUnbonded(elem, assy, pos, atomtype = None, Chunk_class = None): @return: one newly created Atom object, already placed into a new chunk which has been added to the model using addnode """ - #bruce 080520 added Chunk_class option - #bruce 050510 added atomtype option - # bruce 041215 moved this from chunk.py to chem.py, and split part of it + #bruce 041215 moved this from chunk.py to chem.py, and split part of it # into the new atom method make_bondpoints_when_no_bonds, to help fix bug 131. + #bruce 050510 added atomtype option + #bruce 080520 added Chunk_class option + #todo: refile into operations, maybe as an assy or part method if Chunk_class is None: Chunk_class = assy.Chunk chunk = Chunk_class(assy, 'bug') # name is reset below! atom = Atom(elem.symbol, pos, chunk) # bruce 041124 revised name of new chunk, was gensym('Chunk.'); # no need for gensym since atom key makes the name unique, e.g. C1. - atom.set_atomtype_but_dont_revise_singlets(atomtype) # ok to pass None, type name, or type object; this verifies no change in elem - # note, atomtype might well already be the value we're setting; if it is, this should do nothing + atom.set_atomtype_but_dont_revise_singlets(atomtype) + # ok to pass None, type name, or type object; this verifies no change in elem + # note, atomtype might well already be the value we're setting; + # if it is, this should do nothing ## chunk.name = "Chunk-%s" % str(atom) chunk.name = gensym("Chunk", assy) #bruce 080407 per Mark NFR desire atom.make_bondpoints_when_no_bonds() # notices atomtype @@ -4814,34 +4807,44 @@ def oneUnbonded(elem, assy, pos, atomtype = None, Chunk_class = None): # == -def move_alist_and_snuggle(alist, newPositions): +def move_atoms_and_normalize_bondpoints(alist, newPositions): """ Move the atoms in alist to the new positions in the given array or sequence (which must have the same length); then for any singlets in alist, correct their positions using Atom.snuggle. - @warning: it would be wrong to call this on several alists in a row if they might overlap - or were connected by bonded atoms, for the same reason that the snuggle has to be done in a separate loop - (see snuggle docstring for details, re bug 1239). + @warning: it would be wrong to call this on several alists in a row if they + might overlap or were connected by bonded atoms, for the same + reason that the snuggle has to be done in a separate loop + (see snuggle docstring for details, re bug 1239). - @warning: I'm not sure if it does all required invals; it doesn't do gl_update. + @warning: I'm not sure this does all required invals; doesn't do gl_update. """ - #bruce 051221 split this out of class Movie so its bug1239 fix can be used in jig_Gamess. + #bruce 051221 split this out of class Movie so its bug1239 fix can be used + # in jig_Gamess. [later: Those callers have duplicated code which should be + # cleaned up.] + #bruce 090112 renamed from move_alist_and_snuggle + #todo: refile into a new file in operations package assert len(alist) == len(newPositions) singlets = [] for a, newPos in zip(alist, newPositions): - #bruce 050406 this needs a special case for singlets, in case they are H in the xyz file - # (and therefore have the wrong distance from their base atom). - # Rather than needing to know whether or not they were H during the sim, - # we can just regularize the singlet-baseatom distance for all singlets. - # For now I'll just use setposn to set the direction and snuggle to fix the distance. - #e BTW, I wonder if it should also regularize the distance for H itself? Maybe only if sim value - # is wildly wrong, and it should also complain. I won't do this for now. - a.setposn_batch(A(newPos)) #bruce 050513 try to optimize this + #bruce 050406 this needs a special case for singlets, in case they are H + # in the xyz file (and therefore have the wrong distance from their base + # atom). Rather than needing to know whether or not they were H during + # the sim, we can just regularize the singlet-baseatom distance for all + # singlets. For now I'll just use setposn to set the direction and snuggle + # to fix the distance. + # REVIEW: should it also regularize the distance for H itself? Maybe only + # if sim value is wildly wrong, and it should also complain. I won't do + # this for now. + a.setposn(A(newPos)) if a.is_singlet(): # same code as in movend() - singlets.append(a) #bruce 051221 to fix bug 1239: do all snuggles after all moves; see snuggle docstring warning + #bruce 051221 to fix bug 1239: do all snuggles after all moves; + # see snuggle docstring warning + singlets.append(a) + continue for a in singlets: - a.snuggle() # includes a.setposn; no need for that to be setposn_batch [bruce 050516 comment] + a.snuggle() # includes a.setposn return # end diff --git a/cad/src/model/chunk.py b/cad/src/model/chunk.py index a50f3462c..dfcc4a59d 100755 --- a/cad/src/model/chunk.py +++ b/cad/src/model/chunk.py @@ -311,10 +311,12 @@ class Chunk(NodeWithAtomContents, InvalMixin, _f_lost_externs = False _f_gained_externs = False - # Set this to True if any of the atoms in this chunk has their + # Set this to True if any of the atoms in this chunk have their # overlayText set to anything other than None. This keeps us from # having to test that for every single atom in every single chunk - # each time the screen is rerendered. + # each time the screen is rerendered. It is not reset to False + # except when no atoms happen to have overlayText when self is rendered -- + # in other words, it's only a hint -- false positives are permitted. chunkHasOverlayText = False # Set to True if the user wishes to see the overlay text on this @@ -2301,7 +2303,7 @@ class Chunk(NodeWithAtomContents, InvalMixin, return # from Chunk.draw() - def renderOverlayText(self, glpane): + def renderOverlayText(self, glpane): # by EricM gotone = False for atom in self.atoms.itervalues(): text = atom.overlayText @@ -4131,6 +4133,25 @@ class Chunk(NodeWithAtomContents, InvalMixin, assert 0, "should never be called, since a chunk does not *refer* to selatoms, or appear in atom.jigs" return True # but if it ever is called, answer should be true + def _copy_optional_attrs_to(self, numol): + #bruce 090112 split this out of two methods. + # Note: we don't put these in copyable_attrs, since + # copy_copyable_attrs_to wasted RAM when they have their + # default values (and perhaps for other reasons??). + # Review: add a method like this to Node API, to be called + # inside default def of copy_copyable_attrs_to?? + if self.chunkHasOverlayText: + numol.chunkHasOverlayText = True + if self.showOverlayText: + numol.showOverlayText = True + if self._colorfunc is not None: #bruce 060411 added condition + numol._colorfunc = self._colorfunc + if self._dispfunc is not None: + numol._dispfunc = self._dispfunc + # future: also copy user-specified axis, center, etc, if we have those + # (but see existing copy code for self.user_specified_center) + return + def copy_empty_shell_in_mapping(self, mapping): #bruce 070430 revised to honor mapping.assy """ [private method to help the public copy methods, all of which @@ -4152,17 +4173,8 @@ class Chunk(NodeWithAtomContents, InvalMixin, numol = self.__class__(mapping.assy, self.name) #bruce 080316 Chunk -> self.__class__ (part of fixing this for Extrude of DnaGroup) self.copy_copyable_attrs_to(numol) # copies .name (redundantly), .hidden, .display, .color... - if (self.chunkHasOverlayText): - numol.chunkHasOverlayText = True - if (self.showOverlayText): - numol.showOverlayText = True + self._copy_optional_attrs_to(numol) mapping.record_copy(self, numol) - # also copy user-specified axis, center, etc, if we ever have those - ## numol.setDisplayStyle(self.display) - if self._colorfunc is not None: #bruce 060411 added condition; note, this code snippet occurs in two methods - numol._colorfunc = self._colorfunc # bruce 041109 for extrudeMode.py; revised 050524 - if self._dispfunc is not None: - numol._dispfunc = self._dispfunc return numol def copy_full_in_mapping(self, mapping): # Chunk method [bruce 050526] #bruce 060308 major rewrite @@ -4376,10 +4388,7 @@ class Chunk(NodeWithAtomContents, InvalMixin, self.copy_copyable_attrs_to(numol) # copies .name (redundantly), .hidden, .display, .color... # and sets .prior_part, which is what should fix bug 660 - if (self.chunkHasOverlayText): - numol.chunkHasOverlayText = True - if (self.showOverlayText): - numol.showOverlayText = True + self._copy_optional_attrs_to(numol) numol.name = newname #end 050531 kluges nuatoms = {} @@ -4429,20 +4438,17 @@ class Chunk(NodeWithAtomContents, InvalMixin, bond_copied_atoms( na, x, b, a) if copied_hotspot is not None: numol.set_hotspot( ndix[copied_hotspot.key]) - #e also copy (but translate by offset) user-specified axis, center, etc, - # if we ever have those + # future: also copy (but translate by offset) user-specified + # axis, center, etc, if we ever have those if self.user_specified_center is not None: #bruce 050516 bugfix: 'is not None' numol.user_specified_center = self.user_specified_center + offset - numol.setDisplayStyle(self.display) + numol.setDisplayStyle(self.display) + # REVIEW: why is this not redundant? (or is it?) [bruce 090112 question] numol.dad = dad if dad and debug_flags.atom_debug: #bruce 050215 print "atom_debug: mol.copy got an explicit dad (this is deprecated):", dad - if self._colorfunc is not None: #bruce 060411 added condition; note, this code snippet occurs in two methods - numol._colorfunc = self._colorfunc # bruce 041109 for extrudeMode.py; revised 050524 - if self._dispfunc is not None: - numol._dispfunc = self._dispfunc - return numol # assy - + return numol + # == def Passivate(self, p = False): diff --git a/cad/src/model/part.py b/cad/src/model/part.py index 54456ea57..31c9b0b47 100755 --- a/cad/src/model/part.py +++ b/cad/src/model/part.py @@ -1184,13 +1184,6 @@ class Part( jigmakers_Mixin, InvalMixin, StateMixin, # == - # for debugging - def prin(self): - for a in self.selatoms.itervalues(): - a.prin() - - # == - def break_interpart_bonds(self): ###@@@ move elsewhere in method order? review, implem for jigs """ Break all bonds between nodes in this part and nodes in other parts; diff --git a/cad/src/modelTree/mt_statistics.py b/cad/src/modelTree/mt_statistics.py index 89b547fb0..e8813b8ec 100644 --- a/cad/src/modelTree/mt_statistics.py +++ b/cad/src/modelTree/mt_statistics.py @@ -63,12 +63,16 @@ def mt_accumulate_stats(node, stats): #bruce 081216 renamed from accumulate_stat stats.ngroups += int(isinstance(node, Group)) if (isinstance(node, Chunk)): stats.nchunks += 1 + # note: chunkHasOverlayText is only a hint, so it's possible + # this has false positives, even though it becomes accurate + # every time node is drawn. (If it's visible in MT but hidden + # in glpane, I think nothing will update it.) [bruce 090112 comment] if (node.chunkHasOverlayText and not node.showOverlayText): stats.canShowOverlayText += 1 if (node.chunkHasOverlayText and node.showOverlayText): stats.canHideOverlayText += 1 stats.njigs += int(isinstance(node, Jig)) - #e later, classify(node1, Node) into a list of classes, and get counts for all... + # maybe todo: also show counts of all other subclasses of Node? stats.npicked += int(node.picked) stats.nhidden += int(node.hidden) diff --git a/cad/src/operations/ops_files.py b/cad/src/operations/ops_files.py index 723e1e273..a840852be 100755 --- a/cad/src/operations/ops_files.py +++ b/cad/src/operations/ops_files.py @@ -37,7 +37,7 @@ from utilities import debug_flags from platform_dependent.PlatformDependent import find_or_make_Nanorex_subdir from model.assembly import Assembly -from model.chem import move_alist_and_snuggle +from model.chem import move_atoms_and_normalize_bondpoints from simulation.runSim import readGromacsCoordinates @@ -1202,7 +1202,7 @@ class fileSlotsMixin: #bruce 050907 moved these methods out of class MWsemantics #bruce 080606 added condition ok == SUCCESS (likely bugfix) newPositions = readGromacsCoordinates(gromacsCoordinateFile, listOfAtoms) if (type(newPositions) == type([])): - move_alist_and_snuggle(listOfAtoms, newPositions) + move_atoms_and_normalize_bondpoints(listOfAtoms, newPositions) else: env.history.message(redmsg(newPositions)) diff --git a/cad/src/simulation/movie.py b/cad/src/simulation/movie.py index 2385c5526..8fc876301 100755 --- a/cad/src/simulation/movie.py +++ b/cad/src/simulation/movie.py @@ -19,7 +19,7 @@ from PyQt4.Qt import Qt, qApp, QApplication, QCursor, SIGNAL from utilities.Log import redmsg, orangemsg, greenmsg from geometry.VQT import A from foundation.state_utils import IdentityCopyMixin -from model.chem import move_alist_and_snuggle +from model.chem import move_atoms_and_normalize_bondpoints from utilities import debug_flags from platform_dependent.PlatformDependent import fix_plurals from utilities.debug import print_compact_stack, print_compact_traceback @@ -1109,7 +1109,7 @@ class Movie(IdentityCopyMixin): #bruce 080321 bugfix: added IdentityCopyMixin print msg raise ValueError, msg #bruce 060108 reviewed/revised all 2 calls, added this exception to preexisting noop/errorprint (untested) - move_alist_and_snuggle(self.alist, newPositions) #bruce 051221 fixed bug 1239 in this function, then split it out + move_atoms_and_normalize_bondpoints(self.alist, newPositions) #bruce 051221 fixed bug 1239 in this function, then split it out self.glpane.gl_update() return @@ -1166,7 +1166,7 @@ class MovableAtomList: #bruce 050426 splitting this out of class Movie... except res = map( lambda a: a.sim_posn(), self.alist ) return A(res) - def set_posns(self, newposns): #bruce 060111 comment: should probably be renamed set_sim_posns since it corrects singlet posns + def set_posns(self, newposns): """ Set our atoms' positions (even killed ones) to those in the given array (but correct singlet positions); do all required invals but @@ -1175,10 +1175,15 @@ class MovableAtomList: #bruce 050426 splitting this out of class Movie... except @note: someday we might have a version which only does this for the atoms now in a given Part. """ - #e later we'll optimize this by owning atoms and speeding up or eliminating invals - #bruce 060109 replaced prior code with this recently split out routine, so that singlet correction is done on every frame; - # could be optimized, e.g. by precomputing singlet list and optimizing setposn_batch on lists of atoms - move_alist_and_snuggle(self.alist, newposns) + #e later we'll optimize this by owning atoms and speeding up or + # eliminating invals + #bruce 060109 replaced prior code with this recently split out routine, + # so that singlet correction is done on every frame; could be optimized, + # e.g. by precomputing singlet list and optimizing setposn on lists of + # atoms + #bruce 060111 comment: should probably be renamed set_sim_posns + # since it corrects singlet posns + move_atoms_and_normalize_bondpoints(self.alist, newposns) set_posns_no_inval = set_posns #e for now... later this can be faster, and require own/release around it |