Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

gaussianplugin.c File Reference

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#include <math.h>
#include "gaussianplugin.h"
#include "periodic_table.h"
#include "unit_conversion.h"
#include "vmdconio.h"

Go to the source code of this file.

Defines

#define THISPLUGIN   plugin
#define GAUSSIAN_DEBUG   0
#define GAUSSIAN_BASIS_DEBUG   1
#define PRINTERR   (void)(0)
#define GET_LINE(x, y)   if (!fgets(x, sizeof(x), y)) return FALSE
#define SAFE_FREE(ptr)   free(ptr); ptr=NULL
#define SAFE_CALLOC(ptr, type, count)
#define UNK_SHELL   -666
#define SPD_D_SHELL   -5
#define SPD_P_SHELL   -4
#define SPD_S_SHELL   -3
#define SP_S_SHELL   -2
#define SP_P_SHELL   -1
#define S_SHELL   0
#define P_SHELL   1
#define D_SHELL   2
#define F_SHELL   3
#define G_SHELL   4
#define H_SHELL   5
#define I_SHELL   6
#define SPIN_ALPHA   0
#define SPIN_BETA   1
#define STATUS_UNKNOWN   -1
#define STATUS_CONVERGED   0
#define STATUS_SCF_NOT_CONV   1
#define STATUS_TOO_MANY_STEPS   2
#define STATUS_BROKEN_OFF   3

Functions

int parse_static_data (gaussiandata *, int *)
int have_gaussian (gaussiandata *)
int get_proc_mem (gaussiandata *)
int get_basis_options (gaussiandata *)
int get_runtitle (gaussiandata *)
int get_input_structure (gaussiandata *)
int get_coordinates (FILE *file, qm_atom_t *atoms, int numatoms)
int get_int_coordinates (FILE *file, qm_atom_t *atoms, int numatoms)
int get_contrl (gaussiandata *)
int get_final_info (gaussiandata *)
int get_basis (gaussiandata *)
int get_internal_basis (gaussiandata *)
int shellsymm_int (char *symm)
int fill_basis_arrays (gaussiandata *)
int read_first_frame (gaussiandata *)
int get_traj_frame (gaussiandata *)
int find_traj_end (gaussiandata *)
int get_wavefunction (gaussiandata *, qm_timestep_t *)
int get_population (gaussiandata *, qm_timestep_t *)
void fix_fortran_exp (char *string)
void * open_gaussian_read (const char *filename, const char *filetype, int *natoms)
int read_gaussian_structure (void *mydata, int *optflags, molfile_atom_t *atoms)
int read_gaussian_metadata (void *mydata, molfile_qm_metadata_t *gaussian_metadata)
int read_gaussian_rundata (void *mydata, molfile_qm_t *qm_data)
void close_gaussian_read (void *mydata)
VMDPLUGIN_API int VMDPLUGIN_init (void)
VMDPLUGIN_API int VMDPLUGIN_register (void *v, vmdplugin_register_cb cb)
VMDPLUGIN_API int VMDPLUGIN_fini (void)

Variables

const char * runtypes []
const char * scftypes []


Define Documentation

#define D_SHELL   2
 

Definition at line 78 of file gaussianplugin.c.

Referenced by shellsymm_int.

#define F_SHELL   3
 

Definition at line 79 of file gaussianplugin.c.

Referenced by shellsymm_int.

#define G_SHELL   4
 

Definition at line 80 of file gaussianplugin.c.

Referenced by shellsymm_int.

#define GAUSSIAN_BASIS_DEBUG   1
 

Definition at line 39 of file gaussianplugin.c.

#define GAUSSIAN_DEBUG   0
 

Definition at line 37 of file gaussianplugin.c.

#define GET_LINE x,
     if (!fgets(x, sizeof(x), y)) return FALSE
 

Definition at line 57 of file gaussianplugin.c.

#define H_SHELL   5
 

Definition at line 81 of file gaussianplugin.c.

#define I_SHELL   6
 

Definition at line 82 of file gaussianplugin.c.

#define P_SHELL   1
 

Definition at line 77 of file gaussianplugin.c.

Referenced by shellsymm_int.

#define PRINTERR   (void)(0)
 

Definition at line 46 of file gaussianplugin.c.

Referenced by get_population, get_wavefunction, and open_gaussian_read.

#define S_SHELL   0
 

Definition at line 76 of file gaussianplugin.c.

Referenced by shellsymm_int.

#define SAFE_CALLOC ptr,
type,
count   
 

Value:

ptr = (type *)calloc(count,sizeof(type));                         \
  if (ptr == NULL) {                                                \
    PRINTERR;                                                       \
    return MOLFILE_ERROR;                                           \
  }

Definition at line 63 of file gaussianplugin.c.

#define SAFE_FREE ptr       free(ptr); ptr=NULL
 

Definition at line 61 of file gaussianplugin.c.

#define SP_P_SHELL   -1
 

Definition at line 75 of file gaussianplugin.c.

Referenced by get_basis, get_internal_basis, and shellsymm_int.

#define SP_S_SHELL   -2
 

Definition at line 74 of file gaussianplugin.c.

Referenced by get_basis, get_internal_basis, and shellsymm_int.

#define SPD_D_SHELL   -5
 

Definition at line 71 of file gaussianplugin.c.

#define SPD_P_SHELL   -4
 

Definition at line 72 of file gaussianplugin.c.

#define SPD_S_SHELL   -3
 

Definition at line 73 of file gaussianplugin.c.

Referenced by shellsymm_int.

#define SPIN_ALPHA   0
 

Definition at line 84 of file gaussianplugin.c.

Referenced by get_wavefunction.

#define SPIN_BETA   1
 

Definition at line 85 of file gaussianplugin.c.

#define STATUS_BROKEN_OFF   3
 

Definition at line 91 of file gaussianplugin.c.

Referenced by find_traj_end.

#define STATUS_CONVERGED   0
 

Definition at line 88 of file gaussianplugin.c.

Referenced by find_traj_end.

#define STATUS_SCF_NOT_CONV   1
 

Definition at line 89 of file gaussianplugin.c.

Referenced by find_traj_end.

#define STATUS_TOO_MANY_STEPS   2
 

Definition at line 90 of file gaussianplugin.c.

Referenced by find_traj_end.

#define STATUS_UNKNOWN   -1
 

Definition at line 87 of file gaussianplugin.c.

#define THISPLUGIN   plugin
 

Definition at line 30 of file gaussianplugin.c.

#define UNK_SHELL   -666
 

Definition at line 70 of file gaussianplugin.c.

Referenced by shellsymm_int.


Function Documentation

void close_gaussian_read void *    mydata [static]
 

Clean up when done and free all memory to avoid memory leaks.

Definition at line 542 of file gaussianplugin.c.

References gaussiandata::angular_momentum, gaussiandata::basis, gaussiandata::basis_set, gaussiandata::file, gaussiandata::file_name, qm_timestep_t::gradient, gaussiandata::initatoms, gaussiandata::intensities, gaussiandata::internal_coordinates, qm_timestep_t::mulliken_charges, gaussiandata::mulliken_charges, gaussiandata::normal_modes, gaussiandata::num_frames_read, gaussiandata::num_prim_per_shell, gaussiandata::num_shells_per_atom, gaussiandata::numatoms, basis_atom_t::numshells, qm_timestep_t::numwave, qm_wavefunction_t::orb_energies, shell_t::prim, gaussiandata::qm_timestep, qm_timestep_t::scfenergies, basis_atom_t::shell, gaussiandata::shell_symmetry, qm_timestep_t::wave, qm_wavefunction_t::wave_coeffs, and gaussiandata::wavenumbers.

Referenced by VMDPLUGIN_init.

int fill_basis_arrays gaussiandata   data [static]
 

Populate the flat arrays containing the basis set data.

Definition at line 1748 of file gaussianplugin.c.

References gaussiandata::basis, gaussiandata::basis_set, prim_t::contraction_coeff, prim_t::exponent, gaussiandata::num_basis_atoms, gaussiandata::num_basis_funcs, gaussiandata::num_prim_per_shell, gaussiandata::num_shells, gaussiandata::num_shells_per_atom, shell_t::numprims, basis_atom_t::numshells, shell_t::prim, SAFE_CALLOC, basis_atom_t::shell, gaussiandata::shell_symmetry, and shell_t::symmetry.

int find_traj_end gaussiandata   [static]
 

Definition at line 1895 of file gaussianplugin.c.

References gaussiandata::file, gaussiandata::num_frames, gaussiandata::opt_status, STATUS_BROKEN_OFF, STATUS_CONVERGED, STATUS_SCF_NOT_CONV, STATUS_TOO_MANY_STEPS, and VMDCON_INFO.

Referenced by get_final_info.

void fix_fortran_exp char *    string [static]
 

Definition at line 175 of file gaussianplugin.c.

Referenced by get_basis, and get_internal_basis.

int get_basis gaussiandata   [static]
 

Definition at line 1373 of file gaussianplugin.c.

References qm_atom_t::atomicnum, gaussiandata::basis_set, prim_t::contraction_coeff, prim_t::exponent, gaussiandata::file, fill_basis_arrays, fix_fortran_exp, gaussiandata::gbasis, GET_LINE, get_pte_label, gaussiandata::have_basis, gaussiandata::initatoms, MOLFILE_BUFSIZ, MOLFILE_ERROR, basis_atom_t::name, gaussiandata::num_basis_atoms, gaussiandata::num_basis_funcs, gaussiandata::num_shells, gaussiandata::num_shells_per_atom, shell_t::numprims, basis_atom_t::numshells, shell_t::prim, SAFE_CALLOC, SAFE_FREE, basis_atom_t::shell, shellsymm_int, SP_P_SHELL, SP_S_SHELL, shell_t::symmetry, qm_atom_t::type, gaussiandata::version, and VMDCON_INFO.

int get_basis_options gaussiandata   [static]
 

Get basis set statistics

Definition at line 776 of file gaussianplugin.c.

References gaussiandata::basis_string, gaussiandata::file, gaussiandata::gbasis, GET_LINE, MOLFILE_BUFSIZ, MOLFILE_ERROR, gaussiandata::multiplicity, gaussiandata::num_basis_atoms, gaussiandata::num_basis_funcs, gaussiandata::num_electrons, gaussiandata::num_orbitals, gaussiandata::num_shells, gaussiandata::occ_orbitals_A, gaussiandata::occ_orbitals_B, VMDCON_INFO, and gaussiandata::wavef_size.

Referenced by parse_static_data.

int get_contrl gaussiandata   [static]
 

Read and parse the Route section of the input.

Definition at line 1046 of file gaussianplugin.c.

References gaussiandata::basis_string, gaussiandata::file, gaussiandata::gbasis, GET_LINE, gaussiandata::have_basis, gaussiandata::have_cart_basis, gaussiandata::have_wavefunction, gaussiandata::multiplicity, gaussiandata::runtyp, RUNTYP_ENERGY, RUNTYP_HESSIAN, RUNTYP_OPTIMIZE, RUNTYP_SURFACE, runtypes, gaussiandata::scftyp, SCFTYP_RHF, SCFTYP_ROHF, SCFTYP_UHF, scftypes, and VMDCON_INFO.

Referenced by parse_static_data.

int get_coordinates FILE *    file,
qm_atom_t   atoms,
int    numatoms
[static]
 

Read coordinates

Definition at line 1271 of file gaussianplugin.c.

References GET_LINE, qm_atom_t::x, qm_atom_t::y, and qm_atom_t::z.

int get_final_info gaussiandata   [static]
 

the function get_initial_info provides the atom number, coordinates, and atom types and stores them temporarily.

Definition at line 1249 of file gaussianplugin.c.

References gaussiandata::file, find_traj_end, gaussiandata::runtyp, RUNTYP_HESSIAN, RUNTYP_OPTIMIZE, RUNTYP_SADPOINT, and RUNTYP_SURFACE.

Referenced by parse_static_data.

int get_input_structure gaussiandata   [static]
 

Read the input atom definitions.

Definition at line 964 of file gaussianplugin.c.

References qm_atom_t::atomicnum, gaussiandata::file, GET_LINE, get_pte_idx, gaussiandata::initatoms, MOLFILE_BUFSIZ, gaussiandata::multiplicity, gaussiandata::numatoms, gaussiandata::totalcharge, qm_atom_t::type, and VMDCON_INFO.

int get_int_coordinates FILE *    file,
qm_atom_t   atoms,
int    numatoms
[static]
 

same as get_coordinates, but we look for coordinates in internal orientation

Definition at line 1306 of file gaussianplugin.c.

References GET_LINE, qm_atom_t::x, qm_atom_t::y, and qm_atom_t::z.

Referenced by get_traj_frame.

int get_internal_basis gaussiandata   [static]
 

Definition at line 1533 of file gaussianplugin.c.

References qm_atom_t::atomicnum, gaussiandata::basis_set, prim_t::contraction_coeff, prim_t::exponent, fill_basis_arrays, fix_fortran_exp, gaussiandata::gbasis, get_pte_label, gaussiandata::have_basis, gaussiandata::initatoms, MOLFILE_BUFSIZ, basis_atom_t::name, gaussiandata::num_basis_atoms, gaussiandata::num_basis_funcs, gaussiandata::num_shells, gaussiandata::num_shells_per_atom, shell_t::numprims, basis_atom_t::numshells, shell_t::prim, SAFE_CALLOC, basis_atom_t::shell, shellsymm_int, SP_P_SHELL, SP_S_SHELL, shell_t::symmetry, and VMDCON_INFO.

Referenced by get_traj_frame, and read_first_frame.

int get_population gaussiandata  ,
qm_timestep_t  
[static]
 

read in mulliken charges

Definition at line 2117 of file gaussianplugin.c.

References gaussiandata::file, GET_LINE, gaussiandata::have_mulliken, qm_timestep_t::mulliken_charges, gaussiandata::num_basis_atoms, gaussiandata::numatoms, PRINTERR, and VMDCON_INFO.

int get_proc_mem gaussiandata   [static]
 

Get number of processors requested and amount of memory used.

Definition at line 713 of file gaussianplugin.c.

References gaussiandata::file, GET_LINE, gaussiandata::memory, MOLFILE_BUFSIZ, gaussiandata::nproc, and VMDCON_INFO.

Referenced by parse_static_data.

int get_runtitle gaussiandata   [static]
 

Determine the run's title text.

Definition at line 929 of file gaussianplugin.c.

References gaussiandata::file, GET_LINE, and gaussiandata::runtitle.

Referenced by parse_static_data.

int get_traj_frame gaussiandata   data [static]
 

this function extracts the trajectory information from the output file

Definition at line 1799 of file gaussianplugin.c.

References gaussiandata::file, get_basis, get_coordinates, get_int_coordinates, get_internal_basis, get_population, get_wavefunction, qm_wavefunction_t::idtag, gaussiandata::initatoms, MOLFILE_BUFSIZ, gaussiandata::num_frames_read, gaussiandata::numatoms, qm_timestep_t::numwave, qm_wavefunction_t::occupancies, qm_wavefunction_t::orb_energies, qm_wavefunction_t::orb_indices, gaussiandata::qm_timestep, SAFE_CALLOC, gaussiandata::scftyp, SCFTYP_UHF, VMDCON_INFO, qm_timestep_t::wave, qm_wavefunction_t::wave_coeffs, and gaussiandata::wavef_size.

int get_wavefunction gaussiandata  ,
qm_timestep_t  
[static]
 

Definition at line 1938 of file gaussianplugin.c.

References gaussiandata::angular_momentum, qm_wavefunction_t::cartesian, gaussiandata::file, GET_LINE, gaussiandata::have_wavefunction, MOLFILE_BUFSIZ, MOLFILE_WAVE_CANON, qm_wavefunction_t::num_orbitals, gaussiandata::num_orbitals, qm_timestep_t::numwave, qm_wavefunction_t::occupancies, qm_wavefunction_t::orb_energies, qm_wavefunction_t::orb_indices, PRINTERR, qm_wavefunction_t::spin, SPIN_ALPHA, qm_wavefunction_t::type, VMDCON_INFO, qm_timestep_t::wave, qm_wavefunction_t::wave_coeffs, and gaussiandata::wavef_size.

int have_gaussian gaussiandata   [static]
 

Check if the current run is an actual Gaussian run; returns true/false

Definition at line 639 of file gaussianplugin.c.

References gaussiandata::file, gaussiandata::file_name, GET_LINE, MOLFILE_BUFSIZ, gaussiandata::version, gaussiandata::version_string, and VMDCON_INFO.

Referenced by open_gaussian_read.

void* open_gaussian_read const char *    filename,
const char *    filetype,
int *    natoms
[static]
 

Definition at line 198 of file gaussianplugin.c.

References gaussiandata::file, gaussiandata::file_name, have_gaussian, parse_static_data, PRINTERR, gaussiandata::runtyp, RUNTYP_UNKNOWN, gaussiandata::scftyp, SCFTYP_UNKNOWN, gaussiandata::version, and gaussiandata::version_string.

Referenced by VMDPLUGIN_init.

int parse_static_data gaussiandata  ,
int *   
[static]
 

Top level gaussian log file parser. Responsible for static, i.e. non-trajectory information.

Definition at line 600 of file gaussianplugin.c.

References get_basis_options, get_contrl, get_final_info, get_input_structure, get_proc_mem, get_runtitle, gaussiandata::num_frames, gaussiandata::num_frames_read, gaussiandata::num_frames_sent, gaussiandata::numatoms, read_first_frame, and VMDCON_INFO.

int read_first_frame gaussiandata   [static]
 

Definition at line 1218 of file gaussianplugin.c.

References gaussiandata::angular_momentum, get_traj_frame, gaussiandata::num_frames, gaussiandata::qm_timestep, SAFE_CALLOC, VMDCON_INFO, and gaussiandata::wavef_size.

int read_gaussian_metadata void *    mydata,
molfile_qm_metadata_t   gaussian_metadata
[static]
 

Definition at line 306 of file gaussianplugin.c.

References molfile_qm_metadata_t::have_carthessian, molfile_qm_metadata_t::have_normalmodes, molfile_qm_metadata_t::have_sysinfo, molfile_qm_metadata_t::ncart, molfile_qm_metadata_t::nimag, molfile_qm_metadata_t::nintcoords, gaussiandata::num_basis_atoms, molfile_qm_metadata_t::num_basis_atoms, gaussiandata::num_basis_funcs, molfile_qm_metadata_t::num_basis_funcs, gaussiandata::num_shells, molfile_qm_metadata_t::num_shells, gaussiandata::wavef_size, and molfile_qm_metadata_t::wavef_size.

Referenced by VMDPLUGIN_init.

int read_gaussian_rundata void *    mydata,
molfile_qm_t   qm_data
[static]
 

Definition at line 342 of file gaussianplugin.c.

References gaussiandata::angular_momentum, molfile_qm_basis_t::angular_momentum, gaussiandata::basis, molfile_qm_basis_t::basis, molfile_qm_t::basis, gaussiandata::basis_string, molfile_qm_sysinfo_t::basis_string, gaussiandata::geometry, molfile_qm_sysinfo_t::geometry, gaussiandata::memory, molfile_qm_sysinfo_t::memory, gaussiandata::nproc, molfile_qm_sysinfo_t::nproc, gaussiandata::num_basis_atoms, gaussiandata::num_basis_funcs, gaussiandata::num_electrons, molfile_qm_sysinfo_t::num_electrons, molfile_qm_sysinfo_t::num_occupied_A, molfile_qm_sysinfo_t::num_occupied_B, gaussiandata::num_prim_per_shell, molfile_qm_basis_t::num_prim_per_shell, gaussiandata::num_shells, gaussiandata::num_shells_per_atom, molfile_qm_basis_t::num_shells_per_atom, gaussiandata::occ_orbitals_A, gaussiandata::occ_orbitals_B, molfile_qm_t::run, gaussiandata::runtitle, molfile_qm_sysinfo_t::runtitle, gaussiandata::runtyp, molfile_qm_sysinfo_t::runtype, gaussiandata::scftyp, molfile_qm_sysinfo_t::scftype, gaussiandata::shell_symmetry, gaussiandata::totalcharge, molfile_qm_sysinfo_t::totalcharge, gaussiandata::version_string, molfile_qm_sysinfo_t::version_string, and gaussiandata::wavef_size.

Referenced by VMDPLUGIN_init.

int read_gaussian_structure void *    mydata,
int *    optflags,
molfile_atom_t   atoms
[static]
 

Definition at line 255 of file gaussianplugin.c.

References qm_atom_t::atomicnum, molfile_atom_t::atomicnumber, molfile_atom_t::chain, molfile_atom_t::charge, get_pte_mass, get_pte_vdw_radius, gaussiandata::have_mulliken, gaussiandata::initatoms, molfile_atom_t::mass, MOLFILE_ATOMICNUMBER, MOLFILE_CHARGE, MOLFILE_MASS, MOLFILE_RADIUS, qm_timestep_t::mulliken_charges, molfile_atom_t::name, gaussiandata::numatoms, gaussiandata::qm_timestep, molfile_atom_t::radius, molfile_atom_t::resid, molfile_atom_t::resname, molfile_atom_t::segid, molfile_atom_t::type, and qm_atom_t::type.

Referenced by VMDPLUGIN_init.

int shellsymm_int char *    symm [static]
 

Definition at line 1701 of file gaussianplugin.c.

References D_SHELL, F_SHELL, G_SHELL, P_SHELL, S_SHELL, SP_P_SHELL, SP_S_SHELL, SPD_S_SHELL, and UNK_SHELL.

Referenced by get_basis, and get_internal_basis.

VMDPLUGIN_API int VMDPLUGIN_fini void   
 

Definition at line 2195 of file gaussianplugin.c.

References VMDPLUGIN_API, and VMDPLUGIN_SUCCESS.

VMDPLUGIN_API int VMDPLUGIN_init void   
 

Definition at line 2164 of file gaussianplugin.c.

References close_gaussian_read, MOLFILE_PLUGIN_TYPE, open_gaussian_read, read_gaussian_metadata, read_gaussian_rundata, read_gaussian_structure, vmdplugin_ABIVERSION, VMDPLUGIN_API, VMDPLUGIN_SUCCESS, and VMDPLUGIN_THREADUNSAFE.

VMDPLUGIN_API int VMDPLUGIN_register void *    v,
vmdplugin_register_cb    cb
 

Definition at line 2190 of file gaussianplugin.c.

References VMDPLUGIN_API, vmdplugin_register_cb, and VMDPLUGIN_SUCCESS.


Variable Documentation

const char* runtypes[] [static]
 

Initial value:

 { 
  "(unknown)", "ENERGY", "OPTIMIZE", "SADPOINT", "HESSIAN", 
  "SURFACE", "DYNAMICS", "PROPERTIES", NULL}

Definition at line 93 of file gaussianplugin.c.

Referenced by get_contrl.

const char* scftypes[] [static]
 

Initial value:

 { 
  "(unknown)", "RHF", "UHF", "ROHF", "GVB", "MCSCF", "FF", NULL }

Definition at line 97 of file gaussianplugin.c.

Referenced by get_contrl.


Generated on Thu Dec 5 03:07:44 2024 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002