Dear Bob

So far with the code I worked out I can correctly see my atom within Jmol. What 
I miss are cell parameters on the top -left corner and the cell as well! Should 
I call another function somewhere which print them? 
Further CRYSTAL use treat SLAB and POLYMER as 2 dimensional and one dimensional 
system which means having the Z (for slab) and Y and Z (for polymer) expresses 
as Cartesian  coordinates since the periodicity is reduced! Does Jmol has 
already implemented this kind of  situation  should I work out a way to tackle 
it ? 

Crystal can also calculate vibrational frequency in Gamma as Gaussian03/09! Do 
you have some int as to let Jmol read them? 

Thanks a lot and have a Good Weekend, Piero



public class CrystalReader extends AtomSetCollectionReader{
  
 float a;
 float b;
 float c; 
 float alpha;
 float beta ;
 float gamma;
 
  
  
  public void readAtomSetCollection(BufferedReader reader) {
   
    atomSetCollection = new AtomSetCollection("Crystal0X_output", this);
    try{
      this.reader = reader;
      atomSetCollection.setCollectionName(readLine());
     readSystem();
   
    }catch (Exception e) {
      setError(e);
    }
  }   
 private void readSystem() throws Exception{
   do{
     readLine();
     if(line.startsWith("MOLECULE")){
     setFractionalCoordinates(false);
     readAtomCoords();
     break;
     }
     if (line.startsWith("CRYSTAL")|| line.startsWith("SLAB")||
     line.startsWith("POLYMER") || line.startsWith("EXTERNAL") ){
    
       setFractionalCoordinates(true);
       
      readCellParams();
      readAtomCoords();
       break;
     }
     }while(line != null);
 
 }
 

 private void readCellParams()  throws Exception{
   
  do{
     readLine();
     
     if(line.startsWith(" PRIMITIVE CELL")){
       readLine();
       readLine();
       a = parseFloat(line.substring(2,17)) ;
       b = parseFloat(line.substring(18,33)) ;
       c = parseFloat(line.substring(34,42)) ;
       alpha =  parseFloat(line.substring(43,60)) ;
       beta =  parseFloat(line.substring(61,71)) ;
       gamma =  parseFloat(line.substring(72,80)) ;
      //this method works fine so far 
       setFractionalCoordinates(true);  
       setUnitCell(a, b, c, alpha, beta, gamma);
      
      break;
     } 
   }while (line != null);
  }
 
 private void readAtomCoords() throws Exception{
   setFractionalCoordinates(true);
   do{
     readLine();
     if(line.startsWith(" ATOMS IN THE ASYMMETRIC")){
       int numberAtoms = parseInt(line.substring(61,65));
       
       readLine();
       readLine();
       
       int j=0;
      for(int i=0; i<numberAtoms ; i++){
        readLine();
        addNewatom();
        String atomName = line.substring(8,11);
        String sym =atomName.substring(0,2).trim();
        
      int atomicnumber = parseInt(sym);
      Atom atom = atomSetCollection.getAtom(i);
      sym =getElementSymbol(atomicnumber);
      atom.elementSymbol=sym ;
      atom.atomName= atomName + "_" + (j++);
      
      }
       break;
       }
   }while (line != null);
 }
 private void addNewatom(){
   float x = parseFloat(line.substring(15,35));
   float y = parseFloat(line.substring(36,55));
   float z = parseFloat(line.substring(56,75));
   Atom atom=atomSetCollection.addNewAtom();
   setAtomCoord(atom, x, y,z);
   
 }

}



-- 
Pieremanuele Canepa
Room 104
Functional Material Group
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom

e-mail: pc...@kent.ac.uk
mobile: +44 (0) 7772-9756456
-----------------------------------------------------------
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to