HI Bob,
I got to work the Resolver class! now following your info I am working on my
CrystalReader.java. I have still two questions:
1) when I want to read cell parameter a b c ... from formatted output, like
that you see below, could something like this work ?
do{
readLine();
if(line.startsWith("PRIMITIVE CELL")){
readLine();
readLine();
readLine();
a = parseFloat(line.substring(0,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,82)) ;
setUnitCell(a, b, c, alpha, beta, gamma);
break;
}
}while (line == null);
2) is the method setAtomCoord(atom, x, y, z); which input atom by atom? Jmol
likes atomic numbers or atomic Symbols?
Thanks, Piero
PRIMITIVE CELL - CENTRING CODE 7/0 VOLUME= 101.072440 - DENSITY 5.253 g/cm^3
A B C ALPHA BETA GAMMA
5.44533688 5.44533688 5.44533688 55.067417 55.067417 55.067417
*******************************************************************************
ATOMS IN THE ASYMMETRIC UNIT 6 - ATOMS IN THE UNIT CELL: 10
ATOM X/A Y/B Z/C
*******************************************************************************
1 T 26 FE 3.568442544033E-01 3.568442544034E-01 3.568442544034E-01
2 T 26 FE1 -1.430195921397E-01 -1.430195921402E-01 -1.430195921402E-01
3 T 26 FE1 1.430507305437E-01 1.430507305442E-01 1.430507305442E-01
4 T 26 FE -3.568128970553E-01 -3.568128970554E-01 -3.568128970554E-01
5 T 8 O -4.432426672372E-01 -5.675473583976E-02 2.500171301010E-01
6 F 8 O 2.500171301009E-01 -4.432426672377E-01 -5.675473583908E-02
7 F 8 O -5.675473583905E-02 2.500171301013E-01 -4.432426672381E-01
8 T 8 O 4.431926399190E-01 5.670362957970E-02 -2.499784922748E-01
9 F 8 O -2.499784922746E-01 4.431926399195E-01 5.670362957903E-02
10 F 8 O 5.670362957900E-02 -2.499784922750E-01 4.431926399200E-01
--
Pieremanuele Canepa
Room 104
Functional Material Group
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom
e-mail: [email protected]
mobile: +44 (0) 7772-9756456
-----------------------------------------------------------
________________________________________
From: Robert Hanson [[email protected]]
Sent: Thursday, February 11, 2010 12:57 PM
To: [email protected]
Subject: Re: [Jmol-developers] Extend Jmol to crystal files
On Thu, Feb 11, 2010 at 5:56 AM, P.Canepa
<[email protected]<mailto:[email protected]>> wrote:
Hi Rob,
I am sorry for wasting again your time ,
I have been trying for while if my new part of the Resolver class works !
I added this code which should look though the file and find at a certain
point these text lines within brackets. If these are found it should print
out at least the message below, which I cannot see so far !
The code is fine. I think it is working properly. If these are found, it should
NOT print out the message because it will return TRUE. Are you saying with this
code that ANY ONE of these must be present within the first 16 lines? Isn't
there one thing that HAS to be there? Please check on the file specifications
and see if there is one unique phrase rather than all these checks. I wouldn't
know, but you would.
Apperently there is some error! Is the variable lines meant as an array of
Strings where each element of the array corresponds to precise line in my text
file ?
Furthermore
Thank you ,Piero
private static boolean checkCrystal(String[] lines){
for (int i = 0; i < lines.length; i++ ){
if(lines[i].startsWith(" MOLECULAR CALCULATION ")) return true;
if(lines[i].startsWith(" POLYMER CALCULATION ")) return true;
if(lines[i].startsWith(" SLAB CALCULATION ")) return true;
if(lines[i].startsWith(" CRYSTAL CALCULATION ")) return true;
if(lines[i].startsWith(" LOCAL ATOMIC FUNCTIONS BASIS SET ")) return true;
System.out.println("This is a crystal file");
}
return false;
}
--
Pieremanuele Canepa
Room 104
Functional Material Group
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom
e-mail: [email protected]<mailto:[email protected]>
mobile: +44 (0) 7772-9756456
-----------------------------------------------------------
________________________________________
From: Robert Hanson [[email protected]<mailto:[email protected]>]
Sent: Wednesday, February 10, 2010 6:29 PM
To:
[email protected]<mailto:[email protected]>
Subject: Re: [Jmol-developers] Extend Jmol to crystal files
On Wed, Feb 10, 2010 at 7:10 AM, P.Canepa
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
wrote:
Dear Bob,
3) ATOMS IN THE ASYMMETRIC UNIT that starts the atomic coordinates section
As you seethe numbers of lattice parameters and atomic coordinates are found
two lines below.
In addition the values of the lattice parameters and x y z per each atoms are
on the same line, how can I tackle this problem reading line by line (as you
did in Wien2kReader.java) ?
All the readers are subclasses of smarter.AtomCollectionReader. At the end of
that class code you will see a whole set of public functions you can tap into.
In particular there is a global field "line" that is read with
readLine();
When you are reading a mix of text and numbers from a line, first consider
whether there is guaranteed white space between them. Not all programs do that.
If that is the case, then
String[] tokens = getTokens(); // from the NEXT line
or
String[] tokens = getTokens(line); // from the CURRENT line
would be my choice. Then I do something like:
atom.set(parseFloat(tokens[0]), parseFloat(tokens[1]), parseFloat(tokens[2]));
for example.
Or, if you know it is column based, you can just use:
readLine();
atom.set(parseFloat(line.substring(10,20)), parseFloat.....)
Something like that.
Don't worry so much about getting this perfect. I'll edit it down to the
simplest way to read the file. Just get it reading the file successfully any
way you want.
Bob
Can you help me?
Furthermore does jmol need the direct lattice vector to define the cell?
Thank you
--
Pieremanuele Canepa
Room 104
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom
-----------------------------------------------------------
________________________________________
From: Robert Hanson
[[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>]
Sent: Tuesday, February 09, 2010 2:27 PM
To:
[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
Subject: Re: [Jmol-developers] Extend Jmol to crystal files
That would be great. Please:
1) Check out the Jmol code using SVN/Eclipse.
2) Create your reader. Please add this to org.jmol.adapter.readers.xtal (unless
it is XML, then use ....xml). Take a look at
org.jmol.adapter.smarter.AtomSetCollectionReader.java to get a sense of what is
going to happen in the reader.
I can help if you get stuck. This mostly involves:
(a) adding a bit of code to org.jmol.adapter.smarter.Resolver.java
(b) copying one of the other readers as a template as CrystalReader.java
(c) modifying the template as needed
3) Create a working patch and send it to us. This should be just two files --
Resolver.java and CrystalReader.java
4) I will check over your code, make sure it doesn't conflict with other
readers, make sure it properly accounts for various options, and probably edit
it a bit to be consistent with our styling. Then I will add it to Jmol 11.9.x
Bob
On Tue, Feb 9, 2010 at 5:19 AM, P.Canepa
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>>
wrote:
I am physic PhD student and I am willing to contribute to the development of
Jmol.
Reading trough Jmol web-page I realized that it is already capable to save
file for other famous period code such as: CASTEP, WIEN2k, VASP, etc... I would
like to extend it to CRYSTAL09, the periodic code developed at the University
of Turin, Italy
(http:\\www.crystal.unito.it<http://www.crystal.unito.it><http://www.crystal.unito.it><http://www.crystal.unito.it>).
I have a bit of experience with java (especially java swing) and I use daily
CRYSTAL . Can you give me some hint as to start developing class to deal with
crystal files?
Many Thanks, Piero
--
Pieremanuele Canepa
Room 104
School of Physical Sciences, Ingram Building,
University of Kent, Canterbury, Kent,
CT2 7NH
United Kingdom
-----------------------------------------------------------
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Jmol-developers mailing list
[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>><mailto:[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
https://lists.sourceforge.net/lists/listinfo/jmol-developers
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
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
[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>
https://lists.sourceforge.net/lists/listinfo/jmol-developers
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
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
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/jmol-developers
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers