ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/mdtools/interface_implementation/SimSetup.cpp
(Generate patch)

Comparing trunk/mdtools/interface_implementation/SimSetup.cpp (file contents):
Revision 195 by chuckv, Thu Dec 5 18:53:40 2002 UTC vs.
Revision 198 by mmeineke, Fri Dec 6 21:20:42 2002 UTC

# Line 161 | Line 161 | void SimSetup::createSim( void ){
161   #endif // is_mpi
162  
163    // make an array of molecule stamps that match the components used.
164 +  // also extract the used stamps out into a separate linked list
165  
166 +  simnfo->nComponents = n_components;
167 +  simnfo->componentsNmol = components_nmol;
168 +  simnfo->compStamps = comp_stamps;
169 +  simnfo->headStamp = new LinkedMolStamp();
170 +  
171 +  char* id;
172 +  LinkedMolStamp* headStamp = simnfo->headStamp;
173 +  LinkedMolStamp* currentStamp = NULL;
174    for( i=0; i<n_components; i++ ){
175  
176 <    comp_stamps[i] =
177 <      the_stamps->getMolecule( the_components[i]->getType() );
176 >    id = the_components[i]->getType();
177 >    comp_stamps[i] = NULL;
178 >    
179 >    // check to make sure the component isn't already in the list
180 >
181 >    comp_stamps[i] = headStamp->match( id );
182 >    if( comp_stamps[i] == NULL ){
183 >      
184 >      // extract the component from the list;
185 >      
186 >      currentStamp = the_stamps->extractMolStamp( id );
187 >      if( currentStamp == NULL ){
188 >        sprintf( painCave.errMsg,
189 >                 "SimSetup error: Component \"%s\" was not found in the "
190 >                 "list of declared molecules\n"
191 >                 id );
192 >        painCave.isFatal = 1;
193 >        simError();
194 >      }
195 >      
196 >      headStamp->add( currentStamp );
197 >      comp_stamps[i] = headStamp->match( id );
198 >    }
199    }
200  
201 + #ifdef IS_MPI
202 +  strcpy( checkPointMsg, "Component stamps successfully extracted\n" );
203 +  MPIcheckPoint();
204 + #endif // is_mpi
205 +  
206  
207  
208 +
209    // caclulate the number of atoms, bonds, bends and torsions
210  
211    tot_atoms = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines