Java Reference
In-Depth Information
SOLUTION:
Program 11.4 Test program for Molecule
public class Test {
public static void main ( String
[ ]
args )
{
Atom o = new Atom ( 0 ,
0 . 4
,
0 , Atom . O RADIUS ) ;
Atom h1 = new Atom ( 0 . 7 6
,
0.19
, 0 , Atom . H RADIUS
);
Atom h2 = new Atom (
0.76
,
0.19
, 0 , Atom .
H RADIUS ) ;
Atom [ ] H2O = { o, h1 , h2 } ;
Molecule mol = new Molecule (H2O ) ;
}
}
- For each molecule, we are now going to build an enclosing ball that
will allow one to speed up the test for detecting potential collisions.
To simplify, assume the center of that sphere is set as the centroid of
atoms (barycenter of uniform weight). That is, we do not take into
account respective masses. See figure as below. We shall use object
Atom to represent such an enclosing ball.
are atom centers.
denote the centroid (barycenter with uniform
weight).
Plain circles denote Van der Walls of respective atoms.
The enclosing sphere of a water molecule.
- Write a static function middle that takes as its argument an array of
atoms (assume non-void) and that returns the centroid of these atoms.
This function shall be inserted in the Atom class, and will use functions
add and scale of class Point3D . This function shall not modify the atom
coordinates of the array.
 
 
Search WWH ::




Custom Search