@@ -2869,6 +2869,7 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
2869
2869
2870
2870
QString particle_type = " A" ; // A is for Atom
2871
2871
2872
+ // This is a dummy atom.
2872
2873
if (elem.nProtons () == 0 and lj.isDummy ())
2873
2874
{
2874
2875
if (is_perturbable)
@@ -2877,6 +2878,9 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
2877
2878
// Only label dummies for regular simulations.
2878
2879
else if (not was_perturbable)
2879
2880
particle_type = " D" ;
2881
+
2882
+ // Flag that we need to update the atoms.
2883
+ update_atoms0 = true ;
2880
2884
}
2881
2885
2882
2886
// This is a new atom type.
@@ -2893,6 +2897,15 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
2893
2897
2894
2898
// Hash the atom type against its parameter string, minus the type.
2895
2899
param_hash.insert (atomtypes[atomtype].mid (6 ), atomtype);
2900
+
2901
+ if (update_atoms0)
2902
+ {
2903
+ // Set the type.
2904
+ atom.setAtomType (atomtype);
2905
+
2906
+ // Update the atoms in the vector.
2907
+ atoms[i] = atom;
2908
+ }
2896
2909
}
2897
2910
// This type has been seen before.
2898
2911
else
@@ -2977,6 +2990,17 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
2977
2990
update_atoms0 = true ;
2978
2991
}
2979
2992
}
2993
+ else
2994
+ {
2995
+ if (update_atoms0)
2996
+ {
2997
+ // Set the type.
2998
+ atom.setAtomType (atomtype);
2999
+
3000
+ // Update the atoms in the vector.
3001
+ atoms[i] = atom;
3002
+ }
3003
+ }
2980
3004
}
2981
3005
}
2982
3006
@@ -3019,9 +3043,15 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
3019
3043
3020
3044
QString particle_type = " A" ; // A is for Atom
3021
3045
3046
+ // This is a dummy atom.
3022
3047
if (elem.nProtons () == 0 and lj.isDummy ())
3048
+ {
3023
3049
atomtype += " _du" ;
3024
3050
3051
+ // Flag that we need to update the atoms.
3052
+ update_atoms1 = true ;
3053
+ }
3054
+
3025
3055
// This is a new atom type.
3026
3056
if (not atomtypes.contains (atomtype))
3027
3057
{
@@ -3036,6 +3066,15 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
3036
3066
3037
3067
// Hash the atom type against its parameter string, minus the type.
3038
3068
param_hash.insert (atomtypes[atomtype].mid (6 ), atomtype);
3069
+
3070
+ if (update_atoms1)
3071
+ {
3072
+ // Set the type.
3073
+ atom.setAtomType (atomtype);
3074
+
3075
+ // Update the atoms in the vector.
3076
+ atoms[i] = atom;
3077
+ }
3039
3078
}
3040
3079
3041
3080
// This type has been seen before.
@@ -3121,6 +3160,17 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
3121
3160
update_atoms1 = true ;
3122
3161
}
3123
3162
}
3163
+ else
3164
+ {
3165
+ if (update_atoms1)
3166
+ {
3167
+ // Set the type.
3168
+ atom.setAtomType (atomtype);
3169
+
3170
+ // Update the atoms in the vector.
3171
+ atoms[i] = atom;
3172
+ }
3173
+ }
3124
3174
}
3125
3175
}
3126
3176
@@ -3217,14 +3267,6 @@ static QStringList writeMolType(const QString &name, const GroMolType &moltype,
3217
3267
elem1 = Element::elementWithMass (mol.property (" mass1" ).asA <AtomMasses>()[cgatomidx]);
3218
3268
}
3219
3269
3220
- // Update the atom types.
3221
-
3222
- if (elem0.nProtons () == 0 )
3223
- atomtype0 += " _du" ;
3224
-
3225
- if (elem1.nProtons () == 0 )
3226
- atomtype1 += " _du" ;
3227
-
3228
3270
QString resnum = QString::number (atom0.residueNumber ().value ());
3229
3271
3230
3272
if (not atom0.chainName ().isNull ())
0 commit comments