@Test public void testGaussianCollections() { try { // GAUSSIAN collections for (int c = 0; c < collectionNames.length; c++) { String inputDir = TestCommon.TEST_DATA_DIR + "/gaussian/" + collectionNames[c]; System.out.println("Parsing GAUSSIAN experiment " + inputDir); ExperimentFactory factory = new ExperimentFactory(inputDir); LocalDirectory coll = factory.parseDirectoryForMetadata(Software.GAUSSIAN, null, null); MetadataAVUList md1 = coll.getMetadata(); logger.debug(md1.toString()); Assert.assertTrue( TestCommon.compareMetadataToExpected( md1, TestCommon.TEST_DATA_DIR + "/expected_metadata/gaussian/" + collectionNames[c] + ".metadata")); } } catch (Exception e) { e.printStackTrace(); assert (false); } }
@Test public void testGaussianOutputs() { try { LocalFileFactory ffactory = LocalFileFactory.instance(); // GAUSSIAN output files for (int f = 0; f < outputFileNames.length; f++) { String outputFile = TestCommon.TEST_DATA_DIR + "/gaussian/" + outputFileNames[f]; System.out.println("Parsing GAUSSIAN output file " + outputFile); GaussianOutputFile out = new GaussianOutputFile(outputFile); MetadataAVUList md1 = out.getMetadata(); logger.debug(md1.toString()); // extract SCF energy values and store to CSV GaussianUtils.extractEnergyFromLogFile( out, TestCommon.TEST_DATA_DIR + "/output/" + out.getName() + ".csv"); LocalFile inpGen = ffactory.getFile(outputFile, Software.GAUSSIAN); MetadataAVUList md2 = inpGen.getMetadata(); logger.debug(md2.toString()); Assert.assertTrue(TestCommon.compareMetadata(md1, md2)); Assert.assertTrue( TestCommon.compareMetadataToExpected( md1, TestCommon.TEST_DATA_DIR + "/expected_metadata/gaussian/" + outputFileNames[f] + ".metadata")); logger.debug("----------------------------------------"); } } catch (IllegalAccessException e) { e.printStackTrace(); assert (false); } catch (SecurityException e) { e.printStackTrace(); assert (false); } catch (IllegalArgumentException e) { e.printStackTrace(); assert (false); } catch (NoSuchFieldException e) { e.printStackTrace(); assert (false); } catch (IOException e) { e.printStackTrace(); assert (false); } catch (Exception e) { e.printStackTrace(); assert (false); } }
@Test public void testGaussianInputs() { try { LocalFileFactory ffactory = LocalFileFactory.instance(); // GAUSSIAN input files for (int f = 0; f < inputFileNames.length; f++) { String inputFile = TestCommon.TEST_DATA_DIR + "/gaussian/" + inputFileNames[f]; System.out.println("Parsing GAUSSIAN input file " + inputFile); GaussianInputFile inp = new GaussianInputFile(inputFile); MetadataAVUList md1 = inp.getMetadata(); logger.debug(md1.toString()); LocalFile inpGen = ffactory.getFile(inputFile, Software.GAUSSIAN); MetadataAVUList md2 = inpGen.getMetadata(); logger.debug(md2.toString()); Assert.assertTrue(TestCommon.compareMetadata(md1, md2)); // TestCommon.compareMetadataToExpected(md1, TestCommon.TEST_DATA_DIR + // "/expected_metadata/gaussian/" + inputFileNames[f] + ".metadata"); Assert.assertTrue( TestCommon.compareMetadataToExpected( md1, TestCommon.TEST_DATA_DIR + "/expected_metadata/gaussian/" + inputFileNames[f] + ".metadata")); logger.debug("----------------------------------------"); } } catch (IllegalAccessException e) { e.printStackTrace(); assert (false); } catch (SecurityException e) { e.printStackTrace(); assert (false); } catch (IllegalArgumentException e) { e.printStackTrace(); assert (false); } catch (NoSuchFieldException e) { e.printStackTrace(); assert (false); } catch (IOException e) { e.printStackTrace(); assert (false); } catch (Exception e) { e.printStackTrace(); assert (false); } }
/** * Get Gromacs collection metadata * * @throws Exception */ @Override public MetadataAVUList getMetadata() throws Exception { MetadataAVUList metadata = super.getMetadata(); // add aggregated metadata SummaryExperimentTasks tasksSummary = this.getExperimentTasksSummary(); if (tasksSummary != null) { metadata.addAll(tasksSummary.getMetadata()); } // default to MD if no method found if (!metadata.containsAttribute(MethodMetadata.COMPUTATIONAL_METHOD_NAME)) { metadata.add( new MetadataAVU(MethodMetadata.COMPUTATIONAL_METHOD_NAME, ParameterSet.METHOD_MD)); } // if no task found, default software name to AMBER if (!metadata.containsAttribute(PlatformMetadata.SOFTWARE_NAME)) metadata.add(new MetadataAVU(PlatformMetadata.SOFTWARE_NAME, Software.GROMACS)); // add topology info if (mainTopologyFile != null && mainTopologyFile.getMolecularSystems() != null && mainTopologyFile.getMolecularSystems().size() > 0) { MolecularSystem system = mainTopologyFile.getMolecularSystems().get(0); metadata.addAll(system.getMetadata()); if (!metadata.containsAttribute(MethodMetadata.SOLVENT_TYPE)) { // if water or ions are present, assume solvated system if (system.getIonCount() > 0 || system.getSolventMoleculeCount() > 0) metadata.updatePair(MethodMetadata.SOLVENT_TYPE, ParameterSet.SOLVENT_EXPLICIT); else metadata.add(new MetadataAVU(MethodMetadata.SOLVENT_TYPE, ParameterSet.SOLVENT_IN_VACUO)); } } return metadata; }