Skip to content

Commit

Permalink
minor formatting and documentation, #30
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 13, 2017
1 parent 06ab19d commit 08dd27c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions js/common/model/Atom.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ define( function( require ) {
// @public
reset: function() {
this.electronegativityProperty.reset();

// do not reset location and partial charge, they will be reset by their parent molecule
}
} );
Expand Down
9 changes: 8 additions & 1 deletion js/common/model/MPModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,30 @@ define( function( require ) {
// convert angle to range [0,2*PI)
var dipoleAngle = normalizeAngle( molecule.dipoleProperty.get().angle() );

var newDipoleAngle;

// move the molecular dipole one step towards alignment with the E-field
var newDipoleAngle = dipoleAngle;
if ( dipoleAngle === 0 ) {

// do nothing, molecule is aligned with E-field
newDipoleAngle = dipoleAngle;
}
else if ( dipoleAngle > 0 && dipoleAngle < Math.PI ) {

// rotate counterclockwise
newDipoleAngle = dipoleAngle - deltaDipoleAngle;
if ( newDipoleAngle < 0 ) {

// new angle would overshoot, set to zero
newDipoleAngle = 0;
}
}
else {

// rotate clockwise
newDipoleAngle = dipoleAngle + deltaDipoleAngle;
if ( newDipoleAngle > 2 * Math.PI ) {

// new angle would overshoot, set to zero
newDipoleAngle = 0;
}
Expand Down
3 changes: 2 additions & 1 deletion js/common/view/SurfaceColorKey.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright 2014-2017, University of Colorado Boulder

/**
* Key for a surface's color scheme.
* Key for a surface's color scheme. This legend is a rectangular box with a gradient fill that matches the surface
* in the Molecule. Each label is a unit for a color.
*
* @author Chris Malley (PixelZoom, Inc.)
*/
Expand Down

0 comments on commit 08dd27c

Please sign in to comment.