| version 1.1265 | version 1.1266 |
|---|
| |
| | |
| void Molecule::plgLoadDihedrals(int *plgDihedrals) | void Molecule::plgLoadDihedrals(int *plgDihedrals) |
| { | { |
| char atom1name[11]; | std::map< std::string, int > cache; |
| char atom2name[11]; | |
| char atom3name[11]; | |
| char atom4name[11]; | |
| int lastAtomIds[4]; | int lastAtomIds[4]; |
| int multiplicity = 1; //multiplicity of the current bond | int multiplicity = 1; //multiplicity of the current bond |
| | |
| |
| lastAtomIds[j] = atomid[j]; | lastAtomIds[j] = atomid[j]; |
| } | } |
| | |
| strcpy(atom1name, atomNames[atomid[0]-1].atomtype); | |
| strcpy(atom2name, atomNames[atomid[1]-1].atomtype); | |
| strcpy(atom3name, atomNames[atomid[2]-1].atomtype); | |
| strcpy(atom4name, atomNames[atomid[3]-1].atomtype); | |
| | |
| if(duplicate_bond) { | if(duplicate_bond) { |
| multiplicity++; | multiplicity++; |
| if(multiplicity==2) { | if(multiplicity==2) { |
| |
| thisDihedral->atom3 = atomid[2]-1; | thisDihedral->atom3 = atomid[2]-1; |
| thisDihedral->atom4 = atomid[3]-1; | thisDihedral->atom4 = atomid[3]-1; |
| | |
| | char query[128]; |
| | sprintf(query,"%10s :: %10s :: %10s :: %10s :: %d", |
| | atomNames[atomid[0]-1].atomtype, |
| | atomNames[atomid[1]-1].atomtype, |
| | atomNames[atomid[2]-1].atomtype, |
| | atomNames[atomid[3]-1].atomtype, |
| | multiplicity); |
| | auto search = cache.find(query); |
| | if ( search != cache.end() ) { |
| | thisDihedral->dihedral_type = search->second; |
| | } else { |
| | char atom1name[11]; |
| | char atom2name[11]; |
| | char atom3name[11]; |
| | char atom4name[11]; |
| | strcpy(atom1name, atomNames[atomid[0]-1].atomtype); |
| | strcpy(atom2name, atomNames[atomid[1]-1].atomtype); |
| | strcpy(atom3name, atomNames[atomid[2]-1].atomtype); |
| | strcpy(atom4name, atomNames[atomid[3]-1].atomtype); |
| | |
| params->assign_dihedral_index(atom1name, atom2name, | params->assign_dihedral_index(atom1name, atom2name, |
| atom3name, atom4name, thisDihedral, | atom3name, atom4name, thisDihedral, |
| multiplicity, simParams->alchOn ? -1 : 0); | multiplicity, simParams->alchOn ? -1 : 0); |
| |
| iout << iWARN << "ALCHEMY MODULE WILL REMOVE DIHEDRAL OR RAISE ERROR\n" | iout << iWARN << "ALCHEMY MODULE WILL REMOVE DIHEDRAL OR RAISE ERROR\n" |
| << endi; | << endi; |
| } | } |
| | cache[query] = thisDihedral->dihedral_type; |
| | } |
| } | } |
| | |
| numDihedrals = numRealDihedrals; | numDihedrals = numRealDihedrals; |