/**************************************************************************** INTERNATIONAL AVS CENTER (This disclaimer must remain at the top of all files) WARRANTY DISCLAIMER This module and the files associated with it are distributed free of charge. It is placed in the public domain and permission is granted for anyone to use, duplicate, modify, and redistribute it unless otherwise noted. Some modules may be copyrighted. You agree to abide by the conditions also included in the AVS Licensing Agreement, version 1.0, located in the main module directory located at the International AVS Center ftp site and to include the AVS Licensing Agreement when you distribute any files downloaded from that site. The International AVS Center, MCNC, the AVS Consortium and the individual submitting the module and files associated with said module provide absolutely NO WARRANTY OF ANY KIND with respect to this software. The entire risk as to the quality and performance of this software is with the user. IN NO EVENT WILL The International AVS Center, MCNC, the AVS Consortium and the individual submitting the module and files associated with said module BE LIABLE TO ANYONE FOR ANY DAMAGES ARISING FROM THE USE OF THIS SOFTWARE, INCLUDING, WITHOUT LIMITATION, DAMAGES RESULTING FROM LOST DATA OR LOST PROFITS, OR ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES. This AVS module and associated files are public domain software unless otherwise noted. Permission is hereby granted to do whatever you like with it, subject to the conditions that may exist in copyrighted materials. Should you wish to make a contribution toward the improvement, modification, or general performance of this module, please send us your comments: why you liked or disliked it, how you use it, and most important, how it helps your work. We will receive your comments at avs@ncsc.org. Please send AVS module bug reports to avs@ncsc.org. ******************************************************************************/ /* --------------------------------------------------------------------------- */ /* /usr/avs/examples/read_image.c was used as an example of writing modules */ /* shaker v5 Jan 1992 */ /* Janet L. Jensen */ /* James O. Jensen */ /* Ed Bender */ /* ------------------------------------------------------- */ #include /* IAC CODE CHANGE : #include */ #include #include #include #include #include "/usr/avs/include/geom.h" #include "shaker.h" /* Used for AVSmessage() */ static char file_version[] = "@(#)shaker.c, Ed says don't call him"; AVSinit_modules() { int shaker(); AVSmodule_from_desc(shaker); } /* -----------------------------------------*/ /* This is the description function */ /* -----------------------------------------*/ static shaker() { int param, param2, param3; int shaker_compute(); AVSset_module_name("shaker", MODULE_DATA); AVScreate_output_port("output geometry", "geom"); AVSadd_float_parameter("move", 0.00, -1.0, 1.0); param = AVSadd_parameter("Read Ascii File", "string",0,0 ,".vib"); AVSconnect_widget(param, "browser"); param2 = AVSadd_parameter("MODE", "integer",1,1 ,MAX_FREQS); param3 = AVSadd_float_parameter("FREQUENCY", 1,1,5000 ); AVSconnect_widget(param3, "typein_real"); AVSset_compute_proc(shaker_compute); } /* ---------------------------- */ /* This is the compute function */ /* ---------------------------- */ static shaker_compute(output, move, filename, mode) GEOMedit_list *output; float *move; char *filename; int mode; { int i; static int natm; int atomic_numb[MAX_ATOMS]; float atom_center_gs[MAX_ATOMS][COORD]; float atom_center[MAX_ATOMS][COORD]; /* ground state geom from gaussian90 */ float atom_radius[MAX_ATOMS]; float atom_color[MAX_ATOMS][COORD]; /* COORD holds r g b */ static int nfreq; float freq[MAX_FREQS]; float dx[MAX_FREQS][MAX_ATOMS], /* vector changes from gaussian90 */ dy[MAX_FREQS][MAX_ATOMS], dz[MAX_FREQS][MAX_ATOMS]; /* these variables are for makebonds and get_bonds */ static int nbonds; /* number of bonds */ static int vertices; /* number of vertices, 2 per bond */ float *bonds[MAX_BONDS][COORD]; /* vertex pairs assigned in make_bonds */ float tbonds[MAX_BONDS][COORD]; /* temporary holder for passing */ /* these variables are for avs GEOM calls */ float ext[6]; char *objname; GEOMobj *atom_obj, *bond_obj; /* this is for getting the ascii text file that jim creates from the gaussian .chk file */ /* with his fortran read program. */ FILE *f1, *fopen(); /* this is for AVSmodify_parameter for collecting the modes */ int flags; /*------------------------------------------------ */ /* Read in the ascii data file. */ /* It'm important that the ground state is re-read */ /* each time because it gets clobber in get_move */ /* This is necessary, because the bond connectivity*/ /* is pointed to by bonds. Then *bonds is put into */ /* tbond[][] for passing to GEOMadd_disjoint_line. */ /* This way the connectivity should not change. */ /* ----------------------------------------------- */ /* No data file name */ if (!filename) return(1); if(AVSparameter_changed("Read Ascii File")){ /* Attempt to open file */ if (!(f1 = fopen(filename, "r"))) { AVSmessage(file_version, AVS_Warning, AVSmodule, "shaker_compute", "Ok", "Can't open data file %s", filename); return(0); } /*the file is closed in mover */ mover(filename, f1, &natm, atomic_numb, atom_center_gs, &nfreq, freq, dx,dy,dz); flags = (AVS_VALUE | AVS_MAXVAL) | (AVS_MINVAL); AVSmodify_parameter("MODE",flags, 30, 1, nfreq); AVSmodify_float_parameter("FREQUENCY",flags, freq[nfreq-1], freq[0], freq[nfreq-1]); /* ---------------------------------------------------------------*/ /* the bonds connectivity is based on the ground state geometry.*/ /* bonds points to the two ends of one bond in make_bonds(). */ /* Then the actual */ /* value of the vertices are then assigned to tbonds[][] */ /* before tbonds is passed to GEOMadd_disjoint_line. */ /* ---------------------------------------------------------------*/ make_bonds(natm, atomic_numb, atom_center_gs, atom_center, &nbonds, bonds); /* set the radius to some constant arbitrary numb so balls don't change size */ for(i=0; i