maeffplugin.cpp (pymol-open-source-2.2.0) | : | maeffplugin.cpp (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 802 | skipping to change at line 802 | |||
ival=atoi(value.c_str()); | ival=atoi(value.c_str()); | |||
} | } | |||
static void get_float(const std::string &value, float &fval) { | static void get_float(const std::string &value, float &fval) { | |||
fval=atof(value.c_str()); | fval=atof(value.c_str()); | |||
} | } | |||
}; | }; | |||
#define GET_STR( val_, arr_) do { get_str(val_, arr_, sizeof(arr_)); } while(0) | #define GET_STR( val_, arr_) do { get_str(val_, arr_, sizeof(arr_)); } while(0) | |||
class AtomArray : public Array { | class AtomArray : public Array { | |||
int i_name, i_resname, i_resid, i_x, i_y, i_z, i_vx, i_vy, i_vz, | int i_name, i_resname, i_resid, i_x, i_y, i_z, i_vx, i_vy, i_vz, | |||
i_inscode, | ||||
i_anum, i_chain, i_segid, i_charge; | i_anum, i_chain, i_segid, i_charge; | |||
std::vector<molfile_atom_t> &atoms; | std::vector<molfile_atom_t> &atoms; | |||
std::vector<pos_t> &pos; | std::vector<pos_t> &pos; | |||
std::vector<vel_t> &vel; | std::vector<vel_t> &vel; | |||
int &natoms; | int &natoms; | |||
public: | public: | |||
AtomArray(Handle *h_, int ct) | AtomArray(Handle *h_, int ct) | |||
: Array(h_, ct), | : Array(h_, ct), | |||
i_name(-1), i_resname(-1), i_resid(-1), | i_name(-1), i_resname(-1), i_resid(-1), | |||
i_x(-1), i_y(-1), i_z(-1), | i_x(-1), i_y(-1), i_z(-1), | |||
i_vx(-1), i_vy(-1), i_vz(-1), | i_vx(-1), i_vy(-1), i_vz(-1), | |||
i_inscode(-1), | ||||
i_anum(-1), i_chain(-1), i_segid(-1), | i_anum(-1), i_chain(-1), i_segid(-1), | |||
i_charge(0), | i_charge(0), | |||
atoms( h->ctmap[m_ct].particles ), | atoms( h->ctmap[m_ct].particles ), | |||
pos( h->ctmap[m_ct].position), | pos( h->ctmap[m_ct].position), | |||
vel( h->ctmap[m_ct].velocity), | vel( h->ctmap[m_ct].velocity), | |||
natoms( h->ctmap[m_ct].natoms ) | natoms( h->ctmap[m_ct].natoms ) | |||
{ | { | |||
h->optflags = MOLFILE_NOOPTIONS; // ensure initialization | h->optflags = MOLFILE_NOOPTIONS; // ensure initialization | |||
#if defined(DESRES_CTNUMBER) | #if defined(DESRES_CTNUMBER) | |||
h->optflags = MOLFILE_CTNUMBER; | h->optflags = MOLFILE_CTNUMBER; | |||
skipping to change at line 843 | skipping to change at line 845 | |||
else if (attr=="m_x_coord") i_x=i; | else if (attr=="m_x_coord") i_x=i; | |||
else if (attr=="m_y_coord") i_y=i; | else if (attr=="m_y_coord") i_y=i; | |||
else if (attr=="m_z_coord") i_z=i; | else if (attr=="m_z_coord") i_z=i; | |||
else if (attr=="ffio_x_vel") i_vx=i; | else if (attr=="ffio_x_vel") i_vx=i; | |||
else if (attr=="ffio_y_vel") i_vy=i; | else if (attr=="ffio_y_vel") i_vy=i; | |||
else if (attr=="ffio_z_vel") i_vz=i; | else if (attr=="ffio_z_vel") i_vz=i; | |||
else if (attr=="m_atomic_number") { i_anum=i; h->optflags |= MOLFILE_AT OMICNUMBER; } | else if (attr=="m_atomic_number") { i_anum=i; h->optflags |= MOLFILE_AT OMICNUMBER; } | |||
else if (attr=="m_chain_name") i_chain=i; | else if (attr=="m_chain_name") i_chain=i; | |||
else if (attr=="m_pdb_segment_name") i_segid=i; | else if (attr=="m_pdb_segment_name") i_segid=i; | |||
else if (attr=="m_formal_charge") { i_charge=i; h->optflags |= MOLFILE_ CHARGE; } | else if (attr=="m_formal_charge") { i_charge=i; h->optflags |= MOLFILE_ CHARGE; } | |||
else if (attr=="m_insertion_code") { i_inscode=i; } | ||||
} | } | |||
} | } | |||
virtual void insert_row(const Row &row) { | virtual void insert_row(const Row &row) { | |||
molfile_atom_t a; | molfile_atom_t a; | |||
memset(&a, 0, sizeof(molfile_atom_t)); | memset(&a, 0, sizeof(molfile_atom_t)); | |||
if (i_name>=0) GET_STR(row[i_name], a.name); | if (i_name>=0) GET_STR(row[i_name], a.name); | |||
if (i_name>=0) GET_STR(row[i_name], a.type); | if (i_name>=0) GET_STR(row[i_name], a.type); | |||
if (i_resname>=0) GET_STR(row[i_resname], a.resname); | if (i_resname>=0) GET_STR(row[i_resname], a.resname); | |||
if (i_resid>=0) get_int(row[i_resid], a.resid); | if (i_resid>=0) get_int(row[i_resid], a.resid); | |||
if (i_segid>=0) GET_STR(row[i_segid], a.segid); | if (i_segid>=0) GET_STR(row[i_segid], a.segid); | |||
if (i_chain>=0) GET_STR(row[i_chain], a.chain); | if (i_chain>=0) GET_STR(row[i_chain], a.chain); | |||
if (i_inscode>=0) GET_STR(row[i_inscode], a.insertion); | ||||
#if defined(DESRES_CTNUMBER) | #if defined(DESRES_CTNUMBER) | |||
a.ctnumber = m_ct; | a.ctnumber = m_ct; | |||
#endif | #endif | |||
if (i_anum>=0) get_int(row[i_anum], a.atomicnumber); | if (i_anum>=0) get_int(row[i_anum], a.atomicnumber); | |||
// if we didn't get an atom name, try to get one from the atomic number. | // if we didn't get an atom name, try to get one from the atomic number. | |||
bool bad_name=true; | bool bad_name=true; | |||
for (const char *p=a.name; *p; ++p) { | for (const char *p=a.name; *p; ++p) { | |||
if (!isspace(*p)) { | if (!isspace(*p)) { | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added |