00001 #ifndef NANOSHAPERINTERFACE_H 00002 #define NANOSHAPERINTERFACE_H 00003 00004 /*************************************************************************** 00005 *cr 00006 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00007 *cr University of Illinois 00008 *cr All Rights Reserved 00009 *cr 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * RCS INFORMATION: 00014 * 00015 * $RCSfile: NanoShaperInterface.h,v $ 00016 * $Author: johns $ $Locker: $ $State: Exp $ 00017 * $Revision: 1.7 $ $Date: 2019年01月17日 21:21:00 $ 00018 * 00019 *************************************************************************** 00020 * DESCRIPTION: 00021 * Communicate with the NanoShaper surface generation program. For more 00022 * information about NanoShaper, please see: 00023 * 00024 ***************************************************************************/ 00025 00026 // NanoShaper surface generation process: 00027 // Send coords and get back surface information 00028 // Pass this data to NanoShaper server: 00029 // index, x, y, z, radius 00030 // 00031 // NanoShaper server returns this data: 00032 // face list containing 3 vertex points each 00033 // atomid, as mapped to input values 00034 // position list containing x, y, z 00035 // norm list containing normx, normy, normz 00036 00037 #include "ResizeArray.h" 00038 00040 struct NanoShaperCoord { 00041 float x[3]; 00042 int operator==(const NanoShaperCoord& c) { 00043 return !memcmp(x, c.x, 3L*sizeof(float)); 00044 } 00045 }; 00046 00048 struct NanoShaperFace { 00049 int vertex[3]; 00050 00051 int surface_type; 00052 00053 00054 00055 int anaface; 00056 00057 00058 int component; 00059 00060 int operator==(const NanoShaperFace &f) { 00061 return (!memcmp(vertex, f.vertex, 3L*sizeof(float)) && 00062 surface_type==f.surface_type && anaface==f.anaface && 00063 component==f.component); 00064 } 00065 }; 00066 00069 class NanoShaperInterface { 00070 public: 00072 enum {BAD_RANGE = -2, NO_PORTS = -3, NO_CONNECTION = -4, 00073 NO_INITIALIZATION = -5, NANOSHAPER_DIED = -6, COMPUTED = 1}; 00074 00075 enum {NS_SURF_SES = 0, 00076 NS_SURF_SKIN = 1, 00077 NS_SURF_BLOBBY = 2, 00078 NS_SURF_POCKETS = 3}; 00079 00081 void clear(); 00082 00083 // use file interface instead of sockets 00084 int compute_from_file(int surftype, float gspacing, 00085 float probe_radius, float skin_parm, float blob_parm, 00086 int n, int *ids, float *xyzr, int *flgs); 00087 00088 int err; 00089 NanoShaperInterface(void) { err = 0; } 00090 ResizeArray<int> atomids; 00091 ResizeArray<NanoShaperFace> faces; 00092 ResizeArray<NanoShaperCoord> coords; 00093 ResizeArray<NanoShaperCoord> norms; 00094 }; 00095 00096 #endif 00097