void initializeModel(JmolAdapter adapter, Object clientFile) {
		modelCount = (adapter == null ? 1 : adapter.getAtomSetCount(clientFile));
		mmset.setModelCount(modelCount);

		currentModelIndex = -1;
		if (adapter == null) {
			mmset.setModelNameNumberProperties(0, "", 1, null, null, false);
		}
		else {
			if (modelCount > 0) {
				nullChain = new Chain(this, mmset.getModel(0), ' ');
				nullGroup = new Group(nullChain, "", 0, -1, -1);
			}

			group3Lists = new String[modelCount + 1];
			group3Counts = new int[modelCount + 1][];
			for (int i = 0; i < modelCount; ++i) {
				int modelNumber = adapter.getAtomSetNumber(clientFile, i);
				String modelName = adapter.getAtomSetName(clientFile, i);
				if (modelName == null)
					modelName = "" + modelNumber;
				Properties modelProperties = adapter.getAtomSetProperties(clientFile, i);
				Hashtable modelAuxiliaryInfo = adapter.getAtomSetAuxiliaryInfo(clientFile, i);
				boolean isPDBModel = mmset.setModelNameNumberProperties(i, modelName, modelNumber, modelProperties,
						modelAuxiliaryInfo, isPDB);
				if (isPDBModel) {
					group3Lists[i] = JmolConstants.group3List;
					group3Counts[i] = new int[JmolConstants.group3Count + 10];
					if (group3Lists[modelCount] == null) {
						group3Lists[modelCount] = JmolConstants.group3List;
						group3Counts[modelCount] = new int[JmolConstants.group3Count + 10];
					}
				}
			}

			// atom is created, but not all methods are safe, because it
			// has no group -- this is only an issue for debugging

			short mad = viewer.getMadAtom();
			for (JmolAdapter.AtomIterator iterAtom = adapter.getAtomIterator(clientFile); iterAtom.hasNext();) {
				short elementNumber = (short) iterAtom.getElementNumber();
				if (elementNumber <= 0)
					elementNumber = JmolConstants.elementNumberFromSymbol(iterAtom.getElementSymbol());
				char alternateLocation = iterAtom.getAlternateLocationID();
				addAtom(iterAtom.getAtomSetIndex(), iterAtom.getAtomSymmetry(), iterAtom.getAtomSite(), iterAtom
						.getUniqueID(), elementNumber, iterAtom.getAtomName(), mad, iterAtom.getFormalCharge(),
						iterAtom.getPartialCharge(), iterAtom.getOccupancy(), iterAtom.getBfactor(), iterAtom.getX(),
						iterAtom.getY(), iterAtom.getZ(), iterAtom.getIsHetero(), iterAtom.getAtomSerial(), iterAtom
								.getChainID(), iterAtom.getGroup3(), iterAtom.getSequenceNumber(), iterAtom
								.getInsertionCode(), iterAtom.getVectorX(), iterAtom.getVectorY(), iterAtom
								.getVectorZ(), alternateLocation, iterAtom.getClientAtomReference());
			}

			JmolAdapter.BondIterator iterBond = adapter.getBondIterator(clientFile);
			if (iterBond != null)
				while (iterBond.hasNext()) {
					bondAtoms(iterBond.getAtomUniqueID1(), iterBond.getAtomUniqueID2(), (short) iterBond
							.getEncodedOrder());
				}
			JmolAdapter.StructureIterator iterStructure = adapter.getStructureIterator(clientFile);
			if (iterStructure != null)
				while (iterStructure.hasNext()) {
					if (!iterStructure.getStructureType().equals("turn"))
						defineStructure(iterStructure.getModelIndex(), iterStructure.getStructureType(), iterStructure
								.getStartChainID(), iterStructure.getStartSequenceNumber(), iterStructure
								.getStartInsertionCode(), iterStructure.getEndChainID(), iterStructure
								.getEndSequenceNumber(), iterStructure.getEndInsertionCode());
				}

			// define turns LAST. (pulled by the iterator first)
			// so that if they overlap they get overwritten:

			iterStructure = adapter.getStructureIterator(clientFile);
			if (iterStructure != null)
				while (iterStructure.hasNext()) {
					if (iterStructure.getStructureType().equals("turn"))
						defineStructure(iterStructure.getModelIndex(), iterStructure.getStructureType(), iterStructure
								.getStartChainID(), iterStructure.getStartSequenceNumber(), iterStructure
								.getStartInsertionCode(), iterStructure.getEndChainID(), iterStructure
								.getEndSequenceNumber(), iterStructure.getEndInsertionCode());
				}
		}

		/***************************************************************************************************************
		 * crystal cell must come first, in case atom coordinates need to be transformed to fit in the crystal cell
		 **************************************************************************************************************/

		loadShape(JmolConstants.SHAPE_BALLS);
		loadShape(JmolConstants.SHAPE_STICKS);
		loadShape(JmolConstants.SHAPE_HSTICKS);
		loadShape(JmolConstants.SHAPE_MEASURES);
		loadShape(JmolConstants.SHAPE_UCCAGE);

		if (adapter != null) {
			doUnitcellStuff();
			doAutobond();
		}
		finalizeGroupBuild(); // set group offsets and build monomers
		// only now can we access all of the atom's properties
		saveGroup3Info();
		buildPolymers();
		freeze();
		finalizeBuild();
		calcAverageAtomPoint();
		calcBoundBoxDimensions();
	}