use of ffx.potential.parsers.ConversionFilter in project ffx by mjschnie.
the class MainPanel method convertInit.
/**
* Attempts to load from the supplied data structure
*
* @param data Data structure to load from
* @param file Source file
* @param commandDescription Description of the command that created this
* file.
* @return A thread-based UIDataConverter
*/
private UIDataConverter convertInit(Object data, File file, String commandDescription) {
if (data == null) {
return null;
}
// Create the CompositeConfiguration properties.
CompositeConfiguration properties = Keyword.loadProperties(file);
// Create an FFXSystem for this file.
FFXSystem newSystem = new FFXSystem(file, commandDescription, properties);
// Create a Force Field.
forceFieldFilter = new ForceFieldFilter(properties);
ForceField forceField = forceFieldFilter.parse();
String[] patches = properties.getStringArray("patch");
for (String patch : patches) {
logger.info(" Attempting to read force field patch from " + patch + ".");
CompositeConfiguration patchConfiguration = new CompositeConfiguration();
patchConfiguration.addProperty("parameters", patch);
forceFieldFilter = new ForceFieldFilter(patchConfiguration);
ForceField patchForceField = forceFieldFilter.parse();
forceField.append(patchForceField);
if (RotamerLibrary.addRotPatch(patch)) {
logger.info(String.format(" Loaded rotamer definitions from patch %s.", patch));
}
}
newSystem.setForceField(forceField);
ConversionFilter convFilter = null;
// Decide what parser to use.
if (biojavaDataFilter.accept(data)) {
convFilter = new BiojavaFilter((Structure) data, newSystem, forceField, properties);
} else {
throw new IllegalArgumentException("Not a recognized data structure.");
}
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
activeConvFilter = convFilter;
return new UIDataConverter(data, file, convFilter, this);
}
Aggregations