/// \brief Save the specified coord to the specified Boost Property Tree ptree /// /// \relates coord void cath::geom::save_to_ptree(ptree &arg_ptree, ///< The ptree to which the coord should be saved const coord &arg_coord ///< The coord to be saved ) { arg_ptree.put( "x", arg_coord.get_x() ); arg_ptree.put( "y", arg_coord.get_y() ); arg_ptree.put( "z", arg_coord.get_z() ); }
void gridfilesetdeterminer::getfiles(coord& coord1, coord& coord2, set<string>& files) { coord coord3(coord1.getEDouble(), coord2.getNDouble()); coord coord4(coord2.getEDouble(), coord1.getNDouble()); string f1, f2, f3, f4; files.insert(gridfiledeterminer::getfile(coord1)); files.insert(gridfiledeterminer::getfile(coord2)); files.insert(gridfiledeterminer::getfile(coord3)); files.insert(gridfiledeterminer::getfile(coord4)); }
bool hitbox::intersect(const hitbox& rhs) { /* See: http://silentmatt.com/rectangle-intersection/ for visualization of intersection */ if (tl_.x() <= rhs.br_.x() && br_.x() >= rhs.tl_.x() && tl_.y() <= rhs.br_.y() && br_.y() >= rhs.tl_.y()) return true; return false; }
/** * Dodaje do kopca potencjalne nowe maksima, usuwając stare. */ uint64 repopulate(heap<coord> &h) { const coord current = h.pop(); /* Idź w górę. */ if (current.x + 1 == current.y) { h.push(coord(current.x, current.y - 1)); } /* Idź w lewo. */ if (current.x > 1) { h.push(coord(current.x - 1, current.y)); } return current.value(); }
/// \brief TODOCUMENT /// /// \relates pdb_atom ostream & cath::file::write_pdb_file_entry(ostream &arg_os, ///< TODOCUMENT const residue_id &arg_res_id, ///< TODOCUMENT const pdb_atom &arg_pdb_atom ///< TODOCUMENT ) { // Sanity check the inputs if ( arg_res_id.get_residue_name().is_null() ) { BOOST_THROW_EXCEPTION(invalid_argument_exception("Empty residue_name in cath::write_pdb_file_entry()")); } // Grab the necessary data const coord atom_coord = arg_pdb_atom.get_coord(); const string residue_name_with_insert_or_space = make_residue_name_string_with_insert_or_space( arg_res_id.get_residue_name() ); // Output the entry to a temporary ostringstream // (to avoid needlessly messing around with the formatting options of the ostream) ostringstream atom_ss; // Comments with PDB format documentation // (http://www.wwpdb.org/documentation/format33/sect9.html#ATOM) atom_ss << left; atom_ss << setw( 6 ) << arg_pdb_atom.get_record_type(); // 1 - 6 Record name "ATOM " or "HETATM" atom_ss << right; atom_ss << setw( 5 ) << arg_pdb_atom.get_atom_serial(); // 7 - 11 Integer serial Atom serial number. atom_ss << " "; atom_ss << setw( 4 ) << arg_pdb_atom.get_element_type_untrimmed(); // 13 - 16 Atom name Atom name. atom_ss << arg_pdb_atom.get_alt_locn(); // 17 Character altLoc Alternate location indicator. atom_ss << get_amino_acid_code( arg_pdb_atom ); // 18 - 20 Residue name resName Residue name. atom_ss << " "; atom_ss << arg_res_id.get_chain_label(); // 22 Character chainID Chain identifier. // 23 - 26 Integer resSeq Residue sequence number. atom_ss << setw( 5 ) << residue_name_with_insert_or_space; // 27 AChar iCode Code for insertion of residues. atom_ss << " "; atom_ss << fixed << setprecision( 3 ); atom_ss << setw( 8 ) << atom_coord.get_x(); // 31 - 38 Real(8.3) x Orthogonal coordinates for X in Angstroms. atom_ss << setw( 8 ) << atom_coord.get_y(); // 39 - 46 Real(8.3) y Orthogonal coordinates for Y in Angstroms. atom_ss << setw( 8 ) << atom_coord.get_z(); // 47 - 54 Real(8.3) z Orthogonal coordinates for Z in Angstroms. atom_ss << fixed << setprecision( 2 ); atom_ss << setw( 6 ) << arg_pdb_atom.get_occupancy(); // 55 - 60 Real(6.2) occupancy Occupancy. atom_ss << setw( 6 ) << arg_pdb_atom.get_temp_factor(); // 61 - 66 Real(6.2) tempFactor Temperature factor. // 77 - 78 LString(2) element Element symbol, right-justified. // 79 - 80 LString(2) charge Charge on the atom. // Output the result to the ostream and return it arg_os << atom_ss.str(); return arg_os; }
void show(const coord& ob) { cout << "(" << ob.get_x() << "," << ob.get_y() << ")" << endl; }
bool operator >(coord other) const { return value() < other.value(); }
bool operator <(coord other) const { return value() > other.value(); }