-
atomList [accessing]
atomList isNil ifTrue: [atomList := OrderedCollection new].
^atomList
-
connectionList [accessing]
connectionList isNil ifTrue: [connectionList := OrderedCollection new].
^connectionList
-
defaultAtomObjectClass [defaults]
^self class defaultAtomObjectClass
-
defaultMoleculeObjectClass [defaults]
^self class defaultMoleculeObjectClass
-
initialize [initialize-release]
super initialize.
numberOfAtoms := nil.
numberOfConnections := nil.
atomList := nil.
connectionList := nil
-
moleculeObject [accessing]
^self class defaultMoleculeObjectClass fromReader: self
-
numberOfAtoms [accessing]
numberOfAtoms isNil ifTrue: [numberOfAtoms := 0].
^numberOfAtoms
-
numberOfConnections [accessing]
numberOfConnections isNil ifTrue: [numberOfConnections := 0].
^numberOfConnections
-
readAtomBlockFrom: aStream [reading]
numberOfAtoms timesRepeat:
[| line size string x y z atom point |
line := self getLine: aStream.
size := line size.
string := line copyFrom: (1 min: size) to: (10 min: size).
x := (string , 'd') asNumber.
string := line copyFrom: (11 min: size) to: (20 min: size).
y := (string , 'd') asNumber.
string := line copyFrom: (21 min: size) to: (30 min: size).
z := (string , 'd') asNumber.
string := line copyFrom: (32 min: size) to: (34 min: size).
[string first isSeparator]
whileTrue: [string := string copyFrom: 2 to: string size].
[string last isSeparator]
whileTrue: [string := string copyFrom: 1 to: string size - 1].
atom := string.
point := x , y , z.
self atomList add: (Array with: atom with: point)]
-
readBondBlockFrom: aStream [reading]
numberOfConnections timesRepeat:
[| line size string from to bond stereo |
line := self getLine: aStream.
size := line size.
string := line copyFrom: (1 min: size) to: (3 min: size).
from := string asNumber.
string := line copyFrom: (4 min: size) to: (6 min: size).
to := string asNumber.
string := line copyFrom: (7 min: size) to: (9 min: size).
bond := string asNumber.
string := line copyFrom: (10 min: size) to: (12 min: size).
stereo := string asNumber.
self connectionList add: (Array
with: from
with: to
with: bond
with: stereo)]
-
readCountsLineFrom: aStream [reading]
| line string |
line := self getLine: aStream.
string := line copyFrom: 1 to: 3.
numberOfAtoms := string asNumber.
string := line copyFrom: 4 to: 6.
numberOfConnections := string asNumber
-
readFrom: aStream [reading]
commentList := OrderedCollection new.
numberOfAtoms := 0.
numberOfConnections := 0.
atomList := nil.
connectionList := nil.
self readHeaderBlockFrom: aStream.
self readCountsLineFrom: aStream.
self readAtomBlockFrom: aStream.
self readBondBlockFrom: aStream.
self readPropertiesBlockFrom: aStream
-
readHeaderBlockFrom: aStream [reading]
| boolean position line collection |
boolean := true.
position := aStream position.
[aStream atEnd not and: [boolean]] whileTrue:
[position := aStream position.
line := self getLine: aStream.
collection := self separate: line dividers: self separators , 'Vv'.
(collection size >= 2 and:
[((collection at: 1) detect: [:c | c isDigit not] ifNone: [nil]) isNil
and: [((collection at: 2) detect: [:c | c isDigit not] ifNone: [nil]) isNil]])
ifTrue: [boolean := false]
ifFalse: [self commentList add: line]].
aStream position: position
-
readPropertiesBlockFrom: aStream [reading]
[aStream atEnd not] whileTrue:
[| aString aCollection |
aString := self getLine: aStream.
aCollection := self separate: aString.
(aCollection size >= 2
and: [(aCollection at: 1) = 'M' and: [(aCollection at: 2) = 'END']])
ifTrue: [^self]].
^self