diff --git a/parser/parser-lammps/LammpsDataParser.py b/parser/parser-lammps/LammpsDataParser.py index f59aafe728e58b685776bb531fb13a2204c4d4f6..54eefaaf7f2cf387603dea0fc51beddf29538f2f 100644 --- a/parser/parser-lammps/LammpsDataParser.py +++ b/parser/parser-lammps/LammpsDataParser.py @@ -51,11 +51,12 @@ class LammpsDataParserContext(object): section: The cached values and sections that were found in the section that is closed. """ - def __init__(self, writeMetaData=True): + def __init__(self, converter, writeMetaData=True): """Args: writeMetaData: Determines if metadata is written or stored in class attributes. """ self.parser = None + self.converter = converter self.writeMetaData = writeMetaData def startedParsing(self, fInName, parser): @@ -1069,6 +1070,22 @@ class LammpsDataParserContext(object): ######################################################################################################################## def readBondsFromData(self, bond_list, bondFunctional): + toMass = self.converter.ratioMass + toDistance = self.converter.ratioDistance + toTime = self.converter.ratioTime + toEnergy = self.converter.ratioEnergy + toVelocity = self.converter.ratioVelocity + toForce = self.converter.ratioForce + toTorque = self.converter.ratioTorque + toTemp = self.converter.ratioTemp + toPress = self.converter.ratioPress + toDVisc = self.converter.ratioDVisc + toCharge = self.converter.ratioCharge + toDipole = self.converter.ratioDipole + toEField = self.converter.ratioEField + toDensity = self.converter.ratioDensity + + list_of_bonds={} for line in bond_list: @@ -1122,6 +1139,24 @@ class LammpsDataParserContext(object): ######################################################################################################################## def readAnglesFromData(self, angle_list, angleFunctional): + toMass = self.converter.ratioMass + toDistance = self.converter.ratioDistance + toTime = self.converter.ratioTime + toEnergy = self.converter.ratioEnergy + toVelocity = self.converter.ratioVelocity + toForce = self.converter.ratioForce + toTorque = self.converter.ratioTorque + toTemp = self.converter.ratioTemp + toPress = self.converter.ratioPress + toDVisc = self.converter.ratioDVisc + toCharge = self.converter.ratioCharge + toDipole = self.converter.ratioDipole + toEField = self.converter.ratioEField + toDensity = self.converter.ratioDensity + + toRadians = 0.0174533 # multiply to convert deg to rad + + list_of_angles={} for line in angle_list: @@ -1191,6 +1226,23 @@ class LammpsDataParserContext(object): ######################################################################################################################## def readDihedralsFromData(self, dihedral_list, dihedralFunctional): + toMass = self.converter.ratioMass + toDistance = self.converter.ratioDistance + toTime = self.converter.ratioTime + toEnergy = self.converter.ratioEnergy + toVelocity = self.converter.ratioVelocity + toForce = self.converter.ratioForce + toTorque = self.converter.ratioTorque + toTemp = self.converter.ratioTemp + toPress = self.converter.ratioPress + toDVisc = self.converter.ratioDVisc + toCharge = self.converter.ratioCharge + toDipole = self.converter.ratioDipole + toEField = self.converter.ratioEField + toDensity = self.converter.ratioDensity + + toRadians = 0.0174533 # multiply to convert deg to rad + list_of_dihedrals={} for line in dihedral_list: @@ -1264,6 +1316,22 @@ class LammpsDataParserContext(object): ######################################################################################################################## def readPairCoeffFromData(self, lj_list, updateAtomTypes, pairFunctional): + toMass = self.converter.ratioMass + toDistance = self.converter.ratioDistance + toTime = self.converter.ratioTime + toEnergy = self.converter.ratioEnergy + toVelocity = self.converter.ratioVelocity + toForce = self.converter.ratioForce + toTorque = self.converter.ratioTorque + toTemp = self.converter.ratioTemp + toPress = self.converter.ratioPress + toDVisc = self.converter.ratioDVisc + toCharge = self.converter.ratioCharge + toDipole = self.converter.ratioDipole + toEField = self.converter.ratioEField + toDensity = self.converter.ratioDensity + + # this currently gather pair coefficients for pairFunctional reported in the list of strings below supportedLJFunct = ['lj/cut', 'lj/cut/coul/cut', 'lj/cut/coul/long', 'lj/cut/coul/debye', diff --git a/parser/parser-lammps/LammpsLogParser.py b/parser/parser-lammps/LammpsLogParser.py index 547ea1dd91e90e6c4a29bf82566503260a16228e..1d10038446c4e8eb700002157a56c3cefba9b419 100644 --- a/parser/parser-lammps/LammpsLogParser.py +++ b/parser/parser-lammps/LammpsLogParser.py @@ -430,7 +430,7 @@ class LammpsMainParser(MainHierarchicalParser): def compile_data_parser(self): """Instantiate superContext and construct parser for external data file. """ - self.dataSuperContext = LammpsDataParser.LammpsDataParserContext(False) + self.dataSuperContext = LammpsDataParser.LammpsDataParserContext(converter=self.converter, writeMetaData=False) self.dataParser = AncillaryParser( fileDescription=LammpsDataParser.build_LammpsDataFileSimpleMatcher(), parser=self.parser,