git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1084 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -8,10 +8,7 @@ make # may need to edit Makefile for your system
|
||||
|
||||
This will place the asphere_vis executable in the bin directory.
|
||||
|
||||
Documentation is in the doc directory. Note that the doc file says
|
||||
the ellipsoid axes are specified by an "Ellipsoid" section in the data
|
||||
file. In the current version of LAMPS, this is now a "Shapes"
|
||||
section.
|
||||
Documentation is in the doc directory.
|
||||
|
||||
See instructions on how to run an example ellipsoid viz in the
|
||||
examples dir.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
.if !'\*(.T'ps' .if !'\*(.T'html' .tm warning: eqn should have been given a `-T\*(.T' option
|
||||
.if '\*(.T'html' .if !'ps'ps' .tm warning: eqn should have been given a `-Tps' option
|
||||
.if '\*(.T'html' .if !'ps'ps' .tm warning: (it is advisable to invoke groff via: groff -Thtml -e)
|
||||
.lf 1 /usr/share/groff/1.18.1/tmac/eqnrc
|
||||
.lf 1 /usr/share/groff/1.18.1.1/tmac/eqnrc
|
||||
.\" Startup file for eqn.
|
||||
.EQ
|
||||
.nr 0C \n(.C
|
||||
@ -11,36 +11,79 @@
|
||||
.lf 63
|
||||
.EN
|
||||
.lf 1 asphere_vis.manpage
|
||||
.TH asphere_vis 1 "June 22, 2007" "asphere_vis (Graphics Utilities) 0.1" "Graphics Utilities"
|
||||
.TH asphere_vis 1 "October 22, 2007" "asphere_vis (Graphics Utilities) 0.2" "Graphics Utilities"
|
||||
.SH NAME
|
||||
\fBasphere_vis\fR - Tools for ellipsoid visualization in PyMol of a LAMMPS trajectory.
|
||||
.PD 2
|
||||
.SH VERSION
|
||||
.PD 1
|
||||
Version 0.1
|
||||
Version 0.2
|
||||
.PD 2
|
||||
.SH SYNOPSIS
|
||||
.PD 1
|
||||
.TP
|
||||
\fBasphere_vis\fR input_file dump_file output_py_file [\fB-b\fR] [\fB-c\fR \fIcolor_file\fR] [\fB-d\fR] [\fB-f\fR \fImax_frame\fR] [\fB-h\fR] [\fB-i\fR \fIstart_frame\fR \fIskip\fR \fIend_frame\fR] [\fB-n\fR \fInotice_level\fR] [\fB-r\fR \fIellip_res\fR] [\fB-s\fR]
|
||||
\fBasphere_vis\fR flavor_file dump_file output_py_file [\fB-b\fR] [\fB-f\fR \fImax_frame\fR] [\fB-h\fR] [\fB-i\fR \fIstart_frame\fR \fIskip\fR \fIend_frame\fR] [\fB-n\fR \fInotice_level\fR] [\fB-o\fR] [\fB-r\fR \fIellip_res\fR] [\fB-s\fR]
|
||||
.br
|
||||
.PD 2
|
||||
.SH DESCRIPTION
|
||||
.PD 1
|
||||
Tool for ellipsoid visualization in PyMol of a LAMMPS trajectory. The \fIinput_file\fR is a LAMMPS data file with a 'Shapes' section or a LAMMPS input script file with ellipsoid diameters specified using the 'shape' command. The trajectory is input from \fIdump_file\fR that must be generated using a LAMMPS dump_style custom command with the following arguments in order:
|
||||
Tool for converting LAMMPS trajectories into compiled graphics objects for visualization in PyMol. The \fIflavor_file\fR is an input file that describes the color, transparency, and size/shape of each atom type. The \fIflavor_file\fR consists of two possible line formats. For spherical particles, the format is:
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.TP
|
||||
.PP
|
||||
.PD 1
|
||||
\fItag type x y z quatw quati quatj quatk\fR
|
||||
\fIatom_type color alpha diameter\fR
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
where alpha is used to adjust the transparency of the particle. For ellipsoidal particles, the format is:
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
\fIatom_type color alpha diameter_x diameter_y diameter_z\fR
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
Ellipsoidal and spherical line formats can be mixed in the same \fIflavor_file\fR For any atom type not listed in the \fIflavor_file\fR a blue sphere of size 1 is assumed.
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
The \fIdump_file\fR is a LAMMPS trajectory. For atom types specified as spherical in the \fIflavor_file\fR, the \fIdump_file\fR must contain \fItag type x y z\fR as the first columns. For atom types specified as ellipsoidal in the \fIflavor_file\fR, the columns are \fItag type x y z quatw quati quatj quatk\fR.The latter can be gerenated, for example, with the LAMMPS dump_style custom command with the following arguments in order:
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
\fItag type x y z quatw quati quatj quatk\fR
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
The output file is a python file for input to Pymol. This can be viewed from the command line using \fIpymol output.py\fR or by using the \fIrun\fR command from within Pymol.
|
||||
.PD 2
|
||||
.SH PARAMETERS
|
||||
.PD 1
|
||||
@ -48,16 +91,6 @@ Tool for ellipsoid visualization in PyMol of a LAMMPS trajectory. The \fIinput_f
|
||||
\fB-b\fR
|
||||
When used with \fB-s\fR, the option will number the filenames based on the frame number. By default, they are numbered consequtively from zero.
|
||||
.TP
|
||||
\fB-c\fR \fIcolor_file\fR
|
||||
.PD 0
|
||||
.TP
|
||||
.PP
|
||||
.PD 1
|
||||
Color the atom_types and set transparency based on the color file. The color file contains a space delimited set sequence of the color for an atom followed by the alpha. The color should be the string name and the alpha should be between 0 and 1.
|
||||
.TP
|
||||
\fB-d\fR
|
||||
Use a LAMMPS input script rather than a data file for extracting atom shape information. The input script is specified as \fIinput_file\fR.
|
||||
.TP
|
||||
\fB-f\fR \fImax_frame\fR
|
||||
.PD 0
|
||||
.TP
|
||||
@ -102,6 +135,9 @@ Set the degree of program output. Use:
|
||||
.PD 1
|
||||
\fB-n\fR 30 All output
|
||||
.TP
|
||||
\fB-o\fR
|
||||
Do not output the outline for the simulation box.
|
||||
.TP
|
||||
\fB-r\fR \fIellip_res\fR
|
||||
.PD 0
|
||||
.TP
|
||||
@ -199,10 +235,6 @@ Output the results into separate .py files. The filename and extension for the o
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 2
|
||||
.SH KNOWN BUGS
|
||||
.PD 1
|
||||
Comments are not allowed at any point between a section header and the end of the contents for a section in either the data file or the input file.
|
||||
.PD 2
|
||||
.SH AUTHORS
|
||||
.PD 1
|
||||
|
||||
@ -1,33 +1,76 @@
|
||||
.TH asphere_vis 1 "June 22, 2007" "asphere_vis (Graphics Utilities) 0.1" "Graphics Utilities"
|
||||
.TH asphere_vis 1 "October 22, 2007" "asphere_vis (Graphics Utilities) 0.2" "Graphics Utilities"
|
||||
.SH NAME
|
||||
\fBasphere_vis\fR - Tools for ellipsoid visualization in PyMol of a LAMMPS trajectory.
|
||||
.PD 2
|
||||
.SH VERSION
|
||||
.PD 1
|
||||
Version 0.1
|
||||
Version 0.2
|
||||
.PD 2
|
||||
.SH SYNOPSIS
|
||||
.PD 1
|
||||
.TP
|
||||
\fBasphere_vis\fR input_file dump_file output_py_file [\fB-b\fR] [\fB-c\fR \fIcolor_file\fR] [\fB-d\fR] [\fB-f\fR \fImax_frame\fR] [\fB-h\fR] [\fB-i\fR \fIstart_frame\fR \fIskip\fR \fIend_frame\fR] [\fB-n\fR \fInotice_level\fR] [\fB-r\fR \fIellip_res\fR] [\fB-s\fR]
|
||||
\fBasphere_vis\fR flavor_file dump_file output_py_file [\fB-b\fR] [\fB-f\fR \fImax_frame\fR] [\fB-h\fR] [\fB-i\fR \fIstart_frame\fR \fIskip\fR \fIend_frame\fR] [\fB-n\fR \fInotice_level\fR] [\fB-o\fR] [\fB-r\fR \fIellip_res\fR] [\fB-s\fR]
|
||||
.br
|
||||
.PD 2
|
||||
.SH DESCRIPTION
|
||||
.PD 1
|
||||
Tool for ellipsoid visualization in PyMol of a LAMMPS trajectory. The \fIinput_file\fR is a LAMMPS data file with a 'Shapes' section or a LAMMPS input script file with ellipsoid diameters specified using the 'shape' command. The trajectory is input from \fIdump_file\fR that must be generated using a LAMMPS dump_style custom command with the following arguments in order:
|
||||
Tool for converting LAMMPS trajectories into compiled graphics objects for visualization in PyMol. The \fIflavor_file\fR is an input file that describes the color, transparency, and size/shape of each atom type. The \fIflavor_file\fR consists of two possible line formats. For spherical particles, the format is:
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.TP
|
||||
.PP
|
||||
.PD 1
|
||||
\fItag type x y z quatw quati quatj quatk\fR
|
||||
\fIatom_type color alpha diameter\fR
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
where alpha is used to adjust the transparency of the particle. For ellipsoidal particles, the format is:
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
\fIatom_type color alpha diameter_x diameter_y diameter_z\fR
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
Ellipsoidal and spherical line formats can be mixed in the same \fIflavor_file\fR For any atom type not listed in the \fIflavor_file\fR a blue sphere of size 1 is assumed.
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
The \fIdump_file\fR is a LAMMPS trajectory. For atom types specified as spherical in the \fIflavor_file\fR, the \fIdump_file\fR must contain \fItag type x y z\fR as the first columns. For atom types specified as ellipsoidal in the \fIflavor_file\fR, the columns are \fItag type x y z quatw quati quatj quatk\fR.The latter can be gerenated, for example, with the LAMMPS dump_style custom command with the following arguments in order:
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
\fItag type x y z quatw quati quatj quatk\fR
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 0
|
||||
.PP
|
||||
.PD 1
|
||||
The output file is a python file for input to Pymol. This can be viewed from the command line using \fIpymol output.py\fR or by using the \fIrun\fR command from within Pymol.
|
||||
.PD 2
|
||||
.SH PARAMETERS
|
||||
.PD 1
|
||||
@ -35,16 +78,6 @@ Tool for ellipsoid visualization in PyMol of a LAMMPS trajectory. The \fIinput_f
|
||||
\fB-b\fR
|
||||
When used with \fB-s\fR, the option will number the filenames based on the frame number. By default, they are numbered consequtively from zero.
|
||||
.TP
|
||||
\fB-c\fR \fIcolor_file\fR
|
||||
.PD 0
|
||||
.TP
|
||||
.PP
|
||||
.PD 1
|
||||
Color the atom_types and set transparency based on the color file. The color file contains a space delimited set sequence of the color for an atom followed by the alpha. The color should be the string name and the alpha should be between 0 and 1.
|
||||
.TP
|
||||
\fB-d\fR
|
||||
Use a LAMMPS input script rather than a data file for extracting atom shape information. The input script is specified as \fIinput_file\fR.
|
||||
.TP
|
||||
\fB-f\fR \fImax_frame\fR
|
||||
.PD 0
|
||||
.TP
|
||||
@ -89,6 +122,9 @@ Set the degree of program output. Use:
|
||||
.PD 1
|
||||
\fB-n\fR 30 All output
|
||||
.TP
|
||||
\fB-o\fR
|
||||
Do not output the outline for the simulation box.
|
||||
.TP
|
||||
\fB-r\fR \fIellip_res\fR
|
||||
.PD 0
|
||||
.TP
|
||||
@ -186,10 +222,6 @@ Output the results into separate .py files. The filename and extension for the o
|
||||
.PP
|
||||
.PD 1
|
||||
|
||||
.PD 2
|
||||
.SH KNOWN BUGS
|
||||
.PD 1
|
||||
Comments are not allowed at any point between a section header and the end of the contents for a section in either the data file or the input file.
|
||||
.PD 2
|
||||
.SH AUTHORS
|
||||
.PD 1
|
||||
|
||||
Binary file not shown.
@ -4,13 +4,13 @@ from a LAMMPS run.
|
||||
In examples/ellipse, you can run LAMMPS with in.ellipse
|
||||
to generate dump.ellipse
|
||||
|
||||
Copy in.ellipse and dump.ellipse to this dir.
|
||||
Copy dump.ellipse to this dir.
|
||||
|
||||
Run the tool to create a PyMol input file called ellipse.py by typing:
|
||||
|
||||
../bin/asphere_vis in.ellipse dump.ellipse ellipse.py -c colors.ellipse -d
|
||||
../bin/asphere_vis colors.ellipse dump.ellipse ellipse.py -r 4 -o
|
||||
|
||||
Launch PyMol on this input and you should see a nice viz of
|
||||
4 ellipsoids in a box of LJ particles:
|
||||
Launch PyMol on this input and you should see a viz of
|
||||
ellipsoids in a box of LJ particles:
|
||||
|
||||
pymol ellipse.py
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
marine 0.3
|
||||
red 1.0
|
||||
1 marine 0.7 1
|
||||
2 red 1.0 3 1 1
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
asphere_vis.cpp
|
||||
-------------------
|
||||
|
||||
Convert a Lammps ellipsoid trajectory to a Pymol CGO trajectory
|
||||
Convert a Lammps trajectory to a Pymol CGO trajectory
|
||||
|
||||
__________________________________________________________________________
|
||||
This file is part of the Graphics Utilities package for command-line
|
||||
@ -51,123 +51,62 @@ int main(int argc, char *argv[]) {
|
||||
end_frame=cl.argint('i',2);
|
||||
}
|
||||
|
||||
// ----------------- Get the atom type info from a data file
|
||||
unsigned atom_types=0;
|
||||
// ----------------- Assign default atom type info
|
||||
unsigned max_atom_types=1000;
|
||||
vector<cPt> shapes;
|
||||
ifstream in;
|
||||
if (!cl['d']) {
|
||||
a::fileopen(in,cl.argstring(' ',0),error);
|
||||
while (!in.eof()) {
|
||||
char iline[500];
|
||||
in.getline(iline,500);
|
||||
vector<string> tokens;
|
||||
a::get_tokens(iline,tokens);
|
||||
if (tokens.size()>2)
|
||||
if (tokens[1]=="atom" && tokens[2]=="types") {
|
||||
atom_types=atoi(tokens[0].c_str());
|
||||
break;
|
||||
}
|
||||
if (!in)
|
||||
break;
|
||||
}
|
||||
if (atom_types==0)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Could not find number of atom types in data file.");
|
||||
// ----------------- Get the atom type shapes
|
||||
if (parse_to("Shapes",in))
|
||||
for (unsigned i=0; i<atom_types; i++) {
|
||||
double tempd;
|
||||
cPt shape;
|
||||
in >> tempd >> shape;
|
||||
shape.x *= 0.5;
|
||||
shape.y *= 0.5;
|
||||
shape.z *= 0.5;
|
||||
if (in.eof() || !in)
|
||||
break;
|
||||
shapes.push_back(shape);
|
||||
char iline[500];
|
||||
in.getline(iline,500);
|
||||
}
|
||||
if (shapes.size()!=atom_types) {
|
||||
error.buffer() << "Error reading shapes from Pair Coeffs section of "
|
||||
<< "data file. Read " << shapes.size() << " valid shapes, "
|
||||
<< "but expected " << atom_types;
|
||||
error.addbuf(0,"asphere_vis");
|
||||
}
|
||||
a::fileclose(in,error);
|
||||
} else {
|
||||
// ----------------- Get the atom type info from a input file
|
||||
a::fileopen(in,cl.argstring(' ',0),error);
|
||||
while (!in.eof()) {
|
||||
string token;
|
||||
in >> token;
|
||||
if (token=="create_box") {
|
||||
in >> atom_types;
|
||||
shapes.assign(atom_types,cPt(0.5,0.5,0.5));
|
||||
} else if (token=="shape") {
|
||||
unsigned type;
|
||||
cPt shape;
|
||||
in >> type >> shape;
|
||||
shape.x *= 0.5;
|
||||
shape.y *= 0.5;
|
||||
shape.z *= 0.5;
|
||||
if (type>atom_types) {
|
||||
error.buffer() << "Error reading shapes from LAMMPS input file. "
|
||||
<< "I thought there were " << atom_types
|
||||
<< " atom types. But found an shape command for "
|
||||
<< "atom type: " << type;
|
||||
error.addbuf(0,"asphere_vis");
|
||||
}
|
||||
shapes[type-1]=shape;
|
||||
} else {
|
||||
char iline[500];
|
||||
in.getline(iline,500);
|
||||
}
|
||||
|
||||
if (!in && !in.eof())
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Error reading from LAMMPS input file");
|
||||
}
|
||||
a::fileclose(in,error);
|
||||
}
|
||||
if (atom_types==0)
|
||||
error.generate_error(0,"asphere_vis","Found 0 atom types!");
|
||||
|
||||
// ----------------- Get the colors and alpha values for atom types
|
||||
vector<colorPt> color_list;
|
||||
vector<double> alpha_list;
|
||||
if (cl['c']) {
|
||||
a::fileopen(in,cl.argstring('c',0),error);
|
||||
for (unsigned i=0; i<atom_types; i++) {
|
||||
double alpha;
|
||||
string color;
|
||||
in >> color >> alpha;
|
||||
if (in.eof() || !in)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Improperly formatted color file.");
|
||||
color_list.push_back(colors[color]);
|
||||
alpha_list.push_back(alpha);
|
||||
vector<bool> spherical;
|
||||
shapes.assign(max_atom_types,cPt(0.5,0.5,0.5));
|
||||
color_list.assign(max_atom_types,colors["blue"]);
|
||||
alpha_list.assign(max_atom_types,1.0);
|
||||
spherical.assign(max_atom_types,true);
|
||||
|
||||
// ----------------- Get the atom type info from a flavor file
|
||||
unsigned atom_type;
|
||||
cPt shape;
|
||||
string color;
|
||||
double alpha,diameter_x,diameter_y,diameter_z;
|
||||
unsigned num_types=0;
|
||||
char iline[5000];
|
||||
|
||||
ifstream in;
|
||||
a::fileopen(in,cl.argstring(' ',0),error);
|
||||
while (!in.eof()) {
|
||||
in.getline(iline,500);
|
||||
if (!in || in.eof())
|
||||
break;
|
||||
istringstream line_in(iline);
|
||||
line_in >> atom_type;
|
||||
if (!line_in || line_in.eof())
|
||||
break;
|
||||
if (atom_type>max_atom_types)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"asphere_vis will not handle atom types greater than "+
|
||||
a::itoa(max_atom_types));
|
||||
line_in >> color >> alpha >> diameter_x;
|
||||
num_types++;
|
||||
if (!line_in)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Improperly formatted flavor_file at line:\n "+
|
||||
string(iline));
|
||||
color_list[atom_type]=colors[color];
|
||||
alpha_list[atom_type]=alpha;
|
||||
line_in >> diameter_y;
|
||||
if (!line_in) {
|
||||
shapes[atom_type].x=diameter_x/2.0;
|
||||
continue;
|
||||
}
|
||||
a::fileclose(in,error);
|
||||
line_in >> diameter_z;
|
||||
if (!line_in)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Improperly formatted flavor_file at line:\n "+
|
||||
string(iline));
|
||||
shapes[atom_type]=cPt(diameter_x/2.0,diameter_y/2.0,diameter_z/2.0);
|
||||
spherical[atom_type]=false;
|
||||
}
|
||||
|
||||
a::fileopen(in,cl.argstring(' ',1),error);
|
||||
ofstream out;
|
||||
if (!cl['s']) {
|
||||
a::fileopen(out,cl.argstring(' ',2),error);
|
||||
}
|
||||
|
||||
|
||||
// ----------------- Get the atom count
|
||||
unsigned atom_count;
|
||||
if (parse_to("ITEM: NUMBER OF ATOMS",in))
|
||||
in >> atom_count;
|
||||
else
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Could not find ITEM: NUMBER OF ATOMS in input file.");
|
||||
if (!in)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Error reading ITEM: NUMBER OF ATOMS in input file.");
|
||||
error.note[9] << "Read in " << num_types << " atom types from flavor_file.\n";
|
||||
a::fileclose(in,error);
|
||||
|
||||
// ----------------- Get the triangles per ellipsoid
|
||||
unsigned ellip_res=10;
|
||||
@ -178,16 +117,21 @@ int main(int argc, char *argv[]) {
|
||||
ellip_res=10;
|
||||
}
|
||||
|
||||
// ----------------- Get the bounding box
|
||||
bool bound_found=false;
|
||||
a::fileopen(in,cl.argstring(' ',1),error);
|
||||
ofstream out;
|
||||
if (!cl['s']) {
|
||||
a::fileopen(out,cl.argstring(' ',2),error);
|
||||
}
|
||||
// ----------------- Get the bounding box
|
||||
GLSurface glb;
|
||||
bool bound_found=false;
|
||||
if (!cl['o']) {
|
||||
if (parse_to("ITEM: BOX BOUNDS",in)) {
|
||||
bound_found=true;
|
||||
cPt bound[2];
|
||||
in >> bound[0].x >> bound[1].x;
|
||||
in >> bound[0].y >> bound[1].y;
|
||||
in >> bound[0].z >> bound[1].z;
|
||||
GLSurface gls;
|
||||
in >> bound[0].x >> bound[1].x;
|
||||
in >> bound[0].y >> bound[1].y;
|
||||
in >> bound[0].z >> bound[1].z;
|
||||
Vertex v;
|
||||
v.transparency=1;
|
||||
v.valid_normal=false;
|
||||
@ -195,31 +139,33 @@ int main(int argc, char *argv[]) {
|
||||
for (unsigned i=0; i<2; i++)
|
||||
for (unsigned j=0; j<2; j++)
|
||||
for (unsigned k=0; k<2; k++) {
|
||||
v.cpt=cPt(bound[i].x,bound[j].y,bound[k].z);
|
||||
gls.addvertex(v);
|
||||
v.cpt=cPt(bound[i].x,bound[j].y,bound[k].z);
|
||||
glb.addvertex(v);
|
||||
}
|
||||
gls.addline(0,1);
|
||||
gls.addline(0,2);
|
||||
gls.addline(0,4);
|
||||
gls.addline(1,3);
|
||||
gls.addline(1,5);
|
||||
gls.addline(2,3);
|
||||
gls.addline(2,6);
|
||||
gls.addline(3,7);
|
||||
gls.addline(4,5);
|
||||
gls.addline(4,6);
|
||||
gls.addline(5,7);
|
||||
gls.addline(6,7);
|
||||
gls.writelines(out,"gridb");
|
||||
glb.addline(0,1);
|
||||
glb.addline(0,2);
|
||||
glb.addline(0,4);
|
||||
glb.addline(1,3);
|
||||
glb.addline(1,5);
|
||||
glb.addline(2,3);
|
||||
glb.addline(2,6);
|
||||
glb.addline(3,7);
|
||||
glb.addline(4,5);
|
||||
glb.addline(4,6);
|
||||
glb.addline(5,7);
|
||||
glb.addline(6,7);
|
||||
if (!cl['s'])
|
||||
glb.writelines(out,"gridb");
|
||||
out << "cmd.set('cgo_dot_width',8)\n";
|
||||
} else
|
||||
error.addwarning(0,9,"asphere_vis",
|
||||
"Could not find ITEM: BOX BOUNDS in input file. No box output.");
|
||||
}
|
||||
|
||||
if (!in)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Error reading ITEM: BOX BOUNDS.");
|
||||
if (!in)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Error reading ITEM: BOX BOUNDS.");
|
||||
a::fileclose(in,error);
|
||||
|
||||
// ----------------- Generate the frames
|
||||
unsigned frame=0;
|
||||
@ -227,11 +173,7 @@ int main(int argc, char *argv[]) {
|
||||
if (cl['f'])
|
||||
max_frame=cl.argint('f',0);
|
||||
|
||||
colorPt color=colors["marine"];
|
||||
double alpha=1.0;
|
||||
Vertex v;
|
||||
v.color=color;
|
||||
v.transparency=1.0;
|
||||
a::fileopen(in,cl.argstring(' ',1),error);
|
||||
|
||||
// ----------------- Get to the start frame
|
||||
while (frame<start_frame)
|
||||
@ -242,49 +184,64 @@ int main(int argc, char *argv[]) {
|
||||
frame++;
|
||||
|
||||
unsigned wrote=0;
|
||||
Vertex v;
|
||||
while (true) {
|
||||
// ----------------- Get the atom count
|
||||
unsigned atom_count;
|
||||
if (parse_to("ITEM: NUMBER OF ATOMS",in))
|
||||
in >> atom_count;
|
||||
else
|
||||
break;
|
||||
if (!in)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"Error reading ITEM: NUMBER OF ATOMS in input file.");
|
||||
|
||||
if (frame>end_frame)
|
||||
break;
|
||||
if (!parse_to("ITEM: ATOMS",in))
|
||||
break;
|
||||
GLSurface gls;
|
||||
for (unsigned i=0; i<atom_count; i++) {
|
||||
unsigned id;
|
||||
unsigned atom_type;
|
||||
in >> id >> atom_type;
|
||||
unsigned id, atom_type;
|
||||
cPt atom_center;
|
||||
in >> atom_center;
|
||||
Quaternion q;
|
||||
in >> q;
|
||||
if (!in) {
|
||||
error.addwarning(0,9,"asphere_vis","Error reading frame: "+
|
||||
a::itoa(frame));
|
||||
break;
|
||||
}
|
||||
cPt radius(shapes[atom_type-1]);
|
||||
if (radius.x == radius.y && radius.y == radius.z) {
|
||||
v.cpt=atom_center;
|
||||
if (cl['c']) {
|
||||
v.color=color_list[atom_type-1];
|
||||
v.transparency=alpha_list[atom_type-1];
|
||||
}
|
||||
gls.addvertex(v);
|
||||
gls.add_sphere(gls.size_vertices()-1,radius.x);
|
||||
} else {
|
||||
if (cl['c']) {
|
||||
color=color_list[atom_type-1];
|
||||
alpha=alpha_list[atom_type-1];
|
||||
}
|
||||
gls.add_ellipsoid(atom_center,radius,q,
|
||||
color,alpha,ellip_res);
|
||||
Quaternion q;
|
||||
for (unsigned i=0; i<atom_count; i++) {
|
||||
in.getline(iline,5000);
|
||||
istringstream line_in(iline);
|
||||
line_in >> id >> atom_type;
|
||||
if (atom_type>max_atom_types)
|
||||
error.generate_error(0,"asphere_vis",
|
||||
"asphere_vis will not handle atom types greater than "+
|
||||
a::itoa(max_atom_types));
|
||||
|
||||
line_in >> atom_center;
|
||||
if (spherical[atom_type]==false)
|
||||
line_in >> q;
|
||||
if (!line_in) {
|
||||
error.addwarning(0,9,"asphere_vis","Error reading frame: "+
|
||||
a::itoa(frame));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (spherical[atom_type]) {
|
||||
v.cpt=atom_center;
|
||||
v.color=color_list[atom_type];
|
||||
v.transparency=alpha_list[atom_type];
|
||||
gls.addvertex(v);
|
||||
gls.add_sphere(gls.size_vertices()-1,shapes[atom_type].x);
|
||||
} else {
|
||||
gls.add_ellipsoid(atom_center,shapes[atom_type],q,color_list[atom_type],
|
||||
alpha_list[atom_type],ellip_res);
|
||||
}
|
||||
}
|
||||
if (!in)
|
||||
break;
|
||||
if (cl['s']) {
|
||||
if (cl['b'])
|
||||
fi.set_file_num(frame);
|
||||
a::fileopen(out,fi.nextfilename(),error);
|
||||
if (!cl['o']) {
|
||||
glb.writelines(out,"gridb");
|
||||
out << "cmd.set('cgo_dot_width',8)\n";
|
||||
}
|
||||
}
|
||||
gls.writetris(out,"ellipse");
|
||||
if (gls.size_spheres()!=0)
|
||||
@ -321,13 +278,13 @@ int main(int argc, char *argv[]) {
|
||||
void Describe(CommandLine &cl,ostream &out) {
|
||||
string name=cl.program_name();
|
||||
string progname=a::strcenter(name,70);
|
||||
string gridversion=a::strcenter("Graphics Library Version 0.1",70);
|
||||
string gridversion=a::strcenter("Graphics Library Version 0.2",70);
|
||||
out << endl << progname << endl << gridversion << endl
|
||||
<< "______________________________________________________________________\n"
|
||||
<< a::strcenter("W. Michael Brown",70) << endl
|
||||
<< a::strcenter("1/12/2007",70) << endl
|
||||
<< "______________________________________________________________________\n"
|
||||
<< "Tool for LAMMPS aspherical trajectory visualization in pymol.\n\n"
|
||||
<< "Tool for LAMMPS trajectory visualization in Pymol.\n\n"
|
||||
<< cl.format_synopsis("","","") << endl << endl
|
||||
<< "Use '" << name << " -h > " << name
|
||||
<< ".1' to generate a man page for this\n"
|
||||
@ -339,20 +296,15 @@ void Describe(CommandLine &cl,ostream &out) {
|
||||
void HandleArgs(CommandLine &cl, int argc, char *argv[], Error *error) {
|
||||
// Arguments
|
||||
cl.addmanditory(' ',3);
|
||||
cl.addargname(' ',"input_file");
|
||||
cl.addargname(' ',"dump_file");
|
||||
cl.addargname(' ',"output_py_file");
|
||||
cl.add('d',0);
|
||||
cl.adddescription('d',"Use a LAMMPS input script rather than a data file for extracting atom shape information. The input script is specified as input_file.");
|
||||
cl.addargname(' ',"flavor_file");
|
||||
cl.addargname(' ',"dump_file");
|
||||
cl.addargname(' ',"output_py_file");
|
||||
cl.add('f',1);
|
||||
cl.addargname('f',"max_frame");
|
||||
cl.adddescription('f',"Do not write more than max_frame frames to the output file.");
|
||||
cl.add('r',1);
|
||||
cl.addargname('r',"ellip_res");
|
||||
cl.adddescription('r',"Resolution of ellipsoids in PyMol. The number of triangles per ellipsoid is equal to 2*(ellip_res^2). Default is 10.");
|
||||
cl.add('c',1);
|
||||
cl.addargname('c',"color_file");
|
||||
cl.adddescription('c',"Color the atom_types and set transparency based on the color file. The color file contains a space delimited set sequence of the color for an atom followed by the alpha. The color should be the string name and the alpha should be between 0 and 1.");
|
||||
cl.add('s',0);
|
||||
cl.adddescription('s',"Output the results into separate .py files. The filename and extension for the output files is taken from output_py_file.");
|
||||
cl.add('i',3);
|
||||
@ -362,6 +314,8 @@ void HandleArgs(CommandLine &cl, int argc, char *argv[], Error *error) {
|
||||
cl.adddescription('i',"Render the specified frame interval inclusive between start_frame and end_frame. skip gives the number of frames to skip between each rendered frame. A value of 0 outputs every frame between start_frame and end_frame. The first frame in the dump file is frame 0.");
|
||||
cl.add('b',0);
|
||||
cl.adddescription('b',"When used with -s, the option will number the filenames based on the frame number. By default, they are numbered consequtively from zero.");
|
||||
cl.add('o',0);
|
||||
cl.adddescription('o',"Do not output the outline for the simulation box.");
|
||||
|
||||
// Stuff for every executable
|
||||
cl.addhelp('h',0);
|
||||
@ -374,32 +328,40 @@ void HandleArgs(CommandLine &cl, int argc, char *argv[], Error *error) {
|
||||
cl.addtoman_chapter("NAME","Tools for ellipsoid visualization in PyMol of a LAMMPS trajectory.");
|
||||
|
||||
// Version
|
||||
cl.addtoman_chapter("VERSION","Version 0.1");
|
||||
cl.addtoman_chapter("VERSION","Version 0.2");
|
||||
|
||||
// Full Description
|
||||
const string desc[5]={
|
||||
"Tool for ellipsoid visualization in PyMol of a LAMMPS trajectory. The input_file is a LAMMPS ",
|
||||
"data file with a 'Shapes' section or a LAMMPS input script file with ellipsoid diameters specified using the ",
|
||||
"'shape' command. The trajectory is input from dump_file that must ",
|
||||
"be generated using a LAMMPS dump_style custom command with the following arguments in order:\n",
|
||||
".TP\\fItag type x y z quatw quati quatj quatk\\fR\n"
|
||||
};
|
||||
cl.addtoman_chapter("DESCRIPTION",5,desc);
|
||||
const string desc[22]={
|
||||
"Tool for converting LAMMPS trajectories into compiled graphics objects for ",
|
||||
"visualization in PyMol. The flavor_file is an input file that describes ",
|
||||
"the color, transparency, and size/shape of each atom type. The flavor_file ",
|
||||
"consists of two possible line formats. For spherical particles, the format ",
|
||||
"is:\n\n",
|
||||
"\t\\fIatom_type color alpha diameter\\fR\n\n",
|
||||
"where alpha is used to adjust the transparency of the particle. For ",
|
||||
"ellipsoidal particles, the format is:\n\n"
|
||||
"\t\\fIatom_type color alpha diameter_x diameter_y diameter_z\\fR\n\n",
|
||||
"Ellipsoidal and spherical line formats can be mixed in the same flavor_file ",
|
||||
"For any atom type not listed in the flavor_file a blue sphere of size 1 is ",
|
||||
"assumed.\n\n",
|
||||
"The dump_file is a LAMMPS trajectory. For atom types specified as spherical ",
|
||||
"in the flavor_file, the dump_file must contain \\fItag type x y z\\fR as ",
|
||||
"the first columns. For atom types specified as ellipsoidal in the ",
|
||||
"flavor_file, the columns are \\fItag type x y z quatw quati quatj quatk\\fR.",
|
||||
"The latter can be gerenated, for example, with the ",
|
||||
"LAMMPS dump_style custom command with the following arguments in order:\n\n",
|
||||
"\t\\fItag type x y z quatw quati quatj quatk\\fR\n\n",
|
||||
"The output file is a python file for input to Pymol. This can be viewed ",
|
||||
"from the command line using \\fIpymol output.py\\fR or by using the \\fIrun\\fR ",
|
||||
"command from within Pymol."
|
||||
};
|
||||
cl.addtoman_chapter("DESCRIPTION",22,desc);
|
||||
|
||||
Colors colors;
|
||||
cl.addtoman_chapter("AVAILABLE COLORS",colors.colorlist());
|
||||
|
||||
// bugs
|
||||
const string bugs[3]={
|
||||
"Comments are not allowed at any point between a section header and ",
|
||||
"the end of the contents for a section in either the data file or ",
|
||||
"the input file."
|
||||
};
|
||||
cl.addtoman_chapter("KNOWN BUGS",3,bugs);
|
||||
|
||||
|
||||
// Authors
|
||||
cl.addtoman_chapter("AUTHORS","W. Michael Brown");
|
||||
cl.addtoman_chapter("AUTHORS","W. Michael Brown");
|
||||
|
||||
// Parse the commandline
|
||||
if (!cl.parse(argc,argv,error)) {
|
||||
@ -420,7 +382,7 @@ void HandleArgs(CommandLine &cl, int argc, char *argv[], Error *error) {
|
||||
|
||||
// Output the help
|
||||
if (cl['h']) {
|
||||
cl.write_man_page(cout,"0.1","Graphics Utilities");
|
||||
cl.write_man_page(cout,"0.2","Graphics Utilities");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,6 +535,7 @@ void GLSurface::add_super_ellipsoid(const cPt &cen, const cPt &rad,
|
||||
Vertex ver;
|
||||
ver.color=color;
|
||||
ver.transparency=alpha;
|
||||
ver.valid_normal=true;
|
||||
double dU=(u2-u1)/u_segs;
|
||||
double dV=(v2-v1)/v_segs;
|
||||
double U=u1;
|
||||
|
||||
Reference in New Issue
Block a user