MantisBT - Rosetta
View Issue Details
0000035Rosetta[All Projects] Bad Codingpublic2012-07-02 17:422012-09-20 13:41
renfrew 
honda 
lowminoralways
resolvedfixed 
All platformsAnyAny
Trunk 
Trunk 
All
NA
51160 + 51165
0000035: Too Much Pi
Few people use the constants in NumericTraits and this has resulted in many different definitions of pi. I suspect that changing all of these will affect the integration tests. There may be additional numerical constants that have been abused in this manner.

src/apps/pilot/chrisk/pep_prep.cc: Real pi( 3.14159 );
src/apps/pilot/chrisk/pepspec_anchor_dock.cc: Real pi( 3.14159 );
src/apps/pilot/frank/cryst_design.cc: core::Real deg2rad = 3.14159265/180.0;
src/apps/pilot/lemmon/deepMove.cc: core::Real const radians=3.14159;// not sure if this is degree or radians
src/apps/pilot/ragul/ragul_small_mol_map.cc:#define PI 3.14159265
src/apps/pilot/rhiju/rna_protein_test.cc: Real const phi = uniform() * 2 * 3.141592654;
src/apps/pilot/sergey/GA.cc: const Real PI = 3.141592653589;
src/apps/pilot/will/crossmatch.cc: Real ang1 = 180.0-acos(max(-1.0,min(1.0,mi2.axis .dot( mi1.axis ))))*180.0/3.14159;
src/apps/pilot/will/crossmatch.cc: Real ang2 = -acos(max(-1.0,min(1.0,mi2.ortho.dot(rotation_matrix_degrees(axis,ang1)*mi1.ortho))))*180.0/3.14159;
src/apps/pilot/will/crossmatch_d2.cc: Real ang1 = 180.0-acos(max(-1.0,min(1.0,mi2.axis .dot( mi1.axis ))))*180.0/3.14159;
src/apps/pilot/will/crossmatch_d2.cc: Real ang2 = -acos(max(-1.0,min(1.0,mi2.ortho.dot(rotation_matrix_degrees(axis,ang1)*mi1.ortho))))*180.0/3.14159;
src/apps/pilot/will/dubois.cc: pose.set_dof(core::id::DOF_ID(core::id::AtomID(6,2),core::id::THETA),3.14159);
src/apps/pilot/will/dubois.cc: pose.set_dof(core::id::DOF_ID(core::id::AtomID(6,2),core::id::THETA),3.14159);
src/apps/pilot/will/dubois.cc: pose.set_dof(id::DOF_ID(id::AtomID(6,2),id::THETA),3.14159);
src/apps/pilot/will/dubois.cc: pose.set_dof(id::DOF_ID(id::AtomID(6,2),id::THETA),3.14159);
src/apps/pilot/will/dubois.cc: pose.set_dof(id::DOF_ID(id::AtomID(6,2),id::THETA),3.14159);
src/apps/pilot/will/gen_cyc_gly_cst.cc: pose.add_constraint(new DihedralConstraint(AtomID(5,1),AtomID(1,1),AtomID(3,N),AtomID(4,N),new core::scoring::constraints::HarmonicFunc(3.14159 ,0.0001)));
src/apps/pilot/will/gen_d2.cc: //hisp.set_dof( DOF_ID(AtomID(11,ir),PHI ), 3.141593);
src/apps/pilot/will/gen_d2_4his.cc: //hisp.set_dof( DOF_ID(AtomID(11,ir),PHI ), 3.141593);
src/apps/pilot/will/gen_disulf_homodimer.cc: cysp.set_dof( DOF_ID(AtomID(11,ir),PHI ), 3.141593);
src/apps/pilot/will/gensym_3bpy_from_dimer.cc: new HarmonicFunc(3.14159,0.1) ) );
src/apps/pilot/will/gensym_3bpy_from_dimer.cc: new HarmonicFunc(3.14159,0.1) ) );
src/apps/pilot/will/gensym_3bpy_from_dimer.cc: new HarmonicFunc(3.14159,0.1) ) );
src/apps/pilot/will/gensym_3bpy_from_dimer.cc: new HarmonicFunc(3.14159,0.1) ) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C2"),5),AtomID(tmp.residue(5).atom_index("C7"),5),AtomID(9,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C7"),5),AtomID(9,1),AtomID(n1a,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C8"),5),AtomID(tmp.residue(5).atom_index("C9"),5),AtomID(9,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C9"),5),AtomID(9,3),AtomID(n2a,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk11,2),AtomID(bk12,2),AtomID(bk13,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk12,2),AtomID(bk13,1),AtomID(bk14,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk21,4),AtomID(bk22,4),AtomID(bk23,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk22,4),AtomID(bk23,3),AtomID(bk24,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp2.add_constraint( new AngleConstraint( AtomID(tmp2.residue(7).nheavyatoms()-2,7), AtomID(tmp2.residue(7).nheavyatoms()-1,7), AtomID(iO1,5), new HarmonicFunc(3.14159*2.0/3.0,0.2)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C2"),r5),AtomID(tmp.residue(5).atom_index("C7"),r5),AtomID(9,r1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C7"),r5),AtomID(9,r1),AtomID(n1a,r1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C8"),r5),AtomID(tmp.residue(5).atom_index("C9"),r5),AtomID(9,r3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C9"),r5),AtomID(9,r3),AtomID(n2a,r3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(bk11,r2),AtomID(bk12,r2),AtomID(bk13,r1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(bk12,r2),AtomID(bk13,r1),AtomID(bk14,r1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(bk21,r4),AtomID(bk22,r4),AtomID(bk23,r3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(bk22,r4),AtomID(bk23,r3),AtomID(bk24,r3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs.cc: tmp3.add_constraint( new AngleConstraint( AtomID(tmp2.residue(7).nheavyatoms()-2 ,r7), AtomID(tmp2.residue(7).nheavyatoms()-1,r7), AtomID(iO1,r5), new HarmonicFunc(3.14159*2.0/3.0,0.05)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C2"),5),AtomID(tmp.residue(5).atom_index("C7"),5),AtomID(9,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C7"),5),AtomID(9,1),AtomID(n1a,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C8"),5),AtomID(tmp.residue(5).atom_index("C9"),5),AtomID(9,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(tmp.residue(5).atom_index("C9"),5),AtomID(9,3),AtomID(n2a,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk11,2),AtomID(bk12,2),AtomID(bk13,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk12,2),AtomID(bk13,1),AtomID(bk14,1), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk21,4),AtomID(bk22,4),AtomID(bk23,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp.add_constraint( new AngleConstraint( AtomID(bk22,4),AtomID(bk23,3),AtomID(bk24,3), new HarmonicFunc(3.14159,0.3)) );
src/apps/pilot/will/test_ikrs2.cc: tmp2.add_constraint( new AngleConstraint( AtomID(tmp2.residue(7).nheavyatoms()-2,7),AtomID(tmp2.residue(7).nheavyatoms()-1,7), AtomID(iO1,5), new HarmonicFunc(3.14159*2.0/3.0,0.2)) );
src/apps/pilot/will/test_leerichards.cc: core::Real mag = uniform() * 2.0 * 3.14159;
src/apps/public/pepspec/pepspec_anchor_dock.cc: Real pi( 3.14159 );
src/core/chemical/orbitals/AssignOrbitals.cc: if( (theta < 1e-2) || (theta > 3.14-1e-2) )
src/core/chemical/orbitals/AssignOrbitals.cc: if( (theta < 1e-2) || (theta > 3.14-1e-2) )
src/core/chemical/ResidueType.cc: if( (theta < 1e-2) || (theta > 3.14-1e-2) )
src/core/coarse/Translator.cc: const Real Pi (3.14159); // EVIL -- use numeric::d::constants
src/core/coarse/Translator.cc: const Real Pi ( 3.14159 ); //EVIL
src/core/scoring/electron_density_atomwise/ElectronDensityAtomwise.cc: const Real PI = 3.1415926;
src/core/scoring/hbonds/hbonds_geom.cc: //std::cout << "penalizing hbond by " << cos2ChiShifted << " for having hydroxyl hydrogen too close: chi " << chi*180/3.1415926535 << std::endl;
src/core/scoring/methods/GaussianOverlapEnergy.cc: score = ((sqrt(3.14158)*r1*r2)/(sqrt(r1*r1+r2*r2)))*(exp(-d2/(r1*r1+r2*r2)));
src/core/scoring/packstat/compute_sasa.cc: PackstatReal mag = uniform() * 2 * 3.14159;
src/core/scoring/packstat/compute_sasa.cc: return alpha*alpha*3.14159;
src/core/scoring/packstat/LeeRichards.cc: // a->circle->dr += fabs(a->start_angle-a->end_angle);///180.0*3.14159265;
src/core/scoring/packstat/packing_score_params.cc: p.weight(1,23) = -0.00723770034705824; p.center(1,23) = 3.14094836962294;
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+2]=2.0*3.1415*numeric::random::uniform();//alpha
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+3]=2.0*3.1415*numeric::random::uniform();//beta
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+4]=2.0*3.1415*numeric::random::uniform();//gamma
src/core/scoring/ResidualDipolarCoupling.cc: tr.Trace << "alpha: " << par[ex*n_par+2]*180/3.1415926<< std::endl;
src/core/scoring/ResidualDipolarCoupling.cc: tr.Trace << "beta: " << par[ex*n_par+3]*180/3.1415926<< std::endl;
src/core/scoring/ResidualDipolarCoupling.cc: tr.Trace << "gamma:" << par[ex*n_par+4]*180/3.1415926<< std::endl;
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+1]=2.0*3.1415*numeric::random::uniform();//alpha
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+2]=2.0*3.1415*numeric::random::uniform();//beta
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+3]=2.0*3.1415*numeric::random::uniform();//gamma
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+1]=2.0*3.1415*numeric::random::uniform();//alpha
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+2]=2.0*3.1415*numeric::random::uniform();//beta
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+3]=2.0*3.1415*numeric::random::uniform();//gamma
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+0]=2.0*3.1415*numeric::random::uniform();//alpha
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+1]=2.0*3.1415*numeric::random::uniform();//beta
src/core/scoring/ResidualDipolarCoupling.cc: par[ex*n_par+2]=2.0*3.1415*numeric::random::uniform();//gamma
src/core/scoring/SecondaryStructurePotential.cc: rsigma_dot( 5, 14, 1, 1 ) = -3.149200;
src/devel/path_rover/pathrover.cc:#define PI 3.141592653 // TODO: use numeric
src/devel/path_rover/pathrover_partial_data_manager.cc: angle = (angle>0.0) ? 3.14159265359-angle : -(3.14159265359+angle);
src/devel/path_rover/pathrover_partial_data_manager.cc: angle = angle*180/3.14159265359;
src/devel/path_rover/pathrover_partial_data_manager.hh://#define [^] M_PI 3.14159265359
src/numeric/kinematic_closure/bridgeObjects.cc:#define pi 3.14159265358979323846264338327950288
src/protocols/abinitio/vs_test.cc: log << F( 8, 3, 3.14159 ) << std::endl;
src/protocols/fldsgn/potentials/sspot/NatbiasStrandPairPotential.cc: rsigma_dot( 5, 14, 1, 1 ) = -3.149200;
src/protocols/fldsgn/potentials/sspot/SSPairPotential.cc: rsigma_dot( 5, 14, 1, 1 ) = -3.149200;
src/protocols/fldsgn/topology/Sheet.cc:#define PI 3.141592
src/protocols/frag_picker/scores/InterbondAngleScore.cc: double angle = angle_of(v1, v2)*180.0/3.14159;
src/protocols/sparta/constants.hh:#define SPARTA_PI 3.14159265358979323846
src/protocols/swa/rna/StepWiseRNA_FloatingBase_Sampler_Util.hh:#define PI 3.14159265
src/protocols/viewer/viewers.cc: 0.5 * ( - cos( 3.14159 * p ) + 1.0 );
src/protocols/viewer/viewers.cc: 0.5 * ( cos( 3.14159 * p ) + 1.0 );
No tags attached.
Issue History
2012-07-02 17:42renfrewNew Issue
2012-07-02 18:10smlewisNote Added: 0000021
2012-07-09 14:55delucaslNote Added: 0000024
2012-07-09 14:56delucaslNote Edited: 0000024bug_revision_view_page.php?bugnote_id=24#r12
2012-07-09 15:12renfrewNote Added: 0000025
2012-08-04 14:13LabonteAssigned To => Labonte
2012-08-04 14:13LabonteStatusnew => assigned
2012-08-27 17:02smlewisAssigned ToLabonte => honda
2012-09-14 18:02hondaFixed in SVN Version => 51160
2012-09-14 18:02hondaNote Added: 0000098
2012-09-14 18:02hondaResolutionopen => fixed
2012-09-14 18:02hondaFixed in Version => Trunk
2012-09-20 11:25hondaStatusassigned => closed
2012-09-20 13:41smlewisFixed in SVN Version51160 => 51160 + 51165
2012-09-20 13:41smlewisStatusclosed => resolved

Notes
(0000021)
smlewis   
2012-07-02 18:10   
I'm going to close this as a dup of #314159
(0000024)
delucasl   
2012-07-09 14:55   
(edited on: 2012-07-09 14:56)
Is there a conceivable case in which an integration test caused by changing "3.14159" to the standard numeric constant would be actually detrimental to the scientific results?

Edit: I suppose if the reduced accuracy had in some way been optimized around.

(0000025)
renfrew   
2012-07-09 15:12   
I suspect that there would be little difference scientifically. Probably just trajectory changes integration tests.

Most of the examples above are from people setting HarmonicConstraints on dihedral angles. The HarmonicConstraints are in radians and people want to constrain them to 180 degrees (1 PI radians).

Its really just magic number cleanup.
(0000098)
honda   
2012-09-14 18:02   
May cause numerical differences in some architectures.

Affected files:

core/chemical/ResidueType.cc
core/chemical/orbitals/AssignOrbitals.cc
core/coarse/Translator.cc
core/scoring/ResidualDipolarCoupling.cc
core/scoring/methods/GaussianOverlapEnergy.cc
core/scoring/packstat/compute_sasa.cc
protocols/swa/rna/StepWise*
protocols/frag_picker/scores/InterboundAngleScore.cc
protocols/viewer/viewers.cc
protocols/fldsgn/topology/Sheet.cc
protocols/sparta/*
devel/path_rover/*
apps/public/pepspec/pepspec_anchor_dock.cc
apps/pilot/chrisk/*
apps/pilot/lemmon/deepMove.cc
apps/pilot/rhiju/rna_protein_test.cc
apps/pilot/will/*
apps/pilot/sergey/GA.cc
apps/pilot/frank/cryst_design.cc
apps/pilot/ragul/ragul_small_mol_map.cc