Skip to content

Commit

Permalink
More logging improvements to MMFF94PartialCharges
Browse files Browse the repository at this point in the history
Signed-off-by: John May <john.wilkinsonmay@gmail.com>
  • Loading branch information
mjw99 authored and johnmay committed Jul 7, 2014
1 parent e2fbf4f commit 2b1d50e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Expand Up @@ -96,6 +96,9 @@ public IAtomContainer assignMMFF94PartialCharges(IAtomContainer ac) throws Excep
thisAtom = atoms.next();
LOG.debug("Assigning MMFF94 Charge for atom " + thisAtom.getAtomTypeName());
data = parameterSet.get("data" + thisAtom.getAtomTypeName());
LOG.debug("Atom data:");
LOG.debug("WellD, Apol, Neff, DA, q, pbci, A_i, G_i");
LOG.debug(data);
neighboors = ac.getConnectedAtomsList(thisAtom);
LOG.debug("Atom has " + neighboors.size() + " neighbour(s)");
formalCharge = thisAtom.getCharge();
Expand Down
Expand Up @@ -39,6 +39,7 @@
import java.util.StringTokenizer;
import java.util.Vector;

import org.apache.log4j.Logger;
import org.openscience.cdk.config.Isotopes;
import org.openscience.cdk.interfaces.IAtomType;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
Expand All @@ -58,6 +59,8 @@
*/
public class MMFF94BasedParameterSetReader {

private final Logger LOG = Logger.getLogger(MMFF94BasedParameterSetReader.class);

private String configFile = "org/openscience/cdk/modeling/forcefield/data/mmff94.prm";
private InputStream ins = null;
private Map<String,Object> parameterSet;
Expand Down Expand Up @@ -147,7 +150,7 @@ private void setAtomTypeData() throws Exception {
throw new IOException("Data: Malformed Number due to:"+nfe);
}

//logger.debug("data : " + data);
LOG.debug("data : well,apol,Neff,sDA,fcadj,spbci,a,g " + data);
parameterSet.put(key, data);

key="vdw"+sid;
Expand All @@ -157,7 +160,7 @@ private void setAtomTypeData() throws Exception {
data.add(new Double(radius));

}catch (NumberFormatException nfe2) {
// logger.debug("vdwError: Malformed Number due to:"+nfe2);
LOG.debug("vdwError: Malformed Number due to:"+nfe2);
}
parameterSet.put(key, data);

Expand Down Expand Up @@ -328,7 +331,7 @@ private void setStrBnd() throws Exception {
throw new IOException("setStrBnd: Malformed Number due to:"+nfe);
}
key = "strbnd" + scode + ";" + sid1 + ";" + sid2 + ";" + sid3;
//logger.debug("key =" + key);
LOG.debug("key =" + key);
parameterSet.put(key, data);
}

Expand Down Expand Up @@ -359,15 +362,15 @@ private void setTorsion() throws Exception {
double va5 = new Double(value5).doubleValue();

key = "torsion" + scode + ";" + sid1 + ";" + sid2 + ";" + sid3 + ";" + sid4;
//logger.debug("key = " + key);
LOG.debug("key = " + key);
if (parameterSet.containsKey(key)) {
data = (Vector) parameterSet.get(key);
data.add(new Double(va1));
data.add(new Double(va2));
data.add(new Double(va3));
data.add(new Double(va4));
data.add(new Double(va5));
//logger.debug("data = " + data);
LOG.debug("data = " + data);
}
else{
data = new Vector();
Expand All @@ -376,7 +379,7 @@ private void setTorsion() throws Exception {
data.add(new Double(va3));
data.add(new Double(va4));
data.add(new Double(va5));
//logger.debug("data = " + data);
LOG.debug("data = " + data);
}

parameterSet.put(key, data);
Expand Down Expand Up @@ -422,7 +425,7 @@ private void setOpBend() throws Exception {
* @exception Exception Description of the Exception
*/
private void setDefaultStrBnd() throws Exception {
//logger.debug("Sets the Default Stretch-Bend Parameters");
LOG.debug("Sets the Default Stretch-Bend Parameters");
List data = new Vector();
stDFSB.nextToken();
String sIR = stDFSB.nextToken();
Expand Down Expand Up @@ -452,7 +455,7 @@ private void setDefaultStrBnd() throws Exception {
*/
public void readParameterSets(IChemObjectBuilder builder) throws Exception {
//vdW,bond,angle,strbond,opbend,torsion,data
//logger.debug("------ Read MMFF94 ParameterSets ------");
LOG.debug("------ Read MMFF94 ParameterSets ------");

if (ins == null) {
ClassLoader loader = this.getClass().getClassLoader();
Expand Down Expand Up @@ -524,7 +527,7 @@ public void readParameterSets(IChemObjectBuilder builder) throws Exception {
}
stvdW = new StringTokenizer(svdW,"\t; ");
ntvdW = stvdW.countTokens();
//logger.debug("ntvdW : " + ntvdW);
LOG.debug("ntvdW : " + ntvdW);
if (svdW.startsWith("vdw") & ntvdW == 9) {
st.nextToken();
sid = st.nextToken();
Expand All @@ -547,23 +550,23 @@ public void readParameterSets(IChemObjectBuilder builder) throws Exception {
}

try {
//logger.debug("Parses the Default Stretch-Bend Parameters");
LOG.debug("Parses the Default Stretch-Bend Parameters");
while (true) {
sDFSB = rDFSB.readLine();
//logger.debug("sDFSB = " + sDFSB);
LOG.debug("sDFSB = " + sDFSB);
if (sDFSB == null) {
//logger.debug("sDFSB == null, break");
LOG.debug("sDFSB == null, break");
break;
}
stDFSB = new StringTokenizer(sDFSB,"\t; ");
ntDFSB = stDFSB.countTokens();
//logger.debug("ntDFSB : " + ntDFSB);
LOG.debug("ntDFSB : " + ntDFSB);
if (sDFSB.startsWith("DFSB") & ntDFSB == 6) {
setDefaultStrBnd();
}
}
insDFSB.close();
//logger.debug("insDFSB closed");
LOG.debug("insDFSB closed");
} catch (IOException e) {
throw new IOException("There was a problem parsing the Default Stretch-Bend Parameters (mmffdfsb.par)");
}
Expand Down

0 comments on commit 2b1d50e

Please sign in to comment.