From 8051b12ffc8cf2fc7d11163711db2850d909c27c Mon Sep 17 00:00:00 2001 From: ketankhare Date: Mon, 10 Apr 2017 18:39:37 -0400 Subject: [PATCH 01/20] Updated to 1.33 from 1.32 --- src/USER-MOLFILE/vmdplugin.h | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/USER-MOLFILE/vmdplugin.h b/src/USER-MOLFILE/vmdplugin.h index 37299408fe..bbbc53c9bb 100644 --- a/src/USER-MOLFILE/vmdplugin.h +++ b/src/USER-MOLFILE/vmdplugin.h @@ -11,26 +11,26 @@ * * $RCSfile: vmdplugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.32 $ $Date: 2009/02/24 05:12:35 $ + * $Revision: 1.33 $ $Date: 2015/10/29 05:10:54 $ * ***************************************************************************/ /** @file * This header must be included by every VMD plugin library. It defines the - * API for every plugin so that VMD can organize the plugins it finds. + * API for every plugin so that VMD can organize the plugins it finds. */ #ifndef VMD_PLUGIN_H #define VMD_PLUGIN_H -/* +/* * Preprocessor tricks to make it easier for us to redefine the names of * functions when building static plugins. */ #if !defined(VMDPLUGIN) -/** - * macro defining VMDPLUGIN if it hasn't already been set to the name of +/** + * macro defining VMDPLUGIN if it hasn't already been set to the name of * a static plugin that is being compiled. This is the catch-all case. */ #define VMDPLUGIN vmdplugin @@ -38,11 +38,11 @@ /** concatenation macro, joins args x and y together as a single string */ #define xcat(x, y) cat(x, y) /** concatenation macro, joins args x and y together as a single string */ -#define cat(x, y) x ## y +#define cat(x, y) x ## y /* - * macros to correctly define plugin function names depending on whether - * the plugin is being compiled for static linkage or dynamic loading. + * macros to correctly define plugin function names depending on whether + * the plugin is being compiled for static linkage or dynamic loading. * When compiled for static linkage, each plugin needs to have unique * function names for all of its entry points. When compiled for dynamic * loading, the plugins must name their entry points consistently so that @@ -59,13 +59,13 @@ /** "WIN32" is defined on both WIN32 and WIN64 platforms... */ -#if (defined(WIN32)) +#if (defined(WIN32)) #define WIN32_LEAN_AND_MEAN #include #if !defined(STATIC_PLUGIN) #if defined(VMDPLUGIN_EXPORTS) -/** +/** * Only define DllMain for plugins, not in VMD or in statically linked plugins * VMDPLUGIN_EXPORTS is only defined when compiling dynamically loaded plugins */ @@ -86,7 +86,7 @@ BOOL APIENTRY DllMain( HANDLE hModule, #endif /* ! STATIC_PLUGIN */ #else /** If we're not compiling on Windows, then this macro is defined empty */ -#define VMDPLUGIN_API +#define VMDPLUGIN_API #endif /** define plugin linkage correctly for both C and C++ based plugins */ @@ -96,13 +96,13 @@ BOOL APIENTRY DllMain( HANDLE hModule, #define VMDPLUGIN_EXTERN extern VMDPLUGIN_API #endif /* __cplusplus */ -/* - * Plugin API functions start here +/* + * Plugin API functions start here */ -/** - * Init routine: called the first time the library is loaded by the +/** + * Init routine: called the first time the library is loaded by the * application and before any other API functions are referenced. * Return 0 on success. */ @@ -110,15 +110,15 @@ VMDPLUGIN_EXTERN int VMDPLUGIN_init(void); /** * Macro for creating a struct header used in all plugin structures. - * - * This header should be placed at the top of every plugin API definition + * + * This header should be placed at the top of every plugin API definition * so that it can be treated as a subtype of the base plugin type. * * abiversion: Defines the ABI for the base plugin type (not for other plugins) * type: A string descriptor of the plugin type. * name: A name for the plugin. * author: A string identifier, possibly including newlines. - * Major and minor version. + * Major and minor version. * is_reentrant: Whether this library can be run concurrently with itself. */ #define vmdplugin_HEAD \ @@ -129,12 +129,12 @@ VMDPLUGIN_EXTERN int VMDPLUGIN_init(void); const char *author; \ int majorv; \ int minorv; \ - int is_reentrant; + int is_reentrant; -/** +/** * Typedef for generic plugin header, individual plugins can - * make their own structures as long as the header info remains - * the same as the generic plugin header, most easily done by + * make their own structures as long as the header info remains + * the same as the generic plugin header, most easily done by * using the vmdplugin_HEAD macro. */ typedef struct { @@ -144,7 +144,7 @@ typedef struct { /** * Use this macro to initialize the abiversion member of each plugin */ -#define vmdplugin_ABIVERSION 16 +#define vmdplugin_ABIVERSION 17 /*@{*/ /** Use this macro to indicate a plugin's thread-safety at registration time */ @@ -158,7 +158,7 @@ typedef struct { #define VMDPLUGIN_ERROR -1 /*@}*/ -/** +/** * Function pointer typedef for register callback functions */ typedef int (*vmdplugin_register_cb)(void *, vmdplugin_t *); @@ -175,16 +175,16 @@ typedef int (*vmdplugin_register_cb)(void *, vmdplugin_t *); VMDPLUGIN_EXTERN int VMDPLUGIN_register(void *, vmdplugin_register_cb); /** - * Allow the library to register Tcl extensions. + * Allow the library to register Tcl extensions. * This API is optional; if found by dlopen, it will be called after first - * calling init and register. + * calling init and register. */ -VMDPLUGIN_EXTERN int VMDPLUGIN_register_tcl(void *, void *tcl_interp, +VMDPLUGIN_EXTERN int VMDPLUGIN_register_tcl(void *, void *tcl_interp, vmdplugin_register_cb); /** - * The Fini method is called when the application will no longer use - * any plugins in the library. + * The Fini method is called when the application will no longer use + * any plugins in the library. */ VMDPLUGIN_EXTERN int VMDPLUGIN_fini(void); From b9177fd6dccf9d81a7f9a37148852f42d8a76ed1 Mon Sep 17 00:00:00 2001 From: ketankhare Date: Mon, 10 Apr 2017 18:40:30 -0400 Subject: [PATCH 02/20] Updated to 1.108 from 1.103 --- src/USER-MOLFILE/molfile_plugin.h | 339 ++++++++++++++++-------------- 1 file changed, 176 insertions(+), 163 deletions(-) diff --git a/src/USER-MOLFILE/molfile_plugin.h b/src/USER-MOLFILE/molfile_plugin.h index 7a2d7ca42e..714b06539f 100644 --- a/src/USER-MOLFILE/molfile_plugin.h +++ b/src/USER-MOLFILE/molfile_plugin.h @@ -11,14 +11,14 @@ * * $RCSfile: molfile_plugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.103 $ $Date: 2011/03/05 03:56:11 $ + * $Revision: 1.108 $ $Date: 2016/02/26 03:17:01 $ * ***************************************************************************/ -/** @file +/** @file * API for C extensions to define a way to load structure, coordinate, - * trajectory, and volumetric data files - */ + * trajectory, and volumetric data files + */ #ifndef MOL_FILE_PLUGIN_H #define MOL_FILE_PLUGIN_H @@ -60,6 +60,21 @@ typedef ssize_t molfile_ssize_t; /**< for frame counts */ #define MOLFILE_MAXWAVEPERTS 25 /**< maximum number of wavefunctions * per timestep */ +/** + * Hard-coded direct-I/O page size constants for use by both VMD + * and the plugins that want to use direct, unbuffered I/O for high + * performance with SSDs etc. We use two constants to define the + * range of hardware page sizes that we can support, so that we can + * add support for larger 8KB or 16KB page sizes in the future + * as they become more prevalent in high-end storage systems. + * + * At present, VMD uses a hard-coded 4KB page size to reduce memory + * fragmentation, but these constants will make it easier to enable the + * use of larger page sizes in the future if it becomes necessary. + */ +#define MOLFILE_DIRECTIO_MIN_BLOCK_SIZE 4096 +#define MOLFILE_DIRECTIO_MAX_BLOCK_SIZE 4096 + /** * File level comments, origin information, and annotations. @@ -74,16 +89,16 @@ typedef struct { } molfile_metadata_t; -/* - * Struct for specifying atoms in a molecular structure. The first - * six components are required, the rest are optional and their presence is +/* + * Struct for specifying atoms in a molecular structure. The first + * six components are required, the rest are optional and their presence is * indicating by setting the corresponding bit in optsflag. When omitted, - * the application (for read_structure) or plugin (for write_structure) - * must be able to supply default values if the missing parameters are + * the application (for read_structure) or plugin (for write_structure) + * must be able to supply default values if the missing parameters are * part of its internal data structure. * Note that it is not possible to specify coordinates with this structure. - * This is intentional; all coordinate I/O is done with the read_timestep and - * write_timestep functions. + * This is intentional; all coordinate I/O is done with the read_timestep and + * write_timestep functions. */ /** @@ -96,8 +111,17 @@ typedef struct { char resname[8]; /**< required residue name string */ int resid; /**< required integer residue ID */ char segid[8]; /**< required segment name string, or "" */ +#if 0 && vmdplugin_ABIVERSION > 17 + /* The new PDB file formats allows for much larger structures, */ + /* which can therefore require longer chain ID strings. The */ + /* new PDBx/mmCIF file formats do not have length limits on */ + /* fields, so PDB chains could be arbitrarily long strings */ + /* in such files. At present, we know we need at least 3-char */ + /* chains for existing PDBx/mmCIF files. */ + char chain[4]; /**< required chain name, or "" */ +#else char chain[2]; /**< required chain name, or "" */ - +#endif /* rest are optional; use optflags to specify what's present */ char altloc[2]; /**< optional PDB alternate location code */ char insertion[2]; /**< optional PDB insertion code */ @@ -107,6 +131,23 @@ typedef struct { float charge; /**< optional charge value */ float radius; /**< optional radius value */ int atomicnumber; /**< optional element atomic number */ + +#if 0 + char complex[16]; + char assembly[16]; + int qmregion; + int qmregionlink; + int qmlayer; + int qmlayerlink; + int qmfrag; + int qmfraglink; + string qmecp; + int qmadapt; + int qmect; /**< boolean */ + int qmparam; + int autoparam; +#endif + #if defined(DESRES_CTNUMBER) int ctnumber; /**< mae ct block, 0-based, including meta */ #endif @@ -128,7 +169,7 @@ typedef struct { #define MOLFILE_CTNUMBER 0x0200 /**< ctnumber provided */ #endif #define MOLFILE_BADOPTIONS 0xFFFFFFFF /**< Detect badly behaved plugins */ - + /*@}*/ /*@{*/ @@ -140,38 +181,32 @@ typedef struct { #define MOLFILE_QMTS_SCFITER 0x0002 /*@}*/ -#if vmdplugin_ABIVERSION > 10 typedef struct molfile_timestep_metadata { unsigned int count; /**< total # timesteps; -1 if unknown */ unsigned int avg_bytes_per_timestep; /** bytes per timestep */ int has_velocities; /**< if timesteps have velocities */ } molfile_timestep_metadata_t; -#endif /* * Per-timestep atom coordinates and periodic cell information - */ + */ typedef struct { float *coords; /**< coordinates of all atoms, arranged xyzxyzxyz */ -#if vmdplugin_ABIVERSION > 10 float *velocities; /**< space for velocities of all atoms; same layout */ /**< NULL unless has_velocities is set */ -#endif - /*@{*/ + /*@{*/ /** * Unit cell specification of the form A, B, C, alpha, beta, gamma. * notes: A, B, C are side lengths of the unit cell * alpha = angle between b and c * beta = angle between a and c * gamma = angle between a and b - */ - float A, B, C, alpha, beta, gamma; - /*@}*/ + */ + float A, B, C, alpha, beta, gamma; + /*@}*/ -#if vmdplugin_ABIVERSION > 10 double physical_time; /**< physical time point associated with this frame */ -#endif #if defined(DESRES_READ_TIMESTEP2) /* HACK to support generic trajectory information */ @@ -188,7 +223,7 @@ typedef struct { /** * Metadata for volumetric datasets, read initially and used for subsequent - * memory allocations and file loading. + * memory allocations and file loading. */ typedef struct { char dataname[256]; /**< name of volumetric data set */ @@ -198,29 +233,48 @@ typedef struct { * x/y/z axis: * These the three cell sides, providing both direction and length * (not unit vectors) for the x, y, and z axes. In the simplest - * case, these would be <0,size,0> and <0,0,size) for + * case, these would be <0,size,0> and <0,0,size) for * an orthogonal cubic volume set. For other cell shapes these * axes can be oriented non-orthogonally, and the parallelpiped * may have different side lengths, not just a cube/rhombus. */ - float xaxis[3]; /**< direction (and length) for X axis */ + float xaxis[3]; /**< direction (and length) for X axis */ float yaxis[3]; /**< direction (and length) for Y axis */ float zaxis[3]; /**< direction (and length) for Z axis */ /* - * x/y/z size: + * x/y/z size: * Number of grid cells along each axis. This is _not_ the * physical size of the box, this is the number of voxels in each - * direction, independent of the shape of the volume set. + * direction, independent of the shape of the volume set. */ - int xsize; /**< number of grid cells along the X axis */ - int ysize; /**< number of grid cells along the Y axis */ - int zsize; /**< number of grid cells along the Z axis */ + int xsize; /**< number of grid cells along the X axis */ + int ysize; /**< number of grid cells along the Y axis */ + int zsize; /**< number of grid cells along the Z axis */ - int has_color; /**< flag indicating presence of voxel color data */ +#if vmdplugin_ABIVERSION > 16 + int has_scalar; /**< flag indicating presence of scalar volume */ + int has_gradient; /**< flag indicating presence of vector volume */ + int has_variance; /**< flag indicating presence of variance map */ +#endif + int has_color; /**< flag indicating presence of voxel color data */ } molfile_volumetric_t; +#if vmdplugin_ABIVERSION > 16 +/** + * Volumetric dataset read/write structure with both flag/parameter sets + * and VMD-allocated pointers for fields to be used by the plugin. + */ +typedef struct { + int setidx; /**< volumetric dataset index to load/save */ + float *scalar; /**< scalar density/potential field data */ + float *gradient; /**< gradient vector field */ + float *variance; /**< variance map indicating signal/noise */ + float *rgb3f; /**< RGB floating point color texture map */ + unsigned char *rgb3u; /**< RGB unsigned byte color texture map */ +} molfile_volumetric_readwrite_t; +#endif /************************************************************** @@ -231,9 +285,6 @@ typedef struct { ************************************************************** **************************************************************/ -#if vmdplugin_ABIVERSION > 9 - - /* macros for the convergence status of a QM calculation. */ #define MOLFILE_QMSTATUS_UNKNOWN -1 /* don't know yet */ #define MOLFILE_QMSTATUS_OPT_CONV 0 /* optimization converged */ @@ -297,10 +348,10 @@ typedef struct { /** * QM run info. Parameters that stay unchanged during a single file. - */ + */ typedef struct { int nproc; /**< number of processors used. */ - int memory; /**< amount of memory used in Mbyte. */ + int memory; /**< amount of memory used in Mbyte. */ int runtype; /**< flag indicating the calculation method. */ int scftype; /**< SCF type: RHF, UHF, ROHF, GVB or MCSCF wfn. */ int status; /**< indicates wether SCF and geometry optimization @@ -333,9 +384,9 @@ typedef struct { * array size = 2*num_basis_funcs * The basis must NOT be normalized. */ int *atomic_number; /**< atomic numbers (chem. element) of atoms in basis set */ - int *angular_momentum; /**< 3 ints per wave function coefficient do describe the + int *angular_momentum; /**< 3 ints per wave function coefficient do describe the * cartesian components of the angular momentum. - * E.g. S={0 0 0}, Px={1 0 0}, Dxy={1 1 0}, or Fyyz={0 2 1}. + * E.g. S={0 0 0}, Px={1 0 0}, Dxy={1 1 0}, or Fyyz={0 2 1}. */ int *shell_types; /**< type for each shell in basis */ } molfile_qm_basis_t; @@ -409,9 +460,9 @@ enum molfile_qm_wavefunc_type { MOLFILE_WAVE_MCSCFNAT, MOLFILE_WAVE_MCSCFOPT, MOLFILE_WAVE_CINATUR, MOLFILE_WAVE_PIPEK, MOLFILE_WAVE_BOYS, MOLFILE_WAVE_RUEDEN, - MOLFILE_WAVE_NAO, MOLFILE_WAVE_PNAO, MOLFILE_WAVE_NHO, - MOLFILE_WAVE_PNHO, MOLFILE_WAVE_NBO, MOLFILE_WAVE_PNBO, - MOLFILE_WAVE_PNLMO, MOLFILE_WAVE_NLMO, MOLFILE_WAVE_MOAO, + MOLFILE_WAVE_NAO, MOLFILE_WAVE_PNAO, MOLFILE_WAVE_NHO, + MOLFILE_WAVE_PNHO, MOLFILE_WAVE_NBO, MOLFILE_WAVE_PNBO, + MOLFILE_WAVE_PNLMO, MOLFILE_WAVE_NLMO, MOLFILE_WAVE_MOAO, MOLFILE_WAVE_NATO, MOLFILE_WAVE_UNKNOWN }; @@ -442,7 +493,7 @@ typedef struct molfile_qm_timestep_metadata { int has_orben_per_wavef[MOLFILE_MAXWAVEPERTS]; /**< orbital energy flags */ int has_occup_per_wavef[MOLFILE_MAXWAVEPERTS]; /**< orbital occupancy flags */ int num_wavef ; /**< # wavefunctions in this ts */ - int wavef_size; /**< size of one wavefunction + int wavef_size; /**< size of one wavefunction * (# of gaussian basis fctns) */ int num_charge_sets; /**< # of charge values per atom */ } molfile_qm_timestep_metadata_t; @@ -485,8 +536,6 @@ typedef struct { } molfile_qm_timestep_t; -#endif - /************************************************************** **************************************************************/ @@ -498,14 +547,14 @@ typedef struct { * from graphics file reader plugins. */ enum molfile_graphics_type { - MOLFILE_POINT, MOLFILE_TRIANGLE, MOLFILE_TRINORM, MOLFILE_NORMS, - MOLFILE_LINE, MOLFILE_CYLINDER, MOLFILE_CAPCYL, MOLFILE_CONE, + MOLFILE_POINT, MOLFILE_TRIANGLE, MOLFILE_TRINORM, MOLFILE_NORMS, + MOLFILE_LINE, MOLFILE_CYLINDER, MOLFILE_CAPCYL, MOLFILE_CONE, MOLFILE_SPHERE, MOLFILE_TEXT, MOLFILE_COLOR, MOLFILE_TRICOLOR }; /** * Individual graphics object/element data - */ + */ typedef struct { int type; /* One of molfile_graphics_type */ int style; /* A general style parameter */ @@ -521,13 +570,13 @@ typedef struct { type data style size ---- ---- ----- ---- point x, y, z pixel size -triangle x1,y1,z1,x2,y2,z2,x3,y3,z3 -trinorm x1,y1,z1,x2,y2,z2,x3,y3,z3 +triangle x1,y1,z1,x2,y2,z2,x3,y3,z3 +trinorm x1,y1,z1,x2,y2,z2,x3,y3,z3 the next array element must be NORMS -tricolor x1,y1,z1,x2,y2,z2,x3,y3,z3 +tricolor x1,y1,z1,x2,y2,z2,x3,y3,z3 the next array elements must be NORMS the following element must be COLOR, with three RGB triples -norms x1,y1,z1,x2,y2,z2,x3,y3,z3 +norms x1,y1,z1,x2,y2,z2,x3,y3,z3 line x1,y1,z1,x2,y2,z2 0=solid pixel width 1=stippled cylinder x1,y1,z1,x2,y2,z2 resolution radius @@ -541,41 +590,41 @@ color r, g, b /** * Main file reader API. Any function in this struct may be NULL * if not implemented by the plugin; the application checks this to determine - * what functionality is present in the plugin. - */ + * what functionality is present in the plugin. + */ typedef struct { /** - * Required header + * Required header */ vmdplugin_HEAD /** - * Filename extension for this file type. May be NULL if no filename + * Filename extension for this file type. May be NULL if no filename * extension exists and/or is known. For file types that match several * common extensions, list them in a comma separated list such as: * "pdb,ent,foo,bar,baz,ban" * The comma separated list will be expanded when filename extension matching * is performed. If multiple plugins solicit the same filename extensions, - * the one that lists the extension earliest in its list is selected. In the + * the one that lists the extension earliest in its list is selected. In the * case of a "tie", the first one tried/checked "wins". */ const char *filename_extension; /** * Try to open the file for reading. Return an opaque handle, or NULL on - * failure. Set the number of atoms; if the number of atoms cannot be - * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. + * failure. Set the number of atoms; if the number of atoms cannot be + * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. * Filetype should be the name under which this plugin was registered; * this is provided so that plugins can provide the same function pointer * to handle multiple file types. */ - void *(* open_file_read)(const char *filepath, const char *filetype, + void *(* open_file_read)(const char *filepath, const char *filetype, int *natoms); - + /** * Read molecular structure from the given file handle. atoms is allocated * by the caller and points to space for natoms. - * On success, place atom information in the passed-in pointer. + * On success, place atom information in the passed-in pointer. * optflags specifies which optional fields in the atoms will be set by * the plugin. */ @@ -587,15 +636,15 @@ typedef struct { * Each unique bond should be specified only once, so file formats that list * bonds twice will need post-processing before the results are returned to * the caller. - * If the plugin provides bond information, but the file loaded doesn't + * If the plugin provides bond information, but the file loaded doesn't * actually contain any bond info, the nbonds parameter should be * set to 0 and from/to should be set to NULL to indicate that no bond * information was actually present, and automatic bond search should be - * performed. + * performed. * * If the plugin provides bond order information, the bondorder array * will contain the bond order for each from/to pair. If not, the bondorder - * pointer should be set to NULL, in which case the caller will provide a + * pointer should be set to NULL, in which case the caller will provide a * default bond order value of 1.0. * * If the plugin provides bond type information, the bondtype array @@ -606,27 +655,23 @@ typedef struct { * and consistency checking. * * These arrays must be freed by the plugin in the close_file_read function. - * This function can be called only after read_structure(). - * Return MOLFILE_SUCCESS if no errors occur. + * This function can be called only after read_structure(). + * Return MOLFILE_SUCCESS if no errors occur. */ -#if vmdplugin_ABIVERSION > 14 - int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder, + int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder, int **bondtype, int *nbondtypes, char ***bondtypename); -#else - int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder); -#endif /** - * XXX this function will be augmented and possibly superceded by a + * XXX this function will be augmented and possibly superceded by a * new QM-capable version named read_timestep(), when finished. * - * Read the next timestep from the file. Return MOLFILE_SUCCESS, or - * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then - * the frame should be skipped. Otherwise, the application must prepare - * molfile_timestep_t by allocating space in coords for the corresponding - * number of coordinates. - * The natoms parameter exists because some coordinate file formats - * (like CRD) cannot determine for themselves how many atoms are in a + * Read the next timestep from the file. Return MOLFILE_SUCCESS, or + * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then + * the frame should be skipped. Otherwise, the application must prepare + * molfile_timestep_t by allocating space in coords for the corresponding + * number of coordinates. + * The natoms parameter exists because some coordinate file formats + * (like CRD) cannot determine for themselves how many atoms are in a * timestep; the app must therefore obtain this information elsewhere * and provide it to the plugin. */ @@ -636,16 +681,16 @@ typedef struct { * Close the file and release all data. The handle cannot be reused. */ void (* close_file_read)(void *); - + /** * Open a coordinate file for writing using the given header information. * Return an opaque handle, or NULL on failure. The application must - * specify the number of atoms to be written. + * specify the number of atoms to be written. * filetype should be the name under which this plugin was registered. */ - void *(* open_file_write)(const char *filepath, const char *filetype, + void *(* open_file_write)(const char *filepath, const char *filetype, int natoms); - + /** * Write structure information. Return success. */ @@ -653,12 +698,12 @@ typedef struct { /** * Write a timestep to the coordinate file. Return MOLFILE_SUCCESS if no - * errors occur. If the file contains structure information in each - * timestep (like a multi-entry PDB), it will have to cache the information + * errors occur. If the file contains structure information in each + * timestep (like a multi-entry PDB), it will have to cache the information * from the initial calls from write_structure. */ int (* write_timestep)(void *, const molfile_timestep_t *); - + /** * Close the file and release all data. The handle cannot be reused. */ @@ -671,24 +716,27 @@ typedef struct { * the plugin and should be freed by close_file_read(). The application * may call this function any number of times. */ - int (* read_volumetric_metadata)(void *, int *nsets, + int (* read_volumetric_metadata)(void *, int *nsets, molfile_volumetric_t **metadata); - /** - * Read the specified volumetric data set into the space pointed to by - * datablock. The set is specified with a zero-based index. The space + /** + * Read the specified volumetric data set into the space pointed to by + * datablock. The set is specified with a zero-based index. The space * allocated for the datablock must be equal to - * xsize * ysize * zsize. No space will be allocated for colorblock + * xsize * ysize * zsize. No space will be allocated for colorblock * unless has_color is nonzero; in that case, colorblock should be * filled in with three RGB floats per datapoint. */ - int (* read_volumetric_data)(void *, int set, float *datablock, + int (* read_volumetric_data)(void *, int set, float *datablock, float *colorblock); +#if vmdplugin_ABIVERSION > 16 + int (* read_volumetric_data_ex)(void *, molfile_volumetric_readwrite_t *v); +#endif /** * Read raw graphics data stored in this file. Return the number of data - * elements and the data itself as an array of molfile_graphics_t in the - * pointer provided by the application. The plugin is responsible for + * elements and the data itself as an array of molfile_graphics_t in the + * pointer provided by the application. The plugin is responsible for * freeing the data when the file is closed. */ int (* read_rawgraphics)(void *, int *nelem, const molfile_graphics_t **data); @@ -698,19 +746,19 @@ typedef struct { * came from, what the accession code for the database is, textual remarks * and other notes pertaining to the contained structure/trajectory/volume * and anything else that's informative at the whole file level. - */ + */ int (* read_molecule_metadata)(void *, molfile_metadata_t **metadata); - + /** * Write bond information for the molecule. The arrays from * and to point to the (one-based) indices of bonded atoms. - * Each unique bond will be specified only once by the caller. - * File formats that list bonds twice will need to emit both the + * Each unique bond will be specified only once by the caller. + * File formats that list bonds twice will need to emit both the * from/to and to/from versions of each. - * This function must be called before write_structure(). + * This function must be called before write_structure(). * * Like the read_bonds() routine, the bondorder pointer is set to NULL - * if the caller doesn't have such information, in which case the + * if the caller doesn't have such information, in which case the * plugin should assume a bond order of 1.0 if the file format requires * bond order information. * @@ -721,76 +769,47 @@ typedef struct { * scheme is different from the index numbers. * if the pointers are set to NULL, then this information is not available. * bondtypenames can only be used of bondtypes is also given. - * Return MOLFILE_SUCCESS if no errors occur. + * Return MOLFILE_SUCCESS if no errors occur. */ -#if vmdplugin_ABIVERSION > 14 - int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder, + int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder, int *bondtype, int nbondtypes, char **bondtypename); -#else - int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder); -#endif -#if vmdplugin_ABIVERSION > 9 /** - * Write the specified volumetric data set into the space pointed to by + * Write the specified volumetric data set into the space pointed to by * datablock. The * allocated for the datablock must be equal to - * xsize * ysize * zsize. No space will be allocated for colorblock + * xsize * ysize * zsize. No space will be allocated for colorblock * unless has_color is nonzero; in that case, colorblock should be * filled in with three RGB floats per datapoint. */ int (* write_volumetric_data)(void *, molfile_volumetric_t *metadata, float *datablock, float *colorblock); +#if vmdplugin_ABIVERSION > 16 + int (* write_volumetric_data_ex)(void *, molfile_volumetric_t *metadata, + molfile_volumetric_readwrite_t *v); +#endif -#if vmdplugin_ABIVERSION > 15 - /** + /** * Read in Angles, Dihedrals, Impropers, and Cross Terms and optionally types. - * (Cross terms pertain to the CHARMM/NAMD CMAP feature) + * (Cross terms pertain to the CHARMM/NAMD CMAP feature) */ int (* read_angles)(void *handle, int *numangles, int **angles, int **angletypes, int *numangletypes, char ***angletypenames, int *numdihedrals, int **dihedrals, int **dihedraltypes, int *numdihedraltypes, - char ***dihedraltypenames, int *numimpropers, int **impropers, + char ***dihedraltypenames, int *numimpropers, int **impropers, int **impropertypes, int *numimpropertypes, char ***impropertypenames, int *numcterms, int **cterms, int *ctermcols, int *ctermrows); - /** + /** * Write out Angles, Dihedrals, Impropers, and Cross Terms - * (Cross terms pertain to the CHARMM/NAMD CMAP feature) + * (Cross terms pertain to the CHARMM/NAMD CMAP feature) */ int (* write_angles)(void *handle, int numangles, const int *angles, const int *angletypes, int numangletypes, const char **angletypenames, int numdihedrals, const int *dihedrals, const int *dihedraltypes, int numdihedraltypes, - const char **dihedraltypenames, int numimpropers, + const char **dihedraltypenames, int numimpropers, const int *impropers, const int *impropertypes, int numimpropertypes, - const char **impropertypenames, int numcterms, const int *cterms, + const char **impropertypenames, int numcterms, const int *cterms, int ctermcols, int ctermrows); -#else - /** - * Read in Angles, Dihedrals, Impropers, and Cross Terms - * Forces are in Kcal/mol - * (Cross terms pertain to the CHARMM/NAMD CMAP feature, forces are given - * as a 2-D matrix) - */ - int (* read_angles)(void *, - int *numangles, int **angles, double **angleforces, - int *numdihedrals, int **dihedrals, double **dihedralforces, - int *numimpropers, int **impropers, double **improperforces, - int *numcterms, int **cterms, - int *ctermcols, int *ctermrows, double **ctermforces); - - /** - * Write out Angles, Dihedrals, Impropers, and Cross Terms - * Forces are in Kcal/mol - * (Cross terms pertain to the CHARMM/NAMD CMAP feature, forces are given - * as a 2-D matrix) - */ - int (* write_angles)(void *, - int numangles, const int *angles, const double *angleforces, - int numdihedrals, const int *dihedrals, const double *dihedralforces, - int numimpropers, const int *impropers, const double *improperforces, - int numcterms, const int *cterms, - int ctermcols, int ctermrows, const double *ctermforces); -#endif /** @@ -798,7 +817,7 @@ typedef struct { * QM datasets in this file. * * The metadata are the sizes of the QM related data structure - * arrays that will be populated by the plugin when + * arrays that will be populated by the plugin when * read_qm_rundata() is called. Since the allocation of these * arrays is done by VMD rather than the plugin, VMD needs to * know the sizes beforehand. Consequently read_qm_metadata() @@ -811,7 +830,7 @@ typedef struct { * Read timestep independent QM data. * * Typical data that are defined only once per trajectory are - * general info about the calculation (such as the used method), + * general info about the calculation (such as the used method), * the basis set and normal modes. * The data structures to be populated must have been allocated * before by VMD according to sizes obtained through @@ -821,32 +840,27 @@ typedef struct { /** - * Read the next timestep from the file. Return MOLFILE_SUCCESS, or + * Read the next timestep from the file. Return MOLFILE_SUCCESS, or * MOLFILE_EOF on EOF. If the molfile_timestep_t or molfile_qm_metadata_t - * arguments are NULL, then the coordinate or qm data should be skipped. - * Otherwise, the application must prepare molfile_timestep_t and - * molfile_qm_timestep_t by allocating space for the corresponding + * arguments are NULL, then the coordinate or qm data should be skipped. + * Otherwise, the application must prepare molfile_timestep_t and + * molfile_qm_timestep_t by allocating space for the corresponding * number of coordinates, orbital wavefunction coefficients, etc. - * Since it is common for users to want to load only the final timestep + * Since it is common for users to want to load only the final timestep * data from a QM run, the application may provide any combination of - * valid, or NULL pointers for the molfile_timestep_t and + * valid, or NULL pointers for the molfile_timestep_t and * molfile_qm_timestep_t parameters, depending on what information the * user is interested in. - * The natoms and qm metadata parameters exist because some file formats - * cannot determine for themselves how many atoms etc are in a + * The natoms and qm metadata parameters exist because some file formats + * cannot determine for themselves how many atoms etc are in a * timestep; the app must therefore obtain this information elsewhere * and provide it to the plugin. */ int (* read_timestep)(void *, int natoms, molfile_timestep_t *, molfile_qm_metadata_t *, molfile_qm_timestep_t *); -#endif -#if vmdplugin_ABIVERSION > 10 int (* read_timestep_metadata)(void *, molfile_timestep_metadata_t *); -#endif -#if vmdplugin_ABIVERSION > 11 int (* read_qm_timestep_metadata)(void *, molfile_qm_timestep_metadata_t *); -#endif #if defined(DESRES_READ_TIMESTEP2) /** @@ -864,7 +878,6 @@ typedef struct { double * times ); #endif -#if vmdplugin_ABIVERSION > 13 /** * Console output, READ-ONLY function pointer. * Function pointer that plugins can use for printing to the host @@ -883,8 +896,8 @@ typedef struct { * application-provided services */ int (* cons_fputs)(const int, const char*); -#endif } molfile_plugin_t; #endif + From 3d3d1061d330398bd4f534f1b55ce7560146b91b Mon Sep 17 00:00:00 2001 From: ketankhare Date: Mon, 10 Apr 2017 18:41:36 -0400 Subject: [PATCH 03/20] README for updated header files from VMD 1.9.3 --- src/USER-MOLFILE/README | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/USER-MOLFILE/README b/src/USER-MOLFILE/README index f6defed6ae..9a2833365d 100644 --- a/src/USER-MOLFILE/README +++ b/src/USER-MOLFILE/README @@ -28,8 +28,7 @@ taken from. These header files can be found inside the VMD installation tree under: "plugins/include". For convenience, this package includes a set of header files that is -compatible with VMD 1.9 and 1.9.1 (the current version in June 2012) -and should be compilable with VMD versions back to about version 1.8.4 +compatible with VMD 1.9.3 (the current version in April 2017) The person who created this package is Axel Kohlmeyer at Temple U (akohlmey at gmail.com). Contact him directly if you have questions. From dd90c860ee622a612e0002ff63e79d6f59808268 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Apr 2017 17:40:21 -0400 Subject: [PATCH 04/20] refactor msi2lmp documentation to emphasize lack of active development - put a note into the manual - reorder contents of the README file - request for information should be sent to lammps-users - add list of known missing features --- doc/src/Section_tools.txt | 9 +- tools/msi2lmp/README | 271 ++++++++++++++++++++------------------ 2 files changed, 148 insertions(+), 132 deletions(-) diff --git a/doc/src/Section_tools.txt b/doc/src/Section_tools.txt index 03611c7cdb..d95c4f0cd4 100644 --- a/doc/src/Section_tools.txt +++ b/doc/src/Section_tools.txt @@ -369,15 +369,18 @@ supports it. It has its own WWW page at msi2lmp tool :h4,link(msi) -The msi2lmp sub-directory contains a tool for creating LAMMPS input -data files from BIOVIA's Materias Studio files (formerly Accelrys' +The msi2lmp sub-directory contains a tool for creating LAMMPS template +input and data files from BIOVIA's Materias Studio files (formerly Accelrys' Insight MD code, formerly MSI/Biosym and its Discover MD code). This tool was written by John Carpenter (Cray), Michael Peachey (Cray), and Steve Lustig (Dupont). Several people contributed changes to remove bugs and adapt its output to changes in LAMMPS. -See the README file for more information. +This tool has several known limitations and is no longer under active +development, so there are no changes except for the occasional bugfix. + +See the README file in the tools/msi2lmp folder for more information. :line diff --git a/tools/msi2lmp/README b/tools/msi2lmp/README index a20f6e893f..db9b1aca5e 100644 --- a/tools/msi2lmp/README +++ b/tools/msi2lmp/README @@ -1,98 +1,50 @@ -Axel Kohlmeyer is the current maintainer of the msi2lmp tool. -Please send any inquiries about msi2lmp to the lammps-users mailing list. -06 Oct 2016 Axel Kohlmeyer + msi2lmp.exe -Improved whitespace handling in parsing topology and force field -files to avoid bogus warnings about type name truncation. +This code has several known limitations listed below under "LIMITATIONS" +(and possibly some unknown ones, too) and is no longer under active +development. Only the occasional bugfix is applied. -24 Oct 2015 Axel Kohlmeyer +Please send any inquiries about msi2lmp to the lammps-users +mailing list and not to individual people. -Added check to make certain that force field files -are consistent with the notation of non-bonded parameters -that the msi2lmp code expects. For Class 1 and OPLS-AA -the A-B notation with geometric mixing is expected and for -Class 2 the r-eps notation with sixthpower mixing. +------------------------------------------------------------------------ -11 Sep 2014 Axel Kohlmeyer +OVERVIEW -Refactored ReadMdfFile.c so it more consistently honors -the MAX_NAME and MAX_STRING string length defines and -potentially handles inputs with long names better. +This is the third version of a program that generates a LAMMPS data file +based on the information in MSI .car (atom coordinates), .mdf (molecular +topology) and .frc (forcefield) files. The .car and .mdf files are +specific to a molecular system while the .frc file is specific to a +forcefield version. The only coherency needed between .frc and +.car/.mdf files are the atom types. -27 May 2014 Axel Kohlmeyer +The first version was written by Steve Lustig at Dupont, but required +using Discover to derive internal coordinates and forcefield parameters -Added TopoTools style type hints as comments to all Mass, PairCoeff, -BondCoeff, AngleCoeff, DihedralCoeff, ImproperCoeff entries. -This should make it easier to identify force field entries with -the structure and force field map in the data file later. +The second version was written by Michael Peachey while an intern in the +Cray Chemistry Applications Group managed by John Carpenter. This +version derived internal coordinates from the mdf file and looked up +parameters in the frc file thus eliminating the need for Discover. -06 Mar 2014 Axel Kohlmeyer +The third version was written by John Carpenter to optimize the +performance of the program for large molecular systems (the original +code for deriving atom numbers was quadratic in time) and to make the +program fully dynamic. The second version used fixed dimension arrays +for the internal coordinates. -Fixed a bug in handling of triclinic cells, where the matrices to -convert to and from fractional coordinates were incorrectly built. +The third version was revised in Fall 2011 by Stephanie Teich-McGoldrick +to add support non-orthogonal cells. -26 Oct 2013 Axel Kohlmeyer +The next revision was started in Summer/Fall 2013 by Axel Kohlmeyer to +improve portability to Windows compilers, clean up command line parsing +and improve compatibility with the then current LAMMPS versions. This +revision removes compatibility with the obsolete LAMMPS version written +in Fortran 90. -Implemented writing out force field style hints in generated data -files for improved consistency checking when reading those files. -Also added writing out CGCMM style comments to identify atom types. +INSTALLATION & USAGE -08 Oct 2013 Axel Kohlmeyer - -Fixed a memory access violation with Class 2 force fields. -Free all allocated memory to better detection of memory errors. -Print out version number and data with all print levels > 0. -Added valgrind checks to the regression tests - -08 Oct 2013 Axel Kohlmeyer - -Fixed a memory access violation with Class 2 force fields. -Free all allocated memory to better detection of memory errors. -Print out version number and data with all print levels > 0. -Added valgrind checks to the regression tests - -02 Aug 2013 Axel Kohlmeyer - -Added rudimentary support for OPLS-AA based on -input provided by jeff greathouse. - -18 Jul 2013 Axel Kohlmeyer - -Added support for writing out image flags -Improved accuracy of atom masses -Added flag for shifting the entire system -Fixed some minor logic bugs and prepared -for supporting other force fields and morse style bonds. - -12 Jul 2013 Axel Kohlmeyer - -Fixed the bug that caused improper coefficients to be wrong -Cleaned up the handling of box parameters and center the box -by default around the system/molecule. Added a flag to make -this step optional and center the box around the origin instead. -Added a regression test script with examples. - -1 Jul 2013 Axel Kohlmeyer - -Cleanup and improved port to windows. -Removed some more static string limits. -Added print level 3 for additional output. -Make code stop at missing force field parameters -and added -i flag to override this. -Safer argument checking. -Provide short versions for all flags. - -23 Sep 2011 - -added support for triclinic boxes -see msi2lmp/TriclinicModification.pdf doc for details - ------------------------------ - - msi2lmp V3.6 4/10/2005 - - This program uses the .car and .mdf files from MSI/Biosyms's INSIGHT +This program uses the .car and .mdf files from MSI/Biosyms's INSIGHT program to produce a LAMMPS data file. 1. Building msi2lmp @@ -178,50 +130,111 @@ see msi2lmp/TriclinicModification.pdf doc for details -- the LAMMPS data file is written to .data protocol and error information is written to the screen. -**************************************************************** -* -* msi2lmp -* -* This is the third version of a program that generates a LAMMPS -* data file based on the information in MSI .car (atom -* coordinates), .mdf (molecular topology) and .frc (forcefield) -* files. The .car and .mdf files are specific to a molecular -* system while the .frc file is specific to a forcefield version. -* The only coherency needed between .frc and .car/.mdf files are -* the atom types. -* -* The first version was written by Steve Lustig at Dupont, but -* required using Discover to derive internal coordinates and -* forcefield parameters -* -* The second version was written by Michael Peachey while an -* intern in the Cray Chemistry Applications Group managed -* by John Carpenter. This version derived internal coordinates -* from the mdf file and looked up parameters in the frc file -* thus eliminating the need for Discover. -* -* The third version was written by John Carpenter to optimize -* the performance of the program for large molecular systems -* (the original code for deriving atom numbers was quadratic in time) -* and to make the program fully dynamic. The second version used -* fixed dimension arrays for the internal coordinates. -* -* The current maintainer is only reluctantly doing so because John Mayo no longer -* needs this code. -* -* V3.2 corresponds to adding code to MakeLists.c to gracefully deal with -* systems that may only be molecules of 1 to 3 atoms. In V3.1, the values -* for number_of_dihedrals, etc. could be unpredictable in these systems. -* -* V3.3 was generated in response to a strange error reading a MDF file generated by -* Accelys' Materials Studio GUI. Simply rewriting the input part of ReadMdfFile.c -* seems to have fixed the problem. -* -* V3.4 and V3.5 are minor upgrades to fix bugs associated mostly with .car and .mdf files -* written by Accelys' Materials Studio GUI. -* -* V3.6 outputs to LAMMPS 2005 (C++ version). -* -* Contact: Kelly L. Anderson, kelly.anderson@cantab.net -* -* April 2005 +------------------------------------------------------------------------ + +LIMITATIONS + +msi2lmp has the following known limitations: + +- there is no support to select morse bonds over harmonic bonds +- there is no support for auto-equivalences to supplement fully + parameterized interactions with heuristic ones +- there is no support for bond increments + +------------------------------------------------------------------------ + +CHANGELOG + +06 Oct 2016 Axel Kohlmeyer + +Improved whitespace handling in parsing topology and force field +files to avoid bogus warnings about type name truncation. + +24 Oct 2015 Axel Kohlmeyer + +Added check to make certain that force field files are consistent with +the notation of non-bonded parameters that the msi2lmp code expects. +For Class 1 and OPLS-AA the A-B notation with geometric mixing is +expected and for Class 2 the r-eps notation with sixthpower mixing. + +11 Sep 2014 Axel Kohlmeyer + +Refactored ReadMdfFile.c so it more consistently honors the MAX_NAME +and MAX_STRING string length defines and potentially handles inputs +with long names better. + +27 May 2014 Axel Kohlmeyer + +Added TopoTools style type hints as comments to all Mass, PairCoeff, +BondCoeff, AngleCoeff, DihedralCoeff, ImproperCoeff entries. +This should make it easier to identify force field entries with +the structure and force field map in the data file later. + +06 Mar 2014 Axel Kohlmeyer + +Fixed a bug in handling of triclinic cells, where the matrices to +convert to and from fractional coordinates were incorrectly built. + +26 Oct 2013 Axel Kohlmeyer + +Implemented writing out force field style hints in generated data +files for improved consistency checking when reading those files. +Also added writing out CGCMM style comments to identify atom types. + +08 Oct 2013 Axel Kohlmeyer + +Fixed a memory access violation with Class 2 force fields. Free all +allocated memory to better detection of memory errors. Print out +version number and data with all print levels > 0. Added valgrind +checks to the regression tests. + +02 Aug 2013 Axel Kohlmeyer + +Added rudimentary support for OPLS-AA based on input provided +by jeff greathouse. + +18 Jul 2013 Axel Kohlmeyer + +Added support for writing out image flags. Improved accuracy of atom +masses. Added flag for shifting the entire system. Fixed some minor +logic bugs and prepared for supporting other force fields and morse +style bonds. + +12 Jul 2013 Axel Kohlmeyer + +Fixed the bug that caused improper coefficients to be wrong. Cleaned up +the handling of box parameters and center the box by default around the +system/molecule. Added a flag to make this step optional and center the +box around the origin instead. Added a regression test script with +examples. + +1 Jul 2013 Axel Kohlmeyer + +Cleanup and improved port to windows. Removed some more static string +limits. Added print level 3 for additional output. Make code stop at +missing force field parameters and added -i flag to override this. +Safer argument checking. Provide short versions for all flags. + +23 Sep 2011 + +added support for triclinic boxes + +V3.6 outputs to LAMMPS 2005 (C++ version). + +Contact: Kelly L. Anderson, kelly.anderson@cantab.net + +V3.4 and V3.5 are minor upgrades to fix bugs associated mostly with .car + and .mdf files written by Accelys' Materials Studio GUI. April 2005 + +V3.3 was generated in response to a strange error reading a MDF file +generated by Accelys' Materials Studio GUI. Simply rewriting the input +part of ReadMdfFile.c seems to have fixed the problem. + +V3.2 corresponds to adding code to MakeLists.c to gracefully deal with +systems that may only be molecules of 1 to 3 atoms. In V3.1, the values +for number_of_dihedrals, etc. could be unpredictable in these systems. + +----------------------------- + + msi2lmp v3.9.8 6/10/2016 + From dec36e9bfe887b5097958fbd76c789bc703b5938 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Apr 2017 17:40:57 -0400 Subject: [PATCH 05/20] fix typos and remove trailing whitespace --- tools/msi2lmp/src/GetParameters.c | 2 +- tools/msi2lmp/src/InitializeItems.c | 2 +- tools/msi2lmp/src/WriteDataFile.c | 2 +- tools/msi2lmp/src/msi2lmp.c | 7 ++----- tools/msi2lmp/src/msi2lmp.h | 4 ++-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/msi2lmp/src/GetParameters.c b/tools/msi2lmp/src/GetParameters.c index e183c529e0..192b4d296c 100644 --- a/tools/msi2lmp/src/GetParameters.c +++ b/tools/msi2lmp/src/GetParameters.c @@ -136,7 +136,7 @@ void GetParameters() if (forcefield & (FF_TYPE_CLASS1|FF_TYPE_OPLSAA)) { bondtypes[i].params[0] = ff_bond.data[k].ff_param[1]; bondtypes[i].params[1] = ff_bond.data[k].ff_param[0]; - } + } if (forcefield & FF_TYPE_CLASS2) { for (j=0; j < 4; j++) diff --git a/tools/msi2lmp/src/InitializeItems.c b/tools/msi2lmp/src/InitializeItems.c index 4df9fd0f10..1e33636913 100644 --- a/tools/msi2lmp/src/InitializeItems.c +++ b/tools/msi2lmp/src/InitializeItems.c @@ -68,7 +68,7 @@ void InitializeItems(void) if (forcefield & (FF_TYPE_CLASS1|FF_TYPE_OPLSAA)) { strcpy(ff_tor.keyword,"#torsion_1"); ff_tor.number_of_parameters = 3; - } + } if (forcefield & FF_TYPE_CLASS2) { strcpy(ff_tor.keyword,"#torsion_3"); diff --git a/tools/msi2lmp/src/WriteDataFile.c b/tools/msi2lmp/src/WriteDataFile.c index 498978406f..c03eba71c5 100644 --- a/tools/msi2lmp/src/WriteDataFile.c +++ b/tools/msi2lmp/src/WriteDataFile.c @@ -144,7 +144,7 @@ void WriteDataFile(char *nameroot) else if (forcefield & FF_TYPE_CLASS2) fputs(" # class2\n\n",DatF); } else fputs("\n\n",DatF); - + for (i=0; i < no_angle_types; i++) { fprintf(DatF, " %3i", i+1); for ( j = 0; j < m; j++) diff --git a/tools/msi2lmp/src/msi2lmp.c b/tools/msi2lmp/src/msi2lmp.c index c94d4b4d73..15cfddd258 100644 --- a/tools/msi2lmp/src/msi2lmp.c +++ b/tools/msi2lmp/src/msi2lmp.c @@ -142,9 +142,6 @@ * and to make the program fully dynamic. The second version used * fixed dimension arrays for the internal coordinates. * -* John Carpenter can be contacted by sending email to -* jec374@earthlink.net -* * November 2000 */ @@ -356,7 +353,7 @@ int main (int argc, char *argv[]) if (centerflag) puts(" Output is recentered around geometrical center"); if (hintflag) puts(" Output contains style flag hints"); else puts(" Style flag hints disabled"); - printf(" System translated by: %g %g %g\n",shift[0],shift[1],shift[2]); + printf(" System translated by: %g %g %g\n",shift[0],shift[1],shift[2]); } n = 0; @@ -374,7 +371,7 @@ int main (int argc, char *argv[]) if (n == 0) { if (iflag > 0) fputs(" WARNING",stderr); else fputs(" Error ",stderr); - + fputs("- forcefield name and class appear to be inconsistent\n\n",stderr); if (iflag == 0) return 7; } diff --git a/tools/msi2lmp/src/msi2lmp.h b/tools/msi2lmp/src/msi2lmp.h index 377ab1a6c3..4716f719d6 100644 --- a/tools/msi2lmp/src/msi2lmp.h +++ b/tools/msi2lmp/src/msi2lmp.h @@ -24,13 +24,13 @@ * and to make the program fully dynamic. The second version used * fixed dimension arrays for the internal coordinates. * -* The thrid version was revised in Fall 2011 by +* The third version was revised in Fall 2011 by * Stephanie Teich-McGoldrick to add support non-orthogonal cells. * * The next revision was started in Summer/Fall 2013 by * Axel Kohlmeyer to improve portability to Windows compilers, * clean up command line parsing and improve compatibility with -* the then current LAMMPS versions. This revision removes +* the then current LAMMPS versions. This revision removes * compatibility with the obsolete LAMMPS version written in Fortran 90. */ From 481927ff16eda37b9bb8f5689f7b1a8323b20c3c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Apr 2017 17:49:49 -0400 Subject: [PATCH 06/20] correct 'thrid' instead of 'third' --- doc/src/python.txt | 2 +- src/USER-MISC/improper_ring.cpp | 2 +- src/USER-OMP/improper_ring_omp.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/python.txt b/doc/src/python.txt index be6d1b215f..69025d791c 100644 --- a/doc/src/python.txt +++ b/doc/src/python.txt @@ -310,7 +310,7 @@ which corresponds to SELF in the python command. The first line of the function imports the Python module lammps.py in the python dir of the distribution. The second line creates a Python object "lmp" which wraps the instance of LAMMPS that called the function. The -"ptr=lmpptr" argument is what makes that happen. The thrid line +"ptr=lmpptr" argument is what makes that happen. The third line invokes the command() function in the LAMMPS library interface. It takes a single string argument which is a LAMMPS input script command for LAMMPS to execute, the same as if it appeared in your input diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index 5a7937e4ee..adf17ed1d5 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -204,7 +204,7 @@ void ImproperRing::compute(int eflag, int vflag) cfact2 = ckjji / ckjkj; cfact3 = ckjji / cjiji; - /* Calculate the force acted on the thrid atom of the angle. */ + /* Calculate the force acted on the third atom of the angle. */ fkx = cfact2 * bvec2x[icomb] - bvec1x[icomb]; fky = cfact2 * bvec2y[icomb] - bvec1y[icomb]; fkz = cfact2 * bvec2z[icomb] - bvec1z[icomb]; diff --git a/src/USER-OMP/improper_ring_omp.cpp b/src/USER-OMP/improper_ring_omp.cpp index bd7593c51a..4eadc83183 100644 --- a/src/USER-OMP/improper_ring_omp.cpp +++ b/src/USER-OMP/improper_ring_omp.cpp @@ -206,7 +206,7 @@ void ImproperRingOMP::eval(int nfrom, int nto, ThrData * const thr) cfact2 = ckjji / ckjkj; cfact3 = ckjji / cjiji; - /* Calculate the force acted on the thrid atom of the angle. */ + /* Calculate the force acted on the third atom of the angle. */ fkx = cfact2 * bvec2x[icomb] - bvec1x[icomb]; fky = cfact2 * bvec2y[icomb] - bvec1y[icomb]; fkz = cfact2 * bvec2z[icomb] - bvec1z[icomb]; From 4bad52f30c8ef9d90c6248c969d1e1abd6adfd8f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 17 Apr 2017 17:52:06 -0400 Subject: [PATCH 07/20] fix typos --- src/QEQ/fix_qeq_point.cpp | 2 +- src/USER-REAXC/fix_qeq_reax.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index 9af70a445a..63d20ad911 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -58,7 +58,7 @@ void FixQEqPoint::init() neighbor->requests[irequest]->full = 1; int ntypes = atom->ntypes; - memory->create(shld,ntypes+1,ntypes+1,"qeq:shileding"); + memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); if (strstr(update->integrate_style,"respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 26cf03f60a..a94ad3e6f3 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -375,7 +375,7 @@ void FixQEqReax::init_shielding() ntypes = atom->ntypes; if (shld == NULL) - memory->create(shld,ntypes+1,ntypes+1,"qeq:shileding"); + memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); for( i = 1; i <= ntypes; ++i ) for( j = 1; j <= ntypes; ++j ) From dee353614420e6170f236a2d6ed6ae9832a783ae Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 18 Apr 2017 11:42:31 -0400 Subject: [PATCH 08/20] update VMD molfile plugin headers and move them to lib/molfile (where they belong) --- lib/molfile/Makefile.lammps | 8 +++++- lib/molfile/README | 27 ++++++++++++++----- .../molfile}/molfile_plugin.h | 0 {src/USER-MOLFILE => lib/molfile}/vmdplugin.h | 0 src/USER-MOLFILE/README | 16 ++--------- 5 files changed, 29 insertions(+), 22 deletions(-) rename {src/USER-MOLFILE => lib/molfile}/molfile_plugin.h (100%) rename {src/USER-MOLFILE => lib/molfile}/vmdplugin.h (100%) diff --git a/lib/molfile/Makefile.lammps b/lib/molfile/Makefile.lammps index 08118991a0..a181f48aec 100644 --- a/lib/molfile/Makefile.lammps +++ b/lib/molfile/Makefile.lammps @@ -6,6 +6,9 @@ # When you build LAMMPS with the USER-MOLFILE package installed, it will # use the 3 settings in this file. They should be set as follows. # +# The molfile_SYSINC setting is to point to the folder with the VMD +# plugin headers. By default it points to bundled headers in this folder +# # The molfile_SYSLIB setting is for a system dynamic loading library # that will be used to load the molfile plugins. It contains functions # like dlopen(), dlsym() and so on for dynamic linking of executable @@ -24,7 +27,10 @@ # Settings that the LAMMPS build will import when this package is installed -molfile_SYSINC = +# change this to -I/path/to/your/lib/vmd/plugins/include if the bundled +# header files are incompatible with your VMD plugsins +molfile_SYSINC =-I../../lib/molfile +# ifneq ($(LIBOBJDIR),/Obj_mingw32) ifneq ($(LIBOBJDIR),/Obj_mingw64) ifneq ($(LIBOBJDIR),/Obj_mingw32-mpi) diff --git a/lib/molfile/README b/lib/molfile/README index 09ea3cc5c6..9e8260c202 100644 --- a/lib/molfile/README +++ b/lib/molfile/README @@ -6,17 +6,30 @@ and write_dump commands in a LAMMPS input script. More information about the VMD molfile plugins can be found at http://www.ks.uiuc.edu/Research/vmd/plugins/molfile. -More specifically, to be able to dynamically load and execute the -plugins from inside LAMMPS, you need to link with a system library -containing functions like dlopen(), dlsym() and so on for dynamic -linking of executable code into an executable. This library is -defined by setting the molfile_SYSLIB variable in the Makefile.lammps -file in this dir. +NOTE: while the programming interface (API) of the VMD molfile plugins +is backward compatible (i.e. you can expect to be able to compile this +package for plugins from newer VMD packages), the binary interface +(ABI) is not. So it is necessary to compile this package with the +VMD molfile plugin header files (vmdplugin.h and molfile_plugin.h) +matching VMD installation that the (binary) plugin files are taken from. +These header files can be found inside the VMD installation tree under +"plugins/include". For convenience, this package includes a set of +header files that is compatible with VMD 1.9.3 (the current version +in April 2017). You need to adjust the molfile_SYSINC variable in the +Makefile.lammps file in this directory, in case you want to use VMD +molfile plugins from a different version. The interface is compatible +with plugins starting from VMD version 1.8.4. + +In order to be able to dynamically load and execute the plugins from +inside LAMMPS, you need to link with a system library containing functions +like dlopen(), dlsym() and so on for dynamic linking of executable code +into an executable. This library is defined by setting the molfile_SYSLIB +variable in the Makefile.lammps file in this dir. For Linux and most current unix-like operating systems, this can be kept at the default setting of "-ldl" (on some platforms this library is called "-ldld"). For compilation on Windows, a slightly different mechanism is used that is part of the Windows programming environment -and this library is not needed. +and this kind of library is not needed. See the header of Makefile.lammps for more info. diff --git a/src/USER-MOLFILE/molfile_plugin.h b/lib/molfile/molfile_plugin.h similarity index 100% rename from src/USER-MOLFILE/molfile_plugin.h rename to lib/molfile/molfile_plugin.h diff --git a/src/USER-MOLFILE/vmdplugin.h b/lib/molfile/vmdplugin.h similarity index 100% rename from src/USER-MOLFILE/vmdplugin.h rename to lib/molfile/vmdplugin.h diff --git a/src/USER-MOLFILE/README b/src/USER-MOLFILE/README index 9a2833365d..4437b587e4 100644 --- a/src/USER-MOLFILE/README +++ b/src/USER-MOLFILE/README @@ -2,8 +2,8 @@ This package provides a C++ interface class to the VMD molfile plugins, http://www.ks.uiuc.edu/Research/vmd/plugins/molfile, and a set of LAMMPS classes that use this interface. -Molfile plugins provide a consistent programming interface to read and -write file formats commonly used in molecular simulations. This +Molfile plugins provide a consistent programming interface to read +and write file formats commonly used in molecular simulations. This package only provides the interface code, not the plugins; these can be taken as precompiled binaries directly from a VMD installation that matches the platform of your LAMMPS executable. Using the plugin @@ -18,17 +18,5 @@ LAMMPS, you need to link with an appropriate system library, which is done using the settings in lib/molfile/Makefile.lammps. See that file and the lib/molfile/README file for more details. -NOTE: while the programming interface (API) to the molfile plugins is -backward compatible (i.e. you can expect to be able to compile this -package for plugins from newer VMD packages), the binary interface -(ABI) is not. So it is necessary to compile this package with the -molfile plugin header files (vmdplugin.h and molfile_plugin.h) taken -from the _same_ VMD installation that the (binary) plugin files are -taken from. These header files can be found inside the VMD -installation tree under: "plugins/include". - -For convenience, this package includes a set of header files that is -compatible with VMD 1.9.3 (the current version in April 2017) - The person who created this package is Axel Kohlmeyer at Temple U (akohlmey at gmail.com). Contact him directly if you have questions. From 8d390100e0c21b0b86fb5895fb97d36db06a2351 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 18 Apr 2017 11:44:23 -0400 Subject: [PATCH 09/20] update .gitignore and Purge.list for recent changes --- src/.gitignore | 12 ++++++++---- src/Purge.list | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index 97bc2276b0..4fd0431208 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -47,8 +47,6 @@ /dump_molfile.h /molfile_interface.cpp /molfile_interface.h -/molfile_plugin.h -/vmdplugin.h /type_detector.h /intel_buffers.cpp @@ -76,8 +74,8 @@ /pair_awpmd_cut.cpp /pair_awpmd_cut.h -/dihedral_charmmfsh.cpp -/dihedral_charmmfsh.h +/dihedral_charmmfsw.cpp +/dihedral_charmmfsw.h /pair_lj_charmmfsw_coul_charmmfsh.cpp /pair_lj_charmmfsw_coul_charmmfsh.h /pair_lj_charmmfsw_coul_long.cpp @@ -163,6 +161,8 @@ /bond_nonlinear.h /bond_oxdna_fene.cpp /bond_oxdna_fene.h +/bond_oxdna2_fene.cpp +/bond_oxdna2_fene.h /bond_quartic.cpp /bond_quartic.h /bond_table.cpp @@ -770,6 +770,8 @@ /pair_nm_cut_coul_long.h /pair_oxdna_*.cpp /pair_oxdna_*.h +/pair_oxdna2_*.cpp +/pair_oxdna2_*.h /mf_oxdna.h /pair_peri_eps.cpp /pair_peri_eps.h @@ -848,6 +850,8 @@ /prd.h /python.cpp /python.h +/python_impl.cpp +/python_impl.h /reader_molfile.cpp /reader_molfile.h /reaxc_allocate.cpp diff --git a/src/Purge.list b/src/Purge.list index 554c5df824..9b09dd5382 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -16,6 +16,12 @@ style_region.h style_neigh_bin.h style_neigh_pair.h style_neigh_stencil.h +# deleted on 19 April 2017 +vmdplugin.h +molfile_plugin.h +# deleted on 13 April 2017 +dihedral_charmmfsh.cpp +dihedral_charmmfsh.h # deleted on ## XXX 2016 accelerator_intel.h neigh_bond.cpp From 25e8ed63a236f1245de2f1aa5b7565fcdfe1083e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 18 Apr 2017 11:46:19 -0400 Subject: [PATCH 10/20] whitespace cleanup in VMD plugin headers --- lib/molfile/molfile_plugin.h | 210 +++++++++++++++++------------------ lib/molfile/vmdplugin.h | 54 ++++----- 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 714b06539f..c79e7a5abf 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -15,10 +15,10 @@ * ***************************************************************************/ -/** @file +/** @file * API for C extensions to define a way to load structure, coordinate, - * trajectory, and volumetric data files - */ + * trajectory, and volumetric data files + */ #ifndef MOL_FILE_PLUGIN_H #define MOL_FILE_PLUGIN_H @@ -63,9 +63,9 @@ typedef ssize_t molfile_ssize_t; /**< for frame counts */ /** * Hard-coded direct-I/O page size constants for use by both VMD * and the plugins that want to use direct, unbuffered I/O for high - * performance with SSDs etc. We use two constants to define the - * range of hardware page sizes that we can support, so that we can - * add support for larger 8KB or 16KB page sizes in the future + * performance with SSDs etc. We use two constants to define the + * range of hardware page sizes that we can support, so that we can + * add support for larger 8KB or 16KB page sizes in the future * as they become more prevalent in high-end storage systems. * * At present, VMD uses a hard-coded 4KB page size to reduce memory @@ -89,16 +89,16 @@ typedef struct { } molfile_metadata_t; -/* - * Struct for specifying atoms in a molecular structure. The first - * six components are required, the rest are optional and their presence is +/* + * Struct for specifying atoms in a molecular structure. The first + * six components are required, the rest are optional and their presence is * indicating by setting the corresponding bit in optsflag. When omitted, - * the application (for read_structure) or plugin (for write_structure) - * must be able to supply default values if the missing parameters are + * the application (for read_structure) or plugin (for write_structure) + * must be able to supply default values if the missing parameters are * part of its internal data structure. * Note that it is not possible to specify coordinates with this structure. - * This is intentional; all coordinate I/O is done with the read_timestep and - * write_timestep functions. + * This is intentional; all coordinate I/O is done with the read_timestep and + * write_timestep functions. */ /** @@ -169,7 +169,7 @@ typedef struct { #define MOLFILE_CTNUMBER 0x0200 /**< ctnumber provided */ #endif #define MOLFILE_BADOPTIONS 0xFFFFFFFF /**< Detect badly behaved plugins */ - + /*@}*/ /*@{*/ @@ -189,22 +189,22 @@ typedef struct molfile_timestep_metadata { /* * Per-timestep atom coordinates and periodic cell information - */ + */ typedef struct { float *coords; /**< coordinates of all atoms, arranged xyzxyzxyz */ float *velocities; /**< space for velocities of all atoms; same layout */ /**< NULL unless has_velocities is set */ - /*@{*/ + /*@{*/ /** * Unit cell specification of the form A, B, C, alpha, beta, gamma. * notes: A, B, C are side lengths of the unit cell * alpha = angle between b and c * beta = angle between a and c * gamma = angle between a and b - */ - float A, B, C, alpha, beta, gamma; - /*@}*/ + */ + float A, B, C, alpha, beta, gamma; + /*@}*/ double physical_time; /**< physical time point associated with this frame */ @@ -223,7 +223,7 @@ typedef struct { /** * Metadata for volumetric datasets, read initially and used for subsequent - * memory allocations and file loading. + * memory allocations and file loading. */ typedef struct { char dataname[256]; /**< name of volumetric data set */ @@ -233,20 +233,20 @@ typedef struct { * x/y/z axis: * These the three cell sides, providing both direction and length * (not unit vectors) for the x, y, and z axes. In the simplest - * case, these would be <0,size,0> and <0,0,size) for + * case, these would be <0,size,0> and <0,0,size) for * an orthogonal cubic volume set. For other cell shapes these * axes can be oriented non-orthogonally, and the parallelpiped * may have different side lengths, not just a cube/rhombus. */ - float xaxis[3]; /**< direction (and length) for X axis */ + float xaxis[3]; /**< direction (and length) for X axis */ float yaxis[3]; /**< direction (and length) for Y axis */ float zaxis[3]; /**< direction (and length) for Z axis */ /* - * x/y/z size: + * x/y/z size: * Number of grid cells along each axis. This is _not_ the * physical size of the box, this is the number of voxels in each - * direction, independent of the shape of the volume set. + * direction, independent of the shape of the volume set. */ int xsize; /**< number of grid cells along the X axis */ int ysize; /**< number of grid cells along the Y axis */ @@ -348,10 +348,10 @@ typedef struct { /** * QM run info. Parameters that stay unchanged during a single file. - */ + */ typedef struct { int nproc; /**< number of processors used. */ - int memory; /**< amount of memory used in Mbyte. */ + int memory; /**< amount of memory used in Mbyte. */ int runtype; /**< flag indicating the calculation method. */ int scftype; /**< SCF type: RHF, UHF, ROHF, GVB or MCSCF wfn. */ int status; /**< indicates wether SCF and geometry optimization @@ -384,9 +384,9 @@ typedef struct { * array size = 2*num_basis_funcs * The basis must NOT be normalized. */ int *atomic_number; /**< atomic numbers (chem. element) of atoms in basis set */ - int *angular_momentum; /**< 3 ints per wave function coefficient do describe the + int *angular_momentum; /**< 3 ints per wave function coefficient do describe the * cartesian components of the angular momentum. - * E.g. S={0 0 0}, Px={1 0 0}, Dxy={1 1 0}, or Fyyz={0 2 1}. + * E.g. S={0 0 0}, Px={1 0 0}, Dxy={1 1 0}, or Fyyz={0 2 1}. */ int *shell_types; /**< type for each shell in basis */ } molfile_qm_basis_t; @@ -460,9 +460,9 @@ enum molfile_qm_wavefunc_type { MOLFILE_WAVE_MCSCFNAT, MOLFILE_WAVE_MCSCFOPT, MOLFILE_WAVE_CINATUR, MOLFILE_WAVE_PIPEK, MOLFILE_WAVE_BOYS, MOLFILE_WAVE_RUEDEN, - MOLFILE_WAVE_NAO, MOLFILE_WAVE_PNAO, MOLFILE_WAVE_NHO, - MOLFILE_WAVE_PNHO, MOLFILE_WAVE_NBO, MOLFILE_WAVE_PNBO, - MOLFILE_WAVE_PNLMO, MOLFILE_WAVE_NLMO, MOLFILE_WAVE_MOAO, + MOLFILE_WAVE_NAO, MOLFILE_WAVE_PNAO, MOLFILE_WAVE_NHO, + MOLFILE_WAVE_PNHO, MOLFILE_WAVE_NBO, MOLFILE_WAVE_PNBO, + MOLFILE_WAVE_PNLMO, MOLFILE_WAVE_NLMO, MOLFILE_WAVE_MOAO, MOLFILE_WAVE_NATO, MOLFILE_WAVE_UNKNOWN }; @@ -493,7 +493,7 @@ typedef struct molfile_qm_timestep_metadata { int has_orben_per_wavef[MOLFILE_MAXWAVEPERTS]; /**< orbital energy flags */ int has_occup_per_wavef[MOLFILE_MAXWAVEPERTS]; /**< orbital occupancy flags */ int num_wavef ; /**< # wavefunctions in this ts */ - int wavef_size; /**< size of one wavefunction + int wavef_size; /**< size of one wavefunction * (# of gaussian basis fctns) */ int num_charge_sets; /**< # of charge values per atom */ } molfile_qm_timestep_metadata_t; @@ -547,14 +547,14 @@ typedef struct { * from graphics file reader plugins. */ enum molfile_graphics_type { - MOLFILE_POINT, MOLFILE_TRIANGLE, MOLFILE_TRINORM, MOLFILE_NORMS, - MOLFILE_LINE, MOLFILE_CYLINDER, MOLFILE_CAPCYL, MOLFILE_CONE, + MOLFILE_POINT, MOLFILE_TRIANGLE, MOLFILE_TRINORM, MOLFILE_NORMS, + MOLFILE_LINE, MOLFILE_CYLINDER, MOLFILE_CAPCYL, MOLFILE_CONE, MOLFILE_SPHERE, MOLFILE_TEXT, MOLFILE_COLOR, MOLFILE_TRICOLOR }; /** * Individual graphics object/element data - */ + */ typedef struct { int type; /* One of molfile_graphics_type */ int style; /* A general style parameter */ @@ -570,13 +570,13 @@ typedef struct { type data style size ---- ---- ----- ---- point x, y, z pixel size -triangle x1,y1,z1,x2,y2,z2,x3,y3,z3 -trinorm x1,y1,z1,x2,y2,z2,x3,y3,z3 +triangle x1,y1,z1,x2,y2,z2,x3,y3,z3 +trinorm x1,y1,z1,x2,y2,z2,x3,y3,z3 the next array element must be NORMS -tricolor x1,y1,z1,x2,y2,z2,x3,y3,z3 +tricolor x1,y1,z1,x2,y2,z2,x3,y3,z3 the next array elements must be NORMS the following element must be COLOR, with three RGB triples -norms x1,y1,z1,x2,y2,z2,x3,y3,z3 +norms x1,y1,z1,x2,y2,z2,x3,y3,z3 line x1,y1,z1,x2,y2,z2 0=solid pixel width 1=stippled cylinder x1,y1,z1,x2,y2,z2 resolution radius @@ -590,41 +590,41 @@ color r, g, b /** * Main file reader API. Any function in this struct may be NULL * if not implemented by the plugin; the application checks this to determine - * what functionality is present in the plugin. - */ + * what functionality is present in the plugin. + */ typedef struct { /** - * Required header + * Required header */ vmdplugin_HEAD /** - * Filename extension for this file type. May be NULL if no filename + * Filename extension for this file type. May be NULL if no filename * extension exists and/or is known. For file types that match several * common extensions, list them in a comma separated list such as: * "pdb,ent,foo,bar,baz,ban" * The comma separated list will be expanded when filename extension matching * is performed. If multiple plugins solicit the same filename extensions, - * the one that lists the extension earliest in its list is selected. In the + * the one that lists the extension earliest in its list is selected. In the * case of a "tie", the first one tried/checked "wins". */ const char *filename_extension; /** * Try to open the file for reading. Return an opaque handle, or NULL on - * failure. Set the number of atoms; if the number of atoms cannot be - * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. + * failure. Set the number of atoms; if the number of atoms cannot be + * determined, set natoms to MOLFILE_NUMATOMS_UNKNOWN. * Filetype should be the name under which this plugin was registered; * this is provided so that plugins can provide the same function pointer * to handle multiple file types. */ - void *(* open_file_read)(const char *filepath, const char *filetype, + void *(* open_file_read)(const char *filepath, const char *filetype, int *natoms); - + /** * Read molecular structure from the given file handle. atoms is allocated * by the caller and points to space for natoms. - * On success, place atom information in the passed-in pointer. + * On success, place atom information in the passed-in pointer. * optflags specifies which optional fields in the atoms will be set by * the plugin. */ @@ -636,15 +636,15 @@ typedef struct { * Each unique bond should be specified only once, so file formats that list * bonds twice will need post-processing before the results are returned to * the caller. - * If the plugin provides bond information, but the file loaded doesn't + * If the plugin provides bond information, but the file loaded doesn't * actually contain any bond info, the nbonds parameter should be * set to 0 and from/to should be set to NULL to indicate that no bond * information was actually present, and automatic bond search should be - * performed. + * performed. * * If the plugin provides bond order information, the bondorder array * will contain the bond order for each from/to pair. If not, the bondorder - * pointer should be set to NULL, in which case the caller will provide a + * pointer should be set to NULL, in which case the caller will provide a * default bond order value of 1.0. * * If the plugin provides bond type information, the bondtype array @@ -655,23 +655,23 @@ typedef struct { * and consistency checking. * * These arrays must be freed by the plugin in the close_file_read function. - * This function can be called only after read_structure(). - * Return MOLFILE_SUCCESS if no errors occur. + * This function can be called only after read_structure(). + * Return MOLFILE_SUCCESS if no errors occur. */ - int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder, + int (*read_bonds)(void *, int *nbonds, int **from, int **to, float **bondorder, int **bondtype, int *nbondtypes, char ***bondtypename); /** - * XXX this function will be augmented and possibly superceded by a + * XXX this function will be augmented and possibly superceded by a * new QM-capable version named read_timestep(), when finished. * - * Read the next timestep from the file. Return MOLFILE_SUCCESS, or - * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then - * the frame should be skipped. Otherwise, the application must prepare - * molfile_timestep_t by allocating space in coords for the corresponding - * number of coordinates. - * The natoms parameter exists because some coordinate file formats - * (like CRD) cannot determine for themselves how many atoms are in a + * Read the next timestep from the file. Return MOLFILE_SUCCESS, or + * MOLFILE_EOF on EOF. If the molfile_timestep_t argument is NULL, then + * the frame should be skipped. Otherwise, the application must prepare + * molfile_timestep_t by allocating space in coords for the corresponding + * number of coordinates. + * The natoms parameter exists because some coordinate file formats + * (like CRD) cannot determine for themselves how many atoms are in a * timestep; the app must therefore obtain this information elsewhere * and provide it to the plugin. */ @@ -681,16 +681,16 @@ typedef struct { * Close the file and release all data. The handle cannot be reused. */ void (* close_file_read)(void *); - + /** * Open a coordinate file for writing using the given header information. * Return an opaque handle, or NULL on failure. The application must - * specify the number of atoms to be written. + * specify the number of atoms to be written. * filetype should be the name under which this plugin was registered. */ - void *(* open_file_write)(const char *filepath, const char *filetype, + void *(* open_file_write)(const char *filepath, const char *filetype, int natoms); - + /** * Write structure information. Return success. */ @@ -698,12 +698,12 @@ typedef struct { /** * Write a timestep to the coordinate file. Return MOLFILE_SUCCESS if no - * errors occur. If the file contains structure information in each - * timestep (like a multi-entry PDB), it will have to cache the information + * errors occur. If the file contains structure information in each + * timestep (like a multi-entry PDB), it will have to cache the information * from the initial calls from write_structure. */ int (* write_timestep)(void *, const molfile_timestep_t *); - + /** * Close the file and release all data. The handle cannot be reused. */ @@ -716,18 +716,18 @@ typedef struct { * the plugin and should be freed by close_file_read(). The application * may call this function any number of times. */ - int (* read_volumetric_metadata)(void *, int *nsets, + int (* read_volumetric_metadata)(void *, int *nsets, molfile_volumetric_t **metadata); - /** - * Read the specified volumetric data set into the space pointed to by - * datablock. The set is specified with a zero-based index. The space + /** + * Read the specified volumetric data set into the space pointed to by + * datablock. The set is specified with a zero-based index. The space * allocated for the datablock must be equal to - * xsize * ysize * zsize. No space will be allocated for colorblock + * xsize * ysize * zsize. No space will be allocated for colorblock * unless has_color is nonzero; in that case, colorblock should be * filled in with three RGB floats per datapoint. */ - int (* read_volumetric_data)(void *, int set, float *datablock, + int (* read_volumetric_data)(void *, int set, float *datablock, float *colorblock); #if vmdplugin_ABIVERSION > 16 int (* read_volumetric_data_ex)(void *, molfile_volumetric_readwrite_t *v); @@ -735,8 +735,8 @@ typedef struct { /** * Read raw graphics data stored in this file. Return the number of data - * elements and the data itself as an array of molfile_graphics_t in the - * pointer provided by the application. The plugin is responsible for + * elements and the data itself as an array of molfile_graphics_t in the + * pointer provided by the application. The plugin is responsible for * freeing the data when the file is closed. */ int (* read_rawgraphics)(void *, int *nelem, const molfile_graphics_t **data); @@ -746,19 +746,19 @@ typedef struct { * came from, what the accession code for the database is, textual remarks * and other notes pertaining to the contained structure/trajectory/volume * and anything else that's informative at the whole file level. - */ + */ int (* read_molecule_metadata)(void *, molfile_metadata_t **metadata); - + /** * Write bond information for the molecule. The arrays from * and to point to the (one-based) indices of bonded atoms. - * Each unique bond will be specified only once by the caller. - * File formats that list bonds twice will need to emit both the + * Each unique bond will be specified only once by the caller. + * File formats that list bonds twice will need to emit both the * from/to and to/from versions of each. - * This function must be called before write_structure(). + * This function must be called before write_structure(). * * Like the read_bonds() routine, the bondorder pointer is set to NULL - * if the caller doesn't have such information, in which case the + * if the caller doesn't have such information, in which case the * plugin should assume a bond order of 1.0 if the file format requires * bond order information. * @@ -769,15 +769,15 @@ typedef struct { * scheme is different from the index numbers. * if the pointers are set to NULL, then this information is not available. * bondtypenames can only be used of bondtypes is also given. - * Return MOLFILE_SUCCESS if no errors occur. + * Return MOLFILE_SUCCESS if no errors occur. */ - int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder, + int (* write_bonds)(void *, int nbonds, int *from, int *to, float *bondorder, int *bondtype, int nbondtypes, char **bondtypename); /** - * Write the specified volumetric data set into the space pointed to by + * Write the specified volumetric data set into the space pointed to by * datablock. The * allocated for the datablock must be equal to - * xsize * ysize * zsize. No space will be allocated for colorblock + * xsize * ysize * zsize. No space will be allocated for colorblock * unless has_color is nonzero; in that case, colorblock should be * filled in with three RGB floats per datapoint. */ @@ -788,27 +788,27 @@ typedef struct { molfile_volumetric_readwrite_t *v); #endif - /** + /** * Read in Angles, Dihedrals, Impropers, and Cross Terms and optionally types. - * (Cross terms pertain to the CHARMM/NAMD CMAP feature) + * (Cross terms pertain to the CHARMM/NAMD CMAP feature) */ int (* read_angles)(void *handle, int *numangles, int **angles, int **angletypes, int *numangletypes, char ***angletypenames, int *numdihedrals, int **dihedrals, int **dihedraltypes, int *numdihedraltypes, - char ***dihedraltypenames, int *numimpropers, int **impropers, + char ***dihedraltypenames, int *numimpropers, int **impropers, int **impropertypes, int *numimpropertypes, char ***impropertypenames, int *numcterms, int **cterms, int *ctermcols, int *ctermrows); - /** + /** * Write out Angles, Dihedrals, Impropers, and Cross Terms - * (Cross terms pertain to the CHARMM/NAMD CMAP feature) + * (Cross terms pertain to the CHARMM/NAMD CMAP feature) */ int (* write_angles)(void *handle, int numangles, const int *angles, const int *angletypes, int numangletypes, const char **angletypenames, int numdihedrals, const int *dihedrals, const int *dihedraltypes, int numdihedraltypes, - const char **dihedraltypenames, int numimpropers, + const char **dihedraltypenames, int numimpropers, const int *impropers, const int *impropertypes, int numimpropertypes, - const char **impropertypenames, int numcterms, const int *cterms, + const char **impropertypenames, int numcterms, const int *cterms, int ctermcols, int ctermrows); @@ -817,7 +817,7 @@ typedef struct { * QM datasets in this file. * * The metadata are the sizes of the QM related data structure - * arrays that will be populated by the plugin when + * arrays that will be populated by the plugin when * read_qm_rundata() is called. Since the allocation of these * arrays is done by VMD rather than the plugin, VMD needs to * know the sizes beforehand. Consequently read_qm_metadata() @@ -830,7 +830,7 @@ typedef struct { * Read timestep independent QM data. * * Typical data that are defined only once per trajectory are - * general info about the calculation (such as the used method), + * general info about the calculation (such as the used method), * the basis set and normal modes. * The data structures to be populated must have been allocated * before by VMD according to sizes obtained through @@ -840,19 +840,19 @@ typedef struct { /** - * Read the next timestep from the file. Return MOLFILE_SUCCESS, or + * Read the next timestep from the file. Return MOLFILE_SUCCESS, or * MOLFILE_EOF on EOF. If the molfile_timestep_t or molfile_qm_metadata_t - * arguments are NULL, then the coordinate or qm data should be skipped. - * Otherwise, the application must prepare molfile_timestep_t and - * molfile_qm_timestep_t by allocating space for the corresponding + * arguments are NULL, then the coordinate or qm data should be skipped. + * Otherwise, the application must prepare molfile_timestep_t and + * molfile_qm_timestep_t by allocating space for the corresponding * number of coordinates, orbital wavefunction coefficients, etc. - * Since it is common for users to want to load only the final timestep + * Since it is common for users to want to load only the final timestep * data from a QM run, the application may provide any combination of - * valid, or NULL pointers for the molfile_timestep_t and + * valid, or NULL pointers for the molfile_timestep_t and * molfile_qm_timestep_t parameters, depending on what information the * user is interested in. - * The natoms and qm metadata parameters exist because some file formats - * cannot determine for themselves how many atoms etc are in a + * The natoms and qm metadata parameters exist because some file formats + * cannot determine for themselves how many atoms etc are in a * timestep; the app must therefore obtain this information elsewhere * and provide it to the plugin. */ diff --git a/lib/molfile/vmdplugin.h b/lib/molfile/vmdplugin.h index bbbc53c9bb..842d1e431c 100644 --- a/lib/molfile/vmdplugin.h +++ b/lib/molfile/vmdplugin.h @@ -17,20 +17,20 @@ /** @file * This header must be included by every VMD plugin library. It defines the - * API for every plugin so that VMD can organize the plugins it finds. + * API for every plugin so that VMD can organize the plugins it finds. */ #ifndef VMD_PLUGIN_H #define VMD_PLUGIN_H -/* +/* * Preprocessor tricks to make it easier for us to redefine the names of * functions when building static plugins. */ #if !defined(VMDPLUGIN) -/** - * macro defining VMDPLUGIN if it hasn't already been set to the name of +/** + * macro defining VMDPLUGIN if it hasn't already been set to the name of * a static plugin that is being compiled. This is the catch-all case. */ #define VMDPLUGIN vmdplugin @@ -38,11 +38,11 @@ /** concatenation macro, joins args x and y together as a single string */ #define xcat(x, y) cat(x, y) /** concatenation macro, joins args x and y together as a single string */ -#define cat(x, y) x ## y +#define cat(x, y) x ## y /* - * macros to correctly define plugin function names depending on whether - * the plugin is being compiled for static linkage or dynamic loading. + * macros to correctly define plugin function names depending on whether + * the plugin is being compiled for static linkage or dynamic loading. * When compiled for static linkage, each plugin needs to have unique * function names for all of its entry points. When compiled for dynamic * loading, the plugins must name their entry points consistently so that @@ -59,13 +59,13 @@ /** "WIN32" is defined on both WIN32 and WIN64 platforms... */ -#if (defined(WIN32)) +#if (defined(WIN32)) #define WIN32_LEAN_AND_MEAN #include #if !defined(STATIC_PLUGIN) #if defined(VMDPLUGIN_EXPORTS) -/** +/** * Only define DllMain for plugins, not in VMD or in statically linked plugins * VMDPLUGIN_EXPORTS is only defined when compiling dynamically loaded plugins */ @@ -86,7 +86,7 @@ BOOL APIENTRY DllMain( HANDLE hModule, #endif /* ! STATIC_PLUGIN */ #else /** If we're not compiling on Windows, then this macro is defined empty */ -#define VMDPLUGIN_API +#define VMDPLUGIN_API #endif /** define plugin linkage correctly for both C and C++ based plugins */ @@ -96,13 +96,13 @@ BOOL APIENTRY DllMain( HANDLE hModule, #define VMDPLUGIN_EXTERN extern VMDPLUGIN_API #endif /* __cplusplus */ -/* - * Plugin API functions start here +/* + * Plugin API functions start here */ -/** - * Init routine: called the first time the library is loaded by the +/** + * Init routine: called the first time the library is loaded by the * application and before any other API functions are referenced. * Return 0 on success. */ @@ -110,15 +110,15 @@ VMDPLUGIN_EXTERN int VMDPLUGIN_init(void); /** * Macro for creating a struct header used in all plugin structures. - * - * This header should be placed at the top of every plugin API definition + * + * This header should be placed at the top of every plugin API definition * so that it can be treated as a subtype of the base plugin type. * * abiversion: Defines the ABI for the base plugin type (not for other plugins) * type: A string descriptor of the plugin type. * name: A name for the plugin. * author: A string identifier, possibly including newlines. - * Major and minor version. + * Major and minor version. * is_reentrant: Whether this library can be run concurrently with itself. */ #define vmdplugin_HEAD \ @@ -129,12 +129,12 @@ VMDPLUGIN_EXTERN int VMDPLUGIN_init(void); const char *author; \ int majorv; \ int minorv; \ - int is_reentrant; + int is_reentrant; -/** +/** * Typedef for generic plugin header, individual plugins can - * make their own structures as long as the header info remains - * the same as the generic plugin header, most easily done by + * make their own structures as long as the header info remains + * the same as the generic plugin header, most easily done by * using the vmdplugin_HEAD macro. */ typedef struct { @@ -158,7 +158,7 @@ typedef struct { #define VMDPLUGIN_ERROR -1 /*@}*/ -/** +/** * Function pointer typedef for register callback functions */ typedef int (*vmdplugin_register_cb)(void *, vmdplugin_t *); @@ -175,16 +175,16 @@ typedef int (*vmdplugin_register_cb)(void *, vmdplugin_t *); VMDPLUGIN_EXTERN int VMDPLUGIN_register(void *, vmdplugin_register_cb); /** - * Allow the library to register Tcl extensions. + * Allow the library to register Tcl extensions. * This API is optional; if found by dlopen, it will be called after first - * calling init and register. + * calling init and register. */ -VMDPLUGIN_EXTERN int VMDPLUGIN_register_tcl(void *, void *tcl_interp, +VMDPLUGIN_EXTERN int VMDPLUGIN_register_tcl(void *, void *tcl_interp, vmdplugin_register_cb); /** - * The Fini method is called when the application will no longer use - * any plugins in the library. + * The Fini method is called when the application will no longer use + * any plugins in the library. */ VMDPLUGIN_EXTERN int VMDPLUGIN_fini(void); From dfa9815246c3f6b64d130fe0f3d34bd7c2626d65 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 18 Apr 2017 17:07:28 -0400 Subject: [PATCH 11/20] update for fix gle docs from michele ceriotti --- doc/src/fix_gle.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/src/fix_gle.txt b/doc/src/fix_gle.txt index ca7625e2d0..b8d3cc9b34 100644 --- a/doc/src/fix_gle.txt +++ b/doc/src/fix_gle.txt @@ -67,9 +67,10 @@ target value as the {Tstart} and {Tstop} arguments, so that the diffusion matrix that gives canonical sampling for a given A is computed automatically. However, the GLE framework also allow for non-equilibrium sampling, that can be used for instance to model inexpensively zero-point energy -effects "(Ceriotti2)"_#Ceriotti2. This is achieved specifying the -{noneq} keyword followed by the name of the file that contains the -static covariance matrix for the non-equilibrium dynamics. +effects "(Ceriotti2)"_#Ceriotti2. This is achieved specifying the {noneq} + keyword followed by the name of the file that contains the static covariance +matrix for the non-equilibrium dynamics. Please note, that the covariance +matrix is expected to be given in [temperature units]. Since integrating GLE dynamics can be costly when used together with simple potentials, one can use the {every} optional keyword to @@ -148,7 +149,7 @@ dpd/tstat"_pair_dpd.html, "fix gld"_fix_gld.html 1170-80 (2010) :link(GLE4MD) -[(GLE4MD)] "http://epfl-cosmo.github.io/gle4md/"_http://epfl-cosmo.github.io/gle4md/ +[(GLE4MD)] "http://gle4md.org/"_http://gle4md.org/ :link(Ceriotti2) [(Ceriotti2)] Ceriotti, Bussi and Parrinello, Phys Rev Lett 103, From f0681f7e127837f8cb2d033eb180d90f6d4717b3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 20 Apr 2017 14:42:01 -0400 Subject: [PATCH 12/20] add support for USER-TALLY to pair styles hybrid and hybrid/overlay --- src/pair.h | 4 ++-- src/pair_hybrid.cpp | 17 +++++++++++++++++ src/pair_hybrid.h | 3 +++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/pair.h b/src/pair.h index 3f66c6095a..dd859e5f2a 100644 --- a/src/pair.h +++ b/src/pair.h @@ -194,8 +194,8 @@ class Pair : protected Pointers { int num_tally_compute; class Compute **list_tally_compute; public: - void add_tally_callback(class Compute *); - void del_tally_callback(class Compute *); + virtual void add_tally_callback(class Compute *); + virtual void del_tally_callback(class Compute *); protected: int instance_me; // which Pair class instantiation I am diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 03e55006fc..e327066183 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -169,6 +169,23 @@ void PairHybrid::compute(int eflag, int vflag) if (vflag_fdotr) virial_fdotr_compute(); } + +/* ---------------------------------------------------------------------- */ + +void PairHybrid::add_tally_callback(Compute *ptr) +{ + for (int m = 0; m < nstyles; m++) + styles[m]->add_tally_callback(ptr); +} + +/* ---------------------------------------------------------------------- */ + +void PairHybrid::del_tally_callback(Compute *ptr) +{ + for (int m = 0; m < nstyles; m++) + styles[m]->del_tally_callback(ptr); +} + /* ---------------------------------------------------------------------- */ void PairHybrid::compute_inner() diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index e3de3b022a..8fd0b9e4e0 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -55,6 +55,9 @@ class PairHybrid : public Pair { int check_ijtype(int, int, char *); + virtual void add_tally_callback(class Compute *); + virtual void del_tally_callback(class Compute *); + protected: int nstyles; // # of sub-styles Pair **styles; // list of Pair style classes From 4e411364ffa4f79df1378f0c21a4f8a482ea76e5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 21 Apr 2017 14:01:38 -0400 Subject: [PATCH 13/20] add support to pair_modify to selectively disable compute/tally callbacks in sub-styles for pair hybrid and hybrid/overlay --- doc/src/pair_hybrid.txt | 6 ++++++ doc/src/pair_modify.txt | 29 ++++++++++++++++++++++------- src/pair_hybrid.cpp | 24 +++++++++++++++++++++--- src/pair_hybrid.h | 1 + 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/doc/src/pair_hybrid.txt b/doc/src/pair_hybrid.txt index 7ef54e7f07..1c0eee27a1 100644 --- a/doc/src/pair_hybrid.txt +++ b/doc/src/pair_hybrid.txt @@ -225,6 +225,12 @@ special_bonds lj/coul 1e-20 1e-20 0.5 pair_hybrid tersoff lj/cut/coul/long 12.0 pair_modify pair tersoff special lj/coul 1.0 1.0 1.0 :pre +For use with the various "compute */tally"_compute_tally.html +computes, the "pair_modify compute/tally"_pair_modify.html +command can be used to selectively turn off processing of +the compute tally styles, for example, if those pair styles +(e.g. manybody styles) do not support this feature. + See the "pair_modify"_pair_modify.html doc page for details on the specific syntax, requirements and restrictions. diff --git a/doc/src/pair_modify.txt b/doc/src/pair_modify.txt index 03fb80ae5e..34dbb5bc3d 100644 --- a/doc/src/pair_modify.txt +++ b/doc/src/pair_modify.txt @@ -15,11 +15,13 @@ pair_modify keyword values ... :pre one or more keyword/value pairs may be listed :ulb,l keyword = {pair} or {shift} or {mix} or {table} or {table/disp} or {tabinner} or {tabinner/disp} or {tail} or {compute} :l {pair} values = sub-style N {special} which wt1 wt2 wt3 + or sub-style N {compute/tally} flag sub-style = sub-style of "pair hybrid"_pair_hybrid.html N = which instance of sub-style (only if sub-style is used multiple times) - {special} which wt1 wt2 wt3 = override {special_bonds} settings (optional) - which = {lj/coul} or {lj} or {coul} - w1,w2,w3 = 1-2, 1-3, and 1-4 weights from 0.0 to 1.0 inclusive + {special} which wt1 wt2 wt3 = override {special_bonds} settings (optional) + which = {lj/coul} or {lj} or {coul} + w1,w2,w3 = 1-2, 1-3, and 1-4 weights from 0.0 to 1.0 inclusive + {compute/tally} flag = {yes} or {no} {mix} value = {geometric} or {arithmetic} or {sixthpower} {shift} value = {yes} or {no} {table} value = N @@ -40,6 +42,7 @@ pair_modify shift yes mix geometric pair_modify tail yes pair_modify table 12 pair_modify pair lj/cut compute no +pair_modify pair tersoff compute/tally no pair_modify pair lj/cut/coul/long 1 special lj/coul 0.0 0.0 0.0 :pre [Description:] @@ -60,9 +63,12 @@ keywords will be applied to. Note that if the {pair} keyword is not used, and the pair style is {hybrid} or {hybrid/overlay}, then all the specified keywords will be applied to all sub-styles. -The {special} keyword can only be used in conjunction with the {pair} -keyword and must directly follow it. It allows to override the +The {special} and {compute/tally} keywords can [only] be used in +conjunction with the {pair} keyword and must directly follow it. +{special} allows to override the "special_bonds"_special_bonds.html settings for the specified sub-style. +{compute/tally} allows to disable or enable registering +"compute */tally"_compute_tally.html computes for a given sub-style. More details are given below. The {mix} keyword affects pair coefficients for interactions between @@ -231,6 +237,14 @@ setting. Substituting 1.0e-10 for 0.0 and 0.9999999999 for 1.0 is usually a sufficient workaround in this case without causing a significant error. +The {compute/tally} keyword takes exactly 1 argument ({no} or {yes}), +and allows to selectively disable or enable processing of the various +"compute */tally"_compute_tally.html styles for a given +"pair hybrid or hybrid/overlay"_pair_hybrid.html sub-style. + +NOTE: Any "pair_modify pair compute/tally" command must be issued +[before] the corresponding compute style is defined. + :line [Restrictions:] none @@ -240,8 +254,9 @@ conflicting options. You cannot use {tail} yes with 2d simulations. [Related commands:] -"pair_style"_pair_style.html, "pair_coeff"_pair_coeff.html, -"thermo_style"_thermo_style.html +"pair_style"_pair_style.html, "pair_style hybrid"_pair_hybrid.html, +pair_coeff"_pair_coeff.html, "thermo_style"_thermo_style.html, +"compute */tally"_compute_tally.html [Default:] diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index e327066183..fa79f1cf97 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp), styles(NULL), keywords(NULL), multiple(NULL), nmap(NULL), - map(NULL), special_lj(NULL), special_coul(NULL) + map(NULL), special_lj(NULL), special_coul(NULL), compute_tally(NULL) { nstyles = 0; @@ -62,6 +62,7 @@ PairHybrid::~PairHybrid() delete [] special_lj; delete [] special_coul; + delete [] compute_tally; delete [] svector; @@ -175,7 +176,7 @@ void PairHybrid::compute(int eflag, int vflag) void PairHybrid::add_tally_callback(Compute *ptr) { for (int m = 0; m < nstyles; m++) - styles[m]->add_tally_callback(ptr); + if (compute_tally[m]) styles[m]->add_tally_callback(ptr); } /* ---------------------------------------------------------------------- */ @@ -183,7 +184,7 @@ void PairHybrid::add_tally_callback(Compute *ptr) void PairHybrid::del_tally_callback(Compute *ptr) { for (int m = 0; m < nstyles; m++) - styles[m]->del_tally_callback(ptr); + if (compute_tally[m]) styles[m]->del_tally_callback(ptr); } /* ---------------------------------------------------------------------- */ @@ -270,6 +271,8 @@ void PairHybrid::settings(int narg, char **arg) special_lj = new double*[narg]; special_coul = new double*[narg]; + compute_tally = new int[narg]; + // allocate each sub-style // allocate uses suffix, but don't store suffix version in keywords, // else syntax in coeff() will not match @@ -289,6 +292,7 @@ void PairHybrid::settings(int narg, char **arg) styles[nstyles] = force->new_pair(arg[iarg],1,dummy); force->store_style(keywords[nstyles],arg[iarg],0); special_lj[nstyles] = special_coul[nstyles] = NULL; + compute_tally[nstyles] = 1; jarg = iarg + 1; while (jarg < narg && !force->pair_map->count(arg[jarg])) jarg++; @@ -799,6 +803,20 @@ void PairHybrid::modify_params(int narg, char **arg) iarg += 5; } + // if 2nd keyword (after pair) is compute/tally: + // set flag to register USER-TALLY computes accordingly + + if (iarg < narg && strcmp(arg[iarg],"compute/tally") == 0) { + if (narg < iarg+2) + error->all(FLERR,"Illegal pair_modify compute/tally command"); + if (strcmp(arg[iarg+1],"yes") == 0) { + compute_tally[m] = 1; + } else if (strcmp(arg[iarg+1],"no") == 0) { + compute_tally[m] = 0; + } else error->all(FLERR,"Illegal pair_modify compute/tally command"); + iarg += 2; + } + // apply the remaining keywords to the base pair style itself and the // sub-style except for "pair" and "special". // the former is important for some keywords like "tail" or "compute" diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index 8fd0b9e4e0..b8b9af5f40 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -72,6 +72,7 @@ class PairHybrid : public Pair { int ***map; // list of sub-styles itype,jtype points to double **special_lj; // list of per style LJ exclusion factors double **special_coul; // list of per style Coulomb exclusion factors + int *compute_tally; // list of on/off flags for tally computes void allocate(); void flags(); From 396e0b54234da5b34193b92638c08fba70142b7a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 21 Apr 2017 14:02:17 -0400 Subject: [PATCH 14/20] correct broken link in html bond doc overview --- doc/src/bonds.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/src/bonds.txt b/doc/src/bonds.txt index 3b50f6482f..169d56ecbe 100644 --- a/doc/src/bonds.txt +++ b/doc/src/bonds.txt @@ -16,7 +16,6 @@ Bond Styles :h1 bond_none bond_nonlinear bond_oxdna - bond_oxdna2 bond_quartic bond_table bond_zero From 8f14511831986229bc62d1072d1d7ef67968a403 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 21 Apr 2017 16:46:27 -0400 Subject: [PATCH 15/20] avoid division by zero by initializing unset (=automatic) g_ewald parameters to some number > 0. --- src/KSPACE/pppm_disp.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 5d6c2042be..b31d42a815 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -380,6 +380,12 @@ void PPPMDisp::init() alpha = qdist / (cos(0.5*theta) * blen); } + //if g_ewald and g_ewald_6 have not been specified, set some initial value + // to avoid problems when calculating the energies! + + if (!gewaldflag) g_ewald = 1; + if (!gewaldflag_6) g_ewald_6 = 1; + // initialize the pair style to get the coefficients neighrequest_flag = 0; @@ -387,12 +393,6 @@ void PPPMDisp::init() neighrequest_flag = 1; init_coeffs(); - //if g_ewald and g_ewald_6 have not been specified, set some initial value - // to avoid problems when calculating the energies! - - if (!gewaldflag) g_ewald = 1; - if (!gewaldflag_6) g_ewald_6 = 1; - // set accuracy (force units) from accuracy_relative or accuracy_absolute if (accuracy_absolute >= 0.0) accuracy = accuracy_absolute; From 197ce4580b2997e9726219565ad1a85080461d3f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 21 Apr 2017 17:27:08 -0400 Subject: [PATCH 16/20] avoid division by zero also for ewald/disp --- src/KSPACE/ewald_disp.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 467a748d08..85e3da921b 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -138,13 +138,14 @@ void EwaldDisp::init() nsums += n[k]; } - if (!gewaldflag) g_ewald = 0.0; + if (!gewaldflag) g_ewald = g_ewald_6 = 1.0; pair->init(); // so B is defined init_coeffs(); init_coeff_sums(); if (function[0]) qsum_qsq(); else qsqsum = qsum = 0.0; natoms_original = atom->natoms; + if (!gewaldflag) g_ewald = g_ewald_6 = 0.0; // turn off coulombic if no charge @@ -218,8 +219,8 @@ void EwaldDisp::init() } if (!comm->me) { - if (screen) fprintf(screen, " G vector = %g\n", g_ewald); - if (logfile) fprintf(logfile, " G vector = %g\n", g_ewald); + if (screen) fprintf(screen, " G vector = %g, accuracy = %g\n", g_ewald,accuracy); + if (logfile) fprintf(logfile, " G vector = %g accuracy = %g\n", g_ewald,accuracy); } g_ewald_6 = g_ewald; From 0ac22e034c2a3b4627383d798b397defabd65851 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 22 Apr 2017 21:50:27 -0400 Subject: [PATCH 17/20] turn errors from manybody potentials for */tally computes into warnings --- src/USER-TALLY/compute_force_tally.cpp | 4 ++-- src/USER-TALLY/compute_heat_flux_tally.cpp | 4 ++-- src/USER-TALLY/compute_pe_mol_tally.cpp | 6 +++--- src/USER-TALLY/compute_pe_tally.cpp | 4 ++-- src/USER-TALLY/compute_stress_tally.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/USER-TALLY/compute_force_tally.cpp b/src/USER-TALLY/compute_force_tally.cpp index e9ecedd5ab..e97a1c751c 100644 --- a/src/USER-TALLY/compute_force_tally.cpp +++ b/src/USER-TALLY/compute_force_tally.cpp @@ -65,12 +65,12 @@ ComputeForceTally::~ComputeForceTally() void ComputeForceTally::init() { if (force->pair == NULL) - error->all(FLERR,"Trying to use compute force/tally with no pair style"); + error->all(FLERR,"Trying to use compute force/tally without pair style"); else force->pair->add_tally_callback(this); if (force->pair->single_enable == 0 || force->pair->manybody_flag) - error->all(FLERR,"Compute force/tally used with incompatible pair style."); + error->warning(FLERR,"Compute force/tally used with incompatible pair style"); if ((comm->me == 0) && (force->bond || force->angle || force->dihedral || force->improper || force->kspace)) diff --git a/src/USER-TALLY/compute_heat_flux_tally.cpp b/src/USER-TALLY/compute_heat_flux_tally.cpp index 214311cb3d..48cad538d5 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.cpp +++ b/src/USER-TALLY/compute_heat_flux_tally.cpp @@ -64,12 +64,12 @@ ComputeHeatFluxTally::~ComputeHeatFluxTally() void ComputeHeatFluxTally::init() { if (force->pair == NULL) - error->all(FLERR,"Trying to use compute heat/flux/tally with no pair style"); + error->all(FLERR,"Trying to use compute heat/flux/tally without pair style"); else force->pair->add_tally_callback(this); if (force->pair->single_enable == 0 || force->pair->manybody_flag) - error->all(FLERR,"Compute heat/flux/tally used with incompatible pair style."); + error->warning(FLERR,"Compute heat/flux/tally used with incompatible pair style"); if ((comm->me == 0) && (force->bond || force->angle || force->dihedral || force->improper || force->kspace)) diff --git a/src/USER-TALLY/compute_pe_mol_tally.cpp b/src/USER-TALLY/compute_pe_mol_tally.cpp index 09ee04d57a..a30f2d6b9a 100644 --- a/src/USER-TALLY/compute_pe_mol_tally.cpp +++ b/src/USER-TALLY/compute_pe_mol_tally.cpp @@ -59,15 +59,15 @@ ComputePEMolTally::~ComputePEMolTally() void ComputePEMolTally::init() { if (force->pair == NULL) - error->all(FLERR,"Trying to use compute pe/mol/tally with no pair style"); + error->all(FLERR,"Trying to use compute pe/mol/tally without pair style"); else force->pair->add_tally_callback(this); if (atom->molecule_flag == 0) - error->all(FLERR,"Compute pe/mol/tally requires molecule IDs."); + error->all(FLERR,"Compute pe/mol/tally requires molecule IDs"); if (force->pair->single_enable == 0 || force->pair->manybody_flag) - error->all(FLERR,"Compute pe/mol/tally used with incompatible pair style."); + error->warning(FLERR,"Compute pe/mol/tally used with incompatible pair style"); if ((comm->me == 0) && (force->bond || force->angle || force->dihedral || force->improper || force->kspace)) diff --git a/src/USER-TALLY/compute_pe_tally.cpp b/src/USER-TALLY/compute_pe_tally.cpp index 68c00b6d2e..2117f2cb15 100644 --- a/src/USER-TALLY/compute_pe_tally.cpp +++ b/src/USER-TALLY/compute_pe_tally.cpp @@ -64,12 +64,12 @@ ComputePETally::~ComputePETally() void ComputePETally::init() { if (force->pair == NULL) - error->all(FLERR,"Trying to use compute pe/tally with no pair style"); + error->all(FLERR,"Trying to use compute pe/tally without a pair style"); else force->pair->add_tally_callback(this); if (force->pair->single_enable == 0 || force->pair->manybody_flag) - error->all(FLERR,"Compute pe/tally used with incompatible pair style."); + error->warning(FLERR,"Compute pe/tally used with incompatible pair style"); if ((comm->me == 0) && (force->bond || force->angle || force->dihedral || force->improper || force->kspace)) diff --git a/src/USER-TALLY/compute_stress_tally.cpp b/src/USER-TALLY/compute_stress_tally.cpp index 2575bd372a..66df9f6e4f 100644 --- a/src/USER-TALLY/compute_stress_tally.cpp +++ b/src/USER-TALLY/compute_stress_tally.cpp @@ -65,12 +65,12 @@ ComputeStressTally::~ComputeStressTally() void ComputeStressTally::init() { if (force->pair == NULL) - error->all(FLERR,"Trying to use compute stress/tally with no pair style"); + error->all(FLERR,"Trying to use compute stress/tally without pair style"); else force->pair->add_tally_callback(this); if (force->pair->single_enable == 0 || force->pair->manybody_flag) - error->all(FLERR,"Compute stress/tally used with incompatible pair style."); + error->warning(FLERR,"Compute stress/tally used with incompatible pair style"); if ((comm->me == 0) && (force->bond || force->angle || force->dihedral || force->improper || force->kspace)) From ddc1e4e86ea713a6c9393611830c078c9c1d944d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 25 Apr 2017 13:27:20 -0400 Subject: [PATCH 18/20] detect and refuse to run pair style srp together with fix rigid --- doc/src/pair_srp.txt | 2 ++ src/USER-MISC/fix_srp.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/doc/src/pair_srp.txt b/doc/src/pair_srp.txt index 3f54445ba8..e7f1e00d10 100644 --- a/doc/src/pair_srp.txt +++ b/doc/src/pair_srp.txt @@ -150,6 +150,8 @@ hybrid"_pair_hybrid.html. This pair style requires the "newton"_newton.html command to be {on} for non-bonded interactions. +This pair style is not compatible with "rigid body integrators"_fix_rigid.html + [Related commands:] "pair_style hybrid"_pair_hybrid.html, "pair_coeff"_pair_coeff.html, diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index fbd8473cb0..f3dec42a83 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -101,6 +101,13 @@ void FixSRP::init() if (force->pair_match("hybrid",1) == NULL) error->all(FLERR,"Cannot use pair srp without pair_style hybrid"); + int has_rigid = 0; + for (int i = 0; i < modify->nfix; i++) + if (strncmp(modify->fix[i]->style,"rigid",5) == 0) ++has_rigid; + + if (has_rigid > 0) + error->all(FLERR,"Pair srp is not compatible with rigid fixes."); + if ((bptype < 1) || (bptype > atom->ntypes)) error->all(FLERR,"Illegal bond particle type"); From 8f9cb3590a32dce602a7365bb5e2221b74db0597 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 26 Apr 2017 15:34:12 -0400 Subject: [PATCH 19/20] correct units for some improper force constants in docs --- doc/src/improper_cossq.txt | 5 +---- doc/src/improper_ring.txt | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/doc/src/improper_cossq.txt b/doc/src/improper_cossq.txt index 513f0b3151..e238063a8f 100644 --- a/doc/src/improper_cossq.txt +++ b/doc/src/improper_cossq.txt @@ -45,12 +45,9 @@ above, or in the data file or restart files read by the "read_data"_read_data.html or "read_restart"_read_restart.html commands: -K (energy/radian^2) +K (energy) X0 (degrees) :ul -X0 is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of K are in energy/radian^2. - :line Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are diff --git a/doc/src/improper_ring.txt b/doc/src/improper_ring.txt index 705b1cf742..cba59399e7 100644 --- a/doc/src/improper_ring.txt +++ b/doc/src/improper_ring.txt @@ -49,12 +49,9 @@ above, or in the data file or restart files read by the "read_data"_read_data.html or "read_restart"_read_restart.html commands: -K (energy/radian^2) +K (energy) theta0 (degrees) :ul -theta0 is specified in degrees, but LAMMPS converts it to radians -internally; hence the units of K are in energy/radian^2. - :line Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are From 7f49ee8fd7473fe97219c369b837af9b3a38087f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 May 2017 15:33:22 -0400 Subject: [PATCH 20/20] print warning about minimization energy with fix box/relax --- doc/src/Section_errors.txt | 6 ++++++ src/min.cpp | 9 ++++++++- src/min.h | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/src/Section_errors.txt b/doc/src/Section_errors.txt index 832c5718ab..5e0574b390 100644 --- a/doc/src/Section_errors.txt +++ b/doc/src/Section_errors.txt @@ -11171,6 +11171,12 @@ Self-explanatory. :dd If the fix changes the timestep, the dump dcd file will not reflect the change. :dd +{Energy due to X extra global DOFs will be included in minimizer energies} :dt + +When using fixes like box/relax, the potential energy used by the minimizer +is augmented by an additional energy provided by the fix. Thus the printed +converged energy may be different from the total potential energy. :dd + {Energy tally does not account for 'zero yes'} :dt The energy removed by using the 'zero yes' flag is not accounted diff --git a/src/min.cpp b/src/min.cpp index 79d7d6a8bd..d308efb848 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -187,6 +187,8 @@ void Min::setup(int flag) update->minimize_style); if (flag) { fprintf(screen," Unit style : %s\n", update->unit_style); + fprintf(screen," Current step : " BIGINT_FORMAT "\n", + update->ntimestep); timer->print_timeout(screen); } } @@ -196,7 +198,12 @@ void Min::setup(int flag) // cannot be done in init() b/c update init() is before modify init() nextra_global = modify->min_dof(); - if (nextra_global) fextra = new double[nextra_global]; + if (nextra_global) { + fextra = new double[nextra_global]; + if (comm->me == 0 && screen) + fprintf(screen,"WARNING: Energy due to %d extra global DOFs will" + " be included in minimizer energies\n",nextra_global); + } // compute for potential energy diff --git a/src/min.h b/src/min.h index 464018e825..021198bc09 100644 --- a/src/min.h +++ b/src/min.h @@ -123,6 +123,12 @@ Minimization requires that neigh_modify settings be delay = 0, every = changed them and will restore them to their original values after the minimization. +W: Energy due to X extra global DOFs will be included in minimizer energies + +When using fixes like box/relax, the potential energy used by the minimizer +is augmented by an additional energy provided by the fix. Thus the printed +converged energy may be different from the total potential energy. + E: Minimization could not find thermo_pe compute This compute is created by the thermo command. It must have been