/** remove all atoms * */ @Override public void clearAtoms() { atoms.clear(); setPDBFlag(false); if ( atomNameLookup != null) atomNameLookup.clear(); }
/** * {@inheritDoc} */ @Override public void addAtom(Atom atom){ atom.setGroup(this); atoms.add(atom); // TODO this check is useless, coords are always !=null since they are initialized to 0,0,0 in AtomImpl constructor. We need to review this - JD 2016-09-14 if (atom.getCoordsAsPoint3d() != null){ // we have got coordinates! setPDBFlag(true); } if (atomNameLookup != null){ Atom existingAtom = atomNameLookup.put(atom.getName(), atom); // if an atom with same name is added to the group that has to be some kind of problem, // we need to warn properly if (existingAtom != null) { String altLocStr = ""; char altLoc = atom.getAltLoc(); if (altLoc != ' ') altLocStr = "(alt loc '" + altLoc + "')"; logger.warn("An atom with name " + atom.getName() + " " + altLocStr + " is already present in group: " + this.toString() + ". The atom with serial " + atom.getPDBserial() + " will be ignored in look-ups."); } } };
/** returns and identical copy of this Group object . * @return and identical copy of this Group object */ @Override public Object clone() { HetatomImpl n = new HetatomImpl(); n.setPDBFlag(has3D()); n.setResidueNumber(residueNumber); n.setPDBName(getPDBName()); //clone atoms and bonds. cloneAtomsAndBonds(n); // copying the alt loc groups if present, otherwise they stay null if (altLocs!=null) { for (Group altLocGroup:this.altLocs) { Group nAltLocGroup = (Group)altLocGroup.clone(); n.addAltLoc(nAltLocGroup); } } if (chemComp!=null) n.setChemComp(chemComp); return n; }