Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
thsa committed Jun 28, 2024
1 parent 4b22b30 commit 4b0a1e9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/org/openmolecules/pdb/MMTFParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import java.nio.file.Paths;
import java.util.TreeMap;

@Deprecated // MMTF is not supported anymore by the PDB database from July 2nd, 2024 (a pity, because for us,
// it is much more useful than its more bulky replacement binaryCIF, because it included bonds!
public class MMTFParser {
public static final int MODE_DONT_SPLIT = 0;
public static final int MODE_SPLIT_MODELS = 1;
Expand Down Expand Up @@ -235,9 +237,22 @@ else if (mode == MODE_SPLIT_CHAINS) {
for (StereoMolecule mol:molecule)
mol.setName((mol.getName() == null ? "" : mol.getName() + " ") + new MolecularFormula(mol).getFormula());

for (StereoMolecule mol:molecule)
addMissingCharges(mol); // in some molecules quarternary nitrogen atoms are not charged, e.g. 8BXH

return molecule;
}

private static void addMissingCharges(StereoMolecule mol) {
mol.ensureHelperArrays(Molecule.cHelperNeighbours);
for (int atom=0; atom<mol.getAtoms(); atom++)
if (mol.getAtomicNo(atom) == 7
&& mol.getOccupiedValence(atom) == 4
&& mol.getAtomCharge(atom) == 0
&& mol.getAtomRadical(atom) == 0)
mol.setAtomCharge(atom, 1);
}

public static void centerMolecules(Molecule3D[] molecule) {
Coordinates cog = new Coordinates();
for (Molecule3D mol:molecule) {
Expand Down

0 comments on commit 4b0a1e9

Please sign in to comment.